ASoC: Add iPAQ RX1950 support
Subsystems (4)
v4 cover ASoC: Add iPAQ RX1950 support
These three patches are necessary to add sound support for iPAQ RX1950 PDA, appropriate mach-rx1950.c patch is missing, as it depends on battery and LEDs patches which are still not merged nor reviewed.
First patch improves situation with power consumption for uda1380 and also fixes suspend/resume.
Second patch just adds glue driver.
Third patch fixes s3c_device_iis name and exports s3c_device_pcm for all s3c24xx-based devices.
PATCH v4 1/3 ASoC: uda1380: make driver more powersave-friendly
Disable some codec modules in standby mode, completely disable codec in off mode to save some power.
Fix suspend/resume: mark mixer regs as dirty on resume to restore mixer values, otherwise driver produces no sound (master is muted by default).
--- sound/soc/codecs/uda1380.c | 140 +++++++++++++++++++++++++++++++------------- 1 files changed, 99 insertions(+), 41 deletions(-)
sound/soc/codecs/uda1380.c +99 -41
@@ -39,6 +39,7 @@ struct uda1380_priv {u16 reg_cache[UDA1380_CACHEREGNUM ];unsigned int dac_clk;struct work_struct work; +void *control_data; };/*
@@ -129,7 +130,46 @@ static int uda1380_write(struct snd_soc_codec *codec, unsigned int reg,return -EIO ; } -#define uda1380_reset (c) uda1380_write(c, UDA1380_RESET, 0) +static void uda1380_sync_cache (struct snd_soc_codec *codec) +{ +int reg; +u8 data[3 ]; +u16 *cache = codec->reg_cache; + +/* Sync reg_cache with the hardware */ +for (reg =0 ; reg <UDA1380_MVOL ; reg++) { + data[0 ] = reg; + data[1 ] = (cache[reg] &0xff00 ) >>8 ; + data[2 ] = cache[reg] &0x00ff ; +if (codec->hw_write (codec->control_data, data,3 ) !=3 ) +dev_err (codec->dev,"%s: write to reg 0x%x failed\n" , + __func__, reg); + } +} + +static int uda1380_reset (struct snd_soc_codec *codec) +{ +struct uda1380_platform_data *pdata = codec->dev->platform_data; + +if (pdata->gpio_reset != -EINVAL ) { +gpio_set_value (pdata->gpio_reset,1 ); +mdelay (1 ); +gpio_set_value (pdata->gpio_reset,0 ); + }else { +u8 data[3 ]; + + data[0 ] =UDA1380_RESET ; + data[1 ] =0 ; + data[2 ] =0 ; + +if (codec->hw_write (codec->control_data, data,3 ) !=3 ) { +dev_err (codec->dev,"%s: failed\n" , __func__); +return -EIO ; + } + } + +return 0 ; +}static void uda1380_flush_work (struct work_struct *work) {
@@ -145,7 +185,6 @@ static void uda1380_flush_work(struct work_struct *work) uda1380_read_reg_cache(uda1380_codec, reg));clear_bit (bit, &uda1380_cache_dirty); } - }/* declarations of ALSA reg_elem_REAL controls */
@@ -560,18 +599,40 @@ static int uda1380_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) {int pm =uda1380_read_reg_cache (codec,UDA1380_PM ); +struct uda1380_platform_data *pdata = codec->dev->platform_data; + +if (codec->bias_level == level) +return 0 ;switch (level) {case SND_SOC_BIAS_ON :case SND_SOC_BIAS_PREPARE : +/* ADC, DAC on */ uda1380_write (codec,UDA1380_PM ,R02_PON_BIAS | pm);break ;case SND_SOC_BIAS_STANDBY : -uda1380_write (codec,UDA1380_PM ,R02_PON_BIAS ); -break ; -case SND_SOC_BIAS_OFF : +if (codec->bias_level ==SND_SOC_BIAS_OFF ) { +if (pdata->gpio_power != -EINVAL ) { +gpio_set_value (pdata->gpio_power,1 ); +uda1380_reset (codec); + } + +uda1380_sync_cache (codec); + }uda1380_write (codec,UDA1380_PM ,0x0 );break ; +case SND_SOC_BIAS_OFF : +if (pdata->gpio_power != -EINVAL ) { +int reg; +gpio_set_value (pdata->gpio_power,0 ); + +/* Mark mixer regs cache dirty to sync them with +* codec regs on power on. +*/ +for (reg =UDA1380_MVOL ; reg <UDA1380_CACHEREGNUM ; + reg++) +set_bit (reg -0x10 , &uda1380_cache_dirty); + } } codec->bias_level = level;return 0 ;
@@ -651,16 +712,6 @@ static int uda1380_suspend(struct snd_soc_codec *codec, pm_message_t state)static int uda1380_resume (struct snd_soc_codec *codec) { -int i; -u8 data[2 ]; -u16 *cache = codec->reg_cache; - -/* Sync reg_cache with the hardware */ -for (i =0 ; i <ARRAY_SIZE (uda1380_reg); i++) { - data[0 ] = (i <<1 ) | ((cache[i] >>8 ) &0x0001 ); - data[1 ] = cache[i] &0x00ff ; - codec->hw_write (codec->control_data, data,2 ); - }uda1380_set_bias_level (codec,SND_SOC_BIAS_STANDBY );return 0 ; }
@@ -671,29 +722,32 @@ static int uda1380_probe(struct snd_soc_codec *codec)struct uda1380_priv *uda1380 =snd_soc_codec_get_drvdata (codec);int ret; + uda1380->codec = codec; + codec->hw_write = (hw_write_t )i2c_master_send; + codec->control_data = uda1380->control_data; -if (!pdata || !pdata->gpio_power || !pdata->gpio_reset) +if (!pdata)return -EINVAL ; - ret =gpio_request (pdata->gpio_power,"uda1380 power" ); -if (ret) -return ret; - ret =gpio_request (pdata->gpio_reset,"uda1380 reset" ); -if (ret) - goto err_gpio; - -gpio_direction_output (pdata->gpio_power,1 ); - -/* we may need to have the clock running here - pH5 */ -gpio_direction_output (pdata->gpio_reset,1 ); -udelay (5 ); -gpio_set_value (pdata->gpio_reset,0 ); +if (pdata->gpio_reset != -EINVAL ) { + ret =gpio_request (pdata->gpio_reset,"uda1380 reset" ); +if (ret) + goto err_out; +gpio_direction_output (pdata->gpio_reset,0 ); + } - ret =uda1380_reset (codec); -if (ret <0 ) { -dev_err (codec->dev,"Failed to issue reset\n" ); - goto err_reset; +if (pdata->gpio_power != -EINVAL ) { + ret =gpio_request (pdata->gpio_power,"uda1380 power" ); +if (ret) + goto err_gpio; +gpio_direction_output (pdata->gpio_power,0 ); + }else { + ret =uda1380_reset (codec); +if (ret) { +dev_err (codec->dev,"Failed to issue reset\n" ); + goto err_reset; + } }INIT_WORK (&uda1380->work, uda1380_flush_work);
@@ -703,10 +757,11 @@ static int uda1380_probe(struct snd_soc_codec *codec)/* set clock input */ switch (pdata->dac_clk) {case UDA1380_DAC_CLK_SYSCLK : -uda1380_write (codec,UDA1380_CLK ,0 ); +uda1380_write_reg_cache (codec,UDA1380_CLK ,0 );break ;case UDA1380_DAC_CLK_WSPLL : -uda1380_write (codec,UDA1380_CLK ,R00_DAC_CLK ); +uda1380_write_reg_cache (codec,UDA1380_CLK , +R00_DAC_CLK );break ; }
@@ -717,10 +772,12 @@ static int uda1380_probe(struct snd_soc_codec *codec)return 0 ; err_reset: -gpio_set_value (pdata->gpio_power,0 ); -gpio_free (pdata->gpio_reset); +if (pdata->gpio_reset != -EINVAL ) +gpio_free (pdata->gpio_reset); err_gpio: -gpio_free (pdata->gpio_power); +if (pdata->gpio_power != -EINVAL ) +gpio_free (pdata->gpio_power); +err_out:return ret; }
@@ -731,7 +788,6 @@ static int uda1380_remove(struct snd_soc_codec *codec)uda1380_set_bias_level (codec,SND_SOC_BIAS_OFF ); -gpio_set_value (pdata->gpio_power,0 );gpio_free (pdata->gpio_reset);gpio_free (pdata->gpio_power);
@@ -743,8 +799,8 @@ static struct snd_soc_codec_driver soc_codec_dev_uda1380 = { .remove = uda1380_remove, .suspend = uda1380_suspend, .resume = uda1380_resume, - .read = uda1380_read_reg_cache, - .write = uda1380_write, + .read = uda1380_read_reg_cache, + .write = uda1380_write, .set_bias_level = uda1380_set_bias_level, .reg_cache_size = ARRAY_SIZE(uda1380_reg), .reg_word_size = sizeof(u16),
@@ -764,11 +820,13 @@ static __devinit int uda1380_i2c_probe(struct i2c_client *i2c,return -ENOMEM ;i2c_set_clientdata (i2c, uda1380); + uda1380->control_data = i2c; ret =snd_soc_register_codec (&i2c->dev, &soc_codec_dev_uda1380, uda1380_dai,ARRAY_SIZE (uda1380_dai));if (ret <0 )kfree (uda1380); +return ret; }
Signature · 1 line
1.7.2
Re: [PATCH v4 1/3] ASoC: uda1380: make driver more powersave-friendly
Dne Ne 29. srpna 2010 19:11:10 Vasily Khoruzhick napsal(a):
Quoted 17 lines
Disable some codec modules in standby mode, completely disable codec in off mode to save some power.
Fix suspend/resume: mark mixer regs as dirty on resume to restore mixer values, otherwise driver produces no sound (master is muted by default).Signed-off-by Vasily Khoruzhick <[email protected]>--- sound/soc/codecs/uda1380.c | 140+++++++++++++++++++++++++++++++------------- 1 files changed, 99 insertions(+), 41 deletions(-)
sound/soc/codecs/uda1380.c +0
-0
sound/soc/codecs/uda1380.c struct uda1380_priv { · line 42
Quoted 4 lines
sound/soc/codecs/uda1380.c +1
-0@@ -39,6 +39,7 @@ struct uda1380_priv {u16 reg_cache[UDA1380_CACHEREGNUM ];unsigned int dac_clk;struct work_struct work; +void *control_data;
It's already in codec->control_data, isn't it ?
Quoted 52 lines
sound/soc/codecs/uda1380.c +40
-1};/* @@ -129,7 +130,46 @@ static int uda1380_write(struct snd_soc_codec *codec, unsigned int reg, return -EIO; } -#define uda1380_reset (c) uda1380_write(c, UDA1380_RESET, 0) +static void uda1380_sync_cache (struct snd_soc_codec *codec) +{ +int reg; +u8 data[3 ]; +u16 *cache = codec->reg_cache; + +/* Sync reg_cache with the hardware */ +for (reg =0 ; reg <UDA1380_MVOL ; reg++) { + data[0 ] = reg; + data[1 ] = (cache[reg] &0xff00 ) >>8 ; + data[2 ] = cache[reg] &0x00ff ; +if (codec->hw_write (codec->control_data, data,3 ) !=3 ) +dev_err (codec->dev,"%s: write to reg 0x%x failed\n" , + __func__, reg); + } +} + +static int uda1380_reset (struct snd_soc_codec *codec) +{ +struct uda1380_platform_data *pdata = codec->dev->platform_data; + +if (pdata->gpio_reset != -EINVAL ) { +gpio_set_value (pdata->gpio_reset,1 ); +mdelay (1 ); +gpio_set_value (pdata->gpio_reset,0 ); + }else { +u8 data[3 ]; + + data[0 ] =UDA1380_RESET ; + data[1 ] =0 ; + data[2 ] =0 ; + +if (codec->hw_write (codec->control_data, data,3 ) !=3 ) { +dev_err (codec->dev,"%s: failed\n" , __func__); +return -EIO ; + } + } + +return 0 ; +}static void uda1380_flush_work (struct work_struct *work) {
sound/soc/codecs/uda1380.c static void uda1380_flush_work(struct work_struct · line 148
Quoted 4 lines
sound/soc/codecs/uda1380.c +0
-1@@ -145,7 +185,6 @@ static void uda1380_flush_work(struct work_struct *work) uda1380_read_reg_cache(uda1380_codec, reg));clear_bit (bit, &uda1380_cache_dirty); } -
Remove
Quoted 21 lines
sound/soc/codecs/uda1380.c +5
-2}/* declarations of ALSA reg_elem_REAL controls */ @@ -560,18 +599,40 @@ static int uda1380_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { int pm = uda1380_read_reg_cache(codec, UDA1380_PM); +struct uda1380_platform_data *pdata = codec->dev->platform_data; + +if (codec->bias_level == level) +return 0 ;switch (level) {case SND_SOC_BIAS_ON :case SND_SOC_BIAS_PREPARE : +/* ADC, DAC on */ uda1380_write (codec,UDA1380_PM ,R02_PON_BIAS | pm);break ;case SND_SOC_BIAS_STANDBY : -uda1380_write (codec,UDA1380_PM ,R02_PON_BIAS ); -break ;
sound/soc/codecs/uda1380.c static int uda1380_set_bias_level(struct · line 622
Quoted 10 lines
sound/soc/codecs/uda1380.c +8
-1-case SND_SOC_BIAS_OFF : +if (codec->bias_level ==SND_SOC_BIAS_OFF ) { +if (pdata->gpio_power != -EINVAL ) { +gpio_set_value (pdata->gpio_power,1 ); +uda1380_reset (codec); + } + +uda1380_sync_cache (codec); + }uda1380_write (codec,UDA1380_PM ,0x0 );
Maybe some comment won't hurt here about what that 0x0 does.
sound/soc/codecs/uda1380.c static int uda1380_set_bias_level(struct snd_soc_codec *codec, · line 624
Quoted 2 lines
sound/soc/codecs/uda1380.c +1
-0break ; +case SND_SOC_BIAS_OFF :
if (pdata->gpio_power == -EINVAL)
break;
...code...
might help your alignment below.
Quoted 48 lines
sound/soc/codecs/uda1380.c +11
-10+if (pdata->gpio_power != -EINVAL ) { +int reg; +gpio_set_value (pdata->gpio_power,0 ); + +/* Mark mixer regs cache dirty to sync them with +* codec regs on power on. +*/ +for (reg =UDA1380_MVOL ; reg <UDA1380_CACHEREGNUM ; + reg++) +set_bit (reg -0x10 , &uda1380_cache_dirty); + } } codec->bias_level = level;return 0 ;@@ -651,16 +712,6 @@ static int uda1380_suspend(struct snd_soc_codec *codec, pm_message_t state)static int uda1380_resume (struct snd_soc_codec *codec) { -int i; -u8 data[2 ]; -u16 *cache = codec->reg_cache; - -/* Sync reg_cache with the hardware */ -for (i =0 ; i <ARRAY_SIZE (uda1380_reg); i++) { - data[0 ] = (i <<1 ) | ((cache[i] >>8 ) &0x0001 ); - data[1 ] = cache[i] &0x00ff ; - codec->hw_write (codec->control_data, data,2 ); - }uda1380_set_bias_level (codec,SND_SOC_BIAS_STANDBY );return 0 ;}
sound/soc/codecs/uda1380.c +4
-4@@ -671,29 +722,32 @@ static int uda1380_probe(struct snd_soc_codec *codec)struct uda1380_priv *uda1380 =snd_soc_codec_get_drvdata (codec);int ret; + uda1380->codec = codec; + codec->hw_write = (hw_write_t )i2c_master_send; + codec->control_data = uda1380->control_data; -if (!pdata || !pdata->gpio_power || !pdata->gpio_reset) +if (!pdata)return -EINVAL ; - ret =gpio_request (pdata->gpio_power,"uda1380 power" ); -if (ret) -return ret;
sound/soc/codecs/uda1380.c static int uda1380_probe(struct snd_soc_codec *codec) · line 691
Quoted 10 lines
sound/soc/codecs/uda1380.c +0
-10- ret =gpio_request (pdata->gpio_reset,"uda1380 reset" ); -if (ret) - goto err_gpio; - -gpio_direction_output (pdata->gpio_power,1 ); - -/* we may need to have the clock running here - pH5 */ -gpio_direction_output (pdata->gpio_reset,1 ); -udelay (5 ); -gpio_set_value (pdata->gpio_reset,0 );
if (gpio_is_valid(...gpio...)) {
}
sound/soc/codecs/uda1380.c static int uda1380_probe(struct snd_soc_codec *codec) · line 737
Quoted 5 lines
sound/soc/codecs/uda1380.c +5
-0+if (pdata->gpio_reset != -EINVAL ) { + ret =gpio_request (pdata->gpio_reset,"uda1380 reset" ); +if (ret) + goto err_out; +gpio_direction_output (pdata->gpio_reset,0 );
Handle return value and dont depend on this setting the GPIO value, use gpio_set_value() too please.
Quoted 8 lines
sound/soc/codecs/uda1380.c +3
-4+ } - ret =uda1380_reset (codec); -if (ret <0 ) { -dev_err (codec->dev,"Failed to issue reset\n" ); - goto err_reset; +if (pdata->gpio_power != -EINVAL ) { + ret =gpio_request (pdata->gpio_power,"uda1380 power" );
sound/soc/codecs/uda1380.c static int uda1380_probe(struct snd_soc_codec *codec) · line 751
Quoted 10 lines
sound/soc/codecs/uda1380.c +9
-0+if (ret) + goto err_gpio; +gpio_direction_output (pdata->gpio_power,0 ); + }else { + ret =uda1380_reset (codec); +if (ret) { +dev_err (codec->dev,"Failed to issue reset\n" ); + goto err_reset; + } }
Ditto.
Quoted 17 lines
sound/soc/codecs/uda1380.c +3
-2INIT_WORK (&uda1380->work, uda1380_flush_work);@@ -703,10 +757,11 @@ static int uda1380_probe(struct snd_soc_codec *codec)/* set clock input */ switch (pdata->dac_clk) {case UDA1380_DAC_CLK_SYSCLK : -uda1380_write (codec,UDA1380_CLK ,0 ); +uda1380_write_reg_cache (codec,UDA1380_CLK ,0 );break ;case UDA1380_DAC_CLK_WSPLL : -uda1380_write (codec,UDA1380_CLK ,R00_DAC_CLK ); +uda1380_write_reg_cache (codec,UDA1380_CLK , +R00_DAC_CLK );break ; }
sound/soc/codecs/uda1380.c static int uda1380_probe(struct snd_soc_codec *codec) · line 776
Quoted 7 lines
sound/soc/codecs/uda1380.c +2
-2@@ -717,10 +772,12 @@ static int uda1380_probe(struct snd_soc_codec *codec)return 0 ; err_reset: -gpio_set_value (pdata->gpio_power,0 ); -gpio_free (pdata->gpio_reset); +if (pdata->gpio_reset != -EINVAL ) +gpio_free (pdata->gpio_reset);
Ditto
sound/soc/codecs/uda1380.c static int uda1380_probe(struct snd_soc_codec *codec) · line 779
Quoted 4 lines
sound/soc/codecs/uda1380.c +2
-1err_gpio: -gpio_free (pdata->gpio_power); +if (pdata->gpio_power != -EINVAL ) +gpio_free (pdata->gpio_power);
Ditto
Quoted 24 lines
sound/soc/codecs/uda1380.c +3
-3+err_out:return ret; }@@ -731,7 +788,6 @@ static int uda1380_remove(struct snd_soc_codec *codec)uda1380_set_bias_level (codec,SND_SOC_BIAS_OFF ); -gpio_set_value (pdata->gpio_power,0 );gpio_free (pdata->gpio_reset);gpio_free (pdata->gpio_power);@@ -743,8 +799,8 @@ static struct snd_soc_codec_driver soc_codec_dev_uda1380 = { .remove = uda1380_remove, .suspend = uda1380_suspend, .resume = uda1380_resume, - .read = uda1380_read_reg_cache, - .write = uda1380_write, + .read = uda1380_read_reg_cache, + .write = uda1380_write, .set_bias_level = uda1380_set_bias_level, .reg_cache_size = ARRAY_SIZE(uda1380_reg), .reg_word_size = sizeof(u16),
sound/soc/codecs/uda1380.c static __devinit int uda1380_i2c_probe(struct · line 823
Quoted 4 lines
sound/soc/codecs/uda1380.c +1
-0@@ -764,11 +820,13 @@ static __devinit int uda1380_i2c_probe(struct i2c_client *i2c, return -ENOMEM ;i2c_set_clientdata (i2c, uda1380); + uda1380->control_data = i2c;
So is this needed ? Can't you access codec->control_data ?
sound/soc/codecs/uda1380.c static __devinit int uda1380_i2c_probe(struct · line 825
Quoted 3 lines
sound/soc/codecs/uda1380.c +0
-0ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_uda1380, uda1380_dai,
ARRAY_SIZE(uda1380_dai));
sound/soc/codecs/uda1380.c static __devinit int uda1380_i2c_probe(struct i2c_client *i2c, · line 829
Quoted 3 lines
sound/soc/codecs/uda1380.c +1
-0if (ret <0 )kfree (uda1380); +
Remove
sound/soc/codecs/uda1380.c static __devinit int uda1380_i2c_probe(struct · line 830
Quoted 2 lines
sound/soc/codecs/uda1380.c +0
-0return ret; }
Cheers
Re: [PATCH v4 1/3] ASoC: uda1380: make driver more powersave-friendly
В сообщении от 29 августа 2010 20:37:03 автор Marek Vasut написал:
Quoted 4 lines
sound/soc/codecs/uda1380.c struct uda1380_priv { · line 42
Quoted 1 line
sound/soc/codecs/uda1380.c +1
-0+void *control_data;It's already in
codec->control_data, isn't it ?
I'm using priv->control_data as temporary storage to initialize codec-
Quoted 5 lines
control_datalater, as there's nosnd_soc_codecini2c_probeQuoted 3 lines
(quoted diff) +0
-0@@ -145,7 +185,6 @@ static void uda1380_flush_work(struct work_struct *work) uda1380_read_reg_cache(uda1380_codec, reg));
Quoted 7 lines
sound/soc/codecs/uda1380.c static void uda1380_flush_work(struct work_struct *work) · line 148
Quoted 5 lines
sound/soc/codecs/uda1380.c +0
-1clear_bit (bit, &uda1380_cache_dirty); } -Remove
It improves code formatting.
Quoted 34 lines
Quoted 34 lines
sound/soc/codecs/uda1380.c +13
-3@@ -560,18 +599,40 @@ static int uda1380_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { int pm = uda1380_read_reg_cache(codec, UDA1380_PM); +struct uda1380_platform_data *pdata = codec->dev->platform_data; + +if (codec->bias_level == level) +return 0 ;switch (level) {case SND_SOC_BIAS_ON :case SND_SOC_BIAS_PREPARE : +/* ADC, DAC on */ uda1380_write (codec,UDA1380_PM ,R02_PON_BIAS | pm);break ;case SND_SOC_BIAS_STANDBY : -uda1380_write (codec,UDA1380_PM ,R02_PON_BIAS ); -break ; -case SND_SOC_BIAS_OFF : +if (codec->bias_level ==SND_SOC_BIAS_OFF ) { +if (pdata->gpio_power != -EINVAL ) { +gpio_set_value (pdata->gpio_power,1 ); +uda1380_reset (codec); + } + +uda1380_sync_cache (codec); + }
Quoted 3 lines
Quoted 1 line
uda1380_write(codec, UDA1380_PM, 0x0);Maybe some comment won't hurt here about what that
0x0does.
Well, code explain it pretty well, it puts codec into stand-by mode :)
Quoted 8 lines
sound/soc/codecs/uda1380.c static int uda1380_set_bias_level(struct snd_soc_codec *codec, · line 624
Quoted 3 lines
sound/soc/codecs/uda1380.c +1
-0break ; +case SND_SOC_BIAS_OFF :if (
pdata->gpio_power==-EINVAL)break;...code...
might help your alignment below.
Ok
Quoted 72 lines
Quoted 59 lines
sound/soc/codecs/uda1380.c +11
-10+if (pdata->gpio_power != -EINVAL ) { +int reg; +gpio_set_value (pdata->gpio_power,0 ); + +/* Mark mixer regs cache dirty to sync them with +* codec regs on power on. +*/ +for (reg =UDA1380_MVOL ; reg <UDA1380_CACHEREGNUM ; + reg++) +set_bit (reg -0x10 , &uda1380_cache_dirty); + } } codec->bias_level = level;return 0 ;@@ -651,16 +712,6 @@ static int uda1380_suspend(struct snd_soc_codec *codec, pm_message_t state)static int uda1380_resume (struct snd_soc_codec *codec) { -int i; -u8 data[2 ]; -u16 *cache = codec->reg_cache; - -/* Sync reg_cache with the hardware */ -for (i =0 ; i <ARRAY_SIZE (uda1380_reg); i++) { - data[0 ] = (i <<1 ) | ((cache[i] >>8 ) &0x0001 ); - data[1 ] = cache[i] &0x00ff ; - codec->hw_write (codec->control_data, data,2 ); - }sound/soc/codecs/uda1380.c +4
-4uda1380_set_bias_level (codec,SND_SOC_BIAS_STANDBY );return 0 ; }@@ -671,29 +722,32 @@ static int uda1380_probe(struct snd_soc_codec *codec)struct uda1380_priv *uda1380 =snd_soc_codec_get_drvdata (codec);int ret; + uda1380->codec = codec; + codec->hw_write = (hw_write_t )i2c_master_send; + codec->control_data = uda1380->control_data; -if (!pdata || !pdata->gpio_power || !pdata->gpio_reset) +if (!pdata)return -EINVAL ; - ret =gpio_request (pdata->gpio_power,"uda1380 power" ); -if (ret) -return ret;sound/soc/codecs/uda1380.c static int uda1380_probe(struct snd_soc_codec · line 696
Quoted 10 lines
sound/soc/codecs/uda1380.c +0
-10- ret =gpio_request (pdata->gpio_reset,"uda1380 reset" ); -if (ret) - goto err_gpio; - -gpio_direction_output (pdata->gpio_power,1 ); - -/* we may need to have the clock running here - pH5 */ -gpio_direction_output (pdata->gpio_reset,1 ); -udelay (5 ); -gpio_set_value (pdata->gpio_reset,0 );if (
gpio_is_valid(...gpio...)) {
Quoted 1 line
}
Will not work for s3c24xx:
static inline int gpio_is_valid(int number)
{
/* only some non-negative numbers are valid */
return ((unsigned)number) < ARCH_NR_GPIOS;
}Quoted 8 lines
sound/soc/codecs/uda1380.c static int uda1380_probe(struct snd_soc_codec *codec) · line 737
Quoted 5 lines
sound/soc/codecs/uda1380.c +5
-0+if (pdata->gpio_reset != -EINVAL ) { + ret =gpio_request (pdata->gpio_reset,"uda1380 reset" ); +if (ret) + goto err_out; +gpio_direction_output (pdata->gpio_reset,0 );Handle return value and dont depend on this setting the GPIO value, use
gpio_set_value()too please.
This code handles reset-less machines (for example, h1940). gpio_direction_output is neccessary here to ensure that pin is in output mode.
Quoted 18 lines
Quoted 18 lines
sound/soc/codecs/uda1380.c +12
-4+ } - ret =uda1380_reset (codec); -if (ret <0 ) { -dev_err (codec->dev,"Failed to issue reset\n" ); - goto err_reset; +if (pdata->gpio_power != -EINVAL ) { + ret =gpio_request (pdata->gpio_power,"uda1380 power" ); +if (ret) + goto err_gpio; +gpio_direction_output (pdata->gpio_power,0 ); + }else { + ret =uda1380_reset (codec); +if (ret) { +dev_err (codec->dev,"Failed to issue reset\n" ); + goto err_reset; + }
Quoted 3 lines
Quoted 1 line
}
Ditto.
Handling here machine which lacks power pin.
Quoted 3 lines
sound/soc/codecs/uda1380.c static __devinit int uda1380_i2c_probe(struct i2c_client *i2c, · line 823
Quoted 1 line
sound/soc/codecs/uda1380.c +1
-0+ uda1380->control_data = i2c;So is this needed ? Can't you access
codec->control_data?
See comment above.
Quoted 5 lines
sound/soc/codecs/uda1380.c static __devinit int uda1380_i2c_probe(struct i2c_client *i2c,
Quoted 3 lines
sound/soc/codecs/uda1380.c +1
-0kfree (uda1380); +Remove
It improves formatting.
Quoted 5 lines
Quoted 3 lines
return ret;
}
Cheers
thanks,
Regards
Vasily
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH v4 1/3] ASoC: uda1380: make driver more powersave-friendly
Dne Ne 29. srpna 2010 20:13:07 Vasily Khoruzhick napsal(a):
Quoted 8 lines
В сообщении от 29 августа 2010 20:37:03 автор Marek Vasut написал:
Quoted 3 lines
sound/soc/codecs/uda1380.c struct uda1380_priv { · line 42
Quoted 1 line
sound/soc/codecs/uda1380.c +1
-0+void *control_data;It's already in
codec->control_data, isn't it ?I'm using
priv->control_dataas temporary storage to initialize codec-Quoted 1 line
control_datalater, as there's nosnd_soc_codecini2c_probe
Now I know, nevermind.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
sound/soc/codecs/uda1380.c +0
-0@@ -145,7 +185,6 @@ static void uda1380_flush_work(struct work_struct *work) uda1380_read_reg_cache(uda1380_codec, reg));clear_bit (bit, &uda1380_cache_dirty);
Quoted 7 lines
Quoted 5 lines
sound/soc/codecs/uda1380.c static void uda1380_flush_work(struct work_struct *work) · line 148
Quoted 3 lines
sound/soc/codecs/uda1380.c +0
-1} -Remove
It improves code formatting.
It's unrelated to this patch though ... maybe some general "formating fixes" patch would be appropriate.
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
sound/soc/codecs/uda1380.c +13
-3@@ -560,18 +599,40 @@ static int uda1380_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { int pm = uda1380_read_reg_cache(codec, UDA1380_PM); +struct uda1380_platform_data *pdata = codec->dev->platform_data; + +if (codec->bias_level == level) +return 0 ;switch (level) {case SND_SOC_BIAS_ON :case SND_SOC_BIAS_PREPARE : +/* ADC, DAC on */ uda1380_write (codec,UDA1380_PM ,R02_PON_BIAS | pm);break ;case SND_SOC_BIAS_STANDBY : -uda1380_write (codec,UDA1380_PM ,R02_PON_BIAS ); -break ; -case SND_SOC_BIAS_OFF : +if (codec->bias_level ==SND_SOC_BIAS_OFF ) { +if (pdata->gpio_power != -EINVAL ) { +gpio_set_value (pdata->gpio_power,1 ); +uda1380_reset (codec); + } + +uda1380_sync_cache (codec); + }
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
uda1380_write(codec, UDA1380_PM, 0x0);Maybe some comment won't hurt here about what that
0x0does.Well, code explain it pretty well, it puts codec into stand-by mode :)
/* Writing 0x0 to UDA1380_PM register puts codec into sleep mode */
Quoted 88 lines
Quoted 11 lines
sound/soc/codecs/uda1380.c static int uda1380_set_bias_level(struct snd_soc_codec *codec, · line 624
Quoted 4 lines
sound/soc/codecs/uda1380.c +1
-0break ; +case SND_SOC_BIAS_OFF :if (
pdata->gpio_power==-EINVAL)break;...code...
might help your alignment below.
Ok
Quoted 72 lines
Quoted 59 lines
sound/soc/codecs/uda1380.c +11
-10+if (pdata->gpio_power != -EINVAL ) { +int reg; +gpio_set_value (pdata->gpio_power,0 ); + +/* Mark mixer regs cache dirty to sync them with +* codec regs on power on. +*/ +for (reg =UDA1380_MVOL ; reg <UDA1380_CACHEREGNUM ; + reg++) +set_bit (reg -0x10 , &uda1380_cache_dirty); + } } codec->bias_level = level;return 0 ;@@ -651,16 +712,6 @@ static int uda1380_suspend(struct snd_soc_codec *codec, pm_message_t state)static int uda1380_resume (struct snd_soc_codec *codec) { -int i; -u8 data[2 ]; -u16 *cache = codec->reg_cache; - -/* Sync reg_cache with the hardware */ -for (i =0 ; i <ARRAY_SIZE (uda1380_reg); i++) { - data[0 ] = (i <<1 ) | ((cache[i] >>8 ) &0x0001 ); - data[1 ] = cache[i] &0x00ff ; - codec->hw_write (codec->control_data, data,2 ); - }sound/soc/codecs/uda1380.c +4
-4uda1380_set_bias_level (codec,SND_SOC_BIAS_STANDBY );return 0 ; }@@ -671,29 +722,32 @@ static int uda1380_probe(struct snd_soc_codec *codec)struct uda1380_priv *uda1380 =snd_soc_codec_get_drvdata (codec);int ret; + uda1380->codec = codec; + codec->hw_write = (hw_write_t )i2c_master_send; + codec->control_data = uda1380->control_data; -if (!pdata || !pdata->gpio_power || !pdata->gpio_reset) +if (!pdata)return -EINVAL ; - ret =gpio_request (pdata->gpio_power,"uda1380 power" ); -if (ret) -return ret;sound/soc/codecs/uda1380.c static int uda1380_probe(struct snd_soc_codec · line 696
Quoted 10 lines
sound/soc/codecs/uda1380.c +0
-10- ret =gpio_request (pdata->gpio_reset,"uda1380 reset" ); -if (ret) - goto err_gpio; - -gpio_direction_output (pdata->gpio_power,1 ); - -/* we may need to have the clock running here - pH5 */ -gpio_direction_output (pdata->gpio_reset,1 ); -udelay (5 ); -gpio_set_value (pdata->gpio_reset,0 );if (
gpio_is_valid(...gpio...)) {Quoted 1 line
}
Quoted 8 lines
Will not work for s3c24xx:
static inline int
gpio_is_valid(int number){ /* only some non-negative numbers are valid */ return ((unsigned)number) < ARCH_NR_GPIOS; }
Why won't it work? You have some negative values of GPIO pins there?
Quoted 9 lines
Quoted 8 lines
sound/soc/codecs/uda1380.c static int uda1380_probe(struct snd_soc_codec *codec) · line 737
Quoted 5 lines
sound/soc/codecs/uda1380.c +5
-0+if (pdata->gpio_reset != -EINVAL ) { + ret =gpio_request (pdata->gpio_reset,"uda1380 reset" ); +if (ret) + goto err_out; +gpio_direction_output (pdata->gpio_reset,0 );Handle return value and dont depend on this setting the GPIO value, use
gpio_set_value()too please.
Quoted 4 lines
This code handles reset-less machines (for example, h1940).
gpio_direction_outputis neccessary here to ensure that pin is in output mode.
ret = gpio_direction_output(pdata->gpio_reset, 0);
if (ret) {
dev_err();
goto err;
}gpio_set_value();
...
err:
gpio_free();
Stuff like this.
Quoted 11 lines
Quoted 11 lines
sound/soc/codecs/uda1380.c static int uda1380_probe(struct snd_soc_codec *codec) · line 744
Quoted 11 lines
sound/soc/codecs/uda1380.c +6
-4+ } - ret =uda1380_reset (codec); -if (ret <0 ) { -dev_err (codec->dev,"Failed to issue reset\n" ); - goto err_reset; +if (pdata->gpio_power != -EINVAL ) { + ret =gpio_request (pdata->gpio_power,"uda1380 power" ); +if (ret) + goto err_gpio; +gpio_direction_output (pdata->gpio_power,0 );
HERE, see below.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
sound/soc/codecs/uda1380.c +6
-0+ }else { + ret =uda1380_reset (codec); +if (ret) { +dev_err (codec->dev,"Failed to issue reset\n" ); + goto err_reset; + }
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
}
Ditto.
Handling here machine which lacks power pin.
This should have been ... scroll to my previous comment starting with HERE.
Quoted 6 lines
Quoted 4 lines
sound/soc/codecs/uda1380.c static __devinit int uda1380_i2c_probe(struct i2c_client *i2c, · line 823
Quoted 2 lines
sound/soc/codecs/uda1380.c +1
-0+ uda1380->control_data = i2c;So is this needed ? Can't you access
codec->control_data?See comment above.
See comment above. :)
Quoted 8 lines
Quoted 6 lines
sound/soc/codecs/uda1380.c static __devinit int uda1380_i2c_probe(struct i2c_client *i2c,
Quoted 4 lines
sound/soc/codecs/uda1380.c +1
-0kfree (uda1380); +Remove
It improves formatting.
See comment above. :)
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
return ret;
}
Cheers
thanks,
Regards
Vasily
Cheers
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH v5 1/3 ASoC: uda1380: make driver more powersave-friendly
In reply to Marek VasutDisable some codec modules in standby mode, completely disable codec in off mode to save some power.
Fix suspend/resume: mark mixer regs as dirty on resume to restore mixer values, otherwise driver produces no sound (master is muted by default).
--- sound/soc/codecs/uda1380.c | 147 +++++++++++++++++++++++++++++++------------ 1 files changed, 106 insertions(+), 41 deletions(-)
sound/soc/codecs/uda1380.c +106 -41
@@ -39,6 +39,7 @@ struct uda1380_priv {u16 reg_cache[UDA1380_CACHEREGNUM ];unsigned int dac_clk;struct work_struct work; +void *control_data; };/*
@@ -129,7 +130,46 @@ static int uda1380_write(struct snd_soc_codec *codec, unsigned int reg,return -EIO ; } -#define uda1380_reset (c) uda1380_write(c, UDA1380_RESET, 0) +static void uda1380_sync_cache (struct snd_soc_codec *codec) +{ +int reg; +u8 data[3 ]; +u16 *cache = codec->reg_cache; + +/* Sync reg_cache with the hardware */ +for (reg =0 ; reg <UDA1380_MVOL ; reg++) { + data[0 ] = reg; + data[1 ] = (cache[reg] &0xff00 ) >>8 ; + data[2 ] = cache[reg] &0x00ff ; +if (codec->hw_write (codec->control_data, data,3 ) !=3 ) +dev_err (codec->dev,"%s: write to reg 0x%x failed\n" , + __func__, reg); + } +} + +static int uda1380_reset (struct snd_soc_codec *codec) +{ +struct uda1380_platform_data *pdata = codec->dev->platform_data; + +if (pdata->gpio_reset != -EINVAL ) { +gpio_set_value (pdata->gpio_reset,1 ); +mdelay (1 ); +gpio_set_value (pdata->gpio_reset,0 ); + }else { +u8 data[3 ]; + + data[0 ] =UDA1380_RESET ; + data[1 ] =0 ; + data[2 ] =0 ; + +if (codec->hw_write (codec->control_data, data,3 ) !=3 ) { +dev_err (codec->dev,"%s: failed\n" , __func__); +return -EIO ; + } + } + +return 0 ; +}static void uda1380_flush_work (struct work_struct *work) {
@@ -145,7 +185,6 @@ static void uda1380_flush_work(struct work_struct *work) uda1380_read_reg_cache(uda1380_codec, reg));clear_bit (bit, &uda1380_cache_dirty); } - }/* declarations of ALSA reg_elem_REAL controls */
@@ -560,18 +599,40 @@ static int uda1380_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) {int pm =uda1380_read_reg_cache (codec,UDA1380_PM ); +int reg; +struct uda1380_platform_data *pdata = codec->dev->platform_data; + +if (codec->bias_level == level) +return 0 ;switch (level) {case SND_SOC_BIAS_ON :case SND_SOC_BIAS_PREPARE : +/* ADC, DAC on */ uda1380_write (codec,UDA1380_PM ,R02_PON_BIAS | pm);break ;case SND_SOC_BIAS_STANDBY : -uda1380_write (codec,UDA1380_PM ,R02_PON_BIAS ); -break ; -case SND_SOC_BIAS_OFF : +if (codec->bias_level ==SND_SOC_BIAS_OFF ) { +if (pdata->gpio_power != -EINVAL ) { +gpio_set_value (pdata->gpio_power,1 ); +uda1380_reset (codec); + } + +uda1380_sync_cache (codec); + }uda1380_write (codec,UDA1380_PM ,0x0 );break ; +case SND_SOC_BIAS_OFF : +if (pdata->gpio_power == -EINVAL ) +break ; + +gpio_set_value (pdata->gpio_power,0 ); + +/* Mark mixer regs cache dirty to sync them with +* codec regs on power on. +*/ +for (reg =UDA1380_MVOL ; reg <UDA1380_CACHEREGNUM ; reg++) +set_bit (reg -0x10 , &uda1380_cache_dirty); } codec->bias_level = level;return 0 ;
@@ -651,16 +712,6 @@ static int uda1380_suspend(struct snd_soc_codec *codec, pm_message_t state)static int uda1380_resume (struct snd_soc_codec *codec) { -int i; -u8 data[2 ]; -u16 *cache = codec->reg_cache; - -/* Sync reg_cache with the hardware */ -for (i =0 ; i <ARRAY_SIZE (uda1380_reg); i++) { - data[0 ] = (i <<1 ) | ((cache[i] >>8 ) &0x0001 ); - data[1 ] = cache[i] &0x00ff ; - codec->hw_write (codec->control_data, data,2 ); - }uda1380_set_bias_level (codec,SND_SOC_BIAS_STANDBY );return 0 ; }
@@ -671,29 +722,36 @@ static int uda1380_probe(struct snd_soc_codec *codec)struct uda1380_priv *uda1380 =snd_soc_codec_get_drvdata (codec);int ret; + uda1380->codec = codec; + codec->hw_write = (hw_write_t )i2c_master_send; + codec->control_data = uda1380->control_data; -if (!pdata || !pdata->gpio_power || !pdata->gpio_reset) +if (!pdata)return -EINVAL ; - ret =gpio_request (pdata->gpio_power,"uda1380 power" ); -if (ret) -return ret; - ret =gpio_request (pdata->gpio_reset,"uda1380 reset" ); -if (ret) - goto err_gpio; - -gpio_direction_output (pdata->gpio_power,1 ); - -/* we may need to have the clock running here - pH5 */ -gpio_direction_output (pdata->gpio_reset,1 ); -udelay (5 ); -gpio_set_value (pdata->gpio_reset,0 ); +if (pdata->gpio_reset != -EINVAL ) { + ret =gpio_request (pdata->gpio_reset,"uda1380 reset" ); +if (ret) + goto err_out; + ret =gpio_direction_output (pdata->gpio_reset,0 ); +if (ret) + goto err_gpio_reset_conf; + } - ret =uda1380_reset (codec); -if (ret <0 ) { -dev_err (codec->dev,"Failed to issue reset\n" ); - goto err_reset; +if (pdata->gpio_power != -EINVAL ) { + ret =gpio_request (pdata->gpio_power,"uda1380 power" ); +if (ret) + goto err_gpio; + ret =gpio_direction_output (pdata->gpio_power,0 ); +if (ret) + goto err_gpio_power_conf; + }else { + ret =uda1380_reset (codec); +if (ret) { +dev_err (codec->dev,"Failed to issue reset\n" ); + goto err_reset; + } }INIT_WORK (&uda1380->work, uda1380_flush_work);
@@ -703,10 +761,11 @@ static int uda1380_probe(struct snd_soc_codec *codec)/* set clock input */ switch (pdata->dac_clk) {case UDA1380_DAC_CLK_SYSCLK : -uda1380_write (codec,UDA1380_CLK ,0 ); +uda1380_write_reg_cache (codec,UDA1380_CLK ,0 );break ;case UDA1380_DAC_CLK_WSPLL : -uda1380_write (codec,UDA1380_CLK ,R00_DAC_CLK ); +uda1380_write_reg_cache (codec,UDA1380_CLK , +R00_DAC_CLK );break ; }
@@ -717,10 +776,15 @@ static int uda1380_probe(struct snd_soc_codec *codec)return 0 ; err_reset: -gpio_set_value (pdata->gpio_power,0 ); -gpio_free (pdata->gpio_reset); +err_gpio_power_conf: +if (pdata->gpio_power != -EINVAL ) +gpio_free (pdata->gpio_power); + +err_gpio_reset_conf: err_gpio: -gpio_free (pdata->gpio_power); +if (pdata->gpio_reset != -EINVAL ) +gpio_free (pdata->gpio_reset); +err_out:return ret; }
@@ -731,7 +795,6 @@ static int uda1380_remove(struct snd_soc_codec *codec)uda1380_set_bias_level (codec,SND_SOC_BIAS_OFF ); -gpio_set_value (pdata->gpio_power,0 );gpio_free (pdata->gpio_reset);gpio_free (pdata->gpio_power);
@@ -743,8 +806,8 @@ static struct snd_soc_codec_driver soc_codec_dev_uda1380 = { .remove = uda1380_remove, .suspend = uda1380_suspend, .resume = uda1380_resume, - .read = uda1380_read_reg_cache, - .write = uda1380_write, + .read = uda1380_read_reg_cache, + .write = uda1380_write, .set_bias_level = uda1380_set_bias_level, .reg_cache_size = ARRAY_SIZE(uda1380_reg), .reg_word_size = sizeof(u16),
@@ -764,11 +827,13 @@ static __devinit int uda1380_i2c_probe(struct i2c_client *i2c,return -ENOMEM ;i2c_set_clientdata (i2c, uda1380); + uda1380->control_data = i2c; ret =snd_soc_register_codec (&i2c->dev, &soc_codec_dev_uda1380, uda1380_dai,ARRAY_SIZE (uda1380_dai));if (ret <0 )kfree (uda1380); +return ret; }
Signature · 1 line
1.7.2
PATCH v6 1/3 ASoC: uda1380: make driver more powersave-friendly
Disable some codec modules in standby mode, completely disable codec in off mode to save some power.
Fix suspend/resume: mark mixer regs as dirty on resume to restore mixer values, otherwise driver produces no sound (master is muted by default).
--- sound/soc/codecs/uda1380.c | 145 ++++++++++++++++++++++++++++++++------------ 1 files changed, 105 insertions(+), 40 deletions(-)
sound/soc/codecs/uda1380.c +105 -40
@@ -39,6 +39,7 @@ struct uda1380_priv {u16 reg_cache[UDA1380_CACHEREGNUM ];unsigned int dac_clk;struct work_struct work; +void *control_data; };/*
@@ -129,7 +130,46 @@ static int uda1380_write(struct snd_soc_codec *codec, unsigned int reg,return -EIO ; } -#define uda1380_reset (c) uda1380_write(c, UDA1380_RESET, 0) +static void uda1380_sync_cache (struct snd_soc_codec *codec) +{ +int reg; +u8 data[3 ]; +u16 *cache = codec->reg_cache; + +/* Sync reg_cache with the hardware */ +for (reg =0 ; reg <UDA1380_MVOL ; reg++) { + data[0 ] = reg; + data[1 ] = (cache[reg] &0xff00 ) >>8 ; + data[2 ] = cache[reg] &0x00ff ; +if (codec->hw_write (codec->control_data, data,3 ) !=3 ) +dev_err (codec->dev,"%s: write to reg 0x%x failed\n" , + __func__, reg); + } +} + +static int uda1380_reset (struct snd_soc_codec *codec) +{ +struct uda1380_platform_data *pdata = codec->dev->platform_data; + +if (gpio_is_valid (pdata->gpio_reset)) { +gpio_set_value (pdata->gpio_reset,1 ); +mdelay (1 ); +gpio_set_value (pdata->gpio_reset,0 ); + }else { +u8 data[3 ]; + + data[0 ] =UDA1380_RESET ; + data[1 ] =0 ; + data[2 ] =0 ; + +if (codec->hw_write (codec->control_data, data,3 ) !=3 ) { +dev_err (codec->dev,"%s: failed\n" , __func__); +return -EIO ; + } + } + +return 0 ; +}static void uda1380_flush_work (struct work_struct *work) {
@@ -560,18 +600,40 @@ static int uda1380_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) {int pm =uda1380_read_reg_cache (codec,UDA1380_PM ); +int reg; +struct uda1380_platform_data *pdata = codec->dev->platform_data; + +if (codec->bias_level == level) +return 0 ;switch (level) {case SND_SOC_BIAS_ON :case SND_SOC_BIAS_PREPARE : +/* ADC, DAC on */ uda1380_write (codec,UDA1380_PM ,R02_PON_BIAS | pm);break ;case SND_SOC_BIAS_STANDBY : -uda1380_write (codec,UDA1380_PM ,R02_PON_BIAS ); -break ; -case SND_SOC_BIAS_OFF : +if (codec->bias_level ==SND_SOC_BIAS_OFF ) { +if (gpio_is_valid (pdata->gpio_power)) { +gpio_set_value (pdata->gpio_power,1 ); +uda1380_reset (codec); + } + +uda1380_sync_cache (codec); + }uda1380_write (codec,UDA1380_PM ,0x0 );break ; +case SND_SOC_BIAS_OFF : +if (!gpio_is_valid (pdata->gpio_power)) +break ; + +gpio_set_value (pdata->gpio_power,0 ); + +/* Mark mixer regs cache dirty to sync them with +* codec regs on power on. +*/ +for (reg =UDA1380_MVOL ; reg <UDA1380_CACHEREGNUM ; reg++) +set_bit (reg -0x10 , &uda1380_cache_dirty); } codec->bias_level = level;return 0 ;
@@ -651,16 +713,6 @@ static int uda1380_suspend(struct snd_soc_codec *codec, pm_message_t state)static int uda1380_resume (struct snd_soc_codec *codec) { -int i; -u8 data[2 ]; -u16 *cache = codec->reg_cache; - -/* Sync reg_cache with the hardware */ -for (i =0 ; i <ARRAY_SIZE (uda1380_reg); i++) { - data[0 ] = (i <<1 ) | ((cache[i] >>8 ) &0x0001 ); - data[1 ] = cache[i] &0x00ff ; - codec->hw_write (codec->control_data, data,2 ); - }uda1380_set_bias_level (codec,SND_SOC_BIAS_STANDBY );return 0 ; }
@@ -671,29 +723,36 @@ static int uda1380_probe(struct snd_soc_codec *codec)struct uda1380_priv *uda1380 =snd_soc_codec_get_drvdata (codec);int ret; + uda1380->codec = codec; + codec->hw_write = (hw_write_t )i2c_master_send; + codec->control_data = uda1380->control_data; -if (!pdata || !pdata->gpio_power || !pdata->gpio_reset) +if (!pdata)return -EINVAL ; - ret =gpio_request (pdata->gpio_power,"uda1380 power" ); -if (ret) -return ret; - ret =gpio_request (pdata->gpio_reset,"uda1380 reset" ); -if (ret) - goto err_gpio; - -gpio_direction_output (pdata->gpio_power,1 ); - -/* we may need to have the clock running here - pH5 */ -gpio_direction_output (pdata->gpio_reset,1 ); -udelay (5 ); -gpio_set_value (pdata->gpio_reset,0 ); +if (gpio_is_valid (pdata->gpio_reset)) { + ret =gpio_request (pdata->gpio_reset,"uda1380 reset" ); +if (ret) + goto err_out; + ret =gpio_direction_output (pdata->gpio_reset,0 ); +if (ret) + goto err_gpio_reset_conf; + } - ret =uda1380_reset (codec); -if (ret <0 ) { -dev_err (codec->dev,"Failed to issue reset\n" ); - goto err_reset; +if (gpio_is_valid (pdata->gpio_power)) { + ret =gpio_request (pdata->gpio_power,"uda1380 power" ); +if (ret) + goto err_gpio; + ret =gpio_direction_output (pdata->gpio_power,0 ); +if (ret) + goto err_gpio_power_conf; + }else { + ret =uda1380_reset (codec); +if (ret) { +dev_err (codec->dev,"Failed to issue reset\n" ); + goto err_reset; + } }INIT_WORK (&uda1380->work, uda1380_flush_work);
@@ -703,10 +762,11 @@ static int uda1380_probe(struct snd_soc_codec *codec)/* set clock input */ switch (pdata->dac_clk) {case UDA1380_DAC_CLK_SYSCLK : -uda1380_write (codec,UDA1380_CLK ,0 ); +uda1380_write_reg_cache (codec,UDA1380_CLK ,0 );break ;case UDA1380_DAC_CLK_WSPLL : -uda1380_write (codec,UDA1380_CLK ,R00_DAC_CLK ); +uda1380_write_reg_cache (codec,UDA1380_CLK , +R00_DAC_CLK );break ; }
@@ -717,10 +777,15 @@ static int uda1380_probe(struct snd_soc_codec *codec)return 0 ; err_reset: -gpio_set_value (pdata->gpio_power,0 ); -gpio_free (pdata->gpio_reset); +err_gpio_power_conf: +if (gpio_is_valid (pdata->gpio_power)) +gpio_free (pdata->gpio_power); + +err_gpio_reset_conf: err_gpio: -gpio_free (pdata->gpio_power); +if (gpio_is_valid (pdata->gpio_reset)) +gpio_free (pdata->gpio_reset); +err_out:return ret; }
@@ -731,7 +796,6 @@ static int uda1380_remove(struct snd_soc_codec *codec)uda1380_set_bias_level (codec,SND_SOC_BIAS_OFF ); -gpio_set_value (pdata->gpio_power,0 );gpio_free (pdata->gpio_reset);gpio_free (pdata->gpio_power);
@@ -743,8 +807,8 @@ static struct snd_soc_codec_driver soc_codec_dev_uda1380 = { .remove = uda1380_remove, .suspend = uda1380_suspend, .resume = uda1380_resume, - .read = uda1380_read_reg_cache, - .write = uda1380_write, + .read = uda1380_read_reg_cache, + .write = uda1380_write, .set_bias_level = uda1380_set_bias_level, .reg_cache_size = ARRAY_SIZE(uda1380_reg), .reg_word_size = sizeof(u16),
@@ -764,6 +828,7 @@ static __devinit int uda1380_i2c_probe(struct i2c_client *i2c,return -ENOMEM ;i2c_set_clientdata (i2c, uda1380); + uda1380->control_data = i2c; ret =snd_soc_register_codec (&i2c->dev, &soc_codec_dev_uda1380, uda1380_dai,ARRAY_SIZE (uda1380_dai));
Signature · 1 line
1.7.2
PATCH v4 2/3 ASoC: Add HP iPAQ RX1950 support
In reply to Vasily Khoruzhick--- sound/soc/s3c24xx/Kconfig | 8 + sound/soc/s3c24xx/Makefile | 2 + sound/soc/s3c24xx/rx1950_uda1380.c | 326 ++++++++++++++++++++++++++++++++++++ 3 files changed, 336 insertions(+), 0 deletions(-) create mode 100644 sound/soc/s3c24xx/rx1950_uda1380.c
sound/soc/s3c24xx/Kconfig +8 -0
@@ -118,6 +118,14 @@ config SND_S3C24XX_SOC_SIMTEC_HERMES select SND_SOC_TLV320AIC3X select SND_S3C24XX_SOC_SIMTEC +config SND_S3C24XX_SOC_RX1950_UDA1380 + tristate "Audio support for the HP iPAQ RX1950" + depends on SND_S3C24XX_SOC && MACH_RX1950 + select SND_S3C24XX_SOC_I2S + select SND_SOC_UDA1380 + help + This driver provides audio support for HP iPAQ RX1950 PDA. + config SND_SOC_SMDK_WM9713 tristate "SoC AC97 Audio support for SMDK with WM9713" depends on SND_S3C24XX_SOC && (MACH_SMDK6410 || MACH_SMDKC100 || MACH_SMDKV210 || MACH_SMDKC110)
sound/soc/s3c24xx/Makefile +2 -0
@@ -27,6 +27,7 @@ snd-soc-s3c24xx-uda134x-objs := s3c24xx_uda134x.o snd-soc-s3c24xx-simtec-objs := s3c24xx_simtec.o snd-soc-s3c24xx-simtec-hermes-objs := s3c24xx_simtec_hermes.o snd-soc-s3c24xx-simtec-tlv320aic23-objs := s3c24xx_simtec_tlv320aic23.o +snd-soc-rx1950-uda1380-objs := rx1950_uda1380.o snd-soc-smdk64xx-wm8580-objs := smdk64xx_wm8580.o snd-soc-smdk-wm9713-objs := smdk_wm9713.o snd-soc-s3c64xx-smartq-wm8987-objs := smartq_wm8987.o
@@ -42,6 +43,7 @@ obj-$(CONFIG_SND_S3C24XX_SOC_S3C24XX_UDA134X) += snd-soc-s3c24xx-uda134x.o obj-$(CONFIG_SND_S3C24XX_SOC_SIMTEC) += snd-soc-s3c24xx-simtec.o obj-$(CONFIG_SND_S3C24XX_SOC_SIMTEC_HERMES) += snd-soc-s3c24xx-simtec-hermes.o obj-$(CONFIG_SND_S3C24XX_SOC_SIMTEC_TLV320AIC23) += snd-soc-s3c24xx-simtec-tlv320aic23.o +obj-$(CONFIG_SND_S3C24XX_SOC_RX1950_UDA1380) += snd-soc-rx1950-uda1380.o obj-$(CONFIG_SND_S3C64XX_SOC_WM8580) += snd-soc-smdk64xx-wm8580.o obj-$(CONFIG_SND_SOC_SMDK_WM9713) += snd-soc-smdk-wm9713.o obj-$(CONFIG_SND_S3C64XX_SOC_SMARTQ) += snd-soc-s3c64xx-smartq-wm8987.o
sound/soc/s3c24xx/rx1950_uda1380.c new file +326 -0
326 lines not on this page · raw message
Signature · 1 line
1.7.2
Re: [PATCH v4 2/3] ASoC: Add HP iPAQ RX1950 support
Dne Ne 29. srpna 2010 19:11:11 Vasily Khoruzhick napsal(a):
Quoted 206 lines
Signed-off-by Vasily Khoruzhick <[email protected]>--- sound/soc/s3c24xx/Kconfig | 8 + sound/soc/s3c24xx/Makefile | 2 + sound/soc/s3c24xx/rx1950_uda1380.c | 326 ++++++++++++++++++++++++++++++++++++ 3 files changed, 336 insertions(+), 0 deletions(-) create mode 100644 sound/soc/s3c24xx/rx1950_uda1380.csound/soc/s3c24xx/Kconfig +8
-0@@ -118,6 +118,14 @@ config SND_S3C24XX_SOC_SIMTEC_HERMES select SND_SOC_TLV320AIC3X select SND_S3C24XX_SOC_SIMTEC +config SND_S3C24XX_SOC_RX1950_UDA1380 + tristate "Audio support for the HP iPAQ RX1950" + depends on SND_S3C24XX_SOC && MACH_RX1950 + select SND_S3C24XX_SOC_I2S + select SND_SOC_UDA1380 + help + This driver provides audio support for HP iPAQ RX1950 PDA. + config SND_SOC_SMDK_WM9713 tristate "SoC AC97 Audio support for SMDK with WM9713" depends on SND_S3C24XX_SOC && (MACH_SMDK6410 || MACH_SMDKC100 ||
MACH_SMDKV210||MACH_SMDKC110) diff --git a/sound/soc/s3c24xx/Makefile b/sound/soc/s3c24xx/Makefile index 47ed6d7..dd412a9 100644sound/soc/s3c24xx/Makefile +1
-0@@ -27,6 +27,7 @@ snd-soc-s3c24xx-uda134x-objs := s3c24xx_uda134x.o snd-soc-s3c24xx-simtec-objs := s3c24xx_simtec.o snd-soc-s3c24xx-simtec-hermes-objs := s3c24xx_simtec_hermes.o snd-soc-s3c24xx-simtec-tlv320aic23-objs := s3c24xx_simtec_tlv320aic23.o +snd-soc-rx1950-uda1380-objs := rx1950_uda1380.o snd-soc-smdk64xx-wm8580-objs := smdk64xx_wm8580.o snd-soc-smdk-wm9713-objs := smdk_wm9713.o snd-soc-s3c64xx-smartq-wm8987-objs := smartq_wm8987.o@@ -42,6 +43,7 @@ obj-$(CONFIG_SND_S3C24XX_SOC_S3C24XX_UDA134X) +=snd-soc-s3c24xx-uda134x.o obj-$(CONFIG_SND_S3C24XX_SOC_SIMTEC) += snd-soc-s3c24xx-simtec.o
obj-$(CONFIG_SND_S3C24XX_SOC_SIMTEC_HERMES) +=
snd-soc-s3c24xx-simtec-hermes.o obj-$(CONFIG_SND_S3C24XX_SOC_SIMTEC_TLV320AIC23) += snd-soc-s3c24xx-simtec-tlv320aic23.o +obj-$(CONFIG_SND_S3C24XX_SOC_RX1950_UDA1380) += snd-soc-rx1950-uda1380.o obj-$(CONFIG_SND_S3C64XX_SOC_WM8580) += snd-soc-smdk64xx-wm8580.o obj-$(CONFIG_SND_SOC_SMDK_WM9713) += snd-soc-smdk-wm9713.o
obj-$(CONFIG_SND_S3C64XX_SOC_SMARTQ) += snd-soc-s3c64xx-smartq-wm8987.o(quoted diff) +0
-0
b/sound/soc/s3c24xx/rx1950_uda1380.cnew file mode 100644 index 0000000..c653c13sound/soc/s3c24xx/rx1950_uda1380.c new file +13
-0@@ -0,0 +1,326 @@ +/* +* rx1950.c -- ALSA Soc Audio Layer +* +* Copyright (c) 2010 Vasily Khoruzhick <[email protected]> +* +* Based on smdk2440.c and magician.c +* +* Authors: Graeme Gregory [email protected] +* Philipp Zabel <[email protected]> +* Denis Grigoriev <[email protected]> +* Vasily Khoruzhick <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it + * 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.
+ *
+ */sound/soc/s3c24xx/rx1950_uda1380.c new file +131
-0+ +#include <linux/module.h> +#include <linux/moduleparam.h> +#include <linux/timer.h> +#include <linux/delay.h> +#include <linux/interrupt.h> +#include <linux/platform_device.h> +#include <linux/spinlock.h> +#include <linux/i2c.h> +#include <linux/gpio.h> +#include <linux/clk.h> + +#include <sound/core.h> +#include <sound/pcm.h> +#include <sound/pcm_params.h> +#include <sound/soc.h> +#include <sound/soc-dapm.h> +#include <sound/uda1380.h> +#include <sound/jack.h> + +#include <plat/regs-iis.h> + +#include <mach/regs-clock.h> + +#include "s3c-dma.h" +#include "s3c24xx-i2s.h" +#include "../codecs/uda1380.h" + +static int rx1950_uda1380_init (struct snd_soc_pcm_runtime *rtd); +static int rx1950_startup (struct snd_pcm_substream *substream); +static int rx1950_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params); +static int rx1950_spk_power (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event); + +static unsigned int rates[] = { +16000 , +44100 , +48000 , +88200 , +}; + +static struct snd_pcm_hw_constraint_list hw_rates = { + .count =ARRAY_SIZE (rates), + .list = rates, + .mask =0 , +}; + +static struct snd_soc_jack hp_jack; + +static struct snd_soc_jack_pin hp_jack_pins[] = { + { + .pin ="Headphone Jack" , + .mask =SND_JACK_HEADPHONE , + }, + { + .pin ="Speaker" , + .mask =SND_JACK_HEADPHONE , + .invert =1 , + }, +}; + +static struct snd_soc_jack_gpio hp_jack_gpios[] = { + [0 ] = { + .gpio =S3C2410_GPG (12 ), + .name ="hp-gpio" , + .report =SND_JACK_HEADPHONE , + .invert =1 , + .debounce_time =200 , + }, +}; + +static struct snd_soc_ops rx1950_ops = { + .startup = rx1950_startup, + .hw_params = rx1950_hw_params, +}; + +/* s3c24xx digital audio interface glue - connects codec <--> CPU */ +static struct snd_soc_dai_link rx1950_uda1380_dai[] = { + { + .name ="uda1380" , + .stream_name ="UDA1380 Duplex" , + .cpu_dai_name ="s3c24xx-iis" , + .codec_dai_name ="uda1380-hifi" , + .init = rx1950_uda1380_init, + .platform_name ="s3c24xx-pcm-audio" , + .codec_name ="uda1380-codec.0-001a" , + .ops = &rx1950_ops, + }, +}; + +static struct snd_soc_card rx1950_asoc = { + .name ="rx1950" , + .dai_link = rx1950_uda1380_dai, + .num_links =ARRAY_SIZE (rx1950_uda1380_dai), +}; + +/* rx1950 machine dapm widgets */ +static const struct snd_soc_dapm_widget uda1380_dapm_widgets[] = { +SND_SOC_DAPM_HP ("Headphone Jack" ,NULL ), +SND_SOC_DAPM_MIC ("Mic Jack" ,NULL ), +SND_SOC_DAPM_SPK ("Speaker" , rx1950_spk_power), +}; + +/* rx1950 machine audio_map */ +static const struct snd_soc_dapm_route audio_map[] = { +/* headphone connected to VOUTLHP, VOUTRHP */ + {"Headphone Jack" ,NULL ,"VOUTLHP" }, + {"Headphone Jack" ,NULL ,"VOUTRHP" }, + +/* ext speaker connected to VOUTL, VOUTR */ + {"Speaker" ,NULL ,"VOUTL" }, + {"Speaker" ,NULL ,"VOUTR" }, + +/* mic is connected to VINM */ + {"VINM" ,NULL ,"Mic Jack" }, +}; + +static struct platform_device *s3c24xx_snd_device; +static struct clk *xtal; + +static int rx1950_startup (struct snd_pcm_substream *substream) +{ +struct snd_pcm_runtime *runtime = substream->runtime; + + runtime->hw.rate_min = hw_rates.list[0 ]; + runtime->hw.rate_max = hw_rates.list[hw_rates.count -1 ]; + runtime->hw.rates =SNDRV_PCM_RATE_KNOT ; + + return snd_pcm_hw_constraint_list(runtime, 0, + SNDRV_PCM_HW_PARAM_RATE,
sound/soc/s3c24xx/rx1950_uda1380.c line 159
Quoted 10 lines
sound/soc/s3c24xx/rx1950_uda1380.c new file +10
-0+ &hw_rates); +} + +static int rx1950_spk_power (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event) +{ +if (SND_SOC_DAPM_EVENT_ON (event)) +gpio_direction_output (S3C2410_GPA (1 ),1 ); +else +gpio_direction_output (S3C2410_GPA (1 ),0 );
gpio_set_value()
Quoted 80 lines
sound/soc/s3c24xx/rx1950_uda1380.c new file +80
-0+ +return 0 ; +} + +static int rx1950_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{ +struct snd_soc_pcm_runtime *rtd = substream->private_data; +struct snd_soc_dai *cpu_dai = rtd->cpu_dai; +struct snd_soc_dai *codec_dai = rtd->codec_dai; +int div; +int ret; +unsigned int rate =params_rate (params); +int clk_source, fs_mode; + +switch (rate) { +case 16000 : +case 48000 : + clk_source =S3C24XX_CLKSRC_PCLK ; + fs_mode =S3C2410_IISMOD_384FS ; + div =s3c24xx_i2s_get_clockrate () / (384 * rate); +if (s3c24xx_i2s_get_clockrate () % (384 * rate) > (182 * rate)) + div++; +break ; +case 44100 : +case 88200 : + clk_source =S3C24XX_CLKSRC_MPLL ; + fs_mode =S3C2410_IISMOD_256FS ; + div =clk_get_rate (xtal) / (256 * rate); +if (clk_get_rate (xtal) % (256 * rate) > (128 * rate)) + div++; +break ; +default : +printk (KERN_ERR "%s: rate %d is not supported\n" , + __func__, rate); +return -EINVAL ; + } + +/* set codec DAI configuration */ + ret =snd_soc_dai_set_fmt (codec_dai,SND_SOC_DAIFMT_I2S | +SND_SOC_DAIFMT_NB_NF |SND_SOC_DAIFMT_CBS_CFS ); +if (ret <0 ) +return ret; + +/* set cpu DAI configuration */ + ret =snd_soc_dai_set_fmt (cpu_dai,SND_SOC_DAIFMT_I2S | +SND_SOC_DAIFMT_NB_NF |SND_SOC_DAIFMT_CBS_CFS ); +if (ret <0 ) +return ret; + +/* select clock source */ + ret =snd_soc_dai_set_sysclk (cpu_dai, clk_source, rate, +SND_SOC_CLOCK_OUT ); +if (ret <0 ) +return ret; + +/* set MCLK division for sample rate */ + ret =snd_soc_dai_set_clkdiv (cpu_dai,S3C24XX_DIV_MCLK , +S3C2410_IISMOD_384FS ); +if (ret <0 ) +return ret; + +/* set BCLK division for sample rate */ + ret =snd_soc_dai_set_clkdiv (cpu_dai,S3C24XX_DIV_BCLK , +S3C2410_IISMOD_32FS ); +if (ret <0 ) +return ret; + +/* set prescaler division for sample rate */ + ret =snd_soc_dai_set_clkdiv (cpu_dai,S3C24XX_DIV_PRESCALER , +S3C24XX_PRESCALE (div, div)); +if (ret <0 ) +return ret; + +return 0 ; +} + +static int rx1950_uda1380_init (struct snd_soc_pcm_runtime *rtd) +{ +struct snd_soc_codec *codec = rtd->codec;
sound/soc/s3c24xx/rx1950_uda1380.c line 249
Quoted 10 lines
sound/soc/s3c24xx/rx1950_uda1380.c new file +10
-0+int err; + +/* Add rx1950 specific widgets */ +snd_soc_dapm_new_controls (codec, uda1380_dapm_widgets, +ARRAY_SIZE (uda1380_dapm_widgets)); + +/* Set up rx1950 specific audio path audio_mapnects */ + err =snd_soc_dapm_add_routes (codec, audio_map, +ARRAY_SIZE (audio_map)); +
Handle return values
Quoted 17 lines
sound/soc/s3c24xx/rx1950_uda1380.c new file +17
-0+snd_soc_dapm_enable_pin (codec,"Headphone Jack" ); +snd_soc_dapm_enable_pin (codec,"Speaker" ); + +snd_soc_dapm_sync (codec); + +snd_soc_jack_new (codec,"Headphone Jack" ,SND_JACK_HEADPHONE , + &hp_jack); + +snd_soc_jack_add_pins (&hp_jack,ARRAY_SIZE (hp_jack_pins), + hp_jack_pins); + +snd_soc_jack_add_gpios (&hp_jack,ARRAY_SIZE (hp_jack_gpios), + hp_jack_gpios); + +return 0 ; +} +
sound/soc/s3c24xx/rx1950_uda1380.c line 276
Quoted 10 lines
sound/soc/s3c24xx/rx1950_uda1380.c new file +10
-0+static int __init rx1950_init (void ) +{ +int ret; + +/* configure some gpios */ + ret =gpio_request (S3C2410_GPA (1 ),"speaker-power" ); +if (ret) + goto err_gpio; + +gpio_direction_output (S3C2410_GPA (1 ),0 );
Again, use gpio_set_value() after this and handle return value of gpio_direction_output().
Quoted 50 lines
sound/soc/s3c24xx/rx1950_uda1380.c new file +50
-0+ + s3c24xx_snd_device =platform_device_alloc ("soc-audio" ,-1 ); +if (!s3c24xx_snd_device) { + ret = -ENOMEM ; + goto err_plat_alloc; + } + +platform_set_drvdata (s3c24xx_snd_device, &rx1950_asoc); + ret =platform_device_add (s3c24xx_snd_device); + +if (ret) { +platform_device_put (s3c24xx_snd_device); + goto err_plat_add; + } + + xtal =clk_get (&s3c24xx_snd_device->dev,"xtal" ); + +if (IS_ERR (xtal)) { + ret =PTR_ERR (xtal); +platform_device_unregister (s3c24xx_snd_device); + goto err_clk; + } + +return 0 ; + +err_clk: +err_plat_add: +err_plat_alloc: +gpio_free (S3C2410_GPA (1 )); + +err_gpio: +return ret; +} + +static void __exit rx1950_exit(void) +{ +platform_device_unregister (s3c24xx_snd_device); +snd_soc_jack_free_gpios (&hp_jack,ARRAY_SIZE (hp_jack_gpios), + hp_jack_gpios); +clk_put (xtal); +gpio_free (S3C2410_GPA (1 )); +} + +module_init (rx1950_init); +module_exit (rx1950_exit); + +/* Module information */ +MODULE_AUTHOR ("Vasily Khoruzhick" ); +MODULE_DESCRIPTION ("ALSA SoC RX1950" ); +MODULE_LICENSE ("GPL" );
Re: [PATCH v4 2/3] ASoC: Add HP iPAQ RX1950 support
В сообщении от 29 августа 2010 20:39:39 автор Marek Vasut написал:
Quoted 9 lines
sound/soc/s3c24xx/rx1950_uda1380.c line 159
Quoted 7 lines
sound/soc/s3c24xx/rx1950_uda1380.c new file +7
-0+static int rx1950_spk_power (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event) +{ +if (SND_SOC_DAPM_EVENT_ON (event)) +gpio_direction_output (S3C2410_GPA (1 ),1 ); +else +gpio_direction_output (S3C2410_GPA (1 ),0 );
gpio_set_value()
Ok
Quoted 7 lines
Quoted 7 lines
sound/soc/s3c24xx/rx1950_uda1380.c new file +7
-0+static int rx1950_uda1380_init (struct snd_soc_pcm_runtime *rtd) +{ +struct snd_soc_codec *codec = rtd->codec; +int err; + +/* Add rx1950 specific widgets */ + snd_soc_dapm_new_controls(codec, uda1380_dapm_widgets,
Quoted 8 lines
sound/soc/s3c24xx/rx1950_uda1380.c line 249
Quoted 6 lines
sound/soc/s3c24xx/rx1950_uda1380.c new file +6
-0+ ARRAY_SIZE(uda1380_dapm_widgets)); + +/* Set up rx1950 specific audio path audio_mapnects */ + err =snd_soc_dapm_add_routes (codec, audio_map, +ARRAY_SIZE (audio_map)); +Handle return values
Ok
Quoted 4 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ gpio_direction_output(S3C2410_GPA(1), 0);Again, use
gpio_set_value()after this and handle return value ofgpio_direction_output().
Second arg is value, gpio_set_value is not required.
Regards
Vasily
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH v5 2/3 ASoC: Add HP iPAQ RX1950 support
In reply to Marek Vasut--- sound/soc/s3c24xx/Kconfig | 8 + sound/soc/s3c24xx/Makefile | 2 + sound/soc/s3c24xx/rx1950_uda1380.c | 335 ++++++++++++++++++++++++++++++++++++ 3 files changed, 345 insertions(+), 0 deletions(-) create mode 100644 sound/soc/s3c24xx/rx1950_uda1380.c
sound/soc/s3c24xx/Kconfig +8 -0
@@ -118,6 +118,14 @@ config SND_S3C24XX_SOC_SIMTEC_HERMES select SND_SOC_TLV320AIC3X select SND_S3C24XX_SOC_SIMTEC +config SND_S3C24XX_SOC_RX1950_UDA1380 + tristate "Audio support for the HP iPAQ RX1950" + depends on SND_S3C24XX_SOC && MACH_RX1950 + select SND_S3C24XX_SOC_I2S + select SND_SOC_UDA1380 + help + This driver provides audio support for HP iPAQ RX1950 PDA. + config SND_SOC_SMDK_WM9713 tristate "SoC AC97 Audio support for SMDK with WM9713" depends on SND_S3C24XX_SOC && (MACH_SMDK6410 || MACH_SMDKC100 || MACH_SMDKV210 || MACH_SMDKC110)
sound/soc/s3c24xx/Makefile +2 -0
@@ -27,6 +27,7 @@ snd-soc-s3c24xx-uda134x-objs := s3c24xx_uda134x.o snd-soc-s3c24xx-simtec-objs := s3c24xx_simtec.o snd-soc-s3c24xx-simtec-hermes-objs := s3c24xx_simtec_hermes.o snd-soc-s3c24xx-simtec-tlv320aic23-objs := s3c24xx_simtec_tlv320aic23.o +snd-soc-rx1950-uda1380-objs := rx1950_uda1380.o snd-soc-smdk64xx-wm8580-objs := smdk64xx_wm8580.o snd-soc-smdk-wm9713-objs := smdk_wm9713.o snd-soc-s3c64xx-smartq-wm8987-objs := smartq_wm8987.o
@@ -42,6 +43,7 @@ obj-$(CONFIG_SND_S3C24XX_SOC_S3C24XX_UDA134X) += snd-soc-s3c24xx-uda134x.o obj-$(CONFIG_SND_S3C24XX_SOC_SIMTEC) += snd-soc-s3c24xx-simtec.o obj-$(CONFIG_SND_S3C24XX_SOC_SIMTEC_HERMES) += snd-soc-s3c24xx-simtec-hermes.o obj-$(CONFIG_SND_S3C24XX_SOC_SIMTEC_TLV320AIC23) += snd-soc-s3c24xx-simtec-tlv320aic23.o +obj-$(CONFIG_SND_S3C24XX_SOC_RX1950_UDA1380) += snd-soc-rx1950-uda1380.o obj-$(CONFIG_SND_S3C64XX_SOC_WM8580) += snd-soc-smdk64xx-wm8580.o obj-$(CONFIG_SND_SOC_SMDK_WM9713) += snd-soc-smdk-wm9713.o obj-$(CONFIG_SND_S3C64XX_SOC_SMARTQ) += snd-soc-s3c64xx-smartq-wm8987.o
sound/soc/s3c24xx/rx1950_uda1380.c new file +335 -0
335 lines not on this page · raw message
Signature · 1 line
1.7.2
Re: [PATCH v5 2/3] ASoC: Add HP iPAQ RX1950 support
Dne Ne 29. srpna 2010 20:53:46 Vasily Khoruzhick napsal(a):
Quoted 359 lines
Signed-off-by Vasily Khoruzhick <[email protected]>--- sound/soc/s3c24xx/Kconfig | 8 + sound/soc/s3c24xx/Makefile | 2 + sound/soc/s3c24xx/rx1950_uda1380.c | 335 ++++++++++++++++++++++++++++++++++++ 3 files changed, 345 insertions(+), 0 deletions(-) create mode 100644 sound/soc/s3c24xx/rx1950_uda1380.csound/soc/s3c24xx/Kconfig +8
-0@@ -118,6 +118,14 @@ config SND_S3C24XX_SOC_SIMTEC_HERMES select SND_SOC_TLV320AIC3X select SND_S3C24XX_SOC_SIMTEC +config SND_S3C24XX_SOC_RX1950_UDA1380 + tristate "Audio support for the HP iPAQ RX1950" + depends on SND_S3C24XX_SOC && MACH_RX1950 + select SND_S3C24XX_SOC_I2S + select SND_SOC_UDA1380 + help + This driver provides audio support for HP iPAQ RX1950 PDA. + config SND_SOC_SMDK_WM9713 tristate "SoC AC97 Audio support for SMDK with WM9713" depends on SND_S3C24XX_SOC && (MACH_SMDK6410 || MACH_SMDKC100 ||
MACH_SMDKV210||MACH_SMDKC110) diff --git a/sound/soc/s3c24xx/Makefile b/sound/soc/s3c24xx/Makefile index 47ed6d7..dd412a9 100644sound/soc/s3c24xx/Makefile +1
-0@@ -27,6 +27,7 @@ snd-soc-s3c24xx-uda134x-objs := s3c24xx_uda134x.o snd-soc-s3c24xx-simtec-objs := s3c24xx_simtec.o snd-soc-s3c24xx-simtec-hermes-objs := s3c24xx_simtec_hermes.o snd-soc-s3c24xx-simtec-tlv320aic23-objs := s3c24xx_simtec_tlv320aic23.o +snd-soc-rx1950-uda1380-objs := rx1950_uda1380.o snd-soc-smdk64xx-wm8580-objs := smdk64xx_wm8580.o snd-soc-smdk-wm9713-objs := smdk_wm9713.o snd-soc-s3c64xx-smartq-wm8987-objs := smartq_wm8987.o@@ -42,6 +43,7 @@ obj-$(CONFIG_SND_S3C24XX_SOC_S3C24XX_UDA134X) +=snd-soc-s3c24xx-uda134x.o obj-$(CONFIG_SND_S3C24XX_SOC_SIMTEC) += snd-soc-s3c24xx-simtec.o
obj-$(CONFIG_SND_S3C24XX_SOC_SIMTEC_HERMES) +=
snd-soc-s3c24xx-simtec-hermes.o obj-$(CONFIG_SND_S3C24XX_SOC_SIMTEC_TLV320AIC23) += snd-soc-s3c24xx-simtec-tlv320aic23.o +obj-$(CONFIG_SND_S3C24XX_SOC_RX1950_UDA1380) += snd-soc-rx1950-uda1380.o obj-$(CONFIG_SND_S3C64XX_SOC_WM8580) += snd-soc-smdk64xx-wm8580.o obj-$(CONFIG_SND_SOC_SMDK_WM9713) += snd-soc-smdk-wm9713.o
obj-$(CONFIG_SND_S3C64XX_SOC_SMARTQ) += snd-soc-s3c64xx-smartq-wm8987.o(quoted diff) +0
-0
b/sound/soc/s3c24xx/rx1950_uda1380.cnew file mode 100644 index 0000000..2a16113sound/soc/s3c24xx/rx1950_uda1380.c new file +13
-0@@ -0,0 +1,335 @@ +/* +* rx1950.c -- ALSA Soc Audio Layer +* +* Copyright (c) 2010 Vasily Khoruzhick <[email protected]> +* +* Based on smdk2440.c and magician.c +* +* Authors: Graeme Gregory [email protected] +* Philipp Zabel <[email protected]> +* Denis Grigoriev <[email protected]> +* Vasily Khoruzhick <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it + * 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.
+ *
+ */sound/soc/s3c24xx/rx1950_uda1380.c new file +284
-0+ +#include <linux/module.h> +#include <linux/moduleparam.h> +#include <linux/timer.h> +#include <linux/delay.h> +#include <linux/interrupt.h> +#include <linux/platform_device.h> +#include <linux/spinlock.h> +#include <linux/i2c.h> +#include <linux/gpio.h> +#include <linux/clk.h> + +#include <sound/core.h> +#include <sound/pcm.h> +#include <sound/pcm_params.h> +#include <sound/soc.h> +#include <sound/soc-dapm.h> +#include <sound/uda1380.h> +#include <sound/jack.h> + +#include <plat/regs-iis.h> + +#include <mach/regs-clock.h> + +#include "s3c-dma.h" +#include "s3c24xx-i2s.h" +#include "../codecs/uda1380.h" + +static int rx1950_uda1380_init (struct snd_soc_pcm_runtime *rtd); +static int rx1950_startup (struct snd_pcm_substream *substream); +static int rx1950_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params); +static int rx1950_spk_power (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event); + +static unsigned int rates[] = { +16000 , +44100 , +48000 , +88200 , +}; + +static struct snd_pcm_hw_constraint_list hw_rates = { + .count =ARRAY_SIZE (rates), + .list = rates, + .mask =0 , +}; + +static struct snd_soc_jack hp_jack; + +static struct snd_soc_jack_pin hp_jack_pins[] = { + { + .pin ="Headphone Jack" , + .mask =SND_JACK_HEADPHONE , + }, + { + .pin ="Speaker" , + .mask =SND_JACK_HEADPHONE , + .invert =1 , + }, +}; + +static struct snd_soc_jack_gpio hp_jack_gpios[] = { + [0 ] = { + .gpio =S3C2410_GPG (12 ), + .name ="hp-gpio" , + .report =SND_JACK_HEADPHONE , + .invert =1 , + .debounce_time =200 , + }, +}; + +static struct snd_soc_ops rx1950_ops = { + .startup = rx1950_startup, + .hw_params = rx1950_hw_params, +}; + +/* s3c24xx digital audio interface glue - connects codec <--> CPU */ +static struct snd_soc_dai_link rx1950_uda1380_dai[] = { + { + .name ="uda1380" , + .stream_name ="UDA1380 Duplex" , + .cpu_dai_name ="s3c24xx-iis" , + .codec_dai_name ="uda1380-hifi" , + .init = rx1950_uda1380_init, + .platform_name ="s3c24xx-pcm-audio" , + .codec_name ="uda1380-codec.0-001a" , + .ops = &rx1950_ops, + }, +}; + +static struct snd_soc_card rx1950_asoc = { + .name ="rx1950" , + .dai_link = rx1950_uda1380_dai, + .num_links =ARRAY_SIZE (rx1950_uda1380_dai), +}; + +/* rx1950 machine dapm widgets */ +static const struct snd_soc_dapm_widget uda1380_dapm_widgets[] = { +SND_SOC_DAPM_HP ("Headphone Jack" ,NULL ), +SND_SOC_DAPM_MIC ("Mic Jack" ,NULL ), +SND_SOC_DAPM_SPK ("Speaker" , rx1950_spk_power), +}; + +/* rx1950 machine audio_map */ +static const struct snd_soc_dapm_route audio_map[] = { +/* headphone connected to VOUTLHP, VOUTRHP */ + {"Headphone Jack" ,NULL ,"VOUTLHP" }, + {"Headphone Jack" ,NULL ,"VOUTRHP" }, + +/* ext speaker connected to VOUTL, VOUTR */ + {"Speaker" ,NULL ,"VOUTL" }, + {"Speaker" ,NULL ,"VOUTR" }, + +/* mic is connected to VINM */ + {"VINM" ,NULL ,"Mic Jack" }, +}; + +static struct platform_device *s3c24xx_snd_device; +static struct clk *xtal; + +static int rx1950_startup (struct snd_pcm_substream *substream) +{ +struct snd_pcm_runtime *runtime = substream->runtime; + + runtime->hw.rate_min = hw_rates.list[0 ]; + runtime->hw.rate_max = hw_rates.list[hw_rates.count -1 ]; + runtime->hw.rates =SNDRV_PCM_RATE_KNOT ; + +return snd_pcm_hw_constraint_list (runtime,0 , +SNDRV_PCM_HW_PARAM_RATE , + &hw_rates); +} + +static int rx1950_spk_power (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event) +{ +if (SND_SOC_DAPM_EVENT_ON (event)) +gpio_set_value (S3C2410_GPA (1 ),1 ); +else +gpio_set_value (S3C2410_GPA (1 ),0 ); + +return 0 ; +} + +static int rx1950_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{ +struct snd_soc_pcm_runtime *rtd = substream->private_data; +struct snd_soc_dai *cpu_dai = rtd->cpu_dai; +struct snd_soc_dai *codec_dai = rtd->codec_dai; +int div; +int ret; +unsigned int rate =params_rate (params); +int clk_source, fs_mode; + +switch (rate) { +case 16000 : +case 48000 : + clk_source =S3C24XX_CLKSRC_PCLK ; + fs_mode =S3C2410_IISMOD_384FS ; + div =s3c24xx_i2s_get_clockrate () / (384 * rate); +if (s3c24xx_i2s_get_clockrate () % (384 * rate) > (182 * rate)) + div++; +break ; +case 44100 : +case 88200 : + clk_source =S3C24XX_CLKSRC_MPLL ; + fs_mode =S3C2410_IISMOD_256FS ; + div =clk_get_rate (xtal) / (256 * rate); +if (clk_get_rate (xtal) % (256 * rate) > (128 * rate)) + div++; +break ; +default : +printk (KERN_ERR "%s: rate %d is not supported\n" , + __func__, rate); +return -EINVAL ; + } + +/* set codec DAI configuration */ + ret =snd_soc_dai_set_fmt (codec_dai,SND_SOC_DAIFMT_I2S | +SND_SOC_DAIFMT_NB_NF |SND_SOC_DAIFMT_CBS_CFS ); +if (ret <0 ) +return ret; + +/* set cpu DAI configuration */ + ret =snd_soc_dai_set_fmt (cpu_dai,SND_SOC_DAIFMT_I2S | +SND_SOC_DAIFMT_NB_NF |SND_SOC_DAIFMT_CBS_CFS ); +if (ret <0 ) +return ret; + +/* select clock source */ + ret =snd_soc_dai_set_sysclk (cpu_dai, clk_source, rate, +SND_SOC_CLOCK_OUT ); +if (ret <0 ) +return ret; + +/* set MCLK division for sample rate */ + ret =snd_soc_dai_set_clkdiv (cpu_dai,S3C24XX_DIV_MCLK , +S3C2410_IISMOD_384FS ); +if (ret <0 ) +return ret; + +/* set BCLK division for sample rate */ + ret =snd_soc_dai_set_clkdiv (cpu_dai,S3C24XX_DIV_BCLK , +S3C2410_IISMOD_32FS ); +if (ret <0 ) +return ret; + +/* set prescaler division for sample rate */ + ret =snd_soc_dai_set_clkdiv (cpu_dai,S3C24XX_DIV_PRESCALER , +S3C24XX_PRESCALE (div, div)); +if (ret <0 ) +return ret; + +return 0 ; +} + +static int rx1950_uda1380_init (struct snd_soc_pcm_runtime *rtd) +{ +struct snd_soc_codec *codec = rtd->codec; +int err; + +/* Add rx1950 specific widgets */ + err =snd_soc_dapm_new_controls (codec, uda1380_dapm_widgets, +ARRAY_SIZE (uda1380_dapm_widgets)); + +if (err) +return err; + +/* Set up rx1950 specific audio path audio_mapnects */ + err =snd_soc_dapm_add_routes (codec, audio_map, +ARRAY_SIZE (audio_map)); + +if (err) +return err; + +snd_soc_dapm_enable_pin (codec,"Headphone Jack" ); +snd_soc_dapm_enable_pin (codec,"Speaker" ); + +snd_soc_dapm_sync (codec); + +snd_soc_jack_new (codec,"Headphone Jack" ,SND_JACK_HEADPHONE , + &hp_jack); + +snd_soc_jack_add_pins (&hp_jack,ARRAY_SIZE (hp_jack_pins), + hp_jack_pins); + +snd_soc_jack_add_gpios (&hp_jack,ARRAY_SIZE (hp_jack_gpios), + hp_jack_gpios); + +return 0 ; +} + +static int __init rx1950_init (void ) +{ +int ret; + +/* configure some gpios */ + ret =gpio_request (S3C2410_GPA (1 ),"speaker-power" ); +if (ret) + goto err_gpio; + + ret =gpio_direction_output (S3C2410_GPA (1 ),0 ); +if (ret) + goto err_gpio_conf; + + s3c24xx_snd_device =platform_device_alloc ("soc-audio" ,-1 ); +if (!s3c24xx_snd_device) { + ret = -ENOMEM ; + goto err_plat_alloc; + } + +platform_set_drvdata (s3c24xx_snd_device, &rx1950_asoc); + ret =platform_device_add (s3c24xx_snd_device); + +if (ret) { +platform_device_put (s3c24xx_snd_device); + goto err_plat_add; + } + + xtal =clk_get (&s3c24xx_snd_device->dev,"xtal" ); + +if (IS_ERR (xtal)) {
sound/soc/s3c24xx/rx1950_uda1380.c line 312
Quoted 10 lines
sound/soc/s3c24xx/rx1950_uda1380.c new file +10
-0+ ret =PTR_ERR (xtal); +platform_device_unregister (s3c24xx_snd_device); + goto err_clk; + } + +return 0 ; + +err_clk: +err_plat_add: +err_plat_alloc:
No need for so much labels :)
Quoted 13 lines
sound/soc/s3c24xx/rx1950_uda1380.c new file +13
-0+err_gpio_conf: +gpio_free (S3C2410_GPA (1 )); + +err_gpio: +return ret; +} + +static void __exit rx1950_exit(void) +{ +platform_device_unregister (s3c24xx_snd_device); +snd_soc_jack_free_gpios (&hp_jack,ARRAY_SIZE (hp_jack_gpios), + hp_jack_gpios); +clk_put (xtal);
sound/soc/s3c24xx/rx1950_uda1380.c line 335
Quoted 10 lines
sound/soc/s3c24xx/rx1950_uda1380.c new file +10
-0+gpio_free (S3C2410_GPA (1 )); +} + +module_init (rx1950_init); +module_exit (rx1950_exit); + +/* Module information */ +MODULE_AUTHOR ("Vasily Khoruzhick" ); +MODULE_DESCRIPTION ("ALSA SoC RX1950" ); +MODULE_LICENSE ("GPL" );
I'd be glad if some alsa-guy checked this one.
PATCH v4 3/3 ARM: S3C24XX: I2S multi-component-related fixes
In reply to Vasily KhoruzhickExport s3c_device_pcm for all S3C24xx-devices, not only for S3C2440;
Fix device name for s3c_device_iis;
--- arch/arm/plat-s3c24xx/devs.c | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-)
arch/arm/plat-s3c24xx/devs.c +16 -16
@@ -247,7 +247,7 @@ static struct resource s3c_iis_resource[] = {static u64 s3c_device_iis_dmamask =0xffffffffUL ;struct platform_device s3c_device_iis = { - .name ="s3c2410-iis" , + .name ="s3c24xx-iis" , .id =-1 , .num_resources =ARRAY_SIZE (s3c_iis_resource), .resource = s3c_iis_resource,
@@ -259,6 +259,21 @@ struct platform_device s3c_device_iis = {EXPORT_SYMBOL (s3c_device_iis); +/* ASoC PCM DMA */ + +static u64 s3c_device_audio_dmamask =0xffffffffUL ; + +struct platform_device s3c_device_pcm = { + .name ="s3c24xx-pcm-audio" , + .id =-1 , + .dev = { + .dma_mask = &s3c_device_audio_dmamask, + .coherent_dma_mask =0xffffffffUL + } +}; + +EXPORT_SYMBOL (s3c_device_pcm); +/* RTC */ static struct resource s3c_rtc_resource[] = {
@@ -481,8 +496,6 @@ static struct resource s3c_ac97_resource[] = { }, }; -static u64 s3c_device_audio_dmamask =0xffffffffUL ; -struct platform_device s3c_device_ac97 = { .name ="s3c-ac97" , .id =-1 ,
@@ -496,19 +509,6 @@ struct platform_device s3c_device_ac97 = {EXPORT_SYMBOL (s3c_device_ac97); -/* ASoC PCM DMA */ - -struct platform_device s3c_device_pcm = { - .name ="s3c24xx-pcm-audio" , - .id =-1 , - .dev = { - .dma_mask = &s3c_device_audio_dmamask, - .coherent_dma_mask =0xffffffffUL - } -}; - -EXPORT_SYMBOL (s3c_device_pcm); -/* ASoC I2S */ struct platform_device s3c2412_device_iis = {
Signature · 1 line
1.7.2
Re: [PATCH v4 3/3] ARM: S3C24XX: I2S multi-component-related fixes
Dne Ne 29. srpna 2010 19:11:12 Vasily Khoruzhick napsal(a):
Quoted 4 lines
Export
s3c_device_pcmfor all S3C24xx-devices, not only for S3C2440;
Fix device name fors3c_device_iis;
Won't moving this from #ifdef CONFIG_CPU_S32440 trouble other s3c24xx CPUs? If not, that's ok.
Quoted 69 lines
Signed-off-by Vasily Khoruzhick <[email protected]>--- arch/arm/plat-s3c24xx/devs.c | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-)arch/arm/plat-s3c24xx/devs.c +16
-16@@ -247,7 +247,7 @@ static struct resource s3c_iis_resource[] = {static u64 s3c_device_iis_dmamask =0xffffffffUL ;struct platform_device s3c_device_iis = { - .name ="s3c2410-iis" , + .name ="s3c24xx-iis" , .id =-1 , .num_resources =ARRAY_SIZE (s3c_iis_resource), .resource = s3c_iis_resource,@@ -259,6 +259,21 @@ struct platform_device s3c_device_iis = {EXPORT_SYMBOL (s3c_device_iis); +/* ASoC PCM DMA */ + +static u64 s3c_device_audio_dmamask =0xffffffffUL ; + +struct platform_device s3c_device_pcm = { + .name ="s3c24xx-pcm-audio" , + .id =-1 , + .dev = { + .dma_mask = &s3c_device_audio_dmamask, + .coherent_dma_mask =0xffffffffUL + } +}; + +EXPORT_SYMBOL (s3c_device_pcm); +/* RTC */ static struct resource s3c_rtc_resource[] = {@@ -481,8 +496,6 @@ static struct resource s3c_ac97_resource[] = { }, }; -static u64 s3c_device_audio_dmamask =0xffffffffUL ; -struct platform_device s3c_device_ac97 = { .name ="s3c-ac97" , .id =-1 ,@@ -496,19 +509,6 @@ struct platform_device s3c_device_ac97 = {EXPORT_SYMBOL (s3c_device_ac97); -/* ASoC PCM DMA */ - -struct platform_device s3c_device_pcm = { - .name ="s3c24xx-pcm-audio" , - .id =-1 , - .dev = { - .dma_mask = &s3c_device_audio_dmamask, - .coherent_dma_mask =0xffffffffUL - } -}; - -EXPORT_SYMBOL (s3c_device_pcm); -/* ASoC I2S */ struct platform_device s3c2412_device_iis = {
Re: [PATCH v4 3/3] ARM: S3C24XX: I2S multi-component-related fixes
В сообщении от 29 августа 2010 20:41:54 автор Marek Vasut написал:
Quoted 7 lines
Dne Ne 29. srpna 2010 19:11:12 Vasily Khoruzhick napsal(a):
Quoted 3 lines
Export
s3c_device_pcmfor all S3C24xx-devices, not only for S3C2440;
Fix device name fors3c_device_iis;Won't moving this from #ifdef
CONFIG_CPU_S32440trouble other s3c24xx CPUs? If not, that's ok.
Nope, it's necessary for all s3c24xx-based devices.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Marek Vasut
Acked-byRe: [PATCH v4 3/3] ARM: S3C24XX: I2S multi-component-related fixes
Dne Ne 29. srpna 2010 19:47:36 Vasily Khoruzhick napsal(a):
Quoted 10 lines
В сообщении от 29 августа 2010 20:41:54 автор Marek Vasut написал:
Quoted 7 lines
Dne Ne 29. srpna 2010 19:11:12 Vasily Khoruzhick napsal(a):
Quoted 3 lines
Export
s3c_device_pcmfor all S3C24xx-devices, not only for S3C2440;
Fix device name fors3c_device_iis;Won't moving this from #ifdef
CONFIG_CPU_S32440trouble other s3c24xx CPUs? If not, that's ok.Nope, it's necessary for all s3c24xx-based devices.
All right.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel