extcon: Palmas Extcon Driver

This is the driver for the USB comparator built into the palmas chip. It
handles the various USB OTG events that can be generated by cable
insertion/removal.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Moiz Sonasath <m-sonasath@ti.com>
Signed-off-by: Ruchika Kharwar <ruchika@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: George Cherian <george.cherian@ti.com>
[kishon@ti.com: adapted palmas usb driver to use the extcon framework]
Signed-off-by: Sebastien Guiriec <s-guiriec@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Graeme Gregory
2013-05-28 10:50:11 +09:00
committed by Greg Kroah-Hartman
parent 9c8a013af4
commit b1f254e35d
5 changed files with 283 additions and 12 deletions

View File

@@ -20,6 +20,8 @@
#include <linux/leds.h>
#include <linux/regmap.h>
#include <linux/regulator/driver.h>
#include <linux/extcon.h>
#include <linux/usb/phy_companion.h>
#define PALMAS_NUM_CLIENTS 3
@@ -37,6 +39,12 @@ struct palmas_gpadc;
struct palmas_resource;
struct palmas_usb;
enum palmas_usb_state {
PALMAS_USB_STATE_DISCONNECT,
PALMAS_USB_STATE_VBUS,
PALMAS_USB_STATE_ID,
};
struct palmas {
struct device *dev;
@@ -180,9 +188,6 @@ struct palmas_pmic_platform_data {
};
struct palmas_usb_platform_data {
/* Set this if platform wishes its own vbus control */
int no_control_vbus;
/* Do we enable the wakeup comparator on probe */
int wakeup;
};
@@ -350,22 +355,19 @@ struct palmas_usb {
struct palmas *palmas;
struct device *dev;
/* for vbus reporting with irqs disabled */
spinlock_t lock;
struct regulator *vbus_reg;
struct extcon_dev edev;
/* used to set vbus, in atomic path */
struct work_struct set_vbus_work;
int irq1;
int irq2;
int irq3;
int irq4;
int id_otg_irq;
int id_irq;
int vbus_otg_irq;
int vbus_irq;
int vbus_enable;
u8 linkstat;
enum palmas_usb_state linkstat;
};
#define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator)