Lines Matching +full:power +full:- +full:supplies
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
36 * The codec isn't really big-endian or little-endian, since the I2S
50 #define CS4270_PWRCTL 0x02 /* Power Control */
60 #define CS4270_NUMREGS (CS4270_LASTREG - CS4270_FIRSTREG + 1)
110 /* Power-on default values for the registers
112 * This array contains the power-on default values of the registers, with the
134 unsigned int mode; /* The mode (I2S or left-justified) */
138 /* power domain regulators */
139 struct regulator_bulk_data supplies[ARRAY_SIZE(supply_names)]; member
162 * struct cs4270_mode_ratios - clock ratio tables
184 * double-speed instead of quad-speed. However, the CS4270 errata states
185 * that divide-By-1.5 can cause failures, so we avoid that mode where
188 * Errata: There is an errata for the CS4270 where divide-by-1.5 does not
191 * never select any sample rates that require divide-by-1.5.
231 * cs4270_set_dai_sysclk - determine the CS4270 samples rates.
242 * supported values - 64, 96, 128, 192, 256, 384, 512, 768, and 1024.
260 struct snd_soc_component *component = codec_dai->component; in cs4270_set_dai_sysclk()
263 cs4270->mclk = freq; in cs4270_set_dai_sysclk()
268 * cs4270_set_dai_fmt - configure the codec for the selected audio format
276 * SND_SOC_DAIFMT_LEFT_J. The CS4270 codec also supports right-justified
283 struct snd_soc_component *component = codec_dai->component; in cs4270_set_dai_fmt()
290 cs4270->mode = format & SND_SOC_DAIFMT_FORMAT_MASK; in cs4270_set_dai_fmt()
293 dev_err(component->dev, "invalid dai format\n"); in cs4270_set_dai_fmt()
294 return -EINVAL; in cs4270_set_dai_fmt()
300 cs4270->slave_mode = 1; in cs4270_set_dai_fmt()
303 cs4270->slave_mode = 0; in cs4270_set_dai_fmt()
307 dev_err(component->dev, "Unknown master/slave configuration\n"); in cs4270_set_dai_fmt()
308 return -EINVAL; in cs4270_set_dai_fmt()
315 * cs4270_hw_params - program the CS4270 with the given hardware parameters.
323 * The .ops functions are used to provide board-specific data, like input
332 struct snd_soc_component *component = dai->component; in cs4270_hw_params()
343 ratio = cs4270->mclk / rate; /* MCLK/LRCK ratio */ in cs4270_hw_params()
352 dev_err(component->dev, "could not find matching ratio\n"); in cs4270_hw_params()
353 return -EINVAL; in cs4270_hw_params()
362 if (cs4270->slave_mode) in cs4270_hw_params()
369 dev_err(component->dev, "i2c write failed\n"); in cs4270_hw_params()
378 switch (cs4270->mode) { in cs4270_hw_params()
386 dev_err(component->dev, "unknown dai format\n"); in cs4270_hw_params()
387 return -EINVAL; in cs4270_hw_params()
392 dev_err(component->dev, "i2c write failed\n"); in cs4270_hw_params()
400 * cs4270_dai_mute - enable/disable the CS4270 external mute
412 struct snd_soc_component *component = dai->component; in cs4270_dai_mute()
422 reg6 |= cs4270->manual_mute; in cs4270_dai_mute()
429 * cs4270_soc_put_mute - put callback for the 'Master Playback switch'
447 int left = !ucontrol->value.integer.value[0]; in cs4270_soc_put_mute()
448 int right = !ucontrol->value.integer.value[1]; in cs4270_soc_put_mute()
450 cs4270->manual_mute = (left ? CS4270_MUTE_DAC_A : 0) | in cs4270_soc_put_mute()
456 /* A list of non-DAPM controls that the CS4270 supports */
463 SOC_SINGLE("De-emphasis filter", CS4270_TRANS, 0, 1, 0),
465 SOC_SINGLE("Auto-Mute Switch", CS4270_MUTE, 5, 1, 0),
480 .name = "cs4270-hifi",
503 * cs4270_probe - ASoC probe function
514 /* Disable auto-mute. This feature appears to be buggy. In some in cs4270_probe()
515 * situations, auto-mute will not deactivate when it should, so we want in cs4270_probe()
517 * re-enabled it by using the controls. in cs4270_probe()
521 dev_err(component->dev, "i2c write failed\n"); in cs4270_probe()
528 * re-enabled it by using the controls. in cs4270_probe()
533 dev_err(component->dev, "i2c write failed\n"); in cs4270_probe()
537 ret = regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies), in cs4270_probe()
538 cs4270->supplies); in cs4270_probe()
544 * cs4270_remove - ASoC remove function
553 regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), cs4270->supplies); in cs4270_remove()
558 /* This suspend/resume implementation can handle both - a simple standby
563 * The codec's own power saving features are enabled in the suspend callback,
580 regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), in cs4270_soc_suspend()
581 cs4270->supplies); in cs4270_soc_suspend()
591 ret = regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies), in cs4270_soc_resume()
592 cs4270->supplies); in cs4270_soc_resume()
601 regcache_sync(cs4270->regmap); in cs4270_soc_resume()
603 /* ... then disable the power-down bits */ in cs4270_soc_resume()
635 * cs4270_of_match - the device tree bindings
657 * cs4270_i2c_remove - deinitialize the I2C interface of the CS4270
660 * This function puts the chip into low power mode when the i2c device
667 gpiod_set_value_cansleep(cs4270->reset_gpio, 0); in cs4270_i2c_remove()
673 * cs4270_i2c_probe - initialize the I2C interface of the CS4270
687 cs4270 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs4270_private), in cs4270_i2c_probe()
690 return -ENOMEM; in cs4270_i2c_probe()
692 /* get the power supply regulators */ in cs4270_i2c_probe()
694 cs4270->supplies[i].supply = supply_names[i]; in cs4270_i2c_probe()
696 ret = devm_regulator_bulk_get(&i2c_client->dev, in cs4270_i2c_probe()
697 ARRAY_SIZE(cs4270->supplies), in cs4270_i2c_probe()
698 cs4270->supplies); in cs4270_i2c_probe()
703 cs4270->reset_gpio = devm_gpiod_get_optional(&i2c_client->dev, "reset", in cs4270_i2c_probe()
705 if (IS_ERR(cs4270->reset_gpio)) { in cs4270_i2c_probe()
706 dev_dbg(&i2c_client->dev, "Error getting CS4270 reset GPIO\n"); in cs4270_i2c_probe()
707 return PTR_ERR(cs4270->reset_gpio); in cs4270_i2c_probe()
710 if (cs4270->reset_gpio) { in cs4270_i2c_probe()
711 dev_dbg(&i2c_client->dev, "Found reset GPIO\n"); in cs4270_i2c_probe()
712 gpiod_set_value_cansleep(cs4270->reset_gpio, 1); in cs4270_i2c_probe()
718 cs4270->regmap = devm_regmap_init_i2c(i2c_client, &cs4270_regmap); in cs4270_i2c_probe()
719 if (IS_ERR(cs4270->regmap)) in cs4270_i2c_probe()
720 return PTR_ERR(cs4270->regmap); in cs4270_i2c_probe()
723 ret = regmap_read(cs4270->regmap, CS4270_CHIPID, &val); in cs4270_i2c_probe()
725 dev_err(&i2c_client->dev, "failed to read i2c at addr %X\n", in cs4270_i2c_probe()
726 i2c_client->addr); in cs4270_i2c_probe()
731 dev_err(&i2c_client->dev, "device at addr %X is not a CS4270\n", in cs4270_i2c_probe()
732 i2c_client->addr); in cs4270_i2c_probe()
733 return -ENODEV; in cs4270_i2c_probe()
736 dev_info(&i2c_client->dev, "found device at i2c address %X\n", in cs4270_i2c_probe()
737 i2c_client->addr); in cs4270_i2c_probe()
738 dev_info(&i2c_client->dev, "hardware revision %X\n", val & 0xF); in cs4270_i2c_probe()
742 ret = devm_snd_soc_register_component(&i2c_client->dev, in cs4270_i2c_probe()
748 * cs4270_id - I2C device IDs supported by this driver
757 * cs4270_i2c_driver - I2C device identification