Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1113326imm; Wed, 1 Aug 2018 10:23:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfU2oPODYves2siNWR9W7UUF4vd8fqLTVaLpEnhTXq4k7ivNkbnu0cNGKlYvJogMt3eyPpS X-Received: by 2002:a17:902:28a6:: with SMTP id f35-v6mr14361394plb.240.1533144232282; Wed, 01 Aug 2018 10:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144232; cv=none; d=google.com; s=arc-20160816; b=JRbZlbybQkz3FGrVS5G8Nun5pYJKs0bxUCZny94pztmhhrZbacbSPSUK8Yomsho+uM Prlil0JPnrmE9DMZDv3ZwiOG2XvJX00Vxjb1dXk8iO+9aVclmySAAwLDogyL86pmKFkj q9pMK1LCq2p/QYo0Yyxe7LXjAPbJIAx0qDrOx9CjJKIujA6Q9PRHECf0xdCP+RKs8z1T d9LyUEtIAQbrOwMXc7N6CDunUlKVWh7CPdTdn/XRoxl/Wm6ZgjkQ0tpzt4m8wXtvzjKc 9uflBAn3v3ukTgW8Qz9HlIOvc7UEhAzhYghviHWp9bnuBZ+NKHIyj+A9/cTHaklKq2dv FgXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=n44Q+Cslg9XfSoPlU3y5hxyEraPybnJYscv0m/B67pI=; b=T1GdP+gMRaEpAa5LTSmgYzjdchNnoswfh+k1FYCvtd8+Ak7XlYLOy5e3eqzGHnsVtd yk45pimrPV3twkpXywLQ+uOZISA9cBLGMPA0J+9xoqfHrlSOEhEMOx2h4RQOeZdLsXmI XBqUPW8ZfSzMl1xf7OztFymQ6+mlIYDq9dS6rPOXbpofQtaSJKN3dYOdnQ32OAYLlx5E fVcSojwn1zLEyAitK8xYnDc/fpwq0liok0uuANGYCBkBeYwc48yimm9OHekTs+eSX+yw Nb4GKz2pOzllSGBz8KnV4WhtVNZEe5IWkNp0cYhqKf+riGSl7S+i/VwTO8nap6cKWy61 fAOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x32-v6si15189933pld.330.2018.08.01.10.23.38; Wed, 01 Aug 2018 10:23:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405550AbeHATID (ORCPT + 99 others); Wed, 1 Aug 2018 15:08:03 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49334 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405022AbeHATID (ORCPT ); Wed, 1 Aug 2018 15:08:03 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 59F1BCC2; Wed, 1 Aug 2018 17:21:21 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Andy Shevchenko , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.14 152/246] ACPI / LPSS: Only call pwm_add_table() for Bay Trail PWM if PMIC HRV is 2 Date: Wed, 1 Aug 2018 18:51:02 +0200 Message-Id: <20180801165019.017997033@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hans de Goede [ Upstream commit c975e472ec12392a0c34de1350e634310f8a1dea ] The Point of View mobii wintab p800w Bay Trail tablet comes with a Crystal Cove PMIC, yet uses the LPSS PWM for backlight control, rather then the Crystal Cove's PWM, so we need to call pwm_add_table() to add a pwm_backlight mapping for the LPSS pwm despite there being an INT33FD ACPI device present. On all Bay Trail devices the _HRV object of the INT33FD ACPI device will normally return 2, to indicate the Bay Trail variant of the CRC PMIC is present, except on this tablet where _HRV is 0xffff. I guess this is a hack to make the windows Crystal Cove PWM driver not bind. Out of the 44 DSTDs with an INT33FD device in there which I have (from different model devices) only the pov mobii wintab p800w uses 0xffff for the HRV. The byt_pwm_setup code calls acpi_dev_present to check for the presence of a INT33FD ACPI device which indicates that a CRC PMIC is present and if the INT33FD ACPI device is present then byt_pwm_setup will not add a pwm_backlight mapping for the LPSS pwm, so that the CRC PWM will get used instead. acpi_dev_present has a hrv parameter, this commit make us pass 2 instead of -1, so that things still match on normal tablets, but on this special case with its _HRV of 0xffff, the check will now fail so that the pwm_backlight mapping for the LPSS pwm gets added fixing backlight brightness control on this device. Signed-off-by: Hans de Goede Reviewed-by: Andy Shevchenko Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/acpi_lpss.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c @@ -69,6 +69,10 @@ ACPI_MODULE_NAME("acpi_lpss"); #define LPSS_SAVE_CTX BIT(4) #define LPSS_NO_D3_DELAY BIT(5) +/* Crystal Cove PMIC shares same ACPI ID between different platforms */ +#define BYT_CRC_HRV 2 +#define CHT_CRC_HRV 3 + struct lpss_private_data; struct lpss_device_desc { @@ -162,7 +166,7 @@ static void byt_pwm_setup(struct lpss_pr if (!adev->pnp.unique_id || strcmp(adev->pnp.unique_id, "1")) return; - if (!acpi_dev_present("INT33FD", NULL, -1)) + if (!acpi_dev_present("INT33FD", NULL, BYT_CRC_HRV)) pwm_add_table(byt_pwm_lookup, ARRAY_SIZE(byt_pwm_lookup)); }