Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4394159ybl; Sat, 21 Dec 2019 05:56:18 -0800 (PST) X-Google-Smtp-Source: APXvYqzBlGbbW5RY9itrWz55u4N04Q0xOvQtcnc+EpbErU8U4f0GYWKRiHIB/2WmSU+y17QEzgG2 X-Received: by 2002:a05:6830:689:: with SMTP id q9mr14127034otr.285.1576936577864; Sat, 21 Dec 2019 05:56:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576936577; cv=none; d=google.com; s=arc-20160816; b=xrzuFw3uKC4eL5ac6v+n18qPMRvIMy75fYys/j8djbjpjw9TikF1FRczSO5fzJaI5X MBjSLyRXW3HofNnZimS/6pMJSKtVZzfsYRhQXpEvhu/jvXz4qlDK43wtdcdQyDkw90W6 9UqOdxwK9VyofB0QAqc8brLsk7Ji8SjNYhqzBck7UM+7icGYpsaulbOiqAEJPgkxE4ne 69cr6rOHxZsfC+A4zmV2c0arBgFbjChNula/Da7BFuONXskuJQ37S5S8Om6xAnzRdQB1 4Ts/jz068KRUyEPVs0EagGY1wMgTm90bI6pt125dbVL0djpmMesUE87rMTEy5xKzzRMI wJ9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:cc:to:subject:from:date :dkim-signature; bh=HMr5tq4u/iCVvyge/KXZh59ydoLu25ejT807wqisIzA=; b=R3aLMJDTdm3o+Ig5PzAQ4gMNKbv/QY8BE6ZsUie0kur4uXgIyL06rRkRhdCza0+NcR 5IT8l/IeEtm7EtV8pF2e/0XcM+30cTAhlnpQEkB7LpbXDqHE9htH4s15vBlpTEbC1ICv vCNJXFHIOQZ+77td8zVq9GoI5l32qi0O84r4Ie3vBd4bXrpAu45M3zbFmLQkU5gfb5g4 uHgrAPNBXZ+a5IPIikNW1MlWt0zHX8VkAf65RbkCeNKBAcA3kFaE90R/4/crrlM5AJ/E z9+5b6FK8VAsUz/YLEC2EiSk048RTBcKtt4Y3wBx9HW7Txh0oC7P0hMso0JUdpr6yfGq cnsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=HyOld4Tt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l2si6100648oif.170.2019.12.21.05.56.07; Sat, 21 Dec 2019 05:56:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=HyOld4Tt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726885AbfLUNzX (ORCPT + 99 others); Sat, 21 Dec 2019 08:55:23 -0500 Received: from outils.crapouillou.net ([89.234.176.41]:40934 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726339AbfLUNzX (ORCPT ); Sat, 21 Dec 2019 08:55:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1576936520; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HMr5tq4u/iCVvyge/KXZh59ydoLu25ejT807wqisIzA=; b=HyOld4TtSERwF3mEIs/pjgsZBfBqqCQ2mJmCJx0PzMsuFfxi3hE2G1dF4NlTMuyuawTF+a k9NUL7kh/DBUILojk1HHYITwJSbxaJ67CmdOEXnoom/dCZ/fkJJYaRDmeiYOE64dmen4S4 8V3HIfF2wgz54mJtpZJx/kFqgFsyOFs= Date: Sat, 21 Dec 2019 14:55:14 +0100 From: Paul Cercueil Subject: Re: [PATCH v2 3/3] power/supply: Add generic USB charger driver To: Rob Herring Cc: Peter Chen , Sebastian Reichel , Mark Rutland , Greg Kroah-Hartman , od@zcrc.me, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Message-Id: <1576936514.3.0@crapouillou.net> In-Reply-To: <20191219213845.GA3481@bogus> References: <20191211155032.167032-1-paul@crapouillou.net> <20191211155032.167032-3-paul@crapouillou.net> <20191212091814.GA7035@b29397-desktop> <1576270147.3.0@crapouillou.net> <1576493525.3.0@crapouillou.net> <20191219213845.GA3481@bogus> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rob, Le jeu., d=E9c. 19, 2019 at 13:38, Rob Herring a=20 =E9crit : > On Mon, Dec 16, 2019 at 11:52:05AM +0100, Paul Cercueil wrote: >> Hi Peter, >>=20 >>=20 >> Le lun., d=E9c. 16, 2019 at 01:24, Peter Chen a=20 >> =E9crit : >> > >> > > >> + >> > > >> + desc =3D &charger->desc; >> > > >> + desc->name =3D "usb-charger"; >> > > >> + desc->properties =3D usb_charger_properties; >> > > >> + desc->num_properties =3D=20 >> ARRAY_SIZE(usb_charger_properties); >> > > >> + desc->get_property =3D usb_charger_get_property; >> > > >> + desc->type =3D POWER_SUPPLY_TYPE_USB; >> > > > >> > > > What's your further plan for this generic USB charger? >> > > > To support BC1.2, we need to know charger type, and how we=20 >> could >> > > get >> > > > it? >> > > > >> > > > Peter >> > > >> > > Well I don't really know. The USB role framework does not give=20 >> any >> > > info about >> > > what's plugged. >> > > >> > >> > What's the use case for this patch set? How it be used? >>=20 >> My devicetree: >>=20 >> usb_otg: usb@13440000 { >> compatible =3D "ingenic,jz4770-musb", "simple-mfd"; >> reg =3D <0x13440000 0x10000>; >> [...] >>=20 >> usb-role-switch; >>=20 >> connector { >> compatible =3D "gpio-usb-b-connector", "usb-b-connector"; >> label =3D "mini-USB"; >> type =3D "mini"; >>=20 >> id-gpios =3D <&gpf 18 GPIO_ACTIVE_HIGH>; >> vbus-gpios =3D <&gpb 5 GPIO_ACTIVE_HIGH>; >> [...] >> }; >>=20 >> usb_charger: usb-charger { >> compatible =3D "usb-charger"; >=20 > What h/w device is this? GCW Zero: arch/mips/boot/dts/ingenic/gcw0.dts Most of it isn't upstream, so I can still experiment things to get the=20 perfect devicetree. >=20 >> }; >> }; >>=20 >> The new gpio-usb-connector driver uses the ID/VBUS GPIOs to detect=20 >> in which >> state (device, host, unconnected) a OTG connector is. However, that=20 >> means I >> cannot use the standard gpio-charger driver to detect the presence=20 >> of a >> charger based on the state of the VBUS gpio, since it's already=20 >> requested >> here. So the point of this patchset is to provide an alternative to >> gpio-charger that works with OTG controllers compatible with >> 'usb-role-switch'. >=20 > Why not fix gpio-charger or make whatever 'owns' vbus-gpios to=20 > register > a charger device? I see there is a GPIOD_FLAGS_BIT_NONEXCLUSIVE bit that could be used,=20 I'll have a look. Thanks, -Paul >=20 > I guess you could have Vbus sensing with no charging capability, but > that sounds like a new property, not a node to me. >=20 > Rob =