Re: Linux Testing Microconference at LPC

2019-04-26 Thread Tim Bird
I'm in the process now of planning Automated Testing Summit 2019,
which is tentatively planned for Lyon, France on October 31.  This is
the day after Embedded Linux Conference Europe and Open Source Summit
Europe, in Lyon.  I've been working with the
Linux Foundation event staff to set this up.

The focus of that event is test standards, including standards for
test definition, results formats, lab and board management, and APIs
between elements of the Automated Testing and CI stack.

I think that the set of things to discuss is somewhat different
between the Plumbers testing microconference and ATS.  But I hope that
I'm not fragmenting the space too much.

With regards to the Testing microconference at Plumbers, I would like
to do a presentation on the current status of test standards and test
framework interoperability.  We recently had some good meetings
between the LAVA and Fuego people at Linaro Connect
on this topic.

Let me know what you think.
 -- Tim

On Thu, Apr 25, 2019 at 6:37 AM Veronika Kabatova  wrote:
>
>
>
> - Original Message -
> > From: "Dhaval Giani" 
> > To: "Sasha Levin" , "shuah" 
> > , "Kevin Hilman" ,
> > "Tim Bird" , "LKML" 
> > Cc: "Steven Rostedt" , "Dan Carpenter" 
> > , wi...@infradead.org, "gustavo
> > padovan" , "Dmitry Vyukov" 
> > , "knut omang"
> > 
> > Sent: Thursday, April 11, 2019 7:37:51 PM
> > Subject: Linux Testing Microconference at LPC
> >
> > Hi Folks,
> >
> > This is a call for participation for the Linux Testing microconference
> > at LPC this year.
> >
> > For those who were at LPC last year, as the closing panel mentioned,
> > testing is probably the next big push needed to improve quality. From
> > getting more selftests in, to regression testing to ensure we don't
> > break realtime as more of PREEMPT_RT comes in, to more stable distros,
> > we need more testing around the kernel.
> >
> > We have talked about different efforts around testing, such as fuzzing
> > (using syzkaller and trinity), automating fuzzing with syzbot, 0day
> > testing, test frameworks such as ktests, smatch to find bugs in the
> > past. We want to push this discussion further this year and are
> > interested in hearing from you what you want to talk about, and where
> > kernel testing needs to go next.
> >
> > Please let us know what topics you believe should be a part of the
> > micro conference this year.
> >
>
> Hi,
>
> as CKI team, we would like to join the Plumbers discussions about CI for
> kernel. We obviously have our own working pipeline but would like to get
> more involved with the other upstream projects working on the same and
> collaborate on common solutions.
>
> I already started some of these discussions on automated-testing mailing
> list and got in contact with Kevin about the possibility of joining forces
> with KernelCI project.
>
> Our team planned to organize a 'hackfest' for upstream CI during the
> conference but I heard that the Automated Testing Summit should likely take
> place during that time too. If that's the case, we should meet up and
> discuss everything there instead of organizing a separate event.
>
>
> Information and links about CKI Project can be be found at [1] in case
> people are curious. Some of the things we'd like to achieve is having a
> single source for all upstream kernel test results where anyone doing the
> testing can publish them and collaborate on solving common problems (like
> interpreting test results, making build times faster, increasing the test
> coverage, detecting regressions etc.)
>
> With one of my colleagues, we will submit a microconference proposal that
> could serve as the starting point for the followup discussions about these
> topics.
>
>
> We would like to get feedback from kernel developers and maintainers about
> their expectations for testing and receiving results, as well as discuss
> the collaboration with other testing/CI projects.
>
>
>
> Veronika Kabatova
> CKI Project
>
>
> [1] https://cki-project.org/
>
>
> > Thanks!
> > Sasha and Dhaval
> >



-- 
 -- Tim Bird
Senior Staff Software Engineer, Sony Corporation
Architecture Group Chair, Core Embedded Linux Project, Linux Foundation


[PATCH] docs: update kernel versions and dates in tables

2018-05-23 Thread Tim Bird
Every once in a while, we should update the examples
to reflect more recent kernel versions.

Update the tables describing kernel releases, the merge window,
and current longterm maintained kernel, from 2.6-era kernels
to 4.x.

Signed-off-by: Tim Bird <tim.b...@sony.com>
---
 Documentation/process/2.Process.rst | 72 +++--
 1 file changed, 38 insertions(+), 34 deletions(-)

diff --git a/Documentation/process/2.Process.rst 
b/Documentation/process/2.Process.rst
index ce5561b..a9c46dd 100644
--- a/Documentation/process/2.Process.rst
+++ b/Documentation/process/2.Process.rst
@@ -18,17 +18,17 @@ major kernel release happening every two or three months.  
The recent
 release history looks like this:
 
==  =
-   2.6.38  March 14, 2011
-   2.6.37  January 4, 2011
-   2.6.36  October 20, 2010
-   2.6.35  August 1, 2010
-   2.6.34  May 15, 2010
-   2.6.33  February 24, 2010
+   4.11April 30, 2017
+   4.12July 2, 2017
+   4.13September 3, 2017
+   4.14November 12, 2017
+   4.15January 28, 2018
+   4.16April 1, 2018
==  =
 
-Every 2.6.x release is a major kernel release with new features, internal
-API changes, and more.  A typical 2.6 release can contain nearly 10,000
-changesets with changes to several hundred thousand lines of code.  2.6 is
+Every 4.x release is a major kernel release with new features, internal
+API changes, and more.  A typical 4.x release contain about 13,000
+changesets with changes to several hundred thousand lines of code.  4.x is
 thus the leading edge of Linux kernel development; the kernel uses a
 rolling development model which is continually integrating major changes.
 
@@ -70,20 +70,19 @@ will get up to somewhere between -rc6 and -rc9 before the 
kernel is
 considered to be sufficiently stable and the final 2.6.x release is made.
 At that point the whole process starts over again.
 
-As an example, here is how the 2.6.38 development cycle went (all dates in
-2011):
+As an example, here is how the 4.16 development cycle went (all dates in
+2018):
 
==  ===
-   January 4   2.6.37 stable release
-   January 18  2.6.38-rc1, merge window closes
-   January 21  2.6.38-rc2
-   February 1  2.6.38-rc3
-   February 7  2.6.38-rc4
-   February 15 2.6.38-rc5
-   February 21 2.6.38-rc6
-   March 1 2.6.38-rc7
-   March 7 2.6.38-rc8
-   March 142.6.38 stable release
+   January 28  4.15 stable release
+   February 11 4.16-rc1, merge window closes
+   February 18 4.16-rc2
+   February 25 4.16-rc3
+   March 4 4.16-rc4
+   March 114.16-rc5
+   March 184.16-rc6
+   March 254.16-rc7
+   April 1 4.17 stable release
==  ===
 
 How do the developers decide when to close the development cycle and create
@@ -99,37 +98,42 @@ release is made.  In the real world, this kind of 
perfection is hard to
 achieve; there are just too many variables in a project of this size.
 There comes a point where delaying the final release just makes the problem
 worse; the pile of changes waiting for the next merge window will grow
-larger, creating even more regressions the next time around.  So most 2.6.x
+larger, creating even more regressions the next time around.  So most 4.x
 kernels go out with a handful of known regressions though, hopefully, none
 of them are serious.
 
 Once a stable release is made, its ongoing maintenance is passed off to the
 "stable team," currently consisting of Greg Kroah-Hartman.  The stable team
-will release occasional updates to the stable release using the 2.6.x.y
+will release occasional updates to the stable release using the 4.x.y
 numbering scheme.  To be considered for an update release, a patch must (1)
 fix a significant bug, and (2) already be merged into the mainline for the
 next development kernel.  Kernels will typically receive stable updates for
 a little more than one development cycle past their initial release.  So,
-for example, the 2.6.36 kernel's history looked like:
+for example, the 4.13 kernel's history looked like:
 
==  ===
-   October 10  2.6.36 stable release
-   November 22 2.6.36.1
-   December 9  2.6.36.2
-   January 7   2.6.36.3
-   February 17 2.6.36.4
+   September 3 4.13 stable release
+   September 134.13.1
+   September 204.13.2
+   September 274.13.3
+   October 5   4.13.4
+   October 12  4.13.5
+   ... ...
+   November 24 4.13.16
==  ===
 
-2.6.36.4 was the final stable update for the 2.6.36 r

[PATCH] docs: update kernel versions and dates in tables

2018-05-23 Thread Tim Bird
Every once in a while, we should update the examples
to reflect more recent kernel versions.

Update the tables describing kernel releases, the merge window,
and current longterm maintained kernel, from 2.6-era kernels
to 4.x.

Signed-off-by: Tim Bird 
---
 Documentation/process/2.Process.rst | 72 +++--
 1 file changed, 38 insertions(+), 34 deletions(-)

diff --git a/Documentation/process/2.Process.rst 
b/Documentation/process/2.Process.rst
index ce5561b..a9c46dd 100644
--- a/Documentation/process/2.Process.rst
+++ b/Documentation/process/2.Process.rst
@@ -18,17 +18,17 @@ major kernel release happening every two or three months.  
The recent
 release history looks like this:
 
==  =
-   2.6.38  March 14, 2011
-   2.6.37  January 4, 2011
-   2.6.36  October 20, 2010
-   2.6.35  August 1, 2010
-   2.6.34  May 15, 2010
-   2.6.33  February 24, 2010
+   4.11April 30, 2017
+   4.12July 2, 2017
+   4.13September 3, 2017
+   4.14November 12, 2017
+   4.15January 28, 2018
+   4.16April 1, 2018
==  =
 
-Every 2.6.x release is a major kernel release with new features, internal
-API changes, and more.  A typical 2.6 release can contain nearly 10,000
-changesets with changes to several hundred thousand lines of code.  2.6 is
+Every 4.x release is a major kernel release with new features, internal
+API changes, and more.  A typical 4.x release contain about 13,000
+changesets with changes to several hundred thousand lines of code.  4.x is
 thus the leading edge of Linux kernel development; the kernel uses a
 rolling development model which is continually integrating major changes.
 
@@ -70,20 +70,19 @@ will get up to somewhere between -rc6 and -rc9 before the 
kernel is
 considered to be sufficiently stable and the final 2.6.x release is made.
 At that point the whole process starts over again.
 
-As an example, here is how the 2.6.38 development cycle went (all dates in
-2011):
+As an example, here is how the 4.16 development cycle went (all dates in
+2018):
 
==  ===
-   January 4   2.6.37 stable release
-   January 18  2.6.38-rc1, merge window closes
-   January 21  2.6.38-rc2
-   February 1  2.6.38-rc3
-   February 7  2.6.38-rc4
-   February 15 2.6.38-rc5
-   February 21 2.6.38-rc6
-   March 1 2.6.38-rc7
-   March 7 2.6.38-rc8
-   March 142.6.38 stable release
+   January 28  4.15 stable release
+   February 11 4.16-rc1, merge window closes
+   February 18 4.16-rc2
+   February 25 4.16-rc3
+   March 4 4.16-rc4
+   March 114.16-rc5
+   March 184.16-rc6
+   March 254.16-rc7
+   April 1 4.17 stable release
==  ===
 
 How do the developers decide when to close the development cycle and create
@@ -99,37 +98,42 @@ release is made.  In the real world, this kind of 
perfection is hard to
 achieve; there are just too many variables in a project of this size.
 There comes a point where delaying the final release just makes the problem
 worse; the pile of changes waiting for the next merge window will grow
-larger, creating even more regressions the next time around.  So most 2.6.x
+larger, creating even more regressions the next time around.  So most 4.x
 kernels go out with a handful of known regressions though, hopefully, none
 of them are serious.
 
 Once a stable release is made, its ongoing maintenance is passed off to the
 "stable team," currently consisting of Greg Kroah-Hartman.  The stable team
-will release occasional updates to the stable release using the 2.6.x.y
+will release occasional updates to the stable release using the 4.x.y
 numbering scheme.  To be considered for an update release, a patch must (1)
 fix a significant bug, and (2) already be merged into the mainline for the
 next development kernel.  Kernels will typically receive stable updates for
 a little more than one development cycle past their initial release.  So,
-for example, the 2.6.36 kernel's history looked like:
+for example, the 4.13 kernel's history looked like:
 
==  ===
-   October 10  2.6.36 stable release
-   November 22 2.6.36.1
-   December 9  2.6.36.2
-   January 7   2.6.36.3
-   February 17 2.6.36.4
+   September 3 4.13 stable release
+   September 134.13.1
+   September 204.13.2
+   September 274.13.3
+   October 5   4.13.4
+   October 12  4.13.5
+   ... ...
+   November 24 4.13.16
==  ===
 
-2.6.36.4 was the final stable update for the 2.6.36 release.
+4.13.16 was the final sta

Re: [patch] ARM: qcom: silence an uninitialized variable warning

2016-04-13 Thread Tim Bird


