mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 07:03:09 -04:00
phone with rt9471 will ramdump when usb plug in
mutex lock might sleep kernel remove mutex lock in get_property() Change-Id: Ic4a0f55ed8171db75e176208a0a88e3172225031 Signed-off-by: longc104 <longc104@motorola.com> Reviewed-on: https://gerrit.mot.com/2255143 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Wang Wang <wangwang1@lenovo.com> Submit-Approved: Jira Key
This commit is contained in:
parent
433150deb9
commit
6ec8b632f3
2 changed files with 17 additions and 1 deletions
|
|
@ -206,6 +206,7 @@ static enum power_supply_usb_type rt9471_usb_type[] = {
|
|||
|
||||
struct rt9471_state {
|
||||
bool online;
|
||||
bool vbus_gd;
|
||||
};
|
||||
|
||||
struct rt9471_iio {
|
||||
|
|
@ -675,7 +676,11 @@ static int __rt9471_get_ic_stat(struct rt9471_chip *chip,
|
|||
int ret = 0;
|
||||
u8 regval = 0;
|
||||
|
||||
#ifdef RT9471_I2C_NO_MUTEX
|
||||
ret = __rt9471_i2c_read_byte(chip, RT9471_REG_STATUS, ®val);
|
||||
#else
|
||||
ret = rt9471_i2c_read_byte(chip, RT9471_REG_STATUS, ®val);
|
||||
#endif
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
*stat = (regval & RT9471_ICSTAT_MASK) >> RT9471_ICSTAT_SHIFT;
|
||||
|
|
@ -688,7 +693,11 @@ static int __rt9471_get_mivr(struct rt9471_chip *chip, u32 *mivr)
|
|||
int ret = 0;
|
||||
u8 regval = 0;
|
||||
|
||||
#ifdef RT9471_I2C_NO_MUTEX
|
||||
ret = __rt9471_i2c_read_byte(chip, RT9471_REG_VBUS, ®val);
|
||||
#else
|
||||
ret = rt9471_i2c_read_byte(chip, RT9471_REG_VBUS, ®val);
|
||||
#endif
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
@ -704,7 +713,11 @@ static int __rt9471_get_aicr(struct rt9471_chip *chip, u32 *aicr)
|
|||
int ret = 0;
|
||||
u8 regval = 0;
|
||||
|
||||
#ifdef RT9471_I2C_NO_MUTEX
|
||||
ret = __rt9471_i2c_read_byte(chip, RT9471_REG_IBUS, ®val);
|
||||
#else
|
||||
ret = rt9471_i2c_read_byte(chip, RT9471_REG_IBUS, ®val);
|
||||
#endif
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
@ -2268,7 +2281,7 @@ static int rt9471_charger_get_property(struct power_supply *psy,
|
|||
val->intval = chip->state.online;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_PRESENT:
|
||||
val->intval = rt9471_is_vbus_gd(chip);
|
||||
val->intval = chip->state.vbus_gd;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_TYPE:
|
||||
val->intval = rt9471_power_supply_desc.type;
|
||||
|
|
@ -2915,6 +2928,7 @@ static void charger_detect_work_func(struct work_struct *work)
|
|||
chg_ready = rt9471_is_vbus_ready_for_chg(chip);
|
||||
dev_info(chip->dev, "%s: vbus_gd:%d, chg_ready:%d\n", __func__, vbus_gd, chg_ready);
|
||||
chip->state.online = chg_ready;
|
||||
chip->state.vbus_gd = vbus_gd;
|
||||
|
||||
if ((!vbus_gd) && (chip->status & RT9471_STATUS_PLUGIN)) {
|
||||
dev_info(chip->dev, "%s:adapter removed\n", __func__);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
#ifndef __RT9471_CHARGER_H
|
||||
#define __RT9471_CHARGER_H
|
||||
|
||||
#define RT9471_I2C_NO_MUTEX
|
||||
|
||||
#define RT9471_DEVICE_ADDR 0x53
|
||||
#define RT9470_DEVID 0x09
|
||||
#define RT9470D_DEVID 0x0A
|
||||
|
|
|
|||
Loading…
Reference in a new issue