From a9cdb4d86edf6db666c114411c84b78090661501 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Thu, 12 Mar 2009 11:27:49 +0100 Subject: [PATCH] --- yaml --- r: 132929 b: refs/heads/master c: 72d7466468b471f99cefae3c5f4a414bbbaa0bdd h: refs/heads/master i: 132927: dc7941027623a6c394ab3121459e870cccb6dea7 v: v3 --- [refs] | 2 +- trunk/include/sound/pxa2xx-lib.h | 15 ------ trunk/sound/arm/pxa2xx-ac97-lib.c | 71 ++------------------------- trunk/sound/soc/codecs/twl4030.c | 12 ++--- trunk/sound/soc/pxa/pxa-ssp.c | 44 ++++++++++++----- trunk/sound/soc/pxa/pxa2xx-ac97.c | 16 ++---- trunk/sound/soc/s3c24xx/s3c64xx-i2s.c | 8 ++- trunk/sound/soc/sh/hac.c | 12 ++--- trunk/sound/soc/soc-core.c | 3 +- 9 files changed, 58 insertions(+), 125 deletions(-) diff --git a/[refs] b/[refs] index fa076ece35c3..9a96f8dac453 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d2314e0e27566f8830ebed3587cc049e07e6a4ee +refs/heads/master: 72d7466468b471f99cefae3c5f4a414bbbaa0bdd diff --git a/trunk/include/sound/pxa2xx-lib.h b/trunk/include/sound/pxa2xx-lib.h index 2c894b600e5b..2fd3d251d9a5 100644 --- a/trunk/include/sound/pxa2xx-lib.h +++ b/trunk/include/sound/pxa2xx-lib.h @@ -42,19 +42,4 @@ extern int pxa2xx_ac97_hw_resume(void); extern int pxa2xx_ac97_hw_probe(struct platform_device *dev); extern void pxa2xx_ac97_hw_remove(struct platform_device *dev); -/* AC97 platform_data */ -/** - * struct pxa2xx_ac97_platform_data - pxa ac97 platform data - * @reset_gpio: AC97 reset gpio (normally gpio113 or gpio95) - * a -1 value means no gpio will be used for reset - * - * Platform data should only be specified for pxa27x CPUs where a silicon bug - * prevents correct operation of the reset line. If not specified, the default - * behaviour is to consider gpio 113 as the AC97 reset line, which is the - * default on most boards. - */ -struct pxa2xx_ac97_platform_data { - int reset_gpio; -}; - #endif diff --git a/trunk/sound/arm/pxa2xx-ac97-lib.c b/trunk/sound/arm/pxa2xx-ac97-lib.c index d721ea7cae8f..35afd0c33be5 100644 --- a/trunk/sound/arm/pxa2xx-ac97-lib.c +++ b/trunk/sound/arm/pxa2xx-ac97-lib.c @@ -31,7 +31,6 @@ static DECLARE_WAIT_QUEUE_HEAD(gsr_wq); static volatile long gsr_bits; static struct clk *ac97_clk; static struct clk *ac97conf_clk; -static int reset_gpio; /* * Beware PXA27x bugs: @@ -43,45 +42,6 @@ static int reset_gpio; * 1 jiffy timeout if interrupt never comes). */ -enum { - RESETGPIO_FORCE_HIGH, - RESETGPIO_FORCE_LOW, - RESETGPIO_NORMAL_ALTFUNC -}; - -/** - * set_resetgpio_mode - computes and sets the AC97_RESET gpio mode on PXA - * @mode: chosen action - * - * As the PXA27x CPUs suffer from a AC97 bug, a manual control of the reset line - * must be done to insure proper work of AC97 reset line. This function - * computes the correct gpio_mode for further use by reset functions, and - * applied the change through pxa_gpio_mode. - */ -static void set_resetgpio_mode(int resetgpio_action) -{ - int mode = 0; - - if (reset_gpio) - switch (resetgpio_action) { - case RESETGPIO_NORMAL_ALTFUNC: - if (reset_gpio == 113) - mode = 113 | GPIO_OUT | GPIO_DFLT_LOW; - if (reset_gpio == 95) - mode = 95 | GPIO_ALT_FN_1_OUT; - break; - case RESETGPIO_FORCE_LOW: - mode = reset_gpio | GPIO_OUT | GPIO_DFLT_LOW; - break; - case RESETGPIO_FORCE_HIGH: - mode = reset_gpio | GPIO_OUT | GPIO_DFLT_HIGH; - break; - }; - - if (mode) - pxa_gpio_mode(mode); -} - unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg) { unsigned short val = -1; @@ -177,10 +137,10 @@ static inline void pxa_ac97_warm_pxa27x(void) /* warm reset broken on Bulverde, so manually keep AC97 reset high */ - set_resetgpio_mode(RESETGPIO_FORCE_HIGH); + pxa_gpio_mode(113 | GPIO_OUT | GPIO_DFLT_HIGH); udelay(10); GCR |= GCR_WARM_RST; - set_resetgpio_mode(RESETGPIO_NORMAL_ALTFUNC); + pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT); udelay(500); } @@ -348,8 +308,8 @@ int pxa2xx_ac97_hw_resume(void) pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD); } if (cpu_is_pxa27x()) { - /* Use GPIO 113 or 95 as AC97 Reset on Bulverde */ - set_resetgpio_mode(RESETGPIO_NORMAL_ALTFUNC); + /* Use GPIO 113 as AC97 Reset on Bulverde */ + pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT); } clk_enable(ac97_clk); return 0; @@ -360,27 +320,6 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_resume); int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) { int ret; - struct pxa2xx_ac97_platform_data *pdata = dev->dev.platform_data; - - if (pdata) { - switch (pdata->reset_gpio) { - case 95: - case 113: - reset_gpio = pdata->reset_gpio; - break; - case 0: - reset_gpio = 113; - break; - case -1: - break; - default: - dev_err(dev, "Invalid reset GPIO %d\n", - pdata->reset_gpio); - } - } else { - if (cpu_is_pxa27x()) - reset_gpio = 113; - } if (cpu_is_pxa25x() || cpu_is_pxa27x()) { pxa_gpio_mode(GPIO31_SYNC_AC97_MD); @@ -391,7 +330,7 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) if (cpu_is_pxa27x()) { /* Use GPIO 113 as AC97 Reset on Bulverde */ - set_resetgpio_mode(RESETGPIO_NORMAL_ALTFUNC); + pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT); ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK"); if (IS_ERR(ac97conf_clk)) { ret = PTR_ERR(ac97conf_clk); diff --git a/trunk/sound/soc/codecs/twl4030.c b/trunk/sound/soc/codecs/twl4030.c index 97738e2ece04..86bb15cc82ce 100644 --- a/trunk/sound/soc/codecs/twl4030.c +++ b/trunk/sound/soc/codecs/twl4030.c @@ -1383,12 +1383,6 @@ static int twl4030_set_dai_fmt(struct snd_soc_dai *codec_dai, #define TWL4030_RATES (SNDRV_PCM_RATE_8000_48000) #define TWL4030_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FORMAT_S24_LE) -static struct snd_soc_dai_ops twl4030_dai_ops = { - .hw_params = twl4030_hw_params, - .set_sysclk = twl4030_set_dai_sysclk, - .set_fmt = twl4030_set_dai_fmt, -}; - struct snd_soc_dai twl4030_dai = { .name = "twl4030", .playback = { @@ -1403,7 +1397,11 @@ struct snd_soc_dai twl4030_dai = { .channels_max = 2, .rates = TWL4030_RATES, .formats = TWL4030_FORMATS,}, - .ops = &twl4030_dai_ops, + .ops = { + .hw_params = twl4030_hw_params, + .set_sysclk = twl4030_set_dai_sysclk, + .set_fmt = twl4030_set_dai_fmt, + } }; EXPORT_SYMBOL_GPL(twl4030_dai); diff --git a/trunk/sound/soc/pxa/pxa-ssp.c b/trunk/sound/soc/pxa/pxa-ssp.c index d3fa6357a9fd..4dd0d7c57220 100644 --- a/trunk/sound/soc/pxa/pxa-ssp.c +++ b/trunk/sound/soc/pxa/pxa-ssp.c @@ -558,18 +558,17 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai, switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: - sscr0 |= SSCR0_MOD | SSCR0_PSP; + sscr0 |= SSCR0_PSP; sscr1 |= SSCR1_RWOT | SSCR1_TRAIL; switch (fmt & SND_SOC_DAIFMT_INV_MASK) { case SND_SOC_DAIFMT_NB_NF: - sspsp |= SSPSP_FSRT; break; case SND_SOC_DAIFMT_NB_IF: - sspsp |= SSPSP_SFRMP | SSPSP_FSRT; + sspsp |= SSPSP_SFRMP; break; case SND_SOC_DAIFMT_IB_IF: - sspsp |= SSPSP_SFRMP; + sspsp |= SSPSP_SFRMP | SSPSP_SCMODE(3); break; default: return -EINVAL; @@ -655,33 +654,56 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream, sscr0 |= SSCR0_FPCKE; #endif sscr0 |= SSCR0_DataSize(16); - /* use network mode (2 slots) for 16 bit stereo */ break; case SNDRV_PCM_FORMAT_S24_LE: sscr0 |= (SSCR0_EDSS | SSCR0_DataSize(8)); - /* we must be in network mode (2 slots) for 24 bit stereo */ break; case SNDRV_PCM_FORMAT_S32_LE: sscr0 |= (SSCR0_EDSS | SSCR0_DataSize(16)); - /* we must be in network mode (2 slots) for 32 bit stereo */ break; } ssp_write_reg(ssp, SSCR0, sscr0); switch (priv->dai_fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: - /* Cleared when the DAI format is set */ - sspsp = ssp_read_reg(ssp, SSPSP) | SSPSP_SFRMWDTH(width); + sspsp = ssp_read_reg(ssp, SSPSP); + + if (((sscr0 & SSCR0_SCR) == SSCR0_SerClkDiv(4)) && + (width == 16)) { + /* This is a special case where the bitclk is 64fs + * and we're not dealing with 2*32 bits of audio + * samples. + * + * The SSP values used for that are all found out by + * trying and failing a lot; some of the registers + * needed for that mode are only available on PXA3xx. + */ + +#ifdef CONFIG_PXA3xx + if (!cpu_is_pxa3xx()) + return -EINVAL; + + sspsp |= SSPSP_SFRMWDTH(width * 2); + sspsp |= SSPSP_SFRMDLY(width * 4); + sspsp |= SSPSP_EDMYSTOP(3); + sspsp |= SSPSP_DMYSTOP(3); + sspsp |= SSPSP_DMYSTRT(1); +#else + return -EINVAL; +#endif + } else + sspsp |= SSPSP_SFRMWDTH(width); + ssp_write_reg(ssp, SSPSP, sspsp); break; default: break; } - /* We always use a network mode so we always require TDM slots + /* When we use a network mode, we always require TDM slots * - complain loudly and fail if they've not been set up yet. */ - if (!(ssp_read_reg(ssp, SSTSA) & 0xf)) { + if ((sscr0 & SSCR0_MOD) && !(ssp_read_reg(ssp, SSTSA) & 0xf)) { dev_err(&ssp->pdev->dev, "No TDM timeslot configured\n"); return -EINVAL; } diff --git a/trunk/sound/soc/pxa/pxa2xx-ac97.c b/trunk/sound/soc/pxa/pxa2xx-ac97.c index 01c21c6cdbbc..cf809049272a 100644 --- a/trunk/sound/soc/pxa/pxa2xx-ac97.c +++ b/trunk/sound/soc/pxa/pxa2xx-ac97.c @@ -164,18 +164,10 @@ static int pxa2xx_ac97_hw_mic_params(struct snd_pcm_substream *substream, SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000) -static struct snd_soc_dai_ops pxa_ac97_hifi_dai_ops = { +static struct snd_soc_dai_ops pxa_ac97_dai_ops = { .hw_params = pxa2xx_ac97_hw_params, }; -static struct snd_soc_dai_ops pxa_ac97_aux_dai_ops = { - .hw_params = pxa2xx_ac97_hw_aux_params, -}; - -static struct snd_soc_dai_ops pxa_ac97_mic_dai_ops = { - .hw_params = pxa2xx_ac97_hw_mic_params, -}; - /* * There is only 1 physical AC97 interface for pxa2xx, but it * has extra fifo's that can be used for aux DACs and ADCs. @@ -201,7 +193,7 @@ struct snd_soc_dai pxa_ac97_dai[] = { .channels_max = 2, .rates = PXA2XX_AC97_RATES, .formats = SNDRV_PCM_FMTBIT_S16_LE,}, - .ops = &pxa_ac97_hifi_dai_ops, + .ops = &pxa_ac97_dai_ops, }, { .name = "pxa2xx-ac97-aux", @@ -219,7 +211,7 @@ struct snd_soc_dai pxa_ac97_dai[] = { .channels_max = 1, .rates = PXA2XX_AC97_RATES, .formats = SNDRV_PCM_FMTBIT_S16_LE,}, - .ops = &pxa_ac97_aux_dai_ops, + .ops = &pxa_ac97_dai_ops, }, { .name = "pxa2xx-ac97-mic", @@ -231,7 +223,7 @@ struct snd_soc_dai pxa_ac97_dai[] = { .channels_max = 1, .rates = PXA2XX_AC97_RATES, .formats = SNDRV_PCM_FMTBIT_S16_LE,}, - .ops = &pxa_ac97_mic_dai_ops, + .ops = &pxa_ac97_dai_ops, }, }; diff --git a/trunk/sound/soc/s3c24xx/s3c64xx-i2s.c b/trunk/sound/soc/s3c24xx/s3c64xx-i2s.c index 33c5de7e255f..6e1e85dc1ff2 100644 --- a/trunk/sound/soc/s3c24xx/s3c64xx-i2s.c +++ b/trunk/sound/soc/s3c24xx/s3c64xx-i2s.c @@ -177,10 +177,6 @@ static int s3c64xx_i2s_probe(struct platform_device *pdev, #define S3C64XX_I2S_FMTS \ (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE) -static struct snd_soc_dai_ops s3c64xx_i2s_dai_ops = { - .set_sysclk = s3c64xx_i2s_set_sysclk, -}; - struct snd_soc_dai s3c64xx_i2s_dai = { .name = "s3c64xx-i2s", .id = 0, @@ -197,7 +193,9 @@ struct snd_soc_dai s3c64xx_i2s_dai = { .rates = S3C64XX_I2S_RATES, .formats = S3C64XX_I2S_FMTS, }, - .ops = &s3c64xx_i2s_dai_ops, + .ops = { + .set_sysclk = s3c64xx_i2s_set_sysclk, + }, }; EXPORT_SYMBOL_GPL(s3c64xx_i2s_dai); diff --git a/trunk/sound/soc/sh/hac.c b/trunk/sound/soc/sh/hac.c index 41db75af3c69..eab31838badf 100644 --- a/trunk/sound/soc/sh/hac.c +++ b/trunk/sound/soc/sh/hac.c @@ -267,10 +267,6 @@ static int hac_hw_params(struct snd_pcm_substream *substream, #define AC97_FMTS \ SNDRV_PCM_FMTBIT_S16_LE -static struct snd_soc_dai_ops hac_dai_ops = { - .hw_params = hac_hw_params, -}; - struct snd_soc_dai sh4_hac_dai[] = { { .name = "HAC0", @@ -288,7 +284,9 @@ struct snd_soc_dai sh4_hac_dai[] = { .channels_min = 2, .channels_max = 2, }, - .ops = &hac_dai_ops, + .ops = { + .hw_params = hac_hw_params, + }, }, #ifdef CONFIG_CPU_SUBTYPE_SH7760 { @@ -307,7 +305,9 @@ struct snd_soc_dai sh4_hac_dai[] = { .channels_min = 2, .channels_max = 2, }, - .ops = &hac_dai_ops, + .ops = { + .hw_params = hac_hw_params, + }, }, #endif diff --git a/trunk/sound/soc/soc-core.c b/trunk/sound/soc/soc-core.c index 6e710f705a74..16518329f6b2 100644 --- a/trunk/sound/soc/soc-core.c +++ b/trunk/sound/soc/soc-core.c @@ -1432,8 +1432,7 @@ void snd_soc_free_pcms(struct snd_soc_device *socdev) #ifdef CONFIG_SND_SOC_AC97_BUS for (i = 0; i < codec->num_dai; i++) { codec_dai = &codec->dai[i]; - if (codec_dai->ac97_control && codec->ac97 && - strcmp(codec->name, "AC97") != 0) { + if (codec_dai->ac97_control && codec->ac97) { soc_ac97_dev_unregister(codec); goto free_card; }