Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2505095pxb; Mon, 19 Apr 2021 07:18:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVbp7aM3kQGIl/KvWkHV8d0LA4yTI7iB3H9veH+UzzyHydbeOWL0lyArZtDreXT/2TqlQY X-Received: by 2002:aa7:c683:: with SMTP id n3mr25345853edq.214.1618841897872; Mon, 19 Apr 2021 07:18:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618841897; cv=none; d=google.com; s=arc-20160816; b=mrCJJbW3Qe8sToMuMis4PdJ+xrMlfHGMTcm5UYw2q+uA4Rx9qt8BXSjIGOo5tQ1BSS WUU2I2RVeHGzn1sM1q8MMxTCCVM1LtqL07aaEpfuBFNKO3IOeRWe0VJdfnl5gtbWt34T fecGj9YaMdm21wlhL2RN3qywpfh3ckwk1ktdMFKSH6xIJiHmrXYa1P1sTuj7m6WCdXKr ++/EYadxgTN3WbZiwg8ARSdp3CyZ4im7uh9wJ0bDmWFtXvjMj3NAUve+kmb+qO8tyl4r b/tV5lJJpkR9sTJSvOxgYwAwGYB5mV70f9qMyfjVqZCcQrkBdvkOI8FyZ5gbr2darmPh ww5A== 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=gxl4LNsg510LigK/0H63jPyPHWv7G/R4Sn399nMILco=; b=heN+IkpWB88OZ+0duXdn7cN1IWohn/yrJqUbqeIr7yjr1Wr7R19yBo1l3u1fTQXKV1 dceU8z9/2XU/dnPDqmVFGcUO5jEoDeasvneRgAKo+8O7zdAnIL5WMSGskSKB2Amn2dnU Eivr3noRfAsOR5SfqwQad0SUO8yqWkKgMmcZEKpMh6Y9JasiyQWsvbf+IdgxlbHc80dE CFNQNLY+WOE5VY32Rd+m34O3p028doLKIrNZ9PEXpbIJp8UVem6MCcFkJMrVJCN6UAf/ 3dIWBLJ8su23Wbt3VjwC6SxssyCi7hSgOUnJdLOicjE7zTouTUUHCwrqzHXyDZECYNkw 5l8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SPY4oVZu; 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 h21si2724423ede.377.2021.04.19.07.17.54; Mon, 19 Apr 2021 07:18:17 -0700 (PDT) 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=SPY4oVZu; 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 S239431AbhDSNIq (ORCPT + 99 others); Mon, 19 Apr 2021 09:08:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:43444 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239416AbhDSNIl (ORCPT ); Mon, 19 Apr 2021 09:08:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B273F6127C; Mon, 19 Apr 2021 13:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618837690; bh=5vSnftBv7TEoHBYxI8JgxnbeUIjXD2E0W4N0IsgOYck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SPY4oVZuwCRSl/1x0ABlfzlOvE+llhN1g67iLMw6gOkgcaAme/MLyE2q4HDfo3odv oJdwoaXIqWvdMzeyfCWlljrAvVxE0h/y3s7jmB/tuKVk77OuCXQSuR9jMq+FKvAsiq 8DwKd26cGJo9IAHRwmLvTuGwDBf+BbuCLv5pyFfM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Neumann , Hans de Goede , Jiri Kosina , Sasha Levin Subject: [PATCH 5.11 002/122] AMD_SFH: Add sensor_mask module parameter Date: Mon, 19 Apr 2021 15:04:42 +0200 Message-Id: <20210419130530.257445795@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210419130530.166331793@linuxfoundation.org> References: <20210419130530.166331793@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 952f7d10c6b1685c6700fb24cf4ecbcf26ede77e ] Add a sensor_mask module parameter which can be used to override the sensor-mask read from the activestatus bits of the AMD_P2C_MSG3 registers. Some BIOS-es do not program the activestatus bits, leading to the AMD-SFH driver not registering any HID devices even though the laptop in question does actually have sensors. While at it also fix the wrong indentation of the MAGNO_EN define. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=199715 BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1651886 Fixes: 4f567b9f8141 ("SFH: PCIe driver to add support of AMD sensor fusion hub") Suggested-by: Richard Neumann Signed-off-by: Hans de Goede Acked-by: Sandeep Singh Signed-off-by: Sasha Levin --- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c index f3cdb4ea33da..ab0a9443e252 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c @@ -22,9 +22,13 @@ #define ACEL_EN BIT(0) #define GYRO_EN BIT(1) -#define MAGNO_EN BIT(2) +#define MAGNO_EN BIT(2) #define ALS_EN BIT(19) +static int sensor_mask_override = -1; +module_param_named(sensor_mask, sensor_mask_override, int, 0444); +MODULE_PARM_DESC(sensor_mask, "override the detected sensors mask"); + void amd_start_sensor(struct amd_mp2_dev *privdata, struct amd_mp2_sensor_info info) { union sfh_cmd_param cmd_param; @@ -78,8 +82,12 @@ int amd_mp2_get_sensor_num(struct amd_mp2_dev *privdata, u8 *sensor_id) int activestatus, num_of_sensors = 0; u32 activecontrolstatus; - activecontrolstatus = readl(privdata->mmio + AMD_P2C_MSG3); - activestatus = activecontrolstatus >> 4; + if (sensor_mask_override >= 0) { + activestatus = sensor_mask_override; + } else { + activecontrolstatus = readl(privdata->mmio + AMD_P2C_MSG3); + activestatus = activecontrolstatus >> 4; + } if (ACEL_EN & activestatus) sensor_id[num_of_sensors++] = accel_idx; -- 2.30.2