ASoC: Remove in-code changelogs
Subsystems (5)
PATCH 1/1 ASoC: Remove in-code changelogs
The overwhelming majority just say "initial version" anyway.
--- sound/soc/codecs/ac97.c | 3 --- sound/soc/codecs/wm9712.c | 3 --- sound/soc/codecs/wm9713.c | 3 --- sound/soc/pxa/corgi.c | 4 ---- sound/soc/pxa/pxa2xx-i2s.c | 3 --- sound/soc/pxa/spitz.c | 3 --- sound/soc/pxa/tosa.c | 3 --- sound/soc/s3c24xx/neo1973_wm8753.c | 4 ---- sound/soc/s3c24xx/s3c2443-ac97.c | 3 --- sound/soc/s3c24xx/s3c24xx-i2s.c | 5 ----- sound/soc/s3c24xx/s3c24xx-pcm.c | 4 ---- sound/soc/s3c24xx/smdk2443_wm9710.c | 3 --- sound/soc/soc-core.c | 4 ---- sound/soc/soc-dapm.c | 5 ----- 14 files changed, 0 insertions(+), 50 deletions(-)
sound/soc/codecs/ac97.c +0 -3
@@ -10,9 +10,6 @@* Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * -* Revision history -* 17th Oct 2005 Initial version. -* * Generic AC97 support. */
sound/soc/codecs/wm9712.c +0 -3
@@ -9,9 +9,6 @@* under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. -* -* Revision history -* 4th Feb 2006 Initial version. */ #include <linux/init.h>
sound/soc/codecs/wm9713.c +0 -3
@@ -10,9 +10,6 @@* Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * -* Revision history -* 4th Feb 2006 Initial version. -* * Features:- * * o Support for AC97 Codec, Voice DAC and Aux DAC
sound/soc/pxa/corgi.c +0 -4
@@ -11,10 +11,6 @@* under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. -* -* Revision history -* 30th Nov 2005 Initial version. -* */ #include <linux/module.h>
sound/soc/pxa/pxa2xx-i2s.c +0 -3
@@ -9,9 +9,6 @@* under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. -* -* Revision history -* 12th Aug 2005 Initial version. */ #include <linux/init.h>
sound/soc/pxa/spitz.c +0 -3
@@ -12,9 +12,6 @@* Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * -* Revision history -* 30th Nov 2005 Initial version. -* */ #include <linux/module.h>
sound/soc/pxa/tosa.c +0 -3
@@ -12,9 +12,6 @@* Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * -* Revision history -* 30th Nov 2005 Initial version. -* * GPIO's * 1 - Jack Insertion * 5 - Hookswitch (headset answer/hang up switch)
sound/soc/s3c24xx/neo1973_wm8753.c +0 -4
@@ -10,10 +10,6 @@* Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * -* Revision history -* 20th Jan 2007 Initial version. -* 05th Feb 2007 Rename all to Neo1973 -* */ #include <linux/module.h>
sound/soc/s3c24xx/s3c2443-ac97.c +0 -3
@@ -10,9 +10,6 @@* This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. -* -* Revision history -* 21st Mar 2007 Initial Version */ #include <linux/init.h>
sound/soc/s3c24xx/s3c24xx-i2s.c +0 -5
@@ -12,11 +12,6 @@* under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. -* -* -* Revision history -* 11th Dec 2006 Merged with Simtec driver -* 10th Nov 2006 Initial version. */ #include <linux/init.h>
sound/soc/s3c24xx/s3c24xx-pcm.c +0 -4
@@ -12,10 +12,6 @@* under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. -* -* Revision history -* 11th Dec 2006 Merged with Simtec driver -* 10th Nov 2006 Initial version. */ #include <linux/module.h>
sound/soc/s3c24xx/smdk2443_wm9710.c +0 -3
@@ -10,9 +10,6 @@* Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * -* Revision history -* 8th Mar 2007 Initial version. -* */ #include <linux/module.h>
sound/soc/soc-core.c +0 -4
@@ -14,10 +14,6 @@* Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * -* Revision history -* 12th Aug 2005 Initial version. -* 25th Oct 2005 Working Codec, Interface and Platform registration. -* * TODO: * o Add hw rules to enforce rates, etc. * o More testing with other codecs/machines.
sound/soc/soc-dapm.c +0 -5
@@ -10,11 +10,6 @@* Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * -* Revision history -* 12th Aug 2005 Initial version. -* 25th Oct 2005 Implemented path power domain. -* 18th Dec 2005 Implemented machine and stream level power domain. -* * Features: * o Changes power status of internal codec blocks depending on the * dynamic configuration of codec internal audio paths and active
Signature · 1 line
1.5.5.1
PATCH 1/1 ASoC: Clarify API for bias configuration
Currently the ASoC core configures the bias levels in the system using a callback on codecs and machines called "dapm_event", passing it PCI style power levels as SNDRV_CTL_POWER_ constants. This is more obscure than it needs to be and has caused confusion to driver authors, especially given that DAPM is also performing power management.
Address this by renaming the callback function to "set_bias_level" and using constants explicitly representing the off, standby, pre-on and on states which DAPM transitions through.
Also unexport the API for setting bias level: there are currently no in-tree users of this API other than the core itself and it is likely that the core would need to be extended to cater for any users.
--- include/sound/soc-dapm.h | 3 +- include/sound/soc.h | 28 +++++++++++++++++++++--- sound/soc/codecs/tlv320aic3x.c | 26 +++++++++++----------- sound/soc/codecs/wm8731.c | 28 ++++++++++++------------ sound/soc/codecs/wm8750.c | 36 ++++++++++++++++---------------- sound/soc/codecs/wm8753.c | 36 ++++++++++++++++---------------- sound/soc/codecs/wm9712.c | 28 ++++++++++++------------ sound/soc/codecs/wm9713.c | 26 +++++++++++----------- sound/soc/soc-core.c | 25 +++++++++++---------- sound/soc/soc-dapm.c | 44 +++++++++++++++++++-------------------- 10 files changed, 150 insertions(+), 130 deletions(-)
include/sound/soc-dapm.h +2 -1
@@ -221,7 +221,8 @@ int snd_soc_dapm_add_routes(struct snd_soc_codec *codec,/* dapm events */ int snd_soc_dapm_stream_event (struct snd_soc_codec *codec,char *stream,int event); -int snd_soc_dapm_device_event (struct snd_soc_device *socdev,int event); +int snd_soc_dapm_set_bias_level (struct snd_soc_device *socdev, +enum snd_soc_bias_level level);/* dapm sys fs - used by the core */ int snd_soc_dapm_sys_add (struct device *dev);
include/sound/soc.h +24 -4
@@ -103,6 +103,24 @@ .private_value = (unsigned long)&xenum }/* +* Bias levels +* +* @ON: Bias is fully on for audio playback and capture operations. +* @PREPARE: Prepare for audio operations. Called before DAPM switching for +* stream start and stop operations. +* @STANDBY: Low power standby state when no playback/capture operations are +* in progress. NOTE: The transition time between STANDBY and ON +* should be as fast as possible and no longer than 10ms. +* @OFF: Power Off. No restrictions on transition times. +*/ +enum snd_soc_bias_level { +SND_SOC_BIAS_ON , +SND_SOC_BIAS_PREPARE , +SND_SOC_BIAS_STANDBY , +SND_SOC_BIAS_OFF , +}; + +/* * Digital Audio Interface (DAI) types */ #define SND_SOC_DAI_AC97 0x1
@@ -374,7 +392,8 @@ struct snd_soc_codec {struct mutex mutex;/* callbacks */ -int (*dapm_event)(struct snd_soc_codec *codec,int event); +int (*set_bias_level)(struct snd_soc_codec *, +enum snd_soc_bias_level level);/* runtime */ struct snd_card *card;
@@ -396,8 +415,8 @@ struct snd_soc_codec {/* dapm */ struct list_head dapm_widgets;struct list_head dapm_paths; -unsigned int dapm_state; -unsigned int suspend_dapm_state; +enum snd_soc_bias_level bias_level; +enum snd_soc_bias_level suspend_bias_level;struct delayed_work delayed_work;/* codec DAI's */
@@ -467,7 +486,8 @@ struct snd_soc_machine {int (*resume_post)(struct platform_device *pdev);/* callbacks */ -int (*dapm_event)(struct snd_soc_machine *,int event); +int (*set_bias_level)(struct snd_soc_machine *, +enum snd_soc_bias_level level);/* CPU <--> Codec DAI links */ struct snd_soc_dai_link *dai_link;
sound/soc/codecs/tlv320aic3x.c +13 -13
@@ -847,13 +847,14 @@ static int aic3x_set_dai_fmt(struct snd_soc_codec_dai *codec_dai,return 0 ; } -static int aic3x_dapm_event (struct snd_soc_codec *codec,int event) +static int aic3x_set_bias_level (struct snd_soc_codec *codec, +enum snd_soc_bias_level level) {struct aic3x_priv *aic3x = codec->private_data;u8 reg; -switch (event) { -case SNDRV_CTL_POWER_D0 : +switch (level) { +case SND_SOC_BIAS_ON :/* all power is driven by DAPM system */ if (aic3x->master) {/* enable pll */
@@ -862,10 +863,9 @@ static int aic3x_dapm_event(struct snd_soc_codec *codec, int event) reg | PLL_ENABLE); }break ; -case SNDRV_CTL_POWER_D1 : -case SNDRV_CTL_POWER_D2 : +case SND_SOC_BIAS_PREPARE :break ; -case SNDRV_CTL_POWER_D3hot: +case SND_SOC_BIAS_STANDBY :/* * all power is driven by DAPM system, * so output power is safe if bypass was set
@@ -877,7 +877,7 @@ static int aic3x_dapm_event(struct snd_soc_codec *codec, int event) reg & ~PLL_ENABLE); }break ; -case SNDRV_CTL_POWER_D3cold: +case SND_SOC_BIAS_OFF :/* force all power off */ reg =aic3x_read_reg_cache (codec,LINE1L_2_LADC_CTRL );aic3x_write (codec,LINE1L_2_LADC_CTRL , reg & ~LADC_PWR_ON );
@@ -913,7 +913,7 @@ static int aic3x_dapm_event(struct snd_soc_codec *codec, int event) }break ; } - codec->dapm_state = event; + codec->bias_level = level;return 0 ; }
@@ -979,7 +979,7 @@ static int aic3x_suspend(struct platform_device *pdev, pm_message_t state)struct snd_soc_device *socdev =platform_get_drvdata (pdev);struct snd_soc_codec *codec = socdev->codec; -aic3x_dapm_event (codec, SNDRV_CTL_POWER_D3cold); +aic3x_set_bias_level (codec,SND_SOC_BIAS_OFF );return 0 ; }
@@ -999,7 +999,7 @@ static int aic3x_resume(struct platform_device *pdev) codec->hw_write (codec->control_data, data,2 ); } -aic3x_dapm_event (codec, codec->suspend_dapm_state); +aic3x_set_bias_level (codec, codec->suspend_bias_level);return 0 ; }
@@ -1018,7 +1018,7 @@ static int aic3x_init(struct snd_soc_device *socdev) codec->owner =THIS_MODULE ; codec->read = aic3x_read_reg_cache; codec->write = aic3x_write; - codec->dapm_event = aic3x_dapm_event; + codec->set_bias_level = aic3x_set_bias_level; codec->dai = &aic3x_dai; codec->num_dai =1 ; codec->reg_cache_size =sizeof (aic3x_reg);
@@ -1100,7 +1100,7 @@ static int aic3x_init(struct snd_soc_device *socdev)aic3x_write (codec,LINE2R_2_MONOLOPM_VOL ,DEFAULT_VOL );/* off, with power on */ -aic3x_dapm_event (codec, SNDRV_CTL_POWER_D3hot); +aic3x_set_bias_level (codec,SND_SOC_BIAS_STANDBY );/* setup GPIO functions */ aic3x_write (codec,AIC3X_GPIO1_REG , (setup->gpio_func[0 ] &0xf ) <<4 );
@@ -1271,7 +1271,7 @@ static int aic3x_remove(struct platform_device *pdev)/* power down chip */ if (codec->control_data) -aic3x_dapm_event (codec,SNDRV_CTL_POWER_D3 ); +aic3x_set_bias_level (codec,SND_SOC_BIAS_OFF );snd_soc_free_pcms (socdev);snd_soc_dapm_free (socdev);
sound/soc/codecs/wm8731.c +14 -14
@@ -427,29 +427,29 @@ static int wm8731_set_dai_fmt(struct snd_soc_codec_dai *codec_dai,return 0 ; } -static int wm8731_dapm_event (struct snd_soc_codec *codec,int event) +static int wm8731_set_bias_level (struct snd_soc_codec *codec, +enum snd_soc_bias_level level) {u16 reg =wm8731_read_reg_cache (codec,WM8731_PWR ) &0xff7f ; -switch (event) { -case SNDRV_CTL_POWER_D0 :/* full On */ +switch (level) { +case SND_SOC_BIAS_ON :/* vref/mid, osc on, dac unmute */ wm8731_write (codec,WM8731_PWR , reg);break ; -case SNDRV_CTL_POWER_D1 :/* partial On */ -case SNDRV_CTL_POWER_D2 :/* partial On */ +case SND_SOC_BIAS_PREPARE :break ; -case SNDRV_CTL_POWER_D3hot:/* Off, with power */ +case SND_SOC_BIAS_STANDBY :/* everything off except vref/vmid, */ wm8731_write (codec,WM8731_PWR , reg |0x0040 );break ; -case SNDRV_CTL_POWER_D3cold:/* Off, without power */ +case SND_SOC_BIAS_OFF :/* everything off, dac mute, inactive */ wm8731_write (codec,WM8731_ACTIVE ,0x0 );wm8731_write (codec,WM8731_PWR ,0xffff );break ; } - codec->dapm_state = event; + codec->bias_level = level;return 0 ; }
@@ -495,7 +495,7 @@ static int wm8731_suspend(struct platform_device *pdev, pm_message_t state)struct snd_soc_codec *codec = socdev->codec;wm8731_write (codec,WM8731_ACTIVE ,0x0 ); -wm8731_dapm_event (codec, SNDRV_CTL_POWER_D3cold); +wm8731_set_bias_level (codec,SND_SOC_BIAS_OFF );return 0 ; }
@@ -513,8 +513,8 @@ static int wm8731_resume(struct platform_device *pdev) data[1 ] = cache[i] &0x00ff ; codec->hw_write (codec->control_data, data,2 ); } -wm8731_dapm_event (codec, SNDRV_CTL_POWER_D3hot); -wm8731_dapm_event (codec, codec->suspend_dapm_state); +wm8731_set_bias_level (codec,SND_SOC_BIAS_STANDBY ); +wm8731_set_bias_level (codec, codec->suspend_bias_level);return 0 ; }
@@ -531,7 +531,7 @@ static int wm8731_init(struct snd_soc_device *socdev) codec->owner =THIS_MODULE ; codec->read = wm8731_read_reg_cache; codec->write = wm8731_write; - codec->dapm_event = wm8731_dapm_event; + codec->set_bias_level = wm8731_set_bias_level; codec->dai = &wm8731_dai; codec->num_dai =1 ; codec->reg_cache_size =sizeof (wm8731_reg);
@@ -549,7 +549,7 @@ static int wm8731_init(struct snd_soc_device *socdev) }/* power on device */ -wm8731_dapm_event (codec, SNDRV_CTL_POWER_D3hot); +wm8731_set_bias_level (codec,SND_SOC_BIAS_STANDBY );/* set the update bits */ reg =wm8731_read_reg_cache (codec,WM8731_LOUT1V );
@@ -722,7 +722,7 @@ static int wm8731_remove(struct platform_device *pdev)struct snd_soc_codec *codec = socdev->codec;if (codec->control_data) -wm8731_dapm_event (codec, SNDRV_CTL_POWER_D3cold); +wm8731_set_bias_level (codec,SND_SOC_BIAS_OFF );snd_soc_free_pcms (socdev);snd_soc_dapm_free (socdev);
sound/soc/codecs/wm8750.c +18 -18
@@ -678,29 +678,29 @@ static int wm8750_mute(struct snd_soc_codec_dai *dai, int mute)return 0 ; } -static int wm8750_dapm_event (struct snd_soc_codec *codec,int event) +static int wm8750_set_bias_level (struct snd_soc_codec *codec, +enum snd_soc_bias_level level) {u16 pwr_reg =wm8750_read_reg_cache (codec,WM8750_PWR1 ) &0xfe3e ; -switch (event) { -case SNDRV_CTL_POWER_D0 :/* full On */ +switch (level) { +case SND_SOC_BIAS_ON :/* set vmid to 50k and unmute dac */ wm8750_write (codec,WM8750_PWR1 , pwr_reg |0x00c0 );break ; -case SNDRV_CTL_POWER_D1 :/* partial On */ -case SNDRV_CTL_POWER_D2 :/* partial On */ +case SND_SOC_BIAS_PREPARE :/* set vmid to 5k for quick power up */ wm8750_write (codec,WM8750_PWR1 , pwr_reg |0x01c1 );break ; -case SNDRV_CTL_POWER_D3hot:/* Off, with power */ +case SND_SOC_BIAS_STANDBY :/* mute dac and set vmid to 500k, enable VREF */ wm8750_write (codec,WM8750_PWR1 , pwr_reg |0x0141 );break ; -case SNDRV_CTL_POWER_D3cold:/* Off, without power */ +case SND_SOC_BIAS_OFF :wm8750_write (codec,WM8750_PWR1 ,0x0001 );break ; } - codec->dapm_state = event; + codec->bias_level = level;return 0 ; }
@@ -740,7 +740,7 @@ static void wm8750_work(struct work_struct *work) {struct snd_soc_codec *codec = container_of(work, struct snd_soc_codec, delayed_work.work); -wm8750_dapm_event (codec, codec->dapm_state); +wm8750_set_bias_level (codec, codec->bias_level); }static int wm8750_suspend (struct platform_device *pdev,pm_message_t state)
@@ -748,7 +748,7 @@ static int wm8750_suspend(struct platform_device *pdev, pm_message_t state)struct snd_soc_device *socdev =platform_get_drvdata (pdev);struct snd_soc_codec *codec = socdev->codec; -wm8750_dapm_event (codec, SNDRV_CTL_POWER_D3cold); +wm8750_set_bias_level (codec,SND_SOC_BIAS_OFF );return 0 ; }
@@ -769,12 +769,12 @@ static int wm8750_resume(struct platform_device *pdev) codec->hw_write (codec->control_data, data,2 ); } -wm8750_dapm_event (codec, SNDRV_CTL_POWER_D3hot); +wm8750_set_bias_level (codec,SND_SOC_BIAS_STANDBY );/* charge wm8750 caps */ -if (codec->suspend_dapm_state ==SNDRV_CTL_POWER_D0 ) { -wm8750_dapm_event (codec,SNDRV_CTL_POWER_D2 ); - codec->dapm_state =SNDRV_CTL_POWER_D0 ; +if (codec->suspend_bias_level ==SND_SOC_BIAS_ON ) { +wm8750_set_bias_level (codec,SND_SOC_BIAS_PREPARE ); + codec->bias_level =SND_SOC_BIAS_ON ;schedule_delayed_work (&codec->delayed_work,msecs_to_jiffies (1000 )); }
@@ -795,7 +795,7 @@ static int wm8750_init(struct snd_soc_device *socdev) codec->owner =THIS_MODULE ; codec->read = wm8750_read_reg_cache; codec->write = wm8750_write; - codec->dapm_event = wm8750_dapm_event; + codec->set_bias_level = wm8750_set_bias_level; codec->dai = &wm8750_dai; codec->num_dai =1 ; codec->reg_cache_size =sizeof (wm8750_reg);
@@ -813,8 +813,8 @@ static int wm8750_init(struct snd_soc_device *socdev) }/* charge output caps */ -wm8750_dapm_event (codec,SNDRV_CTL_POWER_D2 ); - codec->dapm_state = SNDRV_CTL_POWER_D3hot; +wm8750_set_bias_level (codec,SND_SOC_BIAS_PREPARE ); + codec->bias_level =SND_SOC_BIAS_STANDBY ;schedule_delayed_work (&codec->delayed_work,msecs_to_jiffies (1000 ));/* set the update bits */
@@ -1013,7 +1013,7 @@ static int wm8750_remove(struct platform_device *pdev)struct snd_soc_codec *codec = socdev->codec;if (codec->control_data) -wm8750_dapm_event (codec, SNDRV_CTL_POWER_D3cold); +wm8750_set_bias_level (codec,SND_SOC_BIAS_OFF );run_delayed_work (&codec->delayed_work);snd_soc_free_pcms (socdev);snd_soc_dapm_free (socdev);
sound/soc/codecs/wm8753.c +18 -18
@@ -1265,29 +1265,29 @@ static int wm8753_mute(struct snd_soc_codec_dai *dai, int mute)return 0 ; } -static int wm8753_dapm_event (struct snd_soc_codec *codec,int event) +static int wm8753_set_bias_level (struct snd_soc_codec *codec, +enum snd_soc_bias_level level) {u16 pwr_reg =wm8753_read_reg_cache (codec,WM8753_PWR1 ) &0xfe3e ; -switch (event) { -case SNDRV_CTL_POWER_D0 :/* full On */ +switch (level) { +case SND_SOC_BIAS_ON :/* set vmid to 50k and unmute dac */ wm8753_write (codec,WM8753_PWR1 , pwr_reg |0x00c0 );break ; -case SNDRV_CTL_POWER_D1 :/* partial On */ -case SNDRV_CTL_POWER_D2 :/* partial On */ +case SND_SOC_BIAS_PREPARE :/* set vmid to 5k for quick power up */ wm8753_write (codec,WM8753_PWR1 , pwr_reg |0x01c1 );break ; -case SNDRV_CTL_POWER_D3hot:/* Off, with power */ +case SND_SOC_BIAS_STANDBY :/* mute dac and set vmid to 500k, enable VREF */ wm8753_write (codec,WM8753_PWR1 , pwr_reg |0x0141 );break ; -case SNDRV_CTL_POWER_D3cold:/* Off, without power */ +case SND_SOC_BIAS_OFF :wm8753_write (codec,WM8753_PWR1 ,0x0001 );break ; } - codec->dapm_state = event; + codec->bias_level = level;return 0 ; }
@@ -1491,7 +1491,7 @@ static void wm8753_work(struct work_struct *work) {struct snd_soc_codec *codec = container_of(work, struct snd_soc_codec, delayed_work.work); -wm8753_dapm_event (codec, codec->dapm_state); +wm8753_set_bias_level (codec, codec->bias_level); }static int wm8753_suspend (struct platform_device *pdev,pm_message_t state)
@@ -1503,7 +1503,7 @@ static int wm8753_suspend(struct platform_device *pdev, pm_message_t state)if (!codec->card)return 0 ; -wm8753_dapm_event (codec, SNDRV_CTL_POWER_D3cold); +wm8753_set_bias_level (codec,SND_SOC_BIAS_OFF );return 0 ; }
@@ -1528,12 +1528,12 @@ static int wm8753_resume(struct platform_device *pdev) codec->hw_write (codec->control_data, data,2 ); } -wm8753_dapm_event (codec, SNDRV_CTL_POWER_D3hot); +wm8753_set_bias_level (codec,SND_SOC_BIAS_STANDBY );/* charge wm8753 caps */ -if (codec->suspend_dapm_state ==SNDRV_CTL_POWER_D0 ) { -wm8753_dapm_event (codec,SNDRV_CTL_POWER_D2 ); - codec->dapm_state =SNDRV_CTL_POWER_D0 ; +if (codec->suspend_bias_level ==SND_SOC_BIAS_ON ) { +wm8753_set_bias_level (codec,SND_SOC_BIAS_PREPARE ); + codec->bias_level =SND_SOC_BIAS_ON ;schedule_delayed_work (&codec->delayed_work,msecs_to_jiffies (caps_charge)); }
@@ -1554,7 +1554,7 @@ static int wm8753_init(struct snd_soc_device *socdev) codec->owner =THIS_MODULE ; codec->read = wm8753_read_reg_cache; codec->write = wm8753_write; - codec->dapm_event = wm8753_dapm_event; + codec->set_bias_level = wm8753_set_bias_level; codec->dai = wm8753_dai; codec->num_dai =2 ; codec->reg_cache_size =sizeof (wm8753_reg);
@@ -1575,8 +1575,8 @@ static int wm8753_init(struct snd_soc_device *socdev) }/* charge output caps */ -wm8753_dapm_event (codec,SNDRV_CTL_POWER_D2 ); - codec->dapm_state = SNDRV_CTL_POWER_D3hot; +wm8753_set_bias_level (codec,SND_SOC_BIAS_PREPARE ); + codec->bias_level =SND_SOC_BIAS_STANDBY ;schedule_delayed_work (&codec->delayed_work,msecs_to_jiffies (caps_charge));
@@ -1783,7 +1783,7 @@ static int wm8753_remove(struct platform_device *pdev)struct snd_soc_codec *codec = socdev->codec;if (codec->control_data) -wm8753_dapm_event (codec, SNDRV_CTL_POWER_D3cold); +wm8753_set_bias_level (codec,SND_SOC_BIAS_OFF );run_delayed_work (&codec->delayed_work);snd_soc_free_pcms (socdev);snd_soc_dapm_free (socdev);
sound/soc/codecs/wm9712.c +14 -14
@@ -564,23 +564,23 @@ struct snd_soc_codec_dai wm9712_dai[] = { };EXPORT_SYMBOL_GPL (wm9712_dai); -static int wm9712_dapm_event (struct snd_soc_codec *codec,int event) +static int wm9712_set_bias_level (struct snd_soc_codec *codec, +enum snd_soc_bias_level level) { -switch (event) { -case SNDRV_CTL_POWER_D0 :/* full On */ -case SNDRV_CTL_POWER_D1 :/* partial On */ -case SNDRV_CTL_POWER_D2 :/* partial On */ +switch (level) { +case SND_SOC_BIAS_ON : +case SND_SOC_BIAS_PREPARE :break ; -case SNDRV_CTL_POWER_D3hot:/* Off, with power */ +case SND_SOC_BIAS_STANDBY :ac97_write (codec,AC97_POWERDOWN ,0x0000 );break ; -case SNDRV_CTL_POWER_D3cold:/* Off, without power */ +case SND_SOC_BIAS_OFF :/* disable everything including AC link */ ac97_write (codec,AC97_EXTENDED_MSTATUS ,0xffff );ac97_write (codec,AC97_POWERDOWN ,0xffff );break ; } - codec->dapm_state = event; + codec->bias_level = level;return 0 ; }
@@ -608,7 +608,7 @@ static int wm9712_soc_suspend(struct platform_device *pdev,struct snd_soc_device *socdev =platform_get_drvdata (pdev);struct snd_soc_codec *codec = socdev->codec; -wm9712_dapm_event (codec, SNDRV_CTL_POWER_D3cold); +wm9712_set_bias_level (codec,SND_SOC_BIAS_OFF );return 0 ; }
@@ -625,7 +625,7 @@ static int wm9712_soc_resume(struct platform_device *pdev)return ret; } -wm9712_dapm_event (codec, SNDRV_CTL_POWER_D3hot); +wm9712_set_bias_level (codec,SND_SOC_BIAS_STANDBY );if (ret ==0 ) {/* Sync reg_cache with the hardware after cold reset */
@@ -637,8 +637,8 @@ static int wm9712_soc_resume(struct platform_device *pdev) } } -if (codec->suspend_dapm_state ==SNDRV_CTL_POWER_D0 ) -wm9712_dapm_event (codec,SNDRV_CTL_POWER_D0 ); +if (codec->suspend_bias_level ==SND_SOC_BIAS_ON ) +wm9712_set_bias_level (codec,SND_SOC_BIAS_ON );return ret; }
@@ -672,7 +672,7 @@ static int wm9712_soc_probe(struct platform_device *pdev) codec->num_dai =ARRAY_SIZE (wm9712_dai); codec->write = ac97_write; codec->read = ac97_read; - codec->dapm_event = wm9712_dapm_event; + codec->set_bias_level = wm9712_set_bias_level;INIT_LIST_HEAD (&codec->dapm_widgets);INIT_LIST_HEAD (&codec->dapm_paths);
@@ -696,7 +696,7 @@ static int wm9712_soc_probe(struct platform_device *pdev)/* set alc mux to none */ ac97_write (codec,AC97_VIDEO ,ac97_read (codec,AC97_VIDEO ) |0x3000 ); -wm9712_dapm_event (codec, SNDRV_CTL_POWER_D3hot); +wm9712_set_bias_level (codec,SND_SOC_BIAS_STANDBY );wm9712_add_controls (codec);wm9712_add_widgets (codec); ret =snd_soc_register_card (socdev);
sound/soc/codecs/wm9713.c +13 -13
@@ -1087,33 +1087,33 @@ int wm9713_reset(struct snd_soc_codec *codec, int try_warm) }EXPORT_SYMBOL_GPL (wm9713_reset); -static int wm9713_dapm_event (struct snd_soc_codec *codec,int event) +static int wm9713_set_bias_level (struct snd_soc_codec *codec, +enum snd_soc_bias_level level) {u16 reg; -switch (event) { -case SNDRV_CTL_POWER_D0 :/* full On */ +switch (level) { +case SND_SOC_BIAS_ON :/* enable thermal shutdown */ reg =ac97_read (codec,AC97_EXTENDED_MID ) &0x1bff ;ac97_write (codec,AC97_EXTENDED_MID , reg);break ; -case SNDRV_CTL_POWER_D1 :/* partial On */ -case SNDRV_CTL_POWER_D2 :/* partial On */ +case SND_SOC_BIAS_PREPARE :break ; -case SNDRV_CTL_POWER_D3hot:/* Off, with power */ +case SND_SOC_BIAS_STANDBY :/* enable master bias and vmid */ reg =ac97_read (codec,AC97_EXTENDED_MID ) &0x3bff ;ac97_write (codec,AC97_EXTENDED_MID , reg);ac97_write (codec,AC97_POWERDOWN ,0x0000 );break ; -case SNDRV_CTL_POWER_D3cold:/* Off, without power */ +case SND_SOC_BIAS_OFF :/* disable everything including AC link */ ac97_write (codec,AC97_EXTENDED_MID ,0xffff );ac97_write (codec,AC97_EXTENDED_MSTATUS ,0xffff );ac97_write (codec,AC97_POWERDOWN ,0xffff );break ; } - codec->dapm_state = event; + codec->bias_level = level;return 0 ; }
@@ -1150,7 +1150,7 @@ static int wm9713_soc_resume(struct platform_device *pdev)return ret; } -wm9713_dapm_event (codec, SNDRV_CTL_POWER_D3hot); +wm9713_set_bias_level (codec,SND_SOC_BIAS_STANDBY );/* do we need to re-start the PLL ? */ if (wm9713->pll_out)
@@ -1166,8 +1166,8 @@ static int wm9713_soc_resume(struct platform_device *pdev) } } -if (codec->suspend_dapm_state ==SNDRV_CTL_POWER_D0 ) -wm9713_dapm_event (codec,SNDRV_CTL_POWER_D0 ); +if (codec->suspend_bias_level ==SND_SOC_BIAS_ON ) +wm9713_set_bias_level (codec,SND_SOC_BIAS_ON );return ret; }
@@ -1206,7 +1206,7 @@ static int wm9713_soc_probe(struct platform_device *pdev) codec->num_dai =ARRAY_SIZE (wm9713_dai); codec->write = ac97_write; codec->read = ac97_read; - codec->dapm_event = wm9713_dapm_event; + codec->set_bias_level = wm9713_set_bias_level;INIT_LIST_HEAD (&codec->dapm_widgets);INIT_LIST_HEAD (&codec->dapm_paths);
@@ -1228,7 +1228,7 @@ static int wm9713_soc_probe(struct platform_device *pdev) goto reset_err; } -wm9713_dapm_event (codec, SNDRV_CTL_POWER_D3hot); +wm9713_set_bias_level (codec,SND_SOC_BIAS_STANDBY );/* unmute the adc - move to kcontrol */ reg =ac97_read (codec,AC97_CD ) &0x7fff ;
sound/soc/soc-core.c +13 -12
@@ -283,12 +283,12 @@ static void close_delayed_work(struct work_struct *work)/* are we waiting on this codec DAI stream */ if (codec_dai->pop_wait ==1 ) { -/* power down the codec to D1 if no longer active */ +/* Reduce power if no longer active */ if (codec->active ==0 ) {dbg ("pop wq D1 %s %s\n" , codec->name, codec_dai->playback.stream_name); -snd_soc_dapm_device_event (socdev, -SNDRV_CTL_POWER_D1 ); +snd_soc_dapm_set_bias_level (socdev, +SND_SOC_BIAS_PREPARE ); } codec_dai->pop_wait =0 ;
@@ -296,12 +296,12 @@ static void close_delayed_work(struct work_struct *work) codec_dai->playback.stream_name, SND_SOC_DAPM_STREAM_STOP); -/* power down the codec power domain if no longer active */ +/* Fall into standby if no longer active */ if (codec->active ==0 ) {dbg ("pop wq D3 %s %s\n" , codec->name, codec_dai->playback.stream_name); -snd_soc_dapm_device_event (socdev, - SNDRV_CTL_POWER_D3hot); +snd_soc_dapm_set_bias_level (socdev, +SND_SOC_BIAS_STANDBY ); } } }
@@ -361,8 +361,8 @@ static int soc_codec_close(struct snd_pcm_substream *substream) SND_SOC_DAPM_STREAM_STOP);if (codec->active ==0 && codec_dai->pop_wait ==0 ) -snd_soc_dapm_device_event (socdev, - SNDRV_CTL_POWER_D3hot); +snd_soc_dapm_set_bias_level (socdev, +SND_SOC_BIAS_STANDBY ); }mutex_unlock (&pcm_mutex);
@@ -435,9 +435,10 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) } }else {/* no delayed work - do we need to power up codec */ -if (codec->dapm_state !=SNDRV_CTL_POWER_D0 ) { +if (codec->bias_level !=SND_SOC_BIAS_ON ) { -snd_soc_dapm_device_event (socdev,SNDRV_CTL_POWER_D1 ); +snd_soc_dapm_set_bias_level (socdev, +SND_SOC_BIAS_PREPARE );if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) snd_soc_dapm_stream_event(codec,
@@ -448,7 +449,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) codec_dai->capture.stream_name, SND_SOC_DAPM_STREAM_START); -snd_soc_dapm_device_event (socdev,SNDRV_CTL_POWER_D0 ); +snd_soc_dapm_set_bias_level (socdev,SND_SOC_BIAS_ON );if (codec_dai->dai_ops.digital_mute) codec_dai->dai_ops.digital_mute (codec_dai,0 );
@@ -658,7 +659,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)/* close any waiting streams and save state */ run_delayed_work (&socdev->delayed_work); - codec->suspend_dapm_state = codec->dapm_state; + codec->suspend_bias_level = codec->bias_level;for (i =0 ; i < codec->num_dai; i++) {char *stream = codec->dai[i].playback.stream_name;
sound/soc/soc-dapm.c +21 -23
69 lines not on this page · raw message
Signature · 1 line
1.5.5.1
PATCH 1/1 ASoC: Make CPU and codec DAI operations have same type
The CPU and codec DAI operations differ only in the presence of the digital mute operation for the codec so they may as well be the same type.
--- include/sound/soc.h | 30 ++++++------------------------ 1 files changed, 6 insertions(+), 24 deletions(-)
include/sound/soc.h +6 -24
@@ -290,9 +290,9 @@ struct snd_soc_ops {int (*trigger)(struct snd_pcm_substream *,int ); }; -/* ASoC codec DAI ops */ -struct snd_soc_codec_ops { -/* codec DAI clocking configuration */ +/* ASoC DAI ops */ +struct snd_soc_dai_ops { +/* DAI clocking configuration */ int (*set_sysclk)(struct snd_soc_codec_dai *codec_dai,int clk_id,unsigned int freq,int dir); int (*set_pll)(struct snd_soc_codec_dai *codec_dai,
@@ -300,7 +300,7 @@ struct snd_soc_codec_ops {int (*set_clkdiv)(struct snd_soc_codec_dai *codec_dai,int div_id,int div); -/* CPU DAI format configuration */ +/* DAI format configuration */ int (*set_fmt)(struct snd_soc_codec_dai *codec_dai,unsigned int fmt); int (*set_tdm_slot)(struct snd_soc_codec_dai *codec_dai,
@@ -311,24 +311,6 @@ struct snd_soc_codec_ops {int (*digital_mute)(struct snd_soc_codec_dai *,int mute); }; -/* ASoC cpu DAI ops */ -struct snd_soc_cpu_ops { -/* CPU DAI clocking configuration */ -int (*set_sysclk)(struct snd_soc_cpu_dai *cpu_dai, -int clk_id,unsigned int freq,int dir); -int (*set_clkdiv)(struct snd_soc_cpu_dai *cpu_dai, -int div_id,int div); -int (*set_pll)(struct snd_soc_cpu_dai *cpu_dai, -int pll_id,unsigned int freq_in,unsigned int freq_out); - -/* CPU DAI format configuration */ -int (*set_fmt)(struct snd_soc_cpu_dai *cpu_dai, -unsigned int fmt); -int (*set_tdm_slot)(struct snd_soc_cpu_dai *cpu_dai, -unsigned int mask,int slots); -int (*set_tristate)(struct snd_soc_cpu_dai *,int tristate); -}; -/* SoC Codec DAI */ struct snd_soc_codec_dai {char *name;
@@ -346,7 +328,7 @@ struct snd_soc_codec_dai {/* ops */ struct snd_soc_ops ops; -struct snd_soc_codec_ops dai_ops; +struct snd_soc_dai_ops dai_ops;/* DAI private data */ void *private_data;
@@ -370,7 +352,7 @@ struct snd_soc_cpu_dai {/* ops */ struct snd_soc_ops ops; -struct snd_soc_cpu_ops dai_ops; +struct snd_soc_dai_ops dai_ops;/* DAI capabilities */ struct snd_soc_pcm_stream capture;
Signature · 1 line
1.5.5.1
PATCH 1/1 ASoC: core checkpatch cleanups
--- sound/soc/soc-core.c | 100 +++++++++++++++++++++++++++----------------------- 1 files changed, 54 insertions(+), 46 deletions(-)
sound/soc/soc-core.c +54 -46
@@ -108,9 +108,9 @@ static int soc_ac97_dev_register(struct snd_soc_codec *codec) }#endif -static inline const char *get_dai_name (int type) +static inline const char *get_dai_name (int type) { -switch (type) { +switch (type) {case SND_SOC_DAI_AC97_BUS :case SND_SOC_DAI_AC97 :return "AC97" ;
@@ -178,9 +178,11 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)/* Check that the codec and cpu DAI's are compatible */ if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { runtime->hw.rate_min = -max (codec_dai->playback.rate_min, cpu_dai->playback.rate_min); +max (codec_dai->playback.rate_min, + cpu_dai->playback.rate_min); runtime->hw.rate_max = -min (codec_dai->playback.rate_max, cpu_dai->playback.rate_max); +min (codec_dai->playback.rate_max, + cpu_dai->playback.rate_max); runtime->hw.channels_min =max (codec_dai->playback.channels_min, cpu_dai->playback.channels_min);
@@ -193,9 +195,11 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) codec_dai->playback.rates & cpu_dai->playback.rates; }else { runtime->hw.rate_min = -max (codec_dai->capture.rate_min, cpu_dai->capture.rate_min); +max (codec_dai->capture.rate_min, + cpu_dai->capture.rate_min); runtime->hw.rate_max = -min (codec_dai->capture.rate_max, cpu_dai->capture.rate_max); +min (codec_dai->capture.rate_max, + cpu_dai->capture.rate_max); runtime->hw.channels_min =max (codec_dai->capture.channels_min, cpu_dai->capture.channels_min);
@@ -225,7 +229,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) goto machine_err; } -dbg ("asoc: %s <-> %s info:\n" ,codec_dai->name, cpu_dai->name); +dbg ("asoc: %s <-> %s info:\n" , codec_dai->name, cpu_dai->name);dbg ("asoc: rate mask 0x%x\n" , runtime->hw.rates);dbg ("asoc: min ch %d max ch %d\n" , runtime->hw.channels_min, runtime->hw.channels_max);
@@ -272,7 +276,7 @@ static void close_delayed_work(struct work_struct *work)int i;mutex_lock (&pcm_mutex); -for (i =0 ; i < codec->num_dai; i++) { +for (i =0 ; i < codec->num_dai; i++) { codec_dai = &codec->dai[i]; dbg("pop wq checking: %s status: %s waiting: %s\n",
@@ -511,7 +515,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,if (cpu_dai->ops.hw_params) { ret = cpu_dai->ops.hw_params (substream, params);if (ret <0 ) { -printk (KERN_ERR "asoc: can't set interface %s hw params\n" , +printk (KERN_ERR "asoc: interface %s hw params failed\n" , cpu_dai->name); goto interface_err; }
@@ -520,7 +524,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,if (platform->pcm_ops->hw_params) { ret = platform->pcm_ops->hw_params (substream, params);if (ret <0 ) { -printk (KERN_ERR "asoc: can't set platform %s hw params\n" , +printk (KERN_ERR "asoc: platform %s hw params failed\n" , platform->name); goto platform_err; }
@@ -539,7 +543,7 @@ interface_err: codec_dai->ops.hw_free (substream); codec_err: -if (machine->ops && machine->ops->hw_free) +if (machine->ops && machine->ops->hw_free) machine->ops->hw_free (substream);mutex_unlock (&pcm_mutex);
@@ -628,15 +632,15 @@ static struct snd_pcm_ops soc_pcm_ops = {/* powers down audio subsystem for suspend */ static int soc_suspend (struct platform_device *pdev,pm_message_t state) { -struct snd_soc_device *socdev =platform_get_drvdata (pdev); -struct snd_soc_machine *machine = socdev->machine; -struct snd_soc_platform *platform = socdev->platform; -struct snd_soc_codec_device *codec_dev = socdev->codec_dev; +struct snd_soc_device *socdev =platform_get_drvdata (pdev); +struct snd_soc_machine *machine = socdev->machine; +struct snd_soc_platform *platform = socdev->platform; +struct snd_soc_codec_device *codec_dev = socdev->codec_dev;struct snd_soc_codec *codec = socdev->codec;int i;/* mute any active DAC's */ -for (i =0 ; i < machine->num_links; i++) { +for (i =0 ; i < machine->num_links; i++) {struct snd_soc_codec_dai *dai = machine->dai_link[i].codec_dai;if (dai->dai_ops.digital_mute && dai->playback.active) dai->dai_ops.digital_mute (dai,1 );
@@ -649,7 +653,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)if (machine->suspend_pre) machine->suspend_pre (pdev, state); -for (i =0 ; i < machine->num_links; i++) { +for (i =0 ; i < machine->num_links; i++) {struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai;if (cpu_dai->suspend && cpu_dai->type !=SND_SOC_DAI_AC97 ) cpu_dai->suspend (pdev, cpu_dai);
@@ -661,7 +665,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)run_delayed_work (&socdev->delayed_work); codec->suspend_bias_level = codec->bias_level; -for (i =0 ; i < codec->num_dai; i++) { +for (i =0 ; i < codec->num_dai; i++) {char *stream = codec->dai[i].playback.stream_name;if (stream !=NULL ) snd_soc_dapm_stream_event(codec, stream,
@@ -675,7 +679,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)if (codec_dev->suspend) codec_dev->suspend (pdev, state); -for (i =0 ; i < machine->num_links; i++) { +for (i =0 ; i < machine->num_links; i++) {struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai;if (cpu_dai->suspend && cpu_dai->type ==SND_SOC_DAI_AC97 ) cpu_dai->suspend (pdev, cpu_dai);
@@ -690,17 +694,17 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)/* powers up audio subsystem after a suspend */ static int soc_resume (struct platform_device *pdev) { -struct snd_soc_device *socdev =platform_get_drvdata (pdev); -struct snd_soc_machine *machine = socdev->machine; -struct snd_soc_platform *platform = socdev->platform; -struct snd_soc_codec_device *codec_dev = socdev->codec_dev; +struct snd_soc_device *socdev =platform_get_drvdata (pdev); +struct snd_soc_machine *machine = socdev->machine; +struct snd_soc_platform *platform = socdev->platform; +struct snd_soc_codec_device *codec_dev = socdev->codec_dev;struct snd_soc_codec *codec = socdev->codec;int i;if (machine->resume_pre) machine->resume_pre (pdev); -for (i =0 ; i < machine->num_links; i++) { +for (i =0 ; i < machine->num_links; i++) {struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai;if (cpu_dai->resume && cpu_dai->type ==SND_SOC_DAI_AC97 ) cpu_dai->resume (pdev, cpu_dai);
@@ -709,8 +713,8 @@ static int soc_resume(struct platform_device *pdev)if (codec_dev->resume) codec_dev->resume (pdev); -for (i =0 ; i < codec->num_dai; i++) { -char * stream = codec->dai[i].playback.stream_name; +for (i =0 ; i < codec->num_dai; i++) { +char *stream = codec->dai[i].playback.stream_name;if (stream !=NULL )snd_soc_dapm_stream_event (codec, stream,SND_SOC_DAPM_STREAM_RESUME );
@@ -720,14 +724,14 @@ static int soc_resume(struct platform_device *pdev) SND_SOC_DAPM_STREAM_RESUME); } -/* unmute any active DAC's */ -for (i =0 ; i < machine->num_links; i++) { +/* unmute any active DACs */ +for (i =0 ; i < machine->num_links; i++) {struct snd_soc_codec_dai *dai = machine->dai_link[i].codec_dai;if (dai->dai_ops.digital_mute && dai->playback.active) dai->dai_ops.digital_mute (dai,0 ); } -for (i =0 ; i < machine->num_links; i++) { +for (i =0 ; i < machine->num_links; i++) {struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai;if (cpu_dai->resume && cpu_dai->type !=SND_SOC_DAI_AC97 ) cpu_dai->resume (pdev, cpu_dai);
@@ -757,7 +761,7 @@ static int soc_probe(struct platform_device *pdev)if (machine->probe) { ret = machine->probe (pdev); -if (ret <0 ) +if (ret <0 )return ret; }
@@ -765,20 +769,20 @@ static int soc_probe(struct platform_device *pdev)struct snd_soc_cpu_dai *cpu_dai = machine->dai_link[i].cpu_dai;if (cpu_dai->probe) { ret = cpu_dai->probe (pdev); -if (ret <0 ) +if (ret <0 ) goto cpu_dai_err; } }if (codec_dev->probe) { ret = codec_dev->probe (pdev); -if (ret <0 ) +if (ret <0 ) goto cpu_dai_err; }if (platform->probe) { ret = platform->probe (pdev); -if (ret <0 ) +if (ret <0 ) goto platform_err; }
@@ -865,7 +869,7 @@ static int soc_new_pcm(struct snd_soc_device *socdev, codec_dai->codec = socdev->codec;/* check client and interface hw capabilities */ -sprintf (new_name,"%s %s-%s-%d" ,dai_link->stream_name, codec_dai->name, +sprintf (new_name,"%s %s-%s-%d" , dai_link->stream_name, codec_dai->name,get_dai_name (cpu_dai->type), num);if (codec_dai->playback.channels_min)
@@ -876,7 +880,8 @@ static int soc_new_pcm(struct snd_soc_device *socdev, ret =snd_pcm_new (codec->card, new_name, codec->pcm_devs++, playback, capture, &pcm);if (ret <0 ) { -printk (KERN_ERR "asoc: can't create pcm for codec %s\n" , codec->name); +printk (KERN_ERR "asoc: can't create pcm for codec %s\n" , + codec->name);kfree (rtd);return ret; }
@@ -925,8 +930,9 @@ static ssize_t codec_reg_show(struct device *dev, step = codec->reg_cache_step; count +=sprintf (buf,"%s registers\n" , codec->name); -for (i =0 ; i < codec->reg_cache_size; i += step) - count +=sprintf (buf + count,"%2x: %4x\n" , i, codec->read (codec, i)); +for (i =0 ; i < codec->reg_cache_size; i += step) + count +=sprintf (buf + count,"%2x: %4x\n" , i, + codec->read (codec, i));return count; }
@@ -1069,7 +1075,7 @@ int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid)strncpy (codec->card->driver, codec->name,sizeof (codec->card->driver));/* create the pcms */ -for (i =0 ; i < machine->num_links; i++) { +for (i =0 ; i < machine->num_links; i++) { ret =soc_new_pcm (socdev, &machine->dai_link[i], i);if (ret <0 ) { printk(KERN_ERR "asoc: can't create pcm %s\n",
@@ -1099,7 +1105,7 @@ int snd_soc_register_card(struct snd_soc_device *socdev)struct snd_soc_machine *machine = socdev->machine;int ret =0 , i, ac97 =0 , err =0 ; -for (i =0 ; i < machine->num_links; i++) { +for (i =0 ; i < machine->num_links; i++) {if (socdev->machine->dai_link[i].init) { err = socdev->machine->dai_link[i].init (codec);if (err <0 ) {
@@ -1108,7 +1114,7 @@ int snd_soc_register_card(struct snd_soc_device *socdev)continue ; } } -if (socdev->machine->dai_link[i].codec_dai->type == +if (socdev->machine->dai_link[i].codec_dai->type ==SND_SOC_DAI_AC97_BUS ) ac97 =1 ; }
@@ -1119,7 +1125,7 @@ int snd_soc_register_card(struct snd_soc_device *socdev) ret =snd_card_register (codec->card);if (ret <0 ) { -printk (KERN_ERR "asoc: failed to register soundcard for codec %s\n" , +printk (KERN_ERR "asoc: failed to register soundcard for %s\n" , codec->name); goto out; }
@@ -1143,7 +1149,7 @@ int snd_soc_register_card(struct snd_soc_device *socdev) err =device_create_file (socdev->dev, &dev_attr_codec_reg);if (err <0 ) -printk (KERN_WARNING "asoc: failed to add codec sysfs entries\n" ); +printk (KERN_WARNING "asoc: failed to add codec sysfs files\n" );mutex_unlock (&codec->mutex);
@@ -1169,7 +1175,7 @@ void snd_soc_free_pcms(struct snd_soc_device *socdev)mutex_lock (&codec->mutex);#ifdef CONFIG_SND_SOC_AC97_BUS -for (i =0 ; i < codec->num_dai; i++) { +for (i =0 ; i < codec->num_dai; i++) { codec_dai = &codec->dai[i];if (codec_dai->type ==SND_SOC_DAI_AC97_BUS && codec->ac97) {soc_ac97_dev_unregister (codec);
@@ -1279,7 +1285,8 @@ int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,for (bitmask =1 ; bitmask < e->mask; bitmask <<=1 ) ; val =snd_soc_read (codec, e->reg); - ucontrol->value.enumerated.item[0 ] = (val >> e->shift_l) & (bitmask -1 ); + ucontrol->value.enumerated.item[0 ] + = (val >> e->shift_l) & (bitmask -1 );if (e->shift_l != e->shift_r) ucontrol->value.enumerated.item[1 ] = (val >> e->shift_r) & (bitmask -1 );
@@ -1573,7 +1580,8 @@ int snd_soc_put_volsw_2r(struct snd_kcontrol *kcontrol, val = val << shift; val2 = val2 << shift; -if ((err =snd_soc_update_bits (codec, reg, val_mask, val)) <0 ) + err =snd_soc_update_bits (codec, reg, val_mask, val); +if (err <0 )return err; err =snd_soc_update_bits (codec, reg2, val_mask, val2);
@@ -1589,7 +1597,7 @@ static int __devinit snd_soc_init(void)static void snd_soc_exit (void ) { -platform_driver_unregister (&soc_driver); +platform_driver_unregister (&soc_driver); }module_init (snd_soc_init);
Signature · 1 line
1.5.5.1
Re: [PATCH] ASoC: Clarify API for bias configuration
In reply to Mark BrownQuoted 10 lines · On Mon, 19 May 2008 11:20:39 +0100 "ext Mark Brown"…
Currently the ASoC core configures the bias levels in the system using a callback on codecs and machines called "
dapm_event", passing it PCI style power levels asSNDRV_CTL_POWER_constants. This is more obscure than it needs to be and has caused confusion to driver authors, especially given that DAPM is also performing power management.Address this by renaming the callback function to "
set_bias_level" and using constants explicitly representing the off, standby, pre-on and on states which DAPM transitions through.
First impression: Is that somewhat confusing to refer power state event as a bias level? First what comes to my is this related to mic bias...
If there's a need to change name of dapm_event callback, probably some dapm_device_event etc. would be better if need to separate from other dapm events?
include/sound/soc.h line 120
Quoted 7 lines
include/sound/soc.h +5
-0+enum snd_soc_bias_level { +SND_SOC_BIAS_ON , +SND_SOC_BIAS_PREPARE , +SND_SOC_BIAS_STANDBY , +SND_SOC_BIAS_OFF ,
Yeah, those SNDRV_CTL_POWER_ constants are not so clear and I think some more meaningful naming like here would be better.
Jarkko
Re: [PATCH] ASoC: Clarify API for bias configuration
Quoted 2 lines · Jarkko Nikula
First impression: Is that somewhat confusing to refer power state event as a bias level? First what comes to my is this related to mic bias...
Bias here is being used to refer to general DC offset levels on the AC inputs and outputs of the chip - microphone bias is just one of these levels. For a lot of codecs there's no or limited control of the baises but some do provide fine grained control.
Quoted 3 lines
If there's a need to change name of
dapm_eventcallback, probably somedapm_device_eventetc. would be better if need to separate from other dapm events?
Well, part of the goal was to make it clearer what sort of thing was expected to be configured by this function. I'm drawing a bit of a blank on a better name right now, though.
The tlv320aicx driver is fairly unusual in controlling the PLL here, though it shouldn't cause any problems either. Incidentally, it looks like this needs updating to reflect the support that was added for bypassing the PLL - presumably if the PLL is bypassed then enabling it during playback and record will consume power needlessly?
Most drivers expose clocking configuration like the PLL to machine drivers in order to allow use of clocks generated on the codec independently of the audio stream - if it's not needed outside of playback then generally it'd be set up in hw_params() and stopped in hw_free() or shutdown() to achieve a similar effect to what you're doing.
Re: [PATCH] ASoC: Clarify API for bias configuration
Quoted 5 lines · On Mon, 19 May 2008 19:36:55 +0100 "ext Mark Brown"…
Bias here is being used to refer to general DC offset levels on the AC inputs and outputs of the chip - microphone bias is just one of these levels. For a lot of codecs there's no or limited control of the baises but some do provide fine grained control.
It came to my mind only afterwards but probably usual set_power convention fits here well, doesn't confuse with DAPM and doesn't limit to thinking only mic bias :-)
Quoted 6 lines
The tlv320aicx driver is fairly unusual in controlling the PLL here, though it shouldn't cause any problems either. Incidentally, it looks like this needs updating to reflect the support that was added for bypassing the PLL - presumably if the PLL is bypassed then enabling it during playback and record will consume power needlessly?
Ah, you are right. There seems to be needless PLL power-up between dapm_event and aic3x_hw_params in case of PLL bypass even the aic3x_hw_parms disables it.
Also how on earth I was able to test my ASoC drivers for OMAP in case of codec slave since driver is enabling PLL only for master case. Hmm... what a hack I was using then.
Seems that some fixes are needed there.
Quoted 4 lines
Most drivers expose clocking configuration like the PLL to machine drivers in order to allow use of clocks generated on the codec independently of the audio stream - if it's not needed outside of
Some integrated chips might require it as well if there is some (undocumented) interdependencies inside the integrated chip. IRCC e.g. TSC2301 keypad and touchscreen were using audio clock in some occasions.
Jarkko
Re: [PATCH] ASoC: Clarify API for bias configuration
Quoted 8 lines · Jarkko Nikula
Quoted 2 lines · ext Mark Brown
levels. For a lot of codecs there's no or limited control of the baises but some do provide fine grained control.
It came to my mind only afterwards but probably usual
set_powerconvention fits here well, doesn't confuse with DAPM and doesn't limit to thinking only mic bias :-)
Hrm, depends - I can see people viewing it as an alternative to DAPM. Which, of course, you can do but it's not the Right Way.
This API really is intended for configuring biases and things like them. Maintaining biases is both power and output quality sensitive so it's beneficial for the core to be able to control them specifically. Other things are expected to be managed via either DAPM, feature-specific APIs (eg, the PLLs) or the regular power management interface. From that point of view it would be good to keep the bias name in at least the constants.
Quoted 3 lines
Also how on earth I was able to test my ASoC drivers for OMAP in case of codec slave since driver is enabling PLL only for master case. Hmm... what a hack I was using then.
Is the codec able to run entirely from the clocks on the audio bus, perhaps?
Quoted 7 lines
Quoted 3 lines
Most drivers expose clocking configuration like the PLL to machine drivers in order to allow use of clocks generated on the codec independently of the audio stream - if it's not needed outside of
Some integrated chips might require it as well if there is some (undocumented) interdependencies inside the integrated chip. IRCC e.g. TSC2301 keypad and touchscreen were using audio clock in some occasions.
Yeah, some of these chips would benefit from the clock API being easier to use for things outside the SoC, at least for the non-codec features.
Re: [PATCH] ASoC: Clarify API for bias configuration
Quoted 7 lines · On Fri, 23 May 2008 00:34:15 +0100 "ext Mark Brown"…
Quoted 3 lines
It came to my mind only afterwards but probably usual
set_powerconvention fits here well, doesn't confuse with DAPM and doesn't limit to thinking only mic bias :-)Hrm, depends - I can see people viewing it as an alternative to DAPM. Which, of course, you can do but it's not the Right Way.
Quoted 8 lines
This API really is intended for configuring biases and things like them. Maintaining biases is both power and output quality sensitive so it's beneficial for the core to be able to control them specifically. Other things are expected to be managed via either DAPM, feature-specific APIs (eg, the PLLs) or the regular power management interface. From that point of view it would be good to keep the bias name in at least the constants.
Ok, now I see. That would also clarify what's expected from this callback and what not.
Now snd_soc_dapm_device_event calling codec->dapm_event seems to be stream centric only. How about the case if only bypass path is active? Also then biases should be managed?
Quoted 7 lines
Quoted 3 lines
Also how on earth I was able to test my ASoC drivers for OMAP in case of codec slave since driver is enabling PLL only for master case. Hmm... what a hack I was using then.
Is the codec able to run entirely from the clocks on the audio bus, perhaps?
Yes it can but it requires to reconfigure input clock pin. Actually I found a hack below from my early development tree :-)
- if (aic3x->master) {
+ if (1/*aic3x->master*/) {
/* enable pll */
This needs to be fixed and also move PLL control out of dapm_event callback.
Jarkko
Re: [PATCH] ASoC: Clarify API for bias configuration
Quoted 3 lines · Jarkko Nikula
Now
snd_soc_dapm_device_eventcallingcodec->dapm_eventseems to be stream centric only. How about the case if only bypass path is active? Also then biases should be managed?
Yes, for best performance. However, it will need a more detailed look before changing anything due to the behaviour change if nothing else.
Quoted 3 lines · Mark Brown
The overwhelming majority just say "initial version" anyway.
Signed-off-by Mark Brown <[email protected]>
Quoted 228 lines
--- sound/soc/codecs/ac97.c | 3 --- sound/soc/codecs/wm9712.c | 3 --- sound/soc/codecs/wm9713.c | 3 --- sound/soc/pxa/corgi.c | 4 ---- sound/soc/pxa/pxa2xx-i2s.c | 3 --- sound/soc/pxa/spitz.c | 3 --- sound/soc/pxa/tosa.c | 3 --- sound/soc/s3c24xx/neo1973_wm8753.c | 4 ---- sound/soc/s3c24xx/s3c2443-ac97.c | 3 --- sound/soc/s3c24xx/s3c24xx-i2s.c | 5 ----- sound/soc/s3c24xx/s3c24xx-pcm.c | 4 ---- sound/soc/s3c24xx/smdk2443_wm9710.c | 3 --- sound/soc/soc-core.c | 4 ---- sound/soc/soc-dapm.c | 5 ----- 14 files changed, 0 insertions(+), 50 deletions(-)sound/soc/codecs/ac97.c +0
-3@@ -10,9 +10,6 @@* Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * -* Revision history -* 17th Oct 2005 Initial version. -* * Generic AC97 support. */ sound/soc/codecs/wm9712.c +0
-3@@ -9,9 +9,6 @@* under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. -* -* Revision history -* 4th Feb 2006 Initial version. */ #include <linux/init.h> sound/soc/codecs/wm9713.c +0
-3@@ -10,9 +10,6 @@* Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * -* Revision history -* 4th Feb 2006 Initial version. -* * Features:- * * o Support for AC97 Codec, Voice DAC and Aux DAC sound/soc/pxa/corgi.c +0
-4@@ -11,10 +11,6 @@* under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. -* -* Revision history -* 30th Nov 2005 Initial version. -* */ #include <linux/module.h> sound/soc/pxa/pxa2xx-i2s.c +0
-3@@ -9,9 +9,6 @@* under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. -* -* Revision history -* 12th Aug 2005 Initial version. */ #include <linux/init.h> sound/soc/pxa/spitz.c +0
-3@@ -12,9 +12,6 @@* Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * -* Revision history -* 30th Nov 2005 Initial version. -* */ #include <linux/module.h> sound/soc/pxa/tosa.c +0
-3@@ -12,9 +12,6 @@* Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * -* Revision history -* 30th Nov 2005 Initial version. -* * GPIO's * 1 - Jack Insertion * 5 - Hookswitch (headset answer/hang up switch) sound/soc/s3c24xx/neo1973_wm8753.c +0
-4@@ -10,10 +10,6 @@* Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * -* Revision history -* 20th Jan 2007 Initial version. -* 05th Feb 2007 Rename all to Neo1973 -* */ #include <linux/module.h> sound/soc/s3c24xx/s3c2443-ac97.c +0
-3@@ -10,9 +10,6 @@* This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. -* -* Revision history -* 21st Mar 2007 Initial Version */ #include <linux/init.h> sound/soc/s3c24xx/s3c24xx-i2s.c +0
-5@@ -12,11 +12,6 @@* under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. -* -* -* Revision history -* 11th Dec 2006 Merged with Simtec driver -* 10th Nov 2006 Initial version. */ #include <linux/init.h> sound/soc/s3c24xx/s3c24xx-pcm.c +0
-4@@ -12,10 +12,6 @@* under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. -* -* Revision history -* 11th Dec 2006 Merged with Simtec driver -* 10th Nov 2006 Initial version. */ #include <linux/module.h> sound/soc/s3c24xx/smdk2443_wm9710.c +0
-3@@ -10,9 +10,6 @@* Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * -* Revision history -* 8th Mar 2007 Initial version. -* */ #include <linux/module.h> sound/soc/soc-core.c +0
-4@@ -14,10 +14,6 @@* Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * -* Revision history -* 12th Aug 2005 Initial version. -* 25th Oct 2005 Working Codec, Interface and Platform registration. -* * TODO: * o Add hw rules to enforce rates, etc. * o More testing with other codecs/machines. sound/soc/soc-dapm.c +0
-5@@ -10,11 +10,6 @@* Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * -* Revision history -* 12th Aug 2005 Initial version. -* 25th Oct 2005 Implemented path power domain. -* 18th Dec 2005 Implemented machine and stream level power domain. -* * Features: * o Changes power status of internal codec blocks depending on the * dynamic configuration of codec internal audio paths and active Signature · 6 lines
1.5.5.1 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Signature · 5 lines
-- Ben Q: What's a light-year? A: One-third less calories than a regular year.
Takashi Iwai
AppliedAt Mon, 19 May 2008 11:20:38 +0100,
Quoted 4 lines · Mark Brown
The overwhelming majority just say "initial version" anyway.
Signed-off-by Mark Brown <[email protected]>
Thanks, applied all 4 patches now.
Takashi