Lines Matching +full:ld +full:- +full:pulse +full:- +full:delay +full:- +full:us
1 // SPDX-License-Identifier: GPL-2.0-or-later
16 #include <linux/delay.h>
62 return priv->chip->vol_reg_size; in tas571x_register_size()
88 for (i = size; i >= 1; --i) { in tas571x_reg_write()
99 return -EIO; in tas571x_reg_write()
116 msgs[0].addr = client->addr; in tas571x_reg_read()
121 msgs[1].addr = client->addr; in tas571x_reg_read()
126 ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); in tas571x_reg_read()
130 return -EIO; in tas571x_reg_read()
143 * register write for 8- and 20-byte registers
155 return -ENOMEM; in tas571x_reg_write_multiword()
170 return -EIO; in tas571x_reg_write_multiword()
174 * register read for 8- and 20-byte registers
188 return -ENOMEM; in tas571x_reg_read_multiword()
192 msgs[0].addr = client->addr; in tas571x_reg_read_multiword()
197 msgs[1].addr = client->addr; in tas571x_reg_read_multiword()
202 ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); in tas571x_reg_read_multiword()
206 ret = -EIO; in tas571x_reg_read_multiword()
224 * in the full 32-bits reange.
232 int numcoef = kcontrol->private_value >> 16; in tas571x_coefficient_info()
234 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in tas571x_coefficient_info()
235 uinfo->count = numcoef; in tas571x_coefficient_info()
236 uinfo->value.integer.min = 0; in tas571x_coefficient_info()
237 uinfo->value.integer.max = 0xffffffff; in tas571x_coefficient_info()
245 struct i2c_client *i2c = to_i2c_client(component->dev); in tas571x_coefficient_get()
246 int numcoef = kcontrol->private_value >> 16; in tas571x_coefficient_get()
247 int index = kcontrol->private_value & 0xffff; in tas571x_coefficient_get()
250 ucontrol->value.integer.value, numcoef); in tas571x_coefficient_get()
257 struct i2c_client *i2c = to_i2c_client(component->dev); in tas571x_coefficient_put()
258 int numcoef = kcontrol->private_value >> 16; in tas571x_coefficient_put()
259 int index = kcontrol->private_value & 0xffff; in tas571x_coefficient_put()
262 ucontrol->value.integer.value, numcoef); in tas571x_coefficient_put()
267 struct tas571x_private *priv = snd_soc_component_get_drvdata(dai->component); in tas571x_set_dai_fmt()
269 priv->format = format; in tas571x_set_dai_fmt()
278 struct tas571x_private *priv = snd_soc_component_get_drvdata(dai->component); in tas571x_hw_params()
281 switch (priv->format & SND_SOC_DAIFMT_FORMAT_MASK) { in tas571x_hw_params()
292 return -EINVAL; in tas571x_hw_params()
300 return regmap_update_bits(priv->regmap, TAS571X_SDI_REG, in tas571x_hw_params()
306 struct snd_soc_component *component = dai->component; in tas571x_mute()
334 if (!IS_ERR(priv->mclk)) { in tas571x_set_bias_level()
335 ret = clk_prepare_enable(priv->mclk); in tas571x_set_bias_level()
337 dev_err(component->dev, in tas571x_set_bias_level()
346 if (!IS_ERR(priv->mclk)) in tas571x_set_bias_level()
347 clk_disable_unprepare(priv->mclk); in tas571x_set_bias_level()
379 static const DECLARE_TLV_DB_SCALE(tas5711_volume_tlv, -10350, 50, 1);
459 static const DECLARE_TLV_DB_SCALE(tas5707_volume_tlv, -7900, 50, 1);
489 BIQUAD_COEFS("CH1 - Biquad 0", TAS5707_CH1_BQ0_REG),
490 BIQUAD_COEFS("CH1 - Biquad 1", TAS5707_CH1_BQ1_REG),
491 BIQUAD_COEFS("CH1 - Biquad 2", TAS5707_CH1_BQ2_REG),
492 BIQUAD_COEFS("CH1 - Biquad 3", TAS5707_CH1_BQ3_REG),
493 BIQUAD_COEFS("CH1 - Biquad 4", TAS5707_CH1_BQ4_REG),
494 BIQUAD_COEFS("CH1 - Biquad 5", TAS5707_CH1_BQ5_REG),
495 BIQUAD_COEFS("CH1 - Biquad 6", TAS5707_CH1_BQ6_REG),
497 BIQUAD_COEFS("CH2 - Biquad 0", TAS5707_CH2_BQ0_REG),
498 BIQUAD_COEFS("CH2 - Biquad 1", TAS5707_CH2_BQ1_REG),
499 BIQUAD_COEFS("CH2 - Biquad 2", TAS5707_CH2_BQ2_REG),
500 BIQUAD_COEFS("CH2 - Biquad 3", TAS5707_CH2_BQ3_REG),
501 BIQUAD_COEFS("CH2 - Biquad 4", TAS5707_CH2_BQ4_REG),
502 BIQUAD_COEFS("CH2 - Biquad 5", TAS5707_CH2_BQ5_REG),
503 BIQUAD_COEFS("CH2 - Biquad 6", TAS5707_CH2_BQ6_REG),
560 static const DECLARE_TLV_DB_SCALE(tas5717_volume_tlv, -10375, 25, 0);
563 /* MVOL LSB is ignored - see comments in tas571x_i2c_probe() */
590 BIQUAD_COEFS("CH1 - Biquad 0", TAS5717_CH1_BQ0_REG),
591 BIQUAD_COEFS("CH1 - Biquad 1", TAS5717_CH1_BQ1_REG),
592 BIQUAD_COEFS("CH1 - Biquad 2", TAS5717_CH1_BQ2_REG),
593 BIQUAD_COEFS("CH1 - Biquad 3", TAS5717_CH1_BQ3_REG),
594 BIQUAD_COEFS("CH1 - Biquad 4", TAS5717_CH1_BQ4_REG),
595 BIQUAD_COEFS("CH1 - Biquad 5", TAS5717_CH1_BQ5_REG),
596 BIQUAD_COEFS("CH1 - Biquad 6", TAS5717_CH1_BQ6_REG),
597 BIQUAD_COEFS("CH1 - Biquad 7", TAS5717_CH1_BQ7_REG),
598 BIQUAD_COEFS("CH1 - Biquad 8", TAS5717_CH1_BQ8_REG),
599 BIQUAD_COEFS("CH1 - Biquad 9", TAS5717_CH1_BQ9_REG),
600 BIQUAD_COEFS("CH1 - Biquad 10", TAS5717_CH1_BQ10_REG),
601 BIQUAD_COEFS("CH1 - Biquad 11", TAS5717_CH1_BQ11_REG),
603 BIQUAD_COEFS("CH2 - Biquad 0", TAS5717_CH2_BQ0_REG),
604 BIQUAD_COEFS("CH2 - Biquad 1", TAS5717_CH2_BQ1_REG),
605 BIQUAD_COEFS("CH2 - Biquad 2", TAS5717_CH2_BQ2_REG),
606 BIQUAD_COEFS("CH2 - Biquad 3", TAS5717_CH2_BQ3_REG),
607 BIQUAD_COEFS("CH2 - Biquad 4", TAS5717_CH2_BQ4_REG),
608 BIQUAD_COEFS("CH2 - Biquad 5", TAS5717_CH2_BQ5_REG),
609 BIQUAD_COEFS("CH2 - Biquad 6", TAS5717_CH2_BQ6_REG),
610 BIQUAD_COEFS("CH2 - Biquad 7", TAS5717_CH2_BQ7_REG),
611 BIQUAD_COEFS("CH2 - Biquad 8", TAS5717_CH2_BQ8_REG),
612 BIQUAD_COEFS("CH2 - Biquad 9", TAS5717_CH2_BQ9_REG),
613 BIQUAD_COEFS("CH2 - Biquad 10", TAS5717_CH2_BQ10_REG),
614 BIQUAD_COEFS("CH2 - Biquad 11", TAS5717_CH2_BQ11_REG),
616 BIQUAD_COEFS("CH3 - Biquad 0", TAS5717_CH3_BQ0_REG),
617 BIQUAD_COEFS("CH3 - Biquad 1", TAS5717_CH3_BQ1_REG),
619 BIQUAD_COEFS("CH4 - Biquad 0", TAS5717_CH4_BQ0_REG),
620 BIQUAD_COEFS("CH4 - Biquad 1", TAS5717_CH4_BQ1_REG),
763 .name = "tas571x-hifi",
782 struct device *dev = &client->dev; in tas571x_i2c_probe()
788 return -ENOMEM; in tas571x_i2c_probe()
793 priv->chip = of_id->data; in tas571x_i2c_probe()
795 priv->chip = (void *) id->driver_data; in tas571x_i2c_probe()
797 priv->mclk = devm_clk_get(dev, "mclk"); in tas571x_i2c_probe()
798 if (IS_ERR(priv->mclk) && PTR_ERR(priv->mclk) != -ENOENT) { in tas571x_i2c_probe()
799 dev_err(dev, "Failed to request mclk: %ld\n", in tas571x_i2c_probe()
800 PTR_ERR(priv->mclk)); in tas571x_i2c_probe()
801 return PTR_ERR(priv->mclk); in tas571x_i2c_probe()
804 if (WARN_ON(priv->chip->num_supply_names > TAS571X_MAX_SUPPLIES)) in tas571x_i2c_probe()
805 return -EINVAL; in tas571x_i2c_probe()
806 for (i = 0; i < priv->chip->num_supply_names; i++) in tas571x_i2c_probe()
807 priv->supplies[i].supply = priv->chip->supply_names[i]; in tas571x_i2c_probe()
809 ret = devm_regulator_bulk_get(dev, priv->chip->num_supply_names, in tas571x_i2c_probe()
810 priv->supplies); in tas571x_i2c_probe()
815 ret = regulator_bulk_enable(priv->chip->num_supply_names, in tas571x_i2c_probe()
816 priv->supplies); in tas571x_i2c_probe()
822 priv->regmap = devm_regmap_init(dev, NULL, client, in tas571x_i2c_probe()
823 priv->chip->regmap_config); in tas571x_i2c_probe()
824 if (IS_ERR(priv->regmap)) { in tas571x_i2c_probe()
825 ret = PTR_ERR(priv->regmap); in tas571x_i2c_probe()
829 priv->pdn_gpio = devm_gpiod_get_optional(dev, "pdn", GPIOD_OUT_LOW); in tas571x_i2c_probe()
830 if (IS_ERR(priv->pdn_gpio)) { in tas571x_i2c_probe()
831 dev_err(dev, "error requesting pdn_gpio: %ld\n", in tas571x_i2c_probe()
832 PTR_ERR(priv->pdn_gpio)); in tas571x_i2c_probe()
833 return PTR_ERR(priv->pdn_gpio); in tas571x_i2c_probe()
836 priv->reset_gpio = devm_gpiod_get_optional(dev, "reset", in tas571x_i2c_probe()
838 if (IS_ERR(priv->reset_gpio)) { in tas571x_i2c_probe()
839 dev_err(dev, "error requesting reset_gpio: %ld\n", in tas571x_i2c_probe()
840 PTR_ERR(priv->reset_gpio)); in tas571x_i2c_probe()
841 return PTR_ERR(priv->reset_gpio); in tas571x_i2c_probe()
842 } else if (priv->reset_gpio) { in tas571x_i2c_probe()
843 /* pulse the active low reset line for ~100us */ in tas571x_i2c_probe()
845 gpiod_set_value(priv->reset_gpio, 0); in tas571x_i2c_probe()
849 ret = regmap_write(priv->regmap, TAS571X_OSC_TRIM_REG, 0); in tas571x_i2c_probe()
855 memcpy(&priv->component_driver, &tas571x_component, sizeof(priv->component_driver)); in tas571x_i2c_probe()
856 priv->component_driver.controls = priv->chip->controls; in tas571x_i2c_probe()
857 priv->component_driver.num_controls = priv->chip->num_controls; in tas571x_i2c_probe()
859 if (priv->chip->vol_reg_size == 2) { in tas571x_i2c_probe()
865 ret = regmap_update_bits(priv->regmap, TAS571X_MVOL_REG, 1, 0); in tas571x_i2c_probe()
870 ret = devm_snd_soc_register_component(&client->dev, in tas571x_i2c_probe()
871 &priv->component_driver, in tas571x_i2c_probe()
879 regulator_bulk_disable(priv->chip->num_supply_names, priv->supplies); in tas571x_i2c_probe()
887 regulator_bulk_disable(priv->chip->num_supply_names, priv->supplies); in tas571x_i2c_remove()