Lines Matching +full:imon +full:- +full:slot +full:- +full:no

1 // SPDX-License-Identifier: GPL-2.0
3 // ALSA SoC Texas Instruments TAS2770 20-W Digital Input Mono Class-D
6 // Copyright (C) 2016-2017 Texas Instruments Incorporated - https://www.ti.com/
7 // Author: Tracy Yi <tracy-yi@ti.com>
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()
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()
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()
101 if (tas2770->sdz_gpio) { in tas2770_codec_resume()
102 gpiod_set_value_cansleep(tas2770->sdz_gpio, 1); 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()
134 snd_soc_dapm_to_component(w->dapm); in tas2770_dac_event()
141 tas2770->dac_powered = 1; in tas2770_dac_event()
145 tas2770->dac_powered = 0; in tas2770_dac_event()
149 dev_err(tas2770->dev, "Not supported evevt\n"); in tas2770_dac_event()
150 return -EINVAL; in tas2770_dac_event()
170 SND_SOC_DAPM_SIGGEN("IMON")
180 {"ISENSE", "Switch", "IMON"},
186 struct snd_soc_component *component = dai->component; in tas2770_mute()
190 tas2770->unmuted = !mute; in tas2770_mute()
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()
220 return -EINVAL; in tas2770_set_bitwidth()
230 tas2770->v_sense_slot); in tas2770_set_bitwidth()
238 tas2770->i_sense_slot); in tas2770_set_bitwidth()
247 struct snd_soc_component *component = tas2770->component; in tas2770_set_samplerate()
277 return -EINVAL; in tas2770_set_samplerate()
294 struct snd_soc_component *component = dai->component; in tas2770_hw_params()
308 struct snd_soc_component *component = dai->component; in tas2770_set_fmt()
318 dev_err(tas2770->dev, "ASI invalid DAI clocking\n"); in tas2770_set_fmt()
319 return -EINVAL; in tas2770_set_fmt()
336 dev_err(tas2770->dev, "ASI format Inverse is not found\n"); in tas2770_set_fmt()
337 return -EINVAL; in tas2770_set_fmt()
364 dev_err(tas2770->dev, in tas2770_set_fmt()
366 return -EINVAL; in tas2770_set_fmt()
391 struct snd_soc_component *component = dai->component; in tas2770_set_dai_tdm_slot()
396 return -EINVAL; in tas2770_set_dai_tdm_slot()
408 return -EINVAL; in tas2770_set_dai_tdm_slot()
438 /* Do not change slot width */ in tas2770_set_dai_tdm_slot()
442 ret = -EINVAL; in tas2770_set_dai_tdm_slot()
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()
505 regmap_reinit_cache(tas2770->regmap, &tas2770_i2c_regmap); in tas2770_codec_probe()
511 static DECLARE_TLV_DB_SCALE(tas2770_playback_volume, -12750, 50, 0);
536 return devm_snd_soc_register_component(tas2770->dev, in tas2770_register_codec()
628 rc = fwnode_property_read_u32(dev->fwnode, "ti,imon-slot-no", in tas2770_parse_dt()
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()
632 "ti,imon-slot-no"); in tas2770_parse_dt()
634 tas2770->i_sense_slot = 0; in tas2770_parse_dt()
637 rc = fwnode_property_read_u32(dev->fwnode, "ti,vmon-slot-no", 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()
641 "ti,vmon-slot-no"); 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()
649 return -EPROBE_DEFER; in tas2770_parse_dt()
651 tas2770->sdz_gpio = NULL; in tas2770_parse_dt()
662 tas2770 = devm_kzalloc(&client->dev, sizeof(struct tas2770_priv), in tas2770_i2c_probe()
665 return -ENOMEM; in tas2770_i2c_probe()
667 tas2770->dev = &client->dev; 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()
674 dev_err(&client->dev, "Failed to allocate register map: %d\n", in tas2770_i2c_probe()
679 if (client->dev.of_node) { 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()
693 return -EPROBE_DEFER; in tas2770_i2c_probe()
699 dev_err(tas2770->dev, "Register codec failed.\n"); in tas2770_i2c_probe()