From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752081AbeANPKd (ORCPT + 1 other); Sun, 14 Jan 2018 10:10:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59758 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751819AbeANPKZ (ORCPT ); Sun, 14 Jan 2018 10:10:25 -0500 From: Hans de Goede To: MyungJoo Ham , Chanwoo Choi , Chen-Yu Tsai Cc: Hans de Goede , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] extcon: axp288: Only reschedule charger-detection at boot when a SDP is detected Date: Sun, 14 Jan 2018 16:10:21 +0100 Message-Id: <20180114151021.11432-2-hdegoede@redhat.com> In-Reply-To: <20180114151021.11432-1-hdegoede@redhat.com> References: <20180114151021.11432-1-hdegoede@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sun, 14 Jan 2018 15:10:25 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: The only misdetection which can happen at boot due to data-lines mux issues is detecting a non SDP as SDP, so we only need to retry if we detect a SDP on our first detection. Note Vbus misdetection is not a problem, as soon as the drivers controlling the Vbus path set it correctly we will get an interrupt which reschedules the charger-detection. Also update the comment about the re-detection to reflect this. Signed-off-by: Hans de Goede --- drivers/extcon/extcon-axp288.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c index 63b99d5becd7..17e6808af0d1 100644 --- a/drivers/extcon/extcon-axp288.c +++ b/drivers/extcon/extcon-axp288.c @@ -161,16 +161,16 @@ static void axp288_chrg_detect_complete(struct axp288_extcon_info *info, /* * We depend on other drivers to do things like mux the data lines, * enable/disable vbus based on the id-pin, etc. Sometimes the BIOS has - * not set these things up correctly resulting in the initial charger - * cable type detection giving a wrong result and we end up not charging - * or charging at only 0.5A. + * not set these things up correctly resulting in a wrong result for the + * initial charger type detection and we end up charging at only 0.5A. * - * So we schedule a second cable type detection after 2 seconds to - * give the other drivers time to load and do their thing. + * If our first detect detects an SDP charger-type, we try again after + * 2 seconds to give the other drivers time to load and do their thing. */ if (!info->first_detect_done) { - queue_delayed_work(system_wq, &info->det_work, - msecs_to_jiffies(2000)); + if (info->previous_cable == EXTCON_CHG_USB_SDP) + queue_delayed_work(system_wq, &info->det_work, + msecs_to_jiffies(2000)); info->first_detect_done = true; } -- 2.14.3