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

regulator: sy7636a: add gpios and input regulator

Initialize input regulator and gpios to proper values to have things
basically working as well as in the case when these things are
hardwired.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Andreas Kemnade <akemnade@kernel.org>
Link: https://patch.msgid.link/20250917-sy7636-rsrc-v3-2-331237d507a2@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Andreas Kemnade and committed by
Mark Brown
fb25114c 433e294c

+27
+27
drivers/regulator/sy7636a-regulator.c
··· 12 12 #include <linux/mfd/sy7636a.h> 13 13 #include <linux/module.h> 14 14 #include <linux/platform_device.h> 15 + #include <linux/regulator/consumer.h> 15 16 #include <linux/regulator/driver.h> 16 17 #include <linux/regulator/machine.h> 17 18 #include <linux/regmap.h> ··· 20 19 struct sy7636a_data { 21 20 struct regmap *regmap; 22 21 struct gpio_desc *pgood_gpio; 22 + struct gpio_desc *en_gpio; 23 + struct gpio_desc *vcom_en_gpio; 23 24 }; 24 25 25 26 static int sy7636a_get_vcom_voltage_op(struct regulator_dev *rdev) ··· 100 97 101 98 data->regmap = regmap; 102 99 data->pgood_gpio = gdp; 100 + 101 + ret = devm_regulator_get_enable_optional(&pdev->dev, "vin"); 102 + if (ret) 103 + return dev_err_probe(&pdev->dev, ret, 104 + "failed to get vin regulator\n"); 105 + 106 + data->en_gpio = devm_gpiod_get_optional(&pdev->dev, "enable", 107 + GPIOD_OUT_HIGH); 108 + if (IS_ERR(data->en_gpio)) 109 + return dev_err_probe(&pdev->dev, 110 + PTR_ERR(data->en_gpio), 111 + "failed to get en gpio\n"); 112 + 113 + /* Let VCOM just follow the default power on sequence */ 114 + data->vcom_en_gpio = devm_gpiod_get_optional(&pdev->dev, 115 + "vcom-en", GPIOD_OUT_LOW); 116 + if (IS_ERR(data->vcom_en_gpio)) 117 + return dev_err_probe(&pdev->dev, 118 + PTR_ERR(data->vcom_en_gpio), 119 + "failed to get vcom-en gpio\n"); 120 + 121 + /* if chip was not enabled, give it time to wake up */ 122 + if (data->en_gpio) 123 + usleep_range(2500, 4000); 103 124 104 125 platform_set_drvdata(pdev, data); 105 126