On 04/12/2016 11:45 PM, Dan Carpenter wrote:
> It's harmless but, if "enable" isn't set, then we pass uninitialized
> values to qcom_coincell_chgr_config().  The values aren't used, but
> let's silence the warning anyway.
> 
> Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com>
> 
> diff --git a/drivers/misc/qcom-coincell.c b/drivers/misc/qcom-coincell.c
> index 7b4a2da..829a61d 100644
> --- a/drivers/misc/qcom-coincell.c
> +++ b/drivers/misc/qcom-coincell.c
> @@ -94,7 +94,8 @@ static int qcom_coincell_probe(struct platform_device *pdev)
>  {
>   struct device_node *node = pdev->dev.of_node;
>   struct qcom_coincell chgr;
> - u32 rset, vset;
> + u32 rset = 0;
> + u32 vset = 0;
>   bool enable;
>   int rc;
>  
> 
Looks OK to me.  Thanks for the warning cleanup!

Acked-by: Tim Bird
 -- Tim


Re: [patch] ARM: qcom: silence an uninitialized variable warning

2016-04-13 Thread Tim Bird


On 04/12/2016 11:45 PM, Dan Carpenter wrote:
> It's harmless but, if "enable" isn't set, then we pass uninitialized
> values to qcom_coincell_chgr_config().  The values aren't used, but
> let's silence the warning anyway.
> 
> Signed-off-by: Dan Carpenter 
> 
> diff --git a/drivers/misc/qcom-coincell.c b/drivers/misc/qcom-coincell.c
> index 7b4a2da..829a61d 100644
> --- a/drivers/misc/qcom-coincell.c
> +++ b/drivers/misc/qcom-coincell.c
> @@ -94,7 +94,8 @@ static int qcom_coincell_probe(struct platform_device *pdev)
>  {
>   struct device_node *node = pdev->dev.of_node;
>   struct qcom_coincell chgr;
> - u32 rset, vset;
> + u32 rset = 0;
> + u32 vset = 0;
>   bool enable;
>   int rc;
>  
> 
Looks OK to me.  Thanks for the warning cleanup!

Acked-by: Tim Bird
 -- Tim


[PATCH v4 1/3] dt-binding: power: Add otg regulator binding

2015-12-15 Thread Tim Bird
Add a binding for the regulator which controls the OTG chargepath switch.
The OTG switch gets its power from pm8941_5vs1, and that should be
expressed as a usb_otg_in-supply property in the DT node for the
charger driver.  The regulator name is "otg-vbus".

Signed-off-by: Tim Bird 
---
Changes since v3
 - switch supply name to have underscores instead of dashes
   - (switched back to match the name used in data sheets)
 - switch regulator node name to otg-vbus
Changes since v1
 - switch supply name to have dashes instead of underscores
 - remove superfluous DT explanations in the otg node description
---
 .../devicetree/bindings/power_supply/qcom_smbb.txt| 19 +++
 1 file changed, 19 insertions(+)

diff --git a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt 
b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
index 65b88fa..06f8a5d 100644
--- a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
+++ b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
@@ -105,6 +105,22 @@ PROPERTIES
regulation must be done externally to fully comply with
the JEITA safety guidelines if this flag is set.
 
+- usb_otg_in-supply:
+  Usage: optional
+  Value type: 
+  Description: Reference to the regulator supplying power to the USB_OTG_IN
+   pin.
+
+child nodes:
+- otg-vbus:
+  Usage: optional
+  Description: This node defines a regulator used to control the direction
+   of VBUS voltage - specifically: whether to supply voltage
+   to VBUS for host mode operation of the OTG port, or allow
+   input voltage from external VBUS for charging.  In the
+   hardware, the supply for this regulator comes from
+   usb_otg_in-supply.
+
 EXAMPLE
 charger@1000 {
compatible = "qcom,pm8941-charger";
@@ -128,4 +144,7 @@ charger@1000 {
 
qcom,fast-charge-current-limit = <100>;
qcom,dc-charge-current-limit = <100>;
+   usb_otg_in-supply = <_5vs1>;
+
+   otg-vbus {};
 };
-- 
2.6.3

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


[PATCH v4 2/3] power: qcom_smbb: Add otg regulator for control of vbus

2015-12-15 Thread Tim Bird
Add a regulator to control the OTG chargepath switch.  This
is used by USB code to control VBUS direction - out for host mode
on the OTG port, and in for charging mode.

Signed-off-by: Tim Bird 
---
Changes since v3:
 - changed DT node name to otg-vbus
 - removed fixed-voltage setup from otg regulator rdesc
Changes since v1:
 - changed name of supply to remove underscores
---
 drivers/power/qcom_smbb.c | 72 +++
 1 file changed, 72 insertions(+)

diff --git a/drivers/power/qcom_smbb.c b/drivers/power/qcom_smbb.c
index 5eb1e9e..8998f4d 100644
--- a/drivers/power/qcom_smbb.c
+++ b/drivers/power/qcom_smbb.c
@@ -34,6 +34,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #define SMBB_CHG_VMAX  0x040
 #define SMBB_CHG_VSAFE 0x041
@@ -71,6 +74,8 @@
 #define BTC_CTRL_HOT_EXT_N BIT(0)
 
 #define SMBB_USB_IMAX  0x344
+#define SMBB_USB_OTG_CTL   0x348
+#define OTG_CTL_EN BIT(0)
 #define SMBB_USB_ENUM_TIMER_STOP 0x34e
 #define ENUM_TIMER_STOPBIT(0)
 #define SMBB_USB_SEC_ACCESS0x3d0
@@ -123,6 +128,9 @@ struct smbb_charger {
struct power_supply *dc_psy;
struct power_supply *bat_psy;
struct regmap *regmap;
+
+   struct regulator_desc otg_rdesc;
+   struct regulator_dev *otg_reg;
 };
 
 static int smbb_vbat_weak_fn(unsigned int index)
@@ -778,12 +786,56 @@ static const struct power_supply_desc dc_psy_desc = {
.property_is_writeable = smbb_charger_writable_property,
 };
 
+static int smbb_chg_otg_enable(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   int rc;
+
+   rc = regmap_update_bits(chg->regmap, chg->addr + SMBB_USB_OTG_CTL,
+   OTG_CTL_EN, OTG_CTL_EN);
+   if (rc)
+   dev_err(chg->dev, "failed to update OTG_CTL\n");
+   return rc;
+}
+
+static int smbb_chg_otg_disable(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   int rc;
+
+   rc = regmap_update_bits(chg->regmap, chg->addr + SMBB_USB_OTG_CTL,
+   OTG_CTL_EN, 0);
+   if (rc)
+   dev_err(chg->dev, "failed to update OTG_CTL\n");
+   return rc;
+}
+
+static int smbb_chg_otg_is_enabled(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   unsigned int value = 0;
+   int rc;
+
+   rc = regmap_read(chg->regmap, chg->addr + SMBB_USB_OTG_CTL, );
+   if (rc)
+   dev_err(chg->dev, "failed to read OTG_CTL\n");
+
+   return !!(value & OTG_CTL_EN);
+}
+
+static struct regulator_ops smbb_chg_otg_ops = {
+   .enable = smbb_chg_otg_enable,
+   .disable = smbb_chg_otg_disable,
+   .is_enabled = smbb_chg_otg_is_enabled,
+};
+
 static int smbb_charger_probe(struct platform_device *pdev)
 {
struct power_supply_config bat_cfg = {};
struct power_supply_config usb_cfg = {};
struct power_supply_config dc_cfg = {};
struct smbb_charger *chg;
+   struct regulator_config config = { };
int rc, i;
 
chg = devm_kzalloc(>dev, sizeof(*chg), GFP_KERNEL);
@@ -884,6 +936,26 @@ static int smbb_charger_probe(struct platform_device *pdev)
}
}
 
+   /*
+* otg regulator is used to control VBUS voltage direction
+* when USB switches between host and gadget mode
+*/
+   chg->otg_rdesc.id = -1;
+   chg->otg_rdesc.name = "otg-vbus";
+   chg->otg_rdesc.ops = _chg_otg_ops;
+   chg->otg_rdesc.owner = THIS_MODULE;
+   chg->otg_rdesc.type = REGULATOR_VOLTAGE;
+   chg->otg_rdesc.supply_name = "usb-otg-in";
+   chg->otg_rdesc.of_match = "otg-vbus";
+
+   config.dev = >dev;
+   config.driver_data = chg;
+
+   chg->otg_reg = devm_regulator_register(>dev, >otg_rdesc,
+  );
+   if (IS_ERR(chg->otg_reg))
+   return PTR_ERR(chg->otg_reg);
+
chg->jeita_ext_temp = of_property_read_bool(pdev->dev.of_node,
"qcom,jeita-extended-temp-range");
 
-- 
2.6.3

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


[PATCH v4 3/3] ARM: dts: qcom: add charger otg regulator

2015-12-15 Thread Tim Bird
Add the otg regulator provided by the charger block.

Signed-off-by: Tim Bird 
---
Changes since V3:
 - change name of charger regulator to "otg-vbus"
---
 arch/arm/boot/dts/qcom-pm8941.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-pm8941.dtsi 
b/arch/arm/boot/dts/qcom-pm8941.dtsi
index b0d4439..d0ffca7 100644
--- a/arch/arm/boot/dts/qcom-pm8941.dtsi
+++ b/arch/arm/boot/dts/qcom-pm8941.dtsi
@@ -45,6 +45,10 @@
  "chg-gone",
  "usb-valid",
  "dc-valid";
+
+   usb_otg_in-supply = <_5vs1>;
+
+   chg_otg: otg-vbus { };
};
 
pm8941_gpios: gpios@c000 {
-- 
2.6.3

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


[PATCH v4 1/3] dt-binding: power: Add otg regulator binding

2015-12-15 Thread Tim Bird
Add a binding for the regulator which controls the OTG chargepath switch.
The OTG switch gets its power from pm8941_5vs1, and that should be
expressed as a usb_otg_in-supply property in the DT node for the
charger driver.  The regulator name is "otg-vbus".

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
Changes since v3
 - switch supply name to have underscores instead of dashes
   - (switched back to match the name used in data sheets)
 - switch regulator node name to otg-vbus
Changes since v1
 - switch supply name to have dashes instead of underscores
 - remove superfluous DT explanations in the otg node description
---
 .../devicetree/bindings/power_supply/qcom_smbb.txt| 19 +++
 1 file changed, 19 insertions(+)

diff --git a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt 
b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
index 65b88fa..06f8a5d 100644
--- a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
+++ b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
@@ -105,6 +105,22 @@ PROPERTIES
regulation must be done externally to fully comply with
the JEITA safety guidelines if this flag is set.
 
+- usb_otg_in-supply:
+  Usage: optional
+  Value type: 
+  Description: Reference to the regulator supplying power to the USB_OTG_IN
+   pin.
+
+child nodes:
+- otg-vbus:
+  Usage: optional
+  Description: This node defines a regulator used to control the direction
+   of VBUS voltage - specifically: whether to supply voltage
+   to VBUS for host mode operation of the OTG port, or allow
+   input voltage from external VBUS for charging.  In the
+   hardware, the supply for this regulator comes from
+   usb_otg_in-supply.
+
 EXAMPLE
 charger@1000 {
compatible = "qcom,pm8941-charger";
@@ -128,4 +144,7 @@ charger@1000 {
 
qcom,fast-charge-current-limit = <100>;
qcom,dc-charge-current-limit = <100>;
+   usb_otg_in-supply = <_5vs1>;
+
+   otg-vbus {};
 };
-- 
2.6.3

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


[PATCH v4 3/3] ARM: dts: qcom: add charger otg regulator

2015-12-15 Thread Tim Bird
Add the otg regulator provided by the charger block.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
Changes since V3:
 - change name of charger regulator to "otg-vbus"
---
 arch/arm/boot/dts/qcom-pm8941.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-pm8941.dtsi 
b/arch/arm/boot/dts/qcom-pm8941.dtsi
index b0d4439..d0ffca7 100644
--- a/arch/arm/boot/dts/qcom-pm8941.dtsi
+++ b/arch/arm/boot/dts/qcom-pm8941.dtsi
@@ -45,6 +45,10 @@
  "chg-gone",
  "usb-valid",
  "dc-valid";
+
+   usb_otg_in-supply = <_5vs1>;
+
+   chg_otg: otg-vbus { };
};
 
pm8941_gpios: gpios@c000 {
-- 
2.6.3

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


[PATCH v4 2/3] power: qcom_smbb: Add otg regulator for control of vbus

2015-12-15 Thread Tim Bird
Add a regulator to control the OTG chargepath switch.  This
is used by USB code to control VBUS direction - out for host mode
on the OTG port, and in for charging mode.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
Changes since v3:
 - changed DT node name to otg-vbus
 - removed fixed-voltage setup from otg regulator rdesc
Changes since v1:
 - changed name of supply to remove underscores
---
 drivers/power/qcom_smbb.c | 72 +++
 1 file changed, 72 insertions(+)

diff --git a/drivers/power/qcom_smbb.c b/drivers/power/qcom_smbb.c
index 5eb1e9e..8998f4d 100644
--- a/drivers/power/qcom_smbb.c
+++ b/drivers/power/qcom_smbb.c
@@ -34,6 +34,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #define SMBB_CHG_VMAX  0x040
 #define SMBB_CHG_VSAFE 0x041
@@ -71,6 +74,8 @@
 #define BTC_CTRL_HOT_EXT_N BIT(0)
 
 #define SMBB_USB_IMAX  0x344
+#define SMBB_USB_OTG_CTL   0x348
+#define OTG_CTL_EN BIT(0)
 #define SMBB_USB_ENUM_TIMER_STOP 0x34e
 #define ENUM_TIMER_STOPBIT(0)
 #define SMBB_USB_SEC_ACCESS0x3d0
@@ -123,6 +128,9 @@ struct smbb_charger {
struct power_supply *dc_psy;
struct power_supply *bat_psy;
struct regmap *regmap;
+
+   struct regulator_desc otg_rdesc;
+   struct regulator_dev *otg_reg;
 };
 
 static int smbb_vbat_weak_fn(unsigned int index)
@@ -778,12 +786,56 @@ static const struct power_supply_desc dc_psy_desc = {
.property_is_writeable = smbb_charger_writable_property,
 };
 
+static int smbb_chg_otg_enable(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   int rc;
+
+   rc = regmap_update_bits(chg->regmap, chg->addr + SMBB_USB_OTG_CTL,
+   OTG_CTL_EN, OTG_CTL_EN);
+   if (rc)
+   dev_err(chg->dev, "failed to update OTG_CTL\n");
+   return rc;
+}
+
+static int smbb_chg_otg_disable(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   int rc;
+
+   rc = regmap_update_bits(chg->regmap, chg->addr + SMBB_USB_OTG_CTL,
+   OTG_CTL_EN, 0);
+   if (rc)
+   dev_err(chg->dev, "failed to update OTG_CTL\n");
+   return rc;
+}
+
+static int smbb_chg_otg_is_enabled(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   unsigned int value = 0;
+   int rc;
+
+   rc = regmap_read(chg->regmap, chg->addr + SMBB_USB_OTG_CTL, );
+   if (rc)
+   dev_err(chg->dev, "failed to read OTG_CTL\n");
+
+   return !!(value & OTG_CTL_EN);
+}
+
+static struct regulator_ops smbb_chg_otg_ops = {
+   .enable = smbb_chg_otg_enable,
+   .disable = smbb_chg_otg_disable,
+   .is_enabled = smbb_chg_otg_is_enabled,
+};
+
 static int smbb_charger_probe(struct platform_device *pdev)
 {
struct power_supply_config bat_cfg = {};
struct power_supply_config usb_cfg = {};
struct power_supply_config dc_cfg = {};
struct smbb_charger *chg;
+   struct regulator_config config = { };
int rc, i;
 
chg = devm_kzalloc(>dev, sizeof(*chg), GFP_KERNEL);
@@ -884,6 +936,26 @@ static int smbb_charger_probe(struct platform_device *pdev)
}
}
 
+   /*
+* otg regulator is used to control VBUS voltage direction
+* when USB switches between host and gadget mode
+*/
+   chg->otg_rdesc.id = -1;
+   chg->otg_rdesc.name = "otg-vbus";
+   chg->otg_rdesc.ops = _chg_otg_ops;
+   chg->otg_rdesc.owner = THIS_MODULE;
+   chg->otg_rdesc.type = REGULATOR_VOLTAGE;
+   chg->otg_rdesc.supply_name = "usb-otg-in";
+   chg->otg_rdesc.of_match = "otg-vbus";
+
+   config.dev = >dev;
+   config.driver_data = chg;
+
+   chg->otg_reg = devm_regulator_register(>dev, >otg_rdesc,
+  );
+   if (IS_ERR(chg->otg_reg))
+   return PTR_ERR(chg->otg_reg);
+
chg->jeita_ext_temp = of_property_read_bool(pdev->dev.of_node,
"qcom,jeita-extended-temp-range");
 
-- 
2.6.3

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


Re: [PATCH v2 1/3] dt-binding: power: Add otg regulator binding

2015-12-09 Thread Tim Bird


On 12/09/2015 06:36 AM, Rob Herring wrote:
> On Wed, Dec 9, 2015 at 6:55 AM, Tim Bird  wrote:
>> On 12/08/2015 08:11 PM, Rob Herring wrote:
>>> On Tue, Dec 08, 2015 at 04:40:16PM -0800, Tim Bird wrote:
>>>> Add a binding for the regulator which controls the OTG chargepath switch.
>>>> The OTG switch gets its power from pm8941_5vs1, and that should be
>>>> expressed as a usb-otg-in-supply property in the DT node for the
>>>> charger driver.  The regulator name is "otg".
> 
> [...]
> 
>>>> +child nodes:
>>>> +- otg:
>>>> +  Usage: optional
>>>> +  Description: This node defines a regulator used to control the direction
>>>> +   of VBUS voltage - specifically: whether to supply voltage
>>>> +   to VBUS for host mode operation of the OTG port, or allow
>>>> +   input voltage from external VBUS for charging.  In the
>>>> +   hardware, the supply for this regulator comes from
>>>> +   usb-otg-in-supply.
>>>
>>> Doesn't this regulator need to have a name defined?
>>
>> I'm not sure what you mean.  The regulator name is "otg", defined by the DT 
>> node
>> name. The code requires that the DT node name be "otg", and defines a 
>> regulator
>> with the same name.
>>
>> As far as I know, you have to define a DT label for the node, in order
>> to reference this regulator with a phandle.  Is that what you are referring 
>> to?
>> I usually use "chg_otg" as the label.  Are you asking that this be reflected
>> in the example?
> 
> You need a regulator-name property. Also, should should define valid
> values for regulator-min-microvolt and regulator-max-microvolt.

All of those are listed as optional properties in
Documentation/devicetree/bindings/regulator/regulator.txt.

The regulator-name seems redundant, since the name of the DT
node becomes the regulator name in the Linux system.  This is
not currently used anywhere, as the node is "connected up" via
phandle, which uses the label.  That is, there's no code in
the kernel that looks up this regulator by name, although it
does get a name.

As for the microvolt references, I'm a little stumped what
to do with those.  I could use regulator-min-microvolt of 0
and a regulator-max-microvolt of 50, but that's not
exactly right.

This is actually representing a voltage switch, which is being
represented in the regulator framework in Linux, because it
seems to fit there best.  It has regulators it's related
to, which should be adjusted when this one is.  However, it
intrinsically does not have a voltage of it's own, so it's a
bit of a weird case.  And the voltage can either be going
"out" or "in".

I'm CC-ing Mark Brown, who may know how these types of things
are supposed to be expressed.  I believe he saw an earlier version
of this patch last year.  Or maybe our power maintainers will
chime in with some wisdom.  I can't be the first person to
be adding a charge pathway switch to mainline, so I'm open to
doing it the "right way". :-)

> Thinking about this some more, the node name should be generic, so
> just "regulator". The label does not need to be generic.

There are other switches in the charger block that are not
exposed yet.  This one handles the the OTG (vbus) charge pathway.
Others handle other charge pathways (some of which are used on phones
and some are not - they're used, e.g., on the dragonboard).  I'd
rather not give it a generic name, because eventually the driver
should expose those other switches as something as well.

 -- Tim

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


Re: [PATCH v2 1/3] dt-binding: power: Add otg regulator binding

2015-12-09 Thread Tim Bird
On 12/08/2015 08:11 PM, Rob Herring wrote:
> On Tue, Dec 08, 2015 at 04:40:16PM -0800, Tim Bird wrote:
>> Add a binding for the regulator which controls the OTG chargepath switch.
>> The OTG switch gets its power from pm8941_5vs1, and that should be
>> expressed as a usb-otg-in-supply property in the DT node for the
>> charger driver.  The regulator name is "otg".
>>
>> Signed-off-by: Tim Bird 
>> ---
>> Changes since v1
>>  - switch supply name to have dashes instead of underscores
>>  - remove superfluous DT explanations in the otg node description
>> ---
>>  .../devicetree/bindings/power_supply/qcom_smbb.txt| 19 
>> +++
>>  1 file changed, 19 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt 
>> b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
>> index 65b88fa..28b6da7 100644
>> --- a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
>> +++ b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
>> @@ -105,6 +105,22 @@ PROPERTIES
>> regulation must be done externally to fully comply with
>> the JEITA safety guidelines if this flag is set.
>>  
>> +- usb-otg-in-supply:
>> +  Usage: optional
>> +  Value type: 
>> +  Description: Reference to the regulator supplying power to the USB_OTG_IN
>> +   pin.
>> +
>> +child nodes:
>> +- otg:
>> +  Usage: optional
>> +  Description: This node defines a regulator used to control the direction
>> +   of VBUS voltage - specifically: whether to supply voltage
>> +   to VBUS for host mode operation of the OTG port, or allow
>> +   input voltage from external VBUS for charging.  In the
>> +   hardware, the supply for this regulator comes from
>> +   usb-otg-in-supply.
> 
> Doesn't this regulator need to have a name defined?

I'm not sure what you mean.  The regulator name is "otg", defined by the DT node
name. The code requires that the DT node name be "otg", and defines a regulator
with the same name.

As far as I know, you have to define a DT label for the node, in order
to reference this regulator with a phandle.  Is that what you are referring to?
I usually use "chg_otg" as the label.  Are you asking that this be reflected
in the example?

> Disabling this regulator (along with other setup) will enable charging?

Yes.  Enabling it allows the device to power the USB VBUS line for host
mode, and disabling it allows power to flow the other way (into the device)
for charging, when the USB port is in gadget mode.
 -- Tim

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


[PATCH v3 3/3] ARM: dts: qcom: add charger otg regulator

2015-12-09 Thread Tim Bird
Add the otg regulator provided by the charger block.

Signed-off-by: Tim Bird 
---
 arch/arm/boot/dts/qcom-pm8941.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-pm8941.dtsi 
b/arch/arm/boot/dts/qcom-pm8941.dtsi
index b0d4439..1b80100 100644
--- a/arch/arm/boot/dts/qcom-pm8941.dtsi
+++ b/arch/arm/boot/dts/qcom-pm8941.dtsi
@@ -45,6 +45,10 @@
  "chg-gone",
  "usb-valid",
  "dc-valid";
+
+   usb-otg-in-supply = <_5vs1>;
+
+   chg_otg: otg { };
};
 
pm8941_gpios: gpios@c000 {
-- 
2.6.3

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


[PATCH v3 2/3] power: qcom_smbb: Add otg regulator for control of vbus

2015-12-09 Thread Tim Bird
Add a regulator to control the OTG chargepath switch.  This
is used by USB code to control VBUS direction - out for host mode
on the OTG port, and in for charging mode.

Signed-off-by: Tim Bird 
---
Changes since v1:
 - changed name of supply to remove underscores
---
 drivers/power/qcom_smbb.c | 74 +++
 1 file changed, 74 insertions(+)

diff --git a/drivers/power/qcom_smbb.c b/drivers/power/qcom_smbb.c
index 5eb1e9e..2f1394c 100644
--- a/drivers/power/qcom_smbb.c
+++ b/drivers/power/qcom_smbb.c
@@ -34,6 +34,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #define SMBB_CHG_VMAX  0x040
 #define SMBB_CHG_VSAFE 0x041
@@ -71,6 +74,8 @@
 #define BTC_CTRL_HOT_EXT_N BIT(0)
 
 #define SMBB_USB_IMAX  0x344
+#define SMBB_USB_OTG_CTL   0x348
+#define OTG_CTL_EN BIT(0)
 #define SMBB_USB_ENUM_TIMER_STOP 0x34e
 #define ENUM_TIMER_STOPBIT(0)
 #define SMBB_USB_SEC_ACCESS0x3d0
@@ -123,6 +128,9 @@ struct smbb_charger {
struct power_supply *dc_psy;
struct power_supply *bat_psy;
struct regmap *regmap;
+
+   struct regulator_desc otg_rdesc;
+   struct regulator_dev *otg_reg;
 };
 
 static int smbb_vbat_weak_fn(unsigned int index)
@@ -778,12 +786,56 @@ static const struct power_supply_desc dc_psy_desc = {
.property_is_writeable = smbb_charger_writable_property,
 };
 
+static int smbb_chg_otg_enable(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   int rc;
+
+   rc = regmap_update_bits(chg->regmap, chg->addr + SMBB_USB_OTG_CTL,
+   OTG_CTL_EN, OTG_CTL_EN);
+   if (rc)
+   dev_err(chg->dev, "failed to update OTG_CTL\n");
+   return rc;
+}
+
+static int smbb_chg_otg_disable(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   int rc;
+
+   rc = regmap_update_bits(chg->regmap, chg->addr + SMBB_USB_OTG_CTL,
+   OTG_CTL_EN, 0);
+   if (rc)
+   dev_err(chg->dev, "failed to update OTG_CTL\n");
+   return rc;
+}
+
+static int smbb_chg_otg_is_enabled(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   unsigned int value = 0;
+   int rc;
+
+   rc = regmap_read(chg->regmap, chg->addr + SMBB_USB_OTG_CTL, );
+   if (rc)
+   dev_err(chg->dev, "failed to read OTG_CTL\n");
+
+   return !!(value & OTG_CTL_EN);
+}
+
+static struct regulator_ops smbb_chg_otg_ops = {
+   .enable = smbb_chg_otg_enable,
+   .disable = smbb_chg_otg_disable,
+   .is_enabled = smbb_chg_otg_is_enabled,
+};
+
 static int smbb_charger_probe(struct platform_device *pdev)
 {
struct power_supply_config bat_cfg = {};
struct power_supply_config usb_cfg = {};
struct power_supply_config dc_cfg = {};
struct smbb_charger *chg;
+   struct regulator_config config = { };
int rc, i;
 
chg = devm_kzalloc(>dev, sizeof(*chg), GFP_KERNEL);
@@ -884,6 +936,28 @@ static int smbb_charger_probe(struct platform_device *pdev)
}
}
 
+   /*
+* otg regulator is used to control VBUS voltage direction
+* when USB switches between host and gadget mode
+*/
+   chg->otg_rdesc.id = -1;
+   chg->otg_rdesc.name = "otg";
+   chg->otg_rdesc.ops = _chg_otg_ops;
+   chg->otg_rdesc.owner = THIS_MODULE;
+   chg->otg_rdesc.type = REGULATOR_VOLTAGE;
+   chg->otg_rdesc.supply_name = "usb-otg-in";
+   chg->otg_rdesc.fixed_uV = 500;
+   chg->otg_rdesc.n_voltages = 1;
+   chg->otg_rdesc.of_match = "otg";
+
+   config.dev = >dev;
+   config.driver_data = chg;
+
+   chg->otg_reg = devm_regulator_register(>dev, >otg_rdesc,
+  );
+   if (IS_ERR(chg->otg_reg))
+   return PTR_ERR(chg->otg_reg);
+
chg->jeita_ext_temp = of_property_read_bool(pdev->dev.of_node,
"qcom,jeita-extended-temp-range");
 
-- 
2.6.3

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


[PATCH v3 1/3] dt-binding: power: Add otg regulator binding

2015-12-09 Thread Tim Bird
Add a binding for the regulator which controls the OTG chargepath switch.
The OTG switch gets its power from pm8941_5vs1, and that should be
expressed as a usb-otg-in-supply property in the DT node for the
charger driver.  The regulator name is "otg".

Signed-off-by: Tim Bird 
---
Changes since v1
 - switch supply name to have dashes instead of underscores
 - remove superfluous DT explanations in the otg node description
---
 .../devicetree/bindings/power_supply/qcom_smbb.txt| 19 +++
 1 file changed, 19 insertions(+)

diff --git a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt 
b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
index 65b88fa..28b6da7 100644
--- a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
+++ b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
@@ -105,6 +105,22 @@ PROPERTIES
regulation must be done externally to fully comply with
the JEITA safety guidelines if this flag is set.
 
+- usb-otg-in-supply:
+  Usage: optional
+  Value type: 
+  Description: Reference to the regulator supplying power to the USB_OTG_IN
+   pin.
+
+child nodes:
+- otg:
+  Usage: optional
+  Description: This node defines a regulator used to control the direction
+   of VBUS voltage - specifically: whether to supply voltage
+   to VBUS for host mode operation of the OTG port, or allow
+   input voltage from external VBUS for charging.  In the
+   hardware, the supply for this regulator comes from
+   usb-otg-in-supply.
+
 EXAMPLE
 charger@1000 {
compatible = "qcom,pm8941-charger";
@@ -128,4 +144,7 @@ charger@1000 {
 
qcom,fast-charge-current-limit = <100>;
qcom,dc-charge-current-limit = <100>;
+   usb-otg-in-supply = <_5vs1>;
+
+   otg {};
 };
-- 
2.6.3

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


[PATCH v3 0/3] ARM: power: qcom_smbb: Add otg regulator

2015-12-09 Thread Tim Bird
Add a regulator to control the OTG chargepath switch.

I'm re-sending this (v3) because my v2 submission yesterday failed
to include the AUTHOR OF THE DRIVER(!!), Courtney Cavin.

Changes since v2
 - add the driver author to the To: list!

Changes since v1
 - switch supply name to have dashes instead of underscores
 - remove superfluous DT explanations in the otg node description

Tim Bird (3):
  dt-binding: power: Add otg regulator binding
  power: qcom_smbb: Add otg regulator for control of vbus
  ARM: dts: qcom: add charger otg regulator

 .../devicetree/bindings/power_supply/qcom_smbb.txt | 19 ++
 arch/arm/boot/dts/qcom-pm8941.dtsi |  4 ++
 drivers/power/qcom_smbb.c  | 74 ++
 3 files changed, 97 insertions(+)

-- 
2.6.3

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


[PATCH v3 0/3] ARM: power: qcom_smbb: Add otg regulator

2015-12-09 Thread Tim Bird
Add a regulator to control the OTG chargepath switch.

I'm re-sending this (v3) because my v2 submission yesterday failed
to include the AUTHOR OF THE DRIVER(!!), Courtney Cavin.

Changes since v2
 - add the driver author to the To: list!

Changes since v1
 - switch supply name to have dashes instead of underscores
 - remove superfluous DT explanations in the otg node description

Tim Bird (3):
  dt-binding: power: Add otg regulator binding
  power: qcom_smbb: Add otg regulator for control of vbus
  ARM: dts: qcom: add charger otg regulator

 .../devicetree/bindings/power_supply/qcom_smbb.txt | 19 ++
 arch/arm/boot/dts/qcom-pm8941.dtsi |  4 ++
 drivers/power/qcom_smbb.c  | 74 ++
 3 files changed, 97 insertions(+)

-- 
2.6.3

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


[PATCH v3 2/3] power: qcom_smbb: Add otg regulator for control of vbus

2015-12-09 Thread Tim Bird
Add a regulator to control the OTG chargepath switch.  This
is used by USB code to control VBUS direction - out for host mode
on the OTG port, and in for charging mode.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
Changes since v1:
 - changed name of supply to remove underscores
---
 drivers/power/qcom_smbb.c | 74 +++
 1 file changed, 74 insertions(+)

diff --git a/drivers/power/qcom_smbb.c b/drivers/power/qcom_smbb.c
index 5eb1e9e..2f1394c 100644
--- a/drivers/power/qcom_smbb.c
+++ b/drivers/power/qcom_smbb.c
@@ -34,6 +34,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #define SMBB_CHG_VMAX  0x040
 #define SMBB_CHG_VSAFE 0x041
@@ -71,6 +74,8 @@
 #define BTC_CTRL_HOT_EXT_N BIT(0)
 
 #define SMBB_USB_IMAX  0x344
+#define SMBB_USB_OTG_CTL   0x348
+#define OTG_CTL_EN BIT(0)
 #define SMBB_USB_ENUM_TIMER_STOP 0x34e
 #define ENUM_TIMER_STOPBIT(0)
 #define SMBB_USB_SEC_ACCESS0x3d0
@@ -123,6 +128,9 @@ struct smbb_charger {
struct power_supply *dc_psy;
struct power_supply *bat_psy;
struct regmap *regmap;
+
+   struct regulator_desc otg_rdesc;
+   struct regulator_dev *otg_reg;
 };
 
 static int smbb_vbat_weak_fn(unsigned int index)
@@ -778,12 +786,56 @@ static const struct power_supply_desc dc_psy_desc = {
.property_is_writeable = smbb_charger_writable_property,
 };
 
+static int smbb_chg_otg_enable(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   int rc;
+
+   rc = regmap_update_bits(chg->regmap, chg->addr + SMBB_USB_OTG_CTL,
+   OTG_CTL_EN, OTG_CTL_EN);
+   if (rc)
+   dev_err(chg->dev, "failed to update OTG_CTL\n");
+   return rc;
+}
+
+static int smbb_chg_otg_disable(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   int rc;
+
+   rc = regmap_update_bits(chg->regmap, chg->addr + SMBB_USB_OTG_CTL,
+   OTG_CTL_EN, 0);
+   if (rc)
+   dev_err(chg->dev, "failed to update OTG_CTL\n");
+   return rc;
+}
+
+static int smbb_chg_otg_is_enabled(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   unsigned int value = 0;
+   int rc;
+
+   rc = regmap_read(chg->regmap, chg->addr + SMBB_USB_OTG_CTL, );
+   if (rc)
+   dev_err(chg->dev, "failed to read OTG_CTL\n");
+
+   return !!(value & OTG_CTL_EN);
+}
+
+static struct regulator_ops smbb_chg_otg_ops = {
+   .enable = smbb_chg_otg_enable,
+   .disable = smbb_chg_otg_disable,
+   .is_enabled = smbb_chg_otg_is_enabled,
+};
+
 static int smbb_charger_probe(struct platform_device *pdev)
 {
struct power_supply_config bat_cfg = {};
struct power_supply_config usb_cfg = {};
struct power_supply_config dc_cfg = {};
struct smbb_charger *chg;
+   struct regulator_config config = { };
int rc, i;
 
chg = devm_kzalloc(>dev, sizeof(*chg), GFP_KERNEL);
@@ -884,6 +936,28 @@ static int smbb_charger_probe(struct platform_device *pdev)
}
}
 
+   /*
+* otg regulator is used to control VBUS voltage direction
+* when USB switches between host and gadget mode
+*/
+   chg->otg_rdesc.id = -1;
+   chg->otg_rdesc.name = "otg";
+   chg->otg_rdesc.ops = _chg_otg_ops;
+   chg->otg_rdesc.owner = THIS_MODULE;
+   chg->otg_rdesc.type = REGULATOR_VOLTAGE;
+   chg->otg_rdesc.supply_name = "usb-otg-in";
+   chg->otg_rdesc.fixed_uV = 500;
+   chg->otg_rdesc.n_voltages = 1;
+   chg->otg_rdesc.of_match = "otg";
+
+   config.dev = >dev;
+   config.driver_data = chg;
+
+   chg->otg_reg = devm_regulator_register(>dev, >otg_rdesc,
+  );
+   if (IS_ERR(chg->otg_reg))
+   return PTR_ERR(chg->otg_reg);
+
chg->jeita_ext_temp = of_property_read_bool(pdev->dev.of_node,
"qcom,jeita-extended-temp-range");
 
-- 
2.6.3

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


[PATCH v3 1/3] dt-binding: power: Add otg regulator binding

2015-12-09 Thread Tim Bird
Add a binding for the regulator which controls the OTG chargepath switch.
The OTG switch gets its power from pm8941_5vs1, and that should be
expressed as a usb-otg-in-supply property in the DT node for the
charger driver.  The regulator name is "otg".

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
Changes since v1
 - switch supply name to have dashes instead of underscores
 - remove superfluous DT explanations in the otg node description
---
 .../devicetree/bindings/power_supply/qcom_smbb.txt| 19 +++
 1 file changed, 19 insertions(+)

diff --git a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt 
b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
index 65b88fa..28b6da7 100644
--- a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
+++ b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
@@ -105,6 +105,22 @@ PROPERTIES
regulation must be done externally to fully comply with
the JEITA safety guidelines if this flag is set.
 
+- usb-otg-in-supply:
+  Usage: optional
+  Value type: 
+  Description: Reference to the regulator supplying power to the USB_OTG_IN
+   pin.
+
+child nodes:
+- otg:
+  Usage: optional
+  Description: This node defines a regulator used to control the direction
+   of VBUS voltage - specifically: whether to supply voltage
+   to VBUS for host mode operation of the OTG port, or allow
+   input voltage from external VBUS for charging.  In the
+   hardware, the supply for this regulator comes from
+   usb-otg-in-supply.
+
 EXAMPLE
 charger@1000 {
compatible = "qcom,pm8941-charger";
@@ -128,4 +144,7 @@ charger@1000 {
 
qcom,fast-charge-current-limit = <100>;
qcom,dc-charge-current-limit = <100>;
+   usb-otg-in-supply = <_5vs1>;
+
+   otg {};
 };
-- 
2.6.3

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


[PATCH v3 3/3] ARM: dts: qcom: add charger otg regulator

2015-12-09 Thread Tim Bird
Add the otg regulator provided by the charger block.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
 arch/arm/boot/dts/qcom-pm8941.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-pm8941.dtsi 
b/arch/arm/boot/dts/qcom-pm8941.dtsi
index b0d4439..1b80100 100644
--- a/arch/arm/boot/dts/qcom-pm8941.dtsi
+++ b/arch/arm/boot/dts/qcom-pm8941.dtsi
@@ -45,6 +45,10 @@
  "chg-gone",
  "usb-valid",
  "dc-valid";
+
+   usb-otg-in-supply = <_5vs1>;
+
+   chg_otg: otg { };
};
 
pm8941_gpios: gpios@c000 {
-- 
2.6.3

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


Re: [PATCH v2 1/3] dt-binding: power: Add otg regulator binding

2015-12-09 Thread Tim Bird
On 12/08/2015 08:11 PM, Rob Herring wrote:
> On Tue, Dec 08, 2015 at 04:40:16PM -0800, Tim Bird wrote:
>> Add a binding for the regulator which controls the OTG chargepath switch.
>> The OTG switch gets its power from pm8941_5vs1, and that should be
>> expressed as a usb-otg-in-supply property in the DT node for the
>> charger driver.  The regulator name is "otg".
>>
>> Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
>> ---
>> Changes since v1
>>  - switch supply name to have dashes instead of underscores
>>  - remove superfluous DT explanations in the otg node description
>> ---
>>  .../devicetree/bindings/power_supply/qcom_smbb.txt| 19 
>> +++
>>  1 file changed, 19 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt 
>> b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
>> index 65b88fa..28b6da7 100644
>> --- a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
>> +++ b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
>> @@ -105,6 +105,22 @@ PROPERTIES
>> regulation must be done externally to fully comply with
>> the JEITA safety guidelines if this flag is set.
>>  
>> +- usb-otg-in-supply:
>> +  Usage: optional
>> +  Value type: 
>> +  Description: Reference to the regulator supplying power to the USB_OTG_IN
>> +   pin.
>> +
>> +child nodes:
>> +- otg:
>> +  Usage: optional
>> +  Description: This node defines a regulator used to control the direction
>> +   of VBUS voltage - specifically: whether to supply voltage
>> +   to VBUS for host mode operation of the OTG port, or allow
>> +   input voltage from external VBUS for charging.  In the
>> +   hardware, the supply for this regulator comes from
>> +   usb-otg-in-supply.
> 
> Doesn't this regulator need to have a name defined?

I'm not sure what you mean.  The regulator name is "otg", defined by the DT node
name. The code requires that the DT node name be "otg", and defines a regulator
with the same name.

As far as I know, you have to define a DT label for the node, in order
to reference this regulator with a phandle.  Is that what you are referring to?
I usually use "chg_otg" as the label.  Are you asking that this be reflected
in the example?

> Disabling this regulator (along with other setup) will enable charging?

Yes.  Enabling it allows the device to power the USB VBUS line for host
mode, and disabling it allows power to flow the other way (into the device)
for charging, when the USB port is in gadget mode.
 -- Tim

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


Re: [PATCH v2 1/3] dt-binding: power: Add otg regulator binding

2015-12-09 Thread Tim Bird


On 12/09/2015 06:36 AM, Rob Herring wrote:
> On Wed, Dec 9, 2015 at 6:55 AM, Tim Bird <tim.b...@sonymobile.com> wrote:
>> On 12/08/2015 08:11 PM, Rob Herring wrote:
>>> On Tue, Dec 08, 2015 at 04:40:16PM -0800, Tim Bird wrote:
>>>> Add a binding for the regulator which controls the OTG chargepath switch.
>>>> The OTG switch gets its power from pm8941_5vs1, and that should be
>>>> expressed as a usb-otg-in-supply property in the DT node for the
>>>> charger driver.  The regulator name is "otg".
> 
> [...]
> 
>>>> +child nodes:
>>>> +- otg:
>>>> +  Usage: optional
>>>> +  Description: This node defines a regulator used to control the direction
>>>> +   of VBUS voltage - specifically: whether to supply voltage
>>>> +   to VBUS for host mode operation of the OTG port, or allow
>>>> +   input voltage from external VBUS for charging.  In the
>>>> +   hardware, the supply for this regulator comes from
>>>> +   usb-otg-in-supply.
>>>
>>> Doesn't this regulator need to have a name defined?
>>
>> I'm not sure what you mean.  The regulator name is "otg", defined by the DT 
>> node
>> name. The code requires that the DT node name be "otg", and defines a 
>> regulator
>> with the same name.
>>
>> As far as I know, you have to define a DT label for the node, in order
>> to reference this regulator with a phandle.  Is that what you are referring 
>> to?
>> I usually use "chg_otg" as the label.  Are you asking that this be reflected
>> in the example?
> 
> You need a regulator-name property. Also, should should define valid
> values for regulator-min-microvolt and regulator-max-microvolt.

All of those are listed as optional properties in
Documentation/devicetree/bindings/regulator/regulator.txt.

The regulator-name seems redundant, since the name of the DT
node becomes the regulator name in the Linux system.  This is
not currently used anywhere, as the node is "connected up" via
phandle, which uses the label.  That is, there's no code in
the kernel that looks up this regulator by name, although it
does get a name.

As for the microvolt references, I'm a little stumped what
to do with those.  I could use regulator-min-microvolt of 0
and a regulator-max-microvolt of 50, but that's not
exactly right.

This is actually representing a voltage switch, which is being
represented in the regulator framework in Linux, because it
seems to fit there best.  It has regulators it's related
to, which should be adjusted when this one is.  However, it
intrinsically does not have a voltage of it's own, so it's a
bit of a weird case.  And the voltage can either be going
"out" or "in".

I'm CC-ing Mark Brown, who may know how these types of things
are supposed to be expressed.  I believe he saw an earlier version
of this patch last year.  Or maybe our power maintainers will
chime in with some wisdom.  I can't be the first person to
be adding a charge pathway switch to mainline, so I'm open to
doing it the "right way". :-)

> Thinking about this some more, the node name should be generic, so
> just "regulator". The label does not need to be generic.

There are other switches in the charger block that are not
exposed yet.  This one handles the the OTG (vbus) charge pathway.
Others handle other charge pathways (some of which are used on phones
and some are not - they're used, e.g., on the dragonboard).  I'd
rather not give it a generic name, because eventually the driver
should expose those other switches as something as well.

 -- Tim

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


[PATCH v2 3/3] ARM: dts: qcom: add charger otg regulator

2015-12-08 Thread Tim Bird
Add the otg regulator provided by the charger block.

Signed-off-by: Tim Bird 
---
 arch/arm/boot/dts/qcom-pm8941.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-pm8941.dtsi 
b/arch/arm/boot/dts/qcom-pm8941.dtsi
index b0d4439..1b80100 100644
--- a/arch/arm/boot/dts/qcom-pm8941.dtsi
+++ b/arch/arm/boot/dts/qcom-pm8941.dtsi
@@ -45,6 +45,10 @@
  "chg-gone",
  "usb-valid",
  "dc-valid";
+
+   usb-otg-in-supply = <_5vs1>;
+
+   chg_otg: otg { };
};
 
pm8941_gpios: gpios@c000 {
-- 
2.4.2

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


[PATCH v2 2/3] power: qcom_smbb: Add otg regulator for control of vbus

2015-12-08 Thread Tim Bird
Add a regulator to control the OTG chargepath switch.  This
is used by USB code to control VBUS direction - out for host mode
on the OTG port, and in for charging mode.

Signed-off-by: Tim Bird 
---
Changes since v1:
 - changed name of supply to remove underscores
---
 drivers/power/qcom_smbb.c | 74 +++
 1 file changed, 74 insertions(+)

diff --git a/drivers/power/qcom_smbb.c b/drivers/power/qcom_smbb.c
index 5eb1e9e..2f1394c 100644
--- a/drivers/power/qcom_smbb.c
+++ b/drivers/power/qcom_smbb.c
@@ -34,6 +34,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #define SMBB_CHG_VMAX  0x040
 #define SMBB_CHG_VSAFE 0x041
@@ -71,6 +74,8 @@
 #define BTC_CTRL_HOT_EXT_N BIT(0)
 
 #define SMBB_USB_IMAX  0x344
+#define SMBB_USB_OTG_CTL   0x348
+#define OTG_CTL_EN BIT(0)
 #define SMBB_USB_ENUM_TIMER_STOP 0x34e
 #define ENUM_TIMER_STOPBIT(0)
 #define SMBB_USB_SEC_ACCESS0x3d0
@@ -123,6 +128,9 @@ struct smbb_charger {
struct power_supply *dc_psy;
struct power_supply *bat_psy;
struct regmap *regmap;
+
+   struct regulator_desc otg_rdesc;
+   struct regulator_dev *otg_reg;
 };
 
 static int smbb_vbat_weak_fn(unsigned int index)
@@ -778,12 +786,56 @@ static const struct power_supply_desc dc_psy_desc = {
.property_is_writeable = smbb_charger_writable_property,
 };
 
+static int smbb_chg_otg_enable(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   int rc;
+
+   rc = regmap_update_bits(chg->regmap, chg->addr + SMBB_USB_OTG_CTL,
+   OTG_CTL_EN, OTG_CTL_EN);
+   if (rc)
+   dev_err(chg->dev, "failed to update OTG_CTL\n");
+   return rc;
+}
+
+static int smbb_chg_otg_disable(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   int rc;
+
+   rc = regmap_update_bits(chg->regmap, chg->addr + SMBB_USB_OTG_CTL,
+   OTG_CTL_EN, 0);
+   if (rc)
+   dev_err(chg->dev, "failed to update OTG_CTL\n");
+   return rc;
+}
+
+static int smbb_chg_otg_is_enabled(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   unsigned int value = 0;
+   int rc;
+
+   rc = regmap_read(chg->regmap, chg->addr + SMBB_USB_OTG_CTL, );
+   if (rc)
+   dev_err(chg->dev, "failed to read OTG_CTL\n");
+
+   return !!(value & OTG_CTL_EN);
+}
+
+static struct regulator_ops smbb_chg_otg_ops = {
+   .enable = smbb_chg_otg_enable,
+   .disable = smbb_chg_otg_disable,
+   .is_enabled = smbb_chg_otg_is_enabled,
+};
+
 static int smbb_charger_probe(struct platform_device *pdev)
 {
struct power_supply_config bat_cfg = {};
struct power_supply_config usb_cfg = {};
struct power_supply_config dc_cfg = {};
struct smbb_charger *chg;
+   struct regulator_config config = { };
int rc, i;
 
chg = devm_kzalloc(>dev, sizeof(*chg), GFP_KERNEL);
@@ -884,6 +936,28 @@ static int smbb_charger_probe(struct platform_device *pdev)
}
}
 
+   /*
+* otg regulator is used to control VBUS voltage direction
+* when USB switches between host and gadget mode
+*/
+   chg->otg_rdesc.id = -1;
+   chg->otg_rdesc.name = "otg";
+   chg->otg_rdesc.ops = _chg_otg_ops;
+   chg->otg_rdesc.owner = THIS_MODULE;
+   chg->otg_rdesc.type = REGULATOR_VOLTAGE;
+   chg->otg_rdesc.supply_name = "usb-otg-in";
+   chg->otg_rdesc.fixed_uV = 500;
+   chg->otg_rdesc.n_voltages = 1;
+   chg->otg_rdesc.of_match = "otg";
+
+   config.dev = >dev;
+   config.driver_data = chg;
+
+   chg->otg_reg = devm_regulator_register(>dev, >otg_rdesc,
+  );
+   if (IS_ERR(chg->otg_reg))
+   return PTR_ERR(chg->otg_reg);
+
chg->jeita_ext_temp = of_property_read_bool(pdev->dev.of_node,
"qcom,jeita-extended-temp-range");
 
-- 
2.4.2

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


[PATCH v2 1/3] dt-binding: power: Add otg regulator binding

2015-12-08 Thread Tim Bird
Add a binding for the regulator which controls the OTG chargepath switch.
The OTG switch gets its power from pm8941_5vs1, and that should be
expressed as a usb-otg-in-supply property in the DT node for the
charger driver.  The regulator name is "otg".

Signed-off-by: Tim Bird 
---
Changes since v1
 - switch supply name to have dashes instead of underscores
 - remove superfluous DT explanations in the otg node description
---
 .../devicetree/bindings/power_supply/qcom_smbb.txt| 19 +++
 1 file changed, 19 insertions(+)

diff --git a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt 
b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
index 65b88fa..28b6da7 100644
--- a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
+++ b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
@@ -105,6 +105,22 @@ PROPERTIES
regulation must be done externally to fully comply with
the JEITA safety guidelines if this flag is set.
 
+- usb-otg-in-supply:
+  Usage: optional
+  Value type: 
+  Description: Reference to the regulator supplying power to the USB_OTG_IN
+   pin.
+
+child nodes:
+- otg:
+  Usage: optional
+  Description: This node defines a regulator used to control the direction
+   of VBUS voltage - specifically: whether to supply voltage
+   to VBUS for host mode operation of the OTG port, or allow
+   input voltage from external VBUS for charging.  In the
+   hardware, the supply for this regulator comes from
+   usb-otg-in-supply.
+
 EXAMPLE
 charger@1000 {
compatible = "qcom,pm8941-charger";
@@ -128,4 +144,7 @@ charger@1000 {
 
qcom,fast-charge-current-limit = <100>;
qcom,dc-charge-current-limit = <100>;
+   usb-otg-in-supply = <_5vs1>;
+
+   otg {};
 };
-- 
2.4.2

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


Re: [PATCH] power: qcom_smbb: Add otg regulator for control of vbus

2015-12-08 Thread Tim Bird


On 12/05/2015 08:07 AM, Sebastian Reichel wrote:
> Hi Tim,
> 
> On Thu, Oct 22, 2015 at 02:12:17PM -0700, Tim Bird wrote:
>> Add a regulator to control the OTG chargepath switch.  The OTG
>> switch gets its power from pm8941_5vs1, and that should be expressed
>> as an usb_otg_in-supply property in the DT node for the charger driver.
>> The regulator name is "otg".  This is used by USB code to control VBUS
>> direction.
> 
> I could not find a newer version of this patch with the comments
> from Mark being fixed. Did I miss anything?
No.  I thought I had sent out the follow-up for this, but
apparently I did not.  I'm re-testing it now, and plan to
send it out today.

Sorry about that.  I got sidetracked in the last month on some
other USB issues (not the host side, which is what requires
this patch).
 -- Tim

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


Re: [PATCH] power: qcom_smbb: Add otg regulator for control of vbus

2015-12-08 Thread Tim Bird


On 12/05/2015 08:07 AM, Sebastian Reichel wrote:
> Hi Tim,
> 
> On Thu, Oct 22, 2015 at 02:12:17PM -0700, Tim Bird wrote:
>> Add a regulator to control the OTG chargepath switch.  The OTG
>> switch gets its power from pm8941_5vs1, and that should be expressed
>> as an usb_otg_in-supply property in the DT node for the charger driver.
>> The regulator name is "otg".  This is used by USB code to control VBUS
>> direction.
> 
> I could not find a newer version of this patch with the comments
> from Mark being fixed. Did I miss anything?
No.  I thought I had sent out the follow-up for this, but
apparently I did not.  I'm re-testing it now, and plan to
send it out today.

Sorry about that.  I got sidetracked in the last month on some
other USB issues (not the host side, which is what requires
this patch).
 -- Tim

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


[PATCH v2 2/3] power: qcom_smbb: Add otg regulator for control of vbus

2015-12-08 Thread Tim Bird
Add a regulator to control the OTG chargepath switch.  This
is used by USB code to control VBUS direction - out for host mode
on the OTG port, and in for charging mode.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
Changes since v1:
 - changed name of supply to remove underscores
---
 drivers/power/qcom_smbb.c | 74 +++
 1 file changed, 74 insertions(+)

diff --git a/drivers/power/qcom_smbb.c b/drivers/power/qcom_smbb.c
index 5eb1e9e..2f1394c 100644
--- a/drivers/power/qcom_smbb.c
+++ b/drivers/power/qcom_smbb.c
@@ -34,6 +34,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #define SMBB_CHG_VMAX  0x040
 #define SMBB_CHG_VSAFE 0x041
@@ -71,6 +74,8 @@
 #define BTC_CTRL_HOT_EXT_N BIT(0)
 
 #define SMBB_USB_IMAX  0x344
+#define SMBB_USB_OTG_CTL   0x348
+#define OTG_CTL_EN BIT(0)
 #define SMBB_USB_ENUM_TIMER_STOP 0x34e
 #define ENUM_TIMER_STOPBIT(0)
 #define SMBB_USB_SEC_ACCESS0x3d0
@@ -123,6 +128,9 @@ struct smbb_charger {
struct power_supply *dc_psy;
struct power_supply *bat_psy;
struct regmap *regmap;
+
+   struct regulator_desc otg_rdesc;
+   struct regulator_dev *otg_reg;
 };
 
 static int smbb_vbat_weak_fn(unsigned int index)
@@ -778,12 +786,56 @@ static const struct power_supply_desc dc_psy_desc = {
.property_is_writeable = smbb_charger_writable_property,
 };
 
+static int smbb_chg_otg_enable(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   int rc;
+
+   rc = regmap_update_bits(chg->regmap, chg->addr + SMBB_USB_OTG_CTL,
+   OTG_CTL_EN, OTG_CTL_EN);
+   if (rc)
+   dev_err(chg->dev, "failed to update OTG_CTL\n");
+   return rc;
+}
+
+static int smbb_chg_otg_disable(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   int rc;
+
+   rc = regmap_update_bits(chg->regmap, chg->addr + SMBB_USB_OTG_CTL,
+   OTG_CTL_EN, 0);
+   if (rc)
+   dev_err(chg->dev, "failed to update OTG_CTL\n");
+   return rc;
+}
+
+static int smbb_chg_otg_is_enabled(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   unsigned int value = 0;
+   int rc;
+
+   rc = regmap_read(chg->regmap, chg->addr + SMBB_USB_OTG_CTL, );
+   if (rc)
+   dev_err(chg->dev, "failed to read OTG_CTL\n");
+
+   return !!(value & OTG_CTL_EN);
+}
+
+static struct regulator_ops smbb_chg_otg_ops = {
+   .enable = smbb_chg_otg_enable,
+   .disable = smbb_chg_otg_disable,
+   .is_enabled = smbb_chg_otg_is_enabled,
+};
+
 static int smbb_charger_probe(struct platform_device *pdev)
 {
struct power_supply_config bat_cfg = {};
struct power_supply_config usb_cfg = {};
struct power_supply_config dc_cfg = {};
struct smbb_charger *chg;
+   struct regulator_config config = { };
int rc, i;
 
chg = devm_kzalloc(>dev, sizeof(*chg), GFP_KERNEL);
@@ -884,6 +936,28 @@ static int smbb_charger_probe(struct platform_device *pdev)
}
}
 
+   /*
+* otg regulator is used to control VBUS voltage direction
+* when USB switches between host and gadget mode
+*/
+   chg->otg_rdesc.id = -1;
+   chg->otg_rdesc.name = "otg";
+   chg->otg_rdesc.ops = _chg_otg_ops;
+   chg->otg_rdesc.owner = THIS_MODULE;
+   chg->otg_rdesc.type = REGULATOR_VOLTAGE;
+   chg->otg_rdesc.supply_name = "usb-otg-in";
+   chg->otg_rdesc.fixed_uV = 500;
+   chg->otg_rdesc.n_voltages = 1;
+   chg->otg_rdesc.of_match = "otg";
+
+   config.dev = >dev;
+   config.driver_data = chg;
+
+   chg->otg_reg = devm_regulator_register(>dev, >otg_rdesc,
+  );
+   if (IS_ERR(chg->otg_reg))
+   return PTR_ERR(chg->otg_reg);
+
chg->jeita_ext_temp = of_property_read_bool(pdev->dev.of_node,
"qcom,jeita-extended-temp-range");
 
-- 
2.4.2

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


[PATCH v2 1/3] dt-binding: power: Add otg regulator binding

2015-12-08 Thread Tim Bird
Add a binding for the regulator which controls the OTG chargepath switch.
The OTG switch gets its power from pm8941_5vs1, and that should be
expressed as a usb-otg-in-supply property in the DT node for the
charger driver.  The regulator name is "otg".

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
Changes since v1
 - switch supply name to have dashes instead of underscores
 - remove superfluous DT explanations in the otg node description
---
 .../devicetree/bindings/power_supply/qcom_smbb.txt| 19 +++
 1 file changed, 19 insertions(+)

diff --git a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt 
b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
index 65b88fa..28b6da7 100644
--- a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
+++ b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
@@ -105,6 +105,22 @@ PROPERTIES
regulation must be done externally to fully comply with
the JEITA safety guidelines if this flag is set.
 
+- usb-otg-in-supply:
+  Usage: optional
+  Value type: 
+  Description: Reference to the regulator supplying power to the USB_OTG_IN
+   pin.
+
+child nodes:
+- otg:
+  Usage: optional
+  Description: This node defines a regulator used to control the direction
+   of VBUS voltage - specifically: whether to supply voltage
+   to VBUS for host mode operation of the OTG port, or allow
+   input voltage from external VBUS for charging.  In the
+   hardware, the supply for this regulator comes from
+   usb-otg-in-supply.
+
 EXAMPLE
 charger@1000 {
compatible = "qcom,pm8941-charger";
@@ -128,4 +144,7 @@ charger@1000 {
 
qcom,fast-charge-current-limit = <100>;
qcom,dc-charge-current-limit = <100>;
+   usb-otg-in-supply = <_5vs1>;
+
+   otg {};
 };
-- 
2.4.2

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


[PATCH v2 3/3] ARM: dts: qcom: add charger otg regulator

2015-12-08 Thread Tim Bird
Add the otg regulator provided by the charger block.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
 arch/arm/boot/dts/qcom-pm8941.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-pm8941.dtsi 
b/arch/arm/boot/dts/qcom-pm8941.dtsi
index b0d4439..1b80100 100644
--- a/arch/arm/boot/dts/qcom-pm8941.dtsi
+++ b/arch/arm/boot/dts/qcom-pm8941.dtsi
@@ -45,6 +45,10 @@
  "chg-gone",
  "usb-valid",
  "dc-valid";
+
+   usb-otg-in-supply = <_5vs1>;
+
+   chg_otg: otg { };
};
 
pm8941_gpios: gpios@c000 {
-- 
2.4.2

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


Re: [PATCH v4 3/3] usb: chipidea: register driver as a peripheral with the phy

2015-11-23 Thread Tim Bird


On 11/23/2015 12:29 AM, Peter Chen wrote:
> On Fri, Nov 20, 2015 at 03:47:20PM -0800, Tim Bird wrote:
>> Register the chipidea driver with the phy, so that the phy
>> driver can kick the gadget driver when it resumes from low power.
>> The phy-msm-usb (Qualcomm) driver requires this in order to
>> recover gadget operation after you disconnect the USB cable
>> and reconnect it.
>>
>> Signed-off-by: Tim Bird 
>> ---
>>  drivers/usb/chipidea/udc.c | 6 ++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
>> index 8223fe7..06234cd 100644
>> --- a/drivers/usb/chipidea/udc.c
>> +++ b/drivers/usb/chipidea/udc.c
>> @@ -1890,6 +1890,12 @@ static int udc_start(struct ci_hdrc *ci)
>>  
>>  ci->gadget.ep0 = >ep0in->ep;
>>  
>> +if (ci->usb_phy) {
>> +retval = otg_set_peripheral(ci->usb_phy->otg, >gadget);
>> +if (retval)
>> +goto destroy_eps;
>> +}
>> +
>>  retval = usb_add_gadget_udc(dev, >gadget);
>>  if (retval)
>>  goto destroy_eps;
> 
> Hi Tim,
> 
> I am afraid it can't work for current chipidea framework (find this
> problem after testing), the chipidea core manages its host and device
> function using its own API start/stop, it does not define struct usb_otg
> APIs. In fact, it is not reasonable control host and device function
> at PHY driver.

OK.  I'm going to re-evaluate the phy-msm-usb.c code, and try to figure out
what it should look like under the current framework.

Thanks for looking at it and testing it.  I may have questions as I go.
 -- Tim

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


Re: [PATCH v4 3/3] usb: chipidea: register driver as a peripheral with the phy

2015-11-23 Thread Tim Bird


On 11/23/2015 12:29 AM, Peter Chen wrote:
> On Fri, Nov 20, 2015 at 03:47:20PM -0800, Tim Bird wrote:
>> Register the chipidea driver with the phy, so that the phy
>> driver can kick the gadget driver when it resumes from low power.
>> The phy-msm-usb (Qualcomm) driver requires this in order to
>> recover gadget operation after you disconnect the USB cable
>> and reconnect it.
>>
>> Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
>> ---
>>  drivers/usb/chipidea/udc.c | 6 ++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
>> index 8223fe7..06234cd 100644
>> --- a/drivers/usb/chipidea/udc.c
>> +++ b/drivers/usb/chipidea/udc.c
>> @@ -1890,6 +1890,12 @@ static int udc_start(struct ci_hdrc *ci)
>>  
>>  ci->gadget.ep0 = >ep0in->ep;
>>  
>> +if (ci->usb_phy) {
>> +retval = otg_set_peripheral(ci->usb_phy->otg, >gadget);
>> +if (retval)
>> +goto destroy_eps;
>> +}
>> +
>>  retval = usb_add_gadget_udc(dev, >gadget);
>>  if (retval)
>>  goto destroy_eps;
> 
> Hi Tim,
> 
> I am afraid it can't work for current chipidea framework (find this
> problem after testing), the chipidea core manages its host and device
> function using its own API start/stop, it does not define struct usb_otg
> APIs. In fact, it is not reasonable control host and device function
> at PHY driver.

