Lines Matching +full:dai +full:- +full:format
1 /* SPDX-License-Identifier: GPL-2.0+ */
46 static int cs4341_set_fmt(struct snd_soc_dai *dai, unsigned int format) in cs4341_set_fmt() argument
48 struct snd_soc_component *component = dai->component; in cs4341_set_fmt()
51 switch (format & SND_SOC_DAIFMT_MASTER_MASK) { in cs4341_set_fmt()
55 return -EINVAL; in cs4341_set_fmt()
58 switch (format & SND_SOC_DAIFMT_INV_MASK) { in cs4341_set_fmt()
62 return -EINVAL; in cs4341_set_fmt()
65 switch (format & SND_SOC_DAIFMT_FORMAT_MASK) { in cs4341_set_fmt()
69 cs4341->fmt = format & SND_SOC_DAIFMT_FORMAT_MASK; in cs4341_set_fmt()
72 return -EINVAL; in cs4341_set_fmt()
80 struct snd_soc_dai *dai) in cs4341_hw_params() argument
82 struct snd_soc_component *component = dai->component; in cs4341_hw_params()
94 dev_err(component->dev, "Unsupported PCM format 0x%08x.\n", in cs4341_hw_params()
96 return -EINVAL; in cs4341_hw_params()
99 switch (cs4341->fmt) { in cs4341_hw_params()
110 dev_err(component->dev, "Unsupported DAI format 0x%08x.\n", in cs4341_hw_params()
111 cs4341->fmt); in cs4341_hw_params()
112 return -EINVAL; in cs4341_hw_params()
119 static int cs4341_mute(struct snd_soc_dai *dai, int mute, int direction) in cs4341_mute() argument
121 struct snd_soc_component *component = dai->component; in cs4341_mute()
135 static DECLARE_TLV_DB_SCALE(out_tlv, -9000, 100, 0);
168 SOC_ENUM("De-Emphasis Control", deemph_enum),
170 SOC_SINGLE("Auto-Mute Switch", CS4341_REG_MODE2, 7, 1, 0),
182 .name = "cs4341a-hifi",
220 regmap_write(cs4341->regmap, cs4341_reg_defaults[i].reg, in cs4341_probe()
233 cs4341 = devm_kzalloc(&i2c->dev, sizeof(*cs4341), GFP_KERNEL); in cs4341_i2c_probe()
235 return -ENOMEM; in cs4341_i2c_probe()
239 cs4341->regcfg.reg_bits = 8; in cs4341_i2c_probe()
240 cs4341->regcfg.val_bits = 8; in cs4341_i2c_probe()
241 cs4341->regcfg.max_register = CS4341_REG_VOLB; in cs4341_i2c_probe()
242 cs4341->regcfg.cache_type = REGCACHE_FLAT; in cs4341_i2c_probe()
243 cs4341->regcfg.reg_defaults = cs4341_reg_defaults; in cs4341_i2c_probe()
244 cs4341->regcfg.num_reg_defaults = ARRAY_SIZE(cs4341_reg_defaults); in cs4341_i2c_probe()
245 cs4341->regmap = devm_regmap_init_i2c(i2c, &cs4341->regcfg); in cs4341_i2c_probe()
246 if (IS_ERR(cs4341->regmap)) in cs4341_i2c_probe()
247 return PTR_ERR(cs4341->regmap); in cs4341_i2c_probe()
249 return cs4341_probe(&i2c->dev); in cs4341_i2c_probe()
260 .name = "cs4341-i2c",
279 cs4341 = devm_kzalloc(&spi->dev, sizeof(*cs4341), GFP_KERNEL); in cs4341_spi_probe()
281 return -ENOMEM; in cs4341_spi_probe()
283 if (!spi->bits_per_word) in cs4341_spi_probe()
284 spi->bits_per_word = 8; in cs4341_spi_probe()
285 if (!spi->max_speed_hz) in cs4341_spi_probe()
286 spi->max_speed_hz = 6000000; in cs4341_spi_probe()
293 cs4341->regcfg.reg_bits = 16; in cs4341_spi_probe()
294 cs4341->regcfg.val_bits = 8; in cs4341_spi_probe()
295 cs4341->regcfg.write_flag_mask = 0x20; in cs4341_spi_probe()
296 cs4341->regcfg.max_register = CS4341_REG_VOLB; in cs4341_spi_probe()
297 cs4341->regcfg.cache_type = REGCACHE_FLAT; in cs4341_spi_probe()
298 cs4341->regcfg.readable_reg = cs4341_reg_readable; in cs4341_spi_probe()
299 cs4341->regcfg.reg_defaults = cs4341_reg_defaults; in cs4341_spi_probe()
300 cs4341->regcfg.num_reg_defaults = ARRAY_SIZE(cs4341_reg_defaults); in cs4341_spi_probe()
301 cs4341->regmap = devm_regmap_init_spi(spi, &cs4341->regcfg); in cs4341_spi_probe()
302 if (IS_ERR(cs4341->regmap)) in cs4341_spi_probe()
303 return PTR_ERR(cs4341->regmap); in cs4341_spi_probe()
305 return cs4341_probe(&spi->dev); in cs4341_spi_probe()
310 .name = "cs4341-spi",