Lines Matching full:tas2562

3 // Driver for the Texas Instruments TAS2562 CODEC
24 #include "tas2562.h"
62 TAS2562, enumerator
68 static int tas2562_set_samplerate(struct tas2562_data *tas2562, int samplerate) in tas2562_set_samplerate() argument
131 dev_info(tas2562->dev, "%s, unsupported sample rate, %d\n", 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()
149 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_set_dai_tdm_slot() local
205 dev_err(tas2562->dev, "slot width not supported"); 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()
227 static int tas2562_set_bitwidth(struct tas2562_data *tas2562, int bitwidth) in tas2562_set_bitwidth() argument
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()
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()
290 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_hw_params() local
293 ret = tas2562_set_bitwidth(tas2562, params_format(params)); in tas2562_hw_params()
295 dev_err(tas2562->dev, "set bitwidth failed, %d\n", ret); in tas2562_hw_params()
299 ret = tas2562_set_samplerate(tas2562, params_rate(params)); in tas2562_hw_params()
301 dev_err(tas2562->dev, "set sample rate failed, %d\n", ret); in tas2562_hw_params()
309 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_set_dai_fmt() local
322 dev_err(tas2562->dev, "ASI format Inverse is not found\n"); 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()
356 static int tas2562_update_pwr_ctrl(struct tas2562_data *tas2562) in tas2562_update_pwr_ctrl() argument
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() local
380 tas2562->unmuted = !mute; in tas2562_mute()
381 return tas2562_update_pwr_ctrl(tas2562); in tas2562_mute()
386 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_codec_probe() local
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()
399 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_suspend() local
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()
412 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_resume() local
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()
441 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_dac_event() local
446 tas2562->dac_powered = true; in tas2562_dac_event()
447 ret = tas2562_update_pwr_ctrl(tas2562); in tas2562_dac_event()
450 tas2562->dac_powered = false; in tas2562_dac_event()
451 ret = tas2562_update_pwr_ctrl(tas2562); in tas2562_dac_event()
454 dev_err(tas2562->dev, "Not supported evevt\n"); in tas2562_dac_event()
465 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_volume_control_get() local
467 ucontrol->value.integer.value[0] = tas2562->volume_lvl; in tas2562_volume_control_get()
475 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_volume_control_put() local
497 tas2562->volume_lvl = ucontrol->value.integer.value[0]; in tas2562_volume_control_put()
611 .name = "tas2562-amplifier",
668 static int tas2562_parse_dt(struct tas2562_data *tas2562) in tas2562_parse_dt() argument
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()
678 tas2562->sdz_gpio = NULL; 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()
692 tas2562->sdz_gpio = NULL; in tas2562_parse_dt()
695 if (tas2562->model_id == TAS2110) in tas2562_parse_dt()
699 &tas2562->i_sense_slot); in tas2562_parse_dt()
703 tas2562->i_sense_slot = 0; in tas2562_parse_dt()
708 &tas2562->v_sense_slot); 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()
724 { "tas2562", TAS2562 },
773 { .compatible = "ti,tas2562", },
784 .name = "tas2562",
794 MODULE_DESCRIPTION("TAS2562 Audio amplifier driver");