OK.  I'm going to re-evaluate the phy-msm-usb.c code, and try to figure out
what it should look like under the current framework.

Thanks for looking at it and testing it.  I may have questions as I go.
 -- Tim

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


[PATCH v4 3/3] usb: chipidea: register driver as a peripheral with the phy

2015-11-20 Thread Tim Bird
Register the chipidea driver with the phy, so that the phy
driver can kick the gadget driver when it resumes from low power.
The phy-msm-usb (Qualcomm) driver requires this in order to
recover gadget operation after you disconnect the USB cable
and reconnect it.

Signed-off-by: Tim Bird 
---
 drivers/usb/chipidea/udc.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 8223fe7..06234cd 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1890,6 +1890,12 @@ static int udc_start(struct ci_hdrc *ci)
 
ci->gadget.ep0 = >ep0in->ep;
 
+   if (ci->usb_phy) {
+   retval = otg_set_peripheral(ci->usb_phy->otg, >gadget);
+   if (retval)
+   goto destroy_eps;
+   }
+
retval = usb_add_gadget_udc(dev, >gadget);
if (retval)
goto destroy_eps;
-- 
1.8.2.2

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


[PATCH v4 2/3] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port

2015-11-20 Thread Tim Bird
Add support for async_irq to wake up driver from low power mode.
Without this, the power management code never calls resume.
Remove a spurious interrupt enable in the driver resume function.

