mfd: fusb302: Don't send hardreset when hot reset

FUSB302 default cc status is UFP. If we reset the UFP system,
the UFP PD status would be reset, but the DPF can't detecte
the disconnection since cc status did not changed. Reset UFP
would send hardreset to DPF due to wait power caps timeout.
And that would cause the power reset.

So, let's use softreset instead of hardreset in this case.

Change-Id: Ic896597569adb125bea3bf145c5c93712fa77539
Signed-off-by: zain wang <wzz@rock-chips.com>
This commit is contained in:
zain wang
2017-10-19 17:08:33 +08:00
committed by Huang, Tao
parent ab66f809e9
commit a026f64e8b
2 changed files with 18 additions and 11 deletions

View File

@@ -639,6 +639,16 @@ static void tcpm_select_rp_value(struct fusb30x_chip *chip, u32 rp)
regmap_write(chip->regmap, FUSB_REG_CONTROL0, control0_reg);
}
static int tcpm_check_vbus(struct fusb30x_chip *chip)
{
u32 val;
/* Read status register */
regmap_read(chip->regmap, FUSB_REG_STATUS0, &val);
return (val & STATUS0_VBUSOK) ? 1 : 0;
}
static void tcpm_init(struct fusb30x_chip *chip)
{
u8 val;
@@ -693,6 +703,7 @@ static void tcpm_init(struct fusb30x_chip *chip)
tcpm_set_vconn(chip, 0);
regmap_write(chip->regmap, FUSB_REG_POWER, 0xf);
chip->vbus_begin = tcpm_check_vbus(chip);
}
static void pd_execute_hard_reset(struct fusb30x_chip *chip)
@@ -823,16 +834,6 @@ static void set_state_unattached(struct fusb30x_chip *chip)
gpiod_set_value(chip->gpio_discharge, 0);
}
static int tcpm_check_vbus(struct fusb30x_chip *chip)
{
u32 val;
/* Read status register */
regmap_read(chip->regmap, FUSB_REG_STATUS0, &val);
return (val & STATUS0_VBUSOK) ? 1 : 0;
}
static void set_mesg(struct fusb30x_chip *chip, int cmd, int is_DMT)
{
int i;
@@ -1905,7 +1906,12 @@ static void fusb_state_snk_wait_caps(struct fusb30x_chip *chip, int evt)
}
} else if (evt & EVENT_TIMER_STATE) {
if (chip->hardrst_count <= N_HARDRESET_COUNT) {
set_state(chip, policy_snk_send_hardrst);
if (chip->vbus_begin) {
chip->vbus_begin = false;
set_state(chip, policy_snk_send_softrst);
} else {
set_state(chip, policy_snk_send_hardrst);
}
} else {
if (chip->is_pd_support)
set_state(chip, error_recovery);

View File

@@ -442,6 +442,7 @@ struct fusb30x_chip {
int pd_output_cur;
int cc_meas_high;
int cc_meas_low;
bool vbus_begin;
};
#endif /* FUSB302_H */