Lines Matching +full:vlc +full:- +full:supply

6  * Copyright 2007-2009 Freescale Semiconductor, Inc.  This file is licensed
15 * - Software mode is supported. Stand-alone mode is not supported.
16 * - Only I2C is supported, not SPI
17 * - Support for master and slave mode
18 * - The machine driver's 'startup' function must call
20 * - Only I2S and left-justified modes are supported
21 * - Power management is supported
51 #define CS4270_NUMREGS (CS4270_LASTREG - CS4270_FIRSTREG + 1)
101 /* Power-on default values for the registers
103 * This array contains the power-on default values of the registers, with the
118 "va", "vd", "vlc"
125 unsigned int mode; /* The mode (I2S or left-justified) */
153 * struct cs4270_mode_ratios - clock ratio tables
175 * double-speed instead of quad-speed. However, the CS4270 errata states
176 * that divide-By-1.5 can cause failures, so we avoid that mode where
179 * Errata: There is an errata for the CS4270 where divide-by-1.5 does not
182 * never select any sample rates that require divide-by-1.5.
222 * cs4270_set_dai_sysclk - determine the CS4270 samples rates.
233 * supported values - 64, 96, 128, 192, 256, 384, 512, 768, and 1024.
251 struct snd_soc_component *component = codec_dai->component; in cs4270_set_dai_sysclk()
254 cs4270->mclk = freq; in cs4270_set_dai_sysclk()
259 * cs4270_set_dai_fmt - configure the codec for the selected audio format
267 * SND_SOC_DAIFMT_LEFT_J. The CS4270 codec also supports right-justified
274 struct snd_soc_component *component = codec_dai->component; in cs4270_set_dai_fmt()
281 cs4270->mode = format & SND_SOC_DAIFMT_FORMAT_MASK; in cs4270_set_dai_fmt()
284 dev_err(component->dev, "invalid dai format\n"); in cs4270_set_dai_fmt()
285 return -EINVAL; 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()
298 dev_err(component->dev, "Unknown master/slave configuration\n"); in cs4270_set_dai_fmt()
299 return -EINVAL; in cs4270_set_dai_fmt()
306 * cs4270_hw_params - program the CS4270 with the given hardware parameters.
314 * The .ops functions are used to provide board-specific data, like input
323 struct snd_soc_component *component = dai->component; in cs4270_hw_params()
334 ratio = cs4270->mclk / rate; /* MCLK/LRCK ratio */ in cs4270_hw_params()
343 dev_err(component->dev, "could not find matching ratio\n"); in cs4270_hw_params()
344 return -EINVAL; in cs4270_hw_params()
353 if (cs4270->slave_mode) in cs4270_hw_params()
360 dev_err(component->dev, "i2c write failed\n"); in cs4270_hw_params()
369 switch (cs4270->mode) { in cs4270_hw_params()
377 dev_err(component->dev, "unknown dai format\n"); in cs4270_hw_params()
378 return -EINVAL; in cs4270_hw_params()
383 dev_err(component->dev, "i2c write failed\n"); in cs4270_hw_params()
391 * cs4270_dai_mute - enable/disable the CS4270 external mute
403 struct snd_soc_component *component = dai->component; in cs4270_dai_mute()
413 reg6 |= cs4270->manual_mute; in cs4270_dai_mute()
420 * cs4270_soc_put_mute - put callback for the 'Master Playback switch'
438 int left = !ucontrol->value.integer.value[0]; in cs4270_soc_put_mute()
439 int right = !ucontrol->value.integer.value[1]; in cs4270_soc_put_mute()
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 */
454 SOC_SINGLE("De-emphasis filter", CS4270_TRANS, 0, 1, 0),
456 SOC_SINGLE("Auto-Mute Switch", CS4270_MUTE, 5, 1, 0),
471 .name = "cs4270-hifi",
494 * cs4270_probe - ASoC probe function
505 /* Disable auto-mute. This feature appears to be buggy. In some in cs4270_probe()
506 * situations, auto-mute will not deactivate when it should, so we want in cs4270_probe()
508 * re-enabled it by using the controls. in cs4270_probe()
512 dev_err(component->dev, "i2c write failed\n"); in cs4270_probe()
519 * re-enabled it by using the controls. in cs4270_probe()
524 dev_err(component->dev, "i2c write failed\n"); in cs4270_probe()
528 ret = regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies), in cs4270_probe()
529 cs4270->supplies); in cs4270_probe()
535 * cs4270_remove - ASoC remove function
544 regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), cs4270->supplies); in cs4270_remove()
549 /* This suspend/resume implementation can handle both - a simple standby
571 regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), in cs4270_soc_suspend()
572 cs4270->supplies); in cs4270_soc_suspend()
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()
594 /* ... then disable the power-down bits */ in cs4270_soc_resume()
625 * cs4270_of_match - the device tree bindings
647 * cs4270_i2c_remove - deinitialize the I2C interface of the CS4270
657 gpiod_set_value_cansleep(cs4270->reset_gpio, 0); in cs4270_i2c_remove()
661 * cs4270_i2c_probe - initialize the I2C interface of the CS4270
673 cs4270 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs4270_private), in cs4270_i2c_probe()
676 return -ENOMEM; in cs4270_i2c_probe()
678 /* get the power supply regulators */ in cs4270_i2c_probe()
680 cs4270->supplies[i].supply = supply_names[i]; in cs4270_i2c_probe()
682 ret = devm_regulator_bulk_get(&i2c_client->dev, 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()
697 dev_dbg(&i2c_client->dev, "Found reset GPIO\n"); 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()
709 ret = regmap_read(cs4270->regmap, CS4270_CHIPID, &val); in cs4270_i2c_probe()
711 dev_err(&i2c_client->dev, "failed to read i2c at addr %X\n", in cs4270_i2c_probe()
712 i2c_client->addr); in cs4270_i2c_probe()
717 dev_err(&i2c_client->dev, "device at addr %X is not a CS4270\n", in cs4270_i2c_probe()
718 i2c_client->addr); in cs4270_i2c_probe()
719 return -ENODEV; in cs4270_i2c_probe()
722 dev_info(&i2c_client->dev, "found device at i2c address %X\n", in cs4270_i2c_probe()
723 i2c_client->addr); in cs4270_i2c_probe()
724 dev_info(&i2c_client->dev, "hardware revision %X\n", val & 0xF); in cs4270_i2c_probe()
728 ret = devm_snd_soc_register_component(&i2c_client->dev, in cs4270_i2c_probe()
734 * cs4270_id - I2C device IDs supported by this driver
743 * cs4270_i2c_driver - I2C device identification