Lines Matching full:cs4270
2 * CS4270 ALSA SoC (ASoC) codec driver
11 * This is an ASoC device driver for the Cirrus Logic CS4270 codec.
39 /* CS4270 registers addresses */
54 /* Bit masks for the CS4270 registers */
121 /* Private data for the CS4270 */
160 * The data for this chart is taken from Table 5 of the CS4270 reference
165 * rates the CS4270 currently supports.
175 * double-speed instead of quad-speed. However, the CS4270 errata states
179 * Errata: There is an errata for the CS4270 where divide-by-1.5 does not
204 /* The number of MCLK/LRCK ratios supported by the CS4270 */
222 * cs4270_set_dai_sysclk - determine the CS4270 samples rates.
232 * by the CS4270. The ratio of MCLK / Fs must be equal to one of nine
252 struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); in cs4270_set_dai_sysclk() local
254 cs4270->mclk = freq; in cs4270_set_dai_sysclk()
267 * SND_SOC_DAIFMT_LEFT_J. The CS4270 codec also supports right-justified
275 struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); in cs4270_set_dai_fmt() local
281 cs4270->mode = format & SND_SOC_DAIFMT_FORMAT_MASK; in cs4270_set_dai_fmt()
291 cs4270->slave_mode = 1; in cs4270_set_dai_fmt()
294 cs4270->slave_mode = 0; in cs4270_set_dai_fmt()
306 * cs4270_hw_params - program the CS4270 with the given hardware parameters.
324 struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); in cs4270_hw_params() local
334 ratio = cs4270->mclk / rate; /* MCLK/LRCK ratio */ in cs4270_hw_params()
353 if (cs4270->slave_mode) in cs4270_hw_params()
369 switch (cs4270->mode) { in cs4270_hw_params()
391 * cs4270_dai_mute - enable/disable the CS4270 external mute
396 * This function toggles the mute bits in the MUTE register. The CS4270's
404 struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); in cs4270_dai_mute() local
413 reg6 |= cs4270->manual_mute; in cs4270_dai_mute()
437 struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); in cs4270_soc_put_mute() local
441 cs4270->manual_mute = (left ? CS4270_MUTE_DAC_A : 0) | in cs4270_soc_put_mute()
447 /* A list of non-DAPM controls that the CS4270 supports */
471 .name = "cs4270-hifi",
502 struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); in cs4270_probe() local
528 ret = regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies), in cs4270_probe()
529 cs4270->supplies); in cs4270_probe()
542 struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); in cs4270_remove() local
544 regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), cs4270->supplies); in cs4270_remove()
560 struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); in cs4270_soc_suspend() local
571 regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), in cs4270_soc_suspend()
572 cs4270->supplies); in cs4270_soc_suspend()
579 struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); in cs4270_soc_resume() local
582 ret = regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies), in cs4270_soc_resume()
583 cs4270->supplies); in cs4270_soc_resume()
592 regcache_sync(cs4270->regmap); in cs4270_soc_resume()
628 { .compatible = "cirrus,cs4270", },
647 * cs4270_i2c_remove - deinitialize the I2C interface of the CS4270
655 struct cs4270_private *cs4270 = i2c_get_clientdata(i2c_client); in cs4270_i2c_remove() local
657 gpiod_set_value_cansleep(cs4270->reset_gpio, 0); in cs4270_i2c_remove()
661 * cs4270_i2c_probe - initialize the I2C interface of the CS4270
669 struct cs4270_private *cs4270; in cs4270_i2c_probe() local
673 cs4270 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs4270_private), in cs4270_i2c_probe()
675 if (!cs4270) in cs4270_i2c_probe()
680 cs4270->supplies[i].supply = supply_names[i]; in cs4270_i2c_probe()
683 ARRAY_SIZE(cs4270->supplies), in cs4270_i2c_probe()
684 cs4270->supplies); in cs4270_i2c_probe()
689 cs4270->reset_gpio = devm_gpiod_get_optional(&i2c_client->dev, "reset", in cs4270_i2c_probe()
691 if (IS_ERR(cs4270->reset_gpio)) { in cs4270_i2c_probe()
692 dev_dbg(&i2c_client->dev, "Error getting CS4270 reset GPIO\n"); in cs4270_i2c_probe()
693 return PTR_ERR(cs4270->reset_gpio); in cs4270_i2c_probe()
696 if (cs4270->reset_gpio) { in cs4270_i2c_probe()
698 gpiod_set_value_cansleep(cs4270->reset_gpio, 1); in cs4270_i2c_probe()
704 cs4270->regmap = devm_regmap_init_i2c(i2c_client, &cs4270_regmap); in cs4270_i2c_probe()
705 if (IS_ERR(cs4270->regmap)) in cs4270_i2c_probe()
706 return PTR_ERR(cs4270->regmap); in cs4270_i2c_probe()
708 /* Verify that we have a CS4270 */ in cs4270_i2c_probe()
709 ret = regmap_read(cs4270->regmap, CS4270_CHIPID, &val); in cs4270_i2c_probe()
717 dev_err(&i2c_client->dev, "device at addr %X is not a CS4270\n", in cs4270_i2c_probe()
726 i2c_set_clientdata(i2c_client, cs4270); in cs4270_i2c_probe()
737 {"cs4270"},
750 .name = "cs4270",
761 MODULE_DESCRIPTION("Cirrus Logic CS4270 ALSA SoC Codec Driver");