Lines Matching +full:asi +full:- +full:format
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()
164 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in sense_event()
170 * we might end up with non-functional IVSENSE if playback started earlier, in sense_event()
212 struct snd_soc_component *component = dai->component; in tas2770_mute()
216 tas2770->unmuted = !mute; in tas2770_mute()
223 struct snd_soc_component *component = tas2770->component; in tas2770_set_bitwidth()
230 tas2770->v_sense_slot = tas2770->i_sense_slot + 2; in tas2770_set_bitwidth()
236 tas2770->v_sense_slot = tas2770->i_sense_slot + 4; in tas2770_set_bitwidth()
242 tas2770->v_sense_slot = tas2770->i_sense_slot + 4; in tas2770_set_bitwidth()
246 return -EINVAL; in tas2770_set_bitwidth()
256 tas2770->v_sense_slot); in tas2770_set_bitwidth()
264 tas2770->i_sense_slot); in tas2770_set_bitwidth()
273 struct snd_soc_component *component = tas2770->component; in tas2770_set_samplerate()
303 return -EINVAL; in tas2770_set_samplerate()
320 struct snd_soc_component *component = dai->component; in tas2770_hw_params()
334 struct snd_soc_component *component = dai->component; in tas2770_set_fmt()
344 dev_err(tas2770->dev, "ASI invalid DAI clocking\n"); in tas2770_set_fmt()
345 return -EINVAL; in tas2770_set_fmt()
362 dev_err(tas2770->dev, "ASI format Inverse is not found\n"); in tas2770_set_fmt()
363 return -EINVAL; in tas2770_set_fmt()
390 dev_err(tas2770->dev, in tas2770_set_fmt()
391 "DAI Format is not found, fmt=0x%x\n", fmt); in tas2770_set_fmt()
392 return -EINVAL; in tas2770_set_fmt()
417 struct snd_soc_component *component = dai->component; in tas2770_set_dai_tdm_slot()
422 return -EINVAL; in tas2770_set_dai_tdm_slot()
434 return -EINVAL; in tas2770_set_dai_tdm_slot()
468 ret = -EINVAL; in tas2770_set_dai_tdm_slot()
523 tas2770->component = component; in tas2770_codec_probe()
525 if (tas2770->sdz_gpio) { in tas2770_codec_probe()
526 gpiod_set_value_cansleep(tas2770->sdz_gpio, 1); in tas2770_codec_probe()
531 regmap_reinit_cache(tas2770->regmap, &tas2770_i2c_regmap); in tas2770_codec_probe()
537 static DECLARE_TLV_DB_SCALE(tas2770_playback_volume, -10050, 50, 0);
562 return devm_snd_soc_register_component(tas2770->dev, in tas2770_register_codec()
654 rc = fwnode_property_read_u32(dev->fwnode, "ti,imon-slot-no", in tas2770_parse_dt()
655 &tas2770->i_sense_slot); in tas2770_parse_dt()
657 dev_info(tas2770->dev, "Property %s is missing setting default slot\n", in tas2770_parse_dt()
658 "ti,imon-slot-no"); in tas2770_parse_dt()
660 tas2770->i_sense_slot = 0; in tas2770_parse_dt()
663 rc = fwnode_property_read_u32(dev->fwnode, "ti,vmon-slot-no", in tas2770_parse_dt()
664 &tas2770->v_sense_slot); in tas2770_parse_dt()
666 dev_info(tas2770->dev, "Property %s is missing setting default slot\n", in tas2770_parse_dt()
667 "ti,vmon-slot-no"); in tas2770_parse_dt()
669 tas2770->v_sense_slot = 2; in tas2770_parse_dt()
672 tas2770->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); in tas2770_parse_dt()
673 if (IS_ERR(tas2770->sdz_gpio)) { in tas2770_parse_dt()
674 if (PTR_ERR(tas2770->sdz_gpio) == -EPROBE_DEFER) in tas2770_parse_dt()
675 return -EPROBE_DEFER; in tas2770_parse_dt()
677 tas2770->sdz_gpio = NULL; in tas2770_parse_dt()
688 tas2770 = devm_kzalloc(&client->dev, sizeof(struct tas2770_priv), in tas2770_i2c_probe()
691 return -ENOMEM; in tas2770_i2c_probe()
693 tas2770->dev = &client->dev; in tas2770_i2c_probe()
695 dev_set_drvdata(&client->dev, tas2770); in tas2770_i2c_probe()
697 tas2770->regmap = devm_regmap_init_i2c(client, &tas2770_i2c_regmap); in tas2770_i2c_probe()
698 if (IS_ERR(tas2770->regmap)) { in tas2770_i2c_probe()
699 result = PTR_ERR(tas2770->regmap); in tas2770_i2c_probe()
700 dev_err(&client->dev, "Failed to allocate register map: %d\n", in tas2770_i2c_probe()
705 if (client->dev.of_node) { in tas2770_i2c_probe()
706 result = tas2770_parse_dt(&client->dev, tas2770); in tas2770_i2c_probe()
708 dev_err(tas2770->dev, "%s: Failed to parse devicetree\n", in tas2770_i2c_probe()
714 tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev, "reset", in tas2770_i2c_probe()
716 if (IS_ERR(tas2770->reset_gpio)) { in tas2770_i2c_probe()
717 if (PTR_ERR(tas2770->reset_gpio) == -EPROBE_DEFER) { in tas2770_i2c_probe()
718 tas2770->reset_gpio = NULL; in tas2770_i2c_probe()
719 return -EPROBE_DEFER; in tas2770_i2c_probe()
725 dev_err(tas2770->dev, "Register codec failed.\n"); in tas2770_i2c_probe()