Lines Matching +full:imon +full:- +full:slot +full:- +full:no
1 // SPDX-License-Identifier: GPL-2.0
20 #include <sound/soc-dapm.h>
130 dev_info(tas2562->dev, "%s, unsupported sample rate, %d\n", in tas2562_set_samplerate()
132 return -EINVAL; in tas2562_set_samplerate()
135 snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG0, in tas2562_set_samplerate()
137 snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG0, in tas2562_set_samplerate()
147 struct snd_soc_component *component = dai->component; in tas2562_set_dai_tdm_slot()
154 dev_err(component->dev, "tx masks must not be 0\n"); in tas2562_set_dai_tdm_slot()
155 return -EINVAL; in tas2562_set_dai_tdm_slot()
160 return -EINVAL; in tas2562_set_dai_tdm_slot()
201 /* Do not change slot width */ in tas2562_set_dai_tdm_slot()
204 dev_err(tas2562->dev, "slot width not supported"); in tas2562_set_dai_tdm_slot()
205 ret = -EINVAL; in tas2562_set_dai_tdm_slot()
213 tas2562->v_sense_slot); in tas2562_set_dai_tdm_slot()
219 tas2562->i_sense_slot); in tas2562_set_dai_tdm_slot()
234 snd_soc_component_update_bits(tas2562->component, in tas2562_set_bitwidth()
240 snd_soc_component_update_bits(tas2562->component, in tas2562_set_bitwidth()
246 snd_soc_component_update_bits(tas2562->component, in tas2562_set_bitwidth()
253 dev_info(tas2562->dev, "Unsupported bitwidth format\n"); in tas2562_set_bitwidth()
254 return -EINVAL; in tas2562_set_bitwidth()
257 val = snd_soc_component_read(tas2562->component, TAS2562_PWR_CTRL); in tas2562_set_bitwidth()
266 ret = snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG5, in tas2562_set_bitwidth()
276 ret = snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG6, in tas2562_set_bitwidth()
288 struct snd_soc_component *component = dai->component; in tas2562_hw_params()
294 dev_err(tas2562->dev, "set bitwidth failed, %d\n", ret); in tas2562_hw_params()
300 dev_err(tas2562->dev, "set sample rate failed, %d\n", ret); in tas2562_hw_params()
307 struct snd_soc_component *component = dai->component; in tas2562_set_dai_fmt()
321 dev_err(tas2562->dev, "ASI format Inverse is not found\n"); in tas2562_set_dai_fmt()
322 return -EINVAL; in tas2562_set_dai_fmt()
329 dev_err(tas2562->dev, "Failed to set RX edge\n"); in tas2562_set_dai_fmt()
342 dev_err(tas2562->dev, in tas2562_set_dai_fmt()
344 return -EINVAL; in tas2562_set_dai_fmt()
357 struct snd_soc_component *component = tas2562->component; in tas2562_update_pwr_ctrl()
361 if (tas2562->dac_powered) in tas2562_update_pwr_ctrl()
362 val = tas2562->unmuted ? in tas2562_update_pwr_ctrl()
377 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(dai->component); in tas2562_mute()
379 tas2562->unmuted = !mute; in tas2562_mute()
387 tas2562->component = component; in tas2562_codec_probe()
389 if (tas2562->sdz_gpio) in tas2562_codec_probe()
390 gpiod_set_value_cansleep(tas2562->sdz_gpio, 1); in tas2562_codec_probe()
400 regcache_cache_only(tas2562->regmap, true); in tas2562_suspend()
401 regcache_mark_dirty(tas2562->regmap); in tas2562_suspend()
403 if (tas2562->sdz_gpio) in tas2562_suspend()
404 gpiod_set_value_cansleep(tas2562->sdz_gpio, 0); in tas2562_suspend()
413 if (tas2562->sdz_gpio) in tas2562_resume()
414 gpiod_set_value_cansleep(tas2562->sdz_gpio, 1); in tas2562_resume()
416 regcache_cache_only(tas2562->regmap, false); in tas2562_resume()
418 return regcache_sync(tas2562->regmap); in tas2562_resume()
439 snd_soc_dapm_to_component(w->dapm); in tas2562_dac_event()
445 tas2562->dac_powered = true; in tas2562_dac_event()
449 tas2562->dac_powered = false; in tas2562_dac_event()
453 dev_err(tas2562->dev, "Not supported evevt\n"); in tas2562_dac_event()
454 return -EINVAL; in tas2562_dac_event()
466 ucontrol->value.integer.value[0] = tas2562->volume_lvl; in tas2562_volume_control_get()
478 reg_val = float_vol_db_lookup[ucontrol->value.integer.value[0]/2]; in tas2562_volume_control_put()
496 tas2562->volume_lvl = ucontrol->value.integer.value[0]; in tas2562_volume_control_put()
501 /* Digital Volume Control. From 0 dB to -110 dB in 1 dB steps */
502 static const DECLARE_TLV_DB_SCALE(dvc_tlv, -11000, 100, 0);
570 SND_SOC_DAPM_SIGGEN("IMON"),
581 {"ISENSE", "Switch", "IMON"},
610 .name = "tas2562-amplifier",
669 struct device *dev = tas2562->dev; in tas2562_parse_dt()
672 tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); in tas2562_parse_dt()
673 if (IS_ERR(tas2562->sdz_gpio)) { in tas2562_parse_dt()
674 if (PTR_ERR(tas2562->sdz_gpio) == -EPROBE_DEFER) in tas2562_parse_dt()
675 return -EPROBE_DEFER; in tas2562_parse_dt()
677 tas2562->sdz_gpio = NULL; in tas2562_parse_dt()
681 * The shut-down property is deprecated but needs to be checked for in tas2562_parse_dt()
684 if (tas2562->sdz_gpio == NULL) { in tas2562_parse_dt()
685 tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shut-down", in tas2562_parse_dt()
687 if (IS_ERR(tas2562->sdz_gpio)) in tas2562_parse_dt()
688 if (PTR_ERR(tas2562->sdz_gpio) == -EPROBE_DEFER) in tas2562_parse_dt()
689 return -EPROBE_DEFER; in tas2562_parse_dt()
691 tas2562->sdz_gpio = NULL; in tas2562_parse_dt()
694 if (tas2562->model_id == TAS2110) in tas2562_parse_dt()
697 ret = fwnode_property_read_u32(dev->fwnode, "ti,imon-slot-no", in tas2562_parse_dt()
698 &tas2562->i_sense_slot); in tas2562_parse_dt()
700 dev_err(dev, "Property %s is missing setting default slot\n", in tas2562_parse_dt()
701 "ti,imon-slot-no"); in tas2562_parse_dt()
702 tas2562->i_sense_slot = 0; in tas2562_parse_dt()
706 ret = fwnode_property_read_u32(dev->fwnode, "ti,vmon-slot-no", in tas2562_parse_dt()
707 &tas2562->v_sense_slot); in tas2562_parse_dt()
709 dev_info(dev, "Property %s is missing setting default slot\n", in tas2562_parse_dt()
710 "ti,vmon-slot-no"); in tas2562_parse_dt()
711 tas2562->v_sense_slot = 2; in tas2562_parse_dt()
714 if (tas2562->v_sense_slot < tas2562->i_sense_slot) { in tas2562_parse_dt()
715 dev_err(dev, "Vsense slot must be greater than Isense slot\n"); in tas2562_parse_dt()
716 return -EINVAL; in tas2562_parse_dt()
733 struct device *dev = &client->dev; in tas2562_probe()
740 return -ENOMEM; in tas2562_probe()
743 data->client = client; in tas2562_probe()
744 data->dev = &client->dev; in tas2562_probe()
745 data->model_id = id->driver_data; in tas2562_probe()
749 data->regmap = devm_regmap_init_i2c(client, &tas2562_regmap_config); in tas2562_probe()
750 if (IS_ERR(data->regmap)) { in tas2562_probe()
751 ret = PTR_ERR(data->regmap); in tas2562_probe()
756 dev_set_drvdata(&client->dev, data); in tas2562_probe()
758 if (data->model_id == TAS2110) in tas2562_probe()