Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9083853pxu; Mon, 28 Dec 2020 06:14:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXwvHd0nKBgLsV5vmdLbtZOG1gwbU9wWYH/i1+hyLZ+hOWjrdO2YZIV4YYOf1gNAVWhIpY X-Received: by 2002:a17:906:358c:: with SMTP id o12mr34784539ejb.301.1609164881972; Mon, 28 Dec 2020 06:14:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609164881; cv=none; d=google.com; s=arc-20160816; b=hCF2yJ96fxtFqNvARjFkE7FRfp+fZ/IOOBgx6/MB0o8Klr8uZoPr0/c6CEGplMSO+e ULSRWqu4IRyYRXOqklXJER119s+rwntNyTb+z1iEA0n9GKdqoxZshTAR/gvk5io6CVFO YMB1DbT6Tc7WiALZWkBiZUPHCHwK7u1tfcWkILiuOMVg9I54VwB2e578qpJj5M1uejbV y7xHO/Onv7bcflDq9Q3O8A2kpo+Zpw60GVyG1DiRu+3o3O8zA4ilrOVfGtdQxY+eP3/9 MwCS4LN1UTGNsOA9wIwRRCMeW12145tI516423wO6RZO9GPCOw/DVF2NzMGkqi9dvQ0C KFrg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=I0mjSOryaUlXE6wF0OPCPFDLWev1QsDopezo+oP6JbE=; b=K5CBKFn88wKlu9y36o9L6lGt30FEax1aahJVyIRxc3iAtiO1A/P1E341aX8tUhNLHz /nmld7D5PnB/nffDfWu4A/uao+uVyYJKgmezzDxjqVkXqZ6aNJ7MY0P+v0gwOAYOELZM T13z+OHjiNUa1lNFcWLF87qFLTvQ3dQUN+AdCZxnbv/yzggGe0gPifDEfmEQ26T2davt 5CkZzgKHg0IqC7Sn8XHKbUeuB9vuPugkTjUuK1ACUkUhwzYpPCGvRsb+0pv85Mjg9Cg/ jvdaRndS6HM1CZ0eyWxiUpY+hDJ39Oxv3NKk2okOKk0sQ3iVuTIa614GFBWqlhRdYF5a E6qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fE6I+sxk; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de8si20461479edb.319.2020.12.28.06.14.18; Mon, 28 Dec 2020 06:14:41 -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=@linuxfoundation.org header.s=korg header.b=fE6I+sxk; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439121AbgL1OKq (ORCPT + 99 others); Mon, 28 Dec 2020 09:10:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:45102 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439077AbgL1OKj (ORCPT ); Mon, 28 Dec 2020 09:10:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D30BB208B3; Mon, 28 Dec 2020 14:09:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164599; bh=wwpa5s9xi/prcgth2or2y3XphmPJyV5G2xNHZiy0+78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fE6I+sxkP5tRTSK9uT522C7yQklSWlGfN+NIoLWuFYp2AqRoIfZzhzyfxuQSru0Vj I8MZzbsTlW3ajb6Mc0v0PNracJj1VtgXU2dYimb6OpsLEmivSnKSXOQAyaKouHzSk3 uAHs4rIWOAUUJdI/dSRTSWui/CEHgNPdb0y2ic2U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Sebastian Reichel , Sasha Levin Subject: [PATCH 5.10 231/717] power: supply: axp288_charger: Fix HP Pavilion x2 10 DMI matching Date: Mon, 28 Dec 2020 13:43:49 +0100 Message-Id: <20201228125032.056579966@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede [ Upstream commit a0f1ccd96c7049377d892a4299b6d5e47ec9179d ] Commit 9c80662a74cd ("power: supply: axp288_charger: Add special handling for HP Pavilion x2 10") added special handling for HP Pavilion x2 10 models which use the weird combination of a Type-C connector and the non Type-C aware AXP288 PMIC. This special handling was activated by a DMI match a the product-name of "HP Pavilion x2 Detachable". Recently I've learned that there are also older "HP Pavilion x2 Detachable" models with an AXP288 PMIC + a micro-usb connector where we should not activate the special handling for the Type-C connectors. Extend the matching to also match on the DMI board-name and match on the 2 boards (one Bay Trail based one Cherry Trail based) of which we are certain that they use the AXP288 + Type-C connector combination. Note the DSDT code from these older (AXP288 + micro-USB) models contains some AML code (which never runs under Linux) which reads the micro-USB connector id-pin and if it is pulled to ground, which would normally mean the port is in host mode!, then it sets the input-current-limit to 3A, it seems HP is using the micro-USB port as a charging only connector and identifies their own 3A capable charger though this hack which is a major violation of the USB specs. Note HP also hardcodes a 2A limit when the id-pin is not pulled to ground, which is also in violation of the specs. I've no intention to add support for HP's hack to support 3A charging on these older models. By making the DMI matches for the Type-C equipped models workaround more tighter, these older models will be treated just like any other AXP288 + micro-USB equipped device and the input-current limit will follow the BC 1.2 spec (using the defacto standard values there where the BC 1.2 spec defines a range). Fixes: 9c80662a74cd ("power: supply: axp288_charger: Add special handling for HP Pavilion x2 10") BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1896924 Signed-off-by: Hans de Goede Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/power/supply/axp288_charger.c | 28 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c index 9d981b76c1e72..a4df1ea923864 100644 --- a/drivers/power/supply/axp288_charger.c +++ b/drivers/power/supply/axp288_charger.c @@ -548,14 +548,15 @@ out: /* * The HP Pavilion x2 10 series comes in a number of variants: - * Bay Trail SoC + AXP288 PMIC, DMI_BOARD_NAME: "815D" - * Cherry Trail SoC + AXP288 PMIC, DMI_BOARD_NAME: "813E" - * Cherry Trail SoC + TI PMIC, DMI_BOARD_NAME: "827C" or "82F4" + * Bay Trail SoC + AXP288 PMIC, Micro-USB, DMI_BOARD_NAME: "8021" + * Bay Trail SoC + AXP288 PMIC, Type-C, DMI_BOARD_NAME: "815D" + * Cherry Trail SoC + AXP288 PMIC, Type-C, DMI_BOARD_NAME: "813E" + * Cherry Trail SoC + TI PMIC, Type-C, DMI_BOARD_NAME: "827C" or "82F4" * - * The variants with the AXP288 PMIC are all kinds of special: + * The variants with the AXP288 + Type-C connector are all kinds of special: * - * 1. All variants use a Type-C connector which the AXP288 does not support, so - * when using a Type-C charger it is not recognized. Unlike most AXP288 devices, + * 1. They use a Type-C connector which the AXP288 does not support, so when + * using a Type-C charger it is not recognized. Unlike most AXP288 devices, * this model actually has mostly working ACPI AC / Battery code, the ACPI code * "solves" this by simply setting the input_current_limit to 3A. * There are still some issues with the ACPI code, so we use this native driver, @@ -578,12 +579,17 @@ out: */ static const struct dmi_system_id axp288_hp_x2_dmi_ids[] = { { - /* - * Bay Trail model has "Hewlett-Packard" as sys_vendor, Cherry - * Trail model has "HP", so we only match on product_name. - */ .matches = { - DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"), + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"), + DMI_EXACT_MATCH(DMI_BOARD_NAME, "815D"), + }, + }, + { + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "HP"), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"), + DMI_EXACT_MATCH(DMI_BOARD_NAME, "813E"), }, }, {} /* Terminating entry */ -- 2.27.0