Signed-off-by: Tim Bird 
---
 drivers/usb/phy/phy-msm-usb.c | 17 -
 include/linux/usb/msm_hsusb.h |  1 +
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index e40a071..04fb056 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -648,7 +648,6 @@ skip_phy_resume:
if (motg->async_int) {
motg->async_int = 0;
pm_runtime_put(phy->dev);
-   enable_irq(motg->irq);
}
 
dev_info(phy->dev, "USB exited from low power mode\n");
@@ -1732,6 +1731,12 @@ static int msm_otg_probe(struct platform_device *pdev)
return motg->irq;
}
 
+   motg->async_irq = platform_get_irq_byname(pdev, "async");
+   if (motg->async_irq < 0) {
+   dev_err(>dev, "platform_get_irq for async irq failed\n");
+   motg->async_irq = 0;
+   }
+
regs[0].supply = "vddcx";
regs[1].supply = "v3p3";
regs[2].supply = "v1p8";
@@ -1781,6 +1786,16 @@ static int msm_otg_probe(struct platform_device *pdev)
goto disable_ldo;
}
 
+   if (motg->async_irq) {
+   ret = devm_request_irq(>dev, motg->async_irq,
+ msm_otg_irq, IRQF_TRIGGER_RISING,
+ "msm_otg", motg);
+   if (ret) {
+   dev_err(>dev, "request irq failed (ASYNC INT)\n");
+   goto disable_ldo;
+   }
+   }
+
phy->init = msm_phy_init;
phy->set_power = msm_otg_set_power;
phy->notify_disconnect = msm_phy_notify_disconnect;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 8c8f685..08c67a3 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -164,6 +164,7 @@ struct msm_otg {
struct usb_phy phy;
struct msm_otg_platform_data *pdata;
int irq;
+   int async_irq;
struct clk *clk;
struct clk *pclk;
struct clk *core_clk;
-- 
1.8.2.2

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


[PATCH v4 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb

2015-11-20 Thread Tim Bird
Add optional async_irq to msm_hsusb binding doc.

Signed-off-by: Tim Bird 
---
 Documentation/devicetree/bindings/usb/msm-hsusb.txt | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt 
b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
index 8654a3e..2d13c1c 100644
--- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
+++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
@@ -23,7 +23,12 @@ Required properties:
   "qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY
 
 - regs: Offset and length of the register set in the memory map
-- interrupts:   interrupt-specifier for the OTG interrupt.
+- interrupts:   interrupt-specifier for the OTG interrupts
+
+- interrupt-names: Should contain the following:
+  "core"USB core interrupt
+  "async"   Asynchronous interrupt to wake up from low power mode
+(optional)
 
 - clocks:   A list of phandle + clock-specifier pairs for the
 clocks listed in clock-names
@@ -89,7 +94,8 @@ Example HSUSB OTG controller device node:
 usb@f9a55000 {
 compatible = "qcom,usb-otg-snps";
 reg = <0xf9a55000 0x400>;
-interrupts = <0 134 0>;
+interrupts = <0 134 0>, <0 140 0>;
+interrupt-names = "core", "async";
 dr_mode = "peripheral";
 
 clocks = < GCC_XO_CLK>, < GCC_USB_HS_SYSTEM_CLK>,
-- 
1.8.2.2

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


Re: [PATCH v3 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb

2015-11-20 Thread Tim Bird


On 11/20/2015 03:22 PM, Arnd Bergmann wrote:
> On Friday 20 November 2015 15:20:39 Tim Bird wrote:
>> +- interrupt-names: Should contain the following:
>> +  "core"USB core interrupt
>> +  "async"   Asynchronous interrupt to wake up from low power mode
>> +(optional)
>>  
>>  - clocks:   A list of phandle + clock-specifier pairs for the
>>  clocks listed in clock-names
>> @@ -89,7 +94,8 @@ Example HSUSB OTG controller device node:
>>  usb@f9a55000 {
>>  compatible = "qcom,usb-otg-snps";
>>  reg = <0xf9a55000 0x400>;
>> -interrupts = <0 134 0>;
>> +interrupts = <0 134 0>, <0 140 0>;
>> +interrupt-names = "core_irq", "async_irq";
>>  dr_mode = "peripheral";
>>  
>>
> 
> Now the example doesn't match the documentation any more.
Arrgh.  I'm an idiot.  V4 coming RSN.
 -- Tim

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


[PATCH v3 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb

2015-11-20 Thread Tim Bird
Add optional async_irq to msm_hsusb binding doc.

Signed-off-by: Tim Bird 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/usb/msm-hsusb.txt | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt 
b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
index 8654a3e..bb2b304 100644
--- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
+++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
@@ -23,7 +23,12 @@ Required properties:
   "qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY
 
 - regs: Offset and length of the register set in the memory map
-- interrupts:   interrupt-specifier for the OTG interrupt.
+- interrupts:   interrupt-specifier for the OTG interrupts
+
+- interrupt-names: Should contain the following:
+  "core"USB core interrupt
+  "async"   Asynchronous interrupt to wake up from low power mode
+(optional)
 
 - clocks:   A list of phandle + clock-specifier pairs for the
 clocks listed in clock-names
@@ -89,7 +94,8 @@ Example HSUSB OTG controller device node:
 usb@f9a55000 {
 compatible = "qcom,usb-otg-snps";
 reg = <0xf9a55000 0x400>;
-interrupts = <0 134 0>;
+interrupts = <0 134 0>, <0 140 0>;
+interrupt-names = "core_irq", "async_irq";
 dr_mode = "peripheral";
 
 clocks = < GCC_XO_CLK>, < GCC_USB_HS_SYSTEM_CLK>,
-- 
1.8.2.2

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


Re: [PATCH v3 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb

2015-11-20 Thread Tim Bird


On 11/20/2015 03:20 PM, Tim Bird wrote:
> Add optional async_irq to msm_hsusb binding doc.
> 
> Signed-off-by: Tim Bird 
> Acked-by: Rob Herring 

I probably should have taken this Acked-by by Rob off.  Sorry about that.
  -- Tim

> ---
>  Documentation/devicetree/bindings/usb/msm-hsusb.txt | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt 
> b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
> index 8654a3e..bb2b304 100644
> --- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
> +++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
> @@ -23,7 +23,12 @@ Required properties:
>"qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY
>  
>  - regs: Offset and length of the register set in the memory map
> -- interrupts:   interrupt-specifier for the OTG interrupt.
> +- interrupts:   interrupt-specifier for the OTG interrupts
> +
> +- interrupt-names: Should contain the following:
> +  "core"USB core interrupt
> +  "async"   Asynchronous interrupt to wake up from low power mode
> +(optional)
>  
>  - clocks:   A list of phandle + clock-specifier pairs for the
>  clocks listed in clock-names
> @@ -89,7 +94,8 @@ Example HSUSB OTG controller device node:
>  usb@f9a55000 {
>  compatible = "qcom,usb-otg-snps";
>  reg = <0xf9a55000 0x400>;
> -interrupts = <0 134 0>;
> +interrupts = <0 134 0>, <0 140 0>;
> +interrupt-names = "core_irq", "async_irq";
>  dr_mode = "peripheral";
>  
>  clocks = < GCC_XO_CLK>, < GCC_USB_HS_SYSTEM_CLK>,
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 2/3] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port

2015-11-20 Thread Tim Bird
Add support for async_irq to wake up driver from low power mode.
Without this, the power management code never calls resume.
Remove a spurious interrupt enable in the driver resume function.

Signed-off-by: Tim Bird 
---
 drivers/usb/phy/phy-msm-usb.c | 17 -
 include/linux/usb/msm_hsusb.h |  1 +
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index e40a071..04fb056 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -648,7 +648,6 @@ skip_phy_resume:
if (motg->async_int) {
motg->async_int = 0;
pm_runtime_put(phy->dev);
-   enable_irq(motg->irq);
}
 
dev_info(phy->dev, "USB exited from low power mode\n");
@@ -1732,6 +1731,12 @@ static int msm_otg_probe(struct platform_device *pdev)
return motg->irq;
}
 
+   motg->async_irq = platform_get_irq_byname(pdev, "async");
+   if (motg->async_irq < 0) {
+   dev_err(>dev, "platform_get_irq for async irq failed\n");
+   motg->async_irq = 0;
+   }
+
regs[0].supply = "vddcx";
regs[1].supply = "v3p3";
regs[2].supply = "v1p8";
@@ -1781,6 +1786,16 @@ static int msm_otg_probe(struct platform_device *pdev)
goto disable_ldo;
}
 
+   if (motg->async_irq) {
+   ret = devm_request_irq(>dev, motg->async_irq,
+ msm_otg_irq, IRQF_TRIGGER_RISING,
+ "msm_otg", motg);
+   if (ret) {
+   dev_err(>dev, "request irq failed (ASYNC INT)\n");
+   goto disable_ldo;
+   }
+   }
+
phy->init = msm_phy_init;
phy->set_power = msm_otg_set_power;
phy->notify_disconnect = msm_phy_notify_disconnect;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 8c8f685..08c67a3 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -164,6 +164,7 @@ struct msm_otg {
struct usb_phy phy;
struct msm_otg_platform_data *pdata;
int irq;
+   int async_irq;
struct clk *clk;
struct clk *pclk;
struct clk *core_clk;
-- 
1.8.2.2

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


[PATCH v3 3/3] usb: chipidea: register driver as a peripheral with the phy

2015-11-20 Thread Tim Bird
Register the chipidea driver with the phy, so that the phy
driver can kick the gadget driver when it resumes from low power.
The phy-msm-usb (Qualcomm) driver requires this in order to
recover gadget operation after you disconnect the USB cable
and reconnect it.

Signed-off-by: Tim Bird 
---
 drivers/usb/chipidea/udc.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 8223fe7..06234cd 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1890,6 +1890,12 @@ static int udc_start(struct ci_hdrc *ci)
 
ci->gadget.ep0 = >ep0in->ep;
 
+   if (ci->usb_phy) {
+   retval = otg_set_peripheral(ci->usb_phy->otg, >gadget);
+   if (retval)
+   goto destroy_eps;
+   }
+
retval = usb_add_gadget_udc(dev, >gadget);
if (retval)
goto destroy_eps;
-- 
1.8.2.2

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


Re: [PATCH v2 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb

2015-11-20 Thread Tim Bird


On 11/20/2015 02:44 PM, Arnd Bergmann wrote:
> On Friday 20 November 2015 14:37:16 Tim Bird wrote:
>> +- interrupt-names: Should contain the following:
>> +  "core_irq"USB core interrupt
>> +  "async_irq"   Asynchronous interrupt to wake up from low power mode
>> +(optional)
>>  
>>
> 
> Sorry for the bike-shedding but how about just naming them "core" and "async"?
> 
> The redundant "_irq" postfix seems a little redundant.
OK - look for v3 RSN(tm)  (Real Soon Now)
 -- Tim

P.S. This is a cynical ploy to get me to automate my patch release process, 
isn't it? :-)

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


[PATCH v2 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb

2015-11-20 Thread Tim Bird
Add optional async_irq to msm_hsusb binding doc.

Signed-off-by: Tim Bird 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/usb/msm-hsusb.txt | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt 
b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
index 8654a3e..7ba1dff 100644
--- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
+++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
@@ -23,7 +23,12 @@ Required properties:
   "qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY
 
 - regs: Offset and length of the register set in the memory map
-- interrupts:   interrupt-specifier for the OTG interrupt.
+- interrupts:   interrupt-specifier for the OTG interrupts
+
+- interrupt-names: Should contain the following:
+  "core_irq"USB core interrupt
+  "async_irq"   Asynchronous interrupt to wake up from low power mode
+(optional)
 
 - clocks:   A list of phandle + clock-specifier pairs for the
 clocks listed in clock-names
@@ -89,7 +94,8 @@ Example HSUSB OTG controller device node:
 usb@f9a55000 {
 compatible = "qcom,usb-otg-snps";
 reg = <0xf9a55000 0x400>;
-interrupts = <0 134 0>;
+interrupts = <0 134 0>, <0 140 0>;
+interrupt-names = "core_irq", "async_irq";
 dr_mode = "peripheral";
 
 clocks = < GCC_XO_CLK>, < GCC_USB_HS_SYSTEM_CLK>,
-- 
1.8.2.2

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


[PATCH v2 3/3] usb: chipidea: register driver as a peripheral with the phy

2015-11-20 Thread Tim Bird
Register the chipidea driver with the phy, so that the phy
driver can kick the gadget driver when it resumes from low power.
The phy-msm-usb (Qualcomm) driver requires this in order to
recover gadget operation after you disconnect the USB cable
and reconnect it.

Signed-off-by: Tim Bird 
---
 drivers/usb/chipidea/udc.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 8223fe7..06234cd 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1890,6 +1890,12 @@ static int udc_start(struct ci_hdrc *ci)
 
ci->gadget.ep0 = >ep0in->ep;
 
+   if (ci->usb_phy) {
+   retval = otg_set_peripheral(ci->usb_phy->otg, >gadget);
+   if (retval)
+   goto destroy_eps;
+   }
+
retval = usb_add_gadget_udc(dev, >gadget);
if (retval)
goto destroy_eps;
-- 
1.8.2.2

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


[PATCH v2 2/3] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port

2015-11-20 Thread Tim Bird
Add support for async_irq to wake up driver from low power mode.
Without this, the power management code never calls resume.
Remove a spurious interrupt enable in the driver resume function.

Signed-off-by: Tim Bird 
---
 drivers/usb/phy/phy-msm-usb.c | 17 -
 include/linux/usb/msm_hsusb.h |  1 +
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index e40a071..db6297c 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -648,7 +648,6 @@ skip_phy_resume:
if (motg->async_int) {
motg->async_int = 0;
pm_runtime_put(phy->dev);
-   enable_irq(motg->irq);
}
 
dev_info(phy->dev, "USB exited from low power mode\n");
@@ -1732,6 +1731,12 @@ static int msm_otg_probe(struct platform_device *pdev)
return motg->irq;
}
 
+   motg->async_irq = platform_get_irq_byname(pdev, "async_irq");
+   if (motg->async_irq < 0) {
+   dev_err(>dev, "platform_get_irq for async_irq failed\n");
+   motg->async_irq = 0;
+   }
+
regs[0].supply = "vddcx";
regs[1].supply = "v3p3";
regs[2].supply = "v1p8";
@@ -1781,6 +1786,16 @@ static int msm_otg_probe(struct platform_device *pdev)
goto disable_ldo;
}
 
+   if (motg->async_irq) {
+   ret = devm_request_irq(>dev, motg->async_irq,
+ msm_otg_irq, IRQF_TRIGGER_RISING,
+ "msm_otg", motg);
+   if (ret) {
+   dev_err(>dev, "request irq failed (ASYNC INT)\n");
+   goto disable_ldo;
+   }
+   }
+
phy->init = msm_phy_init;
phy->set_power = msm_otg_set_power;
phy->notify_disconnect = msm_phy_notify_disconnect;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 8c8f685..08c67a3 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -164,6 +164,7 @@ struct msm_otg {
struct usb_phy phy;
struct msm_otg_platform_data *pdata;
int irq;
+   int async_irq;
struct clk *clk;
struct clk *pclk;
struct clk *core_clk;
-- 
1.8.2.2

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


Re: [PATCH 2/2] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port

2015-11-20 Thread Tim Bird


On 11/16/2015 09:21 AM, Felipe Balbi wrote:
> 
> Hi,
> 
> Peter Chen  writes:
>> On Wed, Nov 11, 2015 at 09:48:00AM -0800, Tim Bird wrote:
>>>
>>>
>>> On 11/10/2015 07:14 PM, Peter Chen wrote:
>>>> On Tue, Nov 10, 2015 at 04:46:51PM -0800, Tim Bird wrote:
>>>>> This fixes a bug where if you disconnect and re-connect the USB cable,
>>>>> the gadget driver stops working.
>>>>>
>>>>> Add support for async_irq to wake up driver from low power mode.
>>>>> Without this, the power management code never calls resume.
>>>>> Also, have the phy driver kick the gadget driver (chipidea otg)
>>>>> by having the chipidea driver register with it, for vbus connect
>>>>> notifications.
>>>>>
>>>>> Signed-off-by: Tim Bird 
>>>>> ---
>>>>>  drivers/usb/chipidea/udc.c|  6 ++
>>>>>  drivers/usb/phy/phy-msm-usb.c | 16 
>>>>>  include/linux/usb/msm_hsusb.h |  1 +
>>>>>  3 files changed, 23 insertions(+)
> 
> I just wanna know how you guys want this to be handled ? Through my tree
> or chipidea's ? Or do we break the dependencies between the changes ?

I'm fine with splitting it up.  I'm sending a new series with 3 patches
right after this message.  Do both trees go to linux-next?
 -- Tim

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


[PATCH v4 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb

2015-11-20 Thread Tim Bird
Add optional async_irq to msm_hsusb binding doc.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
 Documentation/devicetree/bindings/usb/msm-hsusb.txt | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt 
b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
index 8654a3e..2d13c1c 100644
--- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
+++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
@@ -23,7 +23,12 @@ Required properties:
   "qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY
 
 - regs: Offset and length of the register set in the memory map
-- interrupts:   interrupt-specifier for the OTG interrupt.
+- interrupts:   interrupt-specifier for the OTG interrupts
+
+- interrupt-names: Should contain the following:
+  "core"USB core interrupt
+  "async"   Asynchronous interrupt to wake up from low power mode
+(optional)
 
 - clocks:   A list of phandle + clock-specifier pairs for the
 clocks listed in clock-names
@@ -89,7 +94,8 @@ Example HSUSB OTG controller device node:
 usb@f9a55000 {
 compatible = "qcom,usb-otg-snps";
 reg = <0xf9a55000 0x400>;
-interrupts = <0 134 0>;
+interrupts = <0 134 0>, <0 140 0>;
+interrupt-names = "core", "async";
 dr_mode = "peripheral";
 
 clocks = < GCC_XO_CLK>, < GCC_USB_HS_SYSTEM_CLK>,
-- 
1.8.2.2

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


[PATCH v4 2/3] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port

2015-11-20 Thread Tim Bird
Add support for async_irq to wake up driver from low power mode.
Without this, the power management code never calls resume.
Remove a spurious interrupt enable in the driver resume function.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
 drivers/usb/phy/phy-msm-usb.c | 17 -
 include/linux/usb/msm_hsusb.h |  1 +
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index e40a071..04fb056 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -648,7 +648,6 @@ skip_phy_resume:
if (motg->async_int) {
motg->async_int = 0;
pm_runtime_put(phy->dev);
-   enable_irq(motg->irq);
}
 
dev_info(phy->dev, "USB exited from low power mode\n");
@@ -1732,6 +1731,12 @@ static int msm_otg_probe(struct platform_device *pdev)
return motg->irq;
}
 
+   motg->async_irq = platform_get_irq_byname(pdev, "async");
+   if (motg->async_irq < 0) {
+   dev_err(>dev, "platform_get_irq for async irq failed\n");
+   motg->async_irq = 0;
+   }
+
regs[0].supply = "vddcx";
regs[1].supply = "v3p3";
regs[2].supply = "v1p8";
@@ -1781,6 +1786,16 @@ static int msm_otg_probe(struct platform_device *pdev)
goto disable_ldo;
}
 
+   if (motg->async_irq) {
+   ret = devm_request_irq(>dev, motg->async_irq,
+ msm_otg_irq, IRQF_TRIGGER_RISING,
+ "msm_otg", motg);
+   if (ret) {
+   dev_err(>dev, "request irq failed (ASYNC INT)\n");
+   goto disable_ldo;
+   }
+   }
+
phy->init = msm_phy_init;
phy->set_power = msm_otg_set_power;
phy->notify_disconnect = msm_phy_notify_disconnect;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 8c8f685..08c67a3 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -164,6 +164,7 @@ struct msm_otg {
struct usb_phy phy;
struct msm_otg_platform_data *pdata;
int irq;
+   int async_irq;
struct clk *clk;
struct clk *pclk;
struct clk *core_clk;
-- 
1.8.2.2

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


[PATCH v4 3/3] usb: chipidea: register driver as a peripheral with the phy

2015-11-20 Thread Tim Bird
Register the chipidea driver with the phy, so that the phy
driver can kick the gadget driver when it resumes from low power.
The phy-msm-usb (Qualcomm) driver requires this in order to
recover gadget operation after you disconnect the USB cable
and reconnect it.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
 drivers/usb/chipidea/udc.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 8223fe7..06234cd 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1890,6 +1890,12 @@ static int udc_start(struct ci_hdrc *ci)
 
ci->gadget.ep0 = >ep0in->ep;
 
+   if (ci->usb_phy) {
+   retval = otg_set_peripheral(ci->usb_phy->otg, >gadget);
+   if (retval)
+   goto destroy_eps;
+   }
+
retval = usb_add_gadget_udc(dev, >gadget);
if (retval)
goto destroy_eps;
-- 
1.8.2.2

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


[PATCH v2 3/3] usb: chipidea: register driver as a peripheral with the phy

2015-11-20 Thread Tim Bird
Register the chipidea driver with the phy, so that the phy
driver can kick the gadget driver when it resumes from low power.
The phy-msm-usb (Qualcomm) driver requires this in order to
recover gadget operation after you disconnect the USB cable
and reconnect it.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
 drivers/usb/chipidea/udc.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 8223fe7..06234cd 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1890,6 +1890,12 @@ static int udc_start(struct ci_hdrc *ci)
 
ci->gadget.ep0 = >ep0in->ep;
 
+   if (ci->usb_phy) {
+   retval = otg_set_peripheral(ci->usb_phy->otg, >gadget);
+   if (retval)
+   goto destroy_eps;
+   }
+
retval = usb_add_gadget_udc(dev, >gadget);
if (retval)
goto destroy_eps;
-- 
1.8.2.2

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


[PATCH v2 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb

2015-11-20 Thread Tim Bird
Add optional async_irq to msm_hsusb binding doc.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
Acked-by: Rob Herring <r...@kernel.org>
---
 Documentation/devicetree/bindings/usb/msm-hsusb.txt | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt 
b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
index 8654a3e..7ba1dff 100644
--- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
+++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
@@ -23,7 +23,12 @@ Required properties:
   "qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY
 
 - regs: Offset and length of the register set in the memory map
-- interrupts:   interrupt-specifier for the OTG interrupt.
+- interrupts:   interrupt-specifier for the OTG interrupts
+
+- interrupt-names: Should contain the following:
+  "core_irq"USB core interrupt
+  "async_irq"   Asynchronous interrupt to wake up from low power mode
+(optional)
 
 - clocks:   A list of phandle + clock-specifier pairs for the
 clocks listed in clock-names
@@ -89,7 +94,8 @@ Example HSUSB OTG controller device node:
 usb@f9a55000 {
 compatible = "qcom,usb-otg-snps";
 reg = <0xf9a55000 0x400>;
-interrupts = <0 134 0>;
+interrupts = <0 134 0>, <0 140 0>;
+interrupt-names = "core_irq", "async_irq";
 dr_mode = "peripheral";
 
 clocks = < GCC_XO_CLK>, < GCC_USB_HS_SYSTEM_CLK>,
-- 
1.8.2.2

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


[PATCH v2 2/3] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port

2015-11-20 Thread Tim Bird
Add support for async_irq to wake up driver from low power mode.
Without this, the power management code never calls resume.
Remove a spurious interrupt enable in the driver resume function.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
 drivers/usb/phy/phy-msm-usb.c | 17 -
 include/linux/usb/msm_hsusb.h |  1 +
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index e40a071..db6297c 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -648,7 +648,6 @@ skip_phy_resume:
if (motg->async_int) {
motg->async_int = 0;
pm_runtime_put(phy->dev);
-   enable_irq(motg->irq);
}
 
dev_info(phy->dev, "USB exited from low power mode\n");
@@ -1732,6 +1731,12 @@ static int msm_otg_probe(struct platform_device *pdev)
return motg->irq;
}
 
+   motg->async_irq = platform_get_irq_byname(pdev, "async_irq");
+   if (motg->async_irq < 0) {
+   dev_err(>dev, "platform_get_irq for async_irq failed\n");
+   motg->async_irq = 0;
+   }
+
regs[0].supply = "vddcx";
regs[1].supply = "v3p3";
regs[2].supply = "v1p8";
@@ -1781,6 +1786,16 @@ static int msm_otg_probe(struct platform_device *pdev)
goto disable_ldo;
}
 
+   if (motg->async_irq) {
+   ret = devm_request_irq(>dev, motg->async_irq,
+ msm_otg_irq, IRQF_TRIGGER_RISING,
+ "msm_otg", motg);
+   if (ret) {
+   dev_err(>dev, "request irq failed (ASYNC INT)\n");
+   goto disable_ldo;
+   }
+   }
+
phy->init = msm_phy_init;
phy->set_power = msm_otg_set_power;
phy->notify_disconnect = msm_phy_notify_disconnect;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 8c8f685..08c67a3 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -164,6 +164,7 @@ struct msm_otg {
struct usb_phy phy;
struct msm_otg_platform_data *pdata;
int irq;
+   int async_irq;
struct clk *clk;
struct clk *pclk;
struct clk *core_clk;
-- 
1.8.2.2

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


Re: [PATCH v3 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb

2015-11-20 Thread Tim Bird


On 11/20/2015 03:22 PM, Arnd Bergmann wrote:
> On Friday 20 November 2015 15:20:39 Tim Bird wrote:
>> +- interrupt-names: Should contain the following:
>> +  "core"USB core interrupt
>> +  "async"   Asynchronous interrupt to wake up from low power mode
>> +(optional)
>>  
>>  - clocks:   A list of phandle + clock-specifier pairs for the
>>  clocks listed in clock-names
>> @@ -89,7 +94,8 @@ Example HSUSB OTG controller device node:
>>  usb@f9a55000 {
>>  compatible = "qcom,usb-otg-snps";
>>  reg = <0xf9a55000 0x400>;
>> -interrupts = <0 134 0>;
>> +interrupts = <0 134 0>, <0 140 0>;
>> +interrupt-names = "core_irq", "async_irq";
>>  dr_mode = "peripheral";
>>  
>>
> 
> Now the example doesn't match the documentation any more.
Arrgh.  I'm an idiot.  V4 coming RSN.
 -- Tim

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


[PATCH v3 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb

2015-11-20 Thread Tim Bird
Add optional async_irq to msm_hsusb binding doc.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
Acked-by: Rob Herring <r...@kernel.org>
---
 Documentation/devicetree/bindings/usb/msm-hsusb.txt | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt 
b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
index 8654a3e..bb2b304 100644
--- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
+++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
@@ -23,7 +23,12 @@ Required properties:
   "qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY
 
 - regs: Offset and length of the register set in the memory map
-- interrupts:   interrupt-specifier for the OTG interrupt.
+- interrupts:   interrupt-specifier for the OTG interrupts
+
+- interrupt-names: Should contain the following:
+  "core"USB core interrupt
+  "async"   Asynchronous interrupt to wake up from low power mode
+(optional)
 
 - clocks:   A list of phandle + clock-specifier pairs for the
 clocks listed in clock-names
@@ -89,7 +94,8 @@ Example HSUSB OTG controller device node:
 usb@f9a55000 {
 compatible = "qcom,usb-otg-snps";
 reg = <0xf9a55000 0x400>;
-interrupts = <0 134 0>;
+interrupts = <0 134 0>, <0 140 0>;
+interrupt-names = "core_irq", "async_irq";
 dr_mode = "peripheral";
 
 clocks = < GCC_XO_CLK>, < GCC_USB_HS_SYSTEM_CLK>,
-- 
1.8.2.2

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


Re: [PATCH 2/2] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port

2015-11-20 Thread Tim Bird


On 11/16/2015 09:21 AM, Felipe Balbi wrote:
> 
> Hi,
> 
> Peter Chen <peter.c...@freescale.com> writes:
>> On Wed, Nov 11, 2015 at 09:48:00AM -0800, Tim Bird wrote:
>>>
>>>
>>> On 11/10/2015 07:14 PM, Peter Chen wrote:
>>>> On Tue, Nov 10, 2015 at 04:46:51PM -0800, Tim Bird wrote:
>>>>> This fixes a bug where if you disconnect and re-connect the USB cable,
>>>>> the gadget driver stops working.
>>>>>
>>>>> Add support for async_irq to wake up driver from low power mode.
>>>>> Without this, the power management code never calls resume.
>>>>> Also, have the phy driver kick the gadget driver (chipidea otg)
>>>>> by having the chipidea driver register with it, for vbus connect
>>>>> notifications.
>>>>>
>>>>> Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
>>>>> ---
>>>>>  drivers/usb/chipidea/udc.c|  6 ++
>>>>>  drivers/usb/phy/phy-msm-usb.c | 16 
>>>>>  include/linux/usb/msm_hsusb.h |  1 +
>>>>>  3 files changed, 23 insertions(+)
> 
> I just wanna know how you guys want this to be handled ? Through my tree
> or chipidea's ? Or do we break the dependencies between the changes ?

I'm fine with splitting it up.  I'm sending a new series with 3 patches
right after this message.  Do both trees go to linux-next?
 -- Tim

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


Re: [PATCH v2 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb

2015-11-20 Thread Tim Bird


On 11/20/2015 02:44 PM, Arnd Bergmann wrote:
> On Friday 20 November 2015 14:37:16 Tim Bird wrote:
>> +- interrupt-names: Should contain the following:
>> +  "core_irq"USB core interrupt
>> +  "async_irq"   Asynchronous interrupt to wake up from low power mode
>> +(optional)
>>  
>>
> 
> Sorry for the bike-shedding but how about just naming them "core" and "async"?
> 
> The redundant "_irq" postfix seems a little redundant.
OK - look for v3 RSN(tm)  (Real Soon Now)
 -- Tim

P.S. This is a cynical ploy to get me to automate my patch release process, 
isn't it? :-)

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


[PATCH v3 3/3] usb: chipidea: register driver as a peripheral with the phy

2015-11-20 Thread Tim Bird
Register the chipidea driver with the phy, so that the phy
driver can kick the gadget driver when it resumes from low power.
The phy-msm-usb (Qualcomm) driver requires this in order to
recover gadget operation after you disconnect the USB cable
and reconnect it.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
 drivers/usb/chipidea/udc.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 8223fe7..06234cd 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1890,6 +1890,12 @@ static int udc_start(struct ci_hdrc *ci)
 
ci->gadget.ep0 = >ep0in->ep;
 
+   if (ci->usb_phy) {
+   retval = otg_set_peripheral(ci->usb_phy->otg, >gadget);
+   if (retval)
+   goto destroy_eps;
+   }
+
retval = usb_add_gadget_udc(dev, >gadget);
if (retval)
goto destroy_eps;
-- 
1.8.2.2

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


Re: [PATCH v3 1/3] Documentation: dt-bindings: add async_irq to msm_hsusb

2015-11-20 Thread Tim Bird


On 11/20/2015 03:20 PM, Tim Bird wrote:
> Add optional async_irq to msm_hsusb binding doc.
> 
> Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
> Acked-by: Rob Herring <r...@kernel.org>

I probably should have taken this Acked-by by Rob off.  Sorry about that.
  -- Tim

> ---
>  Documentation/devicetree/bindings/usb/msm-hsusb.txt | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt 
> b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
> index 8654a3e..bb2b304 100644
> --- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
> +++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
> @@ -23,7 +23,12 @@ Required properties:
>"qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY
>  
>  - regs: Offset and length of the register set in the memory map
> -- interrupts:   interrupt-specifier for the OTG interrupt.
> +- interrupts:   interrupt-specifier for the OTG interrupts
> +
> +- interrupt-names: Should contain the following:
> +  "core"USB core interrupt
> +  "async"   Asynchronous interrupt to wake up from low power mode
> +(optional)
>  
>  - clocks:   A list of phandle + clock-specifier pairs for the
>  clocks listed in clock-names
> @@ -89,7 +94,8 @@ Example HSUSB OTG controller device node:
>  usb@f9a55000 {
>  compatible = "qcom,usb-otg-snps";
>  reg = <0xf9a55000 0x400>;
> -interrupts = <0 134 0>;
> +interrupts = <0 134 0>, <0 140 0>;
> +interrupt-names = "core_irq", "async_irq";
>  dr_mode = "peripheral";
>  
>  clocks = < GCC_XO_CLK>, < GCC_USB_HS_SYSTEM_CLK>,
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 2/3] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port

2015-11-20 Thread Tim Bird
Add support for async_irq to wake up driver from low power mode.
Without this, the power management code never calls resume.
Remove a spurious interrupt enable in the driver resume function.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
 drivers/usb/phy/phy-msm-usb.c | 17 -
 include/linux/usb/msm_hsusb.h |  1 +
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index e40a071..04fb056 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -648,7 +648,6 @@ skip_phy_resume:
if (motg->async_int) {
motg->async_int = 0;
pm_runtime_put(phy->dev);
-   enable_irq(motg->irq);
}
 
dev_info(phy->dev, "USB exited from low power mode\n");
@@ -1732,6 +1731,12 @@ static int msm_otg_probe(struct platform_device *pdev)
return motg->irq;
}
 
+   motg->async_irq = platform_get_irq_byname(pdev, "async");
+   if (motg->async_irq < 0) {
+   dev_err(>dev, "platform_get_irq for async irq failed\n");
+   motg->async_irq = 0;
+   }
+
regs[0].supply = "vddcx";
regs[1].supply = "v3p3";
regs[2].supply = "v1p8";
@@ -1781,6 +1786,16 @@ static int msm_otg_probe(struct platform_device *pdev)
goto disable_ldo;
}
 
+   if (motg->async_irq) {
+   ret = devm_request_irq(>dev, motg->async_irq,
+ msm_otg_irq, IRQF_TRIGGER_RISING,
+ "msm_otg", motg);
+   if (ret) {
+   dev_err(>dev, "request irq failed (ASYNC INT)\n");
+   goto disable_ldo;
+   }
+   }
+
phy->init = msm_phy_init;
phy->set_power = msm_otg_set_power;
phy->notify_disconnect = msm_phy_notify_disconnect;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 8c8f685..08c67a3 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -164,6 +164,7 @@ struct msm_otg {
struct usb_phy phy;
struct msm_otg_platform_data *pdata;
int irq;
+   int async_irq;
struct clk *clk;
struct clk *pclk;
struct clk *core_clk;
-- 
1.8.2.2

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


Re: [PATCH 2/2] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port

2015-11-11 Thread Tim Bird


On 11/10/2015 07:14 PM, Peter Chen wrote:
> On Tue, Nov 10, 2015 at 04:46:51PM -0800, Tim Bird wrote:
>> This fixes a bug where if you disconnect and re-connect the USB cable,
>> the gadget driver stops working.
>>
>> Add support for async_irq to wake up driver from low power mode.
>> Without this, the power management code never calls resume.
>> Also, have the phy driver kick the gadget driver (chipidea otg)
>> by having the chipidea driver register with it, for vbus connect
>> notifications.
>>
>> Signed-off-by: Tim Bird 
>> ---
>>  drivers/usb/chipidea/udc.c|  6 ++
>>  drivers/usb/phy/phy-msm-usb.c | 16 
>>  include/linux/usb/msm_hsusb.h |  1 +
>>  3 files changed, 23 insertions(+)
>>
>> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
>> index 8223fe7..06234cd 100644
>> --- a/drivers/usb/chipidea/udc.c
>> +++ b/drivers/usb/chipidea/udc.c
>> @@ -1890,6 +1890,12 @@ static int udc_start(struct ci_hdrc *ci)
>>  
>>  ci->gadget.ep0 = >ep0in->ep;
>>  
>> +if (ci->usb_phy) {
>> +retval = otg_set_peripheral(ci->usb_phy->otg, >gadget);
>> +if (retval)
>> +goto destroy_eps;
>> +}
>> +
>>  retval = usb_add_gadget_udc(dev, >gadget);
>>  if (retval)
>>  goto destroy_eps;
> 
> Although it looks no affect for other drivers, it is better you
> can split patches between controller and phy, then I can have a test.

OK.

> In fact, most of phy-msm-usb.c's implementations (except USB PHY related)
> are included in chipidea drivers, hope you can try it in future.

I would like to do this.  I'm pretty confused about the relationship between
ehci, chipidea and the phy code, with regard to managing the controller
hardware.  Is there a phy in mainline that is a good example of having most
of the controller support in the chipidea driver rather than in the phy?

Thanks!
 
>> diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
>> index 80eb991..eb80f92 100644
>> --- a/drivers/usb/phy/phy-msm-usb.c
>> +++ b/drivers/usb/phy/phy-msm-usb.c
>> @@ -1731,6 +1731,12 @@ static int msm_otg_probe(struct platform_device *pdev)
>>  return motg->irq;
>>  }
>>  
>> +motg->async_irq = platform_get_irq_byname(pdev, "async_irq");
>> +if (motg->async_irq < 0) {
>> +dev_info(>dev, "platform_get_irq for async_irq failed\n");
>> +motg->async_irq = 0;
>> +}
>> +
> 
> dev_err

OK - I'll change this.  I've listed the async_irq as optional in the binding 
doc,
so I don't actually error out, but I was unsure the appropriate error level for
this message.

Thanks for the feedback!
 -- Tim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port

2015-11-11 Thread Tim Bird


On 11/10/2015 07:14 PM, Peter Chen wrote:
> On Tue, Nov 10, 2015 at 04:46:51PM -0800, Tim Bird wrote:
>> This fixes a bug where if you disconnect and re-connect the USB cable,
>> the gadget driver stops working.
>>
>> Add support for async_irq to wake up driver from low power mode.
>> Without this, the power management code never calls resume.
>> Also, have the phy driver kick the gadget driver (chipidea otg)
>> by having the chipidea driver register with it, for vbus connect
>> notifications.
>>
>> Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
>> ---
>>  drivers/usb/chipidea/udc.c|  6 ++
>>  drivers/usb/phy/phy-msm-usb.c | 16 
>>  include/linux/usb/msm_hsusb.h |  1 +
>>  3 files changed, 23 insertions(+)
>>
>> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
>> index 8223fe7..06234cd 100644
>> --- a/drivers/usb/chipidea/udc.c
>> +++ b/drivers/usb/chipidea/udc.c
>> @@ -1890,6 +1890,12 @@ static int udc_start(struct ci_hdrc *ci)
>>  
>>  ci->gadget.ep0 = >ep0in->ep;
>>  
>> +if (ci->usb_phy) {
>> +retval = otg_set_peripheral(ci->usb_phy->otg, >gadget);
>> +if (retval)
>> +goto destroy_eps;
>> +}
>> +
>>  retval = usb_add_gadget_udc(dev, >gadget);
>>  if (retval)
>>  goto destroy_eps;
> 
> Although it looks no affect for other drivers, it is better you
> can split patches between controller and phy, then I can have a test.

OK.

> In fact, most of phy-msm-usb.c's implementations (except USB PHY related)
> are included in chipidea drivers, hope you can try it in future.

I would like to do this.  I'm pretty confused about the relationship between
ehci, chipidea and the phy code, with regard to managing the controller
hardware.  Is there a phy in mainline that is a good example of having most
of the controller support in the chipidea driver rather than in the phy?

Thanks!
 
>> diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
>> index 80eb991..eb80f92 100644
>> --- a/drivers/usb/phy/phy-msm-usb.c
>> +++ b/drivers/usb/phy/phy-msm-usb.c
>> @@ -1731,6 +1731,12 @@ static int msm_otg_probe(struct platform_device *pdev)
>>  return motg->irq;
>>  }
>>  
>> +motg->async_irq = platform_get_irq_byname(pdev, "async_irq");
>> +if (motg->async_irq < 0) {
>> +dev_info(>dev, "platform_get_irq for async_irq failed\n");
>> +motg->async_irq = 0;
>> +}
>> +
> 
> dev_err

OK - I'll change this.  I've listed the async_irq as optional in the binding 
doc,
so I don't actually error out, but I was unsure the appropriate error level for
this message.

Thanks for the feedback!
 -- Tim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] Documentation: dt-bindings: add async_irq to msm_hsusb

2015-11-10 Thread Tim Bird
Add optional async_irq to msm_hsusb binding doc.

Signed-off-by: Tim Bird 
---
 Documentation/devicetree/bindings/usb/msm-hsusb.txt | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt 
b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
index 8654a3e..7ba1dff 100644
--- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
+++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
@@ -23,7 +23,12 @@ Required properties:
   "qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY
 
 - regs: Offset and length of the register set in the memory map
-- interrupts:   interrupt-specifier for the OTG interrupt.
+- interrupts:   interrupt-specifier for the OTG interrupts
+
+- interrupt-names: Should contain the following:
+  "core_irq"USB core interrupt
+  "async_irq"   Asynchronous interrupt to wake up from low power mode
+(optional)
 
 - clocks:   A list of phandle + clock-specifier pairs for the
 clocks listed in clock-names
@@ -89,7 +94,8 @@ Example HSUSB OTG controller device node:
 usb@f9a55000 {
 compatible = "qcom,usb-otg-snps";
 reg = <0xf9a55000 0x400>;
-interrupts = <0 134 0>;
+interrupts = <0 134 0>, <0 140 0>;
+interrupt-names = "core_irq", "async_irq";
 dr_mode = "peripheral";
 
 clocks = < GCC_XO_CLK>, < GCC_USB_HS_SYSTEM_CLK>,
-- 
1.8.2.2

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


[PATCH 2/2] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port

2015-11-10 Thread Tim Bird
This fixes a bug where if you disconnect and re-connect the USB cable,
the gadget driver stops working.

Add support for async_irq to wake up driver from low power mode.
Without this, the power management code never calls resume.
Also, have the phy driver kick the gadget driver (chipidea otg)
by having the chipidea driver register with it, for vbus connect
notifications.

Signed-off-by: Tim Bird 
---
 drivers/usb/chipidea/udc.c|  6 ++
 drivers/usb/phy/phy-msm-usb.c | 16 
 include/linux/usb/msm_hsusb.h |  1 +
 3 files changed, 23 insertions(+)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 8223fe7..06234cd 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1890,6 +1890,12 @@ static int udc_start(struct ci_hdrc *ci)
 
ci->gadget.ep0 = >ep0in->ep;
 
+   if (ci->usb_phy) {
+   retval = otg_set_peripheral(ci->usb_phy->otg, >gadget);
+   if (retval)
+   goto destroy_eps;
+   }
+
retval = usb_add_gadget_udc(dev, >gadget);
if (retval)
goto destroy_eps;
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 80eb991..eb80f92 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1731,6 +1731,12 @@ static int msm_otg_probe(struct platform_device *pdev)
return motg->irq;
}
 
+   motg->async_irq = platform_get_irq_byname(pdev, "async_irq");
+   if (motg->async_irq < 0) {
+   dev_info(>dev, "platform_get_irq for async_irq failed\n");
+   motg->async_irq = 0;
+   }
+
regs[0].supply = "vddcx";
regs[1].supply = "v3p3";
regs[2].supply = "v1p8";
@@ -1780,6 +1786,16 @@ static int msm_otg_probe(struct platform_device *pdev)
goto disable_ldo;
}
 
+   if (motg->async_irq) {
+   ret = devm_request_irq(>dev, motg->async_irq,
+ msm_otg_irq, IRQF_TRIGGER_RISING,
+ "msm_otg", motg);
+   if (ret) {
+   dev_err(>dev, "request irq failed (ASYNC INT)\n");
+   goto disable_ldo;
+   }
+   }
+
phy->init = msm_phy_init;
phy->set_power = msm_otg_set_power;
phy->notify_disconnect = msm_phy_notify_disconnect;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 8c8f685..08c67a3 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -164,6 +164,7 @@ struct msm_otg {
struct usb_phy phy;
struct msm_otg_platform_data *pdata;
int irq;
+   int async_irq;
struct clk *clk;
struct clk *pclk;
struct clk *core_clk;
-- 
1.8.2.2

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


[PATCH 1/2] Documentation: dt-bindings: add async_irq to msm_hsusb

2015-11-10 Thread Tim Bird
Add optional async_irq to msm_hsusb binding doc.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
 Documentation/devicetree/bindings/usb/msm-hsusb.txt | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt 
b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
index 8654a3e..7ba1dff 100644
--- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
+++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
@@ -23,7 +23,12 @@ Required properties:
   "qcom,usb-otg-snps" for chipsets with Synopsys 28nm PHY
 
 - regs: Offset and length of the register set in the memory map
-- interrupts:   interrupt-specifier for the OTG interrupt.
+- interrupts:   interrupt-specifier for the OTG interrupts
+
+- interrupt-names: Should contain the following:
+  "core_irq"USB core interrupt
+  "async_irq"   Asynchronous interrupt to wake up from low power mode
+(optional)
 
 - clocks:   A list of phandle + clock-specifier pairs for the
 clocks listed in clock-names
@@ -89,7 +94,8 @@ Example HSUSB OTG controller device node:
 usb@f9a55000 {
 compatible = "qcom,usb-otg-snps";
 reg = <0xf9a55000 0x400>;
-interrupts = <0 134 0>;
+interrupts = <0 134 0>, <0 140 0>;
+interrupt-names = "core_irq", "async_irq";
 dr_mode = "peripheral";
 
 clocks = < GCC_XO_CLK>, < GCC_USB_HS_SYSTEM_CLK>,
-- 
1.8.2.2

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


[PATCH 2/2] usb: phy: msm: fix connect/disconnect bug for dragonboard OTG port

2015-11-10 Thread Tim Bird
This fixes a bug where if you disconnect and re-connect the USB cable,
the gadget driver stops working.

Add support for async_irq to wake up driver from low power mode.
Without this, the power management code never calls resume.
Also, have the phy driver kick the gadget driver (chipidea otg)
by having the chipidea driver register with it, for vbus connect
notifications.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
 drivers/usb/chipidea/udc.c|  6 ++
 drivers/usb/phy/phy-msm-usb.c | 16 
 include/linux/usb/msm_hsusb.h |  1 +
 3 files changed, 23 insertions(+)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 8223fe7..06234cd 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1890,6 +1890,12 @@ static int udc_start(struct ci_hdrc *ci)
 
ci->gadget.ep0 = >ep0in->ep;
 
+   if (ci->usb_phy) {
+   retval = otg_set_peripheral(ci->usb_phy->otg, >gadget);
+   if (retval)
+   goto destroy_eps;
+   }
+
retval = usb_add_gadget_udc(dev, >gadget);
if (retval)
goto destroy_eps;
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 80eb991..eb80f92 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -1731,6 +1731,12 @@ static int msm_otg_probe(struct platform_device *pdev)
return motg->irq;
}
 
+   motg->async_irq = platform_get_irq_byname(pdev, "async_irq");
+   if (motg->async_irq < 0) {
+   dev_info(>dev, "platform_get_irq for async_irq failed\n");
+   motg->async_irq = 0;
+   }
+
regs[0].supply = "vddcx";
regs[1].supply = "v3p3";
regs[2].supply = "v1p8";
@@ -1780,6 +1786,16 @@ static int msm_otg_probe(struct platform_device *pdev)
goto disable_ldo;
}
 
+   if (motg->async_irq) {
+   ret = devm_request_irq(>dev, motg->async_irq,
+ msm_otg_irq, IRQF_TRIGGER_RISING,
+ "msm_otg", motg);
+   if (ret) {
+   dev_err(>dev, "request irq failed (ASYNC INT)\n");
+   goto disable_ldo;
+   }
+   }
+
phy->init = msm_phy_init;
phy->set_power = msm_otg_set_power;
phy->notify_disconnect = msm_phy_notify_disconnect;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 8c8f685..08c67a3 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -164,6 +164,7 @@ struct msm_otg {
struct usb_phy phy;
struct msm_otg_platform_data *pdata;
int irq;
+   int async_irq;
struct clk *clk;
struct clk *pclk;
struct clk *core_clk;
-- 
1.8.2.2

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


Re: [GIT PULL] On-demand device probing

2015-10-23 Thread Tim Bird
On 10/22/2015 11:53 AM, Frank Rowand wrote:
> On 10/22/2015 7:44 AM, Greg Kroah-Hartman wrote:
>> 
>>
>> On Thu, Oct 22, 2015 at 11:05:11AM +0200, Tomeu Vizoso wrote:
>>> But that's moot currently because Greg believes that the time spent
>>> probing devices at boot time could be reduced enough so that the order
>>> in which devices are probed becomes irrelevant. IME that would have to
>>> be under 200ms so that the user doesn't notice and that's unicorn-far
>>> from any bootlog I have ever seen.
>>
>> But as no one has actually produced a bootlog, how do you know that?
>> Where exactly is your time being spent?  What driver is causing long
>> delays?  Why is the long-delay-drivers not being done in their own
>> thread?  And most importantly, why are you ignoring the work that people
>> did back in 2008 to solve the issue on other hardware platforms?
>>
>>> Given that downstreams are already carrying as many hacks as they
>>> could think of to speed total boot up, I think this is effectively
>>> telling them to go away.
>>
>> No I'm not, I'm asking for real data, not hand-wavy-this-is-going-to
>> solve-the-random-issue-i'm-having type patch by putting random calls in
>> semi-random subsystems all over the kernel.
>>
>> And when I ask for real data, you respond with the fact that you aren't
>> trying to speed up boot time here at all, so what am I supposed to think
> 
> I also had the understanding that this patch series was about improving
> boot time.  But I was kindly corrected that the behavior change was
> getting the panel displaying stuff at an earlier point in the boot sequence,
> _not_ completing the entire boot faster. 
> 
> The claim for the current series, in patch 0 in v7 is:
> 
>With this series I get the kernel to output to the panel in 0.5s,
>instead of 2.8s.

It's very common to want to get the display up before the
rest of the system.  So wanting to accelerate one part of the boot
at the expense to the rest of the system is a valid use case.
Deferred initcalls, which is out of tree primarily because it requires
the type of manual tweaking that Tomeu describes, specifically
addressed this issue.
> 
> Just to get side-tracked, one other approach at ordering to reduce
> deferrals reported a modest boot time reduction for four boards and a
> very slight boot time increase for one other board.) The report of boot
> times with that approach was in:
> 
>   http://article.gmane.org/gmane.linux.drivers.devicetree/133010
> 
> from Alexander Holler.
> 
> I have not searched further to see if there is more data of boot time
> reductions from any of the other attempts to change driver binding
> order to move dependencies before use of a resource.  But whether
> there is a performance improvement or not, there continues to be
> a stream of developers creatively impacting the binding order for
> their specific driver(s) or board.  So it seems that maybe there
> is an underlying problem, or we don't have adequate documentation
> explaining how to avoid a need to order bindings, or the
> documentation exists and is not being read.

Well, I have probe order problems unrelated to boot time, that
I solved by resorting to putting stuff into modules and loading
them post-boot.  So I'd be interested in easy solutions to managing
boot order in mainline.

> 
> I have been defaulting to the position that has been asserted by
> the device tree maintainters, that probe deferrals work just fine
> for at least the majority of cases (and is the message I have been
> sharing in my conference presentations about device tree).  But I
> suspect that there is at least a small minority of cases that are not
> well served by probe deferral.  (Not to be read as an endorsement of
> this specific patch series, just a generic observation.)

I've been worried about DT overhead adding to boot time for a while.
And IMHO probe deferral is just about the lamest way to solve boot
order dependencies I can imagine, from a computer science perspective.
(Well, there's a certain elegance to it, but it's a stupid "make
everything re-doable, back up and start over, time-wasting" elegance.)

However, when Android takes 35 seconds to boot, and most people almost never
cold-boot your product, a few seconds of kernel time-wasting on
cold-boot seem less important. Alas, when I started working on mobile
phones I stopped caring much about boot time.

Thus, I've never worried about the DT overhead enough to actually
measure it, as requested by Greg.  So I'll just shut up now. :-)
 -- Tim
  
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] On-demand device probing

2015-10-23 Thread Tim Bird
On 10/22/2015 11:53 AM, Frank Rowand wrote:
> On 10/22/2015 7:44 AM, Greg Kroah-Hartman wrote:
>> 
>>
>> On Thu, Oct 22, 2015 at 11:05:11AM +0200, Tomeu Vizoso wrote:
>>> But that's moot currently because Greg believes that the time spent
>>> probing devices at boot time could be reduced enough so that the order
>>> in which devices are probed becomes irrelevant. IME that would have to
>>> be under 200ms so that the user doesn't notice and that's unicorn-far
>>> from any bootlog I have ever seen.
>>
>> But as no one has actually produced a bootlog, how do you know that?
>> Where exactly is your time being spent?  What driver is causing long
>> delays?  Why is the long-delay-drivers not being done in their own
>> thread?  And most importantly, why are you ignoring the work that people
>> did back in 2008 to solve the issue on other hardware platforms?
>>
>>> Given that downstreams are already carrying as many hacks as they
>>> could think of to speed total boot up, I think this is effectively
>>> telling them to go away.
>>
>> No I'm not, I'm asking for real data, not hand-wavy-this-is-going-to
>> solve-the-random-issue-i'm-having type patch by putting random calls in
>> semi-random subsystems all over the kernel.
>>
>> And when I ask for real data, you respond with the fact that you aren't
>> trying to speed up boot time here at all, so what am I supposed to think
> 
> I also had the understanding that this patch series was about improving
> boot time.  But I was kindly corrected that the behavior change was
> getting the panel displaying stuff at an earlier point in the boot sequence,
> _not_ completing the entire boot faster. 
> 
> The claim for the current series, in patch 0 in v7 is:
> 
>With this series I get the kernel to output to the panel in 0.5s,
>instead of 2.8s.

It's very common to want to get the display up before the
rest of the system.  So wanting to accelerate one part of the boot
at the expense to the rest of the system is a valid use case.
Deferred initcalls, which is out of tree primarily because it requires
the type of manual tweaking that Tomeu describes, specifically
addressed this issue.
> 
> Just to get side-tracked, one other approach at ordering to reduce
> deferrals reported a modest boot time reduction for four boards and a
> very slight boot time increase for one other board.) The report of boot
> times with that approach was in:
> 
>   http://article.gmane.org/gmane.linux.drivers.devicetree/133010
> 
> from Alexander Holler.
> 
> I have not searched further to see if there is more data of boot time
> reductions from any of the other attempts to change driver binding
> order to move dependencies before use of a resource.  But whether
> there is a performance improvement or not, there continues to be
> a stream of developers creatively impacting the binding order for
> their specific driver(s) or board.  So it seems that maybe there
> is an underlying problem, or we don't have adequate documentation
> explaining how to avoid a need to order bindings, or the
> documentation exists and is not being read.

Well, I have probe order problems unrelated to boot time, that
I solved by resorting to putting stuff into modules and loading
them post-boot.  So I'd be interested in easy solutions to managing
boot order in mainline.

> 
> I have been defaulting to the position that has been asserted by
> the device tree maintainters, that probe deferrals work just fine
> for at least the majority of cases (and is the message I have been
> sharing in my conference presentations about device tree).  But I
> suspect that there is at least a small minority of cases that are not
> well served by probe deferral.  (Not to be read as an endorsement of
> this specific patch series, just a generic observation.)

I've been worried about DT overhead adding to boot time for a while.
And IMHO probe deferral is just about the lamest way to solve boot
order dependencies I can imagine, from a computer science perspective.
(Well, there's a certain elegance to it, but it's a stupid "make
everything re-doable, back up and start over, time-wasting" elegance.)

However, when Android takes 35 seconds to boot, and most people almost never
cold-boot your product, a few seconds of kernel time-wasting on
cold-boot seem less important. Alas, when I started working on mobile
phones I stopped caring much about boot time.

Thus, I've never worried about the DT overhead enough to actually
measure it, as requested by Greg.  So I'll just shut up now. :-)
 -- Tim
  
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] power: qcom_smbb: Add otg regulator for control of vbus

2015-10-22 Thread Tim Bird
Add a regulator to control the OTG chargepath switch.  The OTG
switch gets its power from pm8941_5vs1, and that should be expressed
as an usb_otg_in-supply property in the DT node for the charger driver.
The regulator name is "otg".  This is used by USB code to control VBUS
direction.

Signed-off-by: Tim Bird 
---
 .../devicetree/bindings/power_supply/qcom_smbb.txt | 20 ++
 drivers/power/qcom_smbb.c  | 74 ++
 2 files changed, 94 insertions(+)

diff --git a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt 
b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
index 65b88fa..dc0f91d 100644
--- a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
+++ b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
@@ -105,6 +105,23 @@ PROPERTIES
regulation must be done externally to fully comply with
the JEITA safety guidelines if this flag is set.
 
+- usb_otg_in-supply:
+  Usage: optional
+  Value type: 
+  Description: Reference to the regulator supplying power to the USB_OTG_IN
+   pin.
+
+child nodes:
+- otg:
+  Usage: optional
+  Description: This node is used to define a regulator which is used by
+   other parts of the system to control the direction of VBUS
+   voltage - specifically: whether to supply voltage to VBUS for
+   host mode operation of the OTG port. The driver registers a
+   regulator with this name, which can be looked up by string.
+   Alternatively, you can add a DT label, which can then be
+   referenced by phandle.
+
 EXAMPLE
 charger@1000 {
compatible = "qcom,pm8941-charger";
@@ -128,4 +145,7 @@ charger@1000 {
 
qcom,fast-charge-current-limit = <100>;
qcom,dc-charge-current-limit = <100>;
+   usb_otg_in-supply = <_5vs1>;
+
+   otg {};
 };
diff --git a/drivers/power/qcom_smbb.c b/drivers/power/qcom_smbb.c
index 0dabfe8..fa2983a 100644
--- a/drivers/power/qcom_smbb.c
+++ b/drivers/power/qcom_smbb.c
@@ -34,6 +34,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #define SMBB_CHG_VMAX  0x040
 #define SMBB_CHG_VSAFE 0x041
@@ -71,6 +74,8 @@
 #define BTC_CTRL_HOT_EXT_N BIT(0)
 
 #define SMBB_USB_IMAX  0x344
+#define SMBB_USB_OTG_CTL   0x348
+#define OTG_CTL_EN BIT(0)
 #define SMBB_USB_ENUM_TIMER_STOP 0x34e
 #define ENUM_TIMER_STOPBIT(0)
 #define SMBB_USB_SEC_ACCESS0x3d0
@@ -123,6 +128,9 @@ struct smbb_charger {
struct power_supply *dc_psy;
struct power_supply *bat_psy;
struct regmap *regmap;
+
+   struct regulator_desc otg_rdesc;
+   struct regulator_dev *otg_reg;
 };
 
 static int smbb_vbat_weak_fn(unsigned int index)
@@ -778,12 +786,56 @@ static const struct power_supply_desc dc_psy_desc = {
.property_is_writeable = smbb_charger_writable_property,
 };
 
+static int smbb_chg_otg_enable(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   int rc;
+
+   rc = regmap_update_bits(chg->regmap, chg->addr + SMBB_USB_OTG_CTL,
+   OTG_CTL_EN, OTG_CTL_EN);
+   if (rc)
+   dev_err(chg->dev, "failed to update OTG_CTL\n");
+   return rc;
+}
+
+static int smbb_chg_otg_disable(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   int rc;
+
+   rc = regmap_update_bits(chg->regmap, chg->addr + SMBB_USB_OTG_CTL,
+   OTG_CTL_EN, 0);
+   if (rc)
+   dev_err(chg->dev, "failed to update OTG_CTL\n");
+   return rc;
+}
+
+static int smbb_chg_otg_is_enabled(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   unsigned int value = 0;
+   int rc;
+
+   rc = regmap_read(chg->regmap, chg->addr + SMBB_USB_OTG_CTL, );
+   if (rc)
+   dev_err(chg->dev, "failed to read OTG_CTL\n");
+
+   return !!(value & OTG_CTL_EN);
+}
+
+static struct regulator_ops smbb_chg_otg_ops = {
+   .enable = smbb_chg_otg_enable,
+   .disable = smbb_chg_otg_disable,
+   .is_enabled = smbb_chg_otg_is_enabled,
+};
+
 static int smbb_charger_probe(struct platform_device *pdev)
 {
struct power_supply_config bat_cfg = {};
struct power_supply_config usb_cfg = {};
struct power_supply_config dc_cfg = {};
struct smbb_charger *chg;
+   struct regulator_config config = { };
int rc, i;
 
chg = devm_kzalloc(>dev, sizeof(*chg), GFP_KERNEL);
@@ -884,6 +936,28 @@ static int smbb_charger_probe(struct platform_device *pdev)
}
}
 
+   /*
+* otg regulator is used to control VBUS voltage direction
+* when USB switches between host and ga

[PATCH] power: qcom_smbb: Add otg regulator for control of vbus

2015-10-22 Thread Tim Bird
Add a regulator to control the OTG chargepath switch.  The OTG
switch gets its power from pm8941_5vs1, and that should be expressed
as an usb_otg_in-supply property in the DT node for the charger driver.
The regulator name is "otg".  This is used by USB code to control VBUS
direction.

Signed-off-by: Tim Bird <tim.b...@sonymobile.com>
---
 .../devicetree/bindings/power_supply/qcom_smbb.txt | 20 ++
 drivers/power/qcom_smbb.c  | 74 ++
 2 files changed, 94 insertions(+)

diff --git a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt 
b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
index 65b88fa..dc0f91d 100644
--- a/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
+++ b/Documentation/devicetree/bindings/power_supply/qcom_smbb.txt
@@ -105,6 +105,23 @@ PROPERTIES
regulation must be done externally to fully comply with
the JEITA safety guidelines if this flag is set.
 
+- usb_otg_in-supply:
+  Usage: optional
+  Value type: 
+  Description: Reference to the regulator supplying power to the USB_OTG_IN
+   pin.
+
+child nodes:
+- otg:
+  Usage: optional
+  Description: This node is used to define a regulator which is used by
+   other parts of the system to control the direction of VBUS
+   voltage - specifically: whether to supply voltage to VBUS for
+   host mode operation of the OTG port. The driver registers a
+   regulator with this name, which can be looked up by string.
+   Alternatively, you can add a DT label, which can then be
+   referenced by phandle.
+
 EXAMPLE
 charger@1000 {
compatible = "qcom,pm8941-charger";
@@ -128,4 +145,7 @@ charger@1000 {
 
qcom,fast-charge-current-limit = <100>;
qcom,dc-charge-current-limit = <100>;
+   usb_otg_in-supply = <_5vs1>;
+
+   otg {};
 };
diff --git a/drivers/power/qcom_smbb.c b/drivers/power/qcom_smbb.c
index 0dabfe8..fa2983a 100644
--- a/drivers/power/qcom_smbb.c
+++ b/drivers/power/qcom_smbb.c
@@ -34,6 +34,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #define SMBB_CHG_VMAX  0x040
 #define SMBB_CHG_VSAFE 0x041
@@ -71,6 +74,8 @@
 #define BTC_CTRL_HOT_EXT_N BIT(0)
 
 #define SMBB_USB_IMAX  0x344
+#define SMBB_USB_OTG_CTL   0x348
+#define OTG_CTL_EN BIT(0)
 #define SMBB_USB_ENUM_TIMER_STOP 0x34e
 #define ENUM_TIMER_STOPBIT(0)
 #define SMBB_USB_SEC_ACCESS0x3d0
@@ -123,6 +128,9 @@ struct smbb_charger {
struct power_supply *dc_psy;
struct power_supply *bat_psy;
struct regmap *regmap;
+
+   struct regulator_desc otg_rdesc;
+   struct regulator_dev *otg_reg;
 };
 
 static int smbb_vbat_weak_fn(unsigned int index)
@@ -778,12 +786,56 @@ static const struct power_supply_desc dc_psy_desc = {
.property_is_writeable = smbb_charger_writable_property,
 };
 
+static int smbb_chg_otg_enable(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   int rc;
+
+   rc = regmap_update_bits(chg->regmap, chg->addr + SMBB_USB_OTG_CTL,
+   OTG_CTL_EN, OTG_CTL_EN);
+   if (rc)
+   dev_err(chg->dev, "failed to update OTG_CTL\n");
+   return rc;
+}
+
+static int smbb_chg_otg_disable(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   int rc;
+
+   rc = regmap_update_bits(chg->regmap, chg->addr + SMBB_USB_OTG_CTL,
+   OTG_CTL_EN, 0);
+   if (rc)
+   dev_err(chg->dev, "failed to update OTG_CTL\n");
+   return rc;
+}
+
+static int smbb_chg_otg_is_enabled(struct regulator_dev *rdev)
+{
+   struct smbb_charger *chg = rdev_get_drvdata(rdev);
+   unsigned int value = 0;
+   int rc;
+
+   rc = regmap_read(chg->regmap, chg->addr + SMBB_USB_OTG_CTL, );
+   if (rc)
+   dev_err(chg->dev, "failed to read OTG_CTL\n");
+
+   return !!(value & OTG_CTL_EN);
+}
+
+static struct regulator_ops smbb_chg_otg_ops = {
+   .enable = smbb_chg_otg_enable,
+   .disable = smbb_chg_otg_disable,
+   .is_enabled = smbb_chg_otg_is_enabled,
+};
+
 static int smbb_charger_probe(struct platform_device *pdev)
 {
struct power_supply_config bat_cfg = {};
struct power_supply_config usb_cfg = {};
struct power_supply_config dc_cfg = {};
struct smbb_charger *chg;
+   struct regulator_config config = { };
int rc, i;
 
chg = devm_kzalloc(>dev, sizeof(*chg), GFP_KERNEL);
@@ -884,6 +936,28 @@ static int smbb_charger_probe(struct platform_device *pdev)
}
}
 
+   /*
+* otg regulator is used to control VBUS voltage direction
+* when USB s

Re: [PATCH v2] usb: phy: msm: Unregister VBUS and ID events notifiers

2015-09-08 Thread Tim Bird


On 09/07/2015 01:07 AM, Ivan T. Ivanov wrote:
> Right now even if driver failed to probe extcon framework will
> still deliver its VBUS and ID events, which will lead to random
> exception codes.
> 
> Fix this by removing VBUS and ID events notifiers when probe fail.
> 
> Fixes: 591fc116f330 ("usb: phy: msm: Use extcon framework for VBUS and ID 
> detection")
> 
> Reported-by: Tim Bird 
> Signed-off-by: Ivan T. Ivanov 
> ---
> 
> Patch reworked to use new extcon API.
> 
>  drivers/usb/phy/phy-msm-usb.c | 25 -
>  1 file changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
> index c58c3c0dbe35..0fd21c147c7e 100644
> --- a/drivers/usb/phy/phy-msm-usb.c
> +++ b/drivers/usb/phy/phy-msm-usb.c
> @@ -1598,6 +1598,8 @@ static int msm_otg_read_dt(struct platform_device 
> *pdev, struct msm_otg *motg)
>   ret = extcon_register_notifier(ext_id, EXTCON_USB_HOST,
>   >id.nb);
>   if (ret < 0) {
> + extcon_unregister_notifier(motg->vbus.extcon,
> +EXTCON_USB, >vbus.nb);
>   dev_err(>dev, "register ID notifier failed\n");
>   return ret;
>   }
> @@ -1660,15 +1662,6 @@ static int msm_otg_probe(struct platform_device *pdev)
>   if (!motg)
>   return -ENOMEM;
> 
> - pdata = dev_get_platdata(>dev);
> - if (!pdata) {
> - if (!np)
> - return -ENXIO;
> - ret = msm_otg_read_dt(pdev, motg);
> - if (ret)
> - return ret;
> - }
> -
>   motg->phy.otg = devm_kzalloc(>dev, sizeof(struct usb_otg),
>GFP_KERNEL);
>   if (!motg->phy.otg)
> @@ -1731,6 +1724,15 @@ static int msm_otg_probe(struct platform_device *pdev)
>   return motg->irq;
>   }
> 
> + pdata = dev_get_platdata(>dev);
> + if (!pdata) {
> + if (!np)
> + return -ENXIO;
> + ret = msm_otg_read_dt(pdev, motg);
> + if (ret)
> + return ret;
> + }
> +

The following code depends on msm_otg_read_dt(), but the
movement of the call puts the phy_number test before msm_otg_read_dt().

/*
 * NOTE: The PHYs can be multiplexed between the chipidea controller
 * and the dwc3 controller, using a single bit. It is important that
 * the dwc3 driver does not set this bit in an incompatible way.
 */
if (motg->phy_number) {
phy_select = devm_ioremap_nocache(>dev, USB2_PHY_SEL, 4);
if (!phy_select)
return -ENOMEM;
/* Enable second PHY with the OTG port */
writel(0x1, phy_select);
}

Can you please move the motg->phy_number code after the msm_otg_read_dt() call?
(right here, in the patch, would be good :-)

>   regs[0].supply = "vddcx";
>   regs[1].supply = "v3p3";
>   regs[2].supply = "v1p8";
> @@ -1834,6 +1836,11 @@ disable_clks:
>   clk_disable_unprepare(motg->clk);
>   if (!IS_ERR(motg->core_clk))
>   clk_disable_unprepare(motg->core_clk);
> +
> + extcon_unregister_notifier(motg->id.extcon,
> +EXTCON_USB_HOST, >id.nb);
> + extcon_unregister_notifier(motg->vbus.extcon,
> +EXTCON_USB, >vbus.nb);
>   return ret;
>  }

Other than that - it looks good.
 -- Tim

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


Re: [PATCH v2] usb: phy: msm: Unregister VBUS and ID events notifiers

2015-09-08 Thread Tim Bird


On 09/07/2015 01:07 AM, Ivan T. Ivanov wrote:
> Right now even if driver failed to probe extcon framework will
> still deliver its VBUS and ID events, which will lead to random
> exception codes.
> 
> Fix this by removing VBUS and ID events notifiers when probe fail.
> 
> Fixes: 591fc116f330 ("usb: phy: msm: Use extcon framework for VBUS and ID 
> detection")
> 
> Reported-by: Tim Bird <tim.b...@sonymobile.com>
> Signed-off-by: Ivan T. Ivanov <ivan.iva...@linaro.org>
> ---
> 
> Patch reworked to use new extcon API.
> 
>  drivers/usb/phy/phy-msm-usb.c | 25 -
>  1 file changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
> index c58c3c0dbe35..0fd21c147c7e 100644
> --- a/drivers/usb/phy/phy-msm-usb.c
> +++ b/drivers/usb/phy/phy-msm-usb.c
> @@ -1598,6 +1598,8 @@ static int msm_otg_read_dt(struct platform_device 
> *pdev, struct msm_otg *motg)
>   ret = extcon_register_notifier(ext_id, EXTCON_USB_HOST,
>   >id.nb);
>   if (ret < 0) {
> + extcon_unregister_notifier(motg->vbus.extcon,
> +EXTCON_USB, >vbus.nb);
>   dev_err(>dev, "register ID notifier failed\n");
>   return ret;
>   }
> @@ -1660,15 +1662,6 @@ static int msm_otg_probe(struct platform_device *pdev)
>   if (!motg)
>   return -ENOMEM;
> 
> - pdata = dev_get_platdata(>dev);
> - if (!pdata) {
> - if (!np)
> - return -ENXIO;
> - ret = msm_otg_read_dt(pdev, motg);
> - if (ret)
> - return ret;
> - }
> -
>   motg->phy.otg = devm_kzalloc(>dev, sizeof(struct usb_otg),
>GFP_KERNEL);
>   if (!motg->phy.otg)
> @@ -1731,6 +1724,15 @@ static int msm_otg_probe(struct platform_device *pdev)
>   return motg->irq;
>   }
> 
> + pdata = dev_get_platdata(>dev);
> + if (!pdata) {
> + if (!np)
> + return -ENXIO;
> + ret = msm_otg_read_dt(pdev, motg);
> + if (ret)
> + return ret;
> + }
> +

The following code depends on msm_otg_read_dt(), but the
movement of the call puts the phy_number test before msm_otg_read_dt().

/*
 * NOTE: The PHYs can be multiplexed between the chipidea controller
 * and the dwc3 controller, using a single bit. It is important that
 * the dwc3 driver does not set this bit in an incompatible way.
 */
if (motg->phy_number) {
phy_select = devm_ioremap_nocache(>dev, USB2_PHY_SEL, 4);
if (!phy_select)
return -ENOMEM;
/* Enable second PHY with the OTG port */
writel(0x1, phy_select);
}

Can you please move the motg->phy_number code after the msm_otg_read_dt() call?
(right here, in the patch, would be good :-)

>   regs[0].supply = "vddcx";
>   regs[1].supply = "v3p3";
>   regs[2].supply = "v1p8";
> @@ -1834,6 +1836,11 @@ disable_clks:
>   clk_disable_unprepare(motg->clk);
>   if (!IS_ERR(motg->core_clk))
>   clk_disable_unprepare(motg->core_clk);
> +
> + extcon_unregister_notifier(motg->id.extcon,
> +EXTCON_USB_HOST, >id.nb);
> + extcon_unregister_notifier(motg->vbus.extcon,
> +EXTCON_USB, >vbus.nb);
>   return ret;
>  }

Other than that - it looks good.
 -- Tim

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


Re: [PATCH] usb: phy: msm: Unregister driver interest for VBUS and ID events

2015-08-24 Thread Tim Bird
On 08/18/2015 12:56 AM, Ivan T. Ivanov wrote:
> Right now even if driver failed to probe extcon framework will
> still deliver its VBUS and ID events, which will lead to random
> exception codes.
> 
> Fix this by removing driver interest for VBUS and ID events when
> probe fail.
> 
> Fixes: 591fc116f330 ("usb: phy: msm: Use extcon framework for VBUS and ID 
> detection")
> 
> Reported-by: Tim Bird 
> Signed-off-by: Ivan T. Ivanov 
> ---
>  drivers/usb/phy/phy-msm-usb.c | 26 +-
>  1 file changed, 17 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
> index 00c49bb1bd29..a9082567f114 100644
> --- a/drivers/usb/phy/phy-msm-usb.c
> +++ b/drivers/usb/phy/phy-msm-usb.c
> @@ -1581,6 +1581,8 @@ static int msm_otg_read_dt(struct platform_device 
> *pdev, struct msm_otg *motg)
>   ret = extcon_register_interest(>id.conn, ext_id->name,
>  "USB-HOST", >id.nb);
>   if (ret < 0) {
> + if (!IS_ERR(ext_vbus))
> + extcon_unregister_interest(>vbus.conn);
>   dev_err(>dev, "register ID notifier failed\n");
>   return ret;
>   }
...

This patch is obsoleted by commit 83b7b67c7, which changes the extcon API
a bit (from register_interest to register_notifier, among other things).

But, in general, I would expect this approach to work.

Do you want me to re-spin this with the new API?
 -- Tim


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


Re: [PATCH] doc: Add more workqueue functions to the documentation

2015-08-24 Thread Tim Bird


On 08/15/2015 06:27 AM, Jonathan Corbet wrote:
> On Fri, 14 Aug 2015 15:46:52 -0700
> Tim Bird  wrote:
> 
>>> It sure would be nice if changes like this were accompanied by a patch
>>> fixing the additional warnings it drags in ... :)  In this case I've put
>>> something together for workqueue.h and will send it off shortly.  
>>
>> My apologies.  
> 
> Sorry, hope I didn't sound grumpier than I really was.  As you note, the
> docs builds are a morass of warnings; it would be nice to avoid making it
> worse when possible.  Especially warnings that actually mean something -
> like the docbook comments being wrong.  It was easily fixed, anyway, no
> worries.

You didn't sound grumpy, but I probably came off as overly
sensitive. I was embarrassed to have missed the warnings.

I would like to lend a hand to clean up the warnings.  And
I'm interested in following up on the discussion from the
ksummit list, about a possible conversion to markdown or
asciidoc.  I started experimenting with this by converting
one of the text files in Documentation to both markdown
and asciidoc, to see:
1) what additional tools needed to be installed, if any,
2) what it took to convert from plain text to the different
markup languages, and
3) and what the resulting output looked like.

However, I didn't quite finish.  If this gets on the agenda
for the kernel summit, then I'll definitely finish up this
work (and maybe try it on some other files), so that there's
a data point for discussing a conversion from DocBook to
something else.

I had the idea of maybe just doing something for the API
docs completely in parallel, as a test, to determine the
difficulty of conversion.  But it probably would turn into
one of those 80/80 things.  (The first 80 percent of the
project takes 80 percent of the time, and the last 20 percent
takes the other 80 percent. :-)
 -- Tim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] doc: Add more workqueue functions to the documentation

2015-08-24 Thread Tim Bird


On 08/15/2015 06:27 AM, Jonathan Corbet wrote:
 On Fri, 14 Aug 2015 15:46:52 -0700
 Tim Bird tim.b...@sonymobile.com wrote:
 
 It sure would be nice if changes like this were accompanied by a patch
 fixing the additional warnings it drags in ... :)  In this case I've put
 something together for workqueue.h and will send it off shortly.  

 My apologies.  
 
 Sorry, hope I didn't sound grumpier than I really was.  As you note, the
 docs builds are a morass of warnings; it would be nice to avoid making it
 worse when possible.  Especially warnings that actually mean something -
 like the docbook comments being wrong.  It was easily fixed, anyway, no
 worries.

You didn't sound grumpy, but I probably came off as overly
sensitive. I was embarrassed to have missed the warnings.

I would like to lend a hand to clean up the warnings.  And
I'm interested in following up on the discussion from the
ksummit list, about a possible conversion to markdown or
asciidoc.  I started experimenting with this by converting
one of the text files in Documentation to both markdown
and asciidoc, to see:
1) what additional tools needed to be installed, if any,
2) what it took to convert from plain text to the different
markup languages, and
3) and what the resulting output looked like.

