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