Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp591767pxb; Wed, 27 Jan 2021 16:05:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJynqBL+noGVGR2eiWjWBqCHpyo7ENRNUguKoE8SKZTQG6tSI3n6ytDEfxCM9wMYpbO/tqX1 X-Received: by 2002:a50:bc15:: with SMTP id j21mr11153669edh.187.1611792339963; Wed, 27 Jan 2021 16:05:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611792339; cv=none; d=google.com; s=arc-20160816; b=bMdCU2+MnHGmrBXmEjEDouG5KbljSxfgBOaof0Z7XS/SVZRKpKMSrYr4mwlLtlveqV S1LvpMQTDOiwJcqK/pbMkNXQZu48A+CZJr29GvWIgJYndCUrPX49htp85tp/G8l/1FOw rO1qPI5uI3B0ymFWTqmHBIr0AfuZU4qJXNRnuKke+ir6s3rd/cDfxKeNGujRYLgVOFEk pRjslT08AXhZy1WZ3sLV4sn8NaaK4LvUrKt1xyDnjEvg+Q8UMVRwW6ZsYiGiaPQl+YFC bXQmbC8vbZPdbkOxKWEd2F9DJjkrqdEn+OhatWq2jryH50WqWu5408UyNqIrPx63JICL rIvQ== 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 :references:in-reply-to:message-id:date:subject:to:from; bh=7tvemJhpXKH8U5m4fHuzqZrInZ40ukMMd/PnpaLjoUA=; b=aU4qaZUv2mDszq9mVDlmpBa8r6/s3ddQ50gAQ4ZPZgv8nRatyjGX7LjS80/69/FSlw DHaJ+amUPqllralmknjefcek9HwIuirJLzne+NoBD1FulzQniz3Z7TmkEgGCq58V1Lqi XYA9AYznAEu3B3Z9OSHwLBQ727tfl+kdPtTc0meHpXEvW8a05twN5Qh3pXknz5E8ECbF Epn8AmgLp3qXWP0nAbgJs5GJgRbwsWfcLk1ri4fqywPpZRLZFMlHcsLlpN9bDRueSYhe 1pPQI1i/oMT0ZqOz5AqVqBIO4cpaIxTHMoI7zbVNeE6tjxW5bSEJEknNW5Pth9Opzc8z VzqA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lz12si1470655ejb.518.2021.01.27.16.05.15; Wed, 27 Jan 2021 16:05:39 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236472AbhA0Pnc (ORCPT + 99 others); Wed, 27 Jan 2021 10:43:32 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:51341 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236389AbhA0Pid (ORCPT ); Wed, 27 Jan 2021 10:38:33 -0500 Received: from envy.fritz.box ([82.207.222.125]) by mrelayeu.kundenserver.de (mreue012 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MNfgZ-1lKXcg2plz-00P1ta; Wed, 27 Jan 2021 16:35:37 +0100 From: mail@richard-neumann.de To: nehal-bakulchandra.shah@amd.com, sandeep.singh@amd.com, mail@richard-neumann.de, jikos@kernel.org, benjamin.tissoires@redhat.com, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Subject: [PATCH v1 1/3] Outsourced sensor masks to PCI driver header. Date: Wed, 27 Jan 2021 16:35:31 +0100 Message-Id: <20210127153533.21560-2-mail@richard-neumann.de> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210127153533.21560-1-mail@richard-neumann.de> References: <20210127153533.21560-1-mail@richard-neumann.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:S0VWvSaZeX/9QNXkqFPXc+YHIO27cHQ4V+xApgEi7fuq1fvTnV8 cIr9OrG5oEu229hdQZ/NqAIMI2T3ceWj1VHYPyqRF+MVV3PRsMLwdfI377dmedZwZJsungY gXaXj09XapKra/9t57FXntqiyvGh9/1rVnldZvIjTfoQzsqq6wuUjapvpJxBTpn+2BSaWr/ wERakmTBPC9eP2q2F+tTQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:t9RraiFcYrk=:0KkyimE1B5yi4UtgIMfJv9 /Zf/bFlbXMj5It5rev+HxK+a7SiaX+SR2ljpUVr2jA3B7/aD95R1EK8G4ibXcGZYKV7f5iNmC pqqy64IN391+xyIU+bgCEMStpBemr3RO7UiXB/cupVhJxUo5Akz07GHpVCMGXs9PM035ICCWp y5XTUM6oVyTt+u+2IMS+Lw/NnuAQkBFPb8cWqi/B3qCQnGe/r/HLGqpoctiJo0OqmxaO81m+O 193JQy081xE9Bn5ElddlEqmX7NT4O/00wqPosTW0JDmiew+jbAvJvu4EBOVU0Wzikf6ztLtWt qWZ24dEY2HPyotnyp9dlJvy59Wu17cTbL1MItlcfcQImmTkkgmmY1MdlRPBnH8bUYKZ6FCO4l FbNiHOpiC+bS1ujRnipmvA5A5qz9s79Gi+QBVLedMTSzXCuB//Ycm6CAre4u1nyp3De+lqmB6 AqkoAAdP7A== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Richard Neumann Outsourced the mask definitions of the four sensors into the PCI device driver header file for later use with the quirks. Also renamed the values from *_EN to *_MASK to emphasize that they are actually sensor bitmasks for matching against activestatus. Signed-off-by: Richard Neumann --- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 13 ++++--------- drivers/hid/amd-sfh-hid/amd_sfh_pcie.h | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c index dbac16641662..4b0ceb2ee86a 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c @@ -20,11 +20,6 @@ #define DRIVER_NAME "pcie_mp2_amd" #define DRIVER_DESC "AMD(R) PCIe MP2 Communication Driver" -#define ACEL_EN BIT(0) -#define GYRO_EN BIT(1) -#define MAGNO_EN BIT(2) -#define ALS_EN BIT(19) - void amd_start_sensor(struct amd_mp2_dev *privdata, struct amd_mp2_sensor_info info) { union sfh_cmd_param cmd_param; @@ -79,16 +74,16 @@ int amd_mp2_get_sensor_num(struct amd_mp2_dev *privdata, u8 *sensor_id) privdata->activecontrolstatus = readl(privdata->mmio + AMD_P2C_MSG3); activestatus = privdata->activecontrolstatus >> 4; - if (ACEL_EN & activestatus) + if (ACCEL_MASK & activestatus) sensor_id[num_of_sensors++] = accel_idx; - if (GYRO_EN & activestatus) + if (GYRO_MASK & activestatus) sensor_id[num_of_sensors++] = gyro_idx; - if (MAGNO_EN & activestatus) + if (MAGNO_MASK & activestatus) sensor_id[num_of_sensors++] = mag_idx; - if (ALS_EN & activestatus) + if (ALS_MASK & activestatus) sensor_id[num_of_sensors++] = als_idx; return num_of_sensors; diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h index 8f8d19b2cfe5..a39f02352c3b 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h +++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h @@ -57,6 +57,20 @@ enum sensor_idx { als_idx = 19 }; +/** + * Bit masks for sensors matching. + * @ACCEL_MASK: Bit mask of the accelerometer + * @GYRO_MASK: Bit mask of the gyroscope + * @MAGNO_MASK: Bit mask of the magnetometer + * @ALS_MASK: Bit mask of the ambient light sensor + */ +enum sensor_mask { + ACCEL_MASK = BIT(accel_idx), + GYRO_MASK = BIT(gyro_idx), + MAGNO_MASK = BIT(mag_idx), + ALS_MASK = BIT(als_idx), +}; + struct amd_mp2_dev { struct pci_dev *pdev; struct amdtp_cl_data *cl_data; -- 2.30.0