Skip to content

Commit

Permalink
USB: OTG: msm: Implement charger detection
Browse files Browse the repository at this point in the history
Implement good battery algorithm defined in the battery charging V1.2 spec
for detecting different charging ports.  USB hardware is put into low power
mode when connected to a dedicated charging port.  vbus_draw and set_power
methods are implemented for determining the allowed current from Host in
different states (un-configured/suspend/configured).

The charger block is implemented using vendor specific registers and the
PHY used in MSM8960(28nm PHY) different from older targets like MSM8x60
and MSM7x30(45nm PHY).  The PHY vendor and product id registers are not
implemented in the above chipsets.  Hence PHY type is passed via platform
data.

Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Pavankumar Kondeti authored and Greg Kroah-Hartman committed May 7, 2011
1 parent 0f73cac commit d860852
Show file tree
Hide file tree
Showing 3 changed files with 457 additions and 5 deletions.
10 changes: 10 additions & 0 deletions drivers/usb/gadget/ci13xxx_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2506,6 +2506,15 @@ static int ci13xxx_wakeup(struct usb_gadget *_gadget)
return ret;
}

static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned mA)
{
struct ci13xxx *udc = container_of(_gadget, struct ci13xxx, gadget);

if (udc->transceiver)
return otg_set_power(udc->transceiver, mA);
return -ENOTSUPP;
}

/**
* Device operations part of the API to the USB controller hardware,
* which don't involve endpoints (or i/o)
Expand All @@ -2514,6 +2523,7 @@ static int ci13xxx_wakeup(struct usb_gadget *_gadget)
static const struct usb_gadget_ops usb_gadget_ops = {
.vbus_session = ci13xxx_vbus_session,
.wakeup = ci13xxx_wakeup,
.vbus_draw = ci13xxx_vbus_draw,
};

/**
Expand Down
Loading

0 comments on commit d860852

Please sign in to comment.