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>
35 if (tas2770->reset_gpio) { in tas2770_reset()
36 gpiod_set_value_cansleep(tas2770->reset_gpio, 0); in tas2770_reset()
38 gpiod_set_value_cansleep(tas2770->reset_gpio, 1); in tas2770_reset()
42 snd_soc_component_write(tas2770->component, TAS2770_SW_RST, in tas2770_reset()
49 struct snd_soc_component *component = tas2770->component; in tas2770_update_pwr_ctrl()
53 if (tas2770->dac_powered) in tas2770_update_pwr_ctrl()
54 val = tas2770->unmuted ? in tas2770_update_pwr_ctrl()
73 regcache_cache_only(tas2770->regmap, true); in tas2770_codec_suspend()
74 regcache_mark_dirty(tas2770->regmap); in tas2770_codec_suspend()
76 if (tas2770->sdz_gpio) { in tas2770_codec_suspend()
77 gpiod_set_value_cansleep(tas2770->sdz_gpio, 0); in tas2770_codec_suspend()
83 regcache_cache_only(tas2770->regmap, false); in tas2770_codec_suspend()
84 regcache_sync(tas2770->regmap); in tas2770_codec_suspend()
99 if (tas2770->sdz_gpio) { in tas2770_codec_resume()
100 gpiod_set_value_cansleep(tas2770->sdz_gpio, 1); in tas2770_codec_resume()
108 regcache_cache_only(tas2770->regmap, false); in tas2770_codec_resume()
110 return regcache_sync(tas2770->regmap); in tas2770_codec_resume()
132 snd_soc_dapm_to_component(w->dapm); in tas2770_dac_event()
139 tas2770->dac_powered = 1; in tas2770_dac_event()
143 tas2770->dac_powered = 0; in tas2770_dac_event()
147 dev_err(tas2770->dev, "Not supported evevt\n"); in tas2770_dac_event()
148 return -EINVAL; in tas2770_dac_event()
184 struct snd_soc_component *component = dai->component; in tas2770_mute()
188 tas2770->unmuted = !mute; in tas2770_mute()
195 struct snd_soc_component *component = tas2770->component; in tas2770_set_bitwidth()
202 tas2770->v_sense_slot = tas2770->i_sense_slot + 2; in tas2770_set_bitwidth()
208 tas2770->v_sense_slot = tas2770->i_sense_slot + 4; in tas2770_set_bitwidth()
214 tas2770->v_sense_slot = tas2770->i_sense_slot + 4; in tas2770_set_bitwidth()
218 return -EINVAL; in tas2770_set_bitwidth()
228 tas2770->v_sense_slot); in tas2770_set_bitwidth()
236 tas2770->i_sense_slot); in tas2770_set_bitwidth()
245 struct snd_soc_component *component = tas2770->component; in tas2770_set_samplerate()
275 return -EINVAL; in tas2770_set_samplerate()
292 struct snd_soc_component *component = dai->component; in tas2770_hw_params()
306 struct snd_soc_component *component = dai->component; in tas2770_set_fmt()
316 dev_err(tas2770->dev, "ASI invalid DAI clocking\n"); in tas2770_set_fmt()
317 return -EINVAL; in tas2770_set_fmt()
334 dev_err(tas2770->dev, "ASI format Inverse is not found\n"); in tas2770_set_fmt()
335 return -EINVAL; in tas2770_set_fmt()
362 dev_err(tas2770->dev, in tas2770_set_fmt()
363 "DAI Format is not found, fmt=0x%x\n", fmt); in tas2770_set_fmt()
364 return -EINVAL; in tas2770_set_fmt()
389 struct snd_soc_component *component = dai->component; in tas2770_set_dai_tdm_slot()
394 return -EINVAL; in tas2770_set_dai_tdm_slot()
406 return -EINVAL; in tas2770_set_dai_tdm_slot()
440 ret = -EINVAL; in tas2770_set_dai_tdm_slot()
495 tas2770->component = component; in tas2770_codec_probe()
497 if (tas2770->sdz_gpio) { in tas2770_codec_probe()
498 gpiod_set_value_cansleep(tas2770->sdz_gpio, 1); in tas2770_codec_probe()
503 regmap_reinit_cache(tas2770->regmap, &tas2770_i2c_regmap); in tas2770_codec_probe()
509 static DECLARE_TLV_DB_SCALE(tas2770_playback_volume, -12750, 50, 0);
534 return devm_snd_soc_register_component(tas2770->dev, in tas2770_register_codec()
626 rc = fwnode_property_read_u32(dev->fwnode, "ti,imon-slot-no", in tas2770_parse_dt()
627 &tas2770->i_sense_slot); in tas2770_parse_dt()
629 dev_info(tas2770->dev, "Property %s is missing setting default slot\n", in tas2770_parse_dt()
630 "ti,imon-slot-no"); in tas2770_parse_dt()
632 tas2770->i_sense_slot = 0; in tas2770_parse_dt()
635 rc = fwnode_property_read_u32(dev->fwnode, "ti,vmon-slot-no", in tas2770_parse_dt()
636 &tas2770->v_sense_slot); in tas2770_parse_dt()
638 dev_info(tas2770->dev, "Property %s is missing setting default slot\n", in tas2770_parse_dt()
639 "ti,vmon-slot-no"); in tas2770_parse_dt()
641 tas2770->v_sense_slot = 2; in tas2770_parse_dt()
644 tas2770->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); in tas2770_parse_dt()
645 if (IS_ERR(tas2770->sdz_gpio)) { in tas2770_parse_dt()
646 if (PTR_ERR(tas2770->sdz_gpio) == -EPROBE_DEFER) in tas2770_parse_dt()
647 return -EPROBE_DEFER; in tas2770_parse_dt()
649 tas2770->sdz_gpio = NULL; in tas2770_parse_dt()
660 tas2770 = devm_kzalloc(&client->dev, sizeof(struct tas2770_priv), in tas2770_i2c_probe()
663 return -ENOMEM; in tas2770_i2c_probe()
665 tas2770->dev = &client->dev; in tas2770_i2c_probe()
667 dev_set_drvdata(&client->dev, tas2770); in tas2770_i2c_probe()
669 tas2770->regmap = devm_regmap_init_i2c(client, &tas2770_i2c_regmap); in tas2770_i2c_probe()
670 if (IS_ERR(tas2770->regmap)) { in tas2770_i2c_probe()
671 result = PTR_ERR(tas2770->regmap); in tas2770_i2c_probe()
672 dev_err(&client->dev, "Failed to allocate register map: %d\n", in tas2770_i2c_probe()
677 if (client->dev.of_node) { in tas2770_i2c_probe()
678 result = tas2770_parse_dt(&client->dev, tas2770); in tas2770_i2c_probe()
680 dev_err(tas2770->dev, "%s: Failed to parse devicetree\n", in tas2770_i2c_probe()
686 tas2770->reset_gpio = devm_gpiod_get_optional(tas2770->dev, "reset", in tas2770_i2c_probe()
688 if (IS_ERR(tas2770->reset_gpio)) { in tas2770_i2c_probe()
689 if (PTR_ERR(tas2770->reset_gpio) == -EPROBE_DEFER) { in tas2770_i2c_probe()
690 tas2770->reset_gpio = NULL; in tas2770_i2c_probe()
691 return -EPROBE_DEFER; in tas2770_i2c_probe()
697 dev_err(tas2770->dev, "Register codec failed.\n"); in tas2770_i2c_probe()