Lines Matching +full:vmon +full:- +full:slot +full:- +full:no
1 // SPDX-License-Identifier: GPL-2.0
21 #include <sound/soc-dapm.h>
131 dev_info(tas2562->dev, "%s, unsupported sample rate, %d\n", in tas2562_set_samplerate()
133 return -EINVAL; in tas2562_set_samplerate()
136 snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG0, in tas2562_set_samplerate()
138 snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG0, in tas2562_set_samplerate()
148 struct snd_soc_component *component = dai->component; in tas2562_set_dai_tdm_slot()
155 dev_err(component->dev, "tx masks must not be 0\n"); in tas2562_set_dai_tdm_slot()
156 return -EINVAL; in tas2562_set_dai_tdm_slot()
161 return -EINVAL; in tas2562_set_dai_tdm_slot()
202 /* Do not change slot width */ in tas2562_set_dai_tdm_slot()
205 dev_err(tas2562->dev, "slot width not supported"); in tas2562_set_dai_tdm_slot()
206 ret = -EINVAL; in tas2562_set_dai_tdm_slot()
214 tas2562->v_sense_slot); in tas2562_set_dai_tdm_slot()
220 tas2562->i_sense_slot); in tas2562_set_dai_tdm_slot()
235 snd_soc_component_update_bits(tas2562->component, in tas2562_set_bitwidth()
241 snd_soc_component_update_bits(tas2562->component, in tas2562_set_bitwidth()
247 snd_soc_component_update_bits(tas2562->component, in tas2562_set_bitwidth()
254 dev_info(tas2562->dev, "Unsupported bitwidth format\n"); in tas2562_set_bitwidth()
255 return -EINVAL; in tas2562_set_bitwidth()
258 val = snd_soc_component_read(tas2562->component, TAS2562_PWR_CTRL); in tas2562_set_bitwidth()
267 ret = snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG5, in tas2562_set_bitwidth()
277 ret = snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG6, in tas2562_set_bitwidth()
289 struct snd_soc_component *component = dai->component; in tas2562_hw_params()
295 dev_err(tas2562->dev, "set bitwidth failed, %d\n", ret); in tas2562_hw_params()
301 dev_err(tas2562->dev, "set sample rate failed, %d\n", ret); in tas2562_hw_params()
308 struct snd_soc_component *component = dai->component; in tas2562_set_dai_fmt()
322 dev_err(tas2562->dev, "ASI format Inverse is not found\n"); in tas2562_set_dai_fmt()
323 return -EINVAL; in tas2562_set_dai_fmt()
330 dev_err(tas2562->dev, "Failed to set RX edge\n"); in tas2562_set_dai_fmt()
343 dev_err(tas2562->dev, in tas2562_set_dai_fmt()
345 return -EINVAL; in tas2562_set_dai_fmt()
358 struct snd_soc_component *component = tas2562->component; in tas2562_update_pwr_ctrl()
362 if (tas2562->dac_powered) in tas2562_update_pwr_ctrl()
363 val = tas2562->unmuted ? in tas2562_update_pwr_ctrl()
378 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(dai->component); in tas2562_mute()
380 tas2562->unmuted = !mute; in tas2562_mute()
388 tas2562->component = component; in tas2562_codec_probe()
390 if (tas2562->sdz_gpio) in tas2562_codec_probe()
391 gpiod_set_value_cansleep(tas2562->sdz_gpio, 1); in tas2562_codec_probe()
401 regcache_cache_only(tas2562->regmap, true); in tas2562_suspend()
402 regcache_mark_dirty(tas2562->regmap); in tas2562_suspend()
404 if (tas2562->sdz_gpio) in tas2562_suspend()
405 gpiod_set_value_cansleep(tas2562->sdz_gpio, 0); in tas2562_suspend()
414 if (tas2562->sdz_gpio) in tas2562_resume()
415 gpiod_set_value_cansleep(tas2562->sdz_gpio, 1); in tas2562_resume()
417 regcache_cache_only(tas2562->regmap, false); in tas2562_resume()
419 return regcache_sync(tas2562->regmap); in tas2562_resume()
440 snd_soc_dapm_to_component(w->dapm); in tas2562_dac_event()
446 tas2562->dac_powered = true; in tas2562_dac_event()
450 tas2562->dac_powered = false; in tas2562_dac_event()
454 dev_err(tas2562->dev, "Not supported evevt\n"); in tas2562_dac_event()
455 return -EINVAL; in tas2562_dac_event()
467 ucontrol->value.integer.value[0] = tas2562->volume_lvl; in tas2562_volume_control_get()
479 reg_val = float_vol_db_lookup[ucontrol->value.integer.value[0]/2]; in tas2562_volume_control_put()
497 tas2562->volume_lvl = ucontrol->value.integer.value[0]; in tas2562_volume_control_put()
502 /* Digital Volume Control. From 0 dB to -110 dB in 1 dB steps */
503 static const DECLARE_TLV_DB_SCALE(dvc_tlv, -11000, 100, 0);
570 SND_SOC_DAPM_SIGGEN("VMON"),
583 {"VSENSE", "Switch", "VMON"},
611 .name = "tas2562-amplifier",
670 struct device *dev = tas2562->dev; in tas2562_parse_dt()
673 tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); in tas2562_parse_dt()
674 if (IS_ERR(tas2562->sdz_gpio)) { in tas2562_parse_dt()
675 if (PTR_ERR(tas2562->sdz_gpio) == -EPROBE_DEFER) in tas2562_parse_dt()
676 return -EPROBE_DEFER; in tas2562_parse_dt()
678 tas2562->sdz_gpio = NULL; in tas2562_parse_dt()
682 * The shut-down property is deprecated but needs to be checked for in tas2562_parse_dt()
685 if (tas2562->sdz_gpio == NULL) { in tas2562_parse_dt()
686 tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shut-down", in tas2562_parse_dt()
688 if (IS_ERR(tas2562->sdz_gpio)) in tas2562_parse_dt()
689 if (PTR_ERR(tas2562->sdz_gpio) == -EPROBE_DEFER) in tas2562_parse_dt()
690 return -EPROBE_DEFER; in tas2562_parse_dt()
692 tas2562->sdz_gpio = NULL; in tas2562_parse_dt()
695 if (tas2562->model_id == TAS2110) in tas2562_parse_dt()
698 ret = fwnode_property_read_u32(dev->fwnode, "ti,imon-slot-no", in tas2562_parse_dt()
699 &tas2562->i_sense_slot); in tas2562_parse_dt()
701 dev_err(dev, "Property %s is missing setting default slot\n", in tas2562_parse_dt()
702 "ti,imon-slot-no"); in tas2562_parse_dt()
703 tas2562->i_sense_slot = 0; in tas2562_parse_dt()
707 ret = fwnode_property_read_u32(dev->fwnode, "ti,vmon-slot-no", in tas2562_parse_dt()
708 &tas2562->v_sense_slot); in tas2562_parse_dt()
710 dev_info(dev, "Property %s is missing setting default slot\n", in tas2562_parse_dt()
711 "ti,vmon-slot-no"); in tas2562_parse_dt()
712 tas2562->v_sense_slot = 2; in tas2562_parse_dt()
715 if (tas2562->v_sense_slot < tas2562->i_sense_slot) { in tas2562_parse_dt()
716 dev_err(dev, "Vsense slot must be greater than Isense slot\n"); in tas2562_parse_dt()
717 return -EINVAL; in tas2562_parse_dt()
734 struct device *dev = &client->dev; in tas2562_probe()
741 return -ENOMEM; in tas2562_probe()
744 data->client = client; in tas2562_probe()
745 data->dev = &client->dev; in tas2562_probe()
746 data->model_id = id->driver_data; in tas2562_probe()
750 data->regmap = devm_regmap_init_i2c(client, &tas2562_regmap_config); in tas2562_probe()
751 if (IS_ERR(data->regmap)) { in tas2562_probe()
752 ret = PTR_ERR(data->regmap); in tas2562_probe()
757 dev_set_drvdata(&client->dev, data); in tas2562_probe()
759 if (data->model_id == TAS2110) in tas2562_probe()