提交 e99a866c 编写于 作者: M Mark Brown

Merge remote-tracking branches 'asoc/topic/tlv320aic3x', 'asoc/topic/width',...

Merge remote-tracking branches 'asoc/topic/tlv320aic3x', 'asoc/topic/width', 'asoc/topic/wm0010', 'asoc/topic/wm8904' and 'asoc/topic/wm8962' into asoc-next
WM8904 audio CODEC
This device supports I2C only.
Required properties:
- compatible: "wlf,wm8904"
- reg: the I2C address of the device.
- clock-names: "mclk"
- clocks: reference to
<Documentation/devicetree/bindings/clock/clock-bindings.txt>
Pins on the device (for linking into audio routes):
* IN1L
* IN1R
* IN2L
* IN2R
* IN3L
* IN3R
* HPOUTL
* HPOUTR
* LINEOUTL
* LINEOUTR
* MICBIAS
Examples:
codec: wm8904@1a {
compatible = "wlf,wm8904";
reg = <0x1a>;
clocks = <&pck0>;
clock-names = "mclk";
};
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#define WM8962_GPIO_FN_MICSCD 22 #define WM8962_GPIO_FN_MICSCD 22
struct wm8962_pdata { struct wm8962_pdata {
struct clk *mclk;
int gpio_base; int gpio_base;
u32 gpio_init[WM8962_MAX_GPIO]; u32 gpio_init[WM8962_MAX_GPIO];
......
...@@ -945,11 +945,11 @@ static int pm860x_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -945,11 +945,11 @@ static int pm860x_pcm_hw_params(struct snd_pcm_substream *substream,
unsigned char inf = 0, mask = 0; unsigned char inf = 0, mask = 0;
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
inf &= ~PCM_INF2_18WL; inf &= ~PCM_INF2_18WL;
break; break;
case SNDRV_PCM_FORMAT_S18_3LE: case 18:
inf |= PCM_INF2_18WL; inf |= PCM_INF2_18WL;
break; break;
default: default:
...@@ -1044,11 +1044,11 @@ static int pm860x_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -1044,11 +1044,11 @@ static int pm860x_i2s_hw_params(struct snd_pcm_substream *substream,
unsigned char inf; unsigned char inf;
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
inf = 0; inf = 0;
break; break;
case SNDRV_PCM_FORMAT_S18_3LE: case 18:
inf = PCM_INF2_18WL; inf = PCM_INF2_18WL;
break; break;
default: default:
......
...@@ -359,14 +359,14 @@ static int adau17x1_hw_params(struct snd_pcm_substream *substream, ...@@ -359,14 +359,14 @@ static int adau17x1_hw_params(struct snd_pcm_substream *substream,
if (adau->dai_fmt != SND_SOC_DAIFMT_RIGHT_J) if (adau->dai_fmt != SND_SOC_DAIFMT_RIGHT_J)
return 0; return 0;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
val = ADAU17X1_SERIAL_PORT1_DELAY16; val = ADAU17X1_SERIAL_PORT1_DELAY16;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
val = ADAU17X1_SERIAL_PORT1_DELAY8; val = ADAU17X1_SERIAL_PORT1_DELAY8;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
val = ADAU17X1_SERIAL_PORT1_DELAY0; val = ADAU17X1_SERIAL_PORT1_DELAY0;
break; break;
default: default:
......
...@@ -1299,12 +1299,12 @@ static int max98088_dai2_hw_params(struct snd_pcm_substream *substream, ...@@ -1299,12 +1299,12 @@ static int max98088_dai2_hw_params(struct snd_pcm_substream *substream,
rate = params_rate(params); rate = params_rate(params);
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
snd_soc_update_bits(codec, M98088_REG_1C_DAI2_FORMAT, snd_soc_update_bits(codec, M98088_REG_1C_DAI2_FORMAT,
M98088_DAI_WS, 0); M98088_DAI_WS, 0);
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
snd_soc_update_bits(codec, M98088_REG_1C_DAI2_FORMAT, snd_soc_update_bits(codec, M98088_REG_1C_DAI2_FORMAT,
M98088_DAI_WS, M98088_DAI_WS); M98088_DAI_WS, M98088_DAI_WS);
break; break;
......
...@@ -1280,12 +1280,12 @@ static int max98095_dai2_hw_params(struct snd_pcm_substream *substream, ...@@ -1280,12 +1280,12 @@ static int max98095_dai2_hw_params(struct snd_pcm_substream *substream,
rate = params_rate(params); rate = params_rate(params);
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
snd_soc_update_bits(codec, M98095_034_DAI2_FORMAT, snd_soc_update_bits(codec, M98095_034_DAI2_FORMAT,
M98095_DAI_WS, 0); M98095_DAI_WS, 0);
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
snd_soc_update_bits(codec, M98095_034_DAI2_FORMAT, snd_soc_update_bits(codec, M98095_034_DAI2_FORMAT,
M98095_DAI_WS, M98095_DAI_WS); M98095_DAI_WS, M98095_DAI_WS);
break; break;
...@@ -1341,12 +1341,12 @@ static int max98095_dai3_hw_params(struct snd_pcm_substream *substream, ...@@ -1341,12 +1341,12 @@ static int max98095_dai3_hw_params(struct snd_pcm_substream *substream,
rate = params_rate(params); rate = params_rate(params);
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
snd_soc_update_bits(codec, M98095_03E_DAI3_FORMAT, snd_soc_update_bits(codec, M98095_03E_DAI3_FORMAT,
M98095_DAI_WS, 0); M98095_DAI_WS, 0);
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
snd_soc_update_bits(codec, M98095_03E_DAI3_FORMAT, snd_soc_update_bits(codec, M98095_03E_DAI3_FORMAT,
M98095_DAI_WS, M98095_DAI_WS); M98095_DAI_WS, M98095_DAI_WS);
break; break;
......
...@@ -1370,16 +1370,16 @@ static int rt5631_hifi_pcm_params(struct snd_pcm_substream *substream, ...@@ -1370,16 +1370,16 @@ static int rt5631_hifi_pcm_params(struct snd_pcm_substream *substream,
return coeff; return coeff;
} }
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
iface |= RT5631_SDP_I2S_DL_20; iface |= RT5631_SDP_I2S_DL_20;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
iface |= RT5631_SDP_I2S_DL_24; iface |= RT5631_SDP_I2S_DL_24;
break; break;
case SNDRV_PCM_FORMAT_S8: case 8:
iface |= RT5631_SDP_I2S_DL_8; iface |= RT5631_SDP_I2S_DL_8;
break; break;
default: default:
......
...@@ -1366,16 +1366,16 @@ static int rt5651_hw_params(struct snd_pcm_substream *substream, ...@@ -1366,16 +1366,16 @@ static int rt5651_hw_params(struct snd_pcm_substream *substream,
dev_dbg(dai->dev, "bclk_ms is %d and pre_div is %d for iis %d\n", dev_dbg(dai->dev, "bclk_ms is %d and pre_div is %d for iis %d\n",
bclk_ms, pre_div, dai->id); bclk_ms, pre_div, dai->id);
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
val_len |= RT5651_I2S_DL_20; val_len |= RT5651_I2S_DL_20;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
val_len |= RT5651_I2S_DL_24; val_len |= RT5651_I2S_DL_24;
break; break;
case SNDRV_PCM_FORMAT_S8: case 8:
val_len |= RT5651_I2S_DL_8; val_len |= RT5651_I2S_DL_8;
break; break;
default: default:
......
...@@ -724,25 +724,25 @@ static int sgtl5000_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -724,25 +724,25 @@ static int sgtl5000_pcm_hw_params(struct snd_pcm_substream *substream,
return ret; return ret;
/* set i2s data format */ /* set i2s data format */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
if (sgtl5000->fmt == SND_SOC_DAIFMT_RIGHT_J) if (sgtl5000->fmt == SND_SOC_DAIFMT_RIGHT_J)
return -EINVAL; return -EINVAL;
i2s_ctl |= SGTL5000_I2S_DLEN_16 << SGTL5000_I2S_DLEN_SHIFT; i2s_ctl |= SGTL5000_I2S_DLEN_16 << SGTL5000_I2S_DLEN_SHIFT;
i2s_ctl |= SGTL5000_I2S_SCLKFREQ_32FS << i2s_ctl |= SGTL5000_I2S_SCLKFREQ_32FS <<
SGTL5000_I2S_SCLKFREQ_SHIFT; SGTL5000_I2S_SCLKFREQ_SHIFT;
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
i2s_ctl |= SGTL5000_I2S_DLEN_20 << SGTL5000_I2S_DLEN_SHIFT; i2s_ctl |= SGTL5000_I2S_DLEN_20 << SGTL5000_I2S_DLEN_SHIFT;
i2s_ctl |= SGTL5000_I2S_SCLKFREQ_64FS << i2s_ctl |= SGTL5000_I2S_SCLKFREQ_64FS <<
SGTL5000_I2S_SCLKFREQ_SHIFT; SGTL5000_I2S_SCLKFREQ_SHIFT;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
i2s_ctl |= SGTL5000_I2S_DLEN_24 << SGTL5000_I2S_DLEN_SHIFT; i2s_ctl |= SGTL5000_I2S_DLEN_24 << SGTL5000_I2S_DLEN_SHIFT;
i2s_ctl |= SGTL5000_I2S_SCLKFREQ_64FS << i2s_ctl |= SGTL5000_I2S_SCLKFREQ_64FS <<
SGTL5000_I2S_SCLKFREQ_SHIFT; SGTL5000_I2S_SCLKFREQ_SHIFT;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
if (sgtl5000->fmt == SND_SOC_DAIFMT_RIGHT_J) if (sgtl5000->fmt == SND_SOC_DAIFMT_RIGHT_J)
return -EINVAL; return -EINVAL;
i2s_ctl |= SGTL5000_I2S_DLEN_32 << SGTL5000_I2S_DLEN_SHIFT; i2s_ctl |= SGTL5000_I2S_DLEN_32 << SGTL5000_I2S_DLEN_SHIFT;
......
...@@ -167,17 +167,17 @@ static int si476x_codec_hw_params(struct snd_pcm_substream *substream, ...@@ -167,17 +167,17 @@ static int si476x_codec_hw_params(struct snd_pcm_substream *substream,
return -EINVAL; return -EINVAL;
} }
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S8: case 8:
width = SI476X_PCM_FORMAT_S8; width = SI476X_PCM_FORMAT_S8;
break; break;
case SNDRV_PCM_FORMAT_S16_LE: case 16:
width = SI476X_PCM_FORMAT_S16_LE; width = SI476X_PCM_FORMAT_S16_LE;
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
width = SI476X_PCM_FORMAT_S20_3LE; width = SI476X_PCM_FORMAT_S20_3LE;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
width = SI476X_PCM_FORMAT_S24_LE; width = SI476X_PCM_FORMAT_S24_LE;
break; break;
default: default:
......
...@@ -661,12 +661,12 @@ static int sn95031_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -661,12 +661,12 @@ static int sn95031_pcm_hw_params(struct snd_pcm_substream *substream,
{ {
unsigned int format, rate; unsigned int format, rate;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
format = BIT(4)|BIT(5); format = BIT(4)|BIT(5);
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
format = 0; format = 0;
break; break;
default: default:
......
...@@ -361,11 +361,11 @@ static int ssm2518_hw_params(struct snd_pcm_substream *substream, ...@@ -361,11 +361,11 @@ static int ssm2518_hw_params(struct snd_pcm_substream *substream,
return -EINVAL; return -EINVAL;
if (ssm2518->right_j) { if (ssm2518->right_j) {
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
ctrl1 |= SSM2518_SAI_CTRL1_FMT_RJ_16BIT; ctrl1 |= SSM2518_SAI_CTRL1_FMT_RJ_16BIT;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
ctrl1 |= SSM2518_SAI_CTRL1_FMT_RJ_24BIT; ctrl1 |= SSM2518_SAI_CTRL1_FMT_RJ_24BIT;
break; break;
default: default:
......
...@@ -275,17 +275,17 @@ static int ssm2602_hw_params(struct snd_pcm_substream *substream, ...@@ -275,17 +275,17 @@ static int ssm2602_hw_params(struct snd_pcm_substream *substream,
regmap_write(ssm2602->regmap, SSM2602_SRATE, srate); regmap_write(ssm2602->regmap, SSM2602_SRATE, srate);
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
iface = 0x0; iface = 0x0;
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
iface = 0x4; iface = 0x4;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
iface = 0x8; iface = 0x8;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
iface = 0xc; iface = 0xc;
break; break;
default: default:
......
...@@ -678,15 +678,11 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream, ...@@ -678,15 +678,11 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream,
confb = snd_soc_read(codec, STA32X_CONFB); confb = snd_soc_read(codec, STA32X_CONFB);
confb &= ~(STA32X_CONFB_SAI_MASK | STA32X_CONFB_SAIFB); confb &= ~(STA32X_CONFB_SAI_MASK | STA32X_CONFB_SAIFB);
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S24_LE: case 24:
case SNDRV_PCM_FORMAT_S24_BE:
case SNDRV_PCM_FORMAT_S24_3LE:
case SNDRV_PCM_FORMAT_S24_3BE:
pr_debug("24bit\n"); pr_debug("24bit\n");
/* fall through */ /* fall through */
case SNDRV_PCM_FORMAT_S32_LE: case 32:
case SNDRV_PCM_FORMAT_S32_BE:
pr_debug("24bit or 32bit\n"); pr_debug("24bit or 32bit\n");
switch (sta32x->format) { switch (sta32x->format) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
...@@ -701,8 +697,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream, ...@@ -701,8 +697,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream,
} }
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
case SNDRV_PCM_FORMAT_S20_3BE:
pr_debug("20bit\n"); pr_debug("20bit\n");
switch (sta32x->format) { switch (sta32x->format) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
...@@ -717,8 +712,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream, ...@@ -717,8 +712,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream,
} }
break; break;
case SNDRV_PCM_FORMAT_S18_3LE: case 18:
case SNDRV_PCM_FORMAT_S18_3BE:
pr_debug("18bit\n"); pr_debug("18bit\n");
switch (sta32x->format) { switch (sta32x->format) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
...@@ -733,8 +727,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream, ...@@ -733,8 +727,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream,
} }
break; break;
case SNDRV_PCM_FORMAT_S16_LE: case 16:
case SNDRV_PCM_FORMAT_S16_BE:
pr_debug("16bit\n"); pr_debug("16bit\n");
switch (sta32x->format) { switch (sta32x->format) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
......
...@@ -197,16 +197,16 @@ static int sta529_hw_params(struct snd_pcm_substream *substream, ...@@ -197,16 +197,16 @@ static int sta529_hw_params(struct snd_pcm_substream *substream,
int pdata, play_freq_val, record_freq_val; int pdata, play_freq_val, record_freq_val;
int bclk_to_fs_ratio; int bclk_to_fs_ratio;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
pdata = 1; pdata = 1;
bclk_to_fs_ratio = 0; bclk_to_fs_ratio = 0;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
pdata = 2; pdata = 2;
bclk_to_fs_ratio = 1; bclk_to_fs_ratio = 1;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
pdata = 3; pdata = 3;
bclk_to_fs_ratio = 2; bclk_to_fs_ratio = 2;
break; break;
......
...@@ -425,14 +425,14 @@ static int tas5086_hw_params(struct snd_pcm_substream *substream, ...@@ -425,14 +425,14 @@ static int tas5086_hw_params(struct snd_pcm_substream *substream,
} }
/* ... then add the offset for the sample bit depth. */ /* ... then add the offset for the sample bit depth. */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
val += 0; val += 0;
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
val += 1; val += 1;
break; break;
case SNDRV_PCM_FORMAT_S24_3LE: case 24:
val += 2; val += 2;
break; break;
default: default:
......
...@@ -71,8 +71,8 @@ static int aic26_hw_params(struct snd_pcm_substream *substream, ...@@ -71,8 +71,8 @@ static int aic26_hw_params(struct snd_pcm_substream *substream,
dev_dbg(&aic26->spi->dev, "aic26_hw_params(substream=%p, params=%p)\n", dev_dbg(&aic26->spi->dev, "aic26_hw_params(substream=%p, params=%p)\n",
substream, params); substream, params);
dev_dbg(&aic26->spi->dev, "rate=%i format=%i\n", params_rate(params), dev_dbg(&aic26->spi->dev, "rate=%i width=%d\n", params_rate(params),
params_format(params)); params_width(params));
switch (params_rate(params)) { switch (params_rate(params)) {
case 8000: fsref = 48000; divisor = AIC26_DIV_6; break; case 8000: fsref = 48000; divisor = AIC26_DIV_6; break;
...@@ -89,11 +89,11 @@ static int aic26_hw_params(struct snd_pcm_substream *substream, ...@@ -89,11 +89,11 @@ static int aic26_hw_params(struct snd_pcm_substream *substream,
} }
/* select data word length */ /* select data word length */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S8: wlen = AIC26_WLEN_16; break; case 8: wlen = AIC26_WLEN_16; break;
case SNDRV_PCM_FORMAT_S16_BE: wlen = AIC26_WLEN_16; break; case 16: wlen = AIC26_WLEN_16; break;
case SNDRV_PCM_FORMAT_S24_BE: wlen = AIC26_WLEN_24; break; case 24: wlen = AIC26_WLEN_24; break;
case SNDRV_PCM_FORMAT_S32_BE: wlen = AIC26_WLEN_32; break; case 32: wlen = AIC26_WLEN_32; break;
default: default:
dev_dbg(&aic26->spi->dev, "bad format\n"); return -EINVAL; dev_dbg(&aic26->spi->dev, "bad format\n"); return -EINVAL;
} }
......
...@@ -760,8 +760,8 @@ static int aic31xx_hw_params(struct snd_pcm_substream *substream, ...@@ -760,8 +760,8 @@ static int aic31xx_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_codec *codec = dai->codec; struct snd_soc_codec *codec = dai->codec;
u8 data = 0; u8 data = 0;
dev_dbg(codec->dev, "## %s: format %d width %d rate %d\n", dev_dbg(codec->dev, "## %s: width %d rate %d\n",
__func__, params_format(params), params_width(params), __func__, params_width(params),
params_rate(params)); params_rate(params));
switch (params_width(params)) { switch (params_width(params)) {
...@@ -780,8 +780,8 @@ static int aic31xx_hw_params(struct snd_pcm_substream *substream, ...@@ -780,8 +780,8 @@ static int aic31xx_hw_params(struct snd_pcm_substream *substream,
AIC31XX_IFACE1_DATALEN_SHIFT); AIC31XX_IFACE1_DATALEN_SHIFT);
break; break;
default: default:
dev_err(codec->dev, "%s: Unsupported format %d\n", dev_err(codec->dev, "%s: Unsupported width %d\n",
__func__, params_format(params)); __func__, params_width(params));
return -EINVAL; return -EINVAL;
} }
......
...@@ -450,16 +450,16 @@ static int aic32x4_hw_params(struct snd_pcm_substream *substream, ...@@ -450,16 +450,16 @@ static int aic32x4_hw_params(struct snd_pcm_substream *substream,
data = snd_soc_read(codec, AIC32X4_IFACE1); data = snd_soc_read(codec, AIC32X4_IFACE1);
data = data & ~(3 << 4); data = data & ~(3 << 4);
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
data |= (AIC32X4_WORD_LEN_20BITS << AIC32X4_DOSRMSB_SHIFT); data |= (AIC32X4_WORD_LEN_20BITS << AIC32X4_DOSRMSB_SHIFT);
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
data |= (AIC32X4_WORD_LEN_24BITS << AIC32X4_DOSRMSB_SHIFT); data |= (AIC32X4_WORD_LEN_24BITS << AIC32X4_DOSRMSB_SHIFT);
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
data |= (AIC32X4_WORD_LEN_32BITS << AIC32X4_DOSRMSB_SHIFT); data |= (AIC32X4_WORD_LEN_32BITS << AIC32X4_DOSRMSB_SHIFT);
break; break;
} }
......
...@@ -873,16 +873,16 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream, ...@@ -873,16 +873,16 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream,
/* select data word length */ /* select data word length */
data = snd_soc_read(codec, AIC3X_ASD_INTF_CTRLB) & (~(0x3 << 4)); data = snd_soc_read(codec, AIC3X_ASD_INTF_CTRLB) & (~(0x3 << 4));
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
data |= (0x01 << 4); data |= (0x01 << 4);
break; break;
case SNDRV_PCM_FORMAT_S24_3LE: case 24:
data |= (0x02 << 4); data |= (0x02 << 4);
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
data |= (0x03 << 4); data |= (0x03 << 4);
break; break;
} }
...@@ -1194,7 +1194,8 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec, ...@@ -1194,7 +1194,8 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec,
#define AIC3X_RATES SNDRV_PCM_RATE_8000_96000 #define AIC3X_RATES SNDRV_PCM_RATE_8000_96000
#define AIC3X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ #define AIC3X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S24_LE | \
SNDRV_PCM_FMTBIT_S32_LE)
static const struct snd_soc_dai_ops aic3x_dai_ops = { static const struct snd_soc_dai_ops aic3x_dai_ops = {
.hw_params = aic3x_hw_params, .hw_params = aic3x_hw_params,
......
...@@ -832,18 +832,18 @@ static int dac33_hw_params(struct snd_pcm_substream *substream, ...@@ -832,18 +832,18 @@ static int dac33_hw_params(struct snd_pcm_substream *substream,
return -EINVAL; return -EINVAL;
} }
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
dac33->fifo_size = DAC33_FIFO_SIZE_16BIT; dac33->fifo_size = DAC33_FIFO_SIZE_16BIT;
dac33->burst_rate = CALC_BURST_RATE(dac33->burst_bclkdiv, 32); dac33->burst_rate = CALC_BURST_RATE(dac33->burst_bclkdiv, 32);
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
dac33->fifo_size = DAC33_FIFO_SIZE_24BIT; dac33->fifo_size = DAC33_FIFO_SIZE_24BIT;
dac33->burst_rate = CALC_BURST_RATE(dac33->burst_bclkdiv, 64); dac33->burst_rate = CALC_BURST_RATE(dac33->burst_bclkdiv, 64);
break; break;
default: default:
dev_err(codec->dev, "unsupported format %d\n", dev_err(codec->dev, "unsupported width %d\n",
params_format(params)); params_width(params));
return -EINVAL; return -EINVAL;
} }
......
...@@ -1763,16 +1763,16 @@ static int twl4030_hw_params(struct snd_pcm_substream *substream, ...@@ -1763,16 +1763,16 @@ static int twl4030_hw_params(struct snd_pcm_substream *substream,
old_format = twl4030_read(codec, TWL4030_REG_AUDIO_IF); old_format = twl4030_read(codec, TWL4030_REG_AUDIO_IF);
format = old_format; format = old_format;
format &= ~TWL4030_DATA_WIDTH; format &= ~TWL4030_DATA_WIDTH;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
format |= TWL4030_DATA_WIDTH_16S_16W; format |= TWL4030_DATA_WIDTH_16S_16W;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
format |= TWL4030_DATA_WIDTH_32S_24W; format |= TWL4030_DATA_WIDTH_32S_24W;
break; break;
default: default:
dev_err(codec->dev, "%s: unknown format %d\n", __func__, dev_err(codec->dev, "%s: unsupported bits/sample %d\n",
params_format(params)); __func__, params_width(params));
return -EINVAL; return -EINVAL;
} }
......
...@@ -243,14 +243,14 @@ static int uda134x_hw_params(struct snd_pcm_substream *substream, ...@@ -243,14 +243,14 @@ static int uda134x_hw_params(struct snd_pcm_substream *substream,
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
break; break;
case SND_SOC_DAIFMT_RIGHT_J: case SND_SOC_DAIFMT_RIGHT_J:
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
hw_params |= (1<<1); hw_params |= (1<<1);
break; break;
case SNDRV_PCM_FORMAT_S18_3LE: case 18:
hw_params |= (1<<2); hw_params |= (1<<2);
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
hw_params |= ((1<<2) | (1<<1)); hw_params |= ((1<<2) | (1<<1));
break; break;
default: default:
......
...@@ -341,8 +341,9 @@ static int wl1273_hw_params(struct snd_pcm_substream *substream, ...@@ -341,8 +341,9 @@ static int wl1273_hw_params(struct snd_pcm_substream *substream,
struct wl1273_core *core = wl1273->core; struct wl1273_core *core = wl1273->core;
unsigned int rate, width, r; unsigned int rate, width, r;
if (params_format(params) != SNDRV_PCM_FORMAT_S16_LE) { if (params_width(params) != 16) {
pr_err("Only SNDRV_PCM_FORMAT_S16_LE supported.\n"); dev_err(dai->dev, "%d bits/sample not supported\n",
params_width(params));
return -EINVAL; return -EINVAL;
} }
......
...@@ -144,7 +144,7 @@ static const struct snd_soc_dapm_route wm0010_dapm_routes[] = { ...@@ -144,7 +144,7 @@ static const struct snd_soc_dapm_route wm0010_dapm_routes[] = {
static const char *wm0010_state_to_str(enum wm0010_state state) static const char *wm0010_state_to_str(enum wm0010_state state)
{ {
const char *state_to_str[] = { static const char * const state_to_str[] = {
"Power off", "Power off",
"Out of reset", "Out of reset",
"Boot ROM", "Boot ROM",
......
...@@ -918,16 +918,16 @@ static int wm8350_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -918,16 +918,16 @@ static int wm8350_pcm_hw_params(struct snd_pcm_substream *substream,
~WM8350_AIF_WL_MASK; ~WM8350_AIF_WL_MASK;
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
iface |= 0x1 << 10; iface |= 0x1 << 10;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
iface |= 0x2 << 10; iface |= 0x2 << 10;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
iface |= 0x3 << 10; iface |= 0x3 << 10;
break; break;
} }
......
...@@ -1095,16 +1095,16 @@ static int wm8400_hw_params(struct snd_pcm_substream *substream, ...@@ -1095,16 +1095,16 @@ static int wm8400_hw_params(struct snd_pcm_substream *substream,
audio1 &= ~WM8400_AIF_WL_MASK; audio1 &= ~WM8400_AIF_WL_MASK;
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
audio1 |= WM8400_AIF_WL_20BITS; audio1 |= WM8400_AIF_WL_20BITS;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
audio1 |= WM8400_AIF_WL_24BITS; audio1 |= WM8400_AIF_WL_24BITS;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
audio1 |= WM8400_AIF_WL_32BITS; audio1 |= WM8400_AIF_WL_32BITS;
break; break;
} }
......
...@@ -449,16 +449,16 @@ static int wm8510_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -449,16 +449,16 @@ static int wm8510_pcm_hw_params(struct snd_pcm_substream *substream,
u16 adn = snd_soc_read(codec, WM8510_ADD) & 0x1f1; u16 adn = snd_soc_read(codec, WM8510_ADD) & 0x1f1;
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
iface |= 0x0020; iface |= 0x0020;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
iface |= 0x0040; iface |= 0x0040;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
iface |= 0x0060; iface |= 0x0060;
break; break;
} }
......
...@@ -163,16 +163,16 @@ static int wm8523_hw_params(struct snd_pcm_substream *substream, ...@@ -163,16 +163,16 @@ static int wm8523_hw_params(struct snd_pcm_substream *substream,
aifctrl2 |= lrclk_ratios[i].value; aifctrl2 |= lrclk_ratios[i].value;
aifctrl1 &= ~WM8523_WL_MASK; aifctrl1 &= ~WM8523_WL_MASK;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
aifctrl1 |= 0x8; aifctrl1 |= 0x8;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
aifctrl1 |= 0x10; aifctrl1 |= 0x10;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
aifctrl1 |= 0x18; aifctrl1 |= 0x18;
break; break;
} }
......
...@@ -511,19 +511,19 @@ static int wm8580_paif_hw_params(struct snd_pcm_substream *substream, ...@@ -511,19 +511,19 @@ static int wm8580_paif_hw_params(struct snd_pcm_substream *substream,
int i, ratio, osr; int i, ratio, osr;
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
paifa |= 0x8; paifa |= 0x8;
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
paifa |= 0x0; paifa |= 0x0;
paifb |= WM8580_AIF_LENGTH_20; paifb |= WM8580_AIF_LENGTH_20;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
paifa |= 0x0; paifa |= 0x0;
paifb |= WM8580_AIF_LENGTH_24; paifb |= WM8580_AIF_LENGTH_24;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
paifa |= 0x0; paifa |= 0x0;
paifb |= WM8580_AIF_LENGTH_32; paifb |= WM8580_AIF_LENGTH_32;
break; break;
......
...@@ -169,13 +169,13 @@ static int wm8711_hw_params(struct snd_pcm_substream *substream, ...@@ -169,13 +169,13 @@ static int wm8711_hw_params(struct snd_pcm_substream *substream,
snd_soc_write(codec, WM8711_SRATE, srate); snd_soc_write(codec, WM8711_SRATE, srate);
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
iface |= 0x0004; iface |= 0x0004;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
iface |= 0x0008; iface |= 0x0008;
break; break;
} }
......
...@@ -94,13 +94,13 @@ static int wm8728_hw_params(struct snd_pcm_substream *substream, ...@@ -94,13 +94,13 @@ static int wm8728_hw_params(struct snd_pcm_substream *substream,
dac &= ~0x18; dac &= ~0x18;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
dac |= 0x10; dac |= 0x10;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
dac |= 0x08; dac |= 0x08;
break; break;
default: default:
......
...@@ -348,13 +348,13 @@ static int wm8731_hw_params(struct snd_pcm_substream *substream, ...@@ -348,13 +348,13 @@ static int wm8731_hw_params(struct snd_pcm_substream *substream,
snd_soc_write(codec, WM8731_SRATE, srate); snd_soc_write(codec, WM8731_SRATE, srate);
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
iface |= 0x0004; iface |= 0x0004;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
iface |= 0x0008; iface |= 0x0008;
break; break;
} }
......
...@@ -367,16 +367,16 @@ static int wm8737_hw_params(struct snd_pcm_substream *substream, ...@@ -367,16 +367,16 @@ static int wm8737_hw_params(struct snd_pcm_substream *substream,
clocking |= coeff_div[i].usb | (coeff_div[i].sr << WM8737_SR_SHIFT); clocking |= coeff_div[i].usb | (coeff_div[i].sr << WM8737_SR_SHIFT);
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
af |= 0x8; af |= 0x8;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
af |= 0x10; af |= 0x10;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
af |= 0x18; af |= 0x18;
break; break;
default: default:
......
...@@ -241,26 +241,26 @@ static int wm8741_hw_params(struct snd_pcm_substream *substream, ...@@ -241,26 +241,26 @@ static int wm8741_hw_params(struct snd_pcm_substream *substream,
} }
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
iface |= 0x0001; iface |= 0x0001;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
iface |= 0x0002; iface |= 0x0002;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
iface |= 0x0003; iface |= 0x0003;
break; break;
default: default:
dev_dbg(codec->dev, "wm8741_hw_params: Unsupported bit size param = %d", dev_dbg(codec->dev, "wm8741_hw_params: Unsupported bit size param = %d",
params_format(params)); params_width(params));
return -EINVAL; return -EINVAL;
} }
dev_dbg(codec->dev, "wm8741_hw_params: bit size param = %d", dev_dbg(codec->dev, "wm8741_hw_params: bit size param = %d",
params_format(params)); params_width(params));
snd_soc_write(codec, WM8741_FORMAT_CONTROL, iface); snd_soc_write(codec, WM8741_FORMAT_CONTROL, iface);
return 0; return 0;
......
...@@ -586,16 +586,16 @@ static int wm8750_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -586,16 +586,16 @@ static int wm8750_pcm_hw_params(struct snd_pcm_substream *substream,
int coeff = get_coeff(wm8750->sysclk, params_rate(params)); int coeff = get_coeff(wm8750->sysclk, params_rate(params));
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
iface |= 0x0004; iface |= 0x0004;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
iface |= 0x0008; iface |= 0x0008;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
iface |= 0x000c; iface |= 0x000c;
break; break;
} }
......
...@@ -937,16 +937,16 @@ static int wm8753_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -937,16 +937,16 @@ static int wm8753_pcm_hw_params(struct snd_pcm_substream *substream,
u16 srate = snd_soc_read(codec, WM8753_SRATE1) & 0x017f; u16 srate = snd_soc_read(codec, WM8753_SRATE1) & 0x017f;
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
voice |= 0x0004; voice |= 0x0004;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
voice |= 0x0008; voice |= 0x0008;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
voice |= 0x000c; voice |= 0x000c;
break; break;
} }
...@@ -1176,16 +1176,16 @@ static int wm8753_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -1176,16 +1176,16 @@ static int wm8753_i2s_hw_params(struct snd_pcm_substream *substream,
coeff_div[coeff].usb); coeff_div[coeff].usb);
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
hifi |= 0x0004; hifi |= 0x0004;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
hifi |= 0x0008; hifi |= 0x0008;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
hifi |= 0x000c; hifi |= 0x000c;
break; break;
} }
......
...@@ -426,16 +426,16 @@ static int wm8770_hw_params(struct snd_pcm_substream *substream, ...@@ -426,16 +426,16 @@ static int wm8770_hw_params(struct snd_pcm_substream *substream,
wm8770 = snd_soc_codec_get_drvdata(codec); wm8770 = snd_soc_codec_get_drvdata(codec);
iface = 0; iface = 0;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
iface |= 0x10; iface |= 0x10;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
iface |= 0x20; iface |= 0x20;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
iface |= 0x30; iface |= 0x30;
break; break;
} }
......
...@@ -270,19 +270,19 @@ static int wm8804_hw_params(struct snd_pcm_substream *substream, ...@@ -270,19 +270,19 @@ static int wm8804_hw_params(struct snd_pcm_substream *substream,
codec = dai->codec; codec = dai->codec;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
blen = 0x0; blen = 0x0;
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
blen = 0x1; blen = 0x1;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
blen = 0x2; blen = 0x2;
break; break;
default: default:
dev_err(dai->dev, "Unsupported word length: %u\n", dev_err(dai->dev, "Unsupported word length: %u\n",
params_format(params)); params_width(params));
return -EINVAL; return -EINVAL;
} }
......
...@@ -640,16 +640,16 @@ static int wm8900_hw_params(struct snd_pcm_substream *substream, ...@@ -640,16 +640,16 @@ static int wm8900_hw_params(struct snd_pcm_substream *substream,
reg = snd_soc_read(codec, WM8900_REG_AUDIO1) & ~0x60; reg = snd_soc_read(codec, WM8900_REG_AUDIO1) & ~0x60;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
reg |= 0x20; reg |= 0x20;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
reg |= 0x40; reg |= 0x40;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
reg |= 0x60; reg |= 0x60;
break; break;
default: default:
......
...@@ -1476,19 +1476,19 @@ static int wm8903_hw_params(struct snd_pcm_substream *substream, ...@@ -1476,19 +1476,19 @@ static int wm8903_hw_params(struct snd_pcm_substream *substream,
aif1 &= ~WM8903_AIF_WL_MASK; aif1 &= ~WM8903_AIF_WL_MASK;
bclk = 2 * fs; bclk = 2 * fs;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
bclk *= 16; bclk *= 16;
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
bclk *= 20; bclk *= 20;
aif1 |= 0x4; aif1 |= 0x4;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
bclk *= 24; bclk *= 24;
aif1 |= 0x8; aif1 |= 0x8;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
bclk *= 32; bclk *= 32;
aif1 |= 0xc; aif1 |= 0xc;
break; break;
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/clk.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -49,6 +50,7 @@ static const char *wm8904_supply_names[WM8904_NUM_SUPPLIES] = { ...@@ -49,6 +50,7 @@ static const char *wm8904_supply_names[WM8904_NUM_SUPPLIES] = {
/* codec private data */ /* codec private data */
struct wm8904_priv { struct wm8904_priv {
struct regmap *regmap; struct regmap *regmap;
struct clk *mclk;
enum wm8904_type devtype; enum wm8904_type devtype;
...@@ -1290,16 +1292,16 @@ static int wm8904_hw_params(struct snd_pcm_substream *substream, ...@@ -1290,16 +1292,16 @@ static int wm8904_hw_params(struct snd_pcm_substream *substream,
wm8904->bclk = snd_soc_params_to_bclk(params); wm8904->bclk = snd_soc_params_to_bclk(params);
} }
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
aif1 |= 0x40; aif1 |= 0x40;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
aif1 |= 0x80; aif1 |= 0x80;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
aif1 |= 0xc0; aif1 |= 0xc0;
break; break;
default: default:
...@@ -1828,6 +1830,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec, ...@@ -1828,6 +1830,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
switch (level) { switch (level) {
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
clk_prepare_enable(wm8904->mclk);
break; break;
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
...@@ -1894,6 +1897,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec, ...@@ -1894,6 +1897,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
regulator_bulk_disable(ARRAY_SIZE(wm8904->supplies), regulator_bulk_disable(ARRAY_SIZE(wm8904->supplies),
wm8904->supplies); wm8904->supplies);
clk_disable_unprepare(wm8904->mclk);
break; break;
} }
codec->dapm.bias_level = level; codec->dapm.bias_level = level;
...@@ -2106,6 +2110,13 @@ static int wm8904_i2c_probe(struct i2c_client *i2c, ...@@ -2106,6 +2110,13 @@ static int wm8904_i2c_probe(struct i2c_client *i2c,
if (wm8904 == NULL) if (wm8904 == NULL)
return -ENOMEM; return -ENOMEM;
wm8904->mclk = devm_clk_get(&i2c->dev, "mclk");
if (IS_ERR(wm8904->mclk)) {
ret = PTR_ERR(wm8904->mclk);
dev_err(&i2c->dev, "Failed to get MCLK\n");
return ret;
}
wm8904->regmap = devm_regmap_init_i2c(i2c, &wm8904_regmap); wm8904->regmap = devm_regmap_init_i2c(i2c, &wm8904_regmap);
if (IS_ERR(wm8904->regmap)) { if (IS_ERR(wm8904->regmap)) {
ret = PTR_ERR(wm8904->regmap); ret = PTR_ERR(wm8904->regmap);
......
...@@ -430,19 +430,19 @@ static int wm8940_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -430,19 +430,19 @@ static int wm8940_i2s_hw_params(struct snd_pcm_substream *substream,
if (ret) if (ret)
goto error_ret; goto error_ret;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S8: case 8:
companding = companding | (1 << 5); companding = companding | (1 << 5);
break; break;
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
iface |= (1 << 5); iface |= (1 << 5);
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
iface |= (2 << 5); iface |= (2 << 5);
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
iface |= (3 << 5); iface |= (3 << 5);
break; break;
} }
......
...@@ -597,17 +597,17 @@ static int wm8955_hw_params(struct snd_pcm_substream *substream, ...@@ -597,17 +597,17 @@ static int wm8955_hw_params(struct snd_pcm_substream *substream,
int ret; int ret;
int wl; int wl;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
wl = 0; wl = 0;
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
wl = 0x4; wl = 0x4;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
wl = 0x8; wl = 0x8;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
wl = 0xc; wl = 0xc;
break; break;
default: default:
......
...@@ -567,24 +567,21 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream, ...@@ -567,24 +567,21 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_codec *codec = dai->codec; struct snd_soc_codec *codec = dai->codec;
struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec);
u16 iface = snd_soc_read(codec, WM8960_IFACE1) & 0xfff3; u16 iface = snd_soc_read(codec, WM8960_IFACE1) & 0xfff3;
snd_pcm_format_t format = params_format(params);
int i; int i;
/* bit size */ /* bit size */
switch (format) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
case SNDRV_PCM_FORMAT_S16_BE:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
case SNDRV_PCM_FORMAT_S20_3BE:
iface |= 0x0004; iface |= 0x0004;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
case SNDRV_PCM_FORMAT_S24_BE:
iface |= 0x0008; iface |= 0x0008;
break; break;
default: default:
dev_err(codec->dev, "unsupported format %i\n", format); dev_err(codec->dev, "unsupported width %d\n",
params_width(params));
return -EINVAL; return -EINVAL;
} }
......
...@@ -565,16 +565,16 @@ static int wm8961_hw_params(struct snd_pcm_substream *substream, ...@@ -565,16 +565,16 @@ static int wm8961_hw_params(struct snd_pcm_substream *substream,
reg = snd_soc_read(codec, WM8961_AUDIO_INTERFACE_0); reg = snd_soc_read(codec, WM8961_AUDIO_INTERFACE_0);
reg &= ~WM8961_WL_MASK; reg &= ~WM8961_WL_MASK;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
reg |= 1 << WM8961_WL_SHIFT; reg |= 1 << WM8961_WL_SHIFT;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
reg |= 2 << WM8961_WL_SHIFT; reg |= 2 << WM8961_WL_SHIFT;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
reg |= 3 << WM8961_WL_SHIFT; reg |= 3 << WM8961_WL_SHIFT;
break; break;
default: default:
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/clk.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/gcd.h> #include <linux/gcd.h>
...@@ -2586,16 +2587,16 @@ static int wm8962_hw_params(struct snd_pcm_substream *substream, ...@@ -2586,16 +2587,16 @@ static int wm8962_hw_params(struct snd_pcm_substream *substream,
if (wm8962->lrclk % 8000 == 0) if (wm8962->lrclk % 8000 == 0)
adctl3 |= WM8962_SAMPLE_RATE_INT_MODE; adctl3 |= WM8962_SAMPLE_RATE_INT_MODE;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
aif0 |= 0x4; aif0 |= 0x4;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
aif0 |= 0x8; aif0 |= 0x8;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
aif0 |= 0xc; aif0 |= 0xc;
break; break;
default: default:
...@@ -3541,6 +3542,8 @@ static int wm8962_set_pdata_from_of(struct i2c_client *i2c, ...@@ -3541,6 +3542,8 @@ static int wm8962_set_pdata_from_of(struct i2c_client *i2c,
pdata->gpio_init[i] = 0x0; pdata->gpio_init[i] = 0x0;
} }
pdata->mclk = devm_clk_get(&i2c->dev, NULL);
return 0; return 0;
} }
...@@ -3572,6 +3575,14 @@ static int wm8962_i2c_probe(struct i2c_client *i2c, ...@@ -3572,6 +3575,14 @@ static int wm8962_i2c_probe(struct i2c_client *i2c,
return ret; return ret;
} }
/* Mark the mclk pointer to NULL if no mclk assigned */
if (IS_ERR(wm8962->pdata.mclk)) {
/* But do not ignore the request for probe defer */
if (PTR_ERR(wm8962->pdata.mclk) == -EPROBE_DEFER)
return -EPROBE_DEFER;
wm8962->pdata.mclk = NULL;
}
for (i = 0; i < ARRAY_SIZE(wm8962->supplies); i++) for (i = 0; i < ARRAY_SIZE(wm8962->supplies); i++)
wm8962->supplies[i].supply = wm8962_supply_names[i]; wm8962->supplies[i].supply = wm8962_supply_names[i];
...@@ -3780,6 +3791,12 @@ static int wm8962_runtime_resume(struct device *dev) ...@@ -3780,6 +3791,12 @@ static int wm8962_runtime_resume(struct device *dev)
struct wm8962_priv *wm8962 = dev_get_drvdata(dev); struct wm8962_priv *wm8962 = dev_get_drvdata(dev);
int ret; int ret;
ret = clk_prepare_enable(wm8962->pdata.mclk);
if (ret) {
dev_err(dev, "Failed to enable MCLK: %d\n", ret);
return ret;
}
ret = regulator_bulk_enable(ARRAY_SIZE(wm8962->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(wm8962->supplies),
wm8962->supplies); wm8962->supplies);
if (ret != 0) { if (ret != 0) {
...@@ -3839,6 +3856,8 @@ static int wm8962_runtime_suspend(struct device *dev) ...@@ -3839,6 +3856,8 @@ static int wm8962_runtime_suspend(struct device *dev)
regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies),
wm8962->supplies); wm8962->supplies);
clk_disable_unprepare(wm8962->pdata.mclk);
return 0; return 0;
} }
#endif #endif
......
...@@ -517,16 +517,16 @@ static int wm8971_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -517,16 +517,16 @@ static int wm8971_pcm_hw_params(struct snd_pcm_substream *substream,
int coeff = get_coeff(wm8971->sysclk, params_rate(params)); int coeff = get_coeff(wm8971->sysclk, params_rate(params));
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
iface |= 0x0004; iface |= 0x0004;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
iface |= 0x0008; iface |= 0x0008;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
iface |= 0x000c; iface |= 0x000c;
break; break;
} }
......
...@@ -445,16 +445,16 @@ static int wm8974_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -445,16 +445,16 @@ static int wm8974_pcm_hw_params(struct snd_pcm_substream *substream,
u16 adn = snd_soc_read(codec, WM8974_ADD) & 0x1f1; u16 adn = snd_soc_read(codec, WM8974_ADD) & 0x1f1;
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
iface |= 0x0020; iface |= 0x0020;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
iface |= 0x0040; iface |= 0x0040;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
iface |= 0x0060; iface |= 0x0060;
break; break;
} }
......
...@@ -736,16 +736,16 @@ static int wm8978_hw_params(struct snd_pcm_substream *substream, ...@@ -736,16 +736,16 @@ static int wm8978_hw_params(struct snd_pcm_substream *substream,
return -EINVAL; return -EINVAL;
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
iface_ctl |= 0x20; iface_ctl |= 0x20;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
iface_ctl |= 0x40; iface_ctl |= 0x40;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
iface_ctl |= 0x60; iface_ctl |= 0x60;
break; break;
} }
...@@ -817,8 +817,8 @@ static int wm8978_hw_params(struct snd_pcm_substream *substream, ...@@ -817,8 +817,8 @@ static int wm8978_hw_params(struct snd_pcm_substream *substream,
wm8978->sysclk == WM8978_MCLK ? wm8978->sysclk == WM8978_MCLK ?
", consider using PLL" : ""); ", consider using PLL" : "");
dev_dbg(codec->dev, "%s: fmt %d, rate %u, MCLK divisor #%d\n", __func__, dev_dbg(codec->dev, "%s: width %d, rate %u, MCLK divisor #%d\n", __func__,
params_format(params), params_rate(params), best); params_width(params), params_rate(params), best);
/* MCLK divisor mask = 0xe0 */ /* MCLK divisor mask = 0xe0 */
snd_soc_update_bits(codec, WM8978_CLOCKING, 0xe0, best << 5); snd_soc_update_bits(codec, WM8978_CLOCKING, 0xe0, best << 5);
......
...@@ -719,22 +719,22 @@ static int wm8983_hw_params(struct snd_pcm_substream *substream, ...@@ -719,22 +719,22 @@ static int wm8983_hw_params(struct snd_pcm_substream *substream,
wm8983->bclk = ret; wm8983->bclk = ret;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
blen = 0x0; blen = 0x0;
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
blen = 0x1; blen = 0x1;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
blen = 0x2; blen = 0x2;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
blen = 0x3; blen = 0x3;
break; break;
default: default:
dev_err(dai->dev, "Unsupported word length %u\n", dev_err(dai->dev, "Unsupported word length %u\n",
params_format(params)); params_width(params));
return -EINVAL; return -EINVAL;
} }
......
...@@ -698,22 +698,22 @@ static int wm8985_hw_params(struct snd_pcm_substream *substream, ...@@ -698,22 +698,22 @@ static int wm8985_hw_params(struct snd_pcm_substream *substream,
if ((int)wm8985->bclk < 0) if ((int)wm8985->bclk < 0)
return wm8985->bclk; return wm8985->bclk;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
blen = 0x0; blen = 0x0;
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
blen = 0x1; blen = 0x1;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
blen = 0x2; blen = 0x2;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
blen = 0x3; blen = 0x3;
break; break;
default: default:
dev_err(dai->dev, "Unsupported word length %u\n", dev_err(dai->dev, "Unsupported word length %u\n",
params_format(params)); params_width(params));
return -EINVAL; return -EINVAL;
} }
......
...@@ -687,16 +687,16 @@ static int wm8988_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -687,16 +687,16 @@ static int wm8988_pcm_hw_params(struct snd_pcm_substream *substream,
} }
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
iface |= 0x0004; iface |= 0x0004;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
iface |= 0x0008; iface |= 0x0008;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
iface |= 0x000c; iface |= 0x000c;
break; break;
} }
......
...@@ -1073,16 +1073,16 @@ static int wm8990_hw_params(struct snd_pcm_substream *substream, ...@@ -1073,16 +1073,16 @@ static int wm8990_hw_params(struct snd_pcm_substream *substream,
audio1 &= ~WM8990_AIF_WL_MASK; audio1 &= ~WM8990_AIF_WL_MASK;
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
audio1 |= WM8990_AIF_WL_20BITS; audio1 |= WM8990_AIF_WL_20BITS;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
audio1 |= WM8990_AIF_WL_24BITS; audio1 |= WM8990_AIF_WL_24BITS;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
audio1 |= WM8990_AIF_WL_32BITS; audio1 |= WM8990_AIF_WL_32BITS;
break; break;
} }
......
...@@ -1081,16 +1081,16 @@ static int wm8991_hw_params(struct snd_pcm_substream *substream, ...@@ -1081,16 +1081,16 @@ static int wm8991_hw_params(struct snd_pcm_substream *substream,
audio1 &= ~WM8991_AIF_WL_MASK; audio1 &= ~WM8991_AIF_WL_MASK;
/* bit size */ /* bit size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
audio1 |= WM8991_AIF_WL_20BITS; audio1 |= WM8991_AIF_WL_20BITS;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
audio1 |= WM8991_AIF_WL_24BITS; audio1 |= WM8991_AIF_WL_24BITS;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
audio1 |= WM8991_AIF_WL_32BITS; audio1 |= WM8991_AIF_WL_32BITS;
break; break;
} }
......
...@@ -1214,19 +1214,19 @@ static int wm8993_hw_params(struct snd_pcm_substream *substream, ...@@ -1214,19 +1214,19 @@ static int wm8993_hw_params(struct snd_pcm_substream *substream,
wm8993->tdm_slots, wm8993->tdm_width); wm8993->tdm_slots, wm8993->tdm_width);
wm8993->bclk *= wm8993->tdm_width * wm8993->tdm_slots; wm8993->bclk *= wm8993->tdm_width * wm8993->tdm_slots;
} else { } else {
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
wm8993->bclk *= 16; wm8993->bclk *= 16;
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
wm8993->bclk *= 20; wm8993->bclk *= 20;
aif1 |= 0x8; aif1 |= 0x8;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
wm8993->bclk *= 24; wm8993->bclk *= 24;
aif1 |= 0x10; aif1 |= 0x10;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
wm8993->bclk *= 32; wm8993->bclk *= 32;
aif1 |= 0x18; aif1 |= 0x18;
break; break;
......
...@@ -2815,19 +2815,19 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream, ...@@ -2815,19 +2815,19 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream,
} }
bclk_rate = params_rate(params); bclk_rate = params_rate(params);
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
bclk_rate *= 16; bclk_rate *= 16;
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
bclk_rate *= 20; bclk_rate *= 20;
aif1 |= 0x20; aif1 |= 0x20;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
bclk_rate *= 24; bclk_rate *= 24;
aif1 |= 0x40; aif1 |= 0x40;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
bclk_rate *= 32; bclk_rate *= 32;
aif1 |= 0x60; aif1 |= 0x60;
break; break;
...@@ -2966,16 +2966,16 @@ static int wm8994_aif3_hw_params(struct snd_pcm_substream *substream, ...@@ -2966,16 +2966,16 @@ static int wm8994_aif3_hw_params(struct snd_pcm_substream *substream,
return 0; return 0;
} }
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
aif1 |= 0x20; aif1 |= 0x20;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
aif1 |= 0x40; aif1 |= 0x40;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
aif1 |= 0x60; aif1 |= 0x60;
break; break;
default: default:
......
...@@ -1597,21 +1597,21 @@ static int wm8995_hw_params(struct snd_pcm_substream *substream, ...@@ -1597,21 +1597,21 @@ static int wm8995_hw_params(struct snd_pcm_substream *substream,
return bclk_rate; return bclk_rate;
aif1 = 0; aif1 = 0;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
aif1 |= (0x1 << WM8995_AIF1_WL_SHIFT); aif1 |= (0x1 << WM8995_AIF1_WL_SHIFT);
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
aif1 |= (0x2 << WM8995_AIF1_WL_SHIFT); aif1 |= (0x2 << WM8995_AIF1_WL_SHIFT);
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
aif1 |= (0x3 << WM8995_AIF1_WL_SHIFT); aif1 |= (0x3 << WM8995_AIF1_WL_SHIFT);
break; break;
default: default:
dev_err(dai->dev, "Unsupported word length %u\n", dev_err(dai->dev, "Unsupported word length %u\n",
params_format(params)); params_width(params));
return -EINVAL; return -EINVAL;
} }
......
...@@ -1029,19 +1029,19 @@ static int wm9081_hw_params(struct snd_pcm_substream *substream, ...@@ -1029,19 +1029,19 @@ static int wm9081_hw_params(struct snd_pcm_substream *substream,
/* Otherwise work out a BCLK from the sample size */ /* Otherwise work out a BCLK from the sample size */
wm9081->bclk = 2 * wm9081->fs; wm9081->bclk = 2 * wm9081->fs;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
wm9081->bclk *= 16; wm9081->bclk *= 16;
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
wm9081->bclk *= 20; wm9081->bclk *= 20;
aif2 |= 0x4; aif2 |= 0x4;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
wm9081->bclk *= 24; wm9081->bclk *= 24;
aif2 |= 0x8; aif2 |= 0x8;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
wm9081->bclk *= 32; wm9081->bclk *= 32;
aif2 |= 0xc; aif2 |= 0xc;
break; break;
......
...@@ -953,16 +953,16 @@ static int wm9713_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -953,16 +953,16 @@ static int wm9713_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_codec *codec = dai->codec; struct snd_soc_codec *codec = dai->codec;
u16 reg = ac97_read(codec, AC97_CENTER_LFE_MASTER) & 0xfff3; u16 reg = ac97_read(codec, AC97_CENTER_LFE_MASTER) & 0xfff3;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S20_3LE: case 20:
reg |= 0x0004; reg |= 0x0004;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
reg |= 0x0008; reg |= 0x0008;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case 32:
reg |= 0x000c; reg |= 0x000c;
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册