Lines Matching full:tas2562

3 // Driver for the Texas Instruments TAS2562 CODEC
23 #include "tas2562.h"
61 TAS2562, enumerator
66 static int tas2562_set_samplerate(struct tas2562_data *tas2562, int samplerate) in tas2562_set_samplerate() argument
129 dev_info(tas2562->dev, "%s, unsupported sample rate, %d\n", 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()
147 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_set_dai_tdm_slot() local
203 dev_err(tas2562->dev, "slot width not supported"); 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()
225 static int tas2562_set_bitwidth(struct tas2562_data *tas2562, int bitwidth) in tas2562_set_bitwidth() argument
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()
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()
288 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_hw_params() local
291 ret = tas2562_set_bitwidth(tas2562, params_format(params)); in tas2562_hw_params()
293 dev_err(tas2562->dev, "set bitwidth failed, %d\n", ret); in tas2562_hw_params()
297 ret = tas2562_set_samplerate(tas2562, params_rate(params)); in tas2562_hw_params()
299 dev_err(tas2562->dev, "set sample rate failed, %d\n", ret); in tas2562_hw_params()
307 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_set_dai_fmt() local
320 dev_err(tas2562->dev, "ASI format Inverse is not found\n"); 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()
354 static int tas2562_update_pwr_ctrl(struct tas2562_data *tas2562) in tas2562_update_pwr_ctrl() argument
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() local
378 tas2562->unmuted = !mute; in tas2562_mute()
379 return tas2562_update_pwr_ctrl(tas2562); in tas2562_mute()
384 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_codec_probe() local
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()
397 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_suspend() local
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()
410 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_resume() local
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()
439 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_dac_event() local
444 tas2562->dac_powered = true; in tas2562_dac_event()
445 ret = tas2562_update_pwr_ctrl(tas2562); in tas2562_dac_event()
448 tas2562->dac_powered = false; in tas2562_dac_event()
449 ret = tas2562_update_pwr_ctrl(tas2562); in tas2562_dac_event()
452 dev_err(tas2562->dev, "Not supported evevt\n"); in tas2562_dac_event()
463 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_volume_control_get() local
465 ucontrol->value.integer.value[0] = tas2562->volume_lvl; in tas2562_volume_control_get()
473 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_volume_control_put() local
495 tas2562->volume_lvl = ucontrol->value.integer.value[0]; in tas2562_volume_control_put()
609 .name = "tas2562-amplifier",
666 static int tas2562_parse_dt(struct tas2562_data *tas2562) in tas2562_parse_dt() argument
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()
676 tas2562->sdz_gpio = NULL; 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()
690 tas2562->sdz_gpio = NULL; in tas2562_parse_dt()
693 if (tas2562->model_id == TAS2110) in tas2562_parse_dt()
697 &tas2562->i_sense_slot); in tas2562_parse_dt()
701 tas2562->i_sense_slot = 0; in tas2562_parse_dt()
706 &tas2562->v_sense_slot); 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()
722 { "tas2562", TAS2562 },
770 { .compatible = "ti,tas2562", },
780 .name = "tas2562",
790 MODULE_DESCRIPTION("TAS2562 Audio amplifier driver");