Lines Matching +full:vd +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
36 * The codec isn't really big-endian or little-endian, since the I2S
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
127 "va", "vd", "vlc"
134 unsigned int mode; /* The mode (I2S or left-justified) */
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
189 * work if Vd is 3.3V. If this effects you, select the
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
411 struct snd_soc_component *component = dai->component; in cs4270_dai_mute()
421 reg6 |= cs4270->manual_mute; in cs4270_dai_mute()
428 * cs4270_soc_put_mute - put callback for the 'Master Playback switch'
446 int left = !ucontrol->value.integer.value[0]; in cs4270_soc_put_mute()
447 int right = !ucontrol->value.integer.value[1]; in cs4270_soc_put_mute()
449 cs4270->manual_mute = (left ? CS4270_MUTE_DAC_A : 0) | in cs4270_soc_put_mute()
455 /* A list of non-DAPM controls that the CS4270 supports */
462 SOC_SINGLE("De-emphasis filter", CS4270_TRANS, 0, 1, 0),
464 SOC_SINGLE("Auto-Mute Switch", CS4270_MUTE, 5, 1, 0),
479 .name = "cs4270-hifi",
502 * cs4270_probe - ASoC probe function
513 /* Disable auto-mute. This feature appears to be buggy. In some in cs4270_probe()
514 * situations, auto-mute will not deactivate when it should, so we want in cs4270_probe()
516 * re-enabled it by using the controls. in cs4270_probe()
520 dev_err(component->dev, "i2c write failed\n"); in cs4270_probe()
527 * re-enabled it by using the controls. in cs4270_probe()
532 dev_err(component->dev, "i2c write failed\n"); in cs4270_probe()
536 ret = regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies), in cs4270_probe()
537 cs4270->supplies); in cs4270_probe()
543 * cs4270_remove - ASoC remove function
552 regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), cs4270->supplies); in cs4270_remove()
557 /* This suspend/resume implementation can handle both - a simple standby
579 regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), in cs4270_soc_suspend()
580 cs4270->supplies); in cs4270_soc_suspend()
590 ret = regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies), in cs4270_soc_resume()
591 cs4270->supplies); in cs4270_soc_resume()
600 regcache_sync(cs4270->regmap); in cs4270_soc_resume()
602 /* ... then disable the power-down bits */ in cs4270_soc_resume()
634 * cs4270_of_match - the device tree bindings
656 * cs4270_i2c_remove - deinitialize the I2C interface of the CS4270
666 gpiod_set_value_cansleep(cs4270->reset_gpio, 0); in cs4270_i2c_remove()
672 * cs4270_i2c_probe - initialize the I2C interface of the CS4270
686 cs4270 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs4270_private), in cs4270_i2c_probe()
689 return -ENOMEM; in cs4270_i2c_probe()
691 /* get the power supply regulators */ in cs4270_i2c_probe()
693 cs4270->supplies[i].supply = supply_names[i]; in cs4270_i2c_probe()
695 ret = devm_regulator_bulk_get(&i2c_client->dev, in cs4270_i2c_probe()
696 ARRAY_SIZE(cs4270->supplies), in cs4270_i2c_probe()
697 cs4270->supplies); in cs4270_i2c_probe()
702 cs4270->reset_gpio = devm_gpiod_get_optional(&i2c_client->dev, "reset", in cs4270_i2c_probe()
704 if (IS_ERR(cs4270->reset_gpio)) { in cs4270_i2c_probe()
705 dev_dbg(&i2c_client->dev, "Error getting CS4270 reset GPIO\n"); in cs4270_i2c_probe()
706 return PTR_ERR(cs4270->reset_gpio); in cs4270_i2c_probe()
709 if (cs4270->reset_gpio) { in cs4270_i2c_probe()
710 dev_dbg(&i2c_client->dev, "Found reset GPIO\n"); in cs4270_i2c_probe()
711 gpiod_set_value_cansleep(cs4270->reset_gpio, 1); in cs4270_i2c_probe()
717 cs4270->regmap = devm_regmap_init_i2c(i2c_client, &cs4270_regmap); in cs4270_i2c_probe()
718 if (IS_ERR(cs4270->regmap)) in cs4270_i2c_probe()
719 return PTR_ERR(cs4270->regmap); in cs4270_i2c_probe()
722 ret = regmap_read(cs4270->regmap, CS4270_CHIPID, &val); in cs4270_i2c_probe()
724 dev_err(&i2c_client->dev, "failed to read i2c at addr %X\n", in cs4270_i2c_probe()
725 i2c_client->addr); in cs4270_i2c_probe()
730 dev_err(&i2c_client->dev, "device at addr %X is not a CS4270\n", in cs4270_i2c_probe()
731 i2c_client->addr); in cs4270_i2c_probe()
732 return -ENODEV; in cs4270_i2c_probe()
735 dev_info(&i2c_client->dev, "found device at i2c address %X\n", in cs4270_i2c_probe()
736 i2c_client->addr); in cs4270_i2c_probe()
737 dev_info(&i2c_client->dev, "hardware revision %X\n", val & 0xF); in cs4270_i2c_probe()
741 ret = devm_snd_soc_register_component(&i2c_client->dev, in cs4270_i2c_probe()
747 * cs4270_id - I2C device IDs supported by this driver
756 * cs4270_i2c_driver - I2C device identification