Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: tlv320adcx140: add avdd and iovdd supply

The datasheet, under "10 Power Supply Recommendations" section,
specifies that both the AVDD and IOVDD supplies must be up and stable
for at least 100us before the SHDNZ can be released. After that, the
chip is ready to receive commands after another 2ms.
Currently the driver doesn't contain any options to bind AVDD and IOVDD
supplies to the tlv320adcx140.

This commit adds bindings for AVDD and IOVDD supplies which the driver
will enable when used.

Signed-off-by: Emil-Juhl <juhl.emildahl@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://patch.msgid.link/20260113-sound-soc-codecs-tvl320adcx140-v4-6-8f7ecec525c8@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Emil-Juhl and committed by
Mark Brown
57be1f67 24175015

+36
+36
sound/soc/codecs/tlv320adcx140.c
··· 22 22 23 23 #include "tlv320adcx140.h" 24 24 25 + static const char *const adcx140_supply_names[] = { 26 + "avdd", 27 + "iovdd", 28 + }; 29 + 30 + #define ADCX140_NUM_SUPPLIES ARRAY_SIZE(adcx140_supply_names) 31 + 25 32 struct adcx140_priv { 26 33 struct regulator *supply_areg; 34 + struct regulator_bulk_data supplies[ADCX140_NUM_SUPPLIES]; 27 35 struct gpio_desc *gpio_reset; 28 36 struct regmap *regmap; 29 37 struct device *dev; ··· 1112 1104 1113 1105 static int adcx140_pwr_off(struct adcx140_priv *adcx140) 1114 1106 { 1107 + int ret; 1108 + 1115 1109 regcache_cache_only(adcx140->regmap, true); 1116 1110 regcache_mark_dirty(adcx140->regmap); 1117 1111 ··· 1127 1117 */ 1128 1118 usleep_range(30000, 100000); 1129 1119 1120 + /* Power off the regulators, `avdd` and `iovdd` */ 1121 + ret = regulator_bulk_disable(ARRAY_SIZE(adcx140->supplies), 1122 + adcx140->supplies); 1123 + if (ret) { 1124 + dev_err(adcx140->dev, "Failed to disable supplies: %d\n", ret); 1125 + return ret; 1126 + } 1127 + 1130 1128 return 0; 1131 1129 } 1132 1130 1133 1131 static int adcx140_pwr_on(struct adcx140_priv *adcx140) 1134 1132 { 1135 1133 int ret; 1134 + 1135 + /* Power on the regulators, `avdd` and `iovdd` */ 1136 + ret = regulator_bulk_enable(ARRAY_SIZE(adcx140->supplies), 1137 + adcx140->supplies); 1138 + if (ret) { 1139 + dev_err(adcx140->dev, "Failed to enable supplies: %d\n", ret); 1140 + return ret; 1141 + } 1136 1142 1137 1143 /* De-assert the reset GPIO */ 1138 1144 gpiod_set_value_cansleep(adcx140->gpio_reset, 1); ··· 1259 1233 1260 1234 adcx140->phase_calib_on = false; 1261 1235 adcx140->dev = &i2c->dev; 1236 + 1237 + for (int i = 0; i < ADCX140_NUM_SUPPLIES; i++) 1238 + adcx140->supplies[i].supply = adcx140_supply_names[i]; 1239 + 1240 + ret = devm_regulator_bulk_get(&i2c->dev, ADCX140_NUM_SUPPLIES, 1241 + adcx140->supplies); 1242 + if (ret) { 1243 + dev_err_probe(&i2c->dev, ret, "Failed to request supplies\n"); 1244 + return ret; 1245 + } 1262 1246 1263 1247 adcx140->gpio_reset = devm_gpiod_get_optional(adcx140->dev, 1264 1248 "reset", GPIOD_OUT_LOW);