Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751991AbcC3JcT (ORCPT ); Wed, 30 Mar 2016 05:32:19 -0400 Received: from mail-yw0-f174.google.com ([209.85.161.174]:33607 "EHLO mail-yw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751855AbcC3JcR (ORCPT ); Wed, 30 Mar 2016 05:32:17 -0400 MIME-Version: 1.0 In-Reply-To: <20160330091950.GA3195@peterchendt> References: <20160325070937.GA22398@peterchendt> <20160328071351.GC3302@peterchendt> <20160329172314.GZ2350@sirena.org.uk> <20160330020501.GA2740@peterchendt> <20160330074229.GB2740@peterchendt> <20160330091950.GA3195@peterchendt> Date: Wed, 30 Mar 2016 17:32:16 +0800 Message-ID: Subject: Re: [PATCH v8 0/4] Introduce usb charger framework to deal with the usb gadget power negotation From: Baolin Wang To: Peter Chen Cc: Mark Brown , Felipe Balbi , Greg KH , Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse , Peter Chen , Alan Stern , r.baldyga@samsung.com, Yoshihiro Shimoda , Lee Jones , Charles Keepax , patches@opensource.wolfsonmicro.com, Linux PM list , USB , device-mainlining@lists.linuxfoundation.org, LKML Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1892 Lines: 49 On 30 March 2016 at 17:19, Peter Chen wrote: > On Wed, Mar 30, 2016 at 04:40:31PM +0800, Baolin Wang wrote: >> >> > - Third, since composite driver covers 500mA (and more for CDP) after set >> >> > configuration and 2mA after suspend, and vbus handler covers connect >> >> > and disconnect. I can't see any reasons we need to notify gadget state >> >> > for power driver, do we really need to have usb_charger_plug_by_gadget? >> >> >> >> In some solutions, gadget does not negotiate with the current. They >> >> just send out one signal to power driver to set the current when the >> >> gadget state is changed (plugin or not). So we need to check the >> >> charger state by the gadget state to notify the charger IC to set >> >> current. >> >> >> > >> > Would you give some examples? >> >> OK. I explain it in detail. Now charger detection can be from gadget >> itself or PMIC, and we focus on gadget detection. Charger IC (charger >> driver) is separate with gadget. >> When the usb cable is plugin, we need to report the plugin event to >> charger driver to set current after setting configuration for gadget. >> The usb charger is responsible for reporting plugin event to charger >> driver. But how usb charger get the plugin event? It can get the >> plugin event from gadget state (if the gadget state is more than >> 'USB_STATE_ATTACHED', it means one cable plugin). So we need notify >> gadget state to usb charger. >> > > Ok, I see, it only changes current limit at function usb_gadget_vbus_draw > in your patch 2/4. Then, we need to make sure usb_charger_set_cur_limit_by_type > is called before calling usb_gadget_set_state(gadget, USB_STATE_CONFIGURED). That's right. > > It seems you have not implemented usb_charger_plug_by_gadget in your patch set. It is implemented in patch 3/4. > > -- > Best Regards, > Peter Chen -- Baolin.wang Best Regards