ASoC: multi-comp: twl4030 updates
Subsystems (4)
cover ASoC: multi-comp: twl4030 updates
Hello Liam, Mark!
The following two patch is for the current multi-comp branch with twl4030 related fixes.
I have separated them, so they can be squased to the corresponding commit in multi-comp branch for now.
The changes in short:
- We do not need the header sound/soc/codecs/twl4030.h anymore, so remove it
- Fix machine drivers with theis header removal
- The codec no longer get's the former setup data, all configuration is coming from board files via the platform_data. So change the code accordingly
- Move the twl4030_priv allocation to a proper place
- Codec can shall go OFF instead of STANDBY, so add back the idle_bias_off flag
- The MFD driver is twl4030-audio
TODO after the multi-comp is merged:
- Rename the mfd driver to twl4030-audio.
Clean up the internal naming within the mfd
This going to touch many files...
One more notice:
The multi-comp branch does not have the
"ASoC: TWL4030: Capture route runtime DAPM ordering fix" commit yet, and I have tested my changes on top of that, but it should not be a big problem, when you rebase this driver.
What do you think?
Peter
---
Peter Ujfalusi (2):
ASoC: multi-comp: twl4030: TI CODECs
ASoC: multi-comp: twl4030: TI OMAP Platform
drivers/mfd/twl-core.c | 2 +- drivers/mfd/twl4030-codec.c | 4 +- include/linux/i2c/twl.h | 6 +++- sound/soc/codecs/twl4030.c | 73 ++++++++++++++++++++--------------------- sound/soc/codecs/twl4030.h | 52 ----------------------------- sound/soc/omap/igep0020.c | 1 - sound/soc/omap/omap2evm.c | 1 - sound/soc/omap/omap3beagle.c | 1 - sound/soc/omap/omap3evm.c | 1 - sound/soc/omap/omap3pandora.c | 1 - sound/soc/omap/overo.c | 1 - sound/soc/omap/sdp3430.c | 4 ++- sound/soc/omap/zoom2.c | 4 ++- 13 files changed, 50 insertions(+), 101 deletions(-) delete mode 100644 sound/soc/codecs/twl4030.h
--
1.7.2
PATCH 1/2 ASoC: multi-comp: twl4030: TI CODECs
Corrections for the twl4030 codec driver on top of the current multi-comp branch.
Short log:
- twl4030.h header removed, since it is not needed anymore
- all codec parameters are coming from platform_data
- put back the idle_bias_off=1
This can be squashed to 'ASoC: multi-component - TI CODECs' commit for now.
--- sound/soc/codecs/twl4030.c | 73 +++++++++++++++++++++---------------------- sound/soc/codecs/twl4030.h | 52 ------------------------------- 2 files changed, 36 insertions(+), 89 deletions(-) delete mode 100644 sound/soc/codecs/twl4030.h
sound/soc/codecs/twl4030.c +36 -37
@@ -36,7 +36,16 @@#include <sound/initval.h> #include <sound/tlv.h> -#include "twl4030.h" +/* Register descriptions are here */ +#include <linux/mfd/twl4030-codec.h> + +/* Shadow register used by the audio driver */ +#define TWL4030_REG_SW_SHADOW 0x4A +#define TWL4030_CACHEREGNUM (TWL4030_REG_SW_SHADOW + 1) + +/* TWL4030_REG_SW_SHADOW (0x4A) Fields */ +#define TWL4030_HFL_EN 0x01 +#define TWL4030_HFR_EN 0x02/* * twl4030 register cache & default register settings
@@ -279,17 +288,17 @@ static inline void twl4030_reset_registers(struct snd_soc_codec *codec)static void twl4030_init_chip (struct snd_soc_codec *codec) { -struct twl4030_setup_data *setup =dev_get_platdata (codec->dev); +struct twl4030_codec_audio_data *pdata =dev_get_platdata (codec->dev);struct twl4030_priv *twl4030 =snd_soc_codec_get_drvdata (codec);u8 reg, byte;int i =0 ;/* Check defaults, if instructed before anything else */ -if (setup && setup->check_defaults) +if (pdata && pdata->check_defaults)twl4030_check_defaults (codec);/* Reset registers, if no setup data or if instructed to do so */ -if (!setup || (setup && setup->reset_registers)) +if (!pdata || (pdata && pdata->reset_registers))twl4030_reset_registers (codec);/* Refresh APLL_CTL register from HW */
@@ -310,20 +319,14 @@ static void twl4030_init_chip(struct snd_soc_codec *codec)twl4030_write (codec,TWL4030_REG_ARXR2_APGA_CTL ,0x32 );/* Machine dependent setup */ -if (!setup) +if (!pdata)return ; - twl4030->digimic_delay = setup->digimic_delay; - -/* Configuration for headset ramp delay from setup data */ -if (setup->sysclk != twl4030->sysclk) -dev_warn (codec->dev, -"Mismatch in APLL mclk: %u (configured: %u)\n" , - setup->sysclk, twl4030->sysclk); + twl4030->digimic_delay = pdata->digimic_delay; reg =twl4030_read_reg_cache (codec,TWL4030_REG_HS_POPN_SET ); reg &= ~TWL4030_RAMP_DELAY ; - reg |= (setup->ramp_delay_value <<2 ); + reg |= (pdata->ramp_delay_value <<2 );twl4030_write_reg_cache (codec,TWL4030_REG_HS_POPN_SET , reg);/* initiate offset cancellation */
@@ -331,7 +334,7 @@ static void twl4030_init_chip(struct snd_soc_codec *codec) reg =twl4030_read_reg_cache (codec,TWL4030_REG_ANAMICL ); reg &= ~TWL4030_OFFSET_CNCL_SEL ; - reg |= setup->offset_cncl_path; + reg |= pdata->offset_cncl_path;twl4030_write (codec,TWL4030_REG_ANAMICL , reg |TWL4030_CNCL_OFFSET_START );
@@ -617,7 +620,7 @@ static int micpath_event(struct snd_soc_dapm_widget *w, static int pin_name##pga_event(struct snd_soc_dapm_widget *w, \ struct snd_kcontrol *kcontrol, int event) \ { \ - struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec); \ + struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec); \ \ switch (event) { \ case SND_SOC_DAPM_POST_PMU: \
@@ -746,7 +749,7 @@ static int aif_event(struct snd_soc_dapm_widget *w,static void headset_ramp (struct snd_soc_codec *codec,int ramp) { -struct twl4030_codec_audio_data *setup = codec->dev->platform_data; +struct twl4030_codec_audio_data *pdata = codec->dev->platform_data;unsigned char hs_gain, hs_pop;struct twl4030_priv *twl4030 =snd_soc_codec_get_drvdata (codec);/* Base values for ramp delay calculation: 2^19 - 2^26 */
@@ -758,9 +761,9 @@ static void headset_ramp(struct snd_soc_codec *codec, int ramp)/* Enable external mute control, this dramatically reduces * the pop-noise */ -if (setup && setup->hs_extmute) { -if (setup->set_hs_extmute) { - setup->set_hs_extmute (1 ); +if (pdata && pdata->hs_extmute) { +if (pdata->set_hs_extmute) { + pdata->set_hs_extmute (1 ); }else { hs_pop |=TWL4030_EXTMUTE ;twl4030_write (codec,TWL4030_REG_HS_POPN_SET , hs_pop);
@@ -798,9 +801,9 @@ static void headset_ramp(struct snd_soc_codec *codec, int ramp) }/* Disable external mute */ -if (setup && setup->hs_extmute) { -if (setup->set_hs_extmute) { - setup->set_hs_extmute (0 ); +if (pdata && pdata->hs_extmute) { +if (pdata->set_hs_extmute) { + pdata->set_hs_extmute (0 ); }else { hs_pop &= ~TWL4030_EXTMUTE ;twl4030_write (codec,TWL4030_REG_HS_POPN_SET , hs_pop);
@@ -2189,7 +2192,7 @@ static int twl4030_voice_set_tristate(struct snd_soc_dai *dai, int tristate)#define TWL4030_RATES (SNDRV_PCM_RATE_8000_48000)#define TWL4030_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FORMAT_S24_LE) -struct snd_soc_dai_ops twl4030_dai_ops = { +static struct snd_soc_dai_ops twl4030_dai_hifi_ops = { .startup = twl4030_startup, .shutdown = twl4030_shutdown, .hw_params = twl4030_hw_params,
@@ -2222,7 +2225,7 @@ static struct snd_soc_dai_driver twl4030_dai[] = { .channels_max = 4, .rates = TWL4030_RATES, .formats = TWL4030_FORMATS,}, - .ops = &twl4030_dai_ops, + .ops = &twl4030_dai_hifi_ops, }, { .name = "twl4030-voice",
@@ -2242,9 +2245,7 @@ static struct snd_soc_dai_driver twl4030_dai[] = { }, }; - -static int twl4030_soc_suspend (struct snd_soc_codec *codec, -pm_message_t state) +static int twl4030_soc_suspend (struct snd_soc_codec *codec,pm_message_t state) {twl4030_set_bias_level (codec,SND_SOC_BIAS_OFF );return 0 ;
@@ -2258,11 +2259,18 @@ static int twl4030_soc_resume(struct snd_soc_codec *codec)static int twl4030_soc_probe (struct snd_soc_codec *codec) { -struct twl4030_priv *twl4030 =snd_soc_codec_get_drvdata (codec); +struct twl4030_priv *twl4030; + twl4030 =kzalloc (sizeof (struct twl4030_priv ),GFP_KERNEL ); +if (twl4030 ==NULL ) { +printk ("Can not allocate memroy\n" ); +return -ENOMEM ; + } +snd_soc_codec_set_drvdata (codec, twl4030);/* Set the defaults, and power up the codec */ twl4030->sysclk =twl4030_codec_get_mclk () /1000 ; codec->bias_level =SND_SOC_BIAS_OFF ; + codec->idle_bias_off =1 ;twl4030_init_chip (codec);
@@ -2294,21 +2302,12 @@ static struct snd_soc_codec_driver soc_codec_dev_twl4030 = {static int __devinit twl4030_codec_probe (struct platform_device *pdev) {struct twl4030_codec_audio_data *pdata = pdev->dev.platform_data; -struct twl4030_priv *twl4030;if (!pdata) {dev_err (&pdev->dev,"platform_data is missing\n" );return -EINVAL ; } - twl4030 =kzalloc (sizeof (struct twl4030_priv ),GFP_KERNEL ); -if (twl4030 ==NULL ) { -dev_err (&pdev->dev,"Can not allocate memroy\n" ); -return -ENOMEM ; - } - -dev_set_drvdata (&pdev->dev, twl4030); -return snd_soc_register_codec (&pdev->dev, &soc_codec_dev_twl4030, twl4030_dai,ARRAY_SIZE (twl4030_dai)); }
sound/soc/codecs/twl4030.h deleted +0 -52
52 lines not on this page · raw message
Signature · 1 line
1.7.2
PATCH 2/2 ASoC: multi-comp: twl4030: TI OMAP Platform
In reply to Peter UjfalusiChanges for twl4030 codec:
- in mfd level
- in machine level
This can be squashed to 'ASoC: multi-component - TI OMAP Platform' commit for now.
--- drivers/mfd/twl-core.c | 2 +- drivers/mfd/twl4030-codec.c | 4 ++-- include/linux/i2c/twl.h | 6 +++++- sound/soc/omap/igep0020.c | 1 - sound/soc/omap/omap2evm.c | 1 - sound/soc/omap/omap3beagle.c | 1 - sound/soc/omap/omap3evm.c | 1 - sound/soc/omap/omap3pandora.c | 1 - sound/soc/omap/overo.c | 1 - sound/soc/omap/sdp3430.c | 4 +++- sound/soc/omap/zoom2.c | 4 +++- 11 files changed, 14 insertions(+), 12 deletions(-)
drivers/mfd/twl-core.c +1 -1
@@ -698,7 +698,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)if (twl_has_codec () && pdata->codec &&twl_class_is_4030 ()) { sub_chip_id = twl_map[TWL_MODULE_AUDIO_VOICE ].sid; - child =add_child (sub_chip_id,"twl4030_audio" , + child =add_child (sub_chip_id,"twl4030-audio" , pdata->codec,sizeof (*pdata->codec), false,0 ,0 );if (IS_ERR (child))
drivers/mfd/twl4030-codec.c +2 -2
@@ -249,14 +249,14 @@ static int __devexit twl4030_codec_remove(struct platform_device *pdev)return 0 ; } -MODULE_ALIAS ("platform:twl4030_audio" ); +MODULE_ALIAS ("platform:twl4030-audio" );static struct platform_driver twl4030_codec_driver = { .probe = twl4030_codec_probe, .remove =__devexit_p (twl4030_codec_remove), .driver = { .owner =THIS_MODULE , - .name ="twl4030_audio" , + .name ="twl4030-audio" , }, };
include/linux/i2c/twl.h +5 -1
@@ -553,8 +553,12 @@ extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);extern int twl4030_remove_script (u8 flags);struct twl4030_codec_audio_data { -unsigned int audio_mclk; +unsigned int audio_mclk;/* not used, will be removed */ +unsigned int digimic_delay;/* in ms */ unsigned int ramp_delay_value; +unsigned int offset_cncl_path; +unsigned int check_defaults:1 ; +unsigned int reset_registers:1 ;unsigned int hs_extmute:1 ;void (*set_hs_extmute)(int mute); };
sound/soc/omap/igep0020.c +0 -1
@@ -33,7 +33,6 @@#include "omap-mcbsp.h" #include "omap-pcm.h" -#include "../codecs/twl4030.h" static int igep2_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params)
sound/soc/omap/omap2evm.c +0 -1
@@ -35,7 +35,6 @@#include "omap-mcbsp.h" #include "omap-pcm.h" -#include "../codecs/twl4030.h" static int omap2evm_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params)
sound/soc/omap/omap3beagle.c +0 -1
@@ -33,7 +33,6 @@#include "omap-mcbsp.h" #include "omap-pcm.h" -#include "../codecs/twl4030.h" static int omap3beagle_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params)
sound/soc/omap/omap3evm.c +0 -1
@@ -31,7 +31,6 @@#include "omap-mcbsp.h" #include "omap-pcm.h" -#include "../codecs/twl4030.h" static int omap3evm_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params)
sound/soc/omap/omap3pandora.c +0 -1
@@ -35,7 +35,6 @@#include "omap-mcbsp.h" #include "omap-pcm.h" -#include "../codecs/twl4030.h" #define OMAP3_PANDORA_DAC_POWER_GPIO 118#define OMAP3_PANDORA_AMP_POWER_GPIO 14
sound/soc/omap/overo.c +0 -1
@@ -33,7 +33,6 @@#include "omap-mcbsp.h" #include "omap-pcm.h" -#include "../codecs/twl4030.h" static int overo_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params)
sound/soc/omap/sdp3430.c +3 -1
@@ -36,9 +36,11 @@#include <mach/gpio.h> #include <plat/mcbsp.h> +/* Register descriptions for twl4030 codec part */ +#include <linux/mfd/twl4030-codec.h> +#include "omap-mcbsp.h" #include "omap-pcm.h" -#include "../codecs/twl4030.h" /* TWL4030 PMBR1 Register */ #define TWL4030_INTBR_PMBR1 0x0D
sound/soc/omap/zoom2.c +3 -1
@@ -32,9 +32,11 @@#include <mach/board-zoom.h> #include <plat/mcbsp.h> +/* Register descriptions for twl4030 codec part */ +#include <linux/mfd/twl4030-codec.h> +#include "omap-mcbsp.h" #include "omap-pcm.h" -#include "../codecs/twl4030.h" #define ZOOM2_HEADSET_MUX_GPIO (OMAP_MAX_GPIO_LINES + 15)
Signature · 1 line
1.7.2
Quoted 2 lines · Peter Ujfalusi
The following two patch is for the current multi-comp branch with twl4030 related fixes.
though patch 2 could've used a better changelog!
Quoted 7 lines · On Friday 06 August 2010 15:14:24 ext Mark Brown wrote:
Quoted 2 lines · Peter Ujfalusi
The following two patch is for the current multi-comp branch with twl4030 related fixes.
Acked-by Mark Brown <[email protected]>though patch 2 could've used a better changelog!
Oops. The commit message in patch 2 not even close to informative :( I did however detailed the changes in the intro mail. These patches will be not visible at the end, since Liam will squash the changes to the multi-comp patch-set, and I did not wanted to put more effort on the commit message for the individual patches (I'm lazy, yes).
Just wanted to give Liam a hand with the twl4030 codec, and make sure that it is going to work flawlessly with multi-comp.
Never the less, I'll try to put more effort next time, since the commit message on top of the patch is easier to read, than a separate mail.
Thanks,
Péter
Liam Girdwood
AppliedQuoted 25 lines · Peter Ujfalusi
Hello Liam, Mark!
The following two patch is for the current multi-comp branch with twl4030 related fixes.
I have separated them, so they can be squased to the corresponding commit in multi-comp branch for now.
The changes in short:
- We do not need the headersound/soc/codecs/twl4030.hanymore, so remove it
- Fix machine drivers with theis header removal
- The codec no longer get's the former setup data, all configuration is coming from board files via theplatform_data. So change the code accordingly
- Move thetwl4030_privallocation to a proper place
- Codec can shall go OFF instead of STANDBY, so add back theidle_bias_offflag
- The MFD driver is twl4030-audioTODO after the multi-comp is merged:
- Rename the mfd driver to twl4030-audio.
Clean up the internal naming within the mfd
This going to touch many files...
Quoted 6 lines
One more notice:
The multi-comp branch does not have the
"ASoC: TWL4030: Capture route runtime DAPM ordering fix" commit yet, and I have tested my changes on top of that, but it should not be a big problem, when you rebase this driver.
Applied.
Thanks
Liam
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk