Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp618665pxb; Tue, 1 Feb 2022 07:07:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzBFwDEvueG/zhChyys2prF3QOn35lfNBKY0DHpv1ju706Cr2UQDkjf2SUM5x/cU5RGwRgI X-Received: by 2002:a17:907:9603:: with SMTP id gb3mr8981035ejc.98.1643728026726; Tue, 01 Feb 2022 07:07:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643728026; cv=none; d=google.com; s=arc-20160816; b=LqGndsaGk+eCK7o9IrBDsPc8DtkyY5wBSv8KhsiVEw2w00HQtJ29k4pgxbdsOoYfjO WraXi6GF0CKvOQirnFkjxJsSmj6uYBhSpZ7ESOKQa78bB6AekAVsAiwCoa11ZP8eRbTB PzxsYfKu4MaRDKZoQYNs2EB3c1sdE54U8NJRDDRbTDC4axPP9K4yHP1hkP6Ou5fkPnji wsHcvx03Q74Fv9pbjb9nXFEMQ2rgt0xX4PkSfyHo7oYYxm1suq60XtFsoKC1rys5+zyE mctjxhJ/En0XpPg0RO/78j/EP/xh1waDdjLJC9MdhbKE3UIbA1g0zEIuwqJ+kpx4z9ar NjGg== 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=LamNEK/YX9d4yqutYB371mhhnNQ/iRuKdSAUJRRVPa4=; b=qDPTw2PtgAJtEdp+BwCHYhrzXp2z8ZKtokH7ijTmqtwsokIBuU6VhbcbtqlVAxWBbI G67Q5TEM8lGIIBt3yzvcWQgrHE9JwG9fb3fta+QllcNDQeIFFDgTJCwI+7Jl8eR3sjPz HY+HDtOiuQUzXGg+5RyJam/M6WnkYiwPVaryTkEBn2A/U2M3zXPHZ4e5ecaB/g3ri3Hb PTkcF1qw9GCc9v6YHEYlOaZ7YkZpmHYiNq2DmJrB8pGAy/MGxQyDScu12mnXl+avhHBw WOIiqTp7bKGuDEW1e+cRr0dM8nAybolvxhpyltDAJVPAwOAz72aKAJrODO+jbQZB/Alt PpDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PUvHj87l; 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 go40si9599374ejc.185.2022.02.01.07.06.40; Tue, 01 Feb 2022 07:07:06 -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=PUvHj87l; 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 S1356386AbiA3UsX (ORCPT + 99 others); Sun, 30 Jan 2022 15:48:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:27256 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356419AbiA3UsB (ORCPT ); Sun, 30 Jan 2022 15:48:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643575680; 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=LamNEK/YX9d4yqutYB371mhhnNQ/iRuKdSAUJRRVPa4=; b=PUvHj87lNJVhxPh57NZ556hC/x1s2ekN9/NbhnC2y5KncsSeFxQ004Uvh0ih3TlftFTd5k +SBcrOvTKBWxX6aGx4OgyyulqWxwHM6S6u+apxCnZRviSA6lgBZNiE+ZFvp/HBRI7SZflZ Om9XWrCuwwknD8Gb3tFuGsaoCCXyu6I= 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-445-QBa4bKeKPgeBJ39eD09GAg-1; Sun, 30 Jan 2022 15:47:55 -0500 X-MC-Unique: QBa4bKeKPgeBJ39eD09GAg-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 AEE2A1083F65; Sun, 30 Jan 2022 20:47:52 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id C386361093; Sun, 30 Jan 2022 20:47:46 +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 20/20] extcon: intel-cht-wc: Report RID_A for ACA adapters Date: Sun, 30 Jan 2022 21:45:57 +0100 Message-Id: <20220130204557.15662-21-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 Make cht_wc_extcon_get_id() report RID_A for ACA adapters, instead of reporting ID_FLOAT. According to the spec. we should read the USB-ID pin ADC value to determine the resistance of the used pull-down resister and then return RID_A / RID_B / RID_C based on this. But all "Accessory Charger Adapter"s (ACAs) which users can actually buy always use a combination of a charging port with one or more USB-A ports, so they should always use a resistor indicating RID_A. But the spec is hard to read / badly-worded so some of them actually indicate they are a RID_B ACA even though they clearly are a RID_A ACA. To workaround this simply always return INTEL_USB_RID_A, which matches all the ACAs which users can actually buy. Acked-by: Chanwoo Choi Signed-off-by: Hans de Goede --- drivers/extcon/extcon-intel-cht-wc.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/extcon/extcon-intel-cht-wc.c b/drivers/extcon/extcon-intel-cht-wc.c index 144cb5d8cd47..2a8d41cbf41c 100644 --- a/drivers/extcon/extcon-intel-cht-wc.c +++ b/drivers/extcon/extcon-intel-cht-wc.c @@ -121,13 +121,21 @@ static int cht_wc_extcon_get_id(struct cht_wc_extcon_data *ext, int pwrsrc_sts) return INTEL_USB_ID_GND; case CHT_WC_PWRSRC_RID_FLOAT: return INTEL_USB_ID_FLOAT; + /* + * According to the spec. we should read the USB-ID pin ADC value here + * to determine the resistance of the used pull-down resister and then + * return RID_A / RID_B / RID_C based on this. But all "Accessory + * Charger Adapter"s (ACAs) which users can actually buy always use + * a combination of a charging port with one or more USB-A ports, so + * they should always use a resistor indicating RID_A. But the spec + * is hard to read / badly-worded so some of them actually indicate + * they are a RID_B ACA evnen though they clearly are a RID_A ACA. + * To workaround this simply always return INTEL_USB_RID_A, which + * matches all the ACAs which users can actually buy. + */ case CHT_WC_PWRSRC_RID_ACA: + return INTEL_USB_RID_A; default: - /* - * Once we have IIO support for the GPADC we should read - * the USBID GPADC channel here and determine ACA role - * based on that. - */ return INTEL_USB_ID_FLOAT; } } -- 2.33.1