summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/twl4030.c
AgeCommit message (Collapse)Author
2014-03-12Merge remote-tracking branches 'asoc/topic/tlv320aic23', ↵Mark Brown
'asoc/topic/tlv320aic26', 'asoc/topic/tlv320aic32x4', 'asoc/topic/tlv320aic3x', 'asoc/topic/tlv320dac33', 'asoc/topic/twl4030', 'asoc/topic/twl6040', 'asoc/topic/uda1380', 'asoc/topic/wl1273' and 'asoc/topic/wm2200' into asoc-next
2014-02-23ASoC: twl4030: Use SOC_ENUM_SINGLE_DECL()Takashi Iwai
Just replace with the helper macro. No functional change at all. Signed-off-by: Takashi Iwai <tiwai@suse.de> Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-20ASoC: twl4030: Clean up duplicated codeTakashi Iwai
Remove the open code in snd_soc_put_twl4030_opmode_enum_double() but just call snd_soc_put_enum_double() instead, which does the very same thing (even correctly with a lock). Signed-off-by: Takashi Iwai <tiwai@suse.de> Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-20ASoC: Rename soc_enum.max field with itemsTakashi Iwai
The name "max" in struct soc_enum is rather confusing since it actually takes the number of items. With "max", one might try to assign (nitems - 1) value. Rename the field to a more appropriate one, "items", which is also used in struct snd_ctl_elem_info, too. This patch also rewrites some code like "if (x > e->nitems - 1)" with "if (x >= e->nitems)". Not only the latter improves the readability, it also fixes a potential bug when e->items is zero. Signed-off-by: Takashi Iwai <tiwai@suse.de> Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-08ASoC: twl4030: Pass the twl4030_priv directly to twl4030_can_write_to_chip()Peter Ujfalusi
To avoid another lookup for the twl4030_priv in there. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-08ASoC: twl4030: Move the ctl cache update local to twl4030_write() functionPeter Ujfalusi
There's no other users of this functionality, the code can be moved inside of twl4030_write. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-08ASoC: twl4030: Parameter alignment fixes (for code consistency)Peter Ujfalusi
Over time the multi line alignment got messed up. Correct them in one go so the code will look consistent. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-08ASoC: twl4030: Remove local reg cachePeter Ujfalusi
Depend on the regmap reg cache implementation for register caching done in the twl-core driver. The local register cache can be removed and we can keep only shadow copies of certain ctl registers for pop noise reduction. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-08ASoC: twl4030: Introduce local ctl register cachePeter Ujfalusi
Few registers need to be cached in the codec driver level. These registers should only be written when the path is active to avoid pop noise on the given path. This patch adds an array which covers the range where the sensitive registers are located and uppon loadinf the driver the ctl cache will be initialized. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-08ASoC: twl4030: Remove reset registers functionalityPeter Ujfalusi
The register states now tracked by the regmap implementation in the core which makes the reset registers functionality 'redundant' since we know the state of the registers now all the time. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-08ASoC: twl4030: Remove check defaults functionalityPeter Ujfalusi
No need to keep the check defaults functionality anymore. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-08ASoC: twl4030: Separate write condition checking from I/O functionPeter Ujfalusi
Simplifies the code a bit and prepares it to the removal of local caching. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-07ASoC: twl4030: Use virtual DAPM mixer controlsLars-Peter Clausen
By using the new virtual DAPM mixer controls it is possible to remove the twl4030 specific implementation of virtual controls. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-06ASoC: twl4030: Remove embedded snd_soc_codec structs from private data structsLars-Peter Clausen
It is unused and a leftover of the pre multi-component era. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-01-11ASoC: twl4030: Remove suspend/resume soc driver operationsPeter Ujfalusi
With idle_bias_off these are no longer needed. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-02ASoC: twl4030: Configure extmute pinmux when the dedicated pin is in usePeter Ujfalusi
When HS extmute is enabled without custom GPIO we should configure the mux to allow the pin to be used as extmute signal. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-02ASoC: twl4030: Convert MICBIAS to SUPPLY widgetPeter Ujfalusi
In order to avoid breakage update the machine drivers at the same time using twl4030: omap3pandora, sdp3430 and zoom2 Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-02ASoC: twl4030: Correct the support for Voice portPeter Ujfalusi
In order to be able to use the Voice port of twl4030 three bits need to be handled in VOICE_IF register: VIF_EN: to enable the voice port (needed for both playback and capture) VIF_DIN_EN: Need to be enabled for playback only (input to the codec) VIF_DOUT_EN: Need to be enabled for capture only (output from codec) Use DAPM_SUPPLY for the VIF_EN bit and add DAPM_AIF_IO/OUT widget to handle the playback/capture bit. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-10ASoC: twl4030: remove __dev* attributesBill Pemberton
CONFIG_HOTPLUG is going away as an option. As result the __dev* markings will be going away. Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst, and __devexit. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-22ASoC: twl4030: Support for DT booted kernelPeter Ujfalusi
When the kernel has been booted with DT blob the platform data is NULL for the driver. We need to construct the pdata based on the DT information for runtime use. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-22ASoC: twl4030: Add pointer to pdata within the private dataPeter Ujfalusi
Access the pdata via a pointer within the twl4030_priv structure. In preparation for DeviceTree support. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-22ASoC: twl4030: Convert to use devm_kzallocPeter Ujfalusi
Allocate the private data with devm_kzalloc. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-22ASoC/mfd: twl4030: Remove set_hs_extmute callback from platform dataPeter Ujfalusi
We no longer have users for the set_hs_extmute callback which has been replaced by hs_extmute_gpio so the codec driver can handle the external mute if it is needed by the board. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-22ASoC: twl4030: Move hs_extmute GPIO handling to driverPeter Ujfalusi
The external mute (if it is in use) is handled by a GPIO line. Prepare to remove the set_hs_extmute callback and replace it with: hs_extmute_gpio: the GPIO number to use for external mute When the users of set_hs_extmute has been converted the callback can be removed. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-22ASoC: twl4030: Convert to use DAI DAPM widgetsPeter Ujfalusi
Use DAPM mapping for stream events and give unique names for the streams. This change also fixes the following warning: twl4030-codec twl4030-codec: Failed to create Capture debugfs file Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-18ASoC: Avoid recalculating the bitmask for SOC_ENUM controlsLars-Peter Clausen
For ENUM controls the bitmask is calculated based on the number of items. Currently this is done each time the control is accessed. And while the performance impact of this should be negligible we can easily do better. The roundup_pow_of_two macro performs the same calculation which is currently done manually, but it is also possible to use this macro with compile time constants and so it can be used to initialize static data. So we can use it to initialize the mask field of a ENUM control during its declaration. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-04ASoC: codecs: Remove rtd->codec usage from CODEC driversMark Brown
In order to support CODEC<->CODEC links remove the assumption that there is only a single CODEC on a DAI link by removing the use of the CODEC pointer in the rtd from the CODEC drivers. They are already being passed their DAI whenever they are passed an rtd and can get the CODEC from there. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-21ASoC: twl4030: Debug code cleanupPeter Ujfalusi
Replace the printk(KERN_ERR* instances with dev_err in the driver. While we are here clean up some of the debug messages as well. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-09ASoC: Fix typo in twl4030.cMasanari Iida
Correct spelling "memroy" to "memory" in sound/soc/codecs/twl4030.c Signed-off-by: Masanari Iida <standby24x7@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-27ASoC: Set idle_bias_off flag in snd_soc_codec_driverAxel Lin
Since commit 33c5f969 "ASoC: Allow idle_bias_off to be specified in CODEC drivers", now we can set idle_bias_off flag in struct snd_soc_codec_driver for devices can unconditionally support idle_bias_off. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20ASoC: twl4030: Use core to set the msbits constraintPeter Ujfalusi
Core can set the msbits constraint in behalf of the dai. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-02ASoC: Drop unused state parameter from CODEC suspend callbackLars-Peter Clausen
The existence of this parameter is purely historical. None of the CODEC drivers uses it and we always pass in the same value anyway, so it should be safe to remove it. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-28ASoC: Convert CODEC drivers to module_platform_driverMark Brown
Factors out a bit of boilerplate. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23ASoC: Constify snd_soc_dai_ops structsLars-Peter Clausen
Commit 1ee46ebd("ASoC: Make the DAI ops constant in the DAI structure") introduced the possibility to have constant DAI ops structures, yet this is barley used in both existing drivers and also new drivers being submitted, although none of them modifies its DAI ops structure. The later is not surprising since existing drivers are often used as templates for new drivers. So this patch just constifies all existing snd_soc_dai_ops structs to eliminate the issue altogether. The patch was generated with the following coccinelle semantic patch: // <smpl> @@ identifier ops; @@ -struct snd_soc_dai_ops ops = +const struct snd_soc_dai_ops ops = { ... }; // </smpl> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-11ASoC: twl4030: Convert to table based initPeter Ujfalusi
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-05ASoC: Consolidate use of controls with custom get/put functionPeter Ujfalusi
Use the macros for controls require custom get/put function. This is to make sure that the soc_mixer_control is used consistently among the drivers. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Cc: Arun KS <arunks@mistralsolutions.com> Cc: Misael Lopez Cruz <misael.lopez@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-07-04MFD: twl4030-audio: Rename platform dataPeter Ujfalusi
Allign the platform data names for twl4030 audio submodule: twl4030_audio_data: for the core MFD driver twl4030_codec_data: for ASoC codec driver twl4030_vibra_data: for the input/ForceFeedback driver To avoid breakage, change all depending drivers, files to use the new types. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com>
2011-07-04MFD: twl4030-codec -> twl4030-audio: Rename the driverPeter Ujfalusi
Rename the driver, and header file from twl4030-codec to twl4030-audio. To avoid breakage change depending drivers at the same time. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> CC: Misael Lopez Cruz <misael.lopez@ti.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com>
2011-05-26mfd: Use mfd cell platform_data for twl4030 codec cells platform bitsSamuel Ortiz
With the addition of a platform device mfd_cell pointer, MFD drivers can go back to passing platform data back to their sub drivers. This allows for an mfd_cell->mfd_data removal and thus keep the sub drivers MFD agnostic. This is mostly needed for non MFD aware sub drivers. Cc: Peter Ujfalusi <peter.ujfalusi@nokia.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Liam Girdwood <lrg@slimlogic.co.uk> Cc: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-03-31Fix common misspellingsLucas De Marchi
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-23mfd: mfd_cell is now implicitly available to twl4030 driversAndres Salomon
The cell's platform_data is now accessed with a helper function; change clients to use that, and remove the now-unused data_size. Signed-off-by: Andres Salomon <dilinger@queued.net> Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-12-14ASoC: TWL4030: Fix 24bit supportPeter Ujfalusi
twl4030 series of codecs supports S32_LE with msbits=24. Replace the S24_LE with S32_LE format, and add constraint for 24msbit in case of 32 S32_LE format. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-11-24Merge branch 'topic/asoc' of ↵Mark Brown
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6 into for-2.6.38
2010-11-23Merge branch 'for-2.6.38' of ↵Takashi Iwai
git://git.kernel.org/pub/scm/linux/kernel/git/lrg/asoc-2.6 into topic/asoc Conflicts: sound/soc/codecs/tpa6130a2.c
2010-11-22ASoC: Do not include soc-dapm.hJarkko Nikula
There is no need to include soc-dapm.h since soc.h includes it. Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-11-19ASoC: Move kfree(twl4030) to twl4030_soc_remove()Axel Lin
As we allocate memory for twl4030 in twl4030_codec_probe(), twl4030_codec_remove() is a better place to free the memory. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-11-06ASoC: Decouple DAPM from CODECsLiam Girdwood
Decoupling Dynamic Audio Power Management (DAPM) from codec devices is required when developing ASoC further. Such as for other ASoC components to have DAPM widgets or when extending DAPM to handle cross-device paths. This patch decouples DAPM related variables from struct snd_soc_codec and moves them to new struct snd_soc_dapm_context that is used to encapsulate DAPM context of a device. ASoC core and API of DAPM functions are modified to use DAPM context instead of codec. This patch does not change current functionality and a large part of changes come because of structure and internal API changes. Core implementation is from Liam Girdwood <lrg@slimlogic.co.uk> with some minor core changes, codecs and machine driver conversions from Jarkko Nikula <jhnikula@gmail.com>. Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Manuel Lauss <manuel.lauss@googlemail.com> Cc: Mike Frysinger <vapier.adi@gmail.com> Cc: Cliff Cai <cliff.cai@analog.com> Cc: Kevin Hilman <khilman@deeprootsystems.com> Cc: Ryan Mallon <ryan@bluewatersys.com> Cc: Timur Tabi <timur@freescale.com> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org> Cc: Wan ZongShun <mcuos.com@gmail.com> Cc: Eric Miao <eric.y.miao@gmail.com> Cc: Jassi Brar <jassi.brar@samsung.com> Cc: Daniel Gloeckner <dg@emlix.com> Cc: Kuninori Morimoto <morimoto.kuninori@renesas.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-10-26ASoC: TWL4030: Use usleep_range when appropriatePeter Ujfalusi
Change the busy loop delays with usleep_range or msleep calls. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-09-15ASoC: Remove needless codec->bias_level assignment to SND_SOC_BIAS_OFFJarkko Nikula
This assignment is done by the snd_soc_register_codec so there is no need to redo it in probe function of a codec driver. Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2010-08-12ASoC: multi-component: TWL4030: Restore registers on removalPeter Ujfalusi
Add back the register restore call, when the codec driver is removed. This does not affect normal operation, but it is usefull when debugging audio through the twl4030 class codecs. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>