Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp618377pxb; Tue, 1 Feb 2022 07:06:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIOuSLB1RWvBjXIInaKeEjsFX4n0e6bHcLYj4I5INBpjoesYwFva4D+p3jZhvCWmOC+30y X-Received: by 2002:a05:6402:50c:: with SMTP id m12mr25490421edv.141.1643728010254; Tue, 01 Feb 2022 07:06:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643728010; cv=none; d=google.com; s=arc-20160816; b=sVUUOJyqoiWYJmDvX9nBygFYmKQFCU2+sPWDe/JwqjjLZJfuBp7tSs0jfA8lKXGulo s6FdcBxgDjo5OSSoVAiPKbSb2bLyq/3H/+Zo+Lbk16xc18ljXieuRcnqKuaNTB/WVJcn jnV7vtAd/kTPTDwIW29E+B6KqMSZ9e52avilwWud/yDqOM7s+tOGdwT0RuOXY54ibW7N 3PQ12KP4F3hCXpSAOTqfeooC6PpNHnxRGzNqT5h4G4zEHDwymXt2PZg0XRog6p4ExBkA i2hdCk61UuP4SVWxYLR0ZFBUiaIcyTxAuNKIo8ChH2FLKEQgpKYTGcdDks6Yss9M4uPQ nO6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=A90HaalXBx1gVGuJBR3n6goMO3ddmchQxDA4Piw5CdM=; b=hHjvCMBXzmfvtAGRpF6oOwOn++cYZbqsxwTQkiY6kH1gMfBZsvtiX9NfvNNRjNdD/2 BWDwbEKmZ50Pu3llTmmJwjo5a2wstL4rysnQAb89p3uSylCvpI057SdHMlQkadtQDH+3 scYQGA14z/JsfWRtMYYbvg/2GCSuSOuudPElzqMYaLfaapIrWk8Q3ZFBDEkTgMqK6eH7 silFll/TgArG2EzLp+78JiXYp0/0v9rJLqyvms2TGyvxKLBd19sx6GRh6u+szjLjHXjI kHoRmI2y7+I1kVUq8vWDFnX/NDYgMGpB0Re9W3JtFesc4A/WXtLDg3Oa0QpiJbGvOF+R mvaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UbuH4vL6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w5si10294562edc.577.2022.02.01.07.06.24; Tue, 01 Feb 2022 07:06:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UbuH4vL6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356374AbiA3Uru (ORCPT + 99 others); Sun, 30 Jan 2022 15:47:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36602 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356355AbiA3Uri (ORCPT ); Sun, 30 Jan 2022 15:47:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643575658; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A90HaalXBx1gVGuJBR3n6goMO3ddmchQxDA4Piw5CdM=; b=UbuH4vL6ugm7QRrXfE7e/UOC0HxlzRI2iG4OZDBNfag2rl5rc0lPtrWBDKm4LB2Ks3xO9o 4NXnp6pkTo2p8OMqklLTIwRYv2cR3qDEE7N8xyoyDM0HZofLYZGdgSSJQcAxzt1p3YRWfq DTWV35pBmpK9aTc7o5e1tkJL51xWBV8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-524-9YUagjr8NeuwZS4pdvgEIQ-1; Sun, 30 Jan 2022 15:47:36 -0500 X-MC-Unique: 9YUagjr8NeuwZS4pdvgEIQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 431681083F60; Sun, 30 Jan 2022 20:47:34 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DB7461093; Sun, 30 Jan 2022 20:47:30 +0000 (UTC) From: Hans de Goede To: "Rafael J . Wysocki" , Mika Westerberg , Mark Gross , Andy Shevchenko , Wolfram Sang , Lee Jones , Sebastian Reichel , MyungJoo Ham , Chanwoo Choi , Ard Biesheuvel Cc: Hans de Goede , Len Brown , linux-acpi@vger.kernel.org, Yauhen Kharuzhy , Tsuchiya Yuto , Fabio Aiuto , platform-driver-x86@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org Subject: [PATCH v4 16/20] extcon: intel-cht-wc: Use new cht_wc_model intel_soc_pmic field Date: Sun, 30 Jan 2022 21:45:53 +0100 Message-Id: <20220130204557.15662-17-hdegoede@redhat.com> In-Reply-To: <20220130204557.15662-1-hdegoede@redhat.com> References: <20220130204557.15662-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The CHT_WC_VBUS_GPIO_CTLO GPIO actually driving an external 5V Vboost converter for Vbus depends on the board on which the Cherry Trail - Whiskey Cove PMIC is actually used. Since the information about the exact PMIC setup is necessary in other places too, struct intel_soc_pmic now has a new cht_wc_model field indicating the board model. Only poke the CHT_WC_VBUS_GPIO_CTLO GPIO if this new field is set to INTEL_CHT_WC_GPD_WIN_POCKET, which indicates the Type-C (with PD and DP-altmode) setup used on the GPD pocket and GPD win; and on which this GPIO actually controls an external 5V Vboost converter. Acked-by: Chanwoo Choi Signed-off-by: Hans de Goede --- Changes in v3: - Use the new cht_wc_model intel_soc_pmic field which replaces the intel_cht_wc_get_model() helper and adjust the commit msg to match --- drivers/extcon/extcon-intel-cht-wc.c | 35 +++++++++++++++++----------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/drivers/extcon/extcon-intel-cht-wc.c b/drivers/extcon/extcon-intel-cht-wc.c index 771f6f4cf92e..81cae8c75850 100644 --- a/drivers/extcon/extcon-intel-cht-wc.c +++ b/drivers/extcon/extcon-intel-cht-wc.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -358,20 +359,26 @@ static int cht_wc_extcon_probe(struct platform_device *pdev) if (IS_ERR(ext->edev)) return PTR_ERR(ext->edev); - /* - * When a host-cable is detected the BIOS enables an external 5v boost - * converter to power connected devices there are 2 problems with this: - * 1) This gets seen by the external battery charger as a valid Vbus - * supply and it then tries to feed Vsys from this creating a - * feedback loop which causes aprox. 300 mA extra battery drain - * (and unless we drive the external-charger-disable pin high it - * also tries to charge the battery causing even more feedback). - * 2) This gets seen by the pwrsrc block as a SDP USB Vbus supply - * Since the external battery charger has its own 5v boost converter - * which does not have these issues, we simply turn the separate - * external 5v boost converter off and leave it off entirely. - */ - cht_wc_extcon_set_5v_boost(ext, false); + switch (pmic->cht_wc_model) { + case INTEL_CHT_WC_GPD_WIN_POCKET: + /* + * When a host-cable is detected the BIOS enables an external 5v boost + * converter to power connected devices there are 2 problems with this: + * 1) This gets seen by the external battery charger as a valid Vbus + * supply and it then tries to feed Vsys from this creating a + * feedback loop which causes aprox. 300 mA extra battery drain + * (and unless we drive the external-charger-disable pin high it + * also tries to charge the battery causing even more feedback). + * 2) This gets seen by the pwrsrc block as a SDP USB Vbus supply + * Since the external battery charger has its own 5v boost converter + * which does not have these issues, we simply turn the separate + * external 5v boost converter off and leave it off entirely. + */ + cht_wc_extcon_set_5v_boost(ext, false); + break; + default: + break; + } /* Enable sw control */ ret = cht_wc_extcon_sw_control(ext, true); -- 2.33.1