From nobody Thu Sep 4 03:30:04 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26AAFC54EE9 for ; Tue, 13 Sep 2022 15:06:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235332AbiIMPGL (ORCPT ); Tue, 13 Sep 2022 11:06:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235371AbiIMPEP (ORCPT ); Tue, 13 Sep 2022 11:04:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B05196B8E6; Tue, 13 Sep 2022 07:30:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BC565B80FAF; Tue, 13 Sep 2022 14:29:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12C6BC433C1; Tue, 13 Sep 2022 14:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663079396; bh=fJYGu+vGBXDNVN3bkHSfbhFb/RFNCdKrSdC1GIKks3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KuU3su4uyPuCY092W4/QjQIHxb24vh6rUVKkNT4z8N+1XZFPVUoQ0pWnJBrLcI9+A doZxO03vOcxGKg/FkHgcXT2bHWUHoJbnuzZ5qBPgbW/GaI3mACAoQOpfqk0w80NhTR W3EUWyJngTpY8PGjJ6913wYaJv7CjnryDku7IOkw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Hans de Goede , Sasha Levin Subject: [PATCH 4.19 10/79] platform/x86: pmc_atom: Fix SLP_TYPx bitfield mask Date: Tue, 13 Sep 2022 16:06:28 +0200 Message-Id: <20220913140349.348078286@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140348.835121645@linuxfoundation.org> References: <20220913140348.835121645@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andy Shevchenko [ Upstream commit 0a90ed8d0cfa29735a221eba14d9cb6c735d35b6 ] On Intel hardware the SLP_TYPx bitfield occupies bits 10-12 as per ACPI specification (see Table 4.13 "PM1 Control Registers Fixed Hardware Feature Control Bits" for the details). Fix the mask and other related definitions accordingly. Fixes: 93e5eadd1f6e ("x86/platform: New Intel Atom SOC power management con= troller driver") Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220801113734.36131-1-andriy.shevchenko@li= nux.intel.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin --- drivers/platform/x86/pmc_atom.c | 2 +- include/linux/platform_data/x86/pmc_atom.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_ato= m.c index 682fc49d172cb..e8440850b73ac 100644 --- a/drivers/platform/x86/pmc_atom.c +++ b/drivers/platform/x86/pmc_atom.c @@ -253,7 +253,7 @@ static void pmc_power_off(void) pm1_cnt_port =3D acpi_base_addr + PM1_CNT; =20 pm1_cnt_value =3D inl(pm1_cnt_port); - pm1_cnt_value &=3D SLEEP_TYPE_MASK; + pm1_cnt_value &=3D ~SLEEP_TYPE_MASK; pm1_cnt_value |=3D SLEEP_TYPE_S5; pm1_cnt_value |=3D SLEEP_ENABLE; =20 diff --git a/include/linux/platform_data/x86/pmc_atom.h b/include/linux/pla= tform_data/x86/pmc_atom.h index e4905fe69c381..e4cfcb6f16633 100644 --- a/include/linux/platform_data/x86/pmc_atom.h +++ b/include/linux/platform_data/x86/pmc_atom.h @@ -16,6 +16,8 @@ #ifndef PMC_ATOM_H #define PMC_ATOM_H =20 +#include + /* ValleyView Power Control Unit PCI Device ID */ #define PCI_DEVICE_ID_VLV_PMC 0x0F1C /* CherryTrail Power Control Unit PCI Device ID */ @@ -148,9 +150,9 @@ #define ACPI_MMIO_REG_LEN 0x100 =20 #define PM1_CNT 0x4 -#define SLEEP_TYPE_MASK 0xFFFFECFF +#define SLEEP_TYPE_MASK GENMASK(12, 10) #define SLEEP_TYPE_S5 0x1C00 -#define SLEEP_ENABLE 0x2000 +#define SLEEP_ENABLE BIT(13) =20 extern int pmc_atom_read(int offset, u32 *value); extern int pmc_atom_write(int offset, u32 value); --=20 2.35.1