Skip to content

Commit 87dbd10

Browse files
power-xsfrkhuangtao
authored andcommitted
power: rk817: fix the OTG mode judgement
Change-Id: I23ecea8b26aa2aff0101bb5237fe89ad2b00fb9c Signed-off-by: shengfei Xu <xsf@rock-chips.com>
1 parent 55f42a9 commit 87dbd10

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/power/rk817_charger.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ module_param_named(dbg_level, dbg_enable, int, 0644);
5252
#define OTG_SLP_DISABLE 0x00
5353
#define OTG_ENABLE 0x33
5454
#define OTG_DISABLE 0x30
55+
#define OTG_MODE 0x03
56+
#define OTG_MODE_ON 0x03
5557
#define DEFAULT_INPUT_VOLTAGE 4500
5658
#define DEFAULT_INPUT_CURRENT 2000
5759
#define DEFAULT_CHRG_VOLTAGE 4200
@@ -500,7 +502,8 @@ static int rk817_charge_field_write(struct rk817_charger *charge,
500502

501503
static int rk817_charge_get_otg_state(struct rk817_charger *charge)
502504
{
503-
return (rk817_charge_field_read(charge, OTG_EN) & 0x03);
505+
return ((rk817_charge_field_read(charge, OTG_EN) &
506+
OTG_MODE) == OTG_MODE_ON);
504507
}
505508

506509
static void rk817_charge_otg_disable(struct rk817_charger *charge)

0 commit comments

Comments
 (0)