Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9267817pxu; Mon, 28 Dec 2020 10:55:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJznBcT12F3oD8yzrL0/bDRwAUiXd/aySShp9Xi+U3kf2ZDvZalzuqVGt92S8m1iXitlVQFt X-Received: by 2002:a17:906:c414:: with SMTP id u20mr41988074ejz.511.1609181707743; Mon, 28 Dec 2020 10:55:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609181707; cv=none; d=google.com; s=arc-20160816; b=JU0QvOId7ixFOu0SnRxtYABOd1DMNsO8WfkKyIkNUrErR/JeByxdgvhfFNgMdh0LOa dMM177uDdRpbw1qFABpe3kpcgo8MCZuaOdRgXSlJi1cfRnFoVyDD68SqcUvwDNrgARjA j+LcShrVf4+6edLYsRs1m/SKurx2zhnuugFs3r2yCPC5twrNbwjre56Lw8xvA9c55Fmr AKTEq0dpg3juenn7VGSOP44SSg3DniEpkDqNFLw7Ahq4Z6FGBIkYDwEaSkxX5qr6EbtN arTrlYcLlmXFhUmkTT1snpIpvWRp2GwaTDO+2YNzT4QxmElgTF3lFO2BEBnGVZfmtyPi r4nQ== 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=8lYaaMjIAMgg0oww1j/eGtlL+ic7ziMJE3X66tC3oYo=; b=oOjzjrH/dEd6kzQPxt2CDnxCuoj33aAsAdOOKZZklJAHOsQZRWOlAYG2mBRrLX1lYr o9MBRTLPdG2oV/zO3MbbJDbZ8V54/dqM55i04uSEKPwF3j4CB82nJeD5rr6bi6O8+Ay9 x6WqSIU1L9uHMRga43YgWDynqF+iTmsMfsH+Tfq6yAbP/5D6jTumk+NW5TY4VhepL27X 4i84Wva1YTNh7C7Um1Hyp9F/gZ8+CJEHfCvy4W61a/Mk7lJEXwHQocoWdjPJaRLduI1u RS0tQeNWWzxXDFf9txOeXpdzMPXZSclJ7nwS3J/mOLNRpzsgonQbLVSaDWl5cUDGaVBl WL/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rMAf81yj; 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 dm3si20563264edb.547.2020.12.28.10.54.45; Mon, 28 Dec 2020 10:55:07 -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=rMAf81yj; 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 S2404306AbgL1Nqg (ORCPT + 99 others); Mon, 28 Dec 2020 08:46:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:46524 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404941AbgL1Npv (ORCPT ); Mon, 28 Dec 2020 08:45:51 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 583C122AAA; Mon, 28 Dec 2020 13:45:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609163136; bh=+OeI2MeOOdSPbMPqfOX5Tf6VczmeQmyz4whiJee9RU8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rMAf81yj7pdvBqDFXusC75roycJv3BU2zm8H/gH4dO373PT1QPXp+fOJmgXQth1R/ ai+WGAamzlEBN1jAoRqobZ+zc4owPk8xk65mnidYCUX5ybO7VMRCZLKWsNRWWyBADu v0kGruLXZsp+aSCac4tGUDBI688H80hnZu5q5kLI= 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.4 183/453] power: supply: axp288_charger: Fix HP Pavilion x2 10 DMI matching Date: Mon, 28 Dec 2020 13:46:59 +0100 Message-Id: <20201228124946.013531767@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124937.240114599@linuxfoundation.org> References: <20201228124937.240114599@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 cf4c67b2d2359..7d09e49f04d3b 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