Lines Matching +full:imon +full:- +full:slot +full:- +full:no
1 // SPDX-License-Identifier: GPL-2.0
20 #include <sound/soc-dapm.h>
129 dev_info(tas2562->dev, "%s, unsupported sample rate, %d\n",
131 return -EINVAL;
134 snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG0,
136 snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG0,
146 struct snd_soc_component *component = dai->component;
153 dev_err(component->dev, "tx masks must not be 0\n");
154 return -EINVAL;
159 return -EINVAL;
200 /* Do not change slot width */
203 dev_err(tas2562->dev, "slot width not supported");
204 ret = -EINVAL;
212 tas2562->v_sense_slot);
218 tas2562->i_sense_slot);
233 snd_soc_component_update_bits(tas2562->component,
239 snd_soc_component_update_bits(tas2562->component,
245 snd_soc_component_update_bits(tas2562->component,
252 dev_info(tas2562->dev, "Unsupported bitwidth format\n");
253 return -EINVAL;
256 val = snd_soc_component_read(tas2562->component, TAS2562_PWR_CTRL);
265 ret = snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG5,
275 ret = snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG6,
287 struct snd_soc_component *component = dai->component;
293 dev_err(tas2562->dev, "set bitwidth failed, %d\n", ret);
299 dev_err(tas2562->dev, "set sample rate failed, %d\n", ret);
306 struct snd_soc_component *component = dai->component;
320 dev_err(tas2562->dev, "ASI format Inverse is not found\n");
321 return -EINVAL;
328 dev_err(tas2562->dev, "Failed to set RX edge\n");
341 dev_err(tas2562->dev,
343 return -EINVAL;
356 struct snd_soc_component *component = tas2562->component;
360 if (tas2562->dac_powered)
361 val = tas2562->unmuted ?
376 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(dai->component);
378 tas2562->unmuted = !mute;
386 tas2562->component = component;
388 if (tas2562->sdz_gpio)
389 gpiod_set_value_cansleep(tas2562->sdz_gpio, 1);
399 regcache_cache_only(tas2562->regmap, true);
400 regcache_mark_dirty(tas2562->regmap);
402 if (tas2562->sdz_gpio)
403 gpiod_set_value_cansleep(tas2562->sdz_gpio, 0);
412 if (tas2562->sdz_gpio)
413 gpiod_set_value_cansleep(tas2562->sdz_gpio, 1);
415 regcache_cache_only(tas2562->regmap, false);
417 return regcache_sync(tas2562->regmap);
438 snd_soc_dapm_to_component(w->dapm);
444 tas2562->dac_powered = true;
448 tas2562->dac_powered = false;
452 dev_err(tas2562->dev, "Not supported evevt\n");
453 return -EINVAL;
465 ucontrol->value.integer.value[0] = tas2562->volume_lvl;
477 reg_val = float_vol_db_lookup[ucontrol->value.integer.value[0]/2];
495 tas2562->volume_lvl = ucontrol->value.integer.value[0];
500 /* Digital Volume Control. From 0 dB to -110 dB in 1 dB steps */
501 static const DECLARE_TLV_DB_SCALE(dvc_tlv, -11000, 100, 0);
561 SND_SOC_DAPM_SIGGEN("IMON"),
572 {"ISENSE", "Switch", "IMON"},
601 .name = "tas2562-amplifier",
660 struct device *dev = tas2562->dev;
663 tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH);
664 if (IS_ERR(tas2562->sdz_gpio)) {
665 if (PTR_ERR(tas2562->sdz_gpio) == -EPROBE_DEFER)
666 return -EPROBE_DEFER;
668 tas2562->sdz_gpio = NULL;
672 * The shut-down property is deprecated but needs to be checked for
675 if (tas2562->sdz_gpio == NULL) {
676 tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shut-down",
678 if (IS_ERR(tas2562->sdz_gpio))
679 if (PTR_ERR(tas2562->sdz_gpio) == -EPROBE_DEFER)
680 return -EPROBE_DEFER;
682 tas2562->sdz_gpio = NULL;
685 if (tas2562->model_id == TAS2110)
688 ret = fwnode_property_read_u32(dev->fwnode, "ti,imon-slot-no",
689 &tas2562->i_sense_slot);
691 dev_err(dev, "Property %s is missing setting default slot\n",
692 "ti,imon-slot-no");
693 tas2562->i_sense_slot = 0;
697 ret = fwnode_property_read_u32(dev->fwnode, "ti,vmon-slot-no",
698 &tas2562->v_sense_slot);
700 dev_info(dev, "Property %s is missing setting default slot\n",
701 "ti,vmon-slot-no");
702 tas2562->v_sense_slot = 2;
705 if (tas2562->v_sense_slot < tas2562->i_sense_slot) {
706 dev_err(dev, "Vsense slot must be greater than Isense slot\n");
707 return -EINVAL;
723 struct device *dev = &client->dev;
729 return -ENOMEM;
731 data->client = client;
732 data->dev = &client->dev;
733 data->model_id = (uintptr_t)i2c_get_match_data(client);
737 data->regmap = devm_regmap_init_i2c(client, &tas2562_regmap_config);
738 if (IS_ERR(data->regmap)) {
739 ret = PTR_ERR(data->regmap);
744 dev_set_drvdata(&client->dev, data);
746 if (data->model_id == TAS2110)