···44 select SND_SOC_TWL6040 if TWL4030_CORE45 select SND_SOC_UDA134X46 select SND_SOC_UDA1380 if I2C47- select SND_SOC_WL1273 if WL1273_CORE48 select SND_SOC_WM2000 if I2C49 select SND_SOC_WM8350 if MFD_WM835050 select SND_SOC_WM8400 if MFD_WM8400
···44 select SND_SOC_TWL6040 if TWL4030_CORE45 select SND_SOC_UDA134X46 select SND_SOC_UDA1380 if I2C47+ select SND_SOC_WL1273 if RADIO_WL127348 select SND_SOC_WM2000 if I2C49 select SND_SOC_WM8350 if MFD_WM835050 select SND_SOC_WM8400 if MFD_WM8400
+12-17
sound/soc/codecs/wl1273.c
···42static int snd_wl1273_fm_set_i2s_mode(struct wl1273_core *core,43 int rate, int width)44{45- struct device *dev = &core->i2c_dev->dev;46 int r = 0;47 u16 mode;48···123 dev_dbg(dev, "mode: 0x%04x\n", mode);124125 if (core->i2s_mode != mode) {126- r = wl1273_fm_write_cmd(core, WL1273_I2S_MODE_CONFIG_SET, mode);127 if (r)128 goto out;129130 core->i2s_mode = mode;131- r = wl1273_fm_write_cmd(core, WL1273_AUDIO_ENABLE,132- WL1273_AUDIO_ENABLE_I2S);133 if (r)134 goto out;135 }···142static int snd_wl1273_fm_set_channel_number(struct wl1273_core *core,143 int channel_number)144{145- struct i2c_client *client = core->i2c_dev;146- struct device *dev = &client->dev;147 int r = 0;148149 dev_dbg(dev, "%s\n", __func__);···153 goto out;154155 if (channel_number == 1 && core->mode == WL1273_MODE_RX)156- r = wl1273_fm_write_cmd(core, WL1273_MOST_MODE_SET,157- WL1273_RX_MONO);158 else if (channel_number == 1 && core->mode == WL1273_MODE_TX)159- r = wl1273_fm_write_cmd(core, WL1273_MONO_SET,160- WL1273_TX_MONO);161 else if (channel_number == 2 && core->mode == WL1273_MODE_RX)162- r = wl1273_fm_write_cmd(core, WL1273_MOST_MODE_SET,163- WL1273_RX_STEREO);164 else if (channel_number == 2 && core->mode == WL1273_MODE_TX)165- r = wl1273_fm_write_cmd(core, WL1273_MONO_SET,166- WL1273_TX_STEREO);167 else168 r = -EINVAL;169out:···232 if (wl1273->core->audio_mode == val)233 return 0;234235- r = wl1273_fm_set_audio(wl1273->core, val);236 if (r < 0)237 return r;238···267268 dev_dbg(codec->dev, "%s: enter.\n", __func__);269270- r = wl1273_fm_set_volume(wl1273->core,271- ucontrol->value.integer.value[0]);272 if (r)273 return r;274
···42static int snd_wl1273_fm_set_i2s_mode(struct wl1273_core *core,43 int rate, int width)44{45+ struct device *dev = &core->client->dev;46 int r = 0;47 u16 mode;48···123 dev_dbg(dev, "mode: 0x%04x\n", mode);124125 if (core->i2s_mode != mode) {126+ r = core->write(core, WL1273_I2S_MODE_CONFIG_SET, mode);127 if (r)128 goto out;129130 core->i2s_mode = mode;131+ r = core->write(core, WL1273_AUDIO_ENABLE,132+ WL1273_AUDIO_ENABLE_I2S);133 if (r)134 goto out;135 }···142static int snd_wl1273_fm_set_channel_number(struct wl1273_core *core,143 int channel_number)144{145+ struct device *dev = &core->client->dev;0146 int r = 0;147148 dev_dbg(dev, "%s\n", __func__);···154 goto out;155156 if (channel_number == 1 && core->mode == WL1273_MODE_RX)157+ r = core->write(core, WL1273_MOST_MODE_SET, WL1273_RX_MONO);0158 else if (channel_number == 1 && core->mode == WL1273_MODE_TX)159+ r = core->write(core, WL1273_MONO_SET, WL1273_TX_MONO);0160 else if (channel_number == 2 && core->mode == WL1273_MODE_RX)161+ r = core->write(core, WL1273_MOST_MODE_SET, WL1273_RX_STEREO);0162 else if (channel_number == 2 && core->mode == WL1273_MODE_TX)163+ r = core->write(core, WL1273_MONO_SET, WL1273_TX_STEREO);0164 else165 r = -EINVAL;166out:···237 if (wl1273->core->audio_mode == val)238 return 0;239240+ r = wl1273->core->set_audio(wl1273->core, val);241 if (r < 0)242 return r;243···272273 dev_dbg(codec->dev, "%s: enter.\n", __func__);274275+ r = wl1273->core->set_volume(wl1273->core,276+ ucontrol->value.integer.value[0]);277 if (r)278 return r;279
···25#ifndef __WL1273_CODEC_H__26#define __WL1273_CODEC_H__270000000000000000000000000000000000000000000000000000000000000000000000028int wl1273_get_format(struct snd_soc_codec *codec, unsigned int *fmt);2930#endif /* End of __WL1273_CODEC_H__ */
···267 ep93xx_i2s_write_reg(info, EP93XX_I2S_RXWRDLEN, word_len);268269 /*270- * Calculate the sdiv (bit clock) and lrdiv (left/right clock) values.271- * If the lrclk is pulse length is larger than the word size, then the272- * bit clock will be gated for the unused bits.000273 */274- div = (clk_get_rate(info->mclk) / params_rate(params)) *275- params_channels(params);276 for (sdiv = 2; sdiv <= 4; sdiv += 2)277- for (lrdiv = 32; lrdiv <= 128; lrdiv <<= 1)278 if (sdiv * lrdiv == div) {279 found = 1;280 goto out;···343 .set_fmt = ep93xx_i2s_set_dai_fmt,344};345346-#define EP93XX_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \347- SNDRV_PCM_FMTBIT_S24_LE | \348- SNDRV_PCM_FMTBIT_S32_LE)349350static struct snd_soc_dai_driver ep93xx_i2s_dai = {351 .symmetric_rates= 1,
···267 ep93xx_i2s_write_reg(info, EP93XX_I2S_RXWRDLEN, word_len);268269 /*270+ * EP93xx I2S module can be setup so SCLK / LRCLK value can be271+ * 32, 64, 128. MCLK / SCLK value can be 2 and 4.272+ * We set LRCLK equal to `rate' and minimum SCLK / LRCLK 273+ * value is 64, because our sample size is 32 bit * 2 channels.274+ * I2S standard permits us to transmit more bits than275+ * the codec uses.276 */277+ div = clk_get_rate(info->mclk) / params_rate(params);0278 for (sdiv = 2; sdiv <= 4; sdiv += 2)279+ for (lrdiv = 64; lrdiv <= 128; lrdiv <<= 1)280 if (sdiv * lrdiv == div) {281 found = 1;282 goto out;···341 .set_fmt = ep93xx_i2s_set_dai_fmt,342};343344+#define EP93XX_I2S_FORMATS (SNDRV_PCM_FMTBIT_S32_LE)00345346static struct snd_soc_dai_driver ep93xx_i2s_dai = {347 .symmetric_rates= 1,