Skip to content

Commit b3ea5f4

Browse files
Marcus CooperLee Jones
authored andcommitted
ab8500-charger: Add UsbLineCtrl2 reference
When the state of USB Charge detection is changed then the calls use a define for another register in other bank. This change creates a new define for the correct register and removes the magic numbers that are present. Signed-off-by: Marcus Cooper <marcus.xm.cooper@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Hakan BERG <hakan.berg@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
1 parent 257107a commit b3ea5f4

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎drivers/power/ab8500_charger.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#define VBUS_DET_DBNC1 0x01
5555
#define OTP_ENABLE_WD 0x01
5656
#define DROP_COUNT_RESET 0x01
57+
#define USB_CH_DET 0x01
5758

5859
#define MAIN_CH_INPUT_CURR_SHIFT 4
5960
#define VBUS_IN_CURR_LIM_SHIFT 4
@@ -2348,8 +2349,9 @@ static void ab8500_charger_usb_link_status_work(struct work_struct *work)
23482349
AB8500_CHARGER, AB8500_USBCH_CTRL1_REG,
23492350
USB_CH_ENA, USB_CH_ENA);
23502351
/*Enable charger detection*/
2351-
abx500_mask_and_set_register_interruptible(di->dev, AB8500_USB,
2352-
AB8500_MCH_IPT_CURLVL_REG, 0x01, 0x01);
2352+
abx500_mask_and_set_register_interruptible(di->dev,
2353+
AB8500_USB, AB8500_USB_LINE_CTRL2_REG,
2354+
USB_CH_DET, USB_CH_DET);
23532355
di->invalid_charger_detect_state = 1;
23542356
/*exit and wait for new link status interrupt.*/
23552357
return;
@@ -2359,8 +2361,9 @@ static void ab8500_charger_usb_link_status_work(struct work_struct *work)
23592361
dev_dbg(di->dev,
23602362
"Invalid charger detected, state= 1\n");
23612363
/*Stop charger detection*/
2362-
abx500_mask_and_set_register_interruptible(di->dev, AB8500_USB,
2363-
AB8500_MCH_IPT_CURLVL_REG, 0x01, 0x00);
2364+
abx500_mask_and_set_register_interruptible(di->dev,
2365+
AB8500_USB, AB8500_USB_LINE_CTRL2_REG,
2366+
USB_CH_DET, 0x00);
23642367
/*Check link status*/
23652368
if (is_ab8500(di->parent))
23662369
ret = abx500_get_register_interruptible(di->dev,

‎include/linux/mfd/abx500/ab8500-bm.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* Bank : 0x5
2424
*/
2525
#define AB8500_USB_LINE_STAT_REG 0x80
26+
#define AB8500_USB_LINE_CTRL2_REG 0x82
2627
#define AB8500_USB_LINK1_STAT_REG 0x94
2728

2829
/*

0 commit comments

Comments
 (0)