However, I didn't quite finish.  If this gets on the agenda
for the kernel summit, then I'll definitely finish up this
work (and maybe try it on some other files), so that there's
a data point for discussing a conversion from DocBook to
something else.

I had the idea of maybe just doing something for the API
docs completely in parallel, as a test, to determine the
difficulty of conversion.  But it probably would turn into
one of those 80/80 things.  (The first 80 percent of the
project takes 80 percent of the time, and the last 20 percent
takes the other 80 percent. :-)
 -- Tim
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] usb: phy: msm: Unregister driver interest for VBUS and ID events

2015-08-24 Thread Tim Bird
On 08/18/2015 12:56 AM, Ivan T. Ivanov wrote:
 Right now even if driver failed to probe extcon framework will
 still deliver its VBUS and ID events, which will lead to random
 exception codes.
 
 Fix this by removing driver interest for VBUS and ID events when
 probe fail.
 
 Fixes: 591fc116f330 (usb: phy: msm: Use extcon framework for VBUS and ID 
 detection)
 
 Reported-by: Tim Bird tim.b...@sonymobile.com
 Signed-off-by: Ivan T. Ivanov ivan.iva...@linaro.org
 ---
  drivers/usb/phy/phy-msm-usb.c | 26 +-
  1 file changed, 17 insertions(+), 9 deletions(-)
 
 diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
 index 00c49bb1bd29..a9082567f114 100644
 --- a/drivers/usb/phy/phy-msm-usb.c
 +++ b/drivers/usb/phy/phy-msm-usb.c
 @@ -1581,6 +1581,8 @@ static int msm_otg_read_dt(struct platform_device 
 *pdev, struct msm_otg *motg)
   ret = extcon_register_interest(motg-id.conn, ext_id-name,
  USB-HOST, motg-id.nb);
   if (ret  0) {
 + if (!IS_ERR(ext_vbus))
 + extcon_unregister_interest(motg-vbus.conn);
   dev_err(pdev-dev, register ID notifier failed\n);
   return ret;
   }
