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>
36 if (tas2770->reset_gpio) { in tas2770_reset()
37 gpiod_set_value_cansleep(tas2770->reset_gpio, 0); in tas2770_reset()
39 gpiod_set_value_cansleep(tas2770->reset_gpio, 1); in tas2770_reset()
43 snd_soc_component_write(tas2770->component, TAS2770_SW_RST, in tas2770_reset()
50 struct snd_soc_component *component = tas2770->component; in tas2770_update_pwr_ctrl()
54 if (tas2770->dac_powered) in tas2770_update_pwr_ctrl()
55 val = tas2770->unmuted ? in tas2770_update_pwr_ctrl()
74 regcache_cache_only(tas2770->regmap, true); in tas2770_codec_suspend()
75 regcache_mark_dirty(tas2770->regmap); in tas2770_codec_suspend()
77 if (tas2770->sdz_gpio) { in tas2770_codec_suspend()
78 gpiod_set_value_cansleep(tas2770->sdz_gpio, 0); in tas2770_codec_suspend()
84 regcache_cache_only(tas2770->regmap, false); in tas2770_codec_suspend()
85 regcache_sync(tas2770->regmap); in tas2770_codec_suspend()
100 if (tas2770->sdz_gpio) { in tas2770_codec_resume()
101 gpiod_set_value_cansleep(tas2770->sdz_gpio, 1); in tas2770_codec_resume()
109 regcache_cache_only(tas2770->regmap, false); in tas2770_codec_resume()
111 return regcache_sync(tas2770->regmap); in tas2770_codec_resume()
133 snd_soc_dapm_to_component(w->dapm); in tas2770_dac_event()
140 tas2770->dac_powered = 1; in tas2770_dac_event()
144 tas2770->dac_powered = 0; in tas2770_dac_event()
148 dev_err(tas2770->dev, "Not supported evevt\n"); in tas2770_dac_event()
149 return -EINVAL; in tas2770_dac_event()
163 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in sense_event()
169 * we might end up with non-functional IVSENSE if playback started earlier, in sense_event()
195 SND_SOC_DAPM_SIGGEN("IMON")
205 {"ISENSE", "Switch", "IMON"},
211 struct snd_soc_component *component = dai->component; in tas2770_mute()
215 tas2770->unmuted = !mute; in tas2770_mute()
222 struct snd_soc_component *component = tas2770->component; in tas2770_set_ivsense_transmit()
244 static int tas2770_set_pdm_transmit(struct tas2770_priv *tas2770, int slot) in tas2770_set_pdm_transmit() argument
246 struct snd_soc_component *component = tas2770->component; in tas2770_set_pdm_transmit()
253 slot); in tas2770_set_pdm_transmit()
260 struct snd_soc_component *component = tas2770->component; in tas2770_set_bitwidth()
280 return -EINVAL; in tas2770_set_bitwidth()
291 struct snd_soc_component *component = tas2770->component; in tas2770_set_samplerate()
321 return -EINVAL; in tas2770_set_samplerate()
338 struct snd_soc_component *component = dai->component; in tas2770_hw_params()
352 struct snd_soc_component *component = dai->component; in tas2770_set_fmt()
362 dev_err(tas2770->dev, "ASI invalid DAI clocking\n"); in tas2770_set_fmt()
363 return -EINVAL; in tas2770_set_fmt()
380 dev_err(tas2770->dev, "ASI format Inverse is not found\n"); in tas2770_set_fmt()
381 return -EINVAL; in tas2770_set_fmt()
408 dev_err(tas2770->dev, in tas2770_set_fmt()
410 return -EINVAL; in tas2770_set_fmt()
435 struct snd_soc_component *component = dai->component; in tas2770_set_dai_tdm_slot()
440 return -EINVAL; in tas2770_set_dai_tdm_slot()
452 return -EINVAL; in tas2770_set_dai_tdm_slot()
482 /* Do not change slot width */ in tas2770_set_dai_tdm_slot()
486 ret = -EINVAL; in tas2770_set_dai_tdm_slot()
539 ret = regmap_read(tas2770->regmap, TAS2770_TEMP_MSB, &msb); in tas2770_read_die_temp()
543 ret = regmap_read(tas2770->regmap, TAS2770_TEMP_LSB, &lsb); in tas2770_read_die_temp()
555 * that the temperature will read -93 *C until the chip is brought out in tas2770_read_die_temp()
557 * ADC is also shut down in software shutdown/low-power mode, so the in tas2770_read_die_temp()
561 *result = (reading - (93 * 16)) * (1000 / 16); in tas2770_read_die_temp()
594 ret = -EOPNOTSUPP; in tas2770_hwmon_read()
624 tas2770->component = component; in tas2770_codec_probe()
626 if (tas2770->sdz_gpio) { in tas2770_codec_probe()
627 gpiod_set_value_cansleep(tas2770->sdz_gpio, 1); in tas2770_codec_probe()
632 regmap_reinit_cache(tas2770->regmap, &tas2770_i2c_regmap); in tas2770_codec_probe()
634 if (tas2770->i_sense_slot != -1 && tas2770->v_sense_slot != -1) { in tas2770_codec_probe()
635 ret = tas2770_set_ivsense_transmit(tas2770, tas2770->i_sense_slot, in tas2770_codec_probe()
636 tas2770->v_sense_slot); in tas2770_codec_probe()
642 if (tas2770->pdm_slot != -1) { in tas2770_codec_probe()
643 ret = tas2770_set_pdm_transmit(tas2770, tas2770->pdm_slot); in tas2770_codec_probe()
653 static DECLARE_TLV_DB_SCALE(tas2770_playback_volume, -10050, 50, 0);
678 return devm_snd_soc_register_component(tas2770->dev, in tas2770_register_codec()
770 rc = fwnode_property_read_u32(dev->fwnode, "ti,imon-slot-no", in tas2770_parse_dt()
771 &tas2770->i_sense_slot); in tas2770_parse_dt()
773 dev_info(tas2770->dev, "Property %s is missing setting default slot\n", in tas2770_parse_dt()
774 "ti,imon-slot-no"); in tas2770_parse_dt()
776 tas2770->i_sense_slot = -1; in tas2770_parse_dt()
779 rc = fwnode_property_read_u32(dev->fwnode, "ti,vmon-slot-no", in tas2770_parse_dt()
780 &tas2770->v_sense_slot); in tas2770_parse_dt()
782 dev_info(tas2770->dev, "Property %s is missing setting default slot\n", in tas2770_parse_dt()
783 "ti,vmon-slot-no"); in tas2770_parse_dt()
785 tas2770->v_sense_slot = -1; in tas2770_parse_dt()
788 rc = fwnode_property_read_u32(dev->fwnode, "ti,pdm-slot-no", in tas2770_parse_dt()
789 &tas2770->pdm_slot); in tas2770_parse_dt()
791 tas2770->pdm_slot = -1; in tas2770_parse_dt()
793 tas2770->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); in tas2770_parse_dt()
794 if (IS_ERR(tas2770->sdz_gpio)) { in tas2770_parse_dt()
795 if (PTR_ERR(tas2770->sdz_gpio) == -EPROBE_DEFER) in tas2770_parse_dt()
796 return -EPROBE_DEFER; in tas2770_parse_dt()
798 tas2770->sdz_gpio = NULL; in tas2770_parse_dt()
809 tas2770 = devm_kzalloc(&client->dev, sizeof(struct tas2770_priv), in tas2770_i2c_probe()
812 return -ENOMEM; in tas2770_i2c_probe()
814 tas2770->dev = &client->dev; in tas2770_i2c_probe()
816 dev_set_drvdata(&client->dev, tas2770); in tas2770_i2c_probe()
818 tas2770->regmap = devm_regmap_init_i2c(client, &tas2770_i2c_regmap); in tas2770_i2c_probe()
819 if (IS_ERR(tas2770->regmap)) { in tas2770_i2c_probe()
820 result = PTR_ERR(tas2770->regmap); in tas2770_i2c_probe()
821 dev_err(&client->dev, "Failed to allocate register map: %d\n", in tas2770_i2c_probe()
826 if (client->dev.of_node) { in tas2770_i2c_probe()
827 result = tas2770_parse_dt(&client->dev, tas2770); in tas2770_i2c_probe()
829 dev_err(tas2770->dev, "%s: Failed to parse devicetree\n", in tas2770_i2c_probe()
835 tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev, "reset", in tas2770_i2c_probe()
837 if (IS_ERR(tas2770->reset_gpio)) { in tas2770_i2c_probe()
838 if (PTR_ERR(tas2770->reset_gpio) == -EPROBE_DEFER) { in tas2770_i2c_probe()
839 tas2770->reset_gpio = NULL; in tas2770_i2c_probe()
840 return -EPROBE_DEFER; in tas2770_i2c_probe()
847 hwmon = devm_hwmon_device_register_with_info(&client->dev, "tas2770", in tas2770_i2c_probe()
852 return dev_err_probe(&client->dev, PTR_ERR(hwmon), in tas2770_i2c_probe()
859 dev_err(tas2770->dev, "Register codec failed.\n"); in tas2770_i2c_probe()