mfd: max96745: Add pwdnb GPIO support

Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
Change-Id: I1e19c365325196c3d6ff652079db2f816f31f4ad
This commit is contained in:
Wyon Bi 2023-05-06 08:41:09 +00:00 committed by Tao Huang
commit 23bc9d31c3
2 changed files with 15 additions and 0 deletions

View file

@ -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),

View file

@ -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;
};