...

This patch is obsoleted by commit 83b7b67c7, which changes the extcon API
a bit (from register_interest to register_notifier, among other things).

But, in general, I would expect this approach to work.

Do you want me to re-spin this with the new API?
 -- Tim


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


repeat... Re: BUG: usb: phy: msm: problem with EPROBE defer and extcon cleanup

2015-08-17 Thread Tim Bird
Sorry - I mistyped Ivan's e-mail the first time.

On 08/17/2015 04:43 PM, Tim Bird wrote:
> Ivan,
> 
> I'm seeing a bug in the phy-msm-usb.c code, when I get an EPROBE defer during 
> probing the driver.
> The code is statically linked in the kernel, and the dts for my board is 
> specifying an extcon phandle 
> for the ID pin.
> 
> Below is a fragment of the kernel output for a boot of this code.  Messages 
> prefixed with TRB
> are my own debug printks.  Note that the notifier block (at ee23513c) that 
> gets registered
> with extcon before the first probe failure, ultimately gets used during an ID 
> pin event
> (status change) by raw_notifier_call_chain().  This notifier block should be 
> unregistered
> if the probe fails, so that only the second one registered is on the call 
> chain.
> 
> Let me know if you plan to work on this.  I'm otherwise occupied the 
> remainder of this week,
> so won't have time to work on it, but I can probably get to it early next 
> week if you don't.
> 
> Regards,
>  -- Tim
> 
> 
> [1.435543] NET: Registered protocol family 17 
>  
> [1.439773] Key type dns_resolver registered   
>  
> [1.444041] Registering SWP/SWPB emulation handler 
>  
> [1.451259] msm_otg f9a55000.usb-phy: failed to get phandle in 
> /soc/usb-phy@f9a55000 node   
> [1.452915] TRB: registering notifier for ext_id   
>  
> [1.464681] TRB: motg=ee235010, id=ee23513c, nb=ee23513c   
>  
> [1.465957] msm_otg f9a55000.usb-phy: OTG regs = f011e000  
>  
> [1.471532] msm_otg f9a55000.usb-phy: Failed to get supply 'v3p3': -517
>  
> [1.477416] msm_hsusb_host f9a55000.ehci: ehci_msm proble  
>  
> [1.482889] msm_hsusb_host f9a55000.ehci: unable to find transceiver   
>  
> [1.488762] msm_hsusb f9a55000.usb-controller: ci_hdrc_msm_probe   
>  
> [1.501689] l20: supplied by vreg-boost-bypass 
>  
> [1.503694] s3: operation not allowed  
>  
> [1.505072] mmc0: Switching to 3.3V signalling voltage failed  
>  
> [1.545275] mmc0: SDHCI controller on f9824900.sdhci [f9824900.sdhci] 
> using ADMA
> [1.545615] msm_otg f9a55000.usb-phy: failed to get phandle in 
> /soc/usb-phy@f9a55000 node   
> [1.551749] TRB: registering notifier for ext_id   
>  
> [1.559835] TRB: motg=ed893e10, id=ed893f3c, nb=ed893f3c   
>  
> [1.564578] msm_otg f9a55000.usb-phy: OTG regs = f0132000  
>  
> [1.569985] l24: supplied by vreg-boost-bypass 
>  
> [1.575342] l6: supplied by s2 
>  
> [1.579737] l6: operation not allowed  
>  
> [1.582458] l24: operation not allowed 
>  
> [1.586229] reg (HPM)  
>  
> [1.608277] mmc0: MAN_BKOPS_EN bit is not set  
>  
> [1.615708] mmc0: new HS200 MMC card at address 0001   
>  
> [1.616252] mmcblk0: mmc0:0001 SEM16G 14.6 GiB 
>  
> [1.619888] mmcblk0boot0: mmc0:0001 SEM16G partition 1 4.00 MiB
>  
> [1.624128] mmcblk0boot1: mmc0:0001 SEM16G partition 2 4.00 MiB
>  
> [1.630063] mmcblk0rpmb: mmc0:0001 SEM16G partition 3 4.00 MiB 
>  
> [1.638255]  mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 
> p16 p17 p18 p19 p20
> [1.695676] msm_hsusb_host f9a55000.ehci: ehci_msm proble  
>  
> [1.695749] msm_otg f9a55000.usb-phy: Host mode is not supported   
>  
> [1.700054] msm_hsusb_host f9a55000.ehci: unable to register with 
> trans

