From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761732AbcLSAN0 (ORCPT ); Sun, 18 Dec 2016 19:13:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38016 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752642AbcLSANX (ORCPT ); Sun, 18 Dec 2016 19:13:23 -0500 From: Hans de Goede To: MyungJoo Ham , Chanwoo Choi Cc: linux-kernel@vger.kernel.org, Hans de Goede Subject: [PATCH 6/8] extcon: axp288: Use vbus-valid instead of -present to determine cable presence Date: Mon, 19 Dec 2016 01:13:11 +0100 Message-Id: <20161219001313.13402-6-hdegoede@redhat.com> In-Reply-To: <20161219001313.13402-1-hdegoede@redhat.com> References: <20161219001313.13402-1-hdegoede@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 19 Dec 2016 00:13:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The vbus-present bit in the power status register also gets set to 1 when a usb-host cable (id-pin shorted to ground) is plugged in and a 5v boost converter is supplying 5v to the otg usb bus. This causes a "disconnect or unknown or ID event" warning in dmesg as well as the extcon device to report the last detected charger cable type as being connected even though none is connected. This commit switches to checking the vbus-valid bit instead, which is only 1 when both vbus is present and the vbus-path is enabled in the vbus-path control register (the vbus-path gets disabled when a usb-host cable is detected, to avoid the pmic drawing power from the 5v boost converter). Signed-off-by: Hans de Goede --- drivers/extcon/extcon-axp288.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c index fc636f6..7aec413 100644 --- a/drivers/extcon/extcon-axp288.c +++ b/drivers/extcon/extcon-axp288.c @@ -166,7 +166,7 @@ static int axp288_handle_chrg_det_event(struct axp288_extcon_info *info) return ret; } - vbus_attach = (pwr_stat & PS_STAT_VBUS_PRESENT); + vbus_attach = (pwr_stat & PS_STAT_VBUS_VALID); if (!vbus_attach) { dev_info(info->dev, "vbus/cable disconnected\n"); goto no_vbus; -- 2.9.3