mfd: max96745: Fix power on reset

Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
Change-Id: I8b325e09dff1e0e9bf2a5262d60e803986e52845
This commit is contained in:
Wyon Bi
2022-08-04 07:39:59 +00:00
parent bf78aaf1e6
commit 495e32cf39

View File

@@ -95,33 +95,28 @@ static void max96745_power_off(void *data)
gpiod_direction_output(max96745->enable_gpio, 0);
}
static int max96745_power_on(struct max96745 *max96745)
static void max96745_power_on(struct max96745 *max96745)
{
u32 val;
int ret;
ret = regmap_read(max96745->regmap, 0x0107, &val);
if (!ret && FIELD_GET(VID_TX_ACTIVE_A | VID_TX_ACTIVE_B, val))
return 0;
return;
if (max96745->enable_gpio)
gpiod_direction_output(max96745->enable_gpio, 1);
else
regmap_update_bits(max96745->regmap, 0x0010, RESET_ALL,
FIELD_PREP(RESET_ALL, 1));
msleep(200);
msleep(100);
ret = regmap_update_bits(max96745->regmap, 0x0010, RESET_ALL,
FIELD_PREP(RESET_ALL, 1));
if (ret < 0)
return ret;
msleep(100);
regmap_update_bits(max96745->regmap, 0x0100, VID_TX_EN,
FIELD_PREP(VID_TX_EN, 0));
regmap_update_bits(max96745->regmap, 0x0076, DIS_REM_CC,
FIELD_PREP(DIS_REM_CC, 1));
regmap_update_bits(max96745->regmap, 0x0086, DIS_REM_CC,
FIELD_PREP(DIS_REM_CC, 1));
return 0;
}
static int max96745_i2c_probe(struct i2c_client *client)
@@ -168,9 +163,7 @@ static int max96745_i2c_probe(struct i2c_client *client)
return dev_err_probe(dev, PTR_ERR(max96745->lock_gpio),
"failed to get lock GPIO\n");
ret = max96745_power_on(max96745);
if (ret)
return ret;
max96745_power_on(max96745);
ret = devm_add_action_or_reset(dev, max96745_power_off, max96745);
if (ret)