Lines Matching full:tas2562
3 // Driver for the Texas Instruments TAS2562 CODEC
24 #include "tas2562.h"
60 TAS2562, enumerator
69 struct tas2562_data *tas2562 = in tas2562_set_bias_level() local
91 dev_err(tas2562->dev, in tas2562_set_bias_level()
99 static int tas2562_set_samplerate(struct tas2562_data *tas2562, int samplerate) in tas2562_set_samplerate() argument
162 dev_info(tas2562->dev, "%s, unsupported sample rate, %d\n", in tas2562_set_samplerate()
167 snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG0, in tas2562_set_samplerate()
169 snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG0, in tas2562_set_samplerate()
180 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_set_dai_tdm_slot() local
237 dev_err(tas2562->dev, "slot width not supported"); in tas2562_set_dai_tdm_slot()
246 tas2562->v_sense_slot); in tas2562_set_dai_tdm_slot()
252 tas2562->i_sense_slot); in tas2562_set_dai_tdm_slot()
259 static int tas2562_set_bitwidth(struct tas2562_data *tas2562, int bitwidth) in tas2562_set_bitwidth() argument
267 snd_soc_component_update_bits(tas2562->component, in tas2562_set_bitwidth()
273 snd_soc_component_update_bits(tas2562->component, in tas2562_set_bitwidth()
279 snd_soc_component_update_bits(tas2562->component, in tas2562_set_bitwidth()
286 dev_info(tas2562->dev, "Unsupported bitwidth format\n"); in tas2562_set_bitwidth()
290 val = snd_soc_component_read(tas2562->component, TAS2562_PWR_CTRL); in tas2562_set_bitwidth()
299 ret = snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG5, in tas2562_set_bitwidth()
309 ret = snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG6, in tas2562_set_bitwidth()
322 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_hw_params() local
325 ret = tas2562_set_bitwidth(tas2562, params_format(params)); in tas2562_hw_params()
327 dev_err(tas2562->dev, "set bitwidth failed, %d\n", ret); in tas2562_hw_params()
331 ret = tas2562_set_samplerate(tas2562, params_rate(params)); in tas2562_hw_params()
333 dev_err(tas2562->dev, "set sample rate failed, %d\n", ret); in tas2562_hw_params()
341 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_set_dai_fmt() local
354 dev_err(tas2562->dev, "ASI format Inverse is not found\n"); in tas2562_set_dai_fmt()
362 dev_err(tas2562->dev, "Failed to set RX edge\n"); in tas2562_set_dai_fmt()
375 dev_err(tas2562->dev, in tas2562_set_dai_fmt()
399 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_codec_probe() local
402 tas2562->component = component; in tas2562_codec_probe()
404 if (tas2562->sdz_gpio) in tas2562_codec_probe()
405 gpiod_set_value_cansleep(tas2562->sdz_gpio, 1); in tas2562_codec_probe()
418 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_suspend() local
420 regcache_cache_only(tas2562->regmap, true); in tas2562_suspend()
421 regcache_mark_dirty(tas2562->regmap); in tas2562_suspend()
423 if (tas2562->sdz_gpio) in tas2562_suspend()
424 gpiod_set_value_cansleep(tas2562->sdz_gpio, 0); in tas2562_suspend()
431 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_resume() local
433 if (tas2562->sdz_gpio) in tas2562_resume()
434 gpiod_set_value_cansleep(tas2562->sdz_gpio, 1); in tas2562_resume()
436 regcache_cache_only(tas2562->regmap, false); in tas2562_resume()
438 return regcache_sync(tas2562->regmap); in tas2562_resume()
460 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_dac_event() local
481 dev_err(tas2562->dev, "Not supported evevt\n"); in tas2562_dac_event()
496 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_volume_control_get() local
498 ucontrol->value.integer.value[0] = tas2562->volume_lvl; in tas2562_volume_control_get()
506 struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component); in tas2562_volume_control_put() local
528 tas2562->volume_lvl = ucontrol->value.integer.value[0]; in tas2562_volume_control_put()
646 .name = "tas2562-amplifier",
703 static int tas2562_parse_dt(struct tas2562_data *tas2562) in tas2562_parse_dt() argument
705 struct device *dev = tas2562->dev; in tas2562_parse_dt()
708 tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); in tas2562_parse_dt()
709 if (IS_ERR(tas2562->sdz_gpio)) { in tas2562_parse_dt()
710 if (PTR_ERR(tas2562->sdz_gpio) == -EPROBE_DEFER) in tas2562_parse_dt()
713 tas2562->sdz_gpio = NULL; in tas2562_parse_dt()
720 if (tas2562->sdz_gpio == NULL) { in tas2562_parse_dt()
721 tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shut-down", in tas2562_parse_dt()
723 if (IS_ERR(tas2562->sdz_gpio)) in tas2562_parse_dt()
724 if (PTR_ERR(tas2562->sdz_gpio) == -EPROBE_DEFER) in tas2562_parse_dt()
727 tas2562->sdz_gpio = NULL; in tas2562_parse_dt()
730 if (tas2562->model_id == TAS2110) in tas2562_parse_dt()
734 &tas2562->i_sense_slot); in tas2562_parse_dt()
738 tas2562->i_sense_slot = 0; in tas2562_parse_dt()
743 &tas2562->v_sense_slot); in tas2562_parse_dt()
747 tas2562->v_sense_slot = 2; in tas2562_parse_dt()
750 if (tas2562->v_sense_slot < tas2562->i_sense_slot) { in tas2562_parse_dt()
797 { "tas2562", TAS2562 },
806 { .compatible = "ti,tas2562", },
816 .name = "tas2562",
826 MODULE_DESCRIPTION("TAS2562 Audio amplifier driver");