@@ -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;
@@ -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;