From patchwork Wed Mar 4 09:14:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 5934251 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3209FBF440 for ; Wed, 4 Mar 2015 09:15:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8E4A92024F for ; Wed, 4 Mar 2015 09:15:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CDBAB20212 for ; Wed, 4 Mar 2015 09:15:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932874AbbCDJOv (ORCPT ); Wed, 4 Mar 2015 04:14:51 -0500 Received: from cantor2.suse.de ([195.135.220.15]:49865 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932843AbbCDJOq (ORCPT ); Wed, 4 Mar 2015 04:14:46 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1FCC7ABED; Wed, 4 Mar 2015 09:14:44 +0000 (UTC) Date: Wed, 4 Mar 2015 20:14:31 +1100 From: NeilBrown To: Sebastian Reichel Cc: Dmitry Eremin-Solenikov , Greg Kroah-Hartman , David Woodhouse , Felipe Balbi , GTA04 owners , 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. Message-ID: <20150304201431.0fc6c108@notabene.brown> In-Reply-To: <20150225211351.GH13695@earth> References: <20150224035809.32252.4180.stgit@notabene.brown> <20150224040129.32252.59874.stgit@notabene.brown> <20150225211351.GH13695@earth> X-Mailer: Claws Mail 3.10.1-162-g4d0ed6 (GTK+ 2.24.25; x86_64-suse-linux-gnu) MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, 25 Feb 2015 22:13:51 +0100 Sebastian Reichel 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 >;