BUG: usb: phy: msm: problem with EPROBE defer and extcon cleanup

2015-08-17 Thread Tim Bird
Ivan,

I'm seeing a bug in the phy-msm-usb.c code, when I get an EPROBE defer during 
probing the driver.
The code is statically linked in the kernel, and the dts for my board is 
specifying an extcon phandle 
for the ID pin.

Below is a fragment of the kernel output for a boot of this code.  Messages 
prefixed with TRB
are my own debug printks.  Note that the notifier block (at ee23513c) that gets 
registered
with extcon before the first probe failure, ultimately gets used during an ID 
pin event
(status change) by raw_notifier_call_chain().  This notifier block should be 
unregistered
if the probe fails, so that only the second one registered is on the call chain.

Let me know if you plan to work on this.  I'm otherwise occupied the remainder 
of this week,
so won't have time to work on it, but I can probably get to it early next week 
if you don't.

Regards,
 -- Tim


[1.435543] NET: Registered protocol family 17   
   
[1.439773] Key type dns_resolver registered 
   
[1.444041] Registering SWP/SWPB emulation handler   
   
[1.451259] msm_otg f9a55000.usb-phy: failed to get phandle in 
/soc/usb-phy@f9a55000 node   
[1.452915] TRB: registering notifier for ext_id 
   
[1.464681] TRB: motg=ee235010, id=ee23513c, nb=ee23513c 
   
[1.465957] msm_otg f9a55000.usb-phy: OTG regs = f011e000
   
[1.471532] msm_otg f9a55000.usb-phy: Failed to get supply 'v3p3': -517  
   
[1.477416] msm_hsusb_host f9a55000.ehci: ehci_msm proble
   
[1.482889] msm_hsusb_host f9a55000.ehci: unable to find transceiver 
   
[1.488762] msm_hsusb f9a55000.usb-controller: ci_hdrc_msm_probe 
   
[1.501689] l20: supplied by vreg-boost-bypass   
   
[1.503694] s3: operation not allowed
   
[1.505072] mmc0: Switching to 3.3V signalling voltage failed
   
[1.545275] mmc0: SDHCI controller on f9824900.sdhci [f9824900.sdhci] using 
ADMA
[1.545615] msm_otg f9a55000.usb-phy: failed to get phandle in 
/soc/usb-phy@f9a55000 node   
[1.551749] TRB: registering notifier for ext_id 
   
[1.559835] TRB: motg=ed893e10, id=ed893f3c, nb=ed893f3c 
   
[1.564578] msm_otg f9a55000.usb-phy: OTG regs = f0132000
   
[1.569985] l24: supplied by vreg-boost-bypass   
   
[1.575342] l6: supplied by s2   
   
[1.579737] l6: operation not allowed
   
[1.582458] l24: operation not allowed   
   
[1.586229] reg (HPM)
   
[1.608277] mmc0: MAN_BKOPS_EN bit is not set
   
[1.615708] mmc0: new HS200 MMC card at address 0001 
   
[1.616252] mmcblk0: mmc0:0001 SEM16G 14.6 GiB   
   
[1.619888] mmcblk0boot0: mmc0:0001 SEM16G partition 1 4.00 MiB  
   
[1.624128] mmcblk0boot1: mmc0:0001 SEM16G partition 2 4.00 MiB  
   
[1.630063] mmcblk0rpmb: mmc0:0001 SEM16G partition 3 4.00 MiB   
   
[1.638255]  mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 
p17 p18 p19 p20
[1.695676] msm_hsusb_host f9a55000.ehci: ehci_msm proble
   
[1.695749] msm_otg f9a55000.usb-phy: Host mode is not supported 
   
[1.700054] msm_hsusb_host f9a55000.ehci: unable to register with 
transceiver   
[1.706184] msm_otg f9a55000.usb-phy: OTG runtime idle   
   
[1.713500] msm_hsusb f9a55000.usb-controller: ci_hdrc_msm_probe 
   
[1.718267] f9a55000.usb-controller supply vbus not found, using dummy 
regulator
[1.724762] TRB: in ci_hdrc_probe
   
[1.731807] ci_hdrc ci_hdrc.0: ChipIdea HDRC found, revision: 10, lpm: 0; 
cap: f013a100 op: f013a140
[1.737561] 

Re: [Device-mainlining] [PATCH v2 2/3] gadget: Introduce the usb charger framework

2015-08-17 Thread Tim Bird


On 08/16/2015 08:03 PM, Baolin Wang via device-mainlining wrote:
> On 14 August 2015 at 23:27, Greg KH  wrote:
>> On Fri, Aug 14, 2015 at 05:47:45PM +0800, Baolin Wang wrote:
>>> + *
>>> + * This program is free software; you can redistribute it and/or modify
>>> + * it under the terms of the GNU General Public License as published by
>>> + * the Free Software Foundation; either version 2 of the License, or
>>> + * (at your option) any later version.
>>
>> I have to ask, do you really mean "any later version"?
>>
> 
> I think I did not get your point, could you explain it detailedly?

The full kernel is licensed under v2 of the GPL only, not "any later version".
See the second paragraph at the top of the COPYING file in the root directory
of the kernel source tree. There are differences on individual files, but
having this file allow "any later version" makes it different from much of
rest of the kernel.

Unless you have a specific reason to allow greater-than-V2 GPL licensing on this
file, you should change the licensing clause.  The following wording appears
to be pretty popular:

* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.

  -- Tim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


repeat... Re: BUG: usb: phy: msm: problem with EPROBE defer and extcon cleanup

2015-08-17 Thread Tim Bird
Sorry - I mistyped Ivan's e-mail the first time.

On 08/17/2015 04:43 PM, Tim Bird wrote:
 Ivan,
 
 I'm seeing a bug in the phy-msm-usb.c code, when I get an EPROBE defer during 
 probing the driver.
 The code is statically linked in the kernel, and the dts for my board is 
 specifying an extcon phandle 
 for the ID pin.
 
 Below is a fragment of the kernel output for a boot of this code.  Messages 
 prefixed with TRB
 are my own debug printks.  Note that the notifier block (at ee23513c) that 
 gets registered
 with extcon before the first probe failure, ultimately gets used during an ID 
 pin event
 (status change) by raw_notifier_call_chain().  This notifier block should be 
 unregistered
 if the probe fails, so that only the second one registered is on the call 
 chain.
 
 Let me know if you plan to work on this.  I'm otherwise occupied the 
 remainder of this week,
 so won't have time to work on it, but I can probably get to it early next 
 week if you don't.
 
 Regards,
  -- Tim
 
 
 [1.435543] NET: Registered protocol family 17 
  
 [1.439773] Key type dns_resolver registered   
  
 [1.444041] Registering SWP/SWPB emulation handler 
  
 [1.451259] msm_otg f9a55000.usb-phy: failed to get phandle in 
 /soc/usb-phy@f9a55000 node   
 [1.452915] TRB: registering notifier for ext_id   
  
 [1.464681] TRB: motg=ee235010, id=ee23513c, nb=ee23513c   
  
 [1.465957] msm_otg f9a55000.usb-phy: OTG regs = f011e000  
  
 [1.471532] msm_otg f9a55000.usb-phy: Failed to get supply 'v3p3': -517
  
 [1.477416] msm_hsusb_host f9a55000.ehci: ehci_msm proble  
  
 [1.482889] msm_hsusb_host f9a55000.ehci: unable to find transceiver   
  
 [1.488762] msm_hsusb f9a55000.usb-controller: ci_hdrc_msm_probe   
  
 [1.501689] l20: supplied by vreg-boost-bypass 
  
 [1.503694] s3: operation not allowed  
  
 [1.505072] mmc0: Switching to 3.3V signalling voltage failed  
  
 [1.545275] mmc0: SDHCI controller on f9824900.sdhci [f9824900.sdhci] 
 using ADMA
 [1.545615] msm_otg f9a55000.usb-phy: failed to get phandle in 
 /soc/usb-phy@f9a55000 node   
 [1.551749] TRB: registering notifier for ext_id   
  
 [1.559835] TRB: motg=ed893e10, id=ed893f3c, nb=ed893f3c   
  
 [1.564578] msm_otg f9a55000.usb-phy: OTG regs = f0132000  
  
 [1.569985] l24: supplied by vreg-boost-bypass 
  
 [1.575342] l6: supplied by s2 
  
 [1.579737] l6: operation not allowed  
  
 [1.582458] l24: operation not allowed 
  
 [1.586229] reg (HPM)  
  
 [1.608277] mmc0: MAN_BKOPS_EN bit is not set  
  
 [1.615708] mmc0: new HS200 MMC card at address 0001   
  
 [1.616252] mmcblk0: mmc0:0001 SEM16G 14.6 GiB 
  
 [1.619888] mmcblk0boot0: mmc0:0001 SEM16G partition 1 4.00 MiB
  
 [1.624128] mmcblk0boot1: mmc0:0001 SEM16G partition 2 4.00 MiB
  
 [1.630063] mmcblk0rpmb: mmc0:0001 SEM16G partition 3 4.00 MiB 
  
 [1.638255]  mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 
 p16 p17 p18 p19 p20
 [1.695676] msm_hsusb_host f9a55000.ehci: ehci_msm proble  
  
 [1.695749] msm_otg f9a55000.usb-phy: Host mode is not supported   
  
 [1.700054] msm_hsusb_host f9a55000.ehci: unable to register with 
 transceiver   
 [1.706184] msm_otg f9a55000.usb-phy: OTG runtime idle 
  
 [1.713500] msm_hsusb f9a55000.usb-controller: ci_hdrc_msm_probe   
  
 [1.718267] f9a55000.usb-controller supply vbus not found, using dummy 
 regulator
 [1.724762] TRB

BUG: usb: phy: msm: problem with EPROBE defer and extcon cleanup

2015-08-17 Thread Tim Bird
Ivan,

I'm seeing a bug in the phy-msm-usb.c code, when I get an EPROBE defer during 
probing the driver.
The code is statically linked in the kernel, and the dts for my board is 
specifying an extcon phandle 
for the ID pin.

Below is a fragment of the kernel output for a boot of this code.  Messages 
prefixed with TRB
are my own debug printks.  Note that the notifier block (at ee23513c) that gets 
registered
with extcon before the first probe failure, ultimately gets used during an ID 
pin event
(status change) by raw_notifier_call_chain().  This notifier block should be 
unregistered
if the probe fails, so that only the second one registered is on the call chain.

Let me know if you plan to work on this.  I'm otherwise occupied the remainder 
of this week,
so won't have time to work on it, but I can probably get to it early next week 
if you don't.

Regards,
 -- Tim


[1.435543] NET: Registered protocol family 17   
   
[1.439773] Key type dns_resolver registered 
   
[1.444041] Registering SWP/SWPB emulation handler   
   
[1.451259] msm_otg f9a55000.usb-phy: failed to get phandle in 
/soc/usb-phy@f9a55000 node   
[1.452915] TRB: registering notifier for ext_id 
   
[1.464681] TRB: motg=ee235010, id=ee23513c, nb=ee23513c 
   
[1.465957] msm_otg f9a55000.usb-phy: OTG regs = f011e000
   
[1.471532] msm_otg f9a55000.usb-phy: Failed to get supply 'v3p3': -517  
   
[1.477416] msm_hsusb_host f9a55000.ehci: ehci_msm proble
   
[1.482889] msm_hsusb_host f9a55000.ehci: unable to find transceiver 
   
[1.488762] msm_hsusb f9a55000.usb-controller: ci_hdrc_msm_probe 
   
[1.501689] l20: supplied by vreg-boost-bypass   
   
[1.503694] s3: operation not allowed
   
[1.505072] mmc0: Switching to 3.3V signalling voltage failed
   
[1.545275] mmc0: SDHCI controller on f9824900.sdhci [f9824900.sdhci] using 
ADMA
[1.545615] msm_otg f9a55000.usb-phy: failed to get phandle in 
/soc/usb-phy@f9a55000 node   
[1.551749] TRB: registering notifier for ext_id 
   
[1.559835] TRB: motg=ed893e10, id=ed893f3c, nb=ed893f3c 
   
[1.564578] msm_otg f9a55000.usb-phy: OTG regs = f0132000
   
[1.569985] l24: supplied by vreg-boost-bypass   
   
[1.575342] l6: supplied by s2   
   
[1.579737] l6: operation not allowed
   
[1.582458] l24: operation not allowed   
   
[1.586229] reg (HPM)
   
[1.608277] mmc0: MAN_BKOPS_EN bit is not set
   
[1.615708] mmc0: new HS200 MMC card at address 0001 
   
[1.616252] mmcblk0: mmc0:0001 SEM16G 14.6 GiB   
   
[1.619888] mmcblk0boot0: mmc0:0001 SEM16G partition 1 4.00 MiB  
   
[1.624128] mmcblk0boot1: mmc0:0001 SEM16G partition 2 4.00 MiB  
   
[1.630063] mmcblk0rpmb: mmc0:0001 SEM16G partition 3 4.00 MiB   
   
[1.638255]  mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 
p17 p18 p19 p20
[1.695676] msm_hsusb_host f9a55000.ehci: ehci_msm proble
   
[1.695749] msm_otg f9a55000.usb-phy: Host mode is not supported 
   
[1.700054] msm_hsusb_host f9a55000.ehci: unable to register with 
transceiver   
[1.706184] msm_otg f9a55000.usb-phy: OTG runtime idle   
   
[1.713500] msm_hsusb f9a55000.usb-controller: ci_hdrc_msm_probe 
   
[1.718267] f9a55000.usb-controller supply vbus not found, using dummy 
regulator
[1.724762] TRB: in ci_hdrc_probe
   
[1.731807] ci_hdrc ci_hdrc.0: ChipIdea HDRC found, revision: 10, lpm: 0; 
cap: f013a100 op: f013a140
[1.737561] 

Re: [Device-mainlining] [PATCH v2 2/3] gadget: Introduce the usb charger framework

2015-08-17 Thread Tim Bird


On 08/16/2015 08:03 PM, Baolin Wang via device-mainlining wrote:
 On 14 August 2015 at 23:27, Greg KH gre...@linuxfoundation.org wrote:
 On Fri, Aug 14, 2015 at 05:47:45PM +0800, Baolin Wang wrote:
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.

 I have to ask, do you really mean any later version?

 
 I think I did not get your point, could you explain it detailedly?

The full kernel is licensed under v2 of the GPL only, not any later version.
See the second paragraph at the top of the COPYING file in the root directory
of the kernel source tree. There are differences on individual files, but
having this file allow any later version makes it different from much of
rest of the kernel.

Unless you have a specific reason to allow greater-than-V2 GPL licensing on this
file, you should change the licensing clause.  The following wording appears
to be pretty popular:

* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.

  -- Tim
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] doc: Add more workqueue functions to the documentation

2015-08-14 Thread Tim Bird


On 08/13/2015 04:45 PM, Jonathan Corbet wrote:
> On Mon, 10 Aug 2015 15:16:16 -0700
> Tim Bird  wrote:
> 
>> There are some workqueue functions declared in workqueue.h, so include
>> that in the workqueue section of the DocBook docs.
> 
> Applied to the docs tree, thanks.
> 
> It sure would be nice if changes like this were accompanied by a patch
> fixing the additional warnings it drags in ... :)  In this case I've put
> something together for workqueue.h and will send it off shortly.

My apologies.  

When I do 'make mandocs', the only messages from workqueue.h that I noticed
were like the following:

Warn: meta author : no refentry/info/author
queue_delayed_work
Note: meta author : see http://docbook.sf.net/el/author
queue_delayed_work
Warn: meta author : no author data, so inserted a fixme
queue_delayed_work
Note: Writing queue_delayed_work.9

But there are over 4000 of these messages when I make mandocs, so I assumed
ignoring them was OK.

Are these what you saw or was it something else?

Do you know how to get rid of these messages?  

It's a bit of a pain rebuilding.  When I make a change, it rebuilds everything.
My build of mandocs takes 27 minutes and generates over 9000 messages.
Somewhere in the middle of that must have been some other messages related to
workqueue.h that I missed.

