linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Sebastian Reichel <sre@kernel.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	David Woodhouse <dwmw2@infradead.org>,
	Felipe Balbi <balbi@ti.com>,
	GTA04 owners <gta04-owner@goldelico.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH 2/2] twl4030_charger: find associated phy by more reliable means.
Date: Wed, 4 Mar 2015 20:14:31 +1100	[thread overview]
Message-ID: <20150304201431.0fc6c108@notabene.brown> (raw)
In-Reply-To: <20150225211351.GH13695@earth>

[-- Attachment #1: Type: text/plain, Size: 2684 bytes --]

On Wed, 25 Feb 2015 22:13:51 +0100 Sebastian Reichel <sre@kernel.org> wrote:

> Hi Neil,
> 
> On Tue, Feb 24, 2015 at 03:01:29PM +1100, NeilBrown wrote:
> > twl4030_charger currently finds the associated phy
> > using usb_get_phy() which will return the first USB2 phy.
> > If your platform has multiple such phys (as mine does),
> > this is not reliable (and reliably fails on the GTA04).
> > 
> > Change to use devm_usb_get_phy_by_node(), having found the
> > node by looking for an appropriately named sibling in
> > device-tree.
> > 
> > This makes usb-charging dependent on correct device-tree
> > configuration.
> 
> The patch looks ok to me, but you should update the DT documentation
> in Documentation/devicetree/bindings/power/twl-charger.txt regarding
> the sibling dependency.
> 
> Apart from that DT binding maintainers should be CC'd.
> 
> -- Sebastian

Thanks.
I've added the following.  I've also changed the code to use
of_find_compatible_node() and find the USB phy based on 'compatible' rather
than on the node name.

I'll Cc DT maintainers when I resubmit.

Thanks,
NeilBrown

diff --git a/Documentation/devicetree/bindings/power/twl-charger.txt b/Documentation/devicetree/bindings/power/twl-charger.txt
index d5c706216df5..3b4ea1b73b38 100644
--- a/Documentation/devicetree/bindings/power/twl-charger.txt
+++ b/Documentation/devicetree/bindings/power/twl-charger.txt
@@ -1,5 +1,15 @@
 TWL BCI (Battery Charger Interface)
 
+The battery charger needs to interact with the USB phy in order
+to know when charging is permissible, and when there is a connection
+or disconnection.
+
+The choice of phy cannot be configured at a hardware level, so there
+is no value in explicit configuration in device-tree.  Rather
+if there is a sibling of the BCI node which is compatible with
+"ti,twl4030-usb", then that is used to determine when and how
+use USB power for charging.
+
 Required properties:
 - compatible:
   - "ti,twl4030-bci"
diff --git a/Documentation/devicetree/bindings/usb/twlxxxx-usb.txt b/Documentation/devicetree/bindings/usb/twlxxxx-usb.txt
index 0aee0ad3f035..17327a296110 100644
--- a/Documentation/devicetree/bindings/usb/twlxxxx-usb.txt
+++ b/Documentation/devicetree/bindings/usb/twlxxxx-usb.txt
@@ -30,6 +30,9 @@ TWL4030 USB PHY AND COMPARATOR
  - usb_mode : The mode used by the phy to connect to the controller. "1"
    specifies "ULPI" mode and "2" specifies "CEA2011_3PIN" mode.
 
+If a sibling node is compatible "ti,twl4030-bci", then it will find
+this device and query it for USB power status.
+
 twl4030-usb {
 	compatible = "ti,twl4030-usb";
 	interrupts = < 10 4 >;

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

  reply	other threads:[~2015-03-04  9:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24  4:01 [PATCH 0/2] Allow twl4030_charger to find phy reliably NeilBrown
2015-02-24  4:01 ` [PATCH 2/2] twl4030_charger: find associated phy by more reliable means NeilBrown
2015-02-25 21:13   ` Sebastian Reichel
2015-03-04  9:14     ` NeilBrown [this message]
2015-02-24  4:01 ` [PATCH 1/2] usb: phy: Add interface to get phy give of device_node NeilBrown
2015-03-02 21:05 ` [PATCH 0/2] Allow twl4030_charger to find phy reliably Pavel Machek
2015-03-22 22:52 NeilBrown
2015-03-22 22:52 ` [PATCH 2/2] twl4030_charger: find associated phy by more reliable means NeilBrown
2015-05-08 16:12   ` Felipe Balbi
2015-05-17  9:56     ` Sebastian Reichel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150304201431.0fc6c108@notabene.brown \
    --to=neilb@suse.de \
    --cc=balbi@ti.com \
    --cc=dbaryshkov@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gta04-owner@goldelico.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).