Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753142AbcCaIRl (ORCPT ); Thu, 31 Mar 2016 04:17:41 -0400 Received: from mga02.intel.com ([134.134.136.20]:46906 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751455AbcCaIRi (ORCPT ); Thu, 31 Mar 2016 04:17:38 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,421,1455004800"; d="asc'?scan'208";a="948624857" From: Felipe Balbi To: Baolin Wang , Jun Li Cc: Peter Chen , Greg KH , Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse , Peter Chen , Alan Stern , "r.baldyga\@samsung.com" , Yoshihiro Shimoda , Lee Jones , Mark Brown , Charles Keepax , "patches\@opensource.wolfsonmicro.com" , Linux PM list , USB , "device-mainlining\@lists.linuxfoundation.org" , LKML Subject: Re: [PATCH v8 0/4] Introduce usb charger framework to deal with the usb gadget power negotation In-Reply-To: References: <20160325070937.GA22398@peterchendt> User-Agent: Notmuch/0.21+96~g9bbc54b (http://notmuchmail.org) Emacs/25.0.90.3 (x86_64-pc-linux-gnu) Date: Thu, 31 Mar 2016 11:15:05 +0300 Message-ID: <87egargj1y.fsf@intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2636 Lines: 65 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi Baolin, Baolin Wang writes: >>> >> Make sense. In our company's solution, charger detection can be done >>> >> by hardware from PMIC at first, then it will not affect the DP/DM >>> >> line when gadget starts to enumeration. >>> > >>> > I see, charger type detection is done automatically by PMIC when VBUS >>> > is detected in your case, you just assume the process is complete >>> > before SW do gadget connect. To make the framework common, you may do >>> one time charger type check when vbus is on, and save it to avoid repeat >>> charger type check. >>> >>> OK. I'll add one judgement to check if the charger type is set in >>> 'usb_charger_detect_type()' function. >> >> Just adding a judgement isn't enough here, your framework should make su= re >> usb_charger_detect_type() is called before gadget connect, with that, the >> existing caller place just gets the charger type from the saved value. >> The real charger type detection done by usb_charger_detect_type() can >> be called only when vbus is on. >> e.g. maybe in usb_udc_vbus_handler() before usb_udc_connect_control(). > > Yeah, Like Felipe suggested, I think we need to introduce one > 'charger_detect()' method to do the SW charger type detection at the > right gadget state. Thanks for your comments. Just to be clear, we add ->charger_detect() when we know of a platform which needs to manually detect the charger type. Until then, we ignore that situation. It might be a good idea, however, do document this in comments on your structure definition stating that if we need to detect charger type, a new method should be added ;-) cheers =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJW/NyKAAoJEIaOsuA1yqREZCcP/2/yTlS9yQQd/rv7RI4+UeYS fLpEqcLSb6rY3os178c47K9e/UpWr2XRcQ+PoZaqGgcIHM4wRd3Rs7RsWrKyZGY4 1VBUOQL2Gz/TnZM/yJwC8uSYvf3NsLHTtPAQpOBnd2n8wwkiSnfnMVvuKxyUgHOS fx6HDIeGVhp61XihTFh4HQ2e+JXsHy7/kT7/vGFHXA6Gk9dTQqj8Hyb+VHAM7J9+ sPmRsHfbCXgXG42Xys76e3z0AdRnyN7hWaRiUu0yJvnhhM53v6qftDxBReX6oiTC aSIe4/uxJjdNe5dieSmE/q9KKX4Apl0VTd84RgzP6iJN8zLHlVQon+bwU5RK6cFr 7PJSDuGwMIIqCshLNWU/HvArvfFOP3rAZxKBxehiGwXJfIaxjl+r+G808wekCrzI CZ47P0gA0loO/KMftQ2z4HapcOoqs8nsdJrKm89rvBjLp4B2NqvmYBedSL5NlNzj Xl7HmrbpQ/b+n43GSeM9Yrr58D2j5wpKIzY2TplYKW/h2IqfLyPcouoU7lffO8U6 6uXJ5cF92kInipt1+ZYp6VJCWyOzG/iIZLS32wkZICyGxfEwV7/JbrHJcw5+prK6 Wvmt2Aqq8d2daNx0Z8uNRbMHRBzsDUs1mpXyuRAxo8lvzWl5uNKurA0oxHlykrDi alo4z99woas9XsdJGxGw =iZLE -----END PGP SIGNATURE----- --=-=-=--