aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sound/soc/sunxi (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-11-30ASoC: sun4i-codec: Add support for H3 codecChen-Yu Tsai1-0/+71
The codec on the H3 is similar to the one found on the A31. One key difference is the analog path controls are routed through the PRCM block. This is supported by the sun8i-codec-analog driver, and tied into this codec driver with the audio card's aux_dev. In addition, the H3 has no HP (headphone) and HBIAS support, and no MIC3 input. The FIFO related registers are slightly rearranged. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Rob Herring <robh@kernel.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-30ASoC: sun4i-codec: Add support for A23 codecChen-Yu Tsai1-0/+108
The codec in the A23 is similar to the one found on the A31. One key difference is the analog path controls are routed through the PRCM block. This is supported by the sun8i-codec-analog driver, and tied into this codec driver with the audio card's aux_dev. In addition, the A23 does not have LINEOUT, and it does not support headset jack detection or buttons. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Rob Herring <robh@kernel.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-24ASoC: sunxi: Uninitialized variable in probe()Dan Carpenter1-1/+1
Oddly enough, my version of GCC misses this uninitialized variable. Fixes: ba2ff3027b5a ("ASoC: sunxi: Add support for A23/A33/H3 codec's analog path controls") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-22ASoC: sunxi: Add support for A23/A33/H3 codec's analog path controlsChen-Yu Tsai3-0/+674
The internal codec on A23/A33/H3 is split into 2 parts. The analog path controls are routed through an embedded custom register bus accessed through the PRCM block. The SoCs share a common set of inputs, outputs, and audio paths. The following table lists the differences. ---------------------------------------- | Feature \ SoC | A23 | A33 | H3 | ---------------------------------------- | Headphone | v | v | | ---------------------------------------- | Line Out | | | v | ---------------------------------------- | Phone In/Out | v | v | | ---------------------------------------- Add an ASoC component driver for it. This should be tied to the codec audio card as an auxiliary device. This patch adds the commont paths and controls, and variant specific headphone out and line out. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-10ASoC: sun4i-codec: fix semicolon.cocci warningskbuild test robot1-1/+1
sound/soc/sunxi/sun4i-codec.c:1339:2-3: Unneeded semicolon Remove unneeded semicolon. Generated by: scripts/coccinelle/misc/semicolon.cocci Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Acked-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-09ASoC: sun4i-codec: Add support for optional reset control to quirksChen-Yu Tsai1-1/+27
The later Allwinner SoCs have a dedicated reset controller, and peripherals have dedicated reset controls which need to be deasserted before the associated peripheral can be used. Add support for this to the quirks structure and probe/remove functions. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-09ASoC: sun4i-codec: Add support for A31 ADC capture pathChen-Yu Tsai1-0/+65
The A31's internal codec capture path has a mixer in front of the ADC for each channel, capable of selecting various inputs, including microphones, line in, phone in, and the main output mixer. This patch adds the various controls, widgets and routes needed for audio capture from the already supported inputs on the A31. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-09ASoC: sunxi: i2s: Implement set_sysclkMaxime Ripard1-15/+38
In our i2s driver, we were previously trying to guess which oversample the user wanted to use by looking at the rate and trying to max it. However, the cards, and especially simple-card with its mclk-fs property will already provide the expected oversample ratio by using the set_sysclk callback. We can thus implement it and remove the logic to deal with the runtime guess. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-04ASoC: sun4i-codec: Add support for A31 board level audio routingChen-Yu Tsai1-2/+19
The A31 SoC's codec has various inputs, outputs and microphone bias supplies. These can be routed on the board in different ways, such as: - HPCOM may be connected to have the headphone DC coupled. - Microphones all use the MBIAS main microphone supply or one mic may use the HBIAS supply, which supports headset detection and buttons. - Line Out may be routed to an audio jack, or an onboard speaker amp with power controls. Add support for specifying the audio routes in the device tree. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-04ASoC: sun4i-codec: Add support for A31 analog microphone inputsChen-Yu Tsai1-0/+70
The A31 internal codec has 3 microphone outputs, of which MIC2 and MIC3 are muxed internally. The resulting two microphone inputs have separate gain controls and mixer inputs. The codec also has 2 microphone bias pins. HBIAS is specifically for the headphone jack, which also supports headphone detection and control buttons. These extra functions are not supported yet. The other, MBIAS, is for all other analog microphones. There is also mention of digital microphone support, but documentation is scarce, and no hardware with it is available. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-04ASoC: sun4i-codec: Add support for A31 Line Out playbackChen-Yu Tsai1-0/+39
The A31 integrated codec has a second "Line Out" output which does not include an integrated amplifier in its path. This path does have a separate volume control. This patch adds support for the playback path from the DAC to the Line Out pins. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-03ASoC: sun4i-codec: Add support for A31 Line In playbackChen-Yu Tsai1-0/+15
The A31 integrated codec has a stereo "Line In" input. Add support for it to the playback paths. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-03ASoC: sun4i-codec: Add support for A31 playback through headphone outputChen-Yu Tsai1-4/+267
The A31 has a similar codec to the A10/A20. The PCM parts are very similar, with different register offsets. The analog paths are very different. There are more inputs and outputs. The ADC mux has been replaced with a proper mixer. This patch adds support for the basic playback path of the A31 codec, from the DAC to the headphones. Headphone detection, microphone, signaling, other inputs/outputs and capture will be added later. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-03ASoC: sun4i-codec: Increase DMA max burst to 8Chen-Yu Tsai1-2/+2
According to the DMA engine API documentation, maxburst denotes the largest possible size of a single transfer, so as not to overflow destination FIFOs as explained in this excerpt from dmaengine.h * @src_maxburst: the maximum number of words (note: words, as in * units of the src_addr_width member, not bytes) that can be sent * in one burst to the device. Typically something like half the * FIFO depth on I/O peripherals so you don't overflow it. This * may or may not be applicable on memory sources. * @dst_maxburst: same as src_maxburst but for destination target * mutatis mutandis. The TX FIFO is 64 samples deep for stereo, and the RX FIFO is 16 samples deep. So maxburst could be 32 and 8 for TX and RX respectively. Unfortunately the sunxi DMA controller driver takes maxburst as the requested burst size, rather than a limit, and returns an error for unsupported values. The original value was 4, but some later SoCs do not officially support this burst size. This patch increases maxburst on the TX side to 8, which is supported by all variants of the sunxi DMA controller. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-03ASoC: sun4i-codec: Expand quirks to handle register offsets and card creationChen-Yu Tsai1-27/+60
The A31 has a similar codec to the A10/A20. The PCM parts are very similar, with just different register offsets. The analog paths are very different. There are more inputs and outputs. The A31s, A23, and H3 have a similar PCM interface, again with register offsets slightly rearranged. The analog path controls, while very similar between them and the A31, have been moved a separate bus which is accessed through a message box like interface in the PRCM address range. This would be handled by a separate auxiliary device tied in through the device tree in its supporting create_card function. The quirks structure is expanded to include different register offsets and separate callbacks for creating the ASoC card. The regmap_config, quirks, and of_device_match tables have been moved to facilitate this. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-03Merge branch 'fix/sunxi' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-sunxiMark Brown1-6/+6
2016-11-03ASoC: sun4i-codec: Revise comments for register definition macrosChen-Yu Tsai1-3/+11
This revises existing comments in the register definition macros section, and adds a few more, so that readers can clearly identify the types of control registers. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-03ASoC: sun4i-codec: Move data structures to add create_card call to quirksChen-Yu Tsai1-39/+39
The audio codec on later Allwinner SoCs have a different layout and audio path compared to the A10/A20. However the PCM parts are still the same. The different layout and audio paths mean we need a different create_card function for different families, so they can create DAPM endpoint widgets and routes. This patch moves the regmap configs, quirks and of_device_id structures to just before the probe function, so we can, among other things, include a pointer for the create_card function. None of the lines of code were changed. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-03ASoC: sun4i-i2s: Implement capture supportMaxime Ripard1-3/+49
The i2s driver was only implementing playback for now. Implement capture to make sure that's not a limitation anymore. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-01ASoC: sun4i-codec: Enable bus clock after getting GPIOChen-Yu Tsai1-6/+6
In the current probe function the GPIO is acquired after the codec's bus clock is enabled. However if it fails to acquire the GPIO due to a deferred probe, it does not disable the bus clock before bailing out. This would result in the clock being enabled multiple times. Move the code that enables the bus clock after the part that gets the GPIO, maintaining a separation between resource acquisition and device enablement in the probe function. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-31ASoC: sun4i-codec: return error code instead of NULL when create_card failsChen-Yu Tsai1-3/+4
When sun4i_codec_create_card fails, we do not assign a proper error code to the return value. The return value would be 0 from the previous function call, or we would have bailed out sooner. This would confuse the driver core into thinking the device probe succeeded, when in fact it didn't, leaving various devres based resources lingering. Make the create_card function pass back a meaningful error code, and assign it to the return value. Fixes: 45fb6b6f2aa3 ("ASoC: sunxi: add support for the on-chip codec on early Allwinner SoCs") Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-26ASoC: sun4i-codec: Rename sun4i_codec_widgets for consistencyDanny Milosavljevic1-3/+3
Rename "sun4i_codec_widgets" to "sun4i_codec_controls" for consistency with the struct field name. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-26Merge branch 'topic/codec-component' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-sunxiMark Brown1-6/+8
2016-09-24ASoC: sun4i-codec: Add custom regmap configsDanny Milosavljevic1-3/+35
The A20 has a few extra registers that the A10 doesn't have. Therefore, use different regmaps for A10 as compared to A20. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-24ASoC: sun4i-codec: Rename some sun7i-only registersDanny Milosavljevic1-3/+3
Some of the registers defined in the driver are only usable on the A20. Rename these registers. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-24ASoC: sunxi: depend on ARCH_SUNXIPeter Robinson1-0/+1
Depend on ARCH_SUNXI or COMPILE_TEST as it doesn't make sense to enable these if the appropriate SoC they're embedded in isn't enabled. Signed-off-by: Peter Robinson <pbrobinson@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-12ASoC: sunxi: compatibility for sun6i to SPDIFMarcus Cooper1-1/+16
The A31 SoC uses the same SPDIF block as found in earlier SoCs, but its reset is controlled via a separate reset controller. The DMA also complains when the maxburst is set to 4 so it's been adjusted to 8 which suites both the older and newer SoCs. Signed-off-by: Marcus Cooper <codekipper@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-08ASoC: codec duplicated callback function goes to component on sun4i-codecKuninori Morimoto1-6/+8
codec driver and component driver has duplicated callback functions, and codec side functions are just copied to component side when register timing. This was quick-hack, but no longer needed. This patch moves these functions from codec driver to component driver. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-07-04ASoC: sunxi: remove redundant dev_err call in sun4i_i2s_probe()Wei Yongjun1-3/+1
There is a error message within devm_ioremap_resource already, so remove the dev_err call to avoid redundant error message. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-07-01ASoC: sunxi: fix semicolon.cocci warningskbuild test robot1-1/+1
sound/soc/sunxi/sun4i-i2s.c:624:2-3: Unneeded semicolon Remove unneeded semicolon. Generated by: scripts/coccinelle/misc/semicolon.cocci Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-06-29ASoC: sunxi: Add Allwinner A10 Digital Audio driverMaxime Ripard3-1/+713
The Allwinner A10 and later come with a hardware block that used for the PCM and I2S interfaces. Add a driver for it in ASoC. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Tested-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-20ASoC: sunxi: Add support for the SPDIF blockMarcus Cooper3-0/+559
The sun4i, sun5i and sun7i SoC families have an SPDIF block which is capable of playback and capture. This patch enables the playback of this block for the sun4i families. Signed-off-by: Marcus Cooper <codekipper@gmail.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-22ASoC: sun4i-codec: Use proper output for external amp routesHans de Goede1-1/+2
An external amp (if any) is connected to the external outputs of the SoC of course, rather then directly to the internal amp. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-12ASoC: sun4i-codec: Add support for PA gpio pinHans de Goede1-0/+35
Add support for PA gpio pin for controlling an external amplifier as used on some Allwinner boards. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-12ASoC: sun4i-codec: Rename codec dapm widgets and routesHans de Goede1-6/+6
Rename the codec dapm widgets and routes with a _codec prefix. This is a preparation patch for adding card dapm widgets and routes. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-02Merge branch 'fix/sun4i-codec' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-sunxiMark Brown1-13/+14
2015-12-01ASoC: sun4i-codec: pass through clk_set_rate errorMaxime Ripard1-3/+4
Commit 1fb34b48361e ('ASoC: sun4i: Implement MIC1 capture') added back some code that disregards the clk_set_rate error code and always returns -EINVAL. Fix that and return the code in order to have more clue about what's going on. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-01ASoC: sunxi: Remove useless comments and variableMaxime Ripard1-22/+0
The comment is misleading on how we should support external power amps, and the variable is not used and generates a warning. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-30ASoC: sun4i: Implement MIC1 captureMaxime Ripard1-31/+197
One of the input path used in the Allwinner codec is the MIC1. Add support for it. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-05ASoC: sun4i-codec: use consistent names for PA controlsAdam Sampson1-13/+14
The power amplifier for the headphone output is called "the PA" and "the headphone amplifier" in Allwinner's documentation for the A10 and A20. sun4i-codec calls it "PA" in some places and "Pre-Amplifier" (which isn't really accurate) in others, leading to user-visible controls with different names referring to the same device. When this driver implements audio input, it'll also need to expose controls for the line and mic input preamps, so just referring to "the Pre-Amplifier" will be ambiguous. Change it to use "Power Amplifier" consistently for the power amplifier's controls. Signed-off-by: Adam Sampson <ats@offog.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-07ASoC: sun4i-codec: Remove the routing propertyMaxime Ripard1-7/+0
Most of the boards have their headphone jack directly connected to the matching pins of the SoCs. Since most of the time we will have the same routing path, it makes no sense to put that in the DTS, since it will only be some useless duplication there. It also fixes the following warning messages that were seen so far, on boards where we were using the bindings in the documentation example. sun4i-codec 1c22c00.codec: ASoC: no sink widget found for Headphone Jack sun4i-codec 1c22c00.codec: ASoC: Failed to add route HP Left -> direct -> Headphone Jack sun4i-codec 1c22c00.codec: ASoC: no sink widget found for Headphone Jack sun4i-codec 1c22c00.codec: ASoC: Failed to add route HP Right -> direct -> Headphone Jack Reported-by: Priit Laes <plaes@plaes.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-30ASoC: sun4i-codec: Remove redundant SND_PCM_RATE_KNOTMaxime Ripard1-2/+1
The SND_PCM_RATE_KNOT covers all the rate settings, even though some that we don't support, while we also list all the rate we support. Simply remove it. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-30ASoC: sun4i-codec: pass through clk_set_rate errorMaxime Ripard1-3/+4
The current code, disregarding the clk_set_rate error code, was always returning -EINVAL. Fix that and return the code in order to have more clue about what's going on. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-17ASoC: sunxi: fix platform_no_drv_owner.cocci warningskbuild test robot1-1/+0
sound/soc/sunxi/sun4i-codec.c:708:3-8: No need to set .owner here. The core will do it. Remove .owner field if calls are used which set it automatically Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci CC: Emilio López <emilio@elopez.com.ar> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-16ASoC: sunxi: add support for the on-chip codec on early Allwinner SoCsEmilio López3-0/+733
The sun4i, sun5i and sun7i SoC families have a built-in codec, capable of both audio capture and playback. While this is called a codec by Allwinner, it really is an in-SoC combination of a codec and a DAI, with its own DAC/ADC and amplifiers in a single memory-mapped controller. The capture part has been left out for now, and will be added eventually. Signed-off-by: Emilio López <emilio@elopez.com.ar> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>