Lines Matching +full:vmon +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", in tas2562_set_samplerate()
131 return -EINVAL; in tas2562_set_samplerate()
134 snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG0, in tas2562_set_samplerate()
136 snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG0, in tas2562_set_samplerate()
146 struct snd_soc_component *component = dai->component; in tas2562_set_dai_tdm_slot()
153 dev_err(component->dev, "tx masks must not be 0\n"); in tas2562_set_dai_tdm_slot()
154 return -EINVAL; in tas2562_set_dai_tdm_slot()
159 return -EINVAL; in tas2562_set_dai_tdm_slot()
200 /* Do not change slot width */ in tas2562_set_dai_tdm_slot()
203 dev_err(tas2562->dev, "slot width not supported"); in tas2562_set_dai_tdm_slot()
204 ret = -EINVAL; in tas2562_set_dai_tdm_slot()
212 tas2562->v_sense_slot); in tas2562_set_dai_tdm_slot()
218 tas2562->i_sense_slot); in tas2562_set_dai_tdm_slot()
233 snd_soc_component_update_bits(tas2562->component, in tas2562_set_bitwidth()
239 snd_soc_component_update_bits(tas2562->component, in tas2562_set_bitwidth()
245 snd_soc_component_update_bits(tas2562->component, in tas2562_set_bitwidth()
252 dev_info(tas2562->dev, "Unsupported bitwidth format\n"); in tas2562_set_bitwidth()
253 return -EINVAL; in tas2562_set_bitwidth()
256 val = snd_soc_component_read(tas2562->component, TAS2562_PWR_CTRL); in tas2562_set_bitwidth()
265 ret = snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG5, in tas2562_set_bitwidth()
275 ret = snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG6, in tas2562_set_bitwidth()
287 struct snd_soc_component *component = dai->component; in tas2562_hw_params()
293 dev_err(tas2562->dev, "set bitwidth failed, %d\n", ret); in tas2562_hw_params()
299 dev_err(tas2562->dev, "set sample rate failed, %d\n", ret); in tas2562_hw_params()
306 struct snd_soc_component *component = dai->component; in tas2562_set_dai_fmt()
320 dev_err(tas2562->dev, "ASI format Inverse is not found\n"); in tas2562_set_dai_fmt()
321 return -EINVAL; in tas2562_set_dai_fmt()
328 dev_err(tas2562->dev, "Failed to set RX edge\n"); in tas2562_set_dai_fmt()
341 dev_err(tas2562->dev, in tas2562_set_dai_fmt()
343 return -EINVAL; in tas2562_set_dai_fmt()
356 struct snd_soc_component *component = tas2562->component; in tas2562_update_pwr_ctrl()
360 if (tas2562->dac_powered) in tas2562_update_pwr_ctrl()
361 val = tas2562->unmuted ? in tas2562_update_pwr_ctrl()
376 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(dai->component); in tas2562_mute()
378 tas2562->unmuted = !mute; in tas2562_mute()
386 tas2562->component = component; in tas2562_codec_probe()
388 if (tas2562->sdz_gpio) in tas2562_codec_probe()
389 gpiod_set_value_cansleep(tas2562->sdz_gpio, 1); in tas2562_codec_probe()
399 regcache_cache_only(tas2562->regmap, true); in tas2562_suspend()
400 regcache_mark_dirty(tas2562->regmap); in tas2562_suspend()
402 if (tas2562->sdz_gpio) in tas2562_suspend()
403 gpiod_set_value_cansleep(tas2562->sdz_gpio, 0); in tas2562_suspend()
412 if (tas2562->sdz_gpio) in tas2562_resume()
413 gpiod_set_value_cansleep(tas2562->sdz_gpio, 1); in tas2562_resume()
415 regcache_cache_only(tas2562->regmap, false); in tas2562_resume()
417 return regcache_sync(tas2562->regmap); in tas2562_resume()
438 snd_soc_dapm_to_component(w->dapm); in tas2562_dac_event()
444 tas2562->dac_powered = true; in tas2562_dac_event()
448 tas2562->dac_powered = false; in tas2562_dac_event()
452 dev_err(tas2562->dev, "Not supported evevt\n"); in tas2562_dac_event()
453 return -EINVAL; in tas2562_dac_event()
465 ucontrol->value.integer.value[0] = tas2562->volume_lvl; in tas2562_volume_control_get()
477 reg_val = float_vol_db_lookup[ucontrol->value.integer.value[0]/2]; in tas2562_volume_control_put()
495 tas2562->volume_lvl = ucontrol->value.integer.value[0]; in tas2562_volume_control_put()
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);
568 SND_SOC_DAPM_SIGGEN("VMON"),
581 {"VSENSE", "Switch", "VMON"},
609 .name = "tas2562-amplifier",
668 struct device *dev = tas2562->dev; in tas2562_parse_dt()
671 tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); in tas2562_parse_dt()
672 if (IS_ERR(tas2562->sdz_gpio)) { in tas2562_parse_dt()
673 if (PTR_ERR(tas2562->sdz_gpio) == -EPROBE_DEFER) in tas2562_parse_dt()
674 return -EPROBE_DEFER; in tas2562_parse_dt()
676 tas2562->sdz_gpio = NULL; in tas2562_parse_dt()
680 * The shut-down property is deprecated but needs to be checked for in tas2562_parse_dt()
683 if (tas2562->sdz_gpio == NULL) { in tas2562_parse_dt()
684 tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shut-down", in tas2562_parse_dt()
686 if (IS_ERR(tas2562->sdz_gpio)) in tas2562_parse_dt()
687 if (PTR_ERR(tas2562->sdz_gpio) == -EPROBE_DEFER) in tas2562_parse_dt()
688 return -EPROBE_DEFER; in tas2562_parse_dt()
690 tas2562->sdz_gpio = NULL; in tas2562_parse_dt()
693 if (tas2562->model_id == TAS2110) in tas2562_parse_dt()
696 ret = fwnode_property_read_u32(dev->fwnode, "ti,imon-slot-no", in tas2562_parse_dt()
697 &tas2562->i_sense_slot); in tas2562_parse_dt()
699 dev_err(dev, "Property %s is missing setting default slot\n", in tas2562_parse_dt()
700 "ti,imon-slot-no"); in tas2562_parse_dt()
701 tas2562->i_sense_slot = 0; in tas2562_parse_dt()
705 ret = fwnode_property_read_u32(dev->fwnode, "ti,vmon-slot-no", in tas2562_parse_dt()
706 &tas2562->v_sense_slot); in tas2562_parse_dt()
708 dev_info(dev, "Property %s is missing setting default slot\n", in tas2562_parse_dt()
709 "ti,vmon-slot-no"); in tas2562_parse_dt()
710 tas2562->v_sense_slot = 2; in tas2562_parse_dt()
713 if (tas2562->v_sense_slot < tas2562->i_sense_slot) { in tas2562_parse_dt()
714 dev_err(dev, "Vsense slot must be greater than Isense slot\n"); in tas2562_parse_dt()
715 return -EINVAL; in tas2562_parse_dt()
731 struct device *dev = &client->dev; in tas2562_probe()
738 return -ENOMEM; in tas2562_probe()
741 data->client = client; in tas2562_probe()
742 data->dev = &client->dev; in tas2562_probe()
743 data->model_id = id->driver_data; in tas2562_probe()
747 data->regmap = devm_regmap_init_i2c(client, &tas2562_regmap_config); in tas2562_probe()
748 if (IS_ERR(data->regmap)) { in tas2562_probe()
749 ret = PTR_ERR(data->regmap); in tas2562_probe()
754 dev_set_drvdata(&client->dev, data); in tas2562_probe()
756 if (data->model_id == TAS2110) in tas2562_probe()