From 23bc9d31c3c374ac731291ecfda2959e52fbb92e Mon Sep 17 00:00:00 2001 From: Wyon Bi Date: Sat, 6 May 2023 08:41:09 +0000 Subject: [PATCH] mfd: max96745: Add pwdnb GPIO support Signed-off-by: Wyon Bi Change-Id: I1e19c365325196c3d6ff652079db2f816f31f4ad --- drivers/mfd/max96745.c | 14 ++++++++++++++ include/linux/mfd/max96745.h | 1 + 2 files changed, 15 insertions(+) diff --git a/drivers/mfd/max96745.c b/drivers/mfd/max96745.c index c212aa5edccb..f65ba34a3b22 100644 --- a/drivers/mfd/max96745.c +++ b/drivers/mfd/max96745.c @@ -108,6 +108,9 @@ static void max96745_power_off(void *data) { struct max96745 *max96745 = data; + if (max96745->pwdnb_gpio) + gpiod_direction_output(max96745->pwdnb_gpio, 1); + if (max96745->enable_gpio) gpiod_direction_output(max96745->enable_gpio, 0); } @@ -124,6 +127,11 @@ static void max96745_power_on(struct max96745 *max96745) msleep(200); } + if (max96745->pwdnb_gpio) { + gpiod_direction_output(max96745->pwdnb_gpio, 0); + msleep(30); + } + /* Set for I2C Fast-mode speed */ regmap_write(max96745->regmap, 0x0070, 0x16); @@ -253,6 +261,12 @@ static int max96745_i2c_probe(struct i2c_client *client) return dev_err_probe(dev, PTR_ERR(max96745->enable_gpio), "failed to get enable GPIO\n"); + max96745->pwdnb_gpio = devm_gpiod_get_optional(dev, "pwdnb", + GPIOD_ASIS); + if (IS_ERR(max96745->pwdnb_gpio)) + return dev_err_probe(dev, PTR_ERR(max96745->pwdnb_gpio), + "failed to get pwdnb GPIO\n"); + max96745->extcon = devm_extcon_dev_allocate(dev, max96745_cable); if (IS_ERR(max96745->extcon)) return dev_err_probe(dev, PTR_ERR(max96745->extcon), diff --git a/include/linux/mfd/max96745.h b/include/linux/mfd/max96745.h index f4784ce52284..f2159a23b2e8 100644 --- a/include/linux/mfd/max96745.h +++ b/include/linux/mfd/max96745.h @@ -15,6 +15,7 @@ struct max96745 { struct regmap *regmap; struct i2c_mux_core *muxc; struct gpio_desc *enable_gpio; + struct gpio_desc *pwdnb_gpio; struct extcon_dev *extcon; bool idle_disc; };