Lines Matching refs:tas2770
35 static void tas2770_reset(struct tas2770_priv *tas2770) in tas2770_reset() argument
37 if (tas2770->reset_gpio) { in tas2770_reset()
38 gpiod_set_value_cansleep(tas2770->reset_gpio, 0); in tas2770_reset()
40 gpiod_set_value_cansleep(tas2770->reset_gpio, 1); in tas2770_reset()
44 snd_soc_component_write(tas2770->component, TAS2770_SW_RST, in tas2770_reset()
49 static int tas2770_update_pwr_ctrl(struct tas2770_priv *tas2770) in tas2770_update_pwr_ctrl() argument
51 struct snd_soc_component *component = tas2770->component; in tas2770_update_pwr_ctrl()
55 if (tas2770->dac_powered) in tas2770_update_pwr_ctrl()
56 val = tas2770->unmuted ? in tas2770_update_pwr_ctrl()
72 struct tas2770_priv *tas2770 = snd_soc_component_get_drvdata(component); in tas2770_codec_suspend() local
75 regcache_cache_only(tas2770->regmap, true); in tas2770_codec_suspend()
76 regcache_mark_dirty(tas2770->regmap); in tas2770_codec_suspend()
78 if (tas2770->sdz_gpio) { in tas2770_codec_suspend()
79 gpiod_set_value_cansleep(tas2770->sdz_gpio, 0); in tas2770_codec_suspend()
85 regcache_cache_only(tas2770->regmap, false); in tas2770_codec_suspend()
86 regcache_sync(tas2770->regmap); in tas2770_codec_suspend()
98 struct tas2770_priv *tas2770 = snd_soc_component_get_drvdata(component); in tas2770_codec_resume() local
101 if (tas2770->sdz_gpio) { in tas2770_codec_resume()
102 gpiod_set_value_cansleep(tas2770->sdz_gpio, 1); in tas2770_codec_resume()
105 ret = tas2770_update_pwr_ctrl(tas2770); in tas2770_codec_resume()
110 regcache_cache_only(tas2770->regmap, false); in tas2770_codec_resume()
112 return regcache_sync(tas2770->regmap); in tas2770_codec_resume()
135 struct tas2770_priv *tas2770 = in tas2770_dac_event() local
141 tas2770->dac_powered = 1; in tas2770_dac_event()
142 ret = tas2770_update_pwr_ctrl(tas2770); in tas2770_dac_event()
145 tas2770->dac_powered = 0; in tas2770_dac_event()
146 ret = tas2770_update_pwr_ctrl(tas2770); in tas2770_dac_event()
149 dev_err(tas2770->dev, "Not supported evevt\n"); in tas2770_dac_event()
187 struct tas2770_priv *tas2770 = in tas2770_mute() local
190 tas2770->unmuted = !mute; in tas2770_mute()
191 return tas2770_update_pwr_ctrl(tas2770); in tas2770_mute()
194 static int tas2770_set_bitwidth(struct tas2770_priv *tas2770, int bitwidth) in tas2770_set_bitwidth() argument
197 struct snd_soc_component *component = tas2770->component; in tas2770_set_bitwidth()
204 tas2770->v_sense_slot = tas2770->i_sense_slot + 2; in tas2770_set_bitwidth()
210 tas2770->v_sense_slot = tas2770->i_sense_slot + 4; in tas2770_set_bitwidth()
216 tas2770->v_sense_slot = tas2770->i_sense_slot + 4; in tas2770_set_bitwidth()
230 tas2770->v_sense_slot); in tas2770_set_bitwidth()
238 tas2770->i_sense_slot); in tas2770_set_bitwidth()
245 static int tas2770_set_samplerate(struct tas2770_priv *tas2770, int samplerate) in tas2770_set_samplerate() argument
247 struct snd_soc_component *component = tas2770->component; in tas2770_set_samplerate()
295 struct tas2770_priv *tas2770 = in tas2770_hw_params() local
299 ret = tas2770_set_bitwidth(tas2770, params_format(params)); in tas2770_hw_params()
303 return tas2770_set_samplerate(tas2770, params_rate(params)); in tas2770_hw_params()
309 struct tas2770_priv *tas2770 = in tas2770_set_fmt() local
318 dev_err(tas2770->dev, "ASI invalid DAI clocking\n"); in tas2770_set_fmt()
336 dev_err(tas2770->dev, "ASI format Inverse is not found\n"); in tas2770_set_fmt()
364 dev_err(tas2770->dev, in tas2770_set_fmt()
494 struct tas2770_priv *tas2770 = in tas2770_codec_probe() local
497 tas2770->component = component; in tas2770_codec_probe()
499 if (tas2770->sdz_gpio) { in tas2770_codec_probe()
500 gpiod_set_value_cansleep(tas2770->sdz_gpio, 1); in tas2770_codec_probe()
504 tas2770_reset(tas2770); in tas2770_codec_probe()
505 regmap_reinit_cache(tas2770->regmap, &tas2770_i2c_regmap); in tas2770_codec_probe()
534 static int tas2770_register_codec(struct tas2770_priv *tas2770) in tas2770_register_codec() argument
536 return devm_snd_soc_register_component(tas2770->dev, in tas2770_register_codec()
624 static int tas2770_parse_dt(struct device *dev, struct tas2770_priv *tas2770) in tas2770_parse_dt() argument
629 &tas2770->i_sense_slot); in tas2770_parse_dt()
631 dev_info(tas2770->dev, "Property %s is missing setting default slot\n", in tas2770_parse_dt()
634 tas2770->i_sense_slot = 0; in tas2770_parse_dt()
638 &tas2770->v_sense_slot); in tas2770_parse_dt()
640 dev_info(tas2770->dev, "Property %s is missing setting default slot\n", in tas2770_parse_dt()
643 tas2770->v_sense_slot = 2; in tas2770_parse_dt()
646 tas2770->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); in tas2770_parse_dt()
647 if (IS_ERR(tas2770->sdz_gpio)) { in tas2770_parse_dt()
648 if (PTR_ERR(tas2770->sdz_gpio) == -EPROBE_DEFER) in tas2770_parse_dt()
651 tas2770->sdz_gpio = NULL; in tas2770_parse_dt()
659 struct tas2770_priv *tas2770; in tas2770_i2c_probe() local
662 tas2770 = devm_kzalloc(&client->dev, sizeof(struct tas2770_priv), in tas2770_i2c_probe()
664 if (!tas2770) in tas2770_i2c_probe()
667 tas2770->dev = &client->dev; in tas2770_i2c_probe()
668 i2c_set_clientdata(client, tas2770); in tas2770_i2c_probe()
669 dev_set_drvdata(&client->dev, tas2770); in tas2770_i2c_probe()
671 tas2770->regmap = devm_regmap_init_i2c(client, &tas2770_i2c_regmap); in tas2770_i2c_probe()
672 if (IS_ERR(tas2770->regmap)) { in tas2770_i2c_probe()
673 result = PTR_ERR(tas2770->regmap); in tas2770_i2c_probe()
680 result = tas2770_parse_dt(&client->dev, tas2770); in tas2770_i2c_probe()
682 dev_err(tas2770->dev, "%s: Failed to parse devicetree\n", in tas2770_i2c_probe()
688 tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev, "reset", in tas2770_i2c_probe()
690 if (IS_ERR(tas2770->reset_gpio)) { in tas2770_i2c_probe()
691 if (PTR_ERR(tas2770->reset_gpio) == -EPROBE_DEFER) { in tas2770_i2c_probe()
692 tas2770->reset_gpio = NULL; in tas2770_i2c_probe()
697 result = tas2770_register_codec(tas2770); in tas2770_i2c_probe()
699 dev_err(tas2770->dev, "Register codec failed.\n"); in tas2770_i2c_probe()