12 #include <linux/module.h>
13 #include <linux/slab.h>
21 #define AK4104_REG_CONTROL1 0x00
22 #define AK4104_REG_RESERVED 0x01
23 #define AK4104_REG_CONTROL2 0x02
24 #define AK4104_REG_TX 0x03
25 #define AK4104_REG_CHN_STATUS(x) ((x) + 0x04)
26 #define AK4104_NUM_REGS 10
28 #define AK4104_REG_MASK 0x1f
29 #define AK4104_READ 0xc0
30 #define AK4104_WRITE 0xe0
31 #define AK4104_RESERVED_VAL 0x5b
34 #define AK4104_CONTROL1_RSTN (1 << 0)
35 #define AK4104_CONTROL1_PW (1 << 1)
36 #define AK4104_CONTROL1_DIF0 (1 << 2)
37 #define AK4104_CONTROL1_DIF1 (1 << 3)
39 #define AK4104_CONTROL2_SEL0 (1 << 0)
40 #define AK4104_CONTROL2_SEL1 (1 << 1)
41 #define AK4104_CONTROL2_MODE (1 << 2)
43 #define AK4104_TX_TXE (1 << 0)
44 #define AK4104_TX_V (1 << 1)
46 #define DRV_NAME "ak4104-codec"
52 static int ak4104_set_dai_fmt(
struct snd_soc_dai *codec_dai,
111 dev_err(codec->
dev,
"unsupported sampling rate\n");
119 .hw_params = ak4104_hw_params,
120 .set_fmt = ak4104_set_dai_fmt,
124 .name =
"ak4104-hifi",
126 .stream_name =
"Playback",
134 .ops = &ak4101_dai_ops,
172 .probe = ak4104_probe,
173 .remove = ak4104_remove,
176 static const struct regmap_config ak4104_regmap = {
205 if (IS_ERR(ak4104->
regmap)) {
206 ret = PTR_ERR(ak4104->
regmap);
221 spi_set_drvdata(spi, ak4104);
224 &soc_codec_device_ak4104, &ak4104_dai, 1);
243 static struct spi_driver ak4104_spi_driver = {
248 .probe = ak4104_spi_probe,