diff options
author | sbrissen <sbrissen@hotmail.com> | 2013-10-23 13:19:08 -0400 |
---|---|---|
committer | sbrissen <sbrissen@hotmail.com> | 2013-11-11 13:56:58 -0500 |
commit | 7fc3ce7312fec9320aeffb1a6c6c6d4bf2408669 (patch) | |
tree | efa7d60c4435cffe05ae479aa98cc815f52c4b59 /include/linux | |
parent | 25db0ffc956371b6613f90e68be96b652c4ab275 (diff) | |
download | kernel_samsung_smdk4412-7fc3ce7312fec9320aeffb1a6c6c6d4bf2408669.zip kernel_samsung_smdk4412-7fc3ce7312fec9320aeffb1a6c6c6d4bf2408669.tar.gz kernel_samsung_smdk4412-7fc3ce7312fec9320aeffb1a6c6c6d4bf2408669.tar.bz2 |
Add support for Note 8 (N5100 and N5110)
Change-Id: I6c9798682f9f6349b37cb452353bd0c0e6958401
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/battery/max17047_fuelgauge_c.h | 109 | ||||
-rw-r--r-- | include/linux/battery/samsung_battery.h | 4 | ||||
-rw-r--r-- | include/linux/exynos_audio.h | 14 | ||||
-rw-r--r-- | include/linux/gpio_keys.h | 3 | ||||
-rw-r--r-- | include/linux/input.h | 14 | ||||
-rw-r--r-- | include/linux/mod_devicetable.h | 6 | ||||
-rw-r--r-- | include/linux/platform_data/lp855x.h | 132 | ||||
-rw-r--r-- | include/linux/power_supply.h | 5 | ||||
-rw-r--r-- | include/linux/sensor/gp2a.h | 11 | ||||
-rw-r--r-- | include/linux/sensor/sensors_core.h | 3 | ||||
-rw-r--r-- | include/linux/sensor/yas.h | 474 | ||||
-rw-r--r-- | include/linux/sensor/yas_cfg.h | 250 | ||||
-rw-r--r-- | include/linux/synaptics_s7301.h | 99 | ||||
-rw-r--r-- | include/linux/wacom_i2c.h | 41 |
14 files changed, 1157 insertions, 8 deletions
diff --git a/include/linux/battery/max17047_fuelgauge_c.h b/include/linux/battery/max17047_fuelgauge_c.h new file mode 100644 index 0000000..157314b --- /dev/null +++ b/include/linux/battery/max17047_fuelgauge_c.h @@ -0,0 +1,109 @@ +/* + * max17047_fuelgauge.h + * + * Copyright (C) 2011 Samsung Electronics + * SangYoung Son <hello.son@samsung.com> + * + * based on max17042_battery.h + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef __MAX17047_BATTERY_H_ +#define __MAX17047_BATTERY_H_ + +//#if defined (CONFIG_FUELGAUGE_MAX17047_COULOMB_COUNTING) +/* jig state */ +extern bool is_jig_attached; + +#define CURRENT_RANGE_MAX_NUM 5 +#define TEMP_RANGE_MAX_NUM 3 + +enum { + SDI = 0, +}; + +enum { + RANGE = 0, + SLOPE, + OFFSET, + TABLE_MAX +}; + + +struct battery_data_t { + u16 Capacity; + u16 low_battery_comp_voltage; + s32 low_battery_table[CURRENT_RANGE_MAX_NUM][TABLE_MAX]; + s32 temp_adjust_table[TEMP_RANGE_MAX_NUM][TABLE_MAX]; + u8 *type_str; +}; + +enum { + FG_LEVEL = 0, + FG_TEMPERATURE, + FG_VOLTAGE, + FG_CURRENT, + FG_CURRENT_AVG, + FG_CHECK_STATUS, + FG_RAW_SOC, + FG_VF_SOC, + FG_AV_SOC, + FG_FULLCAP, + FG_MIXCAP, + FG_AVCAP, + FG_REPCAP, +}; + +enum { + POSITIVE = 0, + NEGATIVE, +}; + +#define LOW_BATT_COMP_RANGE_NUM 5 +#define LOW_BATT_COMP_LEVEL_NUM 2 +#define MAX_LOW_BATT_CHECK_CNT 10 + +/* FullCap learning setting */ +#define VFFULLCAP_CHECK_INTERVAL 300 /* sec */ +/* soc should be 0.1% unit */ +#define VFSOC_FOR_FULLCAP_LEARNING 950 +#define LOW_CURRENT_FOR_FULLCAP_LEARNING 20 +#define HIGH_CURRENT_FOR_FULLCAP_LEARNING 120 +#define LOW_AVGCURRENT_FOR_FULLCAP_LEARNING 20 +#define HIGH_AVGCURRENT_FOR_FULLCAP_LEARNING 100 + +/* power off margin */ +/* soc should be 0.1% unit */ +#define POWER_OFF_SOC_HIGH_MARGIN 20 +#define POWER_OFF_VOLTAGE_HIGH_MARGIN 3500 +#define POWER_OFF_VOLTAGE_LOW_MARGIN 3400 + +/* FG recovery handler */ +/* soc should be 0.1% unit */ +#define STABLE_LOW_BATTERY_DIFF 30 +#define STABLE_LOW_BATTERY_DIFF_LOWBATT 10 +#define LOW_BATTERY_SOC_REDUCE_UNIT 10 + + +//#endif + +struct max17047_platform_data { + int irq_gpio; + + bool enable_current_sense; + bool enable_gauging_temperature; + + const char *psy_name; +}; + +#endif + diff --git a/include/linux/battery/samsung_battery.h b/include/linux/battery/samsung_battery.h index 2293fce..acaed33 100644 --- a/include/linux/battery/samsung_battery.h +++ b/include/linux/battery/samsung_battery.h @@ -185,6 +185,10 @@ struct battery_info { unsigned int prev_battery_soc; struct wake_lock update_wake_lock; #endif +#if defined(CONFIG_MACH_KONA) + unsigned int is_comp_3; + unsigned int is_comp_1; +#endif }; /* jig state */ diff --git a/include/linux/exynos_audio.h b/include/linux/exynos_audio.h index b510119..c429ffc 100644 --- a/include/linux/exynos_audio.h +++ b/include/linux/exynos_audio.h @@ -22,6 +22,15 @@ #ifndef _LINUX_EXYNOS_T0_SOUND_H #define _LINUX_EXYNOS_T0_SOUND_H +#ifdef CONFIG_USE_ADC_DET +struct jack_zone { + unsigned int adc_high; + unsigned int delay_ms; + unsigned int check_count; + unsigned int jack_type; +}; +#endif + struct exynos_sound_platform_data { void (*set_lineout_switch) (int on); void (*set_ext_main_mic) (int on); @@ -33,6 +42,11 @@ struct exynos_sound_platform_data { #endif int dcs_offset_l; int dcs_offset_r; +#ifdef CONFIG_USE_ADC_DET + struct jack_zone *zones; + int num_zones; + int use_jackdet_type; +#endif }; #ifdef CONFIG_EXYNOS_SOUND_PLATFORM_DATA diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h index c3be488..a396a5b 100644 --- a/include/linux/gpio_keys.h +++ b/include/linux/gpio_keys.h @@ -24,6 +24,9 @@ struct gpio_keys_platform_data { int (*enable)(struct device *dev); void (*disable)(struct device *dev); const char *name; /* input device name */ +#ifdef CONFIG_SENSORS_HALL + int gpio_flip_cover; +#endif }; #endif diff --git a/include/linux/input.h b/include/linux/input.h index d75f6f5..5694583 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -449,6 +449,11 @@ struct input_keymap_entry { #define KEY_FOLDER_CLOSE 252 /*only use Grande CHN CTC */ #define KEY_3G 253 /*only use Grande CHN CTC */ +/* kona dummy touchkey */ +#define KEY_DUMMY_1 251 +#define KEY_DUMMY_2 252 +#define KEY_DUMMY_3 253 + /* Code 255 is reserved for special needs of AT keyboard driver */ #define BTN_MISC 0x100 @@ -836,7 +841,14 @@ struct input_keymap_entry { #define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */ #define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */ #define SW_PEN_INSERT 0x0e /* set = pen out */ -#define SW_MAX 0x0f +#define SW_STROBE_INSERT 0x0f /* set = strobe out */ +//#ifdef CONFIG_SENSORS_HALL +//#define SW_FLIP 0x10 /* set = flip cover... */ +//#define SW_MAX 0x17 +//#else +#define SW_MAX 0x10 +//#endif + #define SW_CNT (SW_MAX+1) /* diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index ae28e93..e21658d 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -292,7 +292,11 @@ struct pcmcia_device_id { #define INPUT_DEVICE_ID_LED_MAX 0x0f #define INPUT_DEVICE_ID_SND_MAX 0x07 #define INPUT_DEVICE_ID_FF_MAX 0x7f -#define INPUT_DEVICE_ID_SW_MAX 0x0f +/*#ifdef CONFIG_SENSORS_HALL +#define INPUT_DEVICE_ID_SW_MAX 0x17 +#else*/ +#define INPUT_DEVICE_ID_SW_MAX 0x10 +//#endif #define INPUT_DEVICE_ID_MATCH_BUS 1 #define INPUT_DEVICE_ID_MATCH_VENDOR 2 diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h new file mode 100644 index 0000000..a3398fb --- /dev/null +++ b/include/linux/platform_data/lp855x.h @@ -0,0 +1,132 @@ +/* + * LP855x Backlight Driver + * + * Copyright (C) 2011 Texas Instruments + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#ifndef _LP855X_H +#define _LP855X_H + +#define BL_CTL_SHFT (0) +#define BRT_MODE_SHFT (1) +#define BRT_MODE_MASK (0x06) + +/* Enable backlight. Only valid when BRT_MODE=10(I2C only) */ +#define ENABLE_BL (1) +#define DISABLE_BL (0) + +#define I2C_CONFIG(id) id ## _I2C_CONFIG +#define PWM_CONFIG(id) id ## _PWM_CONFIG + +/* DEVICE CONTROL register - LP8550 */ +#define LP8550_PWM_CONFIG (LP8550_PWM_ONLY << BRT_MODE_SHFT) +#define LP8550_I2C_CONFIG ((ENABLE_BL << BL_CTL_SHFT) | \ + (LP8550_I2C_ONLY << BRT_MODE_SHFT)) + +/* DEVICE CONTROL register - LP8551 */ +#define LP8551_PWM_CONFIG LP8550_PWM_CONFIG +#define LP8551_I2C_CONFIG LP8550_I2C_CONFIG + +/* DEVICE CONTROL register - LP8552 */ +#define LP8552_PWM_CONFIG LP8550_PWM_CONFIG +#define LP8552_I2C_CONFIG LP8550_I2C_CONFIG + +/* DEVICE CONTROL register - LP8553 */ +#define LP8553_PWM_CONFIG LP8550_PWM_CONFIG +#define LP8553_I2C_CONFIG LP8550_I2C_CONFIG + +/* DEVICE CONTROL register - LP8556 */ +#define LP8556_PWM_CONFIG (LP8556_PWM_ONLY << BRT_MODE_SHFT) +#define LP8556_COMB1_CONFIG (LP8556_COMBINED1 << BRT_MODE_SHFT) +#define LP8556_I2C_CONFIG ((ENABLE_BL << BL_CTL_SHFT) | \ + (LP8556_I2C_ONLY << BRT_MODE_SHFT)) +#define LP8556_COMB2_CONFIG (LP8556_COMBINED2 << BRT_MODE_SHFT) + +enum lp855x_chip_id { + LP8550, + LP8551, + LP8552, + LP8553, + LP8556, +}; + +enum lp855x_brightness_ctrl_mode { + PWM_BASED = 1, + REGISTER_BASED, +}; + +enum lp8550_brighntess_source { + LP8550_PWM_ONLY, + LP8550_I2C_ONLY = 2, +}; + +enum lp8551_brighntess_source { + LP8551_PWM_ONLY = LP8550_PWM_ONLY, + LP8551_I2C_ONLY = LP8550_I2C_ONLY, +}; + +enum lp8552_brighntess_source { + LP8552_PWM_ONLY = LP8550_PWM_ONLY, + LP8552_I2C_ONLY = LP8550_I2C_ONLY, +}; + +enum lp8553_brighntess_source { + LP8553_PWM_ONLY = LP8550_PWM_ONLY, + LP8553_I2C_ONLY = LP8550_I2C_ONLY, +}; + +enum lp8556_brightness_source { + LP8556_PWM_ONLY, + LP8556_COMBINED1, /* pwm + i2c before the shaper block */ + LP8556_I2C_ONLY, + LP8556_COMBINED2, /* pwm + i2c after the shaper block */ +}; + +struct lp855x_pwm_data { + void (*pwm_set_intensity) (int brightness, int max_brightness); + int (*pwm_get_intensity) (int max_brightness); +}; + +struct lp855x_rom_data { + u8 addr; + u8 val; + u8 mask; +}; + +/** + * struct lp855x_platform_data + * @name : Backlight driver name. If it is not defined, default name is set. + * @mode : brightness control by pwm or lp855x register + * @device_control : value of DEVICE CONTROL register + * @initial_brightness : initial value of backlight brightness + * @pwm_data : platform specific pwm generation functions. + Only valid when mode is PWM_BASED. + * @load_new_rom_data : + 0 : use default configuration data + 1 : update values of eeprom or eprom registers on loading driver + * @size_program : total size of lp855x_rom_data + * @rom_data : list of new eeprom/eprom registers + * @use_gpio_en : 1: use driver control power_en + * @gpio_en : power on gpio. + * @power_on_udelay : stable time needing to becom led power on. + */ +struct lp855x_platform_data { + char *name; + enum lp855x_brightness_ctrl_mode mode; + u8 device_control; + int initial_brightness; + struct lp855x_pwm_data pwm_data; + u8 load_new_rom_data; + int size_program; + struct lp855x_rom_data *rom_data; + u8 use_gpio_en; + unsigned gpio_en; + unsigned long power_on_udelay; +}; + +#endif diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 529d981..8289fca 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -126,6 +126,11 @@ enum power_supply_property { POWER_SUPPLY_PROP_MODEL_NAME, POWER_SUPPLY_PROP_MANUFACTURER, POWER_SUPPLY_PROP_SERIAL_NUMBER, +#if defined(CONFIG_MACH_KONA) + POWER_SUPPLY_PROP_CHARGING_MODE, + POWER_SUPPLY_PROP_COMPENSATION_1, + POWER_SUPPLY_PROP_COMPENSATION_3, +#endif }; enum power_supply_type { diff --git a/include/linux/sensor/gp2a.h b/include/linux/sensor/gp2a.h index 4b2b62c..08ec548 100644 --- a/include/linux/sensor/gp2a.h +++ b/include/linux/sensor/gp2a.h @@ -28,6 +28,11 @@ #define ADC_BUFFER_NUM 6 +#define DEFAULT_LO_THR 0x07 /* sharp recommand Loff */ +#define DEFAULT_HI_THR 0x08 /* sharp recommand Lon */ + +#define OFFSET_ARRAY_LENGTH 10 + /* 16 level for premium model*/ enum { LIGHT_DIM = 0, @@ -58,12 +63,18 @@ extern char proximity_sensor_detection; /* prototype */ int opt_i2c_read(u8 reg, unsigned char *rbuf, int len); int opt_i2c_write(u8 reg, u8 *val); +#ifndef CONFIG_MACH_KONA_SENSOR int lightsensor_get_adcvalue(void); +#endif int is_gp2a030a(void); struct gp2a_platform_data { int (*gp2a_led_on) (bool); int p_out; /* proximity-sensor-output gpio */ +#ifdef CONFIG_MACH_KONA_SENSOR + unsigned long (*gp2a_get_threshold)(u8 *); +#else unsigned long (*gp2a_get_threshold)(void); +#endif }; #endif diff --git a/include/linux/sensor/sensors_core.h b/include/linux/sensor/sensors_core.h index 969e460..03e86c0 100644 --- a/include/linux/sensor/sensors_core.h +++ b/include/linux/sensor/sensors_core.h @@ -13,6 +13,9 @@ extern struct device *sensors_classdev_register(char *sensors_name); extern void sensors_classdev_unregister(struct device *dev); +extern int sensors_register(struct device *dev, + void *drvdata, struct device_attribute *attributes[], char *name); +extern void sensors_unregister(struct device *dev); struct accel_platform_data { int (*accel_get_position) (void); diff --git a/include/linux/sensor/yas.h b/include/linux/sensor/yas.h new file mode 100644 index 0000000..4f89d0a --- /dev/null +++ b/include/linux/sensor/yas.h @@ -0,0 +1,474 @@ +/* + * Copyright (c) 2010-2011 Yamaha Corporation + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#ifndef __YAS_H__ +#define __YAS_H__ + +#include "yas_cfg.h" + +#define YAS_VERSION "9.0.8" + +/* ------------------ */ +/* Typedef definition */ +/* ------------------- */ + +#include <linux/types.h> + + +/* -------------------------- */ +/* Macro definition */ +/* ------------------------- */ + +/* Debugging */ +#define DEBUG (0) + +#if DEBUG +#include <linux/kernel.h> +#define YLOGD(args) (printk args) +#define YLOGI(args) (printk args) +#define YLOGE(args) (printk args) +#define YLOGW(args) (printk args) +#else /* DEBUG */ +#define YLOGD(args) +#define YLOGI(args) +#define YLOGW(args) +#define YLOGE(args) +#endif /* DEBUG */ + +#define YAS_REPORT_DATA (0x01) +#define YAS_REPORT_CALIB (0x02) +#define YAS_REPORT_OVERFLOW_OCCURED (0x04) +#define YAS_REPORT_HARD_OFFSET_CHANGED (0x08) +#define YAS_REPORT_CALIB_OFFSET_CHANGED (0x10) +#define YAS_X_OVERFLOW (0x01) +#define YAS_X_UNDERFLOW (0x02) +#define YAS_Y1_OVERFLOW (0x04) +#define YAS_Y1_UNDERFLOW (0x08) +#define YAS_Y2_OVERFLOW (0x10) +#define YAS_Y2_UNDERFLOW (0x20) + +#define YAS_HARD_OFFSET_UNKNOWN (0x7f) +#define YAS_CALIB_OFFSET_UNKNOWN (0x7fffffff) + +#define YAS_NO_ERROR (0) +#define YAS_ERROR_ARG (-1) +#define YAS_ERROR_NOT_INITIALIZED (-2) +#define YAS_ERROR_BUSY (-3) +#define YAS_ERROR_DEVICE_COMMUNICATION (-4) +#define YAS_ERROR_CHIP_ID (-5) +#define YAS_ERROR_NOT_ACTIVE (-6) +#define YAS_ERROR_RESTARTSYS (-7) +#define YAS_ERROR_HARDOFFSET_NOT_WRITTEN (-8) +#define YAS_ERROR_INTERRUPT (-9) +#define YAS_ERROR_CALREG (-10) +#define YAS_ERROR_ERROR (-128) + +enum cable_type_t { + CABLE_TYPE_NONE = 0, + CABLE_TYPE_USB, + CABLE_TYPE_AC, +}; + +#ifndef NULL +#define NULL ((void *)(0)) +#endif +#ifndef FALSE +#define FALSE (0) +#endif +#ifndef TRUE +#define TRUE (!(0)) +#endif +#ifndef NELEMS +#define NELEMS(a) ((int)(sizeof(a)/sizeof(a[0]))) +#endif +#ifndef ABS +#define ABS(a) ((a) > 0 ? (a) : -(a)) +#endif +#ifndef M_PI +#define M_PI (3.14159265358979323846) +#endif +#ifndef __GNUC__ +#define __attribute__(x) /* NOTHING */ +#endif + +enum { + YAS532_POSITION_0 = 1, + YAS532_POSITION_1, + YAS532_POSITION_2, + YAS532_POSITION_3, + YAS532_POSITION_4, + YAS532_POSITION_5, + YAS532_POSITION_6, + YAS532_POSITION_7, +}; + +#define YAS532_POSITION_OFFSET 1 + +/* -------------------------------------------------------------------------- */ +/* Structure definition */ +/* -------------------------------------------------------------------------- */ + +struct acc_platform_data { + const char *cal_path; + void (*ldo_on) (bool); + int orientation; +}; +struct accel_cal { + s16 v[3]; +}; +struct yas_mag_filter { + int len; + int noise[3]; + int threshold; /* nT */ +}; +struct yas_vector { + int32_t v[3]; +}; + +struct mag_platform_data { + void (*power_on) (bool); + int offset_enable; + int chg_status; + struct yas_vector ta_offset; + struct yas_vector usb_offset; + struct yas_vector full_offset; + int orientation; +}; + +struct yas_matrix { + int32_t matrix[9]; +}; +struct yas_acc_data { + struct yas_vector xyz; + struct yas_vector raw; +}; +struct yas_gyro_data { + struct yas_vector xyz; + struct yas_vector raw; + int overrun; + int num; +}; +struct yas_mag_data { + struct yas_vector xyz; /* without offset, filtered */ + struct yas_vector raw; /* with offset, not filtered */ + struct yas_vector xy1y2; + int16_t temperature; +}; + +struct yas_mag_offset { + int8_t hard_offset[3]; + struct yas_vector calib_offset; +}; +struct yas_mag_status { + struct yas_mag_offset offset; + int accuracy; + struct yas_matrix dynamic_matrix; +}; +struct yas_offset { + struct yas_mag_status mag[YAS_MAGCALIB_SHAPE_NUM]; +}; + +struct yas_mag_driver_callback { + int (*lock) (void); + int (*unlock) (void); + int (*device_open) (void); + int (*device_close) (void); +#if YAS_MAG_DRIVER == YAS_MAG_DRIVER_YAS529 + int (*device_write) (const uint8_t *buf, int len); + int (*device_read) (uint8_t *buf, int len); +#else + int (*device_write) (uint8_t addr, const uint8_t *buf, int len); + int (*device_read) (uint8_t addr, uint8_t *buf, int len); +#endif + void (*msleep) (int msec); + void (*current_time) (int32_t *sec, int32_t *msec); +}; + +struct yas_mag_driver { + int (*init) (void); + int (*term) (void); + int (*get_delay) (void); + int (*set_delay) (int msec); + int (*get_offset) (struct yas_mag_offset *offset); + int (*set_offset) (struct yas_mag_offset *offset); +#ifdef YAS_MAG_MANUAL_OFFSET + int (*get_manual_offset) (struct yas_vector *offset); + int (*set_manual_offset) (struct yas_vector *offset); +#endif + int (*get_static_matrix) (struct yas_matrix *static_matrix); + int (*set_static_matrix) (struct yas_matrix *static_matrix); + int (*get_dynamic_matrix) (struct yas_matrix *dynamic_matrix); + int (*set_dynamic_matrix) (struct yas_matrix *dynamic_matrix); + int (*get_enable) (void); + int (*set_enable) (int enable); + int (*get_filter) (struct yas_mag_filter *filter); + int (*set_filter) (struct yas_mag_filter *filter); + int (*get_filter_enable) (void); + int (*set_filter_enable) (int enable); + int (*get_position) (void); + int (*set_position) (int position); +#if YAS_MAG_DRIVER == YAS_MAG_DRIVER_YAS529 + int (*read_reg) (uint8_t *buf, int len); + int (*write_reg) (const uint8_t *buf, int len); +#else + int (*read_reg) (uint8_t addr, uint8_t *buf, int len); + int (*write_reg) (uint8_t addr, const uint8_t *buf, int len); +#endif + int (*measure) (struct yas_mag_data *data, int *time_delay_ms); + struct yas_mag_driver_callback callback; +}; + +struct yas_mag_calibration_result { + int32_t spread; + int32_t variation; + int32_t radius; + int8_t axis; + int8_t level; + int8_t accuracy; + struct yas_matrix dynamic_matrix; +}; + +struct yas_mag_calibration_threshold { + int32_t spread; + int32_t variation[3]; +}; + +struct yas_mag_calibration_callback { + int (*lock) (void); + int (*unlock) (void); +}; + +#define YAS_MAGCALIB_MODE_SPHERE (0) +#define YAS_MAGCALIB_MODE_ELLIPSOID (1) + +struct yas_mag_calibration { + int (*init) (void); + int (*term) (void); + int (*update) (struct yas_vector *mag, + struct yas_mag_calibration_result *result); + int (*get_accuracy) (void); + int (*set_accuracy) (int accuracy); + int (*get_offset) (struct yas_vector *offset); + int (*set_offset) (struct yas_vector *offset); + int (*get_shape) (void); + int (*set_shape) (int shape); + int (*get_threshold) (struct yas_mag_calibration_threshold *threshold); + int (*set_threshold) (struct yas_mag_calibration_threshold *threshold); + int (*get_mode) (void); + int (*set_mode) (int mode); + int (*get_max_sample) (void); + int (*set_max_sample) (int num_samples); + int (*get_dynamic_matrix) (struct yas_matrix *dynamic_matrix); + struct yas_mag_calibration_callback callback; +}; + +#if YAS_SUPPORT_FUSION_DRIVER + +struct yas_quaternion { + int32_t q[4]; +}; + +struct yas_fusion_callback { + int (*lock) (void); + int (*unlock) (void); + void (*current_time) (int32_t *sec, int32_t *msec); +}; + +struct yas_fusion { + int (*init) (void); + int (*term) (void); + int (*update) (struct yas_vector *acc, struct yas_vector *mag, + struct yas_vector *gyro); + int (*get_quaternion) (struct yas_quaternion *quaternion); + int (*get_fusion) (struct yas_quaternion *quaternion, + struct yas_vector *acc, struct yas_vector *gravity, + struct yas_vector *linear_acceleration, + struct yas_vector *rotation_vector); + struct yas_fusion_callback callback; +}; +#endif + +#if YAS_SUPPORT_SOFTWARE_GYROSCOPE + +struct yas_swgyro_callback { + int (*lock) (void); + int (*unlock) (void); +}; + +struct yas_swgyro { + int (*init) (void); + int (*term) (void); + int (*get_delay) (void); + int (*set_delay) (int msec); + int (*update) (struct yas_vector *acc, struct yas_vector *mag, + struct yas_vector *gyro); + struct yas_swgyro_callback callback; +}; + +#endif + +struct yas_acc_filter { + int threshold; /* um/s^2 */ +}; + +struct yas_acc_driver_callback { + int (*lock) (void); + int (*unlock) (void); + int (*device_open) (void); + int (*device_close) (void); + int (*device_write) (uint8_t adr, const uint8_t *buf, int len); + int (*device_read) (uint8_t adr, uint8_t *buf, int len); + void (*msleep) (int msec); +}; + +struct yas_acc_driver { + int (*init) (void); + int (*term) (void); + int (*get_delay) (void); + int (*set_delay) (int delay); + int (*get_offset) (struct yas_vector *offset); + int (*set_offset) (struct yas_vector *offset); + int (*get_enable) (void); + int (*set_enable) (int enable); + int (*get_filter) (struct yas_acc_filter *filter); + int (*set_filter) (struct yas_acc_filter *filter); + int (*get_filter_enable) (void); + int (*set_filter_enable) (int enable); + int (*get_position) (void); + int (*set_position) (int position); + int (*measure) (struct yas_acc_data *data); + void (*set_motion_interrupt)(bool enable, bool factorytest); + int (*get_motion_interrupt)(void); +#if DEBUG + int (*get_register) (uint8_t adr, uint8_t *val); +#endif + struct yas_acc_driver_callback callback; +}; + +struct yas_acc_calibration_threshold { + int32_t variation; +}; + +struct yas_acc_calibration_callback { + int (*lock) (void); + int (*unlock) (void); +}; + +struct yas_acc_calibration { + int (*init) (void); + int (*term) (void); + int (*update) (struct yas_vector *acc); + int (*get_offset) (struct yas_vector *offset); + int (*get_threshold) (struct yas_acc_calibration_threshold *threshold); + int (*set_threshold) (struct yas_acc_calibration_threshold *threshold); + struct yas_acc_calibration_callback callback; +}; + +struct yas_gyro_filter { + int threshold; /*mdegree/s */ +}; + +struct yas_gyro_driver_callback { + int (*lock) (void); + int (*unlock) (void); + int (*device_open) (void); + int (*device_close) (void); + int (*device_write) (uint8_t adr, const uint8_t *buf, int len); + int (*device_read) (uint8_t adr, uint8_t *buf, int len); + int (*interrupt_enable) (void); + int (*interrupt_disable) (void); + void (*interrupt_notify) (int num); + void (*msleep) (int msec); +}; + +struct yas_gyro_driver { + int (*init) (void); + int (*term) (void); + int (*get_delay) (void); + int (*set_delay) (int delay); + int (*get_offset) (struct yas_vector *offset); + int (*set_offset) (struct yas_vector *offset); + int (*get_enable) (void); + int (*set_enable) (int enable); + int (*get_filter) (struct yas_gyro_filter *filter); + int (*set_filter) (struct yas_gyro_filter *filter); + int (*get_filter_enable) (void); + int (*set_filter_enable) (int enable); + int (*get_position) (void); + int (*set_position) (int position); + int (*get_interrupt) (void); + int (*set_interrupt) (int interrupt); + int (*measure) (struct yas_gyro_data *data, int num); + void (*interrupt_handler) (void); +#if DEBUG + int (*get_register) (uint8_t adr, uint8_t *val); + int (*set_register) (uint8_t adr, uint8_t val); +#endif + struct yas_gyro_driver_callback callback; +}; + +struct yas_gyro_calibration_threshold { + int32_t variation; +}; + +struct yas_gyro_calibration_callback { + int (*lock) (void); + int (*unlock) (void); +}; + +struct yas_gyro_calibration { + int (*init) (void); + int (*term) (void); + int (*update) (struct yas_vector *gyro); + int (*get_offset) (struct yas_vector *offset); + int (*get_threshold) (struct yas_gyro_calibration_threshold * + threshold); + int (*set_threshold) (struct yas_gyro_calibration_threshold * + threshold); + struct yas_gyro_calibration_callback callback; +}; + +struct yas_utility { + int (*get_rotation_matrix) (struct yas_vector *acc, + struct yas_vector *mag, + struct yas_matrix *rotation_matrix); + int (*get_euler) (struct yas_matrix *rotation_matrix, + struct yas_vector *euler); +}; + +/*-------------------------------------------------------------------------- */ +/* Global function definition */ +/*-------------------------------------------------------------------------- */ + +int yas_mag_driver_init(struct yas_mag_driver *f); +int yas_mag_calibration_init(struct yas_mag_calibration *f); +int yas_acc_driver_init(struct yas_acc_driver *f); +int yas_acc_calibration_init(struct yas_acc_calibration *f); +int yas_gyro_driver_init(struct yas_gyro_driver *f, int interrupt); +int yas_gyro_calibration_init(struct yas_gyro_calibration *f); +int yas_utility_init(struct yas_utility *f); +#if YAS_SUPPORT_FUSION_DRIVER +int yas_fusion_init(struct yas_fusion *f); +#endif +#if YAS_SUPPORT_SOFTWARE_GYROSCOPE +int yas_swgyro_init(struct yas_swgyro *f); +#endif + +#endif /*__YAS_H__ */ diff --git a/include/linux/sensor/yas_cfg.h b/include/linux/sensor/yas_cfg.h new file mode 100644 index 0000000..9af4f47 --- /dev/null +++ b/include/linux/sensor/yas_cfg.h @@ -0,0 +1,250 @@ +/* + * Copyright (c) 2010-2012 Yamaha Corporation + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +#ifndef __YAS_CFG_H__ +#define __YAS_CFG_H__ + +#define YAS_MAG_DRIVER_NONE (-1) +#define YAS_MAG_DRIVER_YAS529 (1) +#define YAS_MAG_DRIVER_YAS530 (2) +#define YAS_MAG_DRIVER_YAS532 (3) + +#define YAS_ACC_DRIVER_NONE (-1) +#define YAS_ACC_DRIVER_ADXL345 (0) +#define YAS_ACC_DRIVER_ADXL346 (1) +#define YAS_ACC_DRIVER_BMA150 (2) +#define YAS_ACC_DRIVER_BMA222 (3) +#define YAS_ACC_DRIVER_BMA250 (4) +#define YAS_ACC_DRIVER_BMA254 (5) +#define YAS_ACC_DRIVER_KXSD9 (6) +#define YAS_ACC_DRIVER_KXTE9 (7) +#define YAS_ACC_DRIVER_KXTF9 (8) +#define YAS_ACC_DRIVER_KXTJ2 (9) +#define YAS_ACC_DRIVER_KXUD9 (10) +#define YAS_ACC_DRIVER_LIS331DL (11) +#define YAS_ACC_DRIVER_LIS331DLH (12) +#define YAS_ACC_DRIVER_LIS331DLM (13) +#define YAS_ACC_DRIVER_LIS3DH (14) +#define YAS_ACC_DRIVER_MMA8452Q (15) +#define YAS_ACC_DRIVER_MMA8453Q (16) + +#define YAS_GYRO_DRIVER_NONE (-1) +#define YAS_GYRO_DRIVER_ITG3200 (0) +#define YAS_GYRO_DRIVER_L3G4200D (1) +#define YAS_GYRO_DRIVER_EWTZMU (2) + +/*----------------------------------------------------------------------------*/ +/* Configuration */ +/*----------------------------------------------------------------------------*/ + + +#ifdef CONFIG_ACC_DRIVER_LIS3DH +#define YAS_ACC_DRIVER (YAS_ACC_DRIVER_LIS3DH) +#else +#define YAS_ACC_DRIVER (YAS_ACC_DRIVER_BMA250) +#endif + +#ifdef CONFIG_MAG_DRIVER_YAS532 +#define YAS_MAG_DRIVER (YAS_MAG_DRIVER_YAS532) +#else +#define YAS_MAG_DRIVER (YAS_MAG_DRIVER_YAS530) +#endif +#define YAS_GYRO_DRIVER (YAS_GYRO_DRIVER_NONE) + +/*----------------------------------------------------------------------------*/ +/* Acceleration Calibration Configuration */ +/*----------------------------------------------------------------------------*/ + + +#define YAS_DEFAULT_ACCCALIB_LENGTH (20) + +#if YAS_ACC_DRIVER == YAS_ACC_DRIVER_ADXL345 +#define YAS_DEFAULT_ACCCALIB_DISTORTION (8000) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_ADXL346 +#define YAS_DEFAULT_ACCCALIB_DISTORTION (4000) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_BMA150 +#define YAS_DEFAULT_ACCCALIB_DISTORTION (4000) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_BMA222 +#define YAS_DEFAULT_ACCCALIB_DISTORTION (25000) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_BMA250 +#define YAS_DEFAULT_ACCCALIB_DISTORTION (20000) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_BMA254 +#define YAS_DEFAULT_ACCCALIB_DISTORTION (4000) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_KXSD9 +#define YAS_DEFAULT_ACCCALIB_DISTORTION (80000) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_KXTE9 +#define YAS_DEFAULT_ACCCALIB_DISTORTION (400000) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_KXTF9 +#define YAS_DEFAULT_ACCCALIB_DISTORTION (2000) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_KXTJ2 +#define YAS_DEFAULT_ACCCALIB_DISTORTION (8000) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_KXUD9 +#define YAS_DEFAULT_ACCCALIB_DISTORTION (20000) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_LIS331DL +#define YAS_DEFAULT_ACCCALIB_DISTORTION (17000) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_LIS331DLH +#define YAS_DEFAULT_ACCCALIB_DISTORTION (6000) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_LIS331DLM +#define YAS_DEFAULT_ACCCALIB_DISTORTION (28000) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_LIS3DH +#define YAS_DEFAULT_ACCCALIB_DISTORTION (18000) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_MMA8452Q +#define YAS_DEFAULT_ACCCALIB_DISTORTION (1000) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_MMA8453Q +#define YAS_DEFAULT_ACCCALIB_DISTORTION (1000) +#else +#define YAS_DEFAULT_ACCCALIB_DISTORTION (0) +#endif + +/*----------------------------------------------------------------------------*/ +/* Accelerometer Filter Configuration */ +/*----------------------------------------------------------------------------*/ + +#if YAS_ACC_DRIVER == YAS_ACC_DRIVER_ADXL345 +#define YAS_ACC_DEFAULT_FILTER_THRESH (76612) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_ADXL346 +#define YAS_ACC_DEFAULT_FILTER_THRESH (76612) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_BMA150 +#define YAS_ACC_DEFAULT_FILTER_THRESH (76612) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_BMA222 +#define YAS_ACC_DEFAULT_FILTER_THRESH (153227) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_BMA250 +#define YAS_ACC_DEFAULT_FILTER_THRESH (76612) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_BMA254 +#define YAS_ACC_DEFAULT_FILTER_THRESH (19152) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_KXSD9 +#define YAS_ACC_DEFAULT_FILTER_THRESH (239460) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_KXTE9 +#define YAS_ACC_DEFAULT_FILTER_THRESH (612909) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_KXTF9 +#define YAS_ACC_DEFAULT_FILTER_THRESH (19152) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_KXTJ2 +#define YAS_ACC_DEFAULT_FILTER_THRESH (38304) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_KXUD9 +#define YAS_ACC_DEFAULT_FILTER_THRESH (215514) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_LIS331DL +#define YAS_ACC_DEFAULT_FILTER_THRESH (176518) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_LIS331DLH +#define YAS_ACC_DEFAULT_FILTER_THRESH (95760) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_LIS331DLM +#define YAS_ACC_DEFAULT_FILTER_THRESH (306454) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_LIS3DH +#define YAS_ACC_DEFAULT_FILTER_THRESH (76608) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_MMA8452Q +#define YAS_ACC_DEFAULT_FILTER_THRESH (19152) +#elif YAS_ACC_DRIVER == YAS_ACC_DRIVER_MMA8453Q +#define YAS_ACC_DEFAULT_FILTER_THRESH (38306) +#else +#define YAS_ACC_DEFAULT_FILTER_THRESH (0) +#endif + +/*----------------------------------------------------------------------------*/ +/* Geomagnetic Calibration Configuration */ +/*----------------------------------------------------------------------------*/ + +#define YAS_DEFAULT_MAGCALIB_THRESHOLD (1) +#define YAS_DEFAULT_MAGCALIB_DISTORTION (15) +#define YAS_DEFAULT_MAGCALIB_SHAPE (0) +#define YAS_MAGCALIB_SHAPE_NUM (2) +#define YAS_MAG_MANUAL_OFFSET + +/*----------------------------------------------------------------------------*/ +/* Geomagnetic Filter Configuration */ +/*----------------------------------------------------------------------------*/ + +#define YAS_MAG_MAX_FILTER_LEN (30) +#define YAS_MAG_DEFAULT_FILTER_NOISE_X (144) /* sd: 1200 nT */ +#define YAS_MAG_DEFAULT_FILTER_NOISE_Y (144) /* sd: 1200 nT */ +#define YAS_MAG_DEFAULT_FILTER_NOISE_Z (144) /* sd: 1200 nT */ +#define YAS_MAG_DEFAULT_FILTER_LEN (20) + +#if YAS_MAG_DRIVER == YAS_MAG_DRIVER_YAS529 +#define YAS_MAG_DEFAULT_FILTER_THRESH (300) +#elif YAS_MAG_DRIVER == YAS_MAG_DRIVER_YAS530 +#define YAS_MAG_DEFAULT_FILTER_THRESH (100) +#elif YAS_MAG_DRIVER == YAS_MAG_DRIVER_YAS532 +#define YAS_MAG_DEFAULT_FILTER_THRESH (300) +#else +#define YAS_MAG_DEFAULT_FILTER_THRESH (0) +#endif + +/*----------------------------------------------------------------------------*/ +/* Gyroscope Calibration Configuration */ +/*----------------------------------------------------------------------------*/ + +#define YAS_DEFAULT_GYROCALIB_LENGTH (20) + +#if YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_ITG3200 +#define YAS_DEFAULT_GYROCALIB_DISTORTION (0) +#elif YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_L3G4200D +#define YAS_DEFAULT_GYROCALIB_DISTORTION (2500000) +#elif YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_EWTZMU +#define YAS_DEFAULT_GYROCALIB_DISTORTION (400000) +#else +#define YAS_DEFAULT_GYROCALIB_DISTORTION (0) +#endif + +/*----------------------------------------------------------------------------*/ +/* Gyroscope Filter Configuration */ +/*----------------------------------------------------------------------------*/ +#if YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_ITG3200 +#define YAS_GYRO_DEFAULT_FILTER_THRESH (0) +#elif YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_L3G4200D +#define YAS_GYRO_DEFAULT_FILTER_THRESH (280) /* 70mdps x 4 */ +#elif YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_EWTZMU +#define YAS_GYRO_DEFAULT_FILTER_THRESH (320) /* 80mdps x 4 */ +#else +#define YAS_GYRO_DEFAULT_FILTER_THRESH (0) +#endif + +/*----------------------------------------------------------------------------*/ +/* Gyroscope Configuration */ +/*----------------------------------------------------------------------------*/ + +#if YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_ITG3200 +#define YAS_GYRO_FIFO_MAX (1) +#elif YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_L3G4200D +#define YAS_GYRO_FIFO_MAX (32) +#elif YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_EWTZMU +#define YAS_GYRO_FIFO_MAX (32) +#else +#define YAS_GYRO_FIFO_MAX (1) +#endif + +/*----------------------------------------------------------------------------*/ +/* Other Configuration */ +/*----------------------------------------------------------------------------*/ +#undef YAS_SENSOR_KERNEL_DEVFILE_INTERFACE +#define YAS_SUPPORT_FUSION_DRIVER (0) +#define YAS_SUPPORT_SOFTWARE_GYROSCOPE (0) + +#if YAS_ACC_DRIVER == YAS_ACC_DRIVER_NONE \ + || YAS_MAG_DRIVER == YAS_MAG_DRIVER_NONE \ + || YAS_GYRO_DRIVER == YAS_GYRO_DRIVER_NONE +#undef YAS_SUPPORT_FUSION_DRIVER +#define YAS_SUPPORT_FUSION_DRIVER (0) +#endif + +#if YAS_SUPPORT_SOFTWARE_GYROSCOPE && YAS_GYRO_DRIVER != YAS_GYRO_DRIVER_NONE +#undef YAS_SUPPORT_SOFTWARE_GYROSCOPE +#define YAS_SUPPORT_SOFTWARE_GYROSCOPE (0) +#endif + +#endif diff --git a/include/linux/synaptics_s7301.h b/include/linux/synaptics_s7301.h index 09284a0..5c0b471 100644 --- a/include/linux/synaptics_s7301.h +++ b/include/linux/synaptics_s7301.h @@ -50,10 +50,57 @@ #define FUNC_ADDR_SIZE 6 #define FUNC_ADDR_LAST 0xdd #define FUNC_ADDR_FIRST 0xe9 -#define PAGE_MAX 0X100 +#define PAGE_MAX 0X400 +#define NEXT_PAGE 0X100 #define MAX_FUNC 0x55 #define CHARGER_CONNECT_BIT (0x1 << 5) +#define MIN_ANGLE -90 +#define MAX_ANGLE 90 + +#define BUTTON_0_MASK (1 << 0) +#define BUTTON_1_MASK (1 << 1) +#define BUTTON_2_MASK (1 << 2) +#define BUTTON_3_MASK (1 << 3) +#define BUTTON_4_MASK (1 << 4) +#define BUTTON_5_MASK (1 << 5) +#define BUTTON_6_MASK (1 << 6) +#define BUTTON_7_MASK (1 << 7) + +/* button threshhold limit */ +#define BUTTON_THRESHOLD_LIMIT 1000 +#define BUTTON_THRESHOLD_MIN 0 + +/* fixed threshold */ +#define BUTTON2_0_THRESHOLD 78 +#define BUTTON2_1_THRESHOLD 50 + +#if defined(CONFIG_KONA_01_BD) +#define BUTTON5_0_THRESHOLD 250 +#define BUTTON5_1_THRESHOLD 70 +#define BUTTON5_2_THRESHOLD 220 +#define BUTTON5_3_THRESHOLD 70 +#define BUTTON5_4_THRESHOLD 250 +#else +#define BUTTON5_0_THRESHOLD 256 +#define BUTTON5_1_THRESHOLD 65 +#define BUTTON5_2_THRESHOLD 400 +#define BUTTON5_3_THRESHOLD 70 +#define BUTTON5_4_THRESHOLD 300 +#endif + +enum BUTTON{ + BUTTON1 = 0, + BUTTON2, + BUTTON3, + BUTTON4, + BUTTON5, + BUTTON6, + BUTTON7, + BUTTON8, + BUTTON_MAX, +}; + enum MT_STATUS { MT_STATUS_INACTIVE = 0, MT_STATUS_PRESS, @@ -69,6 +116,9 @@ struct finger_info { int w_max; int z; int status; + int angle; + int width; + }; struct finger_data { @@ -123,17 +173,49 @@ struct synaptics_ts_fw_block { u32 config_imagesize; }; +#if defined(CONFIG_TOUCHSCREEN_SYNAPTICS_S7301_KEYS) +struct synaptics_button_map { + u8 nbuttons; + u8 *map; +}; + +struct synaptics_extend_button_map { + u8 nbuttons; + u8 *map; + u8 button_mask; +}; + +#endif + struct synaptics_platform_data { int gpio_attn; int max_x; int max_y; int max_pressure; int max_width; + bool swap_xy; + bool invert_x; + bool invert_y; +#ifdef CONFIG_SEC_TOUCHSCREEN_SURFACE_TOUCH + u8 palm_threshold; +#endif u16 x_line; u16 y_line; int (*set_power)(bool); void (*hw_reset)(void); void (*register_cb)(struct charger_callbacks *); +#if defined(CONFIG_TOUCHSCREEN_SYNAPTICS_S7301_KEYLED) + void (*led_control)(int); + bool led_event; +#endif + +#if defined(CONFIG_TOUCHSCREEN_SYNAPTICS_S7301_KEYS) + struct synaptics_button_map *button_map; + struct synaptics_extend_button_map *extend_button_map; + bool support_extend_button; + bool enable_extend_button_event; + int button_pressure[BUTTON_MAX]; +#endif }; struct synaptics_drv_data { @@ -147,11 +229,21 @@ struct synaptics_drv_data { struct work_struct fw_update_work; struct function_info f01; struct function_info f11; +#if defined (CONFIG_TOUCHSCREEN_SYNAPTICS_S7301_KEYS) + struct function_info f1a; +#endif struct function_info f34; struct function_info f54; +#ifdef CONFIG_SEC_TOUCHSCREEN_SURFACE_TOUCH + struct function_info f51; +#endif struct delayed_work init_dwork; struct delayed_work resume_dwork; struct delayed_work noti_dwork; +#if defined (CONFIG_TOUCHSCREEN_SYNAPTICS_S7301_WORKAROUND) + struct delayed_work reset_dwork; + bool firmware_update_check; +#endif struct charger_callbacks callbacks; struct finger_info finger[MAX_MT_CNT]; #if CONFIG_HAS_EARLYSUSPEND @@ -174,12 +266,15 @@ struct synaptics_drv_data { u8 cmd_status; u8 cmd_report_type; u8 cmd_result[MAX_CMD_SIZE]; - u8 firm_version[4]; + u8 firm_version[5]; u8 firm_config[13]; u8 *cmd_temp; u8 *references; u8 *tx_to_tx; u8 *tx_to_gnd; +#if defined(CONFIG_SEC_TOUCHSCREEN_SURFACE_TOUCH) + u8 palm_flag; +#endif u16 x_line; u16 y_line; u16 refer_max; diff --git a/include/linux/wacom_i2c.h b/include/linux/wacom_i2c.h index 326695a..2b95198 100644 --- a/include/linux/wacom_i2c.h +++ b/include/linux/wacom_i2c.h @@ -47,7 +47,11 @@ #define COM_CHECKSUM 0x63 /*I2C address for digitizer and its boot loader*/ -#define WACOM_I2C_ADDR 0x56 +#ifdef CONFIG_EPEN_WACOM_G9PL +#define WACOM_I2C_BOOT 0x09 +#else +#define WACOM_I2C_BOOT 0x57 +#endif #define WACOM_I2C_BOOT 0x57 /*Information for input_dev*/ @@ -73,7 +77,11 @@ #define PDCT_NOSIGNAL 1 #define PDCT_DETECT_PEN 0 +#ifdef CONFIG_MACH_KONA +#define WACOM_PRESSURE_MAX 1024 +#else #define WACOM_PRESSURE_MAX 255 +#endif /*Digitizer Type*/ #define EPEN_DTYPE_B660 1 @@ -272,6 +280,31 @@ #endif +#elif defined(CONFIG_MACH_KONA) + +#define WACOM_DVFS_LOCK_FREQ 800000 +#ifdef CONFIG_SEC_TOUCHSCREEN_DVFS_LOCK +#define SEC_BUS_LOCK +#endif +#define WACOM_HAVE_FWE_PIN +#define WACOM_USE_SOFTKEY + +#define BATTERY_SAVING_MODE +#define WACOM_CONNECTION_CHECK + +#define WACOM_MAX_COORD_X 10804 +#define WACOM_MAX_COORD_Y 17322 +#define WACOM_POSX_OFFSET 100 +#define WACOM_POSY_OFFSET 100 +#define WACOM_MAX_PRESSURE 1023 + +#define WACOM_IRQ_WORK_AROUND +#define WACOM_PEN_DETECT +/* For Android origin */ +#define WACOM_POSX_MAX WACOM_MAX_COORD_Y +#define WACOM_POSY_MAX WACOM_MAX_COORD_X + +#define COOR_WORK_AROUND #endif /*End of Model config*/ @@ -309,9 +342,9 @@ static struct wacom_features wacom_feature_EMR = { .y_max = 0x34F8, .pressure_max = 0xFF, #else - .x_max = 16128, - .y_max = 8448, - .pressure_max = 256, + .x_max = WACOM_MAX_COORD_X, + .y_max = WACOM_MAX_COORD_Y, + .pressure_max = WACOM_MAX_PRESSURE, #endif .comstat = COM_QUERY, .data = {0, 0, 0, 0, 0, 0, 0}, |