summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorArun Murthy <arun.murthy@stericsson.com>2011-06-24 11:28:58 +0530
committerMathieu J. Poirier <mathieu.poirier@linaro.org>2011-11-10 10:59:50 -0700
commitb516f388c6a39bb0fe4be04deb09f8dc6802edee (patch)
tree1a7c4ddeaeafb1e0d0a0265675dceef429b89443 /drivers/power
parentba318d724182e74d6140c42703b141d6c499e6fe (diff)
power: ab5500-charger - usb line status interrupt correction
After getting usb rising edge interrupt, usb chip select should be enabled in order to get the usb line status interrupt. This sequence is done in the usb driver, in battery driver, usb charger detect was enabled. This was conflicting with the sequence followed in the usb driver and hence usb line status interrupt was not triggered. Hence reverted the usb detection enable in battery driver. ST-Ericsson Linux next: Not Tested ST-Ericsson ID: ER349171 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: Iaa055cdbe59699fe0442489586fd5c7e21c1ed5b Signed-off-by: Arun Murthy <arun.murthy@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/25822 Reviewed-by: QATEST Reviewed-by: Johan PALSSON <johan.palsson@stericsson.com> Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/ab5500_charger.c61
1 files changed, 8 insertions, 53 deletions
diff --git a/drivers/power/ab5500_charger.c b/drivers/power/ab5500_charger.c
index 2fd7888ad9d..736be487e14 100644
--- a/drivers/power/ab5500_charger.c
+++ b/drivers/power/ab5500_charger.c
@@ -37,8 +37,6 @@
/* AB5500 Charger constants */
#define AB5500_USB_LINK_STATUS 0x78
-#define USB_CHARG_DET_ENA_MASK 0x01
-#define USB_CHARG_DET_ENA 0x01
#define CHARGER_REV_SUP 0x10
#define SW_EOC 0x40
#define USB_CHAR_DET 0x02
@@ -396,12 +394,6 @@ static int ab5500_charger_read_usb_type(struct ab5500_charger *di)
int ret;
u8 val;
- ret = abx500_get_register_interruptible(di->dev,
- AB5500_BANK_IT, AB5500_IT_SOURCE22_REG, &val);
- if (ret < 0) {
- dev_err(di->dev, "%s ab5500 read failed\n", __func__);
- return ret;
- }
ret = abx500_get_register_interruptible(di->dev, AB5500_BANK_USB,
AB5500_USB_LINE_STATUS, &val);
if (ret < 0) {
@@ -426,45 +418,17 @@ static int ab5500_charger_read_usb_type(struct ab5500_charger *di)
*/
static int ab5500_charger_detect_usb_type(struct ab5500_charger *di)
{
- int i, ret;
+ int ret;
u8 val;
- /*
- * On getting the VBUS rising edge detect interrupt there
- * is a 250ms delay after which the register UsbLineStatus
- * is filled with valid data.
- */
- for (i = 0; i < 10; i++) {
- msleep(250);
- ret = abx500_get_register_interruptible(di->dev,
- AB5500_BANK_IT, AB5500_IT_SOURCE22_REG,
- &val);
- if (ret < 0) {
- dev_err(di->dev, "%s ab5500 read failed\n", __func__);
- return ret;
- }
- if (!(val & USB_LINK_UPDATE))
- continue;
-
- ret = abx500_get_register_interruptible(di->dev,
- AB5500_BANK_USB, AB5500_USB_LINE_STATUS, &val);
- if (ret < 0) {
- dev_err(di->dev, "%s ab5500 read failed\n", __func__);
- return ret;
- }
- /*
- * Until the IT source register is read the UsbLineStatus
- * register is not updated, hence doing the same
- * Revisit this:
- */
-
- /* get the USB type */
- val = (val & AB5500_USB_LINK_STATUS) >> 3;
- if (val) {
- dev_dbg(di->dev, "values = %d\n", val);
- break;
- }
+ ret = abx500_get_register_interruptible(di->dev,
+ AB5500_BANK_USB, AB5500_USB_LINE_STATUS, &val);
+ if (ret < 0) {
+ dev_err(di->dev, "%s ab5500 read failed\n", __func__);
+ return ret;
}
+ /* get the USB type */
+ val = (val & AB5500_USB_LINK_STATUS) >> 3;
ret = ab5500_charger_max_usb_curr(di,
(enum ab5500_charger_link_status) val);
@@ -1533,15 +1497,6 @@ static int ab5500_charger_init_hw_registers(struct ab5500_charger *di)
goto out;
}
- /* Enable USB Charger Detection */
- ret = abx500_mask_and_set_register_interruptible(di->dev,
- AB5500_BANK_USB, AB5500_USB_LINE_CTRL2,
- USB_CHARG_DET_ENA_MASK, USB_CHARG_DET_ENA);
- if (ret) {
- dev_err(di->dev, "failed to enable usb charger detection\n");
- goto out;
- }
-
/* Over current protection for reverse supply */
ret = abx500_mask_and_set_register_interruptible(di->dev,
AB5500_BANK_CHG, AB5500_CREVS, CHARGER_REV_SUP,