Commit daf11ca2 authored by Jiri Kosina's avatar Jiri Kosina

HID: nintendo: fix -Werror build

There are a lot of warnings due to unused protocol constants, but I believe
it's good to leave them in the sources for documentation purposes for further
development.

Switch them over from static conts to macros to avoid the warnings.
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent dad74e18
...@@ -41,106 +41,106 @@ ...@@ -41,106 +41,106 @@
*/ */
/* Output Reports */ /* Output Reports */
static const u8 JC_OUTPUT_RUMBLE_AND_SUBCMD = 0x01; #define JC_OUTPUT_RUMBLE_AND_SUBCMD 0x01
static const u8 JC_OUTPUT_FW_UPDATE_PKT = 0x03; #define JC_OUTPUT_FW_UPDATE_PKT 0x03
static const u8 JC_OUTPUT_RUMBLE_ONLY = 0x10; #define JC_OUTPUT_RUMBLE_ONLY 0x10
static const u8 JC_OUTPUT_MCU_DATA = 0x11; #define JC_OUTPUT_MCU_DATA 0x11
static const u8 JC_OUTPUT_USB_CMD = 0x80; #define JC_OUTPUT_USB_CMD 0x80
/* Subcommand IDs */ /* Subcommand IDs */
static const u8 JC_SUBCMD_STATE /*= 0x00*/; #define JC_SUBCMD_STATE 0x00
static const u8 JC_SUBCMD_MANUAL_BT_PAIRING = 0x01; #define JC_SUBCMD_MANUAL_BT_PAIRING 0x01
static const u8 JC_SUBCMD_REQ_DEV_INFO = 0x02; #define JC_SUBCMD_REQ_DEV_INFO 0x02
static const u8 JC_SUBCMD_SET_REPORT_MODE = 0x03; #define JC_SUBCMD_SET_REPORT_MODE 0x03
static const u8 JC_SUBCMD_TRIGGERS_ELAPSED = 0x04; #define JC_SUBCMD_TRIGGERS_ELAPSED 0x04
static const u8 JC_SUBCMD_GET_PAGE_LIST_STATE = 0x05; #define JC_SUBCMD_GET_PAGE_LIST_STATE 0x05
static const u8 JC_SUBCMD_SET_HCI_STATE = 0x06; #define JC_SUBCMD_SET_HCI_STATE 0x06
static const u8 JC_SUBCMD_RESET_PAIRING_INFO = 0x07; #define JC_SUBCMD_RESET_PAIRING_INFO 0x07
static const u8 JC_SUBCMD_LOW_POWER_MODE = 0x08; #define JC_SUBCMD_LOW_POWER_MODE 0x08
static const u8 JC_SUBCMD_SPI_FLASH_READ = 0x10; #define JC_SUBCMD_SPI_FLASH_READ 0x10
static const u8 JC_SUBCMD_SPI_FLASH_WRITE = 0x11; #define JC_SUBCMD_SPI_FLASH_WRITE 0x11
static const u8 JC_SUBCMD_RESET_MCU = 0x20; #define JC_SUBCMD_RESET_MCU 0x20
static const u8 JC_SUBCMD_SET_MCU_CONFIG = 0x21; #define JC_SUBCMD_SET_MCU_CONFIG 0x21
static const u8 JC_SUBCMD_SET_MCU_STATE = 0x22; #define JC_SUBCMD_SET_MCU_STATE 0x22
static const u8 JC_SUBCMD_SET_PLAYER_LIGHTS = 0x30; #define JC_SUBCMD_SET_PLAYER_LIGHTS 0x30
static const u8 JC_SUBCMD_GET_PLAYER_LIGHTS = 0x31; #define JC_SUBCMD_GET_PLAYER_LIGHTS 0x31
static const u8 JC_SUBCMD_SET_HOME_LIGHT = 0x38; #define JC_SUBCMD_SET_HOME_LIGHT 0x38
static const u8 JC_SUBCMD_ENABLE_IMU = 0x40; #define JC_SUBCMD_ENABLE_IMU 0x40
static const u8 JC_SUBCMD_SET_IMU_SENSITIVITY = 0x41; #define JC_SUBCMD_SET_IMU_SENSITIVITY 0x41
static const u8 JC_SUBCMD_WRITE_IMU_REG = 0x42; #define JC_SUBCMD_WRITE_IMU_REG 0x42
static const u8 JC_SUBCMD_READ_IMU_REG = 0x43; #define JC_SUBCMD_READ_IMU_REG 0x43
static const u8 JC_SUBCMD_ENABLE_VIBRATION = 0x48; #define JC_SUBCMD_ENABLE_VIBRATION 0x48
static const u8 JC_SUBCMD_GET_REGULATED_VOLTAGE = 0x50; #define JC_SUBCMD_GET_REGULATED_VOLTAGE 0x50
/* Input Reports */ /* Input Reports */
static const u8 JC_INPUT_BUTTON_EVENT = 0x3F; #define JC_INPUT_BUTTON_EVENT 0x3F
static const u8 JC_INPUT_SUBCMD_REPLY = 0x21; #define JC_INPUT_SUBCMD_REPLY 0x21
static const u8 JC_INPUT_IMU_DATA = 0x30; #define JC_INPUT_IMU_DATA 0x30
static const u8 JC_INPUT_MCU_DATA = 0x31; #define JC_INPUT_MCU_DATA 0x31
static const u8 JC_INPUT_USB_RESPONSE = 0x81; #define JC_INPUT_USB_RESPONSE 0x81
/* Feature Reports */ /* Feature Reports */
static const u8 JC_FEATURE_LAST_SUBCMD = 0x02; #define JC_FEATURE_LAST_SUBCMD 0x02
static const u8 JC_FEATURE_OTA_FW_UPGRADE = 0x70; #define JC_FEATURE_OTA_FW_UPGRADE 0x70
static const u8 JC_FEATURE_SETUP_MEM_READ = 0x71; #define JC_FEATURE_SETUP_MEM_READ 0x71
static const u8 JC_FEATURE_MEM_READ = 0x72; #define JC_FEATURE_MEM_READ 0x72
static const u8 JC_FEATURE_ERASE_MEM_SECTOR = 0x73; #define JC_FEATURE_ERASE_MEM_SECTOR 0x73
static const u8 JC_FEATURE_MEM_WRITE = 0x74; #define JC_FEATURE_MEM_WRITE 0x74
static const u8 JC_FEATURE_LAUNCH = 0x75; #define JC_FEATURE_LAUNCH 0x75
/* USB Commands */ /* USB Commands */
static const u8 JC_USB_CMD_CONN_STATUS = 0x01; #define JC_USB_CMD_CONN_STATUS 0x01
static const u8 JC_USB_CMD_HANDSHAKE = 0x02; #define JC_USB_CMD_HANDSHAKE 0x02
static const u8 JC_USB_CMD_BAUDRATE_3M = 0x03; #define JC_USB_CMD_BAUDRATE_3M 0x03
static const u8 JC_USB_CMD_NO_TIMEOUT = 0x04; #define JC_USB_CMD_NO_TIMEOUT 0x04
static const u8 JC_USB_CMD_EN_TIMEOUT = 0x05; #define JC_USB_CMD_EN_TIMEOUT 0x05
static const u8 JC_USB_RESET = 0x06; #define JC_USB_RESET 0x06
static const u8 JC_USB_PRE_HANDSHAKE = 0x91; #define JC_USB_PRE_HANDSHAKE 0x91
static const u8 JC_USB_SEND_UART = 0x92; #define JC_USB_SEND_UART 0x92
/* Magic value denoting presence of user calibration */ /* Magic value denoting presence of user calibration */
static const u16 JC_CAL_USR_MAGIC_0 = 0xB2; #define JC_CAL_USR_MAGIC_0 0xB2
static const u16 JC_CAL_USR_MAGIC_1 = 0xA1; #define JC_CAL_USR_MAGIC_1 0xA1
static const u8 JC_CAL_USR_MAGIC_SIZE = 2; #define JC_CAL_USR_MAGIC_SIZE 2
/* SPI storage addresses of user calibration data */ /* SPI storage addresses of user calibration data */
static const u16 JC_CAL_USR_LEFT_MAGIC_ADDR = 0x8010; #define JC_CAL_USR_LEFT_MAGIC_ADDR 0x8010
static const u16 JC_CAL_USR_LEFT_DATA_ADDR = 0x8012; #define JC_CAL_USR_LEFT_DATA_ADDR 0x8012
static const u16 JC_CAL_USR_LEFT_DATA_END = 0x801A; #define JC_CAL_USR_LEFT_DATA_END 0x801A
static const u16 JC_CAL_USR_RIGHT_MAGIC_ADDR = 0x801B; #define JC_CAL_USR_RIGHT_MAGIC_ADDR 0x801B
static const u16 JC_CAL_USR_RIGHT_DATA_ADDR = 0x801D; #define JC_CAL_USR_RIGHT_DATA_ADDR 0x801D
#define JC_CAL_STICK_DATA_SIZE \ #define JC_CAL_STICK_DATA_SIZE \
(JC_CAL_USR_LEFT_DATA_END - JC_CAL_USR_LEFT_DATA_ADDR + 1) (JC_CAL_USR_LEFT_DATA_END - JC_CAL_USR_LEFT_DATA_ADDR + 1)
/* SPI storage addresses of factory calibration data */ /* SPI storage addresses of factory calibration data */
static const u16 JC_CAL_FCT_DATA_LEFT_ADDR = 0x603d; #define JC_CAL_FCT_DATA_LEFT_ADDR 0x603d
static const u16 JC_CAL_FCT_DATA_RIGHT_ADDR = 0x6046; #define JC_CAL_FCT_DATA_RIGHT_ADDR 0x6046
/* SPI storage addresses of IMU factory calibration data */ /* SPI storage addresses of IMU factory calibration data */
static const u16 JC_IMU_CAL_FCT_DATA_ADDR = 0x6020; #define JC_IMU_CAL_FCT_DATA_ADDR 0x6020
static const u16 JC_IMU_CAL_FCT_DATA_END = 0x6037; #define JC_IMU_CAL_FCT_DATA_END 0x6037
#define JC_IMU_CAL_DATA_SIZE \ #define JC_IMU_CAL_DATA_SIZE \
(JC_IMU_CAL_FCT_DATA_END - JC_IMU_CAL_FCT_DATA_ADDR + 1) (JC_IMU_CAL_FCT_DATA_END - JC_IMU_CAL_FCT_DATA_ADDR + 1)
/* SPI storage addresses of IMU user calibration data */ /* SPI storage addresses of IMU user calibration data */
static const u16 JC_IMU_CAL_USR_MAGIC_ADDR = 0x8026; #define JC_IMU_CAL_USR_MAGIC_ADDR 0x8026
static const u16 JC_IMU_CAL_USR_DATA_ADDR = 0x8028; #define JC_IMU_CAL_USR_DATA_ADDR 0x8028
/* The raw analog joystick values will be mapped in terms of this magnitude */ /* The raw analog joystick values will be mapped in terms of this magnitude */
static const u16 JC_MAX_STICK_MAG = 32767; #define JC_MAX_STICK_MAG 32767
static const u16 JC_STICK_FUZZ = 250; #define JC_STICK_FUZZ 250
static const u16 JC_STICK_FLAT = 500; #define JC_STICK_FLAT 500
/* Hat values for pro controller's d-pad */ /* Hat values for pro controller's d-pad */
static const u16 JC_MAX_DPAD_MAG = 1; #define JC_MAX_DPAD_MAG 1
static const u16 JC_DPAD_FUZZ /*= 0*/; #define JC_DPAD_FUZZ 0
static const u16 JC_DPAD_FLAT /*= 0*/; #define JC_DPAD_FLAT 0
/* Under most circumstances IMU reports are pushed every 15ms; use as default */ /* Under most circumstances IMU reports are pushed every 15ms; use as default */
static const u16 JC_IMU_DFLT_AVG_DELTA_MS = 15; #define JC_IMU_DFLT_AVG_DELTA_MS 15
/* How many samples to sum before calculating average IMU report delta */ /* How many samples to sum before calculating average IMU report delta */
static const u16 JC_IMU_SAMPLES_PER_DELTA_AVG = 300; #define JC_IMU_SAMPLES_PER_DELTA_AVG 300
/* Controls how many dropped IMU packets at once trigger a warning message */ /* Controls how many dropped IMU packets at once trigger a warning message */
static const u16 JC_IMU_DROPPED_PKT_WARNING = 3; #define JC_IMU_DROPPED_PKT_WARNING 3
/* /*
* The controller's accelerometer has a sensor resolution of 16bits and is * The controller's accelerometer has a sensor resolution of 16bits and is
...@@ -149,10 +149,10 @@ static const u16 JC_IMU_DROPPED_PKT_WARNING = 3; ...@@ -149,10 +149,10 @@ static const u16 JC_IMU_DROPPED_PKT_WARNING = 3;
* Resolution per G (rather than per millliG): 4.096 * 1000 = 4096 digits per G * Resolution per G (rather than per millliG): 4.096 * 1000 = 4096 digits per G
* Alternatively: 1/4096 = .0002441 Gs per digit * Alternatively: 1/4096 = .0002441 Gs per digit
*/ */
static const s32 JC_IMU_MAX_ACCEL_MAG = 32767; #define JC_IMU_MAX_ACCEL_MAG 32767
static const u16 JC_IMU_ACCEL_RES_PER_G = 4096; #define JC_IMU_ACCEL_RES_PER_G 4096
static const u16 JC_IMU_ACCEL_FUZZ = 10; #define JC_IMU_ACCEL_FUZZ 10
static const u16 JC_IMU_ACCEL_FLAT /*= 0*/; #define JC_IMU_ACCEL_FLAT 0
/* /*
* The controller's gyroscope has a sensor resolution of 16bits and is * The controller's gyroscope has a sensor resolution of 16bits and is
...@@ -169,12 +169,12 @@ static const u16 JC_IMU_ACCEL_FLAT /*= 0*/; ...@@ -169,12 +169,12 @@ static const u16 JC_IMU_ACCEL_FLAT /*= 0*/;
* Now, 14.247 truncating to 14 loses a lot of precision, so we rescale the * Now, 14.247 truncating to 14 loses a lot of precision, so we rescale the
* min/max range by 1000. * min/max range by 1000.
*/ */
static const s32 JC_IMU_PREC_RANGE_SCALE = 1000; #define JC_IMU_PREC_RANGE_SCALE 1000
/* Note: change mag and res_per_dps if prec_range_scale is ever altered */ /* Note: change mag and res_per_dps if prec_range_scale is ever altered */
static const s32 JC_IMU_MAX_GYRO_MAG = 32767000; /* (2^16-1)*1000 */ #define JC_IMU_MAX_GYRO_MAG 32767000 /* (2^16-1)*1000 */
static const u16 JC_IMU_GYRO_RES_PER_DPS = 14247; /* (14.247*1000) */ #define JC_IMU_GYRO_RES_PER_DPS 14247 /* (14.247*1000) */
static const u16 JC_IMU_GYRO_FUZZ = 10; #define JC_IMU_GYRO_FUZZ 10
static const u16 JC_IMU_GYRO_FLAT /*= 0*/; #define JC_IMU_GYRO_FLAT 0
/* frequency/amplitude tables for rumble */ /* frequency/amplitude tables for rumble */
struct joycon_rumble_freq_data { struct joycon_rumble_freq_data {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment