| /* drivers/input/misc/ots_pat9126/pixart_ots.h |
| * |
| * Copyright (c) 2016, The Linux Foundation. All rights reserved. |
| * |
| */ |
| |
| #ifndef __PIXART_OTS_H_ |
| #define __PIXART_OTS_H_ |
| |
| #define PAT9126_DEV_NAME "pixart_pat9126" |
| #define PAT9126_DEV_PHYS "input/rotary" |
| #define BUF_SIZE 2 |
| #define RESET_DELAY_US 1000 |
| #define VDD_VTG_MIN_UV 1800000 |
| #define VDD_VTG_MAX_UV 1800000 |
| #define VDD_ACTIVE_LOAD_UA 10000 |
| #define VLD_VTG_MIN_UV 2800000 |
| #define VLD_VTG_MAX_UV 3300000 |
| #define VLD_ACTIVE_LOAD_UA 10000 |
| #define DELAY_BETWEEN_REG_US 20000 |
| #define PAT9150_I2C_RETRY 4 |
| |
| /* Register addresses */ |
| #define PIXART_PAT9126_PRODUCT_ID1_REG 0x00 |
| #define PIXART_PAT9126_PRODUCT_ID2_REG 0x01 |
| #define PIXART_PAT9126_MOTION_STATUS_REG 0x02 |
| #define PIXART_PAT9126_DELTA_X_LO_REG 0x03 |
| #define PIXART_PAT9126_DELTA_Y_LO_REG 0x04 |
| #define PIXART_PAT9126_SLEEP_MODE_SELECT_REG 0x05 |
| #define PIXART_PAT9126_CONFIG_REG 0x06 |
| #define PIXART_PAT9126_PIXEL_GRAB_STATUS_REG 0x08 |
| #define PIXART_PAT9126_WRITE_PROTECT_REG 0x09 |
| #define PIXART_PAT9126_SLEEP2_MODE_FREQ_REG 0x0B |
| #define PIXART_PAT9126_SET_CPI_RES_X_REG 0x0D |
| #define PIXART_PAT9126_SET_CPI_RES_Y_REG 0x0E |
| #define PIXART_PAT9126_PIXEL_GRAB_VAL_REG 0x0F |
| #define PIXART_PAT9126_DELTA_XY_HI_REG 0x12 |
| #define PIXART_PAT9126_FRAME_AVG_REG 0x17 |
| #define PIXART_PAT9126_ORIENTATION_REG 0x19 |
| #define PIXART_PAT9126_PIXEL_GRAB_CLOCK_REG 0x19 |
| #define PIXART_PAT9126_PIXEL_GRAB_FRAME_SKIP0_REG 0x20 |
| #define PIXART_PAT9126_AE_ENABLE 0x2B |
| #define PIXART_PAT9126_BANK_FTWK 0x2B |
| #define PIXART_PAT9126_BANK_FTWK_D2 0x2C |
| #define PIXART_PAT9126_NY_MIN 0x2D |
| #define PIXART_PAT9126_BANK_CTB 0x30 |
| #define PIXART_PAT9126_BANK_HI_SAD_K 0x38 |
| #define PIXART_PAT9126_VOLTAGE_SEGMENT_SEL_REG 0x4B |
| #define PIXART_PAT9126_PIXEL_GRAB_FRAME_SKIP1_REG 0x58 |
| #define PIXART_PAT9126_MISC1_REG 0x5D |
| #define PIXART_PAT9126_MISC2_REG 0x5E |
| #define PIXART_PAT9126_SENSOR_MODE_SELECT_REG 0x7C |
| #define PIXART_PAT9126_SELECT_BANK_REG 0x7F |
| |
| /*Register configuration data */ |
| #define PIXART_PAT9126_SENSOR_ID 0x31 |
| #define PIXART_PAT9126_RESET 0x97 |
| #define PIXART_PAT9126_MOTION_DATA_LENGTH 0x04 |
| #define PIXART_PAT9126_BANK0 0x00 |
| #define PIXART_PAT9126_DISABLE_WRITE_PROTECT 0x5A |
| #define PIXART_PAT9126_ENABLE_WRITE_PROTECT 0x00 |
| #define PIXART_PAT9126_CPI_RESOLUTION_X 0xFF |
| #define PIXART_PAT9126_CPI_RESOLUTION_Y 0x00 |
| #define PIXART_PAT9126_CPI_RES_X_MAX 0xFF |
| #define PIXART_PAT9126_CPI_RES_X_MIN 0x00 |
| #define PIXART_PAT9126_SENSOR_DEFAULT_MODE 0xC8 |
| #define PIXART_PAT9126_SENSOR_DEFAULT_MODE2 0x80 |
| #define PIXART_PAT9126_SENSOR_SET_MODE 0xCC |
| #define PIXART_PAT9126_SENSOR_SET_MODE2 0x82 |
| #define PIXART_PAT9126_WAKEUP_MODE 0xA0 |
| #define PIXART_PAT9126_SLEEP1_MODE_EN 0xA1 |
| #define PIXART_PAT9126_SLEEP2_MODE_EN 0xB8 |
| #define PIXART_PAT9126_SLEEP2_MODE_DIS 0xB0 |
| #define PIXART_PAT9126_FORCE_ENTER_SLEEP2_MODE 0xBC |
| #define PIXART_PAT9126_SLEEP_MODE_DETECT_FREQ_DEFAULT 0x10 |
| #define PIXART_PAT9126_SLEEP_MODE_FREQ_1024MS 0xF0 |
| #define PIXART_PAT9126_SLEEP_MODE_DETECT_FREQ 0xF0 |
| #define PIXART_PAT9126_SELECT_BANK_VAL1 0x00 |
| #define PIXART_PAT9126_SELECT_BANK_VAL2 0x01 |
| #define PIXART_PAT9126_AE_ENABLE_VAL 0x6D |
| #define PIXART_PAT9126_NY_MIN_VAL 0x00 |
| #define PIXART_PAT9126_BANK_FTWK_DEFAULT_VAL 0xAE |
| #define PIXART_PAT9126_BANK_FTWK_VAL1 0x00 |
| #define PIXART_PAT9126_BANK_FTWK_D2_DEFAULT_VAL 0x97 |
| #define PIXART_PAT9126_BANK_FTWK_D2_VAL1 0x00 |
| #define PIXART_PAT9126_BANK_CTB_DEFAULT_VAL 0xAC |
| #define PIXART_PAT9126_BANK_CTB_VAL1 0x00 |
| #define PIXART_PAT9126_BANK_HI_SAD_K_DEFAULT_VAL 0x01 |
| #define PIXART_PAT9126_BANK_HI_SAD_K_VAL1 0xF1 |
| #define PIXART_PAT9126_LOW_VOLTAGE_SEGMENT 0x04 |
| #define PIXART_PAT9126_VALID_MOTION_DATA 0x80 |
| #define PIXART_PAT9126_PIXEL_GRAB_RESET_VAL 0x00 |
| #define PIXART_PAT9126_PIXEL_GRAB_FRAME_SKIP0_VAL 0x64 |
| #define PIXART_PAT9126_PIXEL_GRAB_FRAME_SKIP0_VAL1 0xE4 |
| #define PIXART_PAT9126_PIXEL_GRAB_FRAME_SKIP1_VAL 0x98 |
| #define PIXART_PAT9126_PIXEL_GRAB_FRAME_SKIP1_VAL1 0xD8 |
| #define PIXART_PAT9126_PIXEL_GRAB_CLOCK_VAL 0x06 |
| #define PIXART_PAT9126_PIXEL_GRAB_CLOCK_VAL1 0x04 |
| #define PIXART_PAT9126_MOTION_COUNT_MAX 385 |
| #define PIXART_PAT9126_MOTION_COUNT_DEFAULT 350 |
| #define PIXART_PAT9126_MOTION_COUNT_MIN 315 |
| |
| #define PIXART_SAMPLING_PERIOD_US_MIN 4000 |
| #define PIXART_SAMPLING_PERIOD_US_MAX 8000 |
| |
| /* Sleep mode configuration */ |
| #define SLEEP_MODES_ENABLED_MASK 0x18 |
| #define SLEEP_MODES_ENABLED_ZERO 0x0 |
| #define SLEEP_MODES_ENABLED_ONE 0x10 |
| #define SLEEP_MODES_ENABLED_TWO 0x18 |
| #define SLEEP_MODE_MASK 0x7 |
| #define SLEEP_MODE_WAKE 0x1 |
| #define SLEEP_MODE_ONE 0x2 |
| #define SLEEP_MODE_TWO 0x4 |
| |
| /* Power down bit */ |
| #define POWER_DOWN_ENABLE_BIT 0x08 |
| |
| /*define pixel grab flag*/ |
| #define OTS_FRAME_VALID 0x80 |
| #define OTS_PIXEL_VALID 0x40 |
| |
| /* Export functions */ |
| int pat9126_disable_mot(struct i2c_client *client, int16_t detect_freq); |
| int pat9126_enable_mot(struct i2c_client *client); |
| |
| #endif |