ASoC merge
Subsystems (5)
The following patch series merges some of the outstanding changes in the linux-2.6-asoc tree. It updates the core and existing drivers and adds some of the new drivers currently in the tree.
PATCH 1/1 Update MAINTAINERS for ALSA SoC
Add myself as a point of contact for the ALSA SoC subsystem and add a reference to the development GIT tree.
--- MAINTAINERS | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
MAINTAINERS +3 -0
@@ -3513,6 +3513,9 @@ S: Maintained SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT P: Liam Girdwood M: [email protected] +P: Mark Brown +M: [email protected] +T: git opensource.wolfsonmicro.com/linux-2.6-asoc L: [email protected] (subscribers-only) S: Supported
Signature · 1 line
1.5.3.5
PATCH 1/1 Reinitialise DMA on every resume
From: Graeme Gregory <[email protected]>
This one changes the DMA initialisation as it turns out the DMA driver in s3c24xx doesnt store registers between suspend/resume so you have to re-initialise the channels on every resume.
--- sound/soc/s3c24xx/s3c24xx-pcm.c | 48 ++++++++++++++++++++------------------ 1 files changed, 25 insertions(+), 23 deletions(-)
sound/soc/s3c24xx/s3c24xx-pcm.c +25 -23
@@ -49,7 +49,9 @@ static const struct snd_pcm_hardware s3c24xx_pcm_hardware = { .info = SNDRV_PCM_INFO_INTERLEAVED |SNDRV_PCM_INFO_BLOCK_TRANSFER |SNDRV_PCM_INFO_MMAP | - SNDRV_PCM_INFO_MMAP_VALID, +SNDRV_PCM_INFO_MMAP_VALID | +SNDRV_PCM_INFO_PAUSE | + SNDRV_PCM_INFO_RESUME, .formats =SNDRV_PCM_FMTBIT_S16_LE |SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_U8 |
@@ -176,28 +178,6 @@ static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream, } } -/* channel needs configuring for mem=>device, increment memory addr, -* sync to pclk, half-word transfers to the IIS-FIFO. */ -if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { -s3c2410_dma_devconfig (prtd->params->channel, -S3C2410_DMASRC_MEM ,S3C2410_DISRCC_INC | -S3C2410_DISRCC_APB , prtd->params->dma_addr); - -s3c2410_dma_config (prtd->params->channel, - prtd->params->dma_size, -S3C2410_DCON_SYNC_PCLK | -S3C2410_DCON_HANDSHAKE ); - }else { -s3c2410_dma_config (prtd->params->channel, - prtd->params->dma_size, -S3C2410_DCON_HANDSHAKE | -S3C2410_DCON_SYNC_PCLK ); - -s3c2410_dma_devconfig (prtd->params->channel, -S3C2410_DMASRC_HW ,0x3 , - prtd->params->dma_addr); - } -s3c2410_dma_set_buffdone_fn (prtd->params->channel, s3c24xx_audio_buffdone);
@@ -246,6 +226,28 @@ static int s3c24xx_pcm_prepare(struct snd_pcm_substream *substream)if (!prtd->params)return 0 ; +/* channel needs configuring for mem=>device, increment memory addr, +* sync to pclk, half-word transfers to the IIS-FIFO. */ +if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { +s3c2410_dma_devconfig (prtd->params->channel, +S3C2410_DMASRC_MEM ,S3C2410_DISRCC_INC | +S3C2410_DISRCC_APB , prtd->params->dma_addr); + +s3c2410_dma_config (prtd->params->channel, + prtd->params->dma_size, +S3C2410_DCON_SYNC_PCLK | +S3C2410_DCON_HANDSHAKE ); + }else { +s3c2410_dma_config (prtd->params->channel, + prtd->params->dma_size, +S3C2410_DCON_HANDSHAKE | +S3C2410_DCON_SYNC_PCLK ); + +s3c2410_dma_devconfig (prtd->params->channel, +S3C2410_DMASRC_HW ,0x3 , + prtd->params->dma_addr); + } +/* flush the DMA channel */ s3c2410_dma_ctrl (prtd->params->channel,S3C2410_DMAOP_FLUSH ); prtd->dma_loaded =0 ;
Signature · 1 line
1.5.3.5
PATCH 1/1 Support suspend and resume of the I2S interface on s3c24xx.
From: Graeme Gregory <[email protected]>
--- sound/soc/s3c24xx/s3c24xx-i2s.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-)
sound/soc/s3c24xx/s3c24xx-i2s.c +38 -0
@@ -75,6 +75,10 @@ static struct s3c24xx_pcm_dma_params s3c24xx_i2s_pcm_stereo_in = {struct s3c24xx_i2s_info {void __iomem *regs;struct clk *iis_clk; +u32 iiscon; +u32 iismod; +u32 iisfcon; +u32 iispsr; };static struct s3c24xx_i2s_info s3c24xx_i2s;
@@ -405,6 +409,38 @@ static int s3c24xx_i2s_probe(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_PM +int s3c24xx_i2s_suspend (struct platform_device *pdev, +struct snd_soc_cpu_dai *cpu_dai) +{ + s3c24xx_i2s.iiscon =readl (s3c24xx_i2s.regs +S3C2410_IISCON ); + s3c24xx_i2s.iismod =readl (s3c24xx_i2s.regs +S3C2410_IISMOD ); + s3c24xx_i2s.iisfcon =readl (s3c24xx_i2s.regs +S3C2410_IISFCON ); + s3c24xx_i2s.iispsr =readl (s3c24xx_i2s.regs +S3C2410_IISPSR ); + +clk_disable (s3c24xx_i2s.iis_clk); + +return 0 ; +} + +int s3c24xx_i2s_resume (struct platform_device *pdev, +struct snd_soc_cpu_dai *cpu_dai) +{ +clk_enable (s3c24xx_i2s.iis_clk); + +writel (s3c24xx_i2s.iiscon, s3c24xx_i2s.regs +S3C2410_IISCON ); +writel (s3c24xx_i2s.iismod, s3c24xx_i2s.regs +S3C2410_IISMOD ); +writel (s3c24xx_i2s.iisfcon, s3c24xx_i2s.regs +S3C2410_IISFCON ); +writel (s3c24xx_i2s.iispsr, s3c24xx_i2s.regs +S3C2410_IISPSR ); + +return 0 ; +} +#else +#define s3c24xx_i2s_suspend NULL +#define s3c24xx_i2s_resume NULL +#endif + +#define S3C24XX_I2S_RATES \ (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \ SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
@@ -415,6 +451,8 @@ struct snd_soc_cpu_dai s3c24xx_i2s_dai = { .id = 0, .type = SND_SOC_DAI_I2S, .probe = s3c24xx_i2s_probe, + .suspend = s3c24xx_i2s_suspend, + .resume = s3c24xx_i2s_resume, .playback = { .channels_min = 2, .channels_max = 2,
Signature · 1 line
1.5.3.5
PATCH 1/1 Fix inverted Bass, Treble, Mono volume and Phone volume WM9712 mixer controls.
From: Joe Sauer <[email protected]>
--- sound/soc/codecs/wm9712.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/wm9712.c +4 -4
@@ -102,7 +102,7 @@ SOC_SINGLE("Speaker Playback ZC Switch", AC97_MASTER, 7, 1, 0),SOC_SINGLE ("Speaker Playback Invert Switch" ,AC97_MASTER ,6 ,1 ,0 ),SOC_SINGLE ("Headphone Playback ZC Switch" ,AC97_HEADPHONE ,7 ,1 ,0 ),SOC_SINGLE ("Mono Playback ZC Switch" ,AC97_MASTER_MONO ,7 ,1 ,0 ), -SOC_SINGLE ("Mono Playback Volume" ,AC97_MASTER_MONO ,0 ,31 ,0 ), +SOC_SINGLE ("Mono Playback Volume" ,AC97_MASTER_MONO ,0 ,31 ,1 ),SOC_SINGLE ("ALC Target Volume" ,AC97_CODEC_CLASS_REV ,12 ,15 ,0 ), SOC_SINGLE("ALC Hold Time", AC97_CODEC_CLASS_REV, 8, 15, 0),
@@ -131,7 +131,7 @@ SOC_SINGLE("Aux Playback Headphone Volume", AC97_CD, 12, 7, 1),SOC_SINGLE ("Aux Playback Speaker Volume" ,AC97_CD ,8 ,7 ,1 ),SOC_SINGLE ("Aux Playback Phone Volume" ,AC97_CD ,4 ,7 ,1 ), -SOC_SINGLE ("Phone Volume" ,AC97_PHONE ,0 ,15 ,0 ), +SOC_SINGLE ("Phone Volume" ,AC97_PHONE ,0 ,15 ,1 ),SOC_DOUBLE ("Line Capture Volume" ,AC97_LINE ,8 ,0 ,31 ,1 ), SOC_SINGLE("Capture 20dB Boost Switch", AC97_REC_SEL, 14, 1, 0),
@@ -145,8 +145,8 @@ SOC_ENUM("Bass Control", wm9712_enum[5]),SOC_SINGLE ("Bass Cut-off Switch" ,AC97_MASTER_TONE ,12 ,1 ,1 ),SOC_SINGLE ("Tone Cut-off Switch" ,AC97_MASTER_TONE ,4 ,1 ,1 ),SOC_SINGLE ("Playback Attenuate (-6dB) Switch" ,AC97_MASTER_TONE ,6 ,1 ,0 ), -SOC_SINGLE ("Bass Volume" ,AC97_MASTER_TONE ,8 ,15 ,0 ), -SOC_SINGLE ("Treble Volume" ,AC97_MASTER_TONE ,0 ,15 ,0 ), +SOC_SINGLE ("Bass Volume" ,AC97_MASTER_TONE ,8 ,15 ,1 ), +SOC_SINGLE ("Treble Volume" ,AC97_MASTER_TONE ,0 ,15 ,1 ),SOC_SINGLE ("Capture ADC Switch" ,AC97_REC_GAIN ,15 ,1 ,1 ), SOC_ENUM("Capture Volume Steps", wm9712_enum[6]),
Signature · 1 line
1.5.3.5
PATCH 1/1 Add device level DAPM event
From: Liam Girdwood <[email protected]>
Added a device level dapm event so that both the machine and codec are informed when dapm events occur.
--- include/sound/soc-dapm.h | 1 + include/sound/soc.h | 3 +++ sound/soc/soc-core.c | 23 +++++++++++------------ sound/soc/soc-dapm.c | 23 +++++++++++++++++++++++ 4 files changed, 38 insertions(+), 12 deletions(-)
include/sound/soc-dapm.h +1 -0
@@ -199,6 +199,7 @@ void snd_soc_dapm_free(struct snd_soc_device *socdev);/* 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);/* dapm sys fs - used by the core */ int snd_soc_dapm_sys_add (struct device *dev);
include/sound/soc.h +3 -0
@@ -426,6 +426,9 @@ struct snd_soc_machine {int (*resume_pre)(struct platform_device *pdev);int (*resume_post)(struct platform_device *pdev); +/* callbacks */ +int (*dapm_event)(struct snd_soc_machine *,int event); +/* CPU <--> Codec DAI links */ struct snd_soc_dai_link *dai_link;int num_links;
sound/soc/soc-core.c +11 -12
@@ -289,15 +289,16 @@ static void close_delayed_work(struct work_struct *work)if (codec_dai->pop_wait ==1 ) { codec_dai->pop_wait =0 ; -snd_soc_dapm_stream_event (codec, codec_dai->playback.stream_name, +snd_soc_dapm_stream_event (codec, + codec_dai->playback.stream_name,SND_SOC_DAPM_STREAM_STOP );/* power down the codec power domain if no longer active */ if (codec->active ==0 ) {dbg ("pop wq D3 %s %s\n" , codec->name, codec_dai->playback.stream_name); -if (codec->dapm_event) - codec->dapm_event (codec, SNDRV_CTL_POWER_D3hot); +snd_soc_dapm_device_event (socdev, + SNDRV_CTL_POWER_D3hot); } } }
@@ -353,12 +354,12 @@ static int soc_codec_close(struct snd_pcm_substream *substream) }else {/* capture streams can be powered down now */ snd_soc_dapm_stream_event (codec, - codec_dai->capture.stream_name,SND_SOC_DAPM_STREAM_STOP ); + codec_dai->capture.stream_name, +SND_SOC_DAPM_STREAM_STOP ); -if (codec->active ==0 && codec_dai->pop_wait ==0 ){ -if (codec->dapm_event) - codec->dapm_event (codec, SNDRV_CTL_POWER_D3hot); - } +if (codec->active ==0 && codec_dai->pop_wait ==0 ) +snd_soc_dapm_device_event (socdev, + SNDRV_CTL_POWER_D3hot); }mutex_unlock (&pcm_mutex);
@@ -433,8 +434,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)/* no delayed work - do we need to power up codec */ if (codec->dapm_state !=SNDRV_CTL_POWER_D0 ) { -if (codec->dapm_event) - codec->dapm_event (codec,SNDRV_CTL_POWER_D1 ); +snd_soc_dapm_device_event (socdev,SNDRV_CTL_POWER_D1 );if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) snd_soc_dapm_stream_event(codec,
@@ -445,8 +445,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) codec_dai->capture.stream_name, SND_SOC_DAPM_STREAM_START); -if (codec->dapm_event) - codec->dapm_event (codec,SNDRV_CTL_POWER_D0 ); +snd_soc_dapm_device_event (socdev,SNDRV_CTL_POWER_D0 );if (codec_dai->dai_ops.digital_mute) codec_dai->dai_ops.digital_mute (codec_dai,0 );
sound/soc/soc-dapm.c +23 -0
@@ -1280,6 +1280,29 @@ int snd_soc_dapm_stream_event(struct snd_soc_codec *codec,EXPORT_SYMBOL_GPL (snd_soc_dapm_stream_event);/** +* snd_soc_dapm_device_event - send a device event to the dapm core +* @socdev: audio device +* @event: device event +* +* Sends a device event to the dapm core. The core then makes any +* necessary machine or codec power changes.. +* +* Returns 0 for success else error. +*/ +int snd_soc_dapm_device_event (struct snd_soc_device *socdev,int event) +{ +struct snd_soc_codec *codec = socdev->codec; +struct snd_soc_machine *machine = socdev->machine; + +if (machine->dapm_event) + machine->dapm_event (machine, event); +if (codec->dapm_event) + codec->dapm_event (codec, event); +return 0 ; +} +EXPORT_SYMBOL_GPL (snd_soc_dapm_device_event); + +/** * snd_soc_dapm_set_endpoint - set audio endpoint status * @codec: audio codec * @endpoint: audio signal endpoint (or start point)
Signature · 1 line
1.5.3.5
PATCH 1/1 ASoC TLV support.
From: Philipp Zabel <[email protected]>
--- include/sound/soc-dapm.h | 24 ++++++++++++++--- include/sound/soc.h | 58 +++++++++++++++++++++++++++++++++------- sound/soc/soc-core.c | 66 ++++++++++++++++++++++++++------------------- sound/soc/soc-dapm.c | 14 +++++---- 4 files changed, 114 insertions(+), 48 deletions(-)
include/sound/soc-dapm.h +20 -4
@@ -131,18 +131,34 @@ .shift = wshift, .invert = winvert}/* dapm kcontrol types */ -#define SOC_DAPM_SINGLE (xname, reg, shift, mask, invert) \ +#define SOC_DAPM_SINGLE (xname, reg, shift, max, invert) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ .info = snd_soc_info_volsw, \ .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ - .private_value = SOC_SINGLE_VALUE(reg, shift, mask, invert) } -#define SOC_DAPM_DOUBLE (xname, reg, shift_left, shift_right, mask, invert, \ + .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } +#define SOC_DAPM_DOUBLE (xname, reg, shift_left, shift_right, max, invert, \ power) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ .info = snd_soc_info_volsw, \ .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\ - ((mask) << 16) | ((invert) << 24) } + ((max) << 16) | ((invert) << 24) } +#define SOC_DAPM_SINGLE_TLV (xname, reg, shift, max, invert, tlv_array) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ + .info = snd_soc_info_volsw, \ + .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ + .tlv.p = (tlv_array), \ + .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ + .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } +#define SOC_DAPM_DOUBLE_TLV (xname, reg, shift_left, shift_right, max, invert, \ + power, tlv_array) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ + .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ + .tlv.p = (tlv_array), \ + .info = snd_soc_info_volsw, \ + .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ + .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\ + ((max) << 16) | ((invert) << 24) }#define SOC_DAPM_ENUM (xname, xenum) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ .info = snd_soc_info_enum_double, \
include/sound/soc.h +48 -10
84 lines not on this page · raw message
sound/soc/soc-core.c +38 -28
159 lines not on this page · raw message
sound/soc/soc-dapm.c +8 -6
@@ -1019,8 +1019,9 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,int reg = kcontrol->private_value &0xff ;int shift = (kcontrol->private_value >>8 ) &0x0f ;int rshift = (kcontrol->private_value >>12 ) &0x0f ; -int mask = (kcontrol->private_value >>16 ) &0xff ; +int max = (kcontrol->private_value >>16 ) &0xff ;int invert = (kcontrol->private_value >>24 ) &0x01 ; +int mask = (1 <<fls (max)) -1 ;/* return the saved value if we are powered down */ if (widget->id == snd_soc_dapm_pga && !widget->power) {
@@ -1035,10 +1036,10 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol, (snd_soc_read (widget->codec, reg) >> rshift) & mask;if (invert) { ucontrol->value.integer.value[0 ] = - mask - ucontrol->value.integer.value[0 ]; + max - ucontrol->value.integer.value[0 ];if (shift != rshift) ucontrol->value.integer.value[1 ] = - mask - ucontrol->value.integer.value[1 ]; + max - ucontrol->value.integer.value[1 ]; }return 0 ;
@@ -1061,7 +1062,8 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,int reg = kcontrol->private_value &0xff ;int shift = (kcontrol->private_value >>8 ) &0x0f ;int rshift = (kcontrol->private_value >>12 ) &0x0f ; -int mask = (kcontrol->private_value >>16 ) &0xff ; +int max = (kcontrol->private_value >>16 ) &0xff ; +int mask = (1 <<fls (max)) -1 ;int invert = (kcontrol->private_value >>24 ) &0x01 ;unsigned short val, val2, val_mask;int ret;
@@ -1069,13 +1071,13 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, val = (ucontrol->value.integer.value[0 ] & mask);if (invert) - val = mask - val; + val = max - val; val_mask = mask << shift; val = val << shift;if (shift != rshift) { val2 = (ucontrol->value.integer.value[1 ] & mask);if (invert) - val2 = mask - val2; + val2 = max - val2; val_mask |= mask << rshift; val |= val2 << rshift; }
Signature · 1 line
1.5.3.5
PATCH 1/1 Add D1 power event to power down event sequence
From: Liam Girdwood <[email protected]>
--- sound/soc/soc-core.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
sound/soc/soc-core.c +8 -0
@@ -288,6 +288,14 @@ 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 */ +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 ); + } + codec_dai->pop_wait =0 ; snd_soc_dapm_stream_event(codec, codec_dai->playback.stream_name,
Signature · 1 line
1.5.3.5
PATCH 1/1 Ensure PCMs are suspended
From: Liam Girdwood <[email protected]>
This fixes a bug whereby PCMs were not being suspended when the rest of the audio subsystem was suspended.
--- include/sound/soc.h | 3 +++ sound/soc/soc-core.c | 5 +++++ 2 files changed, 8 insertions(+), 0 deletions(-)
include/sound/soc.h +3 -0
@@ -448,6 +448,9 @@ struct snd_soc_dai_link {/* codec/machine specific init - e.g. add machine controls */ int (*init)(struct snd_soc_codec *codec); + +/* DAI pcm */ +struct snd_pcm *pcm; };/* SoC machine */
sound/soc/soc-core.c +5 -0
@@ -646,6 +646,10 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state) dai->dai_ops.digital_mute (dai,1 ); } +/* suspend all pcms */ +for (i =0 ; i < machine->num_links; i++) +snd_pcm_suspend_all (machine->dai_link[i].pcm); +if (machine->suspend_pre) machine->suspend_pre (pdev, state);
@@ -880,6 +884,7 @@ static int soc_new_pcm(struct snd_soc_device *socdev,return ret; } + dai_link->pcm = pcm; pcm->private_data = rtd; soc_pcm_ops.mmap = socdev->platform->pcm_ops->mmap; soc_pcm_ops.pointer = socdev->platform->pcm_ops->pointer;
Signature · 1 line
1.5.3.5
PATCH 1/1 Fix power switching support for DAPM_SWITCH widgets.
From: Liam Girdwood <[email protected]>
--- sound/soc/soc-dapm.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
sound/soc/soc-dapm.c +3 -2
@@ -692,7 +692,7 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget,return 0 ; } -/* test and update the power status of a mixer widget */ +/* test and update the power status of a mixer or switch widget */ static int dapm_mixer_update_power (struct snd_soc_dapm_widget *widget,struct snd_kcontrol *kcontrol,int reg,int val_mask,int val,int invert)
@@ -700,7 +700,8 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,struct snd_soc_dapm_path *path;int found =0 ; -if (widget->id != snd_soc_dapm_mixer) +if (widget->id != snd_soc_dapm_mixer && + widget->id != snd_soc_dapm_switch)return -ENODEV ;if (!snd_soc_test_bits (widget->codec, reg, val_mask, val))
Signature · 1 line
1.5.3.5
PATCH 1/1 Clean up tabs.
From: Liam Girdwood <[email protected]>
--- sound/soc/soc-dapm.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
sound/soc/soc-dapm.c +2 -2
@@ -1298,9 +1298,9 @@ int snd_soc_dapm_device_event(struct snd_soc_device *socdev, int event)struct snd_soc_machine *machine = socdev->machine;if (machine->dapm_event) - machine->dapm_event (machine, event); + machine->dapm_event (machine, event);if (codec->dapm_event) - codec->dapm_event (codec, event); + codec->dapm_event (codec, event);return 0 ; }EXPORT_SYMBOL_GPL (snd_soc_dapm_device_event);
Signature · 1 line
1.5.3.5
PATCH 1/1 Add support for passing kcontrols with events.
From: Liam Girdwood <[email protected]>
--- include/sound/soc-dapm.h | 2 +- sound/soc/soc-dapm.c | 40 +++++++++++++++++++++++++++------------- 2 files changed, 28 insertions(+), 14 deletions(-)
include/sound/soc-dapm.h +1 -1
@@ -289,7 +289,7 @@ struct snd_soc_dapm_widget {/* external events */ unsigned short event_flags;/* flags to specify event types */ -int (*event)(struct snd_soc_dapm_widget *,int ); +int (*event)(struct snd_soc_dapm_widget *,struct snd_kcontrol *,int );/* kcontrols that relate to this widget */ int num_kcontrols;
sound/soc/soc-dapm.c +27 -13
@@ -524,11 +524,13 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)continue ;if (event ==SND_SOC_DAPM_STREAM_START ) { - ret = w->event (w,SND_SOC_DAPM_PRE_PMU ); + ret = w->event (w, +NULL ,SND_SOC_DAPM_PRE_PMU );if (ret <0 )return ret; }else if (event ==SND_SOC_DAPM_STREAM_STOP ) { - ret = w->event (w,SND_SOC_DAPM_PRE_PMD ); + ret = w->event (w, +NULL ,SND_SOC_DAPM_PRE_PMD );if (ret <0 )return ret; }
@@ -539,11 +541,13 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)continue ;if (event ==SND_SOC_DAPM_STREAM_START ) { - ret = w->event (w,SND_SOC_DAPM_POST_PMU ); + ret = w->event (w, +NULL ,SND_SOC_DAPM_POST_PMU );if (ret <0 )return ret; }else if (event ==SND_SOC_DAPM_STREAM_STOP ) { - ret = w->event (w,SND_SOC_DAPM_POST_PMD ); + ret = w->event (w, +NULL ,SND_SOC_DAPM_POST_PMD );if (ret <0 )return ret; }
@@ -567,26 +571,30 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)if (power) {/* power up event */ if (w->event_flags &SND_SOC_DAPM_PRE_PMU ) { - ret = w->event (w,SND_SOC_DAPM_PRE_PMU ); + ret = w->event (w, +NULL ,SND_SOC_DAPM_PRE_PMU );if (ret <0 )return ret; }dapm_update_bits (w);if (w->event_flags &SND_SOC_DAPM_POST_PMU ){ - ret = w->event (w,SND_SOC_DAPM_POST_PMU ); + ret = w->event (w, +NULL ,SND_SOC_DAPM_POST_PMU );if (ret <0 )return ret; } }else {/* power down event */ if (w->event_flags &SND_SOC_DAPM_PRE_PMD ) { - ret = w->event (w,SND_SOC_DAPM_PRE_PMD ); + ret = w->event (w, +NULL ,SND_SOC_DAPM_PRE_PMD );if (ret <0 )return ret; }dapm_update_bits (w);if (w->event_flags &SND_SOC_DAPM_POST_PMD ) { - ret = w->event (w,SND_SOC_DAPM_POST_PMD ); + ret = w->event (w, +NULL ,SND_SOC_DAPM_POST_PMD );if (ret <0 )return ret; }
@@ -1096,13 +1104,17 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,dapm_mixer_update_power (widget, kcontrol, reg, val_mask, val, invert);if (widget->event) {if (widget->event_flags &SND_SOC_DAPM_PRE_REG ) { - ret = widget->event (widget,SND_SOC_DAPM_PRE_REG ); -if (ret <0 ) + ret = widget->event (widget, kcontrol, +SND_SOC_DAPM_PRE_REG ); +if (ret <0 ) { + ret =1 ; goto out; + } } ret =snd_soc_update_bits (widget->codec, reg, val_mask, val);if (widget->event_flags &SND_SOC_DAPM_POST_REG ) - ret = widget->event (widget,SND_SOC_DAPM_POST_REG ); + ret = widget->event (widget, kcontrol, +SND_SOC_DAPM_POST_REG ); }else ret =snd_soc_update_bits (widget->codec, reg, val_mask, val);
@@ -1177,13 +1189,15 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,dapm_mux_update_power (widget, kcontrol, mask, mux, e);if (widget->event) {if (widget->event_flags &SND_SOC_DAPM_PRE_REG ) { - ret = widget->event (widget,SND_SOC_DAPM_PRE_REG ); + ret = widget->event (widget, + kcontrol,SND_SOC_DAPM_PRE_REG );if (ret <0 ) goto out; } ret =snd_soc_update_bits (widget->codec, e->reg, mask, val);if (widget->event_flags &SND_SOC_DAPM_POST_REG ) - ret = widget->event (widget,SND_SOC_DAPM_POST_REG ); + ret = widget->event (widget, + kcontrol,SND_SOC_DAPM_POST_REG ); }else ret =snd_soc_update_bits (widget->codec, e->reg, mask, val);
Signature · 1 line
1.5.3.5
PATCH 1/1 Bump ASoC core version number
--- include/sound/soc.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/sound/soc.h +1 -1
@@ -22,7 +22,7 @@#include <sound/control.h> #include <sound/ac97_codec.h> -#define SND_SOC_VERSION "0.13.1" +#define SND_SOC_VERSION "0.13.2"/* * Convenience kcontrol builders
Signature · 1 line
1.5.3.5
PATCH 1/1 Add ASoC WM9713 codec driver.
From: Liam Girdwood <[email protected]>
--- sound/soc/codecs/Kconfig | 5 +- sound/soc/codecs/Makefile | 2 + sound/soc/codecs/wm9713.c | 1289 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/wm9713.h | 53 ++ 4 files changed, 1348 insertions(+), 1 deletions(-) create mode 100644 sound/soc/codecs/wm9713.c create mode 100644 sound/soc/codecs/wm9713.h
sound/soc/codecs/Kconfig +4 -1
@@ -18,6 +18,10 @@ config SND_SOC_WM9712 tristate depends on SND_SOC +config SND_SOC_WM9713 + tristate + depends on SND_SOC + # Cirrus Logic CS4270 Codec config SND_SOC_CS4270 tristate
@@ -36,4 +40,3 @@ config SND_SOC_CS4270_HWMUTE config SND_SOC_CS4270_VD33_ERRATA bool depends on SND_SOC_CS4270 -
sound/soc/codecs/Makefile +2 -0
@@ -3,6 +3,7 @@ snd-soc-wm8731-objs := wm8731.o snd-soc-wm8750-objs := wm8750.o snd-soc-wm8753-objs := wm8753.o snd-soc-wm9712-objs := wm9712.o +snd-soc-wm9713-objs := wm9713.o snd-soc-cs4270-objs := cs4270.o obj-$(CONFIG_SND_SOC_AC97_CODEC) += snd-soc-ac97.o
@@ -10,4 +11,5 @@ obj-$(CONFIG_SND_SOC_WM8731) += snd-soc-wm8731.o obj-$(CONFIG_SND_SOC_WM8750) += snd-soc-wm8750.o obj-$(CONFIG_SND_SOC_WM8753) += snd-soc-wm8753.o obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o +obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o obj-$(CONFIG_SND_SOC_CS4270) += snd-soc-cs4270.o
sound/soc/codecs/wm9713.c new file +1289 -0
1,289 lines not on this page · raw message
sound/soc/codecs/wm9713.h new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
1.5.3.5
PATCH 1/1 Initial WM8753 TLV support for capture mixer.
From: Liam Girdwood <[email protected]>
--- sound/soc/codecs/wm8753.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
sound/soc/codecs/wm8753.c +8 -2
@@ -48,6 +48,7 @@#include <sound/soc.h> #include <sound/soc-dapm.h> #include <sound/initval.h> +#include <sound/tlv.h> #include <asm/div64.h> #include "wm8753.h"
@@ -258,6 +259,11 @@ static int wm8753_set_dai(struct snd_kcontrol *kcontrol,return 1 ; } +static const unsigned int rec_mix_tlv[] = { +TLV_DB_RANGE_HEAD (1 ), +0 ,7 ,TLV_DB_LINEAR_ITEM (-1500 ,600 ), +}; +static const struct snd_kcontrol_new wm8753_snd_controls[] = {SOC_DOUBLE_R ("PCM Volume" ,WM8753_LDAC ,WM8753_RDAC ,0 ,255 ,0 ),
@@ -287,8 +293,8 @@ SOC_SINGLE("Bass Volume", WM8753_BASS, 0, 15, 1),SOC_SINGLE ("Treble Volume" ,WM8753_TREBLE ,0 ,15 ,1 ),SOC_ENUM ("Treble Cut-off" , wm8753_enum[2 ]), -SOC_DOUBLE ("Sidetone Capture Volume" ,WM8753_RECMIX1 ,0 ,4 ,7 ,1 ), -SOC_SINGLE ("Voice Sidetone Capture Volume" ,WM8753_RECMIX2 ,0 ,7 ,1 ), +SOC_DOUBLE_TLV ("Sidetone Capture Volume" ,WM8753_RECMIX1 ,0 ,4 ,7 ,1 , rec_mix_tlv), +SOC_SINGLE_TLV ("Voice Sidetone Capture Volume" ,WM8753_RECMIX2 ,0 ,7 ,1 , rec_mix_tlv),SOC_DOUBLE_R ("Capture Volume" ,WM8753_LINVOL ,WM8753_RINVOL ,0 ,63 ,0 ), SOC_DOUBLE_R("Capture ZC Switch", WM8753_LINVOL, WM8753_RINVOL, 6, 1, 0),
Signature · 1 line
1.5.3.5
PATCH 1/1 Add ASoC AK4535 codec driver.
From: Richard Purdie <[email protected]>
--- include/linux/i2c-id.h | 1 + sound/soc/codecs/Kconfig | 4 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/ak4535.c | 716 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/ak4535.h | 46 +++ 5 files changed, 769 insertions(+), 0 deletions(-) create mode 100644 sound/soc/codecs/ak4535.c create mode 100644 sound/soc/codecs/ak4535.h
include/linux/i2c-id.h +1 -0
@@ -121,6 +121,7 @@#define I2C_DRIVERID_LM4857 92/* LM4857 Audio Amplifier */ #define I2C_DRIVERID_VP27SMPX 93/* Panasonic VP27s tuner internal MPX */ #define I2C_DRIVERID_CS4270 94/* Cirrus Logic 4270 audio codec */ +#define I2C_DRIVERID_AK4535 95/* AK4525 audio codec */ #define I2C_DRIVERID_I2CDEV 900#define I2C_DRIVERID_ARP 902/* SMBus ARP Client */
sound/soc/codecs/Kconfig +4 -0
@@ -2,6 +2,10 @@ config SND_SOC_AC97_CODEC tristate depends on SND_SOC +config SND_SOC_AK4535 + tristate + depends on SND_SOC + config SND_SOC_WM8731 tristate depends on SND_SOC
sound/soc/codecs/Makefile +2 -0
@@ -1,4 +1,5 @@ snd-soc-ac97-objs := ac97.o +snd-soc-ak4535-objs := ak4535.o snd-soc-wm8731-objs := wm8731.o snd-soc-wm8750-objs := wm8750.o snd-soc-wm8753-objs := wm8753.o
@@ -7,6 +8,7 @@ snd-soc-wm9713-objs := wm9713.o snd-soc-cs4270-objs := cs4270.o obj-$(CONFIG_SND_SOC_AC97_CODEC) += snd-soc-ac97.o +obj-$(CONFIG_SND_SOC_AK4535) += snd-soc-ak4535.o obj-$(CONFIG_SND_SOC_WM8731) += snd-soc-wm8731.o obj-$(CONFIG_SND_SOC_WM8750) += snd-soc-wm8750.o obj-$(CONFIG_SND_SOC_WM8753) += snd-soc-wm8753.o
sound/soc/codecs/ak4535.c new file +716 -0
716 lines not on this page · raw message
sound/soc/codecs/ak4535.h new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
1.5.3.5
PATCH 1/1 Add ASoC TLV320 Codec driver.
From: Liam Girdwood <[email protected]>
--- include/linux/i2c-id.h | 1 + sound/soc/codecs/Kconfig | 4 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/tlv320.c | 603 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/tlv320.h | 111 +++++++++ 5 files changed, 721 insertions(+), 0 deletions(-) create mode 100644 sound/soc/codecs/tlv320.c create mode 100644 sound/soc/codecs/tlv320.h
include/linux/i2c-id.h +1 -0
@@ -122,6 +122,7 @@#define I2C_DRIVERID_VP27SMPX 93/* Panasonic VP27s tuner internal MPX */ #define I2C_DRIVERID_CS4270 94/* Cirrus Logic 4270 audio codec */ #define I2C_DRIVERID_AK4535 95/* AK4525 audio codec */ +#define I2C_DRIVERID_TLV320 97/* TLV 320 audio codec */ #define I2C_DRIVERID_I2CDEV 900#define I2C_DRIVERID_ARP 902/* SMBus ARP Client */
sound/soc/codecs/Kconfig +4 -0
@@ -6,6 +6,10 @@ config SND_SOC_AK4535 tristate depends on SND_SOC +config SND_SOC_TLV320 + tristate + depends on SND_SOC + config SND_SOC_WM8731 tristate depends on SND_SOC
sound/soc/codecs/Makefile +2 -0
@@ -1,5 +1,6 @@ snd-soc-ac97-objs := ac97.o snd-soc-ak4535-objs := ak4535.o +snd-soc-tlv320-objs := tlv320.o snd-soc-wm8731-objs := wm8731.o snd-soc-wm8750-objs := wm8750.o snd-soc-wm8753-objs := wm8753.o
@@ -9,6 +10,7 @@ snd-soc-cs4270-objs := cs4270.o obj-$(CONFIG_SND_SOC_AC97_CODEC) += snd-soc-ac97.o obj-$(CONFIG_SND_SOC_AK4535) += snd-soc-ak4535.o +obj-$(CONFIG_SND_SOC_TLV320) += snd-soc-tlv320.o obj-$(CONFIG_SND_SOC_WM8731) += snd-soc-wm8731.o obj-$(CONFIG_SND_SOC_WM8750) += snd-soc-wm8750.o obj-$(CONFIG_SND_SOC_WM8753) += snd-soc-wm8753.o
sound/soc/codecs/tlv320.c new file +603 -0
603 lines not on this page · raw message
sound/soc/codecs/tlv320.h new file +111 -0
111 lines not on this page · raw message
Signature · 1 line
1.5.3.5
PATCH 1/1 Add ASoC UDA1380 codec driver.
From: Liam Girdwood <[email protected]>
--- include/linux/i2c-id.h | 1 + sound/soc/codecs/Kconfig | 4 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/uda1380.c | 740 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/uda1380.h | 89 ++++++ 5 files changed, 836 insertions(+), 0 deletions(-) create mode 100644 sound/soc/codecs/uda1380.c create mode 100644 sound/soc/codecs/uda1380.h
include/linux/i2c-id.h +1 -0
@@ -123,6 +123,7 @@#define I2C_DRIVERID_CS4270 94/* Cirrus Logic 4270 audio codec */ #define I2C_DRIVERID_AK4535 95/* AK4525 audio codec */ #define I2C_DRIVERID_TLV320 97/* TLV 320 audio codec */ +#define I2C_DRIVERID_UDA1380 98/* Philips UDA1380 audio codec */ #define I2C_DRIVERID_I2CDEV 900#define I2C_DRIVERID_ARP 902/* SMBus ARP Client */
sound/soc/codecs/Kconfig +4 -0
@@ -10,6 +10,10 @@ config SND_SOC_TLV320 tristate depends on SND_SOC +config SND_SOC_UDA1380 + tristate + depends on SND_SOC + config SND_SOC_WM8731 tristate depends on SND_SOC
sound/soc/codecs/Makefile +2 -0
@@ -1,6 +1,7 @@ snd-soc-ac97-objs := ac97.o snd-soc-ak4535-objs := ak4535.o snd-soc-tlv320-objs := tlv320.o +snd-soc-uda1380-objs := uda1380.o snd-soc-wm8731-objs := wm8731.o snd-soc-wm8750-objs := wm8750.o snd-soc-wm8753-objs := wm8753.o
@@ -11,6 +12,7 @@ snd-soc-cs4270-objs := cs4270.o obj-$(CONFIG_SND_SOC_AC97_CODEC) += snd-soc-ac97.o obj-$(CONFIG_SND_SOC_AK4535) += snd-soc-ak4535.o obj-$(CONFIG_SND_SOC_TLV320) += snd-soc-tlv320.o +obj-$(CONFIG_SND_SOC_UDA1380) += snd-soc-uda1380.o obj-$(CONFIG_SND_SOC_WM8731) += snd-soc-wm8731.o obj-$(CONFIG_SND_SOC_WM8750) += snd-soc-wm8750.o obj-$(CONFIG_SND_SOC_WM8753) += snd-soc-wm8753.o
sound/soc/codecs/uda1380.c new file +740 -0
740 lines not on this page · raw message
sound/soc/codecs/uda1380.h new file +89 -0
89 lines not on this page · raw message
Signature · 1 line
1.5.3.5
PATCH 1/1 Add pxa2xx SSP audio support.
From: Liam Girdwood <[email protected]>
--- sound/soc/pxa/Kconfig | 4 + sound/soc/pxa/Makefile | 2 + sound/soc/pxa/pxa2xx-ssp.c | 666 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/pxa/pxa2xx-ssp.h | 43 +++ 4 files changed, 715 insertions(+), 0 deletions(-) create mode 100644 sound/soc/pxa/pxa2xx-ssp.c create mode 100644 sound/soc/pxa/pxa2xx-ssp.h
sound/soc/pxa/Kconfig +4 -0
@@ -18,6 +18,10 @@ config SND_PXA2XX_SOC_AC97 config SND_PXA2XX_SOC_I2S tristate +config SND_PXA2XX_SOC_SSP + tristate + select PXA_SSP + config SND_PXA2XX_SOC_CORGI tristate "SoC Audio support for Sharp Zaurus SL-C7x0" depends on SND_PXA2XX_SOC && PXA_SHARP_C7xx
sound/soc/pxa/Makefile +2 -0
@@ -2,10 +2,12 @@ snd-soc-pxa2xx-objs := pxa2xx-pcm.o snd-soc-pxa2xx-ac97-objs := pxa2xx-ac97.o snd-soc-pxa2xx-i2s-objs := pxa2xx-i2s.o +snd-soc-pxa2xx-ssp-objs := pxa2xx-ssp.o obj-$(CONFIG_SND_PXA2XX_SOC) += snd-soc-pxa2xx.o obj-$(CONFIG_SND_PXA2XX_SOC_AC97) += snd-soc-pxa2xx-ac97.o obj-$(CONFIG_SND_PXA2XX_SOC_I2S) += snd-soc-pxa2xx-i2s.o +obj-$(CONFIG_SND_PXA2XX_SOC_SSP) += snd-soc-pxa2xx-ssp.o # PXA Machine Support snd-soc-corgi-objs := corgi.o
sound/soc/pxa/pxa2xx-ssp.c new file +666 -0
666 lines not on this page · raw message
sound/soc/pxa/pxa2xx-ssp.h new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
1.5.3.5
PATCH 1/1 Add Amesom ASoC machine support.
From: Liam Girdwood <[email protected]>
--- sound/soc/pxa/Kconfig | 10 ++ sound/soc/pxa/Makefile | 3 +- sound/soc/pxa/amesom_tlv320.c | 211 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 223 insertions(+), 1 deletions(-) create mode 100644 sound/soc/pxa/amesom_tlv320.c
sound/soc/pxa/Kconfig +10 -0
@@ -57,3 +57,13 @@ config SND_PXA2XX_SOC_TOSA help Say Y if you want to add support for SoC audio on Sharp Zaurus SL-C6000x models (Tosa). + +config SND_PXA2XX_SOC_AMESOM_TLV320 + tristate "SoC SSP Audio support for AMESOM - TLV320AIC24k" + depends on SND_PXA2XX_SOC && MACH_AMESOM + select SND_PXA2XX_SOC_I2S + select SND_PXA2XX_SOC_SSP + select SND_SOC_TLV320 + help + Say Y if you want to add support for SoC audio on Amesom + with the tlv320.
sound/soc/pxa/Makefile +2 -1
@@ -14,9 +14,10 @@ snd-soc-corgi-objs := corgi.o snd-soc-poodle-objs := poodle.o snd-soc-tosa-objs := tosa.o snd-soc-spitz-objs := spitz.o +snd-soc-amesom-tlv320-objs := amesom_tlv320.o obj-$(CONFIG_SND_PXA2XX_SOC_CORGI) += snd-soc-corgi.o obj-$(CONFIG_SND_PXA2XX_SOC_POODLE) += snd-soc-poodle.o obj-$(CONFIG_SND_PXA2XX_SOC_TOSA) += snd-soc-tosa.o obj-$(CONFIG_SND_PXA2XX_SOC_SPITZ) += snd-soc-spitz.o - +obj-$(CONFIG_SND_PXA2XX_SOC_AMESOM_TLV320) += snd-soc-amesom-tlv320.o
sound/soc/pxa/amesom_tlv320.c new file +211 -0
211 lines not on this page · raw message
Signature · 1 line
1.5.3.5
PATCH 1/1 Add ASoC Magician machine support.
From: Liam Girdwood <[email protected]>
--- sound/soc/pxa/Kconfig | 11 + sound/soc/pxa/Makefile | 2 + sound/soc/pxa/magician.c | 539 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 552 insertions(+), 0 deletions(-) create mode 100644 sound/soc/pxa/magician.c
sound/soc/pxa/Kconfig +11 -0
@@ -58,6 +58,17 @@ config SND_PXA2XX_SOC_TOSA Say Y if you want to add support for SoC audio on Sharp Zaurus SL-C6000x models (Tosa). +config SND_PXA2XX_SOC_MAGICIAN + tristate "SoC Audio support for HTC Magician" + depends on SND_PXA2XX_SOC + select SND_PXA2XX_SOC_I2S + select SND_PXA2XX_SOC_SSP + select SND_SOC_UDA1380 + help + Say Y if you want to add support for SoC audio on the + HTC Magician. + + config SND_PXA2XX_SOC_AMESOM_TLV320 tristate "SoC SSP Audio support for AMESOM - TLV320AIC24k" depends on SND_PXA2XX_SOC && MACH_AMESOM
sound/soc/pxa/Makefile +2 -0
@@ -15,9 +15,11 @@ snd-soc-poodle-objs := poodle.o snd-soc-tosa-objs := tosa.o snd-soc-spitz-objs := spitz.o snd-soc-amesom-tlv320-objs := amesom_tlv320.o +snd-soc-magician-objs := magician.o obj-$(CONFIG_SND_PXA2XX_SOC_CORGI) += snd-soc-corgi.o obj-$(CONFIG_SND_PXA2XX_SOC_POODLE) += snd-soc-poodle.o obj-$(CONFIG_SND_PXA2XX_SOC_TOSA) += snd-soc-tosa.o obj-$(CONFIG_SND_PXA2XX_SOC_SPITZ) += snd-soc-spitz.o obj-$(CONFIG_SND_PXA2XX_SOC_AMESOM_TLV320) += snd-soc-amesom-tlv320.o +obj-$(CONFIG_SND_PXA2XX_SOC_MAGICIAN) += snd-soc-magician.o
sound/soc/pxa/magician.c new file +539 -0
539 lines not on this page · raw message
Signature · 1 line
1.5.3.5
PATCH 1/1 Add TLV support for UDA1380
From: Philipp Zabel <[email protected]>
--- sound/soc/codecs/uda1380.c | 255 ++++++++++++++++++++++++++++++++++++++------ 1 files changed, 222 insertions(+), 33 deletions(-)
sound/soc/codecs/uda1380.c +222 -33
@@ -5,6 +5,10 @@* it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * +* Copyright (c) 2007 Philipp Zabel <[email protected]> +* Improved support for DAPM and audio routing/mixing capabilities, +* added TLV support. +* * Modified by Richard Purdie <[email protected]> to fit into SoC * codec model. *
@@ -28,6 +32,7 @@#include <sound/info.h> #include <sound/soc.h> #include <sound/soc-dapm.h> +#include <sound/tlv.h> #include "uda1380.h"
@@ -111,14 +116,14 @@ static int uda1380_write(struct snd_soc_codec *codec, unsigned int reg,*/ if (!codec->active && (reg >=UDA1380_MVOL ))return 0 ; -dbg ("uda hw write %x val %x\n" , reg, value); +dbg ("uda hw write %x val %x" , reg, value);if (codec->hw_write (codec->control_data, data,3 ) ==3 ) {unsigned int val;i2c_master_send (codec->control_data, data,1 );i2c_master_recv (codec->control_data, data,2 ); val = (data[0 ]<<8 ) | data[1 ];if (val != value) { -dbg ("READ BACK VAL %x\n" , (data[0 ]<<8 ) | data[1 ]); +dbg ("READ BACK VAL %x" , (data[0 ]<<8 ) | data[1 ]);return -EIO ; }return 0 ;
@@ -131,37 +136,202 @@ static int uda1380_write(struct snd_soc_codec *codec, unsigned int reg,/* declarations of ALSA reg_elem_REAL controls */ static const char *uda1380_deemp[] = {"None" ,"32kHz" ,"44.1kHz" ,"48kHz" ,"96kHz" }; -static const char *uda1380_input_sel[] = {"Line" ,"Mic" }; -static const char *uda1380_output_sel[] = {"Direct" ,"Mixer" }; +static const char *uda1380_input_sel[] = {"Line" ,"Mic + Line R" ,"Line L" ,"Mic" }; +static const char *uda1380_output_sel[] = {"DAC" ,"Analog Mixer" };static const char *uda1380_spf_mode[] = {"Flat" ,"Minimum1" ,"Minimum2" ,"Maximum" }; +static const char *uda1380_capture_sel[] = {"ADC" ,"Digital Mixer" }; +static const char *uda1380_sel_ns[] = {"3rd-order" ,"5th-order" }; +static const char *uda1380_mix_control[] = {"off" ,"PCM only" ,"before sound processing" ,"after sound processing" }; +static const char *uda1380_sdet_setting[] = {"3200" ,"4800" ,"9600" ,"19200" }; +static const char *uda1380_os_setting[] = {"single-speed" ,"double-speed (no mixing)" ,"quad-speed (no mixing)" }; + +static const struct soc_enum uda1380_deemp_enum[] = { +SOC_ENUM_SINGLE (UDA1380_DEEMP ,8 ,5 , uda1380_deemp), +SOC_ENUM_SINGLE (UDA1380_DEEMP ,0 ,5 , uda1380_deemp), +}; +static const struct soc_enum uda1380_input_sel_enum = +SOC_ENUM_SINGLE (UDA1380_ADC ,2 ,4 , uda1380_input_sel);/* SEL_MIC, SEL_LNA */ +static const struct soc_enum uda1380_output_sel_enum = +SOC_ENUM_SINGLE (UDA1380_PM ,7 ,2 , uda1380_output_sel);/* R02_EN_AVC */ +static const struct soc_enum uda1380_spf_enum = +SOC_ENUM_SINGLE (UDA1380_MODE ,14 ,4 , uda1380_spf_mode);/* M */ +static const struct soc_enum uda1380_capture_sel_enum = +SOC_ENUM_SINGLE (UDA1380_IFACE ,6 ,2 , uda1380_capture_sel);/* SEL_SOURCE */ +static const struct soc_enum uda1380_sel_ns_enum = +SOC_ENUM_SINGLE (UDA1380_MIXER ,14 ,2 , uda1380_sel_ns);/* SEL_NS */ +static const struct soc_enum uda1380_mix_enum = +SOC_ENUM_SINGLE (UDA1380_MIXER ,12 ,4 , uda1380_mix_control);/* MIX, MIX_POS */ +static const struct soc_enum uda1380_sdet_enum = +SOC_ENUM_SINGLE (UDA1380_MIXER ,4 ,4 , uda1380_sdet_setting);/* SD_VALUE */ +static const struct soc_enum uda1380_os_enum = +SOC_ENUM_SINGLE (UDA1380_MIXER ,0 ,3 , uda1380_os_setting);/* OS */ + +/** +* snd_soc_info_volsw - single mixer info callback +* @kcontrol: mixer control +* @uinfo: control element information +* +* Callback to provide information about a single mixer control. +* +* Returns 0 for success. +*/ +int snd_soc_info_volsw_s8 (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_info *uinfo) +{ +int max = (kcontrol->private_value >>16 ) &0xff ; +int min = (kcontrol->private_value >>24 ) &0xff ; + +/* 00000000 (0) ...(-0.25 dB)... 11111000 (-78 dB), 11111100 -INF */ + + uinfo->type =SNDRV_CTL_ELEM_TYPE_INTEGER ; + uinfo->count =2 ; + uinfo->value.integer.min = min; + uinfo->value.integer.max = max; +return 0 ; +} + +/** +* snd_soc_get_volsw_sgn - single mixer get callback +* @kcontrol: mixer control +* @uinfo: control element information +* +* Callback to get the value of a single mixer control. +* +* Returns 0 for success. +*/ +int snd_soc_get_volsw_s8 (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol); +int reg = kcontrol->private_value &0xff ; +int max = (kcontrol->private_value >>16 ) &0xff ; +int min = (kcontrol->private_value >>24 ) &0xff ; + + ucontrol->value.integer.value[0 ] = + (signed char )(snd_soc_read (codec, reg) &0xff ); + ucontrol->value.integer.value[1 ] = + (signed char )((snd_soc_read (codec, reg) >>8 ) &0xff ); + +return 0 ; +} + +/** +* snd_soc_put_volsw_sgn - single mixer put callback +* @kcontrol: mixer control +* @uinfo: control element information +* +* Callback to set the value of a single mixer control. +* +* Returns 0 for success. +*/ +int snd_soc_put_volsw_s8 (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol); +int reg = kcontrol->private_value &0xff ; +int max = (kcontrol->private_value >>16 ) &0xff ; +int min = (kcontrol->private_value >>24 ) &0xff ; +int err; +unsigned short val, val2, val_mask; + + val = (signed char )ucontrol->value.integer.value[0 ] &0xff ; + val2 = (signed char )ucontrol->value.integer.value[1 ] &0xff ; + val |= val2<<8 ; + err =snd_soc_update_bits (codec, reg, val_mask, val); +return err; +} + +DECLARE_TLV_DB_SCALE (amix_tlv,-4950 ,150 ,1 );/* from -48 dB in 1.5 dB steps (mute instead of -49.5 dB) */ + +static const unsigned int mvol_tlv[] = { +TLV_DB_RANGE_HEAD (3 ), +0 ,15 ,TLV_DB_SCALE_ITEM (-8200 ,100 ,1 ),/* from -78 dB in 1 dB steps (3 dB steps, really) */ +16 ,43 ,TLV_DB_SCALE_ITEM (-6600 ,50 ,0 ),/* from -66 dB in 0.5 dB steps (2 dB steps, really) */ +44 ,252 ,TLV_DB_SCALE_ITEM (-5200 ,25 ,0 ),/* from -52 dB in 0.25 dB steps */ +}; -static const struct soc_enum uda1380_enum[] = { -SOC_ENUM_DOUBLE (UDA1380_DEEMP ,0 ,8 ,5 , uda1380_deemp), -SOC_ENUM_SINGLE (UDA1380_ADC ,3 ,2 , uda1380_input_sel), -SOC_ENUM_SINGLE (UDA1380_MODE ,14 ,4 , uda1380_spf_mode), -SOC_ENUM_SINGLE (UDA1380_PM ,7 ,2 , uda1380_output_sel),/* R02_EN_AVC */ +static const unsigned int vc_tlv[] = { +TLV_DB_RANGE_HEAD (4 ), +0 ,7 ,TLV_DB_SCALE_ITEM (-7800 ,150 ,1 ),/* from -72 dB in 1.5 dB steps (6 dB steps really) */ +8 ,15 ,TLV_DB_SCALE_ITEM (-6600 ,75 ,0 ),/* from -66 dB in 0.75 dB steps (3 dB steps really) */ +16 ,43 ,TLV_DB_SCALE_ITEM (-6000 ,50 ,0 ),/* from -60 dB in 0.5 dB steps (2 dB steps really) */ +44 ,228 ,TLV_DB_SCALE_ITEM (-4600 ,25 ,0 ),/* from -46 dB in 0.25 dB steps */ }; +DECLARE_TLV_DB_SCALE (tr_tlv,0 ,200 ,0 );/* from 0 dB to 6 dB in 2 dB steps, if SPF mode != flat */ +DECLARE_TLV_DB_SCALE (bb_tlv,0 ,200 ,0 );/* from 0 dB to 24 dB in 2 dB steps, if SPF mode == maximum */ +/* (SPF mode == flat cuts off at 18 dB max */ + +static const unsigned int dec_tlv[] = { +TLV_DB_RANGE_HEAD (1 ), +-128 ,48 ,TLV_DB_SCALE_ITEM (-6350 ,50 ,1 ), +/* 0011000 (48 dB) ...(0.5 dB)... 10000001 (-63 dB) 10000000 -INF */ +}; + +DECLARE_TLV_DB_SCALE (pga_tlv,0 ,300 ,0 );/* from 0 dB to 24 dB in 3 dB steps */ +DECLARE_TLV_DB_SCALE (vga_tlv,0 ,200 ,0 );/* from 0 dB to 30 dB in 2 dB steps */ + + +#define SOC_DOUBLE_S8_TLV (xname, reg, min, max, tlv_array) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ + .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_READWRITE,\ + .tlv.p = (tlv_array), \ + .info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \ + .put = snd_soc_put_volsw_s8, \ + .private_value = (reg) | (((signed char)max) << 16) | (((signed char)min) << 24) } +static const struct snd_kcontrol_new uda1380_snd_controls[] = { -SOC_DOUBLE ("Playback Volume" ,UDA1380_MVOL ,0 ,8 ,255 ,1 ), -SOC_DOUBLE ("Mixer Volume" ,UDA1380_MIXVOL ,0 ,8 ,255 ,1 ), -SOC_ENUM ("Sound Processing Filter Mode" , uda1380_enum[2 ]), -SOC_DOUBLE ("Treble Volume" ,UDA1380_MODE ,4 ,12 ,3 ,0 ), -SOC_DOUBLE ("Bass Volume" ,UDA1380_MODE ,0 ,8 ,15 ,0 ), -SOC_ENUM ("Playback De-emphasis" , uda1380_enum[0 ]), -SOC_DOUBLE ("Capture Volume" ,UDA1380_DEC ,0 ,8 ,127 ,0 ), -SOC_DOUBLE ("Line Capture Volume" ,UDA1380_PGA ,0 ,8 ,15 ,0 ), -SOC_SINGLE ("Mic Capture Volume" ,UDA1380_PGA ,8 ,11 ,0 ), -SOC_DOUBLE ("Playback Switch" ,UDA1380_DEEMP ,3 ,11 ,1 ,1 ), -SOC_SINGLE ("Capture Switch" ,UDA1380_PGA ,15 ,1 ,0 ), -SOC_SINGLE ("AGC Timing" ,UDA1380_AGC ,8 ,7 ,0 ), -SOC_SINGLE ("AGC Target level" ,UDA1380_AGC ,2 ,3 ,1 ), +SOC_DOUBLE_TLV ("Analog Mixer Volume" ,UDA1380_AMIX ,0 ,8 ,44 ,1 , amix_tlv),/* AVCR, AVCL */ +SOC_DOUBLE_TLV ("Master Playback Volume" ,UDA1380_MVOL ,0 ,8 ,252 ,1 , mvol_tlv),/* MVCL, MVCR */ +SOC_SINGLE_TLV ("ADC Playback Volume" ,UDA1380_MIXVOL ,8 ,228 ,1 , vc_tlv),/* VC2 */ +SOC_SINGLE_TLV ("PCM Playback Volume" ,UDA1380_MIXVOL ,0 ,228 ,1 , vc_tlv),/* VC1 */ +SOC_ENUM ("Sound Processing Filter" , uda1380_spf_enum),/* M */ +SOC_DOUBLE_TLV ("Tone Control - Treble" ,UDA1380_MODE ,4 ,12 ,3 ,0 , tr_tlv),/* TRL, TRR */ +SOC_DOUBLE_TLV ("Tone Control - Bass" ,UDA1380_MODE ,0 ,8 ,15 ,0 , bb_tlv),/* BBL, BBR */ +/**/ SOC_SINGLE ("Master Playback Switch" ,UDA1380_DEEMP ,14 ,1 ,1 ),/* MTM */ +SOC_SINGLE ("ADC Playback Switch" ,UDA1380_DEEMP ,11 ,1 ,1 ),/* MT2 from decimation filter */ +SOC_ENUM ("ADC Playback De-emphasis" , uda1380_deemp_enum[0 ]),/* DE2 */ +SOC_SINGLE ("PCM Playback Switch" ,UDA1380_DEEMP ,3 ,1 ,1 ),/* MT1, from digital data input */ +SOC_ENUM ("PCM Playback De-emphasis" , uda1380_deemp_enum[1 ]),/* DE1 */ +SOC_SINGLE ("DAC Polarity inverting Switch" ,UDA1380_MIXER ,15 ,1 ,0 ),/* DA_POL_INV */ +SOC_ENUM ("Noise Shaper" , uda1380_sel_ns_enum),/* SEL_NS */ +SOC_ENUM ("Digital Mixer Signal Control" , uda1380_mix_enum),/* MIX_POS, MIX */ +SOC_SINGLE ("Silence Switch" ,UDA1380_MIXER ,7 ,1 ,0 ),/* SILENCE, force DAC output to silence */ +SOC_SINGLE ("Silence Detector Switch" ,UDA1380_MIXER ,6 ,1 ,0 ),/* SDET_ON */ +SOC_ENUM ("Silence Detector Setting" , uda1380_sdet_enum),/* SD_VALUE */ +SOC_ENUM ("Oversampling Input" , uda1380_os_enum),/* OS */ +SOC_DOUBLE_S8_TLV ("ADC Capture Volume" ,UDA1380_DEC ,-128 ,48 , dec_tlv),/* ML_DEC, MR_DEC */ +/**/ SOC_SINGLE ("ADC Capture Switch" ,UDA1380_PGA ,15 ,1 ,1 ),/* MT_ADC */ +SOC_DOUBLE_TLV ("Line Capture Volume" ,UDA1380_PGA ,0 ,8 ,8 ,0 , pga_tlv),/* PGA_GAINCTRLL, PGA_GAINCTRLR */ +SOC_SINGLE ("ADC Polarity inverting Switch" ,UDA1380_ADC ,12 ,1 ,0 ),/* ADCPOL_INV */ +SOC_SINGLE_TLV ("Mic Capture Volume" ,UDA1380_ADC ,8 ,15 ,0 , vga_tlv),/* VGA_CTRL */ +SOC_SINGLE ("DC Filter Bypass Switch" ,UDA1380_ADC ,1 ,1 ,0 ),/* SKIP_DCFIL (before decimator) */ +SOC_SINGLE ("DC Filter Enable Switch" ,UDA1380_ADC ,0 ,1 ,0 ),/* EN_DCFIL (at output of decimator) */ +SOC_SINGLE ("AGC Timing" ,UDA1380_AGC ,8 ,7 ,0 ),/* TODO: enum, see table 62 */ +SOC_SINGLE ("AGC Target level" ,UDA1380_AGC ,2 ,3 ,1 ),/* AGC_LEVEL */ +/* -5.5, -8, -11.5, -14 dBFS */ SOC_SINGLE ("AGC Switch" ,UDA1380_AGC ,0 ,1 ,0 ), -SOC_SINGLE ("Silence" ,UDA1380_MIXER ,7 ,1 ,0 ), -SOC_SINGLE ("Silence Detection" ,UDA1380_MIXER ,6 ,1 ,0 ), }; +/** +* uda1380_snd_soc_cnew +* +* temporary copy of snd_soc_cnew that doesn't overwrite .access +*/ +struct snd_kcontrol *uda1380_snd_soc_cnew (const struct snd_kcontrol_new *_template, +void *data,char *long_name) +{ +struct snd_kcontrol_new template; + +memcpy (&template, _template,sizeof (template)); +if (long_name) + template.name = long_name; + template.index =0 ; + +return snd_ctl_new1 (&template, data); +} +/* add non dapm controls */ static int uda1380_add_controls (struct snd_soc_codec *codec) {
@@ -169,7 +339,7 @@ static int uda1380_add_controls(struct snd_soc_codec *codec)for (i =0 ; i <ARRAY_SIZE (uda1380_snd_controls); i++) { err =snd_ctl_add (codec->card, -snd_soc_cnew (&uda1380_snd_controls[i],codec,NULL )); +uda1380_snd_soc_cnew (&uda1380_snd_controls[i],codec,NULL ));if (err <0 )return err; }
@@ -179,17 +349,24 @@ static int uda1380_add_controls(struct snd_soc_codec *codec)/* Input mux */ static const struct snd_kcontrol_new uda1380_input_mux_control = -SOC_DAPM_ENUM ("Input Select" , uda1380_enum[1 ]); +SOC_DAPM_ENUM ("Route" , uda1380_input_sel_enum);/* Output mux */ static const struct snd_kcontrol_new uda1380_output_mux_control = -SOC_DAPM_ENUM ("Output Select" , uda1380_enum[3 ]); +SOC_DAPM_ENUM ("Route" , uda1380_output_sel_enum); + +/* Capture mux */ +static const struct snd_kcontrol_new uda1380_capture_mux_control = +SOC_DAPM_ENUM ("Route" , uda1380_capture_sel_enum); +static const struct snd_soc_dapm_widget uda1380_dapm_widgets[] = {SND_SOC_DAPM_MUX ("Input Mux" ,SND_SOC_NOPM ,0 ,0 , &uda1380_input_mux_control),SND_SOC_DAPM_MUX ("Output Mux" ,SND_SOC_NOPM ,0 ,0 , &uda1380_output_mux_control), +SND_SOC_DAPM_MUX ("Capture Mux" ,SND_SOC_NOPM ,0 ,0 , + &uda1380_capture_mux_control),SND_SOC_DAPM_PGA ("Left PGA" ,UDA1380_PM ,3 ,0 ,NULL ,0 ),SND_SOC_DAPM_PGA ("Right PGA" ,UDA1380_PM ,1 ,0 ,NULL ,0 ),SND_SOC_DAPM_PGA ("Mic LNA" ,UDA1380_PM ,4 ,0 ,NULL ,0 ),
@@ -218,8 +395,10 @@ static const char *audio_map[][3] = { {"Analog Mixer", NULL, "VINL"}, {"Analog Mixer", NULL, "DAC"}, - {"Output Mux", "Direct", "DAC"}, - {"Output Mux", "Mixer", "Analog Mixer"}, + {"Output Mux", "DAC", "DAC"}, + {"Output Mux", "Analog Mixer", "Analog Mixer"}, + +/* {"DAC", "Digital Mixer", "I2S" } */ /* headphone driver */ {"VOUTLHP", NULL, "HeadPhone Driver"},
@@ -228,10 +407,13 @@ static const char *audio_map[][3] = {/* input mux */ {"Left ADC", NULL, "Input Mux"}, {"Input Mux", "Mic", "Mic LNA"}, + {"Input Mux", "Mic + Line R", "Mic LNA"}, + {"Input Mux", "Line L", "Left PGA"}, {"Input Mux", "Line", "Left PGA"},/* right input */ - {"Right ADC", NULL, "Right PGA"}, + {"Right ADC", "Mic + Line R", "Right PGA"}, + {"Right ADC", "Line", "Right PGA"},/* inputs */ {"Mic LNA", NULL, "VINM"},
@@ -307,6 +489,13 @@ static int uda1380_pcm_prepare(struct snd_pcm_substream *substream) }else { reg_start =UDA1380_DEC ; reg_end =UDA1380_AGC ; +/* FIXME - wince values */ +// uda1380_write(codec, UDA1380_PM, uda1380_read_reg_cache (codec, UDA1380_PM) | R02_PON_LNA | R02_PON_DAC); +uda1380_write (codec,UDA1380_PM ,0x851f ); +// uda1380_write_reg_cache(codec, UDA1380_DEC, 0x0000); +// uda1380_write_reg_cache(codec, UDA1380_PGA, uda1380_read_reg_cache (codec, UDA1380_PM) & ~R21_MT_ADC); /* unmute */ +// uda1380_write_reg_cache(codec, UDA1380_ADC, 0x0001/*0x090d*/); +// ADC_POL_INV=0 VGA_CTRL=9(1001:18dB) gain SEL_LNA=1 SEL_MIC=1 EN_DCFIL=1 }/* FIXME disable DAC_CLK */
@@ -314,7 +503,7 @@ static int uda1380_pcm_prepare(struct snd_pcm_substream *substream)uda1380_write (codec,UDA1380_CLK , clk & ~R00_DAC_CLK );for (reg = reg_start; reg <= reg_end; reg++ ) { -dbg ("reg %x val %x\n" ,reg,uda1380_read_reg_cache (codec, reg)); +dbg ("flush reg %x val %x:" ,reg,uda1380_read_reg_cache (codec, reg));uda1380_write (codec, reg,uda1380_read_reg_cache (codec, reg)); }
@@ -387,7 +576,7 @@ static void uda1380_pcm_shutdown(struct snd_pcm_substream *substream)static int uda1380_mute (struct snd_soc_codec_dai *codec_dai,int mute) {struct snd_soc_codec *codec = codec_dai->codec; -u16 mute_reg =uda1380_read_reg_cache (codec,UDA1380_DEEMP ) &0xbfff ; +u16 mute_reg =uda1380_read_reg_cache (codec,UDA1380_DEEMP ) & ~R13_MTM ;/* FIXME: mute(codec,0) is called when the magician clock is already * set to WSPLL, but for some unknown reason writing to interpolator
@@ -395,7 +584,7 @@ static int uda1380_mute(struct snd_soc_codec_dai *codec_dai, int mute)u16 clk =uda1380_read_reg_cache (codec,UDA1380_CLK );uda1380_write (codec,UDA1380_CLK , ~R00_DAC_CLK & clk);if (mute) -uda1380_write (codec,UDA1380_DEEMP , mute_reg |0x4000 ); +uda1380_write (codec,UDA1380_DEEMP , mute_reg |R13_MTM );else uda1380_write (codec,UDA1380_DEEMP , mute_reg);uda1380_write (codec,UDA1380_CLK , clk);
Signature · 1 line
1.5.3.5
PATCH 1/1 Add ASoC WM8510 codec driver.
From: Liam Girdwood <[email protected]>
--- include/linux/i2c-id.h | 1 + sound/soc/codecs/Kconfig | 4 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/wm8510.c | 855 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/wm8510.h | 103 ++++++ 5 files changed, 965 insertions(+), 0 deletions(-) create mode 100644 sound/soc/codecs/wm8510.c create mode 100644 sound/soc/codecs/wm8510.h
include/linux/i2c-id.h +1 -0
@@ -124,6 +124,7 @@#define I2C_DRIVERID_AK4535 95/* AK4525 audio codec */ #define I2C_DRIVERID_TLV320 97/* TLV 320 audio codec */ #define I2C_DRIVERID_UDA1380 98/* Philips UDA1380 audio codec */ +#define I2C_DRIVERID_WM8510 99/* Wolfson WM8510 audio codec */ #define I2C_DRIVERID_I2CDEV 900#define I2C_DRIVERID_ARP 902/* SMBus ARP Client */
sound/soc/codecs/Kconfig +4 -0
@@ -14,6 +14,10 @@ config SND_SOC_UDA1380 tristate depends on SND_SOC +config SND_SOC_WM8510 + tristate + depends on SND_SOC + config SND_SOC_WM8731 tristate depends on SND_SOC
sound/soc/codecs/Makefile +2 -0
@@ -2,6 +2,7 @@ snd-soc-ac97-objs := ac97.o snd-soc-ak4535-objs := ak4535.o snd-soc-tlv320-objs := tlv320.o snd-soc-uda1380-objs := uda1380.o +snd-soc-wm8510-objs := wm8510.o snd-soc-wm8731-objs := wm8731.o snd-soc-wm8750-objs := wm8750.o snd-soc-wm8753-objs := wm8753.o
@@ -13,6 +14,7 @@ obj-$(CONFIG_SND_SOC_AC97_CODEC) += snd-soc-ac97.o obj-$(CONFIG_SND_SOC_AK4535) += snd-soc-ak4535.o obj-$(CONFIG_SND_SOC_TLV320) += snd-soc-tlv320.o obj-$(CONFIG_SND_SOC_UDA1380) += snd-soc-uda1380.o +obj-$(CONFIG_SND_SOC_WM8510) += snd-soc-wm8510.o obj-$(CONFIG_SND_SOC_WM8731) += snd-soc-wm8731.o obj-$(CONFIG_SND_SOC_WM8750) += snd-soc-wm8750.o obj-$(CONFIG_SND_SOC_WM8753) += snd-soc-wm8753.o
sound/soc/codecs/wm8510.c new file +855 -0
855 lines not on this page · raw message
sound/soc/codecs/wm8510.h new file +103 -0
103 lines not on this page · raw message
Signature · 1 line
1.5.3.5
PATCH 1/1 Add ASoC WM8711 codec driver.
From: Liam Girdwood <[email protected]>
--- include/linux/i2c-id.h | 1 + sound/soc/codecs/Kconfig | 4 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/wm8711.c | 707 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/wm8711.h | 42 +++ 5 files changed, 756 insertions(+), 0 deletions(-) create mode 100644 sound/soc/codecs/wm8711.c create mode 100644 sound/soc/codecs/wm8711.h
include/linux/i2c-id.h +1 -0
@@ -125,6 +125,7 @@#define I2C_DRIVERID_TLV320 97/* TLV 320 audio codec */ #define I2C_DRIVERID_UDA1380 98/* Philips UDA1380 audio codec */ #define I2C_DRIVERID_WM8510 99/* Wolfson WM8510 audio codec */ +#define I2C_DRIVERID_WM8711 100/* Wolfson WM8711 audio codec */ #define I2C_DRIVERID_I2CDEV 900#define I2C_DRIVERID_ARP 902/* SMBus ARP Client */
sound/soc/codecs/Kconfig +4 -0
@@ -18,6 +18,10 @@ config SND_SOC_WM8510 tristate depends on SND_SOC +config SND_SOC_WM8711 + tristate + depends on SND_SOC + config SND_SOC_WM8731 tristate depends on SND_SOC
sound/soc/codecs/Makefile +2 -0
@@ -3,6 +3,7 @@ snd-soc-ak4535-objs := ak4535.o snd-soc-tlv320-objs := tlv320.o snd-soc-uda1380-objs := uda1380.o snd-soc-wm8510-objs := wm8510.o +snd-soc-wm8711-objs := wm8711.o snd-soc-wm8731-objs := wm8731.o snd-soc-wm8750-objs := wm8750.o snd-soc-wm8753-objs := wm8753.o
@@ -15,6 +16,7 @@ obj-$(CONFIG_SND_SOC_AK4535) += snd-soc-ak4535.o obj-$(CONFIG_SND_SOC_TLV320) += snd-soc-tlv320.o obj-$(CONFIG_SND_SOC_UDA1380) += snd-soc-uda1380.o obj-$(CONFIG_SND_SOC_WM8510) += snd-soc-wm8510.o +obj-$(CONFIG_SND_SOC_WM8711) += snd-soc-wm8711.o obj-$(CONFIG_SND_SOC_WM8731) += snd-soc-wm8731.o obj-$(CONFIG_SND_SOC_WM8750) += snd-soc-wm8750.o obj-$(CONFIG_SND_SOC_WM8753) += snd-soc-wm8753.o
sound/soc/codecs/wm8711.c new file +707 -0
707 lines not on this page · raw message
sound/soc/codecs/wm8711.h new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
1.5.3.5
Re: [PATCH] Add ASoC WM8711 codec driver.
At Tue, 20 Nov 2007 09:25:46 +0000,
Quoted 5 lines · Mark Brown
From: Liam Girdwood <[email protected]>
Signed-off-by Liam Girdwood <[email protected]>
This one has no sign-off of the original author...
Quoted 1 line
+ * Author: Mike Arthur <[email protected]>
Takashi
Re: [PATCH] Add ASoC WM8711 codec driver.
Quoted 1 line · Takashi Iwai
This one has no sign-off of the original author...
I'll include that on next submission, thanks.
Re: [PATCH] Add TLV support for UDA1380
In reply to Mark BrownAt Tue, 20 Nov 2007 09:25:44 +0000,
Quoted 4 lines · Mark Brown
From: Philipp Zabel <[email protected]>
Signed-off-by Philipp Zabel <[email protected]>
Apparently this patch does much more than the subject says. If so, please add a proper changelog here, not only in the comment lines.
Quoted 13 lines
sound/soc/codecs/uda1380.c +13
-0+/** +* snd_soc_info_volsw - single mixer info callback +* @kcontrol: mixer control +* @uinfo: control element information +* +* Callback to provide information about a single mixer control. +* +* Returns 0 for success. +*/ +int snd_soc_info_volsw_s8 (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_info *uinfo) +{ +int max = (kcontrol->private_value >>16 ) &0xff ;
sound/soc/codecs/uda1380.c static int uda1380_write(struct snd_soc_codec *codec, unsigned int reg, · line 192
Quoted 10 lines
sound/soc/codecs/uda1380.c +10
-0+int min = (kcontrol->private_value >>24 ) &0xff ; + +/* 00000000 (0) ...(-0.25 dB)... 11111000 (-78 dB), 11111100 -INF */ + + uinfo->type =SNDRV_CTL_ELEM_TYPE_INTEGER ; + uinfo->count =2 ; + uinfo->value.integer.min = min; + uinfo->value.integer.max = max; +return 0 ; +}
This can be static, no? The other two, too.
Review
Quoted 2 lines
(quoted diff) +2
-0+ +DECLARE_TLV_DB_SCALE(amix_tlv, -4950, 150, 1); /* from -48 dB in 1.5 dB steps (mute instead of -49.5 dB) */
Define as static. DECLARE_TLV_DB_SCALE() itself doesn't contain static prefix.
Quoted 13 lines
sound/soc/codecs/uda1380.c +7
-5+static const unsigned int mvol_tlv[] = { +TLV_DB_RANGE_HEAD (3 ), +0 ,15 ,TLV_DB_SCALE_ITEM (-8200 ,100 ,1 ),/* from -78 dB in 1 dB steps (3 dB steps, really) */ +16 ,43 ,TLV_DB_SCALE_ITEM (-6600 ,50 ,0 ),/* from -66 dB in 0.5 dB steps (2 dB steps, really) */ +44 ,252 ,TLV_DB_SCALE_ITEM (-5200 ,25 ,0 ),/* from -52 dB in 0.25 dB steps */ +}; -static const struct soc_enum uda1380_enum[] = { -SOC_ENUM_DOUBLE (UDA1380_DEEMP ,0 ,8 ,5 , uda1380_deemp), -SOC_ENUM_SINGLE (UDA1380_ADC ,3 ,2 , uda1380_input_sel), -SOC_ENUM_SINGLE (UDA1380_MODE ,14 ,4 , uda1380_spf_mode), -SOC_ENUM_SINGLE (UDA1380_PM ,7 ,2 , uda1380_output_sel),/* R02_EN_AVC */ +static const unsigned int vc_tlv[] = {
sound/soc/codecs/uda1380.c static int uda1380_write(struct snd_soc_codec *codec, unsigned int reg, · line 264
Quoted 10 lines
sound/soc/codecs/uda1380.c +8
-0+TLV_DB_RANGE_HEAD (4 ), +0 ,7 ,TLV_DB_SCALE_ITEM (-7800 ,150 ,1 ),/* from -72 dB in 1.5 dB steps (6 dB steps really) */ +8 ,15 ,TLV_DB_SCALE_ITEM (-6600 ,75 ,0 ),/* from -66 dB in 0.75 dB steps (3 dB steps really) */ +16 ,43 ,TLV_DB_SCALE_ITEM (-6000 ,50 ,0 ),/* from -60 dB in 0.5 dB steps (2 dB steps really) */ +44 ,228 ,TLV_DB_SCALE_ITEM (-4600 ,25 ,0 ),/* from -46 dB in 0.25 dB steps */ }; +DECLARE_TLV_DB_SCALE (tr_tlv,0 ,200 ,0 );/* from 0 dB to 6 dB in 2 dB steps, if SPF mode != flat */ +DECLARE_TLV_DB_SCALE (bb_tlv,0 ,200 ,0 );/* from 0 dB to 24 dB in 2 dB steps, if SPF mode == maximum */ +/* (SPF mode == flat cuts off at 18 dB max */
Ditto.
sound/soc/codecs/uda1380.c static int uda1380_write(struct snd_soc_codec *codec, unsigned int reg, · line 273
Quoted 9 lines
sound/soc/codecs/uda1380.c +9
-0+ +static const unsigned int dec_tlv[] = { +TLV_DB_RANGE_HEAD (1 ), +-128 ,48 ,TLV_DB_SCALE_ITEM (-6350 ,50 ,1 ), +/* 0011000 (48 dB) ...(0.5 dB)... 10000001 (-63 dB) 10000000 -INF */ +}; + +DECLARE_TLV_DB_SCALE (pga_tlv,0 ,300 ,0 );/* from 0 dB to 24 dB in 3 dB steps */ +DECLARE_TLV_DB_SCALE (vga_tlv,0 ,200 ,0 );/* from 0 dB to 30 dB in 2 dB steps */
Ditto.
Takashi
Re: [PATCH] Add ASoC Magician machine support.
In reply to Mark BrownAt Tue, 20 Nov 2007 09:25:43 +0000,
Quoted 5 lines · Mark Brown
From: Liam Girdwood <[email protected]>
Signed-off-by Philipp Zabel <[email protected]>Signed-off-by Liam Girdwood <[email protected]>
Hmm... Some patches seem to have inconsistent From: and the author attribute. For exmaple, this module has
MODULE_AUTHOR("Philipp Zabel");while Liam is in From header here (and it's a broken address :)
Otherwise it looks OK except for a few coding style issues. To be sure, try checkpatch.pl.
Takashi
Quoted 599 lines
--- sound/soc/pxa/Kconfig | 11 + sound/soc/pxa/Makefile | 2 + sound/soc/pxa/magician.c | 539 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 552 insertions(+), 0 deletions(-) create mode 100644 sound/soc/pxa/magician.csound/soc/pxa/Kconfig +11
-0@@ -58,6 +58,17 @@ config SND_PXA2XX_SOC_TOSA Say Y if you want to add support for SoC audio on Sharp Zaurus SL-C6000x models (Tosa). +config SND_PXA2XX_SOC_MAGICIAN + tristate "SoC Audio support for HTC Magician" + depends on SND_PXA2XX_SOC + select SND_PXA2XX_SOC_I2S + select SND_PXA2XX_SOC_SSP + select SND_SOC_UDA1380 + help + Say Y if you want to add support for SoC audio on the + HTC Magician. + + config SND_PXA2XX_SOC_AMESOM_TLV320 tristate "SoC SSP Audio support for AMESOM - TLV320AIC24k" depends on SND_PXA2XX_SOC && MACH_AMESOMsound/soc/pxa/Makefile +2
-0@@ -15,9 +15,11 @@ snd-soc-poodle-objs := poodle.o snd-soc-tosa-objs := tosa.o snd-soc-spitz-objs := spitz.o snd-soc-amesom-tlv320-objs := amesom_tlv320.o +snd-soc-magician-objs := magician.o obj-$(CONFIG_SND_PXA2XX_SOC_CORGI) += snd-soc-corgi.o obj-$(CONFIG_SND_PXA2XX_SOC_POODLE) += snd-soc-poodle.o obj-$(CONFIG_SND_PXA2XX_SOC_TOSA) += snd-soc-tosa.o obj-$(CONFIG_SND_PXA2XX_SOC_SPITZ) += snd-soc-spitz.o obj-$(CONFIG_SND_PXA2XX_SOC_AMESOM_TLV320) += snd-soc-amesom-tlv320.o +obj-$(CONFIG_SND_PXA2XX_SOC_MAGICIAN) += snd-soc-magician.osound/soc/pxa/magician.c new file +539
-0@@ -0,0 +1,539 @@ +/* +* SoC audio for HTC Magician +* +* Copyright (c) 2006 Philipp Zabel <[email protected]> +* +* based on spitz.c, +* Authors: Liam Girdwood <[email protected]> +* Richard Purdie <[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. +* +*/ + +#include <linux/module.h> +#include <linux/timer.h> +#include <linux/interrupt.h> +#include <linux/platform_device.h> +#include <linux/delay.h> +#include <sound/driver.h> +#include <sound/core.h> +#include <sound/pcm.h> +#include <sound/soc.h> +#include <sound/soc-dapm.h> + +#include <asm/hardware/scoop.h> +#include <asm/arch/pxa-regs.h> +#include <asm/arch/hardware.h> +#include <asm/arch/magician.h> +#include <asm/arch/magician_cpld.h> +#include <asm/mach-types.h> +#include "../codecs/uda1380.h" +#include "pxa2xx-pcm.h" +#include "pxa2xx-i2s.h" +#include "pxa2xx-ssp.h" + +#define MAGICIAN_HP_ON 0 +#define MAGICIAN_HP_OFF 1 + +#define MAGICIAN_SPK_ON 0 +#define MAGICIAN_SPK_OFF 1 + +#define MAGICIAN_MIC 0 +#define MAGICIAN_MIC_EXT 1 + +/* +* SSP GPIO's +*/ +#define GPIO23_SSPSCLK_MD (23 | GPIO_ALT_FN_2_OUT) +#define GPIO24_SSPSFRM_MD (24 | GPIO_ALT_FN_2_OUT) +#define GPIO25_SSPTXD_MD (25 | GPIO_ALT_FN_2_OUT) + +static int magician_hp_func =MAGICIAN_HP_OFF ; +static int magician_spk_func =MAGICIAN_SPK_ON ; +static int magician_in_sel =MAGICIAN_MIC ; + +extern struct platform_device magician_cpld; + +static void magician_ext_control (struct snd_soc_codec *codec) +{ +snd_soc_dapm_set_endpoint (codec,"Speaker" , + (magician_spk_func ==MAGICIAN_SPK_ON )); + +snd_soc_dapm_set_endpoint (codec,"Headphone Jack" , + (magician_hp_func ==MAGICIAN_HP_ON )); + +switch (magician_in_sel) { +case MAGICIAN_MIC : +snd_soc_dapm_set_endpoint (codec,"Headset Mic" ,0 ); +snd_soc_dapm_set_endpoint (codec,"Call Mic" ,1 ); +break ; +case MAGICIAN_MIC_EXT : +snd_soc_dapm_set_endpoint (codec,"Call Mic" ,0 ); +snd_soc_dapm_set_endpoint (codec,"Headset Mic" ,1 ); +break ; + } +snd_soc_dapm_sync_endpoints (codec); +} + +static int magician_startup (struct snd_pcm_substream *substream) +{ +struct snd_soc_pcm_runtime *rtd = substream->private_data; +struct snd_soc_codec *codec = rtd->socdev->codec; + +/* check the jack status at stream startup */ +magician_ext_control (codec); + +return 0 ; +} + +/* +* Magician uses SSP port for playback. +*/ +static int magician_playback_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_codec_dai *codec_dai = rtd->dai->codec_dai; +struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai; +unsigned int acps, acds, div4; +int ret =0 ; + +/* +* Rate = SSPSCLK / (word size(16)) +* SSPSCLK = (ACPS / ACDS) / SSPSCLKDIV(div4 or div1) +*/ +switch (params_rate (params)) { +case 8000 : + acps =32842000 ; + acds =PXA2XX_SSP_CLK_AUDIO_DIV_32 ;/* wrong - 32 bits/sample */ + div4 =PXA2XX_SSP_CLK_SCDB_4 ; +break ; +case 11025 : + acps =5622000 ; + acds =PXA2XX_SSP_CLK_AUDIO_DIV_8 ;/* 16 bits/sample, 1 slot */ + div4 =PXA2XX_SSP_CLK_SCDB_4 ; +break ; +case 22050 : + acps =5622000 ; + acds =PXA2XX_SSP_CLK_AUDIO_DIV_4 ; + div4 =PXA2XX_SSP_CLK_SCDB_4 ; +break ; +case 44100 : + acps =11345000 ; + acds =PXA2XX_SSP_CLK_AUDIO_DIV_4 ; + div4 =PXA2XX_SSP_CLK_SCDB_4 ; +break ; +case 48000 : + acps =12235000 ; + acds =PXA2XX_SSP_CLK_AUDIO_DIV_4 ; + div4 =PXA2XX_SSP_CLK_SCDB_4 ; +break ; + } + +/* set codec DAI configuration */ + ret = codec_dai->dai_ops.set_fmt (codec_dai,SND_SOC_DAIFMT_MSB | +SND_SOC_DAIFMT_NB_NF |SND_SOC_DAIFMT_CBS_CFS ); +if (ret <0 ) +return ret; + +/* set cpu DAI configuration */ + ret = cpu_dai->dai_ops.set_fmt (cpu_dai,SND_SOC_DAIFMT_MSB | +SND_SOC_DAIFMT_NB_NF |SND_SOC_DAIFMT_CBS_CFS ); +if (ret <0 ) +return ret; + +/* set audio clock as clock source */ + ret = cpu_dai->dai_ops.set_sysclk (cpu_dai,PXA2XX_SSP_CLK_AUDIO ,0 , +SND_SOC_CLOCK_OUT ); +if (ret <0 ) +return ret; + +/* set the SSP audio system clock ACDS divider */ + ret = cpu_dai->dai_ops.set_clkdiv (cpu_dai, +PXA2XX_SSP_AUDIO_DIV_ACDS , acds); +if (ret <0 ) +return ret; + +/* set the SSP audio system clock SCDB divider4 */ + ret = cpu_dai->dai_ops.set_clkdiv (cpu_dai, +PXA2XX_SSP_AUDIO_DIV_SCDB , div4); +if (ret <0 ) +return ret; + +/* set SSP audio pll clock */ + ret = cpu_dai->dai_ops.set_pll (cpu_dai,0 ,0 , acps); +if (ret <0 ) +return ret; + +return 0 ; +} + +/* +* We have to enable the SSP port early so the UDA1380 can flush +* it's register cache. The UDA1380 can only write it's interpolator and +* decimator registers when the link is running. +*/ +static int magician_playback_prepare (struct snd_pcm_substream *substream) +{ +/* enable SSP clock - is this needed ? */ +SSCR0_P (1 ) |=SSCR0_SSE ; + +/* FIXME: ENABLE I2S */ +SACR0 |=SACR0_BCKD ; +SACR0 |=SACR0_ENB ; +pxa_set_cken (CKEN8_I2S ,1 ); + +return 0 ; +} + +static int magician_playback_hw_free (struct snd_pcm_substream *substream) +{ +/* FIXME: DISABLE I2S */ +SACR0 &= ~SACR0_ENB ; +SACR0 &= ~SACR0_BCKD ; +pxa_set_cken (CKEN8_I2S ,0 ); +return 0 ; +} + +/* +* Magician uses I2S for capture. +*/ +static int magician_capture_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_codec_dai *codec_dai = rtd->dai->codec_dai; +struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai; +int ret =0 ; + +/* set codec DAI configuration */ + ret = codec_dai->dai_ops.set_fmt (codec_dai, +SND_SOC_DAIFMT_MSB |SND_SOC_DAIFMT_NB_NF |SND_SOC_DAIFMT_CBS_CFS ); +if (ret <0 ) +return ret; + +/* set cpu DAI configuration */ + ret = cpu_dai->dai_ops.set_fmt (cpu_dai, +SND_SOC_DAIFMT_MSB |SND_SOC_DAIFMT_NB_NF |SND_SOC_DAIFMT_CBS_CFS ); +if (ret <0 ) +return ret; + +/* set the I2S system clock as output */ + ret = cpu_dai->dai_ops.set_sysclk (cpu_dai,PXA2XX_I2S_SYSCLK ,0 , +SND_SOC_CLOCK_OUT ); +if (ret <0 ) +return ret; + +return 0 ; +} + +/* +* We have to enable the I2S port early so the UDA1380 can flush +* it's register cache. The UDA1380 can only write it's interpolator and +* decimator registers when the link is running. +*/ +static int magician_capture_prepare (struct snd_pcm_substream *substream) +{ +SACR0 |=SACR0_ENB ; +return 0 ; +} + +static struct snd_soc_ops magician_capture_ops = { + .startup = magician_startup, + .hw_params = magician_capture_hw_params, + .prepare = magician_capture_prepare, +}; + +static struct snd_soc_ops magician_playback_ops = { + .startup = magician_startup, + .hw_params = magician_playback_hw_params, + .prepare = magician_playback_prepare, + .hw_free = magician_playback_hw_free, +}; + +static int magician_get_jack (struct snd_kcontrol * kcontrol, +struct snd_ctl_elem_value * ucontrol) +{ + ucontrol->value.integer.value[0 ] = magician_hp_func; +return 0 ; +} + +static int magician_set_hp (struct snd_kcontrol * kcontrol, +struct snd_ctl_elem_value * ucontrol) +{ +struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol); + +if (magician_hp_func == ucontrol->value.integer.value[0 ]) +return 0 ; + + magician_hp_func = ucontrol->value.integer.value[0 ]; +magician_ext_control (codec); +return 1 ; +} + +static int magician_get_spk (struct snd_kcontrol * kcontrol, +struct snd_ctl_elem_value * ucontrol) +{ + ucontrol->value.integer.value[0 ] = magician_spk_func; +return 0 ; +} + +static int magician_set_spk (struct snd_kcontrol * kcontrol, +struct snd_ctl_elem_value * ucontrol) +{ +struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol); + +if (magician_spk_func == ucontrol->value.integer.value[0 ]) +return 0 ; + + magician_spk_func = ucontrol->value.integer.value[0 ]; +magician_ext_control (codec); +return 1 ; +} + +static int magician_get_input (struct snd_kcontrol * kcontrol, +struct snd_ctl_elem_value * ucontrol) +{ + ucontrol->value.integer.value[0 ] = magician_in_sel; +return 0 ; +} + +static int magician_set_input (struct snd_kcontrol * kcontrol, +struct snd_ctl_elem_value * ucontrol) +{ +struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol); + +if (magician_in_sel == ucontrol->value.integer.value[0 ]) +return 0 ; + + magician_in_sel = ucontrol->value.integer.value[0 ]; + +switch (magician_in_sel) { +case MAGICIAN_MIC : +magician_egpio_disable (&magician_cpld, +EGPIO_NR_MAGICIAN_IN_SEL0 ); +magician_egpio_enable (&magician_cpld, +EGPIO_NR_MAGICIAN_IN_SEL1 ); +break ; +case MAGICIAN_MIC_EXT : +magician_egpio_disable (&magician_cpld, +EGPIO_NR_MAGICIAN_IN_SEL0 ); +magician_egpio_disable (&magician_cpld, +EGPIO_NR_MAGICIAN_IN_SEL1 ); + } + +return 1 ; +} + +static int magician_spk_power (struct snd_soc_dapm_widget *w,int event) +{ +if (SND_SOC_DAPM_EVENT_ON (event)) +magician_egpio_enable (&magician_cpld, +EGPIO_NR_MAGICIAN_SPK_POWER ); +else +magician_egpio_disable (&magician_cpld, +EGPIO_NR_MAGICIAN_SPK_POWER ); +return 0 ; +} + +static int magician_hp_power (struct snd_soc_dapm_widget *w,int event) +{ +if (SND_SOC_DAPM_EVENT_ON (event)) +magician_egpio_enable (&magician_cpld, +EGPIO_NR_MAGICIAN_EP_POWER ); +else +magician_egpio_disable (&magician_cpld, +EGPIO_NR_MAGICIAN_EP_POWER ); +return 0 ; +} + +static int magician_mic_bias (struct snd_soc_dapm_widget *w,int event) +{ +// if (SND_SOC_DAPM_EVENT_ON(event)) +// magician_egpio_enable(&magician_cpld, +// EGPIO_NR_MAGICIAN_MIC_POWER); +// else +// magician_egpio_disable(&magician_cpld, +// EGPIO_NR_MAGICIAN_MIC_POWER); +return 0 ; +} + +/* magician machine dapm widgets */ +static const struct snd_soc_dapm_widget uda1380_dapm_widgets[] = { +SND_SOC_DAPM_HP ("Headphone Jack" , magician_hp_power), +SND_SOC_DAPM_SPK ("Speaker" , magician_spk_power), +SND_SOC_DAPM_MIC ("Call Mic" , magician_mic_bias), +SND_SOC_DAPM_MIC ("Headset Mic" , magician_mic_bias), +}; + +/* magician machine audio_map */ +static const char *audio_map[][3 ] = { + +/* Headphone connected to VOUTL, VOUTR */ + {"Headphone Jack" ,NULL ,"VOUTL" }, + {"Headphone Jack" ,NULL ,"VOUTR" }, + +/* Speaker connected to VOUTL, VOUTR */ + {"Speaker" ,NULL ,"VOUTL" }, + {"Speaker" ,NULL ,"VOUTR" }, + +/* Mics are connected to VINM */ + {"VINM" ,NULL ,"Headset Mic" }, + {"VINM" ,NULL ,"Call Mic" }, + + {NULL ,NULL ,NULL }, +}; + +static const char *hp_function[] = {"On" ,"Off" }; +static const char *spk_function[] = {"On" ,"Off" }; +static const char *input_select[] = {"Call Mic" ,"Headset Mic" }; +static const struct soc_enum magician_enum[] = { +SOC_ENUM_SINGLE_EXT (4 , hp_function), +SOC_ENUM_SINGLE_EXT (2 , spk_function), +SOC_ENUM_SINGLE_EXT (2 , input_select), +}; + +static const struct snd_kcontrol_new uda1380_magician_controls[] = { +SOC_ENUM_EXT ("Headphone Switch" , magician_enum[0 ], magician_get_jack, + magician_set_hp), +SOC_ENUM_EXT ("Speaker Switch" , magician_enum[1 ], magician_get_spk, + magician_set_spk), +SOC_ENUM_EXT ("Input Select" , magician_enum[2 ], magician_get_input, + magician_set_input), +}; + +/* +* Logic for a uda1380 as connected on a HTC Magician +*/ +static int magician_uda1380_init (struct snd_soc_codec *codec) +{ +int i, err; + +/* NC codec pins */ +snd_soc_dapm_set_endpoint (codec,"VOUTLHP" ,0 ); +snd_soc_dapm_set_endpoint (codec,"VOUTRHP" ,0 ); + +/* FIXME: is anything connected here? */ +snd_soc_dapm_set_endpoint (codec,"VINL" ,0 ); +snd_soc_dapm_set_endpoint (codec,"VINR" ,0 ); + +/* Add magician specific controls */ +for (i =0 ; i <ARRAY_SIZE (uda1380_magician_controls); i++) { +if ((err =snd_ctl_add (codec->card, +snd_soc_cnew (&uda1380_magician_controls[i], + codec,NULL ))) <0 ) +return err; + } + +/* Add magician specific widgets */ +for (i =0 ; i <ARRAY_SIZE (uda1380_dapm_widgets); i++) { +snd_soc_dapm_new_control (codec, &uda1380_dapm_widgets[i]); + } + +/* Set up magician specific audio path interconnects */ +for (i =0 ; audio_map[i][0 ] !=NULL ; i++) { +snd_soc_dapm_connect_input (codec, audio_map[i][0 ], + audio_map[i][1 ], audio_map[i][2 ]); + } + +snd_soc_dapm_sync_endpoints (codec); +return 0 ; +} + +/* magician digital audio interface glue - connects codec <--> CPU */ +static struct snd_soc_dai_link magician_dai[] = { +{ + .name ="uda1380" , + .stream_name ="UDA1380 Playback" , + .cpu_dai = &pxa_ssp_dai[0 ], + .codec_dai = &uda1380_dai[UDA1380_DAI_PLAYBACK ], + .init = magician_uda1380_init, + .ops = &magician_playback_ops, +}, +{ + .name ="uda1380" , + .stream_name ="UDA1380 Capture" , + .cpu_dai = &pxa_i2s_dai, + .codec_dai = &uda1380_dai[UDA1380_DAI_CAPTURE ], + .ops = &magician_capture_ops, +} +}; + +/* magician audio machine driver */ +static struct snd_soc_machine snd_soc_machine_magician = { + .name ="Magician" , + .dai_link = magician_dai, + .num_links =ARRAY_SIZE (magician_dai), +}; + +/* magician audio private data */ +static struct uda1380_setup_data magician_uda1380_setup = { + .i2c_address =0x18 , + .dac_clk =UDA1380_DAC_CLK_WSPLL , +}; + +/* magician audio subsystem */ +static struct snd_soc_device magician_snd_devdata = { + .machine = &snd_soc_machine_magician, + .platform = &pxa2xx_soc_platform, + .codec_dev = &soc_codec_dev_uda1380, + .codec_data = &magician_uda1380_setup, +}; + +static struct platform_device *magician_snd_device; + +static int __init magician_init (void ) +{ +int ret; + +if (!machine_is_magician ()) +return -ENODEV ; + +magician_egpio_enable (&magician_cpld,EGPIO_NR_MAGICIAN_CODEC_POWER ); + +/* we may need to have the clock running here - pH5 */ +magician_egpio_enable (&magician_cpld,EGPIO_NR_MAGICIAN_CODEC_RESET ); +udelay (5 ); +magician_egpio_disable (&magician_cpld,EGPIO_NR_MAGICIAN_CODEC_RESET ); + +/* correct place? we'll need it to talk to the uda1380 */ +request_module ("i2c-pxa" ); + + magician_snd_device =platform_device_alloc ("soc-audio" ,-1 ); +if (!magician_snd_device) +return -ENOMEM ; + +platform_set_drvdata (magician_snd_device, &magician_snd_devdata); + magician_snd_devdata.dev = &magician_snd_device->dev; + ret =platform_device_add (magician_snd_device); + +if (ret) +platform_device_put (magician_snd_device); + +pxa_gpio_mode (GPIO23_SSPSCLK_MD ); +pxa_gpio_mode (GPIO24_SSPSFRM_MD ); +pxa_gpio_mode (GPIO25_SSPTXD_MD ); + +return ret; +} + +static void __exit magician_exit(void) +{ +platform_device_unregister (magician_snd_device); + +magician_egpio_disable (&magician_cpld,EGPIO_NR_MAGICIAN_SPK_POWER ); +magician_egpio_disable (&magician_cpld,EGPIO_NR_MAGICIAN_EP_POWER ); +magician_egpio_disable (&magician_cpld,EGPIO_NR_MAGICIAN_MIC_POWER ); +magician_egpio_disable (&magician_cpld,EGPIO_NR_MAGICIAN_CODEC_POWER ); +} + +module_init (magician_init); +module_exit (magician_exit); + +MODULE_AUTHOR ("Philipp Zabel" ); +MODULE_DESCRIPTION ("ALSA SoC Magician" ); +MODULE_LICENSE ("GPL" );Signature · 6 lines
1.5.3.5 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH] Add ASoC Magician machine support.
Quoted 6 lines · Takashi Iwai
Hmm... Some patches seem to have inconsistent From: and the author attribute. For exmaple, this module has
MODULE_AUTHOR("Philipp Zabel");while Liam is in From header here (and it's a broken address :)
Yes, there's quite a few things look a bit bogus here. I've gone through and reviewed things - hopefully the meta information should be more joined up for the next submission.
Re: [PATCH] Add ASoC Magician machine support.
Quoted 5 lines · Mark Brown
Quoted 2 lines · Takashi Iwai
Hmm... Some patches seem to have inconsistent From: and the author attribute. For exmaple, this module has
Quoted 7 lines
Quoted 3 lines
MODULE_AUTHOR("Philipp Zabel");while Liam is in From header here (and it's a broken address :)
Yes, there's quite a few things look a bit bogus here. I've gone through and reviewed things - hopefully the meta information should be more joined up for the next submission.
I'm only just about to push basic HTC Magician machine support to LAK, so I'm not sure if this driver should still be held back a bit. I only sent it to Liam
directly by mail (actually I created it with his help in a sort of email ping-pong),
so that's how his address ended up in the From: header.
regards
Philipp
Re: [PATCH] Add ASoC Magician machine support.
Quoted 2 lines · pHilipp Zabel
I'm only just about to push basic HTC Magician machine support to LAK, so I'm not sure if this driver should still be held back a bit. I only
I've no strong feeling either way so if you're unsure if it should go I'll drop it from the patch series for now. Could you take care of submitting the ASoC changes when everything else is ready, please?
Re: [PATCH] Add ASoC Magician machine support.
Quoted 8 lines · Mark Brown
Quoted 2 lines · pHilipp Zabel
I'm only just about to push basic HTC Magician machine support to LAK, so I'm not sure if this driver should still be held back a bit. I only
I've no strong feeling either way so if you're unsure if it should go I'll drop it from the patch series for now. Could you take care of submitting the ASoC changes when everything else is ready, please?
I will. That will also give me the opportunity make the driver use clock and GPIO API before submitting.
regards
Philipp
Re: [PATCH] Add Amesom ASoC machine support.
In reply to Mark BrownAt Tue, 20 Nov 2007 09:25:42 +0000,
Quoted 3 lines · Mark Brown
sound/soc/pxa/amesom_tlv320.c new file +0
-0
(snip)
Quoted 1 line
+static struct
snd_soc_machineamesom;
Looks superfluous.
sound/soc/pxa/amesom_tlv320.c line 86
Quoted 12 lines
sound/soc/pxa/amesom_tlv320.c new file +12
-0+/* +* Tlv320 uses SSP port for playback. +*/ +static int tlv320_voice_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_codec_dai *codec_dai = rtd->dai->codec_dai; +struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai; +int ret =0 ; + +//printk("tlv320_voice_hw_params enter\n");
Avoid C++ style comments.
sound/soc/pxa/amesom_tlv320.c line 87
Quoted 1 line
sound/soc/pxa/amesom_tlv320.c new file +1
-0+switch (params_rate (params)) {
Add space between switch and the parenthesis.
Takashi
Re: [PATCH] Add Amesom ASoC machine support.
In reply to Mark BrownMark,
I suggest to do the same naming changes in the machine part like I 've suggested for tlv32024K codec driver: rename all tlv320 places to tlv320aic2x and "aic2x_"
Also I suggest to name all static functions in the machine ASoC part to begin from ameson_ and not the codec one.
Regards,
Vladimir
Quoted 263 lines · Mark Brown
From: Liam Girdwood <[email protected]>
Signed-off-by Nicola Perrino <[email protected]>Signed-off-by Liam Girdwood <[email protected]>--- sound/soc/pxa/Kconfig | 10 ++ sound/soc/pxa/Makefile | 3 +- sound/soc/pxa/amesom_tlv320.c | 211 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 223 insertions(+), 1 deletions(-) create mode 100644 sound/soc/pxa/amesom_tlv320.csound/soc/pxa/Kconfig +10
-0@@ -57,3 +57,13 @@ config SND_PXA2XX_SOC_TOSA help Say Y if you want to add support for SoC audio on Sharp Zaurus SL-C6000x models (Tosa). + +config SND_PXA2XX_SOC_AMESOM_TLV320 + tristate "SoC SSP Audio support for AMESOM - TLV320AIC24k" + depends on SND_PXA2XX_SOC && MACH_AMESOM + select SND_PXA2XX_SOC_I2S + select SND_PXA2XX_SOC_SSP + select SND_SOC_TLV320 + help + Say Y if you want to add support for SoC audio on Amesom + with the tlv320.sound/soc/pxa/Makefile +2
-1@@ -14,9 +14,10 @@ snd-soc-corgi-objs := corgi.o snd-soc-poodle-objs := poodle.o snd-soc-tosa-objs := tosa.o snd-soc-spitz-objs := spitz.o +snd-soc-amesom-tlv320-objs := amesom_tlv320.o obj-$(CONFIG_SND_PXA2XX_SOC_CORGI) += snd-soc-corgi.o obj-$(CONFIG_SND_PXA2XX_SOC_POODLE) += snd-soc-poodle.o obj-$(CONFIG_SND_PXA2XX_SOC_TOSA) += snd-soc-tosa.o obj-$(CONFIG_SND_PXA2XX_SOC_SPITZ) += snd-soc-spitz.o - +obj-$(CONFIG_SND_PXA2XX_SOC_AMESOM_TLV320) += snd-soc-amesom-tlv320.osound/soc/pxa/amesom_tlv320.c new file +211
-0@@ -0,0 +1,211 @@ +/* +* amesom_tlv320.c -- SoC audio for Amesom +* +* Copyright 2005 Wolfson Microelectronics PLC. +* Copyright 2006 Atlab srl. +* +* Authors: Liam Girdwood <[email protected]> +* Nicola Perrino <[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. +* +* Revision history +* 5th Dec 2006 Initial version. +* +*/ + +#include <linux/module.h> +#include <linux/moduleparam.h> +#include <linux/device.h> +#include <linux/i2c.h> +#include <sound/driver.h> +#include <sound/core.h> +#include <sound/pcm.h> +#include <sound/soc.h> +#include <sound/soc-dapm.h> + +#include <asm/hardware.h> +#include <asm/arch/pxa-regs.h> +#include <asm/arch/audio.h> + +#include "../codecs/tlv320.h" +#include "pxa2xx-pcm.h" +#include "pxa2xx-i2s.h" +#include "pxa2xx-ssp.h" + + +/* +* SSP2 GPIO's +*/ + +#define GPIO11_SSP2RX_MD (11 | GPIO_ALT_FN_2_IN) +#define GPIO13_SSP2TX_MD (13 | GPIO_ALT_FN_1_OUT) +#define GPIO50_SSP2CLKS_MD (50 | GPIO_ALT_FN_3_IN) +#define GPIO14_SSP2FRMS_MD (14 | GPIO_ALT_FN_2_IN) +#define GPIO50_SSP2CLKM_MD (50 | GPIO_ALT_FN_3_OUT) +#define GPIO14_SSP2FRMM_MD (14 | GPIO_ALT_FN_2_OUT) + + +static struct snd_soc_machine amesom; + + +static int amesom_probe (struct platform_device *pdev) +{ +return 0 ; +} + +static int amesom_remove (struct platform_device *pdev) +{ +return 0 ; +} + +static int tlv320_voice_startup (struct snd_pcm_substream *substream) +{ +return 0 ; +} + +static void tlv320_voice_shutdown (struct snd_pcm_substream *substream) +{ +return ; +} + +/* +* Tlv320 uses SSP port for playback. +*/ +static int tlv320_voice_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_codec_dai *codec_dai = rtd->dai->codec_dai; +struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai; +int ret =0 ; + +//printk("tlv320_voice_hw_params enter\n"); +switch (params_rate (params)) { +case 8000 : +//printk("tlv320_voice_hw_params 8000\n"); +break ; +case 16000 : +//printk("tlv320_voice_hw_params 16000\n"); +break ; +default : +break ; + } + +// CODEC MASTER, SSP SLAVE + +/* set codec DAI configuration */ + ret = codec_dai->dai_ops.set_fmt (codec_dai,SND_SOC_DAIFMT_MSB | +SND_SOC_DAIFMT_NB_NF |SND_SOC_DAIFMT_CBM_CFM ); +if (ret <0 ) +return ret; + +/* set cpu DAI configuration */ + ret = cpu_dai->dai_ops.set_fmt (cpu_dai,SND_SOC_DAIFMT_MSB | +SND_SOC_DAIFMT_NB_NF |SND_SOC_DAIFMT_CBM_CFM ); +if (ret <0 ) +return ret; + +/* set the SSP system clock as input (unused) */ + ret = cpu_dai->dai_ops.set_sysclk (cpu_dai,PXA2XX_SSP_CLK_NET_PLL ,0 , +SND_SOC_CLOCK_IN ); +if (ret <0 ) +return ret; + +/* set SSP slots */ +//ret = cpu_dai->dai_ops.set_tdm_slot(cpu_dai, 0x1, slots); + ret = cpu_dai->dai_ops.set_tdm_slot (cpu_dai,0x3 ,1 ); +if (ret <0 ) +return ret; + +return 0 ; +} + +static int tlv320_voice_hw_free (struct snd_pcm_substream *substream) +{ +return 0 ; +} + +static struct snd_soc_ops tlv320_voice_ops = { + .startup = tlv320_voice_startup, + .shutdown = tlv320_voice_shutdown, + .hw_params = tlv320_voice_hw_params, + .hw_free = tlv320_voice_hw_free, +}; + + +static struct snd_soc_dai_link amesom_dai[] = { +{ + .name ="TLV320" , + .stream_name ="TLV320 Voice" , + .cpu_dai = &pxa_ssp_dai[PXA2XX_DAI_SSP2 ], + .codec_dai = &tlv320_dai[TLV320_DAI_MODE1_VOICE ], + .ops = &tlv320_voice_ops, +}, +}; + +static struct snd_soc_machine amesom = { + .name ="Amesom" , + .probe = amesom_probe, + .remove = amesom_remove, + .dai_link = amesom_dai, + .num_links =ARRAY_SIZE (amesom_dai), +}; + +static struct tlv320_setup_data amesom_tlv320_setup = { +#ifdef TLV320AIC24K //codec2 + .i2c_address =0x41 , +#else // TLV320AIC14k + .i2c_address =0x40 , +#endif +}; + +static struct snd_soc_device amesom_snd_devdata = { + .machine = &amesom, + .platform = &pxa2xx_soc_platform, + .codec_dev = &soc_codec_dev_tlv320, + .codec_data = &amesom_tlv320_setup, +}; + +static struct platform_device *amesom_snd_device; + +static int __init amesom_init (void ) +{ +int ret; + + amesom_snd_device =platform_device_alloc ("soc-audio" ,-1 ); +if (!amesom_snd_device) +return -ENOMEM ; + +platform_set_drvdata (amesom_snd_device, &amesom_snd_devdata); + amesom_snd_devdata.dev = &amesom_snd_device->dev; + ret =platform_device_add (amesom_snd_device); + +if (ret) +platform_device_put (amesom_snd_device); + + +/* SSP port 2 slave */ +pxa_gpio_mode (GPIO11_SSP2RX_MD ); +pxa_gpio_mode (GPIO13_SSP2TX_MD ); +pxa_gpio_mode (GPIO50_SSP2CLKS_MD ); +pxa_gpio_mode (GPIO14_SSP2FRMS_MD ); + +return ret; +} + +static void __exit amesom_exit(void) +{ +platform_device_unregister (amesom_snd_device); +} + +module_init (amesom_init); +module_exit (amesom_exit); + +/* Module information */ +MODULE_AUTHOR ("Nicola Perrino" ); +MODULE_DESCRIPTION ("ALSA SoC TLV320 Amesom" ); +MODULE_LICENSE ("GPL" );
Re: [PATCH] Add Amesom ASoC machine support.
Quoted 6 lines · Vladimir A. Barinov
I suggest to do the same naming changes in the machine part like I 've suggested for tlv32024K codec driver: rename all tlv320 places to tlv320aic2x and "
aic2x_"Also I suggest to name all static functions in the machine ASoC part to begin from
ameson_and not the codec one.
That all seems sensible. Nicola, could you look into this please?
Thanks.
Re: [PATCH] Add ASoC TLV320 Codec driver.
In reply to Mark BrownAt Tue, 20 Nov 2007 09:25:39 +0000,
include/linux/i2c-id.h line 125
Quoted 10 lines · Mark Brown
include/linux/i2c-id.h +1
-0@@ -122,6 +122,7 @@#define I2C_DRIVERID_VP27SMPX 93/* Panasonic VP27s tuner internal MPX */ #define I2C_DRIVERID_CS4270 94/* Cirrus Logic 4270 audio codec */ #define I2C_DRIVERID_AK4535 95/* AK4525 audio codec */ +#define I2C_DRIVERID_TLV320 97/* TLV 320 audio codec */
Where is 96? :-)
Quoted 2 lines
sound/soc/codecs/tlv320.c new file +0
-0
(snip)
Quoted 1 line
+//#define
TLV320_DEBUG0
Avoid C++ style comments. Use C-style /**/ instead.
sound/soc/codecs/tlv320.c line 67
Quoted 3 lines
sound/soc/codecs/tlv320.c new file +3
-0+#define TLV320_VOICE_BITS \ + (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ + SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
Double-check if it's really S24_LE or S24_3LE.
sound/soc/codecs/tlv320.c line 73
Quoted 6 lines
sound/soc/codecs/tlv320.c new file +6
-0+ + +static int caps_charge =2000 ; +static int setting =1 ; +module_param (caps_charge, int,0 ); +module_param (setting, int,0 );
No description for setting variable? Also, this should be bool instead of int.
sound/soc/codecs/tlv320.c line 92
Quoted 6 lines
sound/soc/codecs/tlv320.c new file +6
-0+/* ADDR table */ +static const unsigned char tlv320_reg_addr[] = { +0x00 ,/* CONTROL REG 0 No Operation */ +0x01 ,/* CONTROL REG 1 */ +0x02 ,/* CONTROL REG 2 */ +0x03 ,/* CONTROL REG 3A */
Spaces and tabs are mixed up. Use tabs please.
sound/soc/codecs/tlv320.c line 226
Quoted 5 lines
sound/soc/codecs/tlv320.c new file +5
-0+static inline unsigned int tlv320_read_reg_cache (struct snd_soc_codec *codec, +unsigned int reg) +{ +u8 *cache = codec->reg_cache; +if (reg >ARRAY_SIZE (tlv320_reg_addr))
Shouldn't it be "reg >= ARRAY_SIZE(tlv_320_reg_addr)" ?
sound/soc/codecs/tlv320.c line 239
Quoted 6 lines
sound/soc/codecs/tlv320.c new file +6
-0+static inline void tlv320_write_reg_cache (struct snd_soc_codec *codec, +unsigned int reg,unsigned int value) +{ +u8 *cache = codec->reg_cache; +if (reg >ARRAY_SIZE (tlv320_reg_addr)) +return ;
Ditto.
Quoted 13 lines
sound/soc/codecs/tlv320.c new file +11
-0+static int tlv320_write (struct snd_soc_codec *codec,unsigned int reg, +unsigned int value) +{ +if (tlv320_reg_addr[reg] >0x06 ) +return -1 ; + +tlv320_write_reg_cache (codec, reg, value); + +return i2c_smbus_write_byte_data (codec->control_data, tlv320_reg_addr[reg], value); +/* +* write block tlv320
sound/soc/codecs/tlv320.c line 277
Quoted 10 lines
sound/soc/codecs/tlv320.c new file +10
-0+*/ +static int tlv320_write_block (struct snd_soc_codec *codec, +const u8 *data,unsigned int len) +{ +int ret =-1 ; +int i; + +for (i=0 ; i<len; i++) { +dbg ("addr = 0x%02x, data = 0x%02x" , tlv320_reg_addr[i], data[i]); +if ((ret =tlv320_write (codec, i, data[i])) <0 )
Avoid if ((xxx = yyy()) < 0) style. This isn't recommended any more. Split to two lines,
xxx = yyy(); if (xxx < 0) ...
Quoted 2 lines
sound/soc/codecs/tlv320.c new file +2
-0+static int tlv320_init (struct snd_soc_device *socdev) +{
...
sound/soc/codecs/tlv320.c line 377
Quoted 2 lines
sound/soc/codecs/tlv320.c new file +2
-0+/* register pcms */ + ret =snd_soc_new_pcms (socdev,SNDRV_DEFAULT_IDX1 ,SNDRV_DEFAULT_STR1 );
SNDRV_DEFAULT_IDX1 and SNDRV_DEFAULT_STR1 are for card index and name string, not for PCM instance. Pass 0 and any suitable string here.
sound/soc/codecs/tlv320.c line 384
Quoted 2 lines
sound/soc/codecs/tlv320.c new file +2
-0+queue_delayed_work (tlv320_workq, + &codec->delayed_work,msecs_to_jiffies (caps_charge));
Remove this unless you really implement the workq stuff. (Ditto for workq creation.) Creation of a workq isn't no cost even if it's not used.
Also, there are some other coding style issues.
Try checkpatch.pl to find out them.
Furthermore, if this driver supports only I2C right now, it'd be better to add kconfig dependency to CONFIG_I2C.
Takashi
Re: [PATCH] Add ASoC TLV320 Codec driver.
Quoted 5 lines · Takashi Iwai
Quoted 1 line · Mark Brown
+#define
I2C_DRIVERID_TLV32097 /* TLV 320 audio codec */Where is 96? :-)
Sorry, I had another codec queued for addition which I dropped from the series. I'll fix this when I resubmit.
Quoted 5 lines
sound/soc/codecs/tlv320.c line 67
Quoted 3 lines
sound/soc/codecs/tlv320.c new file +3
-0+#define TLV320_VOICE_BITS \ + (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ + SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)Double-check if it's really
S24_LEorS24_3LE.
Nicola, could you please look into this and also the other issues that Takashi raised?
Re: [PATCH] Add ASoC TLV320 Codec driver.
In reply to Takashi IwaiHi Takashi, Mark,
Quoted 14 lines · Takashi Iwai
At Tue, 20 Nov 2007 09:25:39 +0000,
include/linux/i2c-id.h line 125
Quoted 10 lines · Mark Brown
include/linux/i2c-id.h +1
-0@@ -122,6 +122,7 @@#define I2C_DRIVERID_VP27SMPX 93/* Panasonic VP27s tuner internal MPX */ #define I2C_DRIVERID_CS4270 94/* Cirrus Logic 4270 audio codec */ #define I2C_DRIVERID_AK4535 95/* AK4525 audio codec */ +#define I2C_DRIVERID_TLV320 97/* TLV 320 audio codec */ Where is 96? :-)
You don't seem to use these driver IDs anywhere? These IDs are optional, so if you have no need for them, it's much easier to just not define them.
Note that the i2c_driver.id field is planed for removal anyway.
Signature · 1 line
Jean Delvare
Re: [PATCH] Add ASoC TLV320 Codec driver.
At Tue, 20 Nov 2007 22:34:42 +0100,
Quoted 19 lines · Jean Delvare
Hi Takashi, Mark,
Quoted 14 lines · Takashi Iwai
At Tue, 20 Nov 2007 09:25:39 +0000,
include/linux/i2c-id.h line 125
Quoted 10 lines · Mark Brown
include/linux/i2c-id.h +1
-0@@ -122,6 +122,7 @@#define I2C_DRIVERID_VP27SMPX 93/* Panasonic VP27s tuner internal MPX */ #define I2C_DRIVERID_CS4270 94/* Cirrus Logic 4270 audio codec */ #define I2C_DRIVERID_AK4535 95/* AK4525 audio codec */ +#define I2C_DRIVERID_TLV320 97/* TLV 320 audio codec */ Where is 96? :-)
Quoted 5 lines
You don't seem to use these driver IDs anywhere? These IDs are optional, so if you have no need for them, it's much easier to just not define them.
Note that the i2c_driver.id field is planed for removal anyway.
Thanks, that's good to know.
Mark, could you get rid of them in your next patch series?
Takashi
Re: [PATCH] Add ASoC TLV320 Codec driver.
Quoted 8 lines · Takashi Iwai
Quoted 3 lines · Jean Delvare
You don't seem to use these driver IDs anywhere? These IDs are optional, so if you have no need for them, it's much easier to just not define them.
Thanks, that's good to know.
Mark, could you get rid of them in your next patch series?
Yes, I will do so.
Re: [PATCH] Add ASoC TLV320 Codec driver.
In reply to Mark BrownHi Mark,
The TLV320 name doesn't define the specific device, it just names the TI brand and voltage params. There is a certain gradation of TLV320 codecs and they are quite different inside. They are:
1) TLV320AIC2X family that currently includes aic20, aic20K, aic21, aic24, aic24K, aic25 audio chips
2) TLV320AIC3X family that currently includes aic31, aic3106, aic32, aic33 and possible other audio chips
3) for aic2x there are some chips that has diferent internal structure and couldn't be put in 1) family:
{aic22} - quite a different by internal structure
{aic23} - quite a different by internal structure
{aic26} - quite a different by internal structure{aic28, aic29} - these are also similar by register set
So you shouldn't name the tlv320aic24K codec driver as "tlv320". You should create one named like tlv320aic2x and in the driver name callback starting with "aic2x_".
Regards,
Vladimir
Quoted 788 lines · Mark Brown
From: Liam Girdwood <[email protected]>
Signed-off-by Nicola Perrino <[email protected]>Signed-off-by Liam Girdwood <[email protected]>--- include/linux/i2c-id.h | 1 + sound/soc/codecs/Kconfig | 4 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/tlv320.c | 603 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/tlv320.h | 111 +++++++++ 5 files changed, 721 insertions(+), 0 deletions(-) create mode 100644 sound/soc/codecs/tlv320.c create mode 100644 sound/soc/codecs/tlv320.hinclude/linux/i2c-id.h +1
-0@@ -122,6 +122,7 @@#define I2C_DRIVERID_VP27SMPX 93/* Panasonic VP27s tuner internal MPX */ #define I2C_DRIVERID_CS4270 94/* Cirrus Logic 4270 audio codec */ #define I2C_DRIVERID_AK4535 95/* AK4525 audio codec */ +#define I2C_DRIVERID_TLV320 97/* TLV 320 audio codec */ #define I2C_DRIVERID_I2CDEV 900#define I2C_DRIVERID_ARP 902/* SMBus ARP Client */ sound/soc/codecs/Kconfig +4
-0@@ -6,6 +6,10 @@ config SND_SOC_AK4535 tristate depends on SND_SOC +config SND_SOC_TLV320 + tristate + depends on SND_SOC + config SND_SOC_WM8731 tristate depends on SND_SOCsound/soc/codecs/Makefile +2
-0@@ -1,5 +1,6 @@ snd-soc-ac97-objs := ac97.o snd-soc-ak4535-objs := ak4535.o +snd-soc-tlv320-objs := tlv320.o snd-soc-wm8731-objs := wm8731.o snd-soc-wm8750-objs := wm8750.o snd-soc-wm8753-objs := wm8753.o@@ -9,6 +10,7 @@ snd-soc-cs4270-objs := cs4270.o obj-$(CONFIG_SND_SOC_AC97_CODEC) += snd-soc-ac97.o obj-$(CONFIG_SND_SOC_AK4535) += snd-soc-ak4535.o +obj-$(CONFIG_SND_SOC_TLV320) += snd-soc-tlv320.o obj-$(CONFIG_SND_SOC_WM8731) += snd-soc-wm8731.o obj-$(CONFIG_SND_SOC_WM8750) += snd-soc-wm8750.o obj-$(CONFIG_SND_SOC_WM8753) += snd-soc-wm8753.osound/soc/codecs/tlv320.c new file +603
-0@@ -0,0 +1,603 @@ +/* +* tlv320.c -- TLV 320 ALSA Soc Audio driver +* +* Copyright 2005 Wolfson Microelectronics PLC. +* Copyright 2006 Atlab srl. +* +* Authors: Liam Girdwood <[email protected]> +* Nicola Perrino <[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. +* +*/ + +#include <linux/module.h> +#include <linux/moduleparam.h> +#include <linux/version.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/delay.h> +#include <linux/pm.h> +#include <linux/i2c.h> +#include <linux/platform_device.h> +#include <sound/driver.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/initval.h> + +#include "tlv320.h" + +#define AUDIO_NAME "tlv320" +#define TLV320_VERSION "0.1" + +/* +* Debug +*/ + +//#define TLV320_DEBUG 0 + +#ifdef TLV320_DEBUG +#define dbg(format, arg...) \ + printk(KERN_DEBUG AUDIO_NAME ": " format "\n" , ## arg) +#else +#define dbg(format, arg...) do {} while (0) +#endif +#define err(format, arg...) \ + printk(KERN_ERR AUDIO_NAME ": " format "\n" , ## arg) +#define info(format, arg...) \ + printk(KERN_INFO AUDIO_NAME ": " format "\n" , ## arg) +#define warn(format, arg...) \ + printk(KERN_WARNING AUDIO_NAME ": " format "\n" , ## arg) + + +#define TLV320_VOICE_RATES \ + (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \ + SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ + SNDRV_PCM_RATE_48000) + + +#define TLV320_VOICE_BITS \ + (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ + SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) + + +static int caps_charge =2000 ; +static int setting =1 ; +module_param (caps_charge, int,0 ); +module_param (setting, int,0 ); +MODULE_PARM_DESC (caps_charge,"TLV320 cap charge time (msecs)" ); + +static struct workqueue_struct *tlv320_workq =NULL ; +//static struct work_struct tlv320_dapm_work; + +/* codec private data */ +struct tlv320_priv { +unsigned int sysclk; +unsigned int pcmclk; +}; + + +#ifdef TLV320AIC24K +/* ADDR table */ +static const unsigned char tlv320_reg_addr[] = { +0x00 ,/* CONTROL REG 0 No Operation */ +0x01 ,/* CONTROL REG 1 */ +0x02 ,/* CONTROL REG 2 */ +0x03 ,/* CONTROL REG 3A */ +0x03 ,/* CONTROL REG 3B */ +0x03 ,/* CONTROL REG 3C */ +0x03 ,/* CONTROL REG 3D */ +0x04 ,/* CONTROL REG 4 */ +0x04 ,/* CONTROL REG 4 Bis */ +0x05 ,/* CONTROL REG 5A */ +0x05 ,/* CONTROL REG 5B */ +0x05 ,/* CONTROL REG 5C */ +0x05 ,/* CONTROL REG 5D */ +0x06 ,/* CONTROL REG 6A */ +0x06 ,/* CONTROL REG 6B */ +}; + +/* +* DATA case digital SET1: +* SSP -> DAC -> OUT +* IN -> ADC -> SSP +* IN = HNSI (MIC) +* OUT = HDSO (SPKG) +* Usage: playback, capture streams +*/ +static const unsigned char tlv320_reg_data_init_set1[] = { +0x00 ,/* CONTROL REG 0 No Operation */ +0x49 ,/* CONTROL REG 1 */ +0x20 ,/* CONTROL REG 2 */ +0x01 ,/* CONTROL REG 3A */ +0x40 ,/* CONTROL REG 3B */ +0x81 ,/* CONTROL REG 3C */ +0xc0 ,/* CONTROL REG 3D */ +0x02 ,//0x42(16khz),//0x10, /* CONTROL REG 4 */ +0x88 ,//0x90, /* CONTROL REG 4 Bis */ +0x00 ,/* CONTROL REG 5A */ +0x40 ,//(0dB) /* CONTROL REG 5B */ +0xbf ,/* CONTROL REG 5C */ +0xc0 ,/* CONTROL REG 5D */ +0x02 ,//(HNSI) /* CONTROL REG 6A */ +0x81 //(HDSO) /* CONTROL REG 6B */ +}; + +/* +* DATA case digital SET2: +* SSP -> DAC -> OUT +* IN -> ADC -> SSP +* IN = HDSI (PHONE IN) +* OUT = HNSO (PHONE OUT) +* Usage: playback, capture streams +*/ +static const unsigned char tlv320_reg_data_init_set2[] = { +0x00 ,/* CONTROL REG 0 No Operation */ +0x49 ,/* CONTROL REG 1 */ +0x20 ,/* CONTROL REG 2 */ +0x01 ,/* CONTROL REG 3A */ +0x40 ,/* CONTROL REG 3B */ +0x81 ,/* CONTROL REG 3C */ +0xc0 ,/* CONTROL REG 3D */ +0x02 ,//0x42(16khz),//0x10, /* CONTROL REG 4 */ +0x88 ,//0x90, /* CONTROL REG 4 Bis */ +0x00 ,/* CONTROL REG 5A */ +0x52 ,//(-27dB) /* CONTROL REG 5B */ +0xbf ,/* CONTROL REG 5C */ +0xc0 ,/* CONTROL REG 5D */ +0x01 ,//(PHONE IN) /* CONTROL REG 6A */ +0x82 //(PHONE OUT) /* CONTROL REG 6B */ +}; + +/* +* DATA case analog: +* ADC, DAC, SSP off +* Headset input to output (HDSI2O -> 1) +* Handset input to output (HNSI2O -> 1) +* Usage: room monitor +*/ +static const unsigned char tlv320_reg_data_init_set3[] = { +0x00 ,/* CONTROL REG 0 No Operation */ +0x08 ,/* CONTROL REG 1 */ +0x20 ,/* CONTROL REG 2 */ +0x11 ,/* CONTROL REG 3A */ +0x40 ,/* CONTROL REG 3B */ +0x80 ,/* CONTROL REG 3C */ +0xc0 ,/* CONTROL REG 3D */ +0x00 ,/* CONTROL REG 4 */ +0x00 ,/* CONTROL REG 5A */ +0x40 ,/* CONTROL REG 5B */ +0x80 ,/* CONTROL REG 5C */ +0xc0 ,/* CONTROL REG 5D */ +0x60 ,/* CONTROL REG 6A */ +0x80 /* CONTROL REG 6B */ +}; + +#else // TLV320AIC14k + +/* ADDR table */ +static const unsigned char tlv320_reg_addr[] = { +0x00 ,/* CONTROL REG 0 No Operation */ +0x01 ,/* CONTROL REG 1 */ +0x02 ,/* CONTROL REG 2 */ +0x03 ,/* CONTROL REG 3 */ +0x04 ,/* CONTROL REG 4 */ +0x04 ,/* CONTROL REG 4 Bis */ +0x05 ,/* CONTROL REG 5A */ +0x05 ,/* CONTROL REG 5B */ +0x05 ,/* CONTROL REG 5C */ +0x05 ,/* CONTROL REG 5D */ +0x06 /* CONTROL REG 6 */ +}; + +/* +* DATA case digital: +* SSP -> DAC -> OUT +* IN -> ADC -> SSP +* Usage: playback, capture streams +*/ +static const unsigned char tlv320_reg_data_init_set1[] = { +0x00 ,/* CONTROL REG 0 No Operation */ +0x41 ,/* CONTROL REG 1 */ +0x20 ,/* CONTROL REG 2 */ +0x09 ,/* CONTROL REG 3 */ +0x02 ,//0x42(16khz),//0x10, /* CONTROL REG 4 */ +0x88 ,//0x90, /* CONTROL REG 4 Bis */ +0x2A ,/* CONTROL REG 5A */ +0x6A ,/* CONTROL REG 5B */ +0xbc ,/* CONTROL REG 5C */ +0xc0 ,/* CONTROL REG 5D */ +0x00 /* CONTROL REG 6 */ +}; +#endif +/* +* read tlv320 register cache +*/ +static inline unsigned int tlv320_read_reg_cache (struct snd_soc_codec *codec, +unsigned int reg) +{ +u8 *cache = codec->reg_cache; +if (reg >ARRAY_SIZE (tlv320_reg_addr)) +return -1 ; +return cache[reg]; +} + +/* +* write tlv320 register cache +*/ +static inline void tlv320_write_reg_cache (struct snd_soc_codec *codec, +unsigned int reg,unsigned int value) +{ +u8 *cache = codec->reg_cache; +if (reg >ARRAY_SIZE (tlv320_reg_addr)) +return ; + cache[reg] = value; +} + +/* +* read tlv320 +*/ +static int tlv320_read (struct snd_soc_codec *codec,u8 reg) +{ +return i2c_smbus_read_byte_data (codec->control_data, reg); +} + +/* +* write tlv320 +*/ +static int tlv320_write (struct snd_soc_codec *codec,unsigned int reg, +unsigned int value) +{ +if (tlv320_reg_addr[reg] >0x06 ) +return -1 ; + +tlv320_write_reg_cache (codec, reg, value); + +return i2c_smbus_write_byte_data (codec->control_data, tlv320_reg_addr[reg], value); +} + + +/* +* write block tlv320 +*/ +static int tlv320_write_block (struct snd_soc_codec *codec, +const u8 *data,unsigned int len) +{ +int ret =-1 ; +int i; + +for (i=0 ; i<len; i++) { +dbg ("addr = 0x%02x, data = 0x%02x" , tlv320_reg_addr[i], data[i]); +if ((ret =tlv320_write (codec, i, data[i])) <0 ) +break ; + } + +return ret; +} + + +static int tlv320_set_dai_fmt (struct snd_soc_codec_dai *codec_dai, +unsigned int fmt) +{ +dbg ("tlv320_set_dai_fmt enter" ); +return 0 ; +} + +/* +* Set PCM DAI bit size and sample rate. +*/ +static int tlv320_pcm_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{ +dbg ("tlv320_pcm_hw_params enter" ); +return 0 ; +} + + +static int tlv320_config_pcm_sysclk (struct snd_soc_codec_dai *codec_dai, +int clk_id,unsigned int freq,int dir) +{ +dbg ("tlv320_config_pcm_sysclk enter" ); +return 0 ; +} + + +/* +* Voice over PCM DAI +*/ +struct snd_soc_codec_dai tlv320_dai[] = { +{ .name ="TLV320 Voice" , + .id =1 , + .playback = { + .stream_name ="Voice Playback" , + .channels_min =1 , + .channels_max =2 , + .rates =TLV320_VOICE_RATES , + .formats =TLV320_VOICE_BITS ,}, + .capture = { + .stream_name ="Voice Capture" , + .channels_min =1 , + .channels_max =2 , + .rates =TLV320_VOICE_RATES , + .formats =TLV320_VOICE_BITS ,}, + .ops = { + .hw_params = tlv320_pcm_hw_params,}, + .dai_ops = { + .digital_mute =NULL , + .set_fmt = tlv320_set_dai_fmt, + .set_clkdiv =NULL , + .set_pll =NULL , + .set_sysclk = tlv320_config_pcm_sysclk, + }, +}, + + +}; +EXPORT_SYMBOL_GPL (tlv320_dai); + + +static void tlv320_work (struct work_struct *work) +{ +#if 0 +struct snd_soc_codec *codec = + container_of(work, struct snd_soc_codec, delayed_work.work); +//wm8753_dapm_event(codec, codec->dapm_state); +#endif +} + +/* +* initialise the TLV320 driver +* register the mixer and dsp interfaces with the kernel +*/ +static int tlv320_init (struct snd_soc_device *socdev) +{ +struct snd_soc_codec *codec = socdev->codec; +int ret =0 ; + + codec->name ="TLV320" ; + codec->owner =THIS_MODULE ; + codec->read = tlv320_read_reg_cache; + codec->write = tlv320_write; + codec->dai = tlv320_dai; + codec->num_dai =ARRAY_SIZE (tlv320_dai); + codec->reg_cache_size =sizeof (tlv320_reg_addr); + + codec->reg_cache = +kmemdup (tlv320_reg_addr,sizeof (tlv320_reg_addr),GFP_KERNEL ); +if (codec->reg_cache ==NULL ) +return -ENOMEM ; + +/* register pcms */ + ret =snd_soc_new_pcms (socdev,SNDRV_DEFAULT_IDX1 ,SNDRV_DEFAULT_STR1 ); +if (ret <0 ) { +kfree (codec->reg_cache); +return ret; + } + +queue_delayed_work (tlv320_workq, + &codec->delayed_work,msecs_to_jiffies (caps_charge)); + + ret =snd_soc_register_card (socdev); +if (ret <0 ) { +snd_soc_free_pcms (socdev); +snd_soc_dapm_free (socdev); + } + +return ret; +} + +/* If the i2c layer weren't so broken, we could pass this kind of data +around */ +static struct snd_soc_device *tlv320_socdev; + +#if defined (CONFIG_I2C ) || defined (CONFIG_I2C_MODULE ) + +static unsigned short normal_i2c[] = {0 ,I2C_CLIENT_END }; + +/* Magic definition of all other variables and things */ +I2C_CLIENT_INSMOD ; + +static struct i2c_driver tlv320_i2c_driver; +static struct i2c_client client_template; + +static int tlv320_codec_probe (struct i2c_adapter *adap,int addr,int kind) +{ +struct snd_soc_device *socdev = tlv320_socdev; +struct tlv320_setup_data *setup = socdev->codec_data; +struct snd_soc_codec *codec = socdev->codec; +struct i2c_client *i2c; +int ret, len; +const unsigned char *data; + +if (addr != setup->i2c_address) +return -ENODEV ; + + client_template.adapter = adap; + client_template.addr = addr; + + i2c =kmemdup (&client_template,sizeof (client_template),GFP_KERNEL ); +if (i2c ==NULL ){ +kfree (codec); +return -ENOMEM ; + } +i2c_set_clientdata (i2c, codec); + codec->control_data = i2c; + + ret =i2c_attach_client (i2c); +if (ret <0 ) { +err ("failed to attach codec at addr %x\n" , addr); + goto err; + } + + ret =tlv320_init (socdev); +if (ret <0 ) { +err ("failed to initialise TLV320\n" ); + goto err; + } + +switch (setting) { +case 1 : + data = tlv320_reg_data_init_set1; + len =sizeof (tlv320_reg_data_init_set1); +break ; +case 2 : + data = tlv320_reg_data_init_set2; + len =sizeof (tlv320_reg_data_init_set2); +break ; +case 3 : + data = tlv320_reg_data_init_set3; + len =sizeof (tlv320_reg_data_init_set3); +break ; +default : + data = tlv320_reg_data_init_set1; + len =sizeof (tlv320_reg_data_init_set1); +break ; + } + + ret =tlv320_write_block (codec, data, len); + +if (ret <0 ) { +err ("attach error: init status %d\n" , ret); + }else { +info ("attach: chip tlv320 at address 0x%02x" , +tlv320_read (codec,0x02 ) <<1 ); + } + +//tlv320_write(codec, CODEC_REG6B, 0x80); +#if 0 +int value; +int i; + +for (i=0 ; i<len; i++) { + value =tlv320_read (codec, tlv320_reg_addr[i]); +dbg ("read addr = 0x%02x, data = 0x%02x" , tlv320_reg_addr[i], value); +mdelay (10 ); + } + +#endif + + +return ret; + +err: +kfree (codec); +kfree (i2c); +return ret; +} + +static int tlv320_i2c_detach (struct i2c_client *client) +{ +struct snd_soc_codec *codec =i2c_get_clientdata (client); +i2c_detach_client (client); +kfree (codec->reg_cache); +kfree (client); +return 0 ; +} + +static int tlv320_i2c_attach (struct i2c_adapter *adap) +{ +return i2c_probe (adap, &addr_data, tlv320_codec_probe); +} + +/* tlv320 i2c codec control layer */ +static struct i2c_driver tlv320_i2c_driver = { + .driver = { + .name ="tlv320 I2C Codec" , + .owner =THIS_MODULE , + }, + .id =I2C_DRIVERID_TLV320 , + .attach_adapter = tlv320_i2c_attach, + .detach_client = tlv320_i2c_detach, + .command =NULL , +}; + +static struct i2c_client client_template = { + .name ="tlv320" , + .driver = &tlv320_i2c_driver, +}; +#endif + +static int tlv320_probe (struct platform_device *pdev) +{ +struct snd_soc_device *socdev =platform_get_drvdata (pdev); +struct tlv320_setup_data *setup; +struct snd_soc_codec *codec; +int ret =0 ; +struct tlv320_priv *tlv320; + +info ("TLV320 Audio Codec %s" ,TLV320_VERSION ); + + setup = socdev->codec_data; + codec =kzalloc (sizeof (struct snd_soc_codec ),GFP_KERNEL ); +if (codec ==NULL ) +return -ENOMEM ; + + tlv320 =kzalloc (sizeof (struct tlv320_priv ),GFP_KERNEL ); +if (tlv320 ==NULL ) { +kfree (codec); +return -ENOMEM ; + } + + codec->private_data = tlv320; + + socdev->codec = codec; +mutex_init (&codec->mutex); +INIT_LIST_HEAD (&codec->dapm_widgets); +INIT_LIST_HEAD (&codec->dapm_paths); + tlv320_socdev = socdev; + +INIT_DELAYED_WORK (&codec->delayed_work, tlv320_work); + tlv320_workq =create_workqueue ("tlv320" ); +if (tlv320_workq ==NULL ) { +kfree (codec); +return -ENOMEM ; + } +#if defined (CONFIG_I2C ) || defined (CONFIG_I2C_MODULE ) +if (setup->i2c_address) { + normal_i2c[0 ] = setup->i2c_address; + codec->hw_write = (hw_write_t )i2c_master_send; + ret =i2c_add_driver (&tlv320_i2c_driver); +if (ret !=0 ) +printk (KERN_ERR "can't add i2c driver" ); + } +#else +/* Add other interfaces here */ +#endif +return ret; +} + +/* power down chip */ +static int tlv320_remove (struct platform_device *pdev) +{ +struct snd_soc_device *socdev =platform_get_drvdata (pdev); +struct snd_soc_codec *codec = socdev->codec; + +if (tlv320_workq) +destroy_workqueue (tlv320_workq); +snd_soc_free_pcms (socdev); +snd_soc_dapm_free (socdev); +#if defined (CONFIG_I2C ) || defined (CONFIG_I2C_MODULE ) +i2c_del_driver (&tlv320_i2c_driver); +#endif +kfree (codec->private_data); +kfree (codec); + +return 0 ; +} + +struct snd_soc_codec_device soc_codec_dev_tlv320 = { + .probe = tlv320_probe, + .remove = tlv320_remove, +}; + +EXPORT_SYMBOL_GPL (soc_codec_dev_tlv320); + +MODULE_DESCRIPTION ("ASoC TLV320 driver" ); +MODULE_AUTHOR ("Nicola Perrino" ); +MODULE_LICENSE ("GPL" );sound/soc/codecs/tlv320.h new file +111
-0@@ -0,0 +1,111 @@ +/* +* tlv320.h -- TLV 320 ALSA Soc Audio driver +* +* Copyright 2005 Wolfson Microelectronics PLC. +* Copyright 2006 Atlab srl. +* +* Authors: Liam Girdwood <[email protected]> +* Nicola Perrino <[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. +* +*/ + +#ifndef _TLV320_H +#define _TLV320_H + +#define TLV320AIC24K + + +/* TLV320 register space */ +#define CODEC_NOOP 0x00 +#define CODEC_REG1 0x01 +#define CODEC_REG2 0x02 +#define CODEC_REG3A 0x03 +#define CODEC_REG3B 0x04 +#define CODEC_REG3C 0x05 +#define CODEC_REG3D 0x06 +#define CODEC_REG4A 0x07 +#define CODEC_REG4B 0x08 +#define CODEC_REG5A 0x09 +#define CODEC_REG5B 0x0a +#define CODEC_REG5C 0x0b +#define CODEC_REG5D 0x0c +#define CODEC_REG6A 0x0d +#define CODEC_REG6B 0x0e + + +// Control Register 1 +#define REG1_CONTINUOUS 0x40 +#define REG1_IIR_EN 0x20 +#define REG1_MIC_BIAS_235 0x08 +#define REG1_ANALOG_LOOP_BACK 0x04 +#define REG1_DIGITAL_LOOP_BACK 0x02 +#define REG1_DAC16 0x01 + +// Control Register 2 +#define REG2_TURBO_EN 0x80 +#define REG2_FIR_BYPASS 0x40 +#define REG2_GPIO 0x02 +#define REG2_GPIO_1 0x06 + +// Control Register 3A +#define REG3_PWDN_ALL 0x30 +#define REG3_PWDN_ADC 0x10 +#define REG3_PWDN_DAC 0x20 +#define REG3_SW_RESET 0x08 +#define REG3_SAMPLING_FACTOR1 0x01 +#define REG3_SAMPLING_FACTOR2 0x02 + +// Control Register 3B +#define REG3_8KBP_EN 0x60 +#define REG3_MUTE_OUTP1 0x42 +#define REG3_MUTE_OUTP2 0x48 +#define REG3_MUTE_OUTP3 0x44 + +// Control Register 4 +#define REG4_FSDIV_M 0x85 //M=5 +#define REG4_FSDIV_NP 0x08 //N=1, P=8 +//#define REG4_FSDIV_NP 0x01 //N=1, P=8 +#define REG4_FSDIV_NP1 0x02 //N=16, P=2 + +// Control Register 5 +#define REG5A_ADC_GAIN 0x02 //3dB +#define REG5A_ADC_MUTE 0x0f //Mute +#define REG5B_DAC_GAIN 0x42 //-3dB +#define REG5B_DAC_MUTE 0x4f //Mute +#define REG5C_SIDETONE_MUTE 0xBF + +// Control Register 6 +#define REG6A_AIC24A_CH1_IN 0x08 //INP1 to ADC +#define REG6B_AIC24A_CH1_OUT 0x82 //OUTP2 to DAC +#define REG6A_AIC24A_CH2_IN 0x02 //INP2 to ADC +#define REG6B_AIC24A_CH2_OUT 0x81 //OUTP3 to DAC + +/* clock inputs */ +#define TLV320_MCLK 0 +#define TLV320_PCMCLK 1 + + +struct tlv320_setup_data { +unsigned short i2c_address; +}; + +/* DAI ifmodes */ +/* mode 1 IFMODE = 00 */ +#define TLV320_DAI_MODE1_VOICE 0 +#define TLV320_DAI_MODE1_HIFI 1 +/* mode 2 IFMODE = 01 */ +#define TLV320_DAI_MODE2_VOICE 2 +/* mode 3 IFMODE = 10 */ +#define TLV320_DAI_MODE3_HIFI 3 +/* mode 4 IFMODE = 11 */ +#define TLV320_DAI_MODE4_HIFI 4 + +extern struct snd_soc_codec_dai tlv320_dai[5 ]; +extern struct snd_soc_codec_device soc_codec_dev_tlv320; + +#endif
Re: [PATCH] Add ASoC AK4535 codec driver.
In reply to Mark BrownAt Tue, 20 Nov 2007 09:25:38 +0000,
sound/soc/codecs/Kconfig config SND_SOC_AC97_CODEC · line 8
Quoted 13 lines · Mark Brown
sound/soc/codecs/Kconfig +4
-0@@ -2,6 +2,10 @@ config SND_SOC_AC97_CODEC tristate depends on SND_SOC +config SND_SOC_AK4535 + tristate + depends on SND_SOC +
Unless you add another interface support, this driver seems only for I2C. Then let's add dependency on I2C (which will avoid a possible unresolved symbol error).
sound/soc/codecs/ak4535.c
Quoted 2 lines
sound/soc/codecs/ak4535.c new file +0
-0
ak4535.c has some obvious coding-style issues.
Try to run scripts/checkpatch.pl and fix the reported parts.
Takashi
Re: [PATCH] Add ASoC AK4535 codec driver.
Quoted 10 lines · Takashi Iwai
sound/soc/codecs/Kconfig config SND_SOC_AC97_CODEC · line 8
Quoted 4 lines · Mark Brown
sound/soc/codecs/Kconfig +4
-0+config SND_SOC_AK4535 + tristate + depends on SND_SOC +Unless you add another interface support, this driver seems only for I2C. Then let's add dependency on I2C (which will avoid a possible unresolved symbol error).
The idiom used by the rest of the ASoC codecs appears to be to omit the bus dependencies entirely from the codec drivers and rely on the machine driver pulling in the appropriate bus driver. For the sake of consistency I'd rather leave this just now and then separately go through and address this for all drivers at once - does that seem sensible to you?
Quoted 5 lines
sound/soc/codecs/ak4535.c
Quoted 2 lines
sound/soc/codecs/ak4535.c new file +0
-0
ak4535.chas some obvious coding-style issues.
Try to runscripts/checkpatch.pland fix the reported parts.
I've fixed up the mechanical issues for next submission.
Re: [PATCH] Add ASoC AK4535 codec driver.
At Tue, 20 Nov 2007 15:05:30 +0000,
Quoted 13 lines · Mark Brown
Quoted 10 lines · Takashi Iwai
sound/soc/codecs/Kconfig config SND_SOC_AC97_CODEC · line 8
Quoted 4 lines · Mark Brown
sound/soc/codecs/Kconfig +4
-0+config SND_SOC_AK4535 + tristate + depends on SND_SOC +Unless you add another interface support, this driver seems only for I2C. Then let's add dependency on I2C (which will avoid a possible unresolved symbol error).
Quoted 6 lines
The idiom used by the rest of the ASoC codecs appears to be to omit the bus dependencies entirely from the codec drivers and rely on the machine driver pulling in the appropriate bus driver. For the sake of consistency I'd rather leave this just now and then separately go through and address this for all drivers at once - does that seem sensible to you?
Well, the problem is that the dependency with I2C is incomplete right now. We may build ASOC=y and I2C=m, and you'll get unresolved symbols due to call of I2C function from asoc.
I'm not sure what is the proper way to fix this. If the codec driver supports non-I2C and can be built without it, the explicit dependency on I2C is of course wrong.
Takashi
Re: [PATCH] Add ASoC AK4535 codec driver.
Quoted 9 lines · Takashi Iwai
Quoted 3 lines · Mark Brown
consistency I'd rather leave this just now and then separately go through and address this for all drivers at once - does that seem sensible to you?
Well, the problem is that the dependency with I2C is incomplete right now. We may build ASOC=y and I2C=m, and you'll get unresolved symbols due to call of I2C function from asoc.
Yes, I agree that this would be an improvement. I'd just like to do it for all the drivers at once rather than have some of the drivers set up one way and some another.
Quoted 3 lines
I'm not sure what is the proper way to fix this. If the codec driver supports non-I2C and can be built without it, the explicit dependency on I2C is of course wrong.
Yes, and of course users will still need to ensure that the appropriate bus driver for their platform is availiable on their system, though that could be loaded later. Still, we could make life a little easier for some users so it seems a worthwhile thing to do even though it doesn't solve everything.
Re: [PATCH] Add ASoC AK4535 codec driver.
At Tue, 20 Nov 2007 15:35:41 +0000,
Quoted 8 lines · Mark Brown
Quoted 5 lines · Takashi Iwai
Quoted 3 lines · Mark Brown
consistency I'd rather leave this just now and then separately go through and address this for all drivers at once - does that seem sensible to you?
Quoted 7 lines
Quoted 3 lines
Well, the problem is that the dependency with I2C is incomplete right now. We may build ASOC=y and I2C=m, and you'll get unresolved symbols due to call of I2C function from asoc.
Yes, I agree that this would be an improvement. I'd just like to do it for all the drivers at once rather than have some of the drivers set up one way and some another.
Fair enough.
Quoted 9 lines
Quoted 3 lines
I'm not sure what is the proper way to fix this. If the codec driver supports non-I2C and can be built without it, the explicit dependency on I2C is of course wrong.
Yes, and of course users will still need to ensure that the appropriate bus driver for their platform is availiable on their system, though that could be loaded later. Still, we could make life a little easier for some users so it seems a worthwhile thing to do even though it doesn't solve everything.
Agreed.
Takashi
Re: [PATCH] Initial WM8753 TLV support for capture mixer.
In reply to Mark BrownAt Tue, 20 Nov 2007 09:25:37 +0000,
Quoted 20 lines · Mark Brown
From: Liam Girdwood <[email protected]>
--- sound/soc/codecs/wm8753.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)sound/soc/codecs/wm8753.c +1
-0@@ -48,6 +48,7 @@#include <sound/soc.h> #include <sound/soc-dapm.h> #include <sound/initval.h> +#include <sound/tlv.h> #include <asm/div64.h> #include "wm8753.h"
sound/soc/codecs/wm8753.c static int wm8753_set_dai(struct snd_kcontrol *kcontrol, · line 266
Quoted 8 lines
sound/soc/codecs/wm8753.c +5
-0@@ -258,6 +259,11 @@ static int wm8753_set_dai(struct snd_kcontrol *kcontrol,return 1 ; } +static const unsigned int rec_mix_tlv[] = { +TLV_DB_RANGE_HEAD (1 ), +0 ,7 ,TLV_DB_LINEAR_ITEM (-1500 ,600 ), +}; +
You don't need TLV_DB_DB_RANGE_HEAD() for a single range. TLV_DB_RANGE*() is for multiple ranges.
Simply use like below:
static const DECLARE_TLV_DB_LINEAR(rec_mix_tlv, -500, 600);
Takashi
Quoted 22 lines
sound/soc/codecs/wm8753.c +2
-2static const struct snd_kcontrol_new wm8753_snd_controls[] = {SOC_DOUBLE_R ("PCM Volume" ,WM8753_LDAC ,WM8753_RDAC ,0 ,255 ,0 ),@@ -287,8 +293,8 @@ SOC_SINGLE("Bass Volume", WM8753_BASS, 0, 15, 1),SOC_SINGLE ("Treble Volume" ,WM8753_TREBLE ,0 ,15 ,1 ),SOC_ENUM ("Treble Cut-off" , wm8753_enum[2 ]), -SOC_DOUBLE ("Sidetone Capture Volume" ,WM8753_RECMIX1 ,0 ,4 ,7 ,1 ), -SOC_SINGLE ("Voice Sidetone Capture Volume" ,WM8753_RECMIX2 ,0 ,7 ,1 ), +SOC_DOUBLE_TLV ("Sidetone Capture Volume" ,WM8753_RECMIX1 ,0 ,4 ,7 ,1 , rec_mix_tlv), +SOC_SINGLE_TLV ("Voice Sidetone Capture Volume" ,WM8753_RECMIX2 ,0 ,7 ,1 , rec_mix_tlv),SOC_DOUBLE_R ("Capture Volume" ,WM8753_LINVOL ,WM8753_RINVOL ,0 ,63 ,0 ), SOC_DOUBLE_R("Capture ZC Switch", WM8753_LINVOL, WM8753_RINVOL, 6, 1, 0),Signature · 6 lines
1.5.3.5 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH] Initial WM8753 TLV support for capture mixer.
Quoted 4 lines · Takashi Iwai
You don't need
TLV_DB_DB_RANGE_HEAD()for a single range. TLV_DB_RANGE*() is for multiple ranges.
Simply use like below:static const DECLARE_TLV_DB_LINEAR(rec_mix_tlv, -500, 600);
Thanks, I've fixed this for the next submission.
Re: [PATCH] Add ASoC WM9713 codec driver.
In reply to Mark BrownAt Tue, 20 Nov 2007 09:25:36 +0000,
Quoted 2 lines · Mark Brown
From: Liam Girdwood <[email protected]>
I suppose the author is Liam, right? It's a bit strange that his sign-off appears in the middle, then...
Quoted 4 lines
Signed-off-by Marc Mulcahy <[email protected]>Signed-off-by Graeme Gregory <[email protected]>Signed-off-by Liam Girdwood <[email protected]>Signed-off-by Mark Brown <[email protected]>
(snip)
Quoted 3 lines
sound/soc/codecs/wm9713.c new file +3
-0+static int mixer_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event) +{
...
sound/soc/codecs/wm9713.c line 235
Quoted 1 line
sound/soc/codecs/wm9713.c new file +1
-0+if (l &0x1 || r &0x1 )
I'd suggest to put parentheses around bit-ops.
Quoted 3 lines
sound/soc/codecs/wm9713.c new file +3
-0+static int wm9713_set_dai_clkdiv (struct snd_soc_codec_dai *codec_dai, +int div_id,int div) +{
...
Quoted 1 line
+};
Remove semicolon.
sound/soc/codecs/wm9713.c line 1018
Quoted 3 lines
sound/soc/codecs/wm9713.c new file +3
-0+#define WM9713_PCM_FORMATS \ + (SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S20_3LE | \ + SNDRV_PCM_FORMAT_S24_LE)
Is it S24_LE or S24_3LE? I see S24_LE in other codec drivers, but am not pretty sure whether I checked it...
Takashi
Re: [PATCH] Add ASoC WM9713 codec driver.
Quoted 7 lines · Takashi Iwai
sound/soc/codecs/wm9713.c line 1018
Quoted 3 lines · Mark Brown
sound/soc/codecs/wm9713.c new file +3
-0+#define WM9713_PCM_FORMATS \ + (SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S20_3LE | \ + SNDRV_PCM_FORMAT_S24_LE)Is it
S24_LEorS24_3LE? I seeS24_LEin other codec drivers, but am not pretty sure whether I checked it...
Apparently, these are the formats that an AC'97 controller connected with this codec can support.
Samples on the AC'97 bus are always MSB-aligned with at most 20 bits. I don't think it makes much sense to let the codec driver decide what sample formats the controller should support, because the controller will have to convert the samples anyway (from/to 16, 24 or 32 bits). Furthermore, I'm sure there are AC'97 controllers that can handle big- endian samples on the memory bus.
Regards,
Clemens
Re: [PATCH] Add ASoC WM9713 codec driver.
Quoted 4 lines · Clemens Ladisch
Quoted 2 lines · Takashi Iwai
Is it
S24_LEorS24_3LE? I seeS24_LEin other codec drivers, but am not pretty sure whether I checked it...
I think it's correct but I'll double check before resubmitting.
Quoted 2 lines
Apparently, these are the formats that an AC'97 controller connected with this codec can support.
This define is not used for the AC'97 interface of the chip - it is only used for the PCM interface which the chip supports in addition to its AC'97 interface.
Re: [PATCH] Bump ASoC core version number
In reply to Mark BrownAt Tue, 20 Nov 2007 09:25:35 +0000,
Quoted 4 lines · Mark Brown
--- include/sound/soc.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
No author and sign-off? It's trivial so I don't care much, though.
Takashi
Quoted 22 lines
include/sound/soc.h +1
-1@@ -22,7 +22,7 @@#include <sound/control.h> #include <sound/ac97_codec.h> -#define SND_SOC_VERSION "0.13.1" +#define SND_SOC_VERSION "0.13.2"/* * Convenience kcontrol builders Signature · 6 lines
1.5.3.5 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH] Ensure PCMs are suspended
In reply to Mark BrownAt Tue, 20 Nov 2007 09:25:31 +0000,
Quoted 2 lines · Mark Brown
From: Liam Girdwood <[email protected]>
This one has no sign-off and local user only...
Takashi
Quoted 53 lines
This fixes a bug whereby PCMs were not being suspended when the rest of the audio subsystem was suspended.
--- include/sound/soc.h | 3 +++ sound/soc/soc-core.c | 5 +++++ 2 files changed, 8 insertions(+), 0 deletions(-)include/sound/soc.h +3
-0@@ -448,6 +448,9 @@ struct snd_soc_dai_link {/* codec/machine specific init - e.g. add machine controls */ int (*init)(struct snd_soc_codec *codec); + +/* DAI pcm */ +struct snd_pcm *pcm; };/* SoC machine */ sound/soc/soc-core.c +5
-0@@ -646,6 +646,10 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state) dai->dai_ops.digital_mute (dai,1 ); } +/* suspend all pcms */ +for (i =0 ; i < machine->num_links; i++) +snd_pcm_suspend_all (machine->dai_link[i].pcm); +if (machine->suspend_pre) machine->suspend_pre (pdev, state);@@ -880,6 +884,7 @@ static int soc_new_pcm(struct snd_soc_device *socdev,return ret; } + dai_link->pcm = pcm; pcm->private_data = rtd; soc_pcm_ops.mmap = socdev->platform->pcm_ops->mmap; soc_pcm_ops.pointer = socdev->platform->pcm_ops->pointer;Signature · 6 lines
1.5.3.5 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH] Add D1 power event to power down event sequence
In reply to Mark BrownAt Tue, 20 Nov 2007 09:25:30 +0000,
Quoted 2 lines · Mark Brown
From: Liam Girdwood <[email protected]>
Looks suspicious. Also, sign-off is missing.
Takashi
Quoted 32 lines
--- sound/soc/soc-core.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)sound/soc/soc-core.c +8
-0@@ -288,6 +288,14 @@ 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 */ +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 ); + } + codec_dai->pop_wait =0 ; snd_soc_dapm_stream_event(codec, codec_dai->playback.stream_name,Signature · 6 lines
1.5.3.5 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH] Fix inverted Bass, Treble, Mono volume and Phone volume WM9712 mixer controls.
In reply to Mark BrownAt Tue, 20 Nov 2007 09:25:27 +0000,
Quoted 6 lines · Mark Brown
From: Joe Sauer <[email protected]>
Signed-off-by Joe Sauer <[email protected]>Signed-off-by Liam Girdwood <[email protected]>Signed-off-by Mark Brown <[email protected]>
We have already a patch to fix Mono and Bass/Treble on ALSA HG tree but only Phone volume seems missing. Is it right?
Takashi
Quoted 45 lines
--- sound/soc/codecs/wm9712.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)sound/soc/codecs/wm9712.c +4
-4@@ -102,7 +102,7 @@ SOC_SINGLE("Speaker Playback ZC Switch", AC97_MASTER, 7, 1, 0),SOC_SINGLE ("Speaker Playback Invert Switch" ,AC97_MASTER ,6 ,1 ,0 ),SOC_SINGLE ("Headphone Playback ZC Switch" ,AC97_HEADPHONE ,7 ,1 ,0 ),SOC_SINGLE ("Mono Playback ZC Switch" ,AC97_MASTER_MONO ,7 ,1 ,0 ), -SOC_SINGLE ("Mono Playback Volume" ,AC97_MASTER_MONO ,0 ,31 ,0 ), +SOC_SINGLE ("Mono Playback Volume" ,AC97_MASTER_MONO ,0 ,31 ,1 ),SOC_SINGLE ("ALC Target Volume" ,AC97_CODEC_CLASS_REV ,12 ,15 ,0 ), SOC_SINGLE("ALC Hold Time", AC97_CODEC_CLASS_REV, 8, 15, 0),@@ -131,7 +131,7 @@ SOC_SINGLE("Aux Playback Headphone Volume", AC97_CD, 12, 7, 1),SOC_SINGLE ("Aux Playback Speaker Volume" ,AC97_CD ,8 ,7 ,1 ),SOC_SINGLE ("Aux Playback Phone Volume" ,AC97_CD ,4 ,7 ,1 ), -SOC_SINGLE ("Phone Volume" ,AC97_PHONE ,0 ,15 ,0 ), +SOC_SINGLE ("Phone Volume" ,AC97_PHONE ,0 ,15 ,1 ),SOC_DOUBLE ("Line Capture Volume" ,AC97_LINE ,8 ,0 ,31 ,1 ), SOC_SINGLE("Capture 20dB Boost Switch", AC97_REC_SEL, 14, 1, 0),@@ -145,8 +145,8 @@ SOC_ENUM("Bass Control", wm9712_enum[5]),SOC_SINGLE ("Bass Cut-off Switch" ,AC97_MASTER_TONE ,12 ,1 ,1 ),SOC_SINGLE ("Tone Cut-off Switch" ,AC97_MASTER_TONE ,4 ,1 ,1 ),SOC_SINGLE ("Playback Attenuate (-6dB) Switch" ,AC97_MASTER_TONE ,6 ,1 ,0 ), -SOC_SINGLE ("Bass Volume" ,AC97_MASTER_TONE ,8 ,15 ,0 ), -SOC_SINGLE ("Treble Volume" ,AC97_MASTER_TONE ,0 ,15 ,0 ), +SOC_SINGLE ("Bass Volume" ,AC97_MASTER_TONE ,8 ,15 ,1 ), +SOC_SINGLE ("Treble Volume" ,AC97_MASTER_TONE ,0 ,15 ,1 ),SOC_SINGLE ("Capture ADC Switch" ,AC97_REC_GAIN ,15 ,1 ,1 ), SOC_ENUM("Capture Volume Steps", wm9712_enum[6]),Signature · 6 lines
1.5.3.5 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH] Fix inverted Bass, Treble, Mono volume and Phone volume WM9712 mixer controls.
Quoted 2 lines · Takashi Iwai
We have already a patch to fix Mono and Bass/Treble on ALSA HG tree but only Phone volume seems missing. Is it right?
Yes, that's right - the same fix was made independantly to ALSA and the ASoC tree with these extra changes appearing in the version that was submitted to ASoC.
Re: [PATCH] Fix inverted Bass, Treble, Mono volume and Phone volume WM9712 mixer controls.
In reply to Mark BrownQuoted 14 lines · Mark Brown
From: Joe Sauer <[email protected]>
Signed-off-by Joe Sauer <[email protected]>Signed-off-by Liam Girdwood <[email protected]>Signed-off-by Mark Brown <[email protected]>--- sound/soc/codecs/wm9712.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)sound/soc/codecs/wm9712.c +0
-0
sound/soc/codecs/wm9712.c SOC_SINGLE("Speaker Playback ZC Switch", AC97_MASTER, 7, 1, 0), · line 105
Quoted 5 lines
sound/soc/codecs/wm9712.c +1
-1@@ -102,7 +102,7 @@ SOC_SINGLE("Speaker Playback ZC Switch", AC97_MASTER, 7, 1, 0),SOC_SINGLE ("Speaker Playback Invert Switch" ,AC97_MASTER ,6 ,1 ,0 ),SOC_SINGLE ("Headphone Playback ZC Switch" ,AC97_HEADPHONE ,7 ,1 ,0 ),SOC_SINGLE ("Mono Playback ZC Switch" ,AC97_MASTER_MONO ,7 ,1 ,0 ), -SOC_SINGLE("Mono Playback Volume", AC97_MASTER_MONO, 0, 31, 0), +SOC_SINGLE("Mono Playback Volume", AC97_MASTER_MONO, 0, 31, 1),
I think there also should be "Mono Playback Switch", otherwise there's no way you can unmute mono playback:
+ SOC_SINGLE("Mono Playback Switch", AC97_MASTER_MONO, 15, 1, 1),
Quoted 22 lines
sound/soc/codecs/wm9712.c +3
-3SOC_SINGLE ("ALC Target Volume" ,AC97_CODEC_CLASS_REV ,12 ,15 ,0 ), SOC_SINGLE("ALC Hold Time", AC97_CODEC_CLASS_REV, 8, 15, 0),@@ -131,7 +131,7 @@ SOC_SINGLE("Aux Playback Headphone Volume", AC97_CD, 12, 7, 1),SOC_SINGLE ("Aux Playback Speaker Volume" ,AC97_CD ,8 ,7 ,1 ),SOC_SINGLE ("Aux Playback Phone Volume" ,AC97_CD ,4 ,7 ,1 ), -SOC_SINGLE ("Phone Volume" ,AC97_PHONE ,0 ,15 ,0 ), +SOC_SINGLE ("Phone Volume" ,AC97_PHONE ,0 ,15 ,1 ),SOC_DOUBLE ("Line Capture Volume" ,AC97_LINE ,8 ,0 ,31 ,1 ), SOC_SINGLE("Capture 20dB Boost Switch", AC97_REC_SEL, 14, 1, 0),@@ -145,8 +145,8 @@ SOC_ENUM("Bass Control", wm9712_enum[5]),SOC_SINGLE ("Bass Cut-off Switch" ,AC97_MASTER_TONE ,12 ,1 ,1 ),SOC_SINGLE ("Tone Cut-off Switch" ,AC97_MASTER_TONE ,4 ,1 ,1 ),SOC_SINGLE ("Playback Attenuate (-6dB) Switch" ,AC97_MASTER_TONE ,6 ,1 ,0 ), -SOC_SINGLE ("Bass Volume" ,AC97_MASTER_TONE ,8 ,15 ,0 ), -SOC_SINGLE ("Treble Volume" ,AC97_MASTER_TONE ,0 ,15 ,0 ), +SOC_SINGLE ("Bass Volume" ,AC97_MASTER_TONE ,8 ,15 ,1 ), +SOC_SINGLE ("Treble Volume" ,AC97_MASTER_TONE ,0 ,15 ,1 ),SOC_SINGLE ("Capture ADC Switch" ,AC97_REC_GAIN ,15 ,1 ,1 ), SOC_ENUM("Capture Volume Steps", wm9712_enum[6]),
Signature · 2 lines
Sincerely yours, Mike.
Re: [PATCH] Fix inverted Bass, Treble, Mono volume and Phone volume WM9712 mixer controls.
Quoted 3 lines · Mike Rapoport
I think there also should be "Mono Playback Switch", otherwise there's no way you can unmute mono playback:
+SOC_SINGLE("Mono Playback Switch", AC97_MASTER_MONO, 15, 1, 1),
Yes, I'll add that hunk to the patch. It's already in our development branch.
At Tue, 20 Nov 2007 09:25:23 +0000,
Quoted 4 lines · Mark Brown
The following patch series merges some of the outstanding changes in the linux-2.6-asoc tree. It updates the core and existing drivers and adds some of the new drivers currently in the tree.
Thanks. Could you add the patch sequence number to each patch at the next time (if the order matters)?
Takashi
Quoted 2 lines · Takashi Iwai
Thanks. Could you add the patch sequence number to each patch at the next time (if the order matters)?
Yes, sorry - I'll look into that. I have to say that I was surprised when I saw that git-send-email hadn't generated them.
Quoted 3 lines · Mark Brown
The following patch series merges some of the outstanding changes in the linux-2.6-asoc tree. It updates the core and existing drivers and adds some of the new drivers currently in the tree.
In asoc v2 soc-core is changed from being a platform driver into subsys_initcall(asoc_bus_init); Is this change going in anytime soon? subsys call is the right way, the alsa core is not a platform device. This will bring asoc into alignment with i2c which already uses subsys_initcall.
Quoted 5 lines
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Signature · 2 lines
Jon Smirl [email protected]
Quoted 5 lines · Jon Smirl
In asoc v2 soc-core is changed from being a platform driver into
subsys_initcall(asoc_bus_init); Is this change going in anytime soon? subsys call is the right way, the alsa core is not a platform device. This will bring asoc into alignment with i2c which already usessubsys_initcall.
I can't give any actual hard timescales for anything but this merge is a first step on the way to doing that. My plan was to try to get the pending ASoC v1 changes merged into mainline so that there is only one place to keep track of when merging into ASoC v2 development.
Quoted 8 lines · Mark Brown
Quoted 5 lines · Jon Smirl
In asoc v2 soc-core is changed from being a platform driver into
subsys_initcall(asoc_bus_init); Is this change going in anytime soon? subsys call is the right way, the alsa core is not a platform device. This will bring asoc into alignment with i2c which already usessubsys_initcall.
Quoted 5 lines
I can't give any actual hard timescales for anything but this merge is a first step on the way to doing that. My plan was to try to get the pending ASoC v1 changes merged into mainline so that there is only one place to keep track of when merging into ASoC v2 development.
I've got a patch for the PowerPC that removes platform bus, it's of_platform bus on the PowerPC. Removing platform bus exposes all kinds of things that shouldn't be on it, like the ASoC core.
Signature · 2 lines
Jon Smirl [email protected]