@@ -1064,8 +1064,9 @@ static void ln8411_pulldown_res_work(struct work_struct *work)
10641064 regmap_clear_bits (ln8411 -> regmap , LN8411_CTRL1 , LN8411_PD_EN_MASK );
10651065}
10661066
1067- static int ln8411_disable_otg (struct ln8411_device * ln8411 )
1067+ static int ln8411_disable_otg (struct regulator_dev * rdev )
10681068{
1069+ struct ln8411_device * ln8411 = rdev_get_drvdata (rdev );
10691070 union power_supply_propval val = {0 };
10701071 int ret ;
10711072
@@ -1112,37 +1113,6 @@ static int ln8411_disable_otg(struct ln8411_device *ln8411)
11121113 return ln8411_set_lion_ctrl (ln8411 , LN8411_LION_CTRL_LOCK );
11131114}
11141115
1115- static int ln8411_disable_vwpc_otg (struct regulator_dev * rdev )
1116- {
1117- struct ln8411_device * ln8411 = rdev_get_drvdata (rdev );
1118- union power_supply_propval val = {0 };
1119- int ret ;
1120-
1121- ret = ln8411_disable_otg (ln8411 );
1122- if (ret )
1123- return ret ;
1124-
1125- if (ln8411 -> role == LN8411_SECONDARY )
1126- return ret ;
1127-
1128- val .intval = false;
1129-
1130- ret = power_supply_set_property (ln8411 -> vwpc , POWER_SUPPLY_PROP_ONLINE , & val );
1131- if (ret )
1132- return ret ;
1133-
1134- ret = regmap_set_bits (ln8411 -> regmap ,
1135- LN8411_CTRL1 ,
1136- (LN8411_VBUS_PD_EN | LN8411_VWPC_PD_EN ));
1137- if (ret )
1138- return ret ;
1139-
1140- queue_delayed_work (system_wq , & ln8411 -> pulldown_res_work ,
1141- msecs_to_jiffies (320 ));
1142-
1143- return ret ;
1144- }
1145-
11461116static const struct regulator_init_data ln8411_otg_init_data = {
11471117 .constraints = {
11481118 .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
@@ -1154,7 +1124,7 @@ static const struct regulator_init_data ln8411_otg_init_data = {
11541124};
11551125
11561126static const struct regulator_ops ln8411_chg_vwpc_otg_ops = {
1157- .disable = ln8411_disable_vwpc_otg ,
1127+ .disable = ln8411_disable_otg ,
11581128 .enable = ln8411_enable_vwpc_otg ,
11591129 .is_enabled = ln8411_is_enabled_vwpc_otg ,
11601130 .get_current_limit = ln8411_get_current_limit_otg ,
@@ -1227,39 +1197,8 @@ static int ln8411_enable_vusb_otg(struct regulator_dev *rdev)
12271197 return power_supply_set_property (ln8411 -> vusb , POWER_SUPPLY_PROP_ONLINE , & val );
12281198}
12291199
1230- static int ln8411_disable_vusb_otg (struct regulator_dev * rdev )
1231- {
1232- struct ln8411_device * ln8411 = rdev_get_drvdata (rdev );
1233- union power_supply_propval val = {0 };
1234- int ret ;
1235-
1236- ret = ln8411_disable_otg (ln8411 );
1237- if (ret )
1238- return ret ;
1239-
1240- if (ln8411 -> role == LN8411_SECONDARY )
1241- return ret ;
1242-
1243- val .intval = false;
1244-
1245- ret = power_supply_set_property (ln8411 -> vusb , POWER_SUPPLY_PROP_ONLINE , & val );
1246- if (ret )
1247- return ret ;
1248-
1249- ret = regmap_set_bits (ln8411 -> regmap ,
1250- LN8411_CTRL1 ,
1251- (LN8411_VBUS_PD_EN | LN8411_VUSB_PD_EN ));
1252- if (ret )
1253- return ret ;
1254-
1255- queue_delayed_work (system_wq , & ln8411 -> pulldown_res_work ,
1256- msecs_to_jiffies (320 ));
1257-
1258- return ret ;
1259- }
1260-
12611200static const struct regulator_ops ln8411_chg_vusb_otg_ops = {
1262- .disable = ln8411_disable_vusb_otg ,
1201+ .disable = ln8411_disable_otg ,
12631202 .enable = ln8411_enable_vusb_otg ,
12641203 .is_enabled = ln8411_is_enabled_vusb_otg ,
12651204 .get_current_limit = ln8411_get_current_limit_otg ,
0 commit comments