However, I'll try to fix build errors in the future.

Thanks,
 -- Tim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 5/5] regulator: Regulator driver for the Qualcomm RPM

2015-08-14 Thread Tim Bird
On Fri, Aug 14, 2015 at 9:58 AM, Andy Gross  wrote:
> On Mon, Jul 27, 2015 at 08:20:33PM -0700, Bjorn Andersson wrote:
>> Driver for regulators exposed by the Resource Power Manager (RPM) found
>> in devices based on Qualcomm 8974 and newer platforms.
>>
>> Reviewed-by: Mark Brown 
>> Signed-off-by: Bjorn Andersson 
>> ---
>
> Mark/Liam, can you please pick this up.  The dependencies for this have been 
> merged
> in by the arm/soc maintainers.
>
> Acked-by: Andy Gross 

I'd like to see these go in as well, though I realize we're starting
to get pretty close to the merge window.
These regulators are the last thing outstanding to get the USB driver
working completely in mainline for
the Xperia Z1 and the dragonboard (800).

FWIW...

Tested-by: Tim Bird 
 -- Tim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] doc: Add more workqueue functions to the documentation

2015-08-14 Thread Tim Bird


On 08/13/2015 04:45 PM, Jonathan Corbet wrote:
 On Mon, 10 Aug 2015 15:16:16 -0700
 Tim Bird tim.b...@sonymobile.com wrote:
 
 There are some workqueue functions declared in workqueue.h, so include
 that in the workqueue section of the DocBook docs.
 
 Applied to the docs tree, thanks.
 
 It sure would be nice if changes like this were accompanied by a patch
 fixing the additional warnings it drags in ... :)  In this case I've put
 something together for workqueue.h and will send it off shortly.

My apologies.  

When I do 'make mandocs', the only messages from workqueue.h that I noticed
were like the following:

Warn: meta author : no refentry/info/author
queue_delayed_work
Note: meta author : see http://docbook.sf.net/el/author
queue_delayed_work
Warn: meta author : no author data, so inserted a fixme
queue_delayed_work
Note: Writing queue_delayed_work.9

But there are over 4000 of these messages when I make mandocs, so I assumed
ignoring them was OK.

Are these what you saw or was it something else?

Do you know how to get rid of these messages?  

It's a bit of a pain rebuilding.  When I make a change, it rebuilds everything.
My build of mandocs takes 27 minutes and generates over 9000 messages.
Somewhere in the middle of that must have been some other messages related to
workqueue.h that I missed.

However, I'll try to fix build errors in the future.

Thanks,
 -- Tim
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 5/5] regulator: Regulator driver for the Qualcomm RPM

2015-08-14 Thread Tim Bird
On Fri, Aug 14, 2015 at 9:58 AM, Andy Gross agr...@codeaurora.org wrote:
 On Mon, Jul 27, 2015 at 08:20:33PM -0700, Bjorn Andersson wrote:
 Driver for regulators exposed by the Resource Power Manager (RPM) found
 in devices based on Qualcomm 8974 and newer platforms.

 Reviewed-by: Mark Brown broo...@kernel.org
 Signed-off-by: Bjorn Andersson bjorn.anders...@sonymobile.com
 ---

 Mark/Liam, can you please pick this up.  The dependencies for this have been 
 merged
 in by the arm/soc maintainers.

 Acked-by: Andy Gross agr...@codeaurora.org

I'd like to see these go in as well, though I realize we're starting
to get pretty close to the merge window.
These regulators are the last thing outstanding to get the USB driver
working completely in mainline for
the Xperia Z1 and the dragonboard (800).

FWIW...

Tested-by: Tim Bird tim.b...@sonymobile.com
 -- Tim
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] doc: Add more workqueue functions to the documentation

2015-08-10 Thread Tim Bird
There are some workqueue functions declared in workqueue.h, so include
that in the workqueue section of the DocBook docs.

Signed-off-by: Tim Bird 
---
 Documentation/DocBook/device-drivers.tmpl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/DocBook/device-drivers.tmpl 
b/Documentation/DocBook/device-drivers.tmpl
index faf09d4..bbc1d7e 100644
--- a/Documentation/DocBook/device-drivers.tmpl
+++ b/Documentation/DocBook/device-drivers.tmpl
@@ -66,6 +66,7 @@
 !Ekernel/time/hrtimer.c
  
  Workqueues and Kevents
+!Iinclude/linux/workqueue.h
 !Ekernel/workqueue.c
  
  Internal Functions
-- 
1.8.2.2

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


Re: [PATCH] extcon: add index increment in find_cable_index_by_name

2015-08-10 Thread Tim Bird

Never mind...

This is already fixed by commit be052cc8 in mainline.

Sorry for the noise.
 -- Tim

On 08/10/2015 10:44 AM, Tim Bird wrote:
> This fixes a bug introduced by commit 73b6ecdb93e8 ("extcon: Redefine the
> unique id of supported external connectors without 'enum extcon' type")
> which introduced an infinite loop in find_cable_index_by_name.  That commit
> converted the scan from a for loop to a while, but did not increment
> 'i' anywhere in the loop.  If the loop index is not incremented, the
> function never exits.
> 
> This function can never work correctly without this fix.
> 
> Signed-off-by: Tim Bird 
> ---
>  drivers/extcon/extcon.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
> index dda1e62..734a9b1 100644
> --- a/drivers/extcon/extcon.c
> +++ b/drivers/extcon/extcon.c
> @@ -138,6 +138,7 @@ static int find_cable_index_by_name(struct extcon_dev 
> *edev, const char *name)
>   id = i;
>   break;
>   }
> + i++;
>   }
>  
>   if (id == EXTCON_NONE)
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] extcon: add index increment in find_cable_index_by_name

2015-08-10 Thread Tim Bird
This fixes a bug introduced by commit 73b6ecdb93e8 ("extcon: Redefine the
unique id of supported external connectors without 'enum extcon' type")
which introduced an infinite loop in find_cable_index_by_name.  That commit
converted the scan from a for loop to a while, but did not increment
'i' anywhere in the loop.  If the loop index is not incremented, the
function never exits.

This function can never work correctly without this fix.

Signed-off-by: Tim Bird 
---
 drivers/extcon/extcon.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index dda1e62..734a9b1 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -138,6 +138,7 @@ static int find_cable_index_by_name(struct extcon_dev 
*edev, const char *name)
id = i;
break;
}
+   i++;
}
 
if (id == EXTCON_NONE)
-- 
1.8.2.2

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


[PATCH] extcon: add index increment in find_cable_index_by_name

2015-08-10 Thread Tim Bird
This fixes a bug introduced by commit 73b6ecdb93e8 (extcon: Redefine the
unique id of supported external connectors without 'enum extcon' type)
which introduced an infinite loop in find_cable_index_by_name.  That commit
converted the scan from a for loop to a while, but did not increment
'i' anywhere in the loop.  If the loop index is not incremented, the
function never exits.

This function can never work correctly without this fix.

Signed-off-by: Tim Bird tim.b...@sonymobile.com
---
 drivers/extcon/extcon.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index dda1e62..734a9b1 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -138,6 +138,7 @@ static int find_cable_index_by_name(struct extcon_dev 
*edev, const char *name)
id = i;
break;
}
+   i++;
}
 
if (id == EXTCON_NONE)
-- 
1.8.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] doc: Add more workqueue functions to the documentation

2015-08-10 Thread Tim Bird
There are some workqueue functions declared in workqueue.h, so include
that in the workqueue section of the DocBook docs.

Signed-off-by: Tim Bird tim.b...@sonymobile.com
---
 Documentation/DocBook/device-drivers.tmpl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/DocBook/device-drivers.tmpl 
b/Documentation/DocBook/device-drivers.tmpl
index faf09d4..bbc1d7e 100644
--- a/Documentation/DocBook/device-drivers.tmpl
+++ b/Documentation/DocBook/device-drivers.tmpl
@@ -66,6 +66,7 @@
 !Ekernel/time/hrtimer.c
  /sect1
  sect1titleWorkqueues and Kevents/title
+!Iinclude/linux/workqueue.h
 !Ekernel/workqueue.c
  /sect1
  sect1titleInternal Functions/title
-- 
1.8.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] extcon: add index increment in find_cable_index_by_name

2015-08-10 Thread Tim Bird

Never mind...

This is already fixed by commit be052cc8 in mainline.

Sorry for the noise.
 -- Tim

On 08/10/2015 10:44 AM, Tim Bird wrote:
 This fixes a bug introduced by commit 73b6ecdb93e8 (extcon: Redefine the
 unique id of supported external connectors without 'enum extcon' type)
 which introduced an infinite loop in find_cable_index_by_name.  That commit
 converted the scan from a for loop to a while, but did not increment
 'i' anywhere in the loop.  If the loop index is not incremented, the
 function never exits.
 
 This function can never work correctly without this fix.
 
 Signed-off-by: Tim Bird tim.b...@sonymobile.com
 ---
  drivers/extcon/extcon.c | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
 index dda1e62..734a9b1 100644
 --- a/drivers/extcon/extcon.c
 +++ b/drivers/extcon/extcon.c
 @@ -138,6 +138,7 @@ static int find_cable_index_by_name(struct extcon_dev 
 *edev, const char *name)
   id = i;
   break;
   }
 + i++;
   }
  
   if (id == EXTCON_NONE)
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv2 1/4] spmi: pmic-arb: add support for irq_get_irqchip_state

2015-08-04 Thread Tim Bird
On Sun, Jul 26, 2015 at 10:34 PM, Andy Gross  wrote:
> On Thu, Jun 18, 2015 at 02:13:42PM -0700, Bjorn Andersson wrote:
>> Signed-off-by: Courtney Cavin 
>> Signed-off-by: Bjorn Andersson 
>> ---
>
> Looks good.
>
> Greg, can you pick this up?
>
> Reviewed-by: Andy Gross 

I gave this (v2) a test with the USB driver, and it works great.  I'd
like to see this patch of the series go in soon, even if the rest of
the charger driver gets stalled for some reason.  This enables much
simpler ID pin handling for host mode for the USB driver.

FWIW...

Tested-by: Tim Bird 

 -- Tim Bird
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv2 1/4] spmi: pmic-arb: add support for irq_get_irqchip_state

2015-08-04 Thread Tim Bird
On Sun, Jul 26, 2015 at 10:34 PM, Andy Gross agr...@codeaurora.org wrote:
 On Thu, Jun 18, 2015 at 02:13:42PM -0700, Bjorn Andersson wrote:
 Signed-off-by: Courtney Cavin courtney.ca...@sonymobile.com
 Signed-off-by: Bjorn Andersson bjorn.anders...@sonymobile.com
 ---

 Looks good.

 Greg, can you pick this up?

 Reviewed-by: Andy Gross agr...@codeaurora.org

I gave this (v2) a test with the USB driver, and it works great.  I'd
like to see this patch of the series go in soon, even if the rest of
the charger driver gets stalled for some reason.  This enables much
simpler ID pin handling for host mode for the USB driver.

FWIW...

Tested-by: Tim Bird tim.b...@sonymobile.com

 -- Tim Bird
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] usb: chipidea: Use extcon framework for VBUS and ID detect

2015-07-29 Thread Tim Bird
On Tue, Jun 2, 2015 at 6:14 AM, Ivan T. Ivanov  wrote:
> On recent Qualcomm platforms VBUS and ID lines are not routed to
> USB PHY LINK controller. Use extcon framework to receive connect
> and disconnect ID and VBUS notification.
>
> Signed-off-by: Ivan T. Ivanov 
> ---
> Changes sice v2 [1].
>
> * Simulate IRQ on extcon event - used to trigger OTG state machine.
>
> I have to admit that I couldn't test complete Chipidea OTG state machine,
> because my setup is little weird. I am using "qcom,usb-otg-ci" as PHY/OTG
> provider, "qcom,ehci-host" as host controller driver and "qcom,ci-hdrc" for
> device role.

Ivan,

Do you have patches for the code (presumably pmic code) where the vbus and id
lines are signaled?  Presumably you've added some extcon_set_cable_state() calls
somewhere in your source tree, for this to work.  I'm wondering if you
can share your
work in progress, or let me know when you plan to push that upstream?

I'm interested in testing the msm usb code (specifically host mode support)
on my dragonboard here.

Thanks,
 -- Tim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 1/3] ARM: dts: qcom: Add binding for the qcom coincell charger

2015-07-29 Thread Tim Bird
Greg,

At this point I've got Reviewed-by from Rob on the binding and dts bits,
and Reviewed-by from Andy Gross on the complete patch series (v3).

I believe I've addressed all issues raised. Can you please add this
(v3) to drivers/misc?

Let me know if you want me to re-send anything.

Thanks very much.
 -- Tim


On 07/17/2015 08:42 AM, Rob Herring wrote:
> On Thu, Jul 16, 2015 at 6:55 PM, Tim Bird  wrote:
>> This binding is used to configure the driver for the coincell charger
>> found in Qualcomm PMICs.
>>
>> Signed-off-by: Tim Bird 
> 
> Reviewed-by: Rob Herring 
> 
>> ---
>>
>> Changes in v3:
>>  - change charge-enable property to charger-disable
>> Changes in v2:
>>  - remove 'qcom,' from example node name
>>  - Added reference to parent node pm8941@0 and binding doc for it
>>
>>  .../bindings/power/qcom,coincell-charger.txt   | 48 
>> ++
>>  1 file changed, 48 insertions(+)
>>  create mode 100644 
>> Documentation/devicetree/bindings/power/qcom,coincell-charger.txt
>>
>> diff --git 
>> a/Documentation/devicetree/bindings/power/qcom,coincell-charger.txt 
>> b/Documentation/devicetree/bindings/power/qcom,coincell-charger.txt
>> new file mode 100644
>> index 000..0e6d875
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/power/qcom,coincell-charger.txt
>> @@ -0,0 +1,48 @@
>> +Qualcomm Coincell Charger:
>> +
>> +The hardware block controls charging for a coincell or capacitor that is
>> +used to provide power backup for certain features of the power management
>> +IC (PMIC)
>> +
>> +- compatible:
>> +   Usage: required
>> +   Value type: 
>> +   Definition: must be: "qcom,pm8941-coincell"
>> +
>> +- reg:
>> +   Usage: required
>> +   Value type: 
>> +   Definition: base address of the coincell charger registers
>> +
>> +- qcom,rset-ohms:
>> +   Usage: required
>> +   Value type: 
>> +   Definition: resistance (in ohms) for current-limiting resistor
>> +   must be one of: 800, 1200, 1700, 2100
>> +
>> +- qcom,vset-millivolts:
>> +   Usage: required
>> +   Value type: 
>> +   Definition: voltage (in millivolts) to apply for charging
>> +   must be one of: 2500, 3000, 3100, 3200
>> +
>> +- qcom,charger-disable:
>> +   Usage: optional
>> +   Value type: 
>> +   Definition: definining this property disables charging
>> +
>> +This charger is a sub-node of one of the 8941 PMIC blocks, and is specified
>> +as a child node in DTS of that node.  See ../mfd/qcom,spmi-pmic.txt and
>> +../mfd/qcom-pm8xxx.txt
>> +
>> +Example:
>> +
>> +   pm8941@0 {
>> +   coincell@2800 {
>> +   compatible = "qcom,pm8941-coincell";
>> +   reg = <0x2800>;
>> +
>> +   qcom,rset-ohms = <2100>;
>> +   qcom,vset-millivolts = <3000>;
>> +   };
>> +   };
>> --
>> 1.8.2.2
>>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Bug: shared usb dt document is incorrect

2015-07-29 Thread Tim Bird


On 07/28/2015 07:54 PM, Rob Herring wrote:
> On Tue, Jul 28, 2015 at 8:06 PM, Tim Bird  wrote:
>> Antoine and Rob,
>>
>> I was just doing some testing with USB on a Qualcomm SoC.
>>
>> I followed the instructions in the binding document:
>> Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
>>
>> which has a compatible for "qcom,ci-hdrc", and is, in general,
>> for chipidea-based USB controllers.
>>
>> It says in the document that the property usb-phy is deprecated, and to
>> use phys and phy-names instead.  However, the Qualcomm
>> driver for this still uses usb-phy.  That driver is in:
>> drivers/usb/chipidea/ci_hdrc_msm.c
> 
> Deprecated means it still exists in the wild and should be maintained,
> but don't use it for new dts files.
OK.  But for the Qualcomm driver, the new binding doesn't work (see below).
Since the binding doc specifically says: 'Use "phys" instead [of "usb-phy"].',
it is wrong as currently written, for this controller/phy combination.

>> I'm guessing I should update the Qualcomm driver to use
>> phys and phy-names, but wanted to check with you-all to
>> verify that this is the preferred method of getting
>> phys by phandle now.  It's either change the driver
>> or make an exception in the binding document, I believe.
> 
> That would be fine along with updating the dts files, but the doc
> should remain for some time.

Does this mean I should try phys/phy-names, and if that doesn't work
try usb-phy, for backwards compatibility?

>> I presume I should be changing devm_usb_get_phy_by_phandle()
>> to of_phy_get(), but let me know if there's more to it than that.
> 
> devm_phy_get actually. The driver already supports it. See
> ci_hdrc_probe in core.c.

In my case the probe that is running is ci_hdrc_msm_probe(), in ci_hdrc_msm.c
This probe uses devm_usb_get_phy_by_phandle(..."usb-phy").  If I specify 
phys/phy-names
in my dts, the probe fails silently - leading ultimately to USB not working.
If I specify "usb-phy" in my dts, everything works. In this case, that property
is NOT deprecated.  It's the only one that works.

I don't understand what's going on with the different probe routines and how the
SoC-specific parts interact with the core.  I just know that the kernel 
behaviour
and the binding doc don't match, and I'd like to help fix it if I can.

Thanks for your patience while I try to understand this issue.
 -- Tim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Bug: shared usb dt document is incorrect

2015-07-29 Thread Tim Bird


On 07/28/2015 07:54 PM, Rob Herring wrote:
 On Tue, Jul 28, 2015 at 8:06 PM, Tim Bird tim.b...@sonymobile.com wrote:
 Antoine and Rob,

 I was just doing some testing with USB on a Qualcomm SoC.

 I followed the instructions in the binding document:
 Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt

 which has a compatible for qcom,ci-hdrc, and is, in general,
 for chipidea-based USB controllers.

 It says in the document that the property usb-phy is deprecated, and to
 use phys and phy-names instead.  However, the Qualcomm
 driver for this still uses usb-phy.  That driver is in:
 drivers/usb/chipidea/ci_hdrc_msm.c
 
 Deprecated means it still exists in the wild and should be maintained,
 but don't use it for new dts files.
OK.  But for the Qualcomm driver, the new binding doesn't work (see below).
Since the binding doc specifically says: 'Use phys instead [of usb-phy].',
it is wrong as currently written, for this controller/phy combination.

 I'm guessing I should update the Qualcomm driver to use
 phys and phy-names, but wanted to check with you-all to
 verify that this is the preferred method of getting
 phys by phandle now.  It's either change the driver
 or make an exception in the binding document, I believe.
 
 That would be fine along with updating the dts files, but the doc
 should remain for some time.

Does this mean I should try phys/phy-names, and if that doesn't work
try usb-phy, for backwards compatibility?

 I presume I should be changing devm_usb_get_phy_by_phandle()
 to of_phy_get(), but let me know if there's more to it than that.
 
 devm_phy_get actually. The driver already supports it. See
 ci_hdrc_probe in core.c.

In my case the probe that is running is ci_hdrc_msm_probe(), in ci_hdrc_msm.c
This probe uses devm_usb_get_phy_by_phandle(...usb-phy).  If I specify 
phys/phy-names
in my dts, the probe fails silently - leading ultimately to USB not working.
If I specify usb-phy in my dts, everything works. In this case, that property
is NOT deprecated.  It's the only one that works.

I don't understand what's going on with the different probe routines and how the
SoC-specific parts interact with the core.  I just know that the kernel 
behaviour
and the binding doc don't match, and I'd like to help fix it if I can.

Thanks for your patience while I try to understand this issue.
 -- Tim
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] usb: chipidea: Use extcon framework for VBUS and ID detect

2015-07-29 Thread Tim Bird
On Tue, Jun 2, 2015 at 6:14 AM, Ivan T. Ivanov ivan.iva...@linaro.org wrote:
 On recent Qualcomm platforms VBUS and ID lines are not routed to
 USB PHY LINK controller. Use extcon framework to receive connect
 and disconnect ID and VBUS notification.

 Signed-off-by: Ivan T. Ivanov ivan.iva...@linaro.org
 ---
 Changes sice v2 [1].

 * Simulate IRQ on extcon event - used to trigger OTG state machine.

 I have to admit that I couldn't test complete Chipidea OTG state machine,
 because my setup is little weird. I am using qcom,usb-otg-ci as PHY/OTG
 provider, qcom,ehci-host as host controller driver and qcom,ci-hdrc for
 device role.

Ivan,

Do you have patches for the code (presumably pmic code) where the vbus and id
lines are signaled?  Presumably you've added some extcon_set_cable_state() calls
somewhere in your source tree, for this to work.  I'm wondering if you
can share your
work in progress, or let me know when you plan to push that upstream?

I'm interested in testing the msm usb code (specifically host mode support)
on my dragonboard here.

Thanks,
 -- Tim
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 1/3] ARM: dts: qcom: Add binding for the qcom coincell charger

2015-07-29 Thread Tim Bird
Greg,

At this point I've got Reviewed-by from Rob on the binding and dts bits,
and Reviewed-by from Andy Gross on the complete patch series (v3).

I believe I've addressed all issues raised. Can you please add this
(v3) to drivers/misc?

Let me know if you want me to re-send anything.

Thanks very much.
 -- Tim


On 07/17/2015 08:42 AM, Rob Herring wrote:
 On Thu, Jul 16, 2015 at 6:55 PM, Tim Bird tim.b...@sonymobile.com wrote:
 This binding is used to configure the driver for the coincell charger
 found in Qualcomm PMICs.

 Signed-off-by: Tim Bird tim.b...@sonymobile.com
 
 Reviewed-by: Rob Herring r...@kernel.org
 
 ---

 Changes in v3:
  - change charge-enable property to charger-disable
 Changes in v2:
  - remove 'qcom,' from example node name
  - Added reference to parent node pm8941@0 and binding doc for it

  .../bindings/power/qcom,coincell-charger.txt   | 48 
 ++
  1 file changed, 48 insertions(+)
  create mode 100644 
 Documentation/devicetree/bindings/power/qcom,coincell-charger.txt

 diff --git 
 a/Documentation/devicetree/bindings/power/qcom,coincell-charger.txt 
 b/Documentation/devicetree/bindings/power/qcom,coincell-charger.txt
 new file mode 100644
 index 000..0e6d875
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/power/qcom,coincell-charger.txt
 @@ -0,0 +1,48 @@
 +Qualcomm Coincell Charger:
 +
 +The hardware block controls charging for a coincell or capacitor that is
 +used to provide power backup for certain features of the power management
 +IC (PMIC)
 +
 +- compatible:
 +   Usage: required
 +   Value type: string
 +   Definition: must be: qcom,pm8941-coincell
 +
 +- reg:
 +   Usage: required
 +   Value type: u32
 +   Definition: base address of the coincell charger registers
 +
 +- qcom,rset-ohms:
 +   Usage: required
 +   Value type: u32
 +   Definition: resistance (in ohms) for current-limiting resistor
 +   must be one of: 800, 1200, 1700, 2100
 +
 +- qcom,vset-millivolts:
 +   Usage: required
 +   Value type: u32
 +   Definition: voltage (in millivolts) to apply for charging
 +   must be one of: 2500, 3000, 3100, 3200
 +
 +- qcom,charger-disable:
 +   Usage: optional
 +   Value type: boolean
 +   Definition: definining this property disables charging
 +
 +This charger is a sub-node of one of the 8941 PMIC blocks, and is specified
 +as a child node in DTS of that node.  See ../mfd/qcom,spmi-pmic.txt and
 +../mfd/qcom-pm8xxx.txt
 +
 +Example:
 +
 +   pm8941@0 {
 +   coincell@2800 {
 +   compatible = qcom,pm8941-coincell;
 +   reg = 0x2800;
 +
 +   qcom,rset-ohms = 2100;
 +   qcom,vset-millivolts = 3000;
 +   };
 +   };
 --
 1.8.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Bug: shared usb dt document is incorrect

2015-07-28 Thread Tim Bird
Antoine and Rob,

I was just doing some testing with USB on a Qualcomm SoC.

I followed the instructions in the binding document:
Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt

which has a compatible for "qcom,ci-hdrc", and is, in general,
for chipidea-based USB controllers.

It says in the document that the property usb-phy is deprecated, and to
use phys and phy-names instead.  However, the Qualcomm
driver for this still uses usb-phy.  That driver is in:
drivers/usb/chipidea/ci_hdrc_msm.c

I'm guessing I should update the Qualcomm driver to use
phys and phy-names, but wanted to check with you-all to
verify that this is the preferred method of getting 
phys by phandle now.  It's either change the driver
or make an exception in the binding document, I believe.

I presume I should be changing devm_usb_get_phy_by_phandle()
to of_phy_get(), but let me know if there's more to it than that.

In case I change the driver, do I then update the binding doc
to remove the information about the deprecated property, or not?

Please advise.
 -- Tim

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


  1   2   3   4   >