Re: [PATCH v1 1/8] usb: otg: palmas-usb: make palmas-usb as a comparator driver

2013-01-25 Thread Felipe Balbi
On Fri, Jan 25, 2013 at 02:14:07PM +0530, kishon wrote:
> On Friday 25 January 2013 01:13 PM, Felipe Balbi wrote:
> >Hi,
> >
> >On Fri, Jan 25, 2013 at 08:42:24AM +0530, Kishon Vijay Abraham I wrote:
> >>palmas-usb is made as a comparator driver to omap usb2 phy, so that
> >>omap usb can make use of palmas for srp and also to set vbus.
> >>
> >>Signed-off-by: Kishon Vijay Abraham I 
> >
> >doesn't apply. palmas-usb isn't in mainline
> >
> Yes. We'll ask Rajendra Nayak to pick this up in his tree?

Eventually the final version needs to go upstream, though.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v1 1/8] usb: otg: palmas-usb: make palmas-usb as a comparator driver

2013-01-25 Thread kishon

On Friday 25 January 2013 01:13 PM, Felipe Balbi wrote:

Hi,

On Fri, Jan 25, 2013 at 08:42:24AM +0530, Kishon Vijay Abraham I wrote:

palmas-usb is made as a comparator driver to omap usb2 phy, so that
omap usb can make use of palmas for srp and also to set vbus.

Signed-off-by: Kishon Vijay Abraham I 


doesn't apply. palmas-usb isn't in mainline


Yes. We'll ask Rajendra Nayak to pick this up in his tree?

Thanks
Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v1 1/8] usb: otg: palmas-usb: make palmas-usb as a comparator driver

2013-01-24 Thread Felipe Balbi
Hi,

On Fri, Jan 25, 2013 at 08:42:24AM +0530, Kishon Vijay Abraham I wrote:
> palmas-usb is made as a comparator driver to omap usb2 phy, so that
> omap usb can make use of palmas for srp and also to set vbus.
> 
> Signed-off-by: Kishon Vijay Abraham I 

doesn't apply. palmas-usb isn't in mainline

-- 
balbi


signature.asc
Description: Digital signature


[PATCH v1 1/8] usb: otg: palmas-usb: make palmas-usb as a comparator driver

2013-01-24 Thread Kishon Vijay Abraham I
palmas-usb is made as a comparator driver to omap usb2 phy, so that
omap usb can make use of palmas for srp and also to set vbus.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/otg/palmas-usb.c |   20 ++--
 include/linux/mfd/palmas.h   |3 +++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/otg/palmas-usb.c b/drivers/usb/otg/palmas-usb.c
index 8389ad6..76240ef 100644
--- a/drivers/usb/otg/palmas-usb.c
+++ b/drivers/usb/otg/palmas-usb.c
@@ -31,6 +31,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -208,16 +210,20 @@ static void palmas_set_vbus_work(struct work_struct *data)
regulator_disable(palmas_usb->vbus_reg);
 }
 
-static int palmas_set_vbus(struct palmas_usb *palmas_usb, bool enabled)
+static int palmas_set_vbus(struct phy_companion *comparator, bool enabled)
 {
+   struct palmas_usb *palmas_usb = comparator_to_palmas(comparator);
+
palmas_usb->vbus_enable = enabled;
schedule_work(&palmas_usb->set_vbus_work);
 
return 0;
 }
 
-static int palmas_start_srp(struct palmas_usb *palmas_usb)
+static int palmas_start_srp(struct phy_companion *comparator)
 {
+   struct palmas_usb *palmas_usb = comparator_to_palmas(comparator);
+
palmas_usb_write(palmas_usb->palmas, PALMAS_USB_VBUS_CTRL_SET,
PALMAS_USB_VBUS_CTRL_SET_VBUS_DISCHRG |
PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SINK);
@@ -253,6 +259,7 @@ static void palmas_dt_to_pdata(struct device_node *node,
 
 static int palmas_usb_probe(struct platform_device *pdev)
 {
+   u32 ret;
struct palmas *palmas = dev_get_drvdata(pdev->dev.parent);
struct palmas_usb_platform_data *pdata = pdev->dev.platform_data;
struct device_node *node = pdev->dev.of_node;
@@ -289,6 +296,15 @@ static int palmas_usb_probe(struct platform_device *pdev)
palmas_usb->irq4 = regmap_irq_get_virq(palmas->irq_data,
PALMAS_VBUS_IRQ);
 
+   palmas_usb->comparator.set_vbus = palmas_set_vbus;
+   palmas_usb->comparator.start_srp = palmas_start_srp;
+
+   ret = omap_usb2_set_comparator(&palmas_usb->comparator);
+   if (ret == -ENODEV) {
+   dev_info(&pdev->dev, "phy not ready, deferring probe");
+   return -EPROBE_DEFER;
+   }
+
palmas_usb_wakeup(palmas, pdata->wakeup);
 
/* init spinlock for workqueue */
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 82932db..a557db6 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define PALMAS_NUM_CLIENTS 3
 
@@ -343,6 +344,8 @@ struct palmas_usb {
struct palmas *palmas;
struct device *dev;
 
+   struct phy_companion comparator;
+
/* for vbus reporting with irqs disabled */
spinlock_t lock;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html