On 9/8/16, 11:29 AM, "Alexander Shiyan" shc_work@mail.ru wrote:
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 1cd6ab3..9853e79 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -458,6 +458,13 @@ config SND_SOC_CS42XX8_I2C select SND_SOC_CS42XX8 select REGMAP_I2C
+config SND_SOC_CS4341
- tristate "Cirrus Logic CS4341 CODEC"
- depends on SPI_MASTER
- select REGMAP_SPI
- help
Enable support for Cirrus Logic (Crystal) CS4341 CODEC.
This devices primary interface is I2C. That should be added as well since i2c is read/write and spi is write only.
# Cirrus Logic CS4349 HiFi DAC config SND_SOC_CS4349 tristate "Cirrus Logic CS4349 CODEC"
+#define CS4341_REG_MODE1 0x00 +#define CS4341_REG_MODE2 0x01 +#define CS4341_REG_MIX 0x02 +#define CS4341_REG_VOLA 0x03 +#define CS4341_REG_VOLB 0x04
+#define CS4341_MODE2_DIF (7 << 4) +#define CS4341_MODE2_DIF_I2S_24 (0 << 4) +#define CS4341_MODE2_DIF_I2S_16 (1 << 4) +#define CS4341_MODE2_DIF_LJ_24 (2 << 4) +#define CS4341_MODE2_DIF_RJ_24 (3 << 4) +#define CS4341_MODE2_DIF_RJ_16 (5 << 4)
+#define CS4341_VOLX_MUTE (1 << 7)
It would be a good idea to clean up the indentation here.
- switch (cs4341->fmt) {
- case SND_SOC_DAIFMT_I2S:
snd_soc_update_bits(codec, CS4341_REG_MODE2, CS4341_MODE2_DIF,
bits24 ? CS4341_MODE2_DIF_I2S_24 :
CS4341_MODE2_DIF_I2S_16);
break;
- case SND_SOC_DAIFMT_LEFT_J:
snd_soc_update_bits(codec, CS4341_REG_MODE2, CS4341_MODE2_DIF,
CS4341_MODE2_DIF_LJ_24);
break;
- case SND_SOC_DAIFMT_RIGHT_J:
snd_soc_update_bits(codec, CS4341_REG_MODE2, CS4341_MODE2_DIF,
bits24 ? CS4341_MODE2_DIF_RJ_24 :
CS4341_MODE2_DIF_RJ_16);
break;
- default:
dev_err(codec->dev, "Unsupported DAI format\n");
return -EINVAL;
- }
Can we use regmap_update_bits where we can?
- return 0;
+}
+static int cs4341_digital_mute(struct snd_soc_dai *dai, int mute) +{
- struct snd_soc_codec *codec = dai->codec;
- int ret;
- ret = snd_soc_update_bits(codec, CS4341_REG_VOLA, CS4341_VOLX_MUTE,
mute ? CS4341_VOLX_MUTE : 0);
- if (ret < 0)
return ret;
- return snd_soc_update_bits(codec, CS4341_REG_VOLB, CS4341_VOLX_MUTE,
mute ? CS4341_VOLX_MUTE : 0);
regmap_update_bits
+}