Fixed MTP to work with TWRP

This commit is contained in:
awab228 2018-06-19 23:16:04 +02:00
commit f6dfaef42e
50820 changed files with 20846062 additions and 0 deletions

View file

@ -0,0 +1,64 @@
/*
* include/linux/input/ad714x.h
*
* AD714x is very flexible, it can be used as buttons, scrollwheel,
* slider, touchpad at the same time. That depends on the boards.
* The platform_data for the device's "struct device" holds this
* information.
*
* Copyright 2009-2011 Analog Devices Inc.
*
* Licensed under the GPL-2 or later.
*/
#ifndef __LINUX_INPUT_AD714X_H__
#define __LINUX_INPUT_AD714X_H__
#define STAGE_NUM 12
#define STAGE_CFGREG_NUM 8
#define SYS_CFGREG_NUM 8
/* board information which need be initialized in arch/mach... */
struct ad714x_slider_plat {
int start_stage;
int end_stage;
int max_coord;
};
struct ad714x_wheel_plat {
int start_stage;
int end_stage;
int max_coord;
};
struct ad714x_touchpad_plat {
int x_start_stage;
int x_end_stage;
int x_max_coord;
int y_start_stage;
int y_end_stage;
int y_max_coord;
};
struct ad714x_button_plat {
int keycode;
unsigned short l_mask;
unsigned short h_mask;
};
struct ad714x_platform_data {
int slider_num;
int wheel_num;
int touchpad_num;
int button_num;
struct ad714x_slider_plat *slider;
struct ad714x_wheel_plat *wheel;
struct ad714x_touchpad_plat *touchpad;
struct ad714x_button_plat *button;
unsigned short stage_cfg_reg[STAGE_NUM][STAGE_CFGREG_NUM];
unsigned short sys_cfg_reg[SYS_CFGREG_NUM];
unsigned long irqflags;
};
#endif

View file

@ -0,0 +1,188 @@
/*
* Analog Devices ADP5589/ADP5585 I/O Expander and QWERTY Keypad Controller
*
* Copyright 2010-2011 Analog Devices Inc.
*
* Licensed under the GPL-2.
*/
#ifndef _ADP5589_H
#define _ADP5589_H
/*
* ADP5589 specific GPI and Keymap defines
*/
#define ADP5589_KEYMAPSIZE 88
#define ADP5589_GPI_PIN_ROW0 97
#define ADP5589_GPI_PIN_ROW1 98
#define ADP5589_GPI_PIN_ROW2 99
#define ADP5589_GPI_PIN_ROW3 100
#define ADP5589_GPI_PIN_ROW4 101
#define ADP5589_GPI_PIN_ROW5 102
#define ADP5589_GPI_PIN_ROW6 103
#define ADP5589_GPI_PIN_ROW7 104
#define ADP5589_GPI_PIN_COL0 105
#define ADP5589_GPI_PIN_COL1 106
#define ADP5589_GPI_PIN_COL2 107
#define ADP5589_GPI_PIN_COL3 108
#define ADP5589_GPI_PIN_COL4 109
#define ADP5589_GPI_PIN_COL5 110
#define ADP5589_GPI_PIN_COL6 111
#define ADP5589_GPI_PIN_COL7 112
#define ADP5589_GPI_PIN_COL8 113
#define ADP5589_GPI_PIN_COL9 114
#define ADP5589_GPI_PIN_COL10 115
#define GPI_LOGIC1 116
#define GPI_LOGIC2 117
#define ADP5589_GPI_PIN_ROW_BASE ADP5589_GPI_PIN_ROW0
#define ADP5589_GPI_PIN_ROW_END ADP5589_GPI_PIN_ROW7
#define ADP5589_GPI_PIN_COL_BASE ADP5589_GPI_PIN_COL0
#define ADP5589_GPI_PIN_COL_END ADP5589_GPI_PIN_COL10
#define ADP5589_GPI_PIN_BASE ADP5589_GPI_PIN_ROW_BASE
#define ADP5589_GPI_PIN_END ADP5589_GPI_PIN_COL_END
#define ADP5589_GPIMAPSIZE_MAX (ADP5589_GPI_PIN_END - ADP5589_GPI_PIN_BASE + 1)
/*
* ADP5585 specific GPI and Keymap defines
*/
#define ADP5585_KEYMAPSIZE 30
#define ADP5585_GPI_PIN_ROW0 37
#define ADP5585_GPI_PIN_ROW1 38
#define ADP5585_GPI_PIN_ROW2 39
#define ADP5585_GPI_PIN_ROW3 40
#define ADP5585_GPI_PIN_ROW4 41
#define ADP5585_GPI_PIN_ROW5 42
#define ADP5585_GPI_PIN_COL0 43
#define ADP5585_GPI_PIN_COL1 44
#define ADP5585_GPI_PIN_COL2 45
#define ADP5585_GPI_PIN_COL3 46
#define ADP5585_GPI_PIN_COL4 47
#define GPI_LOGIC 48
#define ADP5585_GPI_PIN_ROW_BASE ADP5585_GPI_PIN_ROW0
#define ADP5585_GPI_PIN_ROW_END ADP5585_GPI_PIN_ROW5
#define ADP5585_GPI_PIN_COL_BASE ADP5585_GPI_PIN_COL0
#define ADP5585_GPI_PIN_COL_END ADP5585_GPI_PIN_COL4
#define ADP5585_GPI_PIN_BASE ADP5585_GPI_PIN_ROW_BASE
#define ADP5585_GPI_PIN_END ADP5585_GPI_PIN_COL_END
#define ADP5585_GPIMAPSIZE_MAX (ADP5585_GPI_PIN_END - ADP5585_GPI_PIN_BASE + 1)
struct adp5589_gpi_map {
unsigned short pin;
unsigned short sw_evt;
};
/* scan_cycle_time */
#define ADP5589_SCAN_CYCLE_10ms 0
#define ADP5589_SCAN_CYCLE_20ms 1
#define ADP5589_SCAN_CYCLE_30ms 2
#define ADP5589_SCAN_CYCLE_40ms 3
/* RESET_CFG */
#define RESET_PULSE_WIDTH_500us 0
#define RESET_PULSE_WIDTH_1ms 1
#define RESET_PULSE_WIDTH_2ms 2
#define RESET_PULSE_WIDTH_10ms 3
#define RESET_TRIG_TIME_0ms (0 << 2)
#define RESET_TRIG_TIME_1000ms (1 << 2)
#define RESET_TRIG_TIME_1500ms (2 << 2)
#define RESET_TRIG_TIME_2000ms (3 << 2)
#define RESET_TRIG_TIME_2500ms (4 << 2)
#define RESET_TRIG_TIME_3000ms (5 << 2)
#define RESET_TRIG_TIME_3500ms (6 << 2)
#define RESET_TRIG_TIME_4000ms (7 << 2)
#define RESET_PASSTHRU_EN (1 << 5)
#define RESET1_POL_HIGH (1 << 6)
#define RESET1_POL_LOW (0 << 6)
#define RESET2_POL_HIGH (1 << 7)
#define RESET2_POL_LOW (0 << 7)
/* ADP5589 Mask Bits:
* C C C C C C C C C C C | R R R R R R R R
* 1 9 8 7 6 5 4 3 2 1 0 | 7 6 5 4 3 2 1 0
* 0
* ---------------- BIT ------------------
* 1 1 1 1 1 1 1 1 1 0 0 | 0 0 0 0 0 0 0 0
* 8 7 6 5 4 3 2 1 0 9 8 | 7 6 5 4 3 2 1 0
*/
#define ADP_ROW(x) (1 << (x))
#define ADP_COL(x) (1 << (x + 8))
#define ADP5589_ROW_MASK 0xFF
#define ADP5589_COL_MASK 0xFF
#define ADP5589_COL_SHIFT 8
#define ADP5589_MAX_ROW_NUM 7
#define ADP5589_MAX_COL_NUM 10
/* ADP5585 Mask Bits:
* C C C C C | R R R R R R
* 4 3 2 1 0 | 5 4 3 2 1 0
*
* ---- BIT -- -----------
* 1 0 0 0 0 | 0 0 0 0 0 0
* 0 9 8 7 6 | 5 4 3 2 1 0
*/
#define ADP5585_ROW_MASK 0x3F
#define ADP5585_COL_MASK 0x1F
#define ADP5585_ROW_SHIFT 0
#define ADP5585_COL_SHIFT 6
#define ADP5585_MAX_ROW_NUM 5
#define ADP5585_MAX_COL_NUM 4
#define ADP5585_ROW(x) (1 << ((x) & ADP5585_ROW_MASK))
#define ADP5585_COL(x) (1 << (((x) & ADP5585_COL_MASK) + ADP5585_COL_SHIFT))
/* Put one of these structures in i2c_board_info platform_data */
struct adp5589_kpad_platform_data {
unsigned keypad_en_mask; /* Keypad (Rows/Columns) enable mask */
const unsigned short *keymap; /* Pointer to keymap */
unsigned short keymapsize; /* Keymap size */
bool repeat; /* Enable key repeat */
bool en_keylock; /* Enable key lock feature (ADP5589 only)*/
unsigned char unlock_key1; /* Unlock Key 1 (ADP5589 only) */
unsigned char unlock_key2; /* Unlock Key 2 (ADP5589 only) */
unsigned char unlock_timer; /* Time in seconds [0..7] between the two unlock keys 0=disable (ADP5589 only) */
unsigned char scan_cycle_time; /* Time between consecutive scan cycles */
unsigned char reset_cfg; /* Reset config */
unsigned short reset1_key_1; /* Reset Key 1 */
unsigned short reset1_key_2; /* Reset Key 2 */
unsigned short reset1_key_3; /* Reset Key 3 */
unsigned short reset2_key_1; /* Reset Key 1 */
unsigned short reset2_key_2; /* Reset Key 2 */
unsigned debounce_dis_mask; /* Disable debounce mask */
unsigned pull_dis_mask; /* Disable all pull resistors mask */
unsigned pullup_en_100k; /* Pull-Up 100k Enable Mask */
unsigned pullup_en_300k; /* Pull-Up 300k Enable Mask */
unsigned pulldown_en_300k; /* Pull-Down 300k Enable Mask */
const struct adp5589_gpi_map *gpimap;
unsigned short gpimapsize;
const struct adp5589_gpio_platform_data *gpio_data;
};
struct i2c_client; /* forward declaration */
struct adp5589_gpio_platform_data {
int gpio_start; /* GPIO Chip base # */
int (*setup)(struct i2c_client *client,
int gpio, unsigned ngpio,
void *context);
int (*teardown)(struct i2c_client *client,
int gpio, unsigned ngpio,
void *context);
void *context;
};
#endif

View file

@ -0,0 +1,358 @@
/*
* include/linux/input/adxl34x.h
*
* Digital Accelerometer characteristics are highly application specific
* and may vary between boards and models. The platform_data for the
* device's "struct device" holds this information.
*
* Copyright 2009 Analog Devices Inc.
*
* Licensed under the GPL-2 or later.
*/
#ifndef __LINUX_INPUT_ADXL34X_H__
#define __LINUX_INPUT_ADXL34X_H__
#include <linux/input.h>
struct adxl34x_platform_data {
/*
* X,Y,Z Axis Offset:
* offer user offset adjustments in twoscompliment
* form with a scale factor of 15.6 mg/LSB (i.e. 0x7F = +2 g)
*/
s8 x_axis_offset;
s8 y_axis_offset;
s8 z_axis_offset;
/*
* TAP_X/Y/Z Enable: Setting TAP_X, Y, or Z Enable enables X,
* Y, or Z participation in Tap detection. A '0' excludes the
* selected axis from participation in Tap detection.
* Setting the SUPPRESS bit suppresses Double Tap detection if
* acceleration greater than tap_threshold is present during the
* tap_latency period, i.e. after the first tap but before the
* opening of the second tap window.
*/
#define ADXL_SUPPRESS (1 << 3)
#define ADXL_TAP_X_EN (1 << 2)
#define ADXL_TAP_Y_EN (1 << 1)
#define ADXL_TAP_Z_EN (1 << 0)
u8 tap_axis_control;
/*
* tap_threshold:
* holds the threshold value for tap detection/interrupts.
* The data format is unsigned. The scale factor is 62.5 mg/LSB
* (i.e. 0xFF = +16 g). A zero value may result in undesirable
* behavior if Tap/Double Tap is enabled.
*/
u8 tap_threshold;
/*
* tap_duration:
* is an unsigned time value representing the maximum
* time that an event must be above the tap_threshold threshold
* to qualify as a tap event. The scale factor is 625 us/LSB. A zero
* value will prevent Tap/Double Tap functions from working.
*/
u8 tap_duration;
/*
* tap_latency:
* is an unsigned time value representing the wait time
* from the detection of a tap event to the opening of the time
* window tap_window for a possible second tap event. The scale
* factor is 1.25 ms/LSB. A zero value will disable the Double Tap
* function.
*/
u8 tap_latency;
/*
* tap_window:
* is an unsigned time value representing the amount
* of time after the expiration of tap_latency during which a second
* tap can begin. The scale factor is 1.25 ms/LSB. A zero value will
* disable the Double Tap function.
*/
u8 tap_window;
/*
* act_axis_control:
* X/Y/Z Enable: A '1' enables X, Y, or Z participation in activity
* or inactivity detection. A '0' excludes the selected axis from
* participation. If all of the axes are excluded, the function is
* disabled.
* AC/DC: A '0' = DC coupled operation and a '1' = AC coupled
* operation. In DC coupled operation, the current acceleration is
* compared with activity_threshold and inactivity_threshold directly
* to determine whether activity or inactivity is detected. In AC
* coupled operation for activity detection, the acceleration value
* at the start of activity detection is taken as a reference value.
* New samples of acceleration are then compared to this
* reference value and if the magnitude of the difference exceeds
* activity_threshold the device will trigger an activity interrupt. In
* AC coupled operation for inactivity detection, a reference value
* is used again for comparison and is updated whenever the
* device exceeds the inactivity threshold. Once the reference
* value is selected, the device compares the magnitude of the
* difference between the reference value and the current
* acceleration with inactivity_threshold. If the difference is below
* inactivity_threshold for a total of inactivity_time, the device is
* considered inactive and the inactivity interrupt is triggered.
*/
#define ADXL_ACT_ACDC (1 << 7)
#define ADXL_ACT_X_EN (1 << 6)
#define ADXL_ACT_Y_EN (1 << 5)
#define ADXL_ACT_Z_EN (1 << 4)
#define ADXL_INACT_ACDC (1 << 3)
#define ADXL_INACT_X_EN (1 << 2)
#define ADXL_INACT_Y_EN (1 << 1)
#define ADXL_INACT_Z_EN (1 << 0)
u8 act_axis_control;
/*
* activity_threshold:
* holds the threshold value for activity detection.
* The data format is unsigned. The scale factor is
* 62.5 mg/LSB. A zero value may result in undesirable behavior if
* Activity interrupt is enabled.
*/
u8 activity_threshold;
/*
* inactivity_threshold:
* holds the threshold value for inactivity
* detection. The data format is unsigned. The scale
* factor is 62.5 mg/LSB. A zero value may result in undesirable
* behavior if Inactivity interrupt is enabled.
*/
u8 inactivity_threshold;
/*
* inactivity_time:
* is an unsigned time value representing the
* amount of time that acceleration must be below the value in
* inactivity_threshold for inactivity to be declared. The scale factor
* is 1 second/LSB. Unlike the other interrupt functions, which
* operate on unfiltered data, the inactivity function operates on the
* filtered output data. At least one output sample must be
* generated for the inactivity interrupt to be triggered. This will
* result in the function appearing un-responsive if the
* inactivity_time register is set with a value less than the time
* constant of the Output Data Rate. A zero value will result in an
* interrupt when the output data is below inactivity_threshold.
*/
u8 inactivity_time;
/*
* free_fall_threshold:
* holds the threshold value for Free-Fall detection.
* The data format is unsigned. The root-sum-square(RSS) value
* of all axes is calculated and compared to the value in
* free_fall_threshold to determine if a free fall event may be
* occurring. The scale factor is 62.5 mg/LSB. A zero value may
* result in undesirable behavior if Free-Fall interrupt is
* enabled. Values between 300 and 600 mg (0x05 to 0x09) are
* recommended.
*/
u8 free_fall_threshold;
/*
* free_fall_time:
* is an unsigned time value representing the minimum
* time that the RSS value of all axes must be less than
* free_fall_threshold to generate a Free-Fall interrupt. The
* scale factor is 5 ms/LSB. A zero value may result in
* undesirable behavior if Free-Fall interrupt is enabled.
* Values between 100 to 350 ms (0x14 to 0x46) are recommended.
*/
u8 free_fall_time;
/*
* data_rate:
* Selects device bandwidth and output data rate.
* RATE = 3200 Hz / (2^(15 - x)). Default value is 0x0A, or 100 Hz
* Output Data Rate. An Output Data Rate should be selected that
* is appropriate for the communication protocol and frequency
* selected. Selecting too high of an Output Data Rate with a low
* communication speed will result in samples being discarded.
*/
u8 data_rate;
/*
* data_range:
* FULL_RES: When this bit is set with the device is
* in Full-Resolution Mode, where the output resolution increases
* with RANGE to maintain a 4 mg/LSB scale factor. When this
* bit is cleared the device is in 10-bit Mode and RANGE determine the
* maximum g-Range and scale factor.
*/
#define ADXL_FULL_RES (1 << 3)
#define ADXL_RANGE_PM_2g 0
#define ADXL_RANGE_PM_4g 1
#define ADXL_RANGE_PM_8g 2
#define ADXL_RANGE_PM_16g 3
u8 data_range;
/*
* low_power_mode:
* A '0' = Normal operation and a '1' = Reduced
* power operation with somewhat higher noise.
*/
u8 low_power_mode;
/*
* power_mode:
* LINK: A '1' with both the activity and inactivity functions
* enabled will delay the start of the activity function until
* inactivity is detected. Once activity is detected, inactivity
* detection will begin and prevent the detection of activity. This
* bit serially links the activity and inactivity functions. When '0'
* the inactivity and activity functions are concurrent. Additional
* information can be found in the ADXL34x datasheet's Application
* section under Link Mode.
* AUTO_SLEEP: A '1' sets the ADXL34x to switch to Sleep Mode
* when inactivity (acceleration has been below inactivity_threshold
* for at least inactivity_time) is detected and the LINK bit is set.
* A '0' disables automatic switching to Sleep Mode. See the
* Sleep Bit section of the ADXL34x datasheet for more information.
*/
#define ADXL_LINK (1 << 5)
#define ADXL_AUTO_SLEEP (1 << 4)
u8 power_mode;
/*
* fifo_mode:
* BYPASS The FIFO is bypassed
* FIFO FIFO collects up to 32 values then stops collecting data
* STREAM FIFO holds the last 32 data values. Once full, the FIFO's
* oldest data is lost as it is replaced with newer data
*
* DEFAULT should be ADXL_FIFO_STREAM
*/
#define ADXL_FIFO_BYPASS 0
#define ADXL_FIFO_FIFO 1
#define ADXL_FIFO_STREAM 2
u8 fifo_mode;
/*
* watermark:
* The Watermark feature can be used to reduce the interrupt load
* of the system. The FIFO fills up to the value stored in watermark
* [1..32] and then generates an interrupt.
* A '0' disables the watermark feature.
*/
u8 watermark;
/*
* When acceleration measurements are received from the ADXL34x
* events are sent to the event subsystem. The following settings
* select the event type and event code for new x, y and z axis data
* respectively.
*/
u32 ev_type; /* EV_ABS or EV_REL */
u32 ev_code_x; /* ABS_X,Y,Z or REL_X,Y,Z */
u32 ev_code_y; /* ABS_X,Y,Z or REL_X,Y,Z */
u32 ev_code_z; /* ABS_X,Y,Z or REL_X,Y,Z */
/*
* A valid BTN or KEY Code; use tap_axis_control to disable
* event reporting
*/
u32 ev_code_tap[3]; /* EV_KEY {X-Axis, Y-Axis, Z-Axis} */
/*
* A valid BTN or KEY Code for Free-Fall or Activity enables
* input event reporting. A '0' disables the Free-Fall or
* Activity reporting.
*/
u32 ev_code_ff; /* EV_KEY */
u32 ev_code_act_inactivity; /* EV_KEY */
/*
* Use ADXL34x INT2 pin instead of INT1 pin for interrupt output
*/
u8 use_int2;
/*
* ADXL346 only ORIENTATION SENSING feature
* The orientation function of the ADXL346 reports both 2-D and
* 3-D orientation concurrently.
*/
#define ADXL_EN_ORIENTATION_2D 1
#define ADXL_EN_ORIENTATION_3D 2
#define ADXL_EN_ORIENTATION_2D_3D 3
u8 orientation_enable;
/*
* The width of the deadzone region between two or more
* orientation positions is determined by setting the Deadzone
* value. The deadzone region size can be specified with a
* resolution of 3.6deg. The deadzone angle represents the total
* angle where the orientation is considered invalid.
*/
#define ADXL_DEADZONE_ANGLE_0p0 0 /* !!!0.0 [deg] */
#define ADXL_DEADZONE_ANGLE_3p6 1 /* 3.6 [deg] */
#define ADXL_DEADZONE_ANGLE_7p2 2 /* 7.2 [deg] */
#define ADXL_DEADZONE_ANGLE_10p8 3 /* 10.8 [deg] */
#define ADXL_DEADZONE_ANGLE_14p4 4 /* 14.4 [deg] */
#define ADXL_DEADZONE_ANGLE_18p0 5 /* 18.0 [deg] */
#define ADXL_DEADZONE_ANGLE_21p6 6 /* 21.6 [deg] */
#define ADXL_DEADZONE_ANGLE_25p2 7 /* 25.2 [deg] */
u8 deadzone_angle;
/*
* To eliminate most human motion such as walking or shaking,
* a Divisor value should be selected to effectively limit the
* orientation bandwidth. Set the depth of the filter used to
* low-pass filter the measured acceleration for stable
* orientation sensing
*/
#define ADXL_LP_FILTER_DIVISOR_2 0
#define ADXL_LP_FILTER_DIVISOR_4 1
#define ADXL_LP_FILTER_DIVISOR_8 2
#define ADXL_LP_FILTER_DIVISOR_16 3
#define ADXL_LP_FILTER_DIVISOR_32 4
#define ADXL_LP_FILTER_DIVISOR_64 5
#define ADXL_LP_FILTER_DIVISOR_128 6
#define ADXL_LP_FILTER_DIVISOR_256 7
u8 divisor_length;
u32 ev_codes_orient_2d[4]; /* EV_KEY {+X, -X, +Y, -Y} */
u32 ev_codes_orient_3d[6]; /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
};
#endif

View file

@ -0,0 +1,20 @@
#ifndef _AS5011_H
#define _AS5011_H
/*
* Copyright (c) 2010, 2011 Fabien Marteau <fabien.marteau@armadeus.com>
*
* 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.
*/
struct as5011_platform_data {
unsigned int button_gpio;
unsigned int axis_irq; /* irq number */
unsigned long axis_irqflags;
char xp, xn; /* threshold for x axis */
char yp, yn; /* threshold for y axis */
};
#endif /* _AS5011_H */

View file

@ -0,0 +1,54 @@
/*
* Driver for AUO in-cell touchscreens
*
* Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de>
*
* based on auo_touch.h from Dell Streak kernel
*
* Copyright (c) 2008 QUALCOMM Incorporated.
* Copyright (c) 2008 QUALCOMM USA, INC.
*
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* 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 __AUO_PIXCIR_TS_H__
#define __AUO_PIXCIR_TS_H__
/*
* Interrupt modes:
* periodical: interrupt is asserted periodicaly
* compare coordinates: interrupt is asserted when coordinates change
* indicate touch: interrupt is asserted during touch
*/
#define AUO_PIXCIR_INT_PERIODICAL 0x00
#define AUO_PIXCIR_INT_COMP_COORD 0x01
#define AUO_PIXCIR_INT_TOUCH_IND 0x02
/*
* @gpio_int interrupt gpio
* @int_setting one of AUO_PIXCIR_INT_*
* @init_hw hardwarespecific init
* @exit_hw hardwarespecific shutdown
* @x_max x-resolution
* @y_max y-resolution
*/
struct auo_pixcir_ts_platdata {
int gpio_int;
int gpio_rst;
int int_setting;
unsigned int x_max;
unsigned int y_max;
};
#endif

View file

@ -0,0 +1,34 @@
/*
* Copyright (C) ST-Ericsson SA 2010
* Author: Naveen Kumar G <naveen.gaddipati@stericsson.com> for ST-Ericsson
* License terms:GNU General Public License (GPL) version 2
*/
#ifndef _BU21013_H
#define _BU21013_H
/**
* struct bu21013_platform_device - Handle the platform data
* @touch_x_max: touch x max
* @touch_y_max: touch y max
* @cs_pin: chip select pin
* @touch_pin: touch gpio pin
* @ext_clk: external clock flag
* @x_flip: x flip flag
* @y_flip: y flip flag
* @wakeup: wakeup flag
*
* This is used to handle the platform data
*/
struct bu21013_platform_device {
int touch_x_max;
int touch_y_max;
unsigned int cs_pin;
unsigned int touch_pin;
bool ext_clk;
bool x_flip;
bool y_flip;
bool wakeup;
};
#endif

View file

@ -0,0 +1,59 @@
/*
* VTI CMA3000_Dxx Accelerometer driver
*
* Copyright (C) 2010 Texas Instruments
* Author: Hemanth V <hemanthv@ti.com>
*
* 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.
*
* 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.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _LINUX_CMA3000_H
#define _LINUX_CMA3000_H
#define CMAMODE_DEFAULT 0
#define CMAMODE_MEAS100 1
#define CMAMODE_MEAS400 2
#define CMAMODE_MEAS40 3
#define CMAMODE_MOTDET 4
#define CMAMODE_FF100 5
#define CMAMODE_FF400 6
#define CMAMODE_POFF 7
#define CMARANGE_2G 2000
#define CMARANGE_8G 8000
/**
* struct cma3000_i2c_platform_data - CMA3000 Platform data
* @fuzz_x: Noise on X Axis
* @fuzz_y: Noise on Y Axis
* @fuzz_z: Noise on Z Axis
* @g_range: G range in milli g i.e 2000 or 8000
* @mode: Operating mode
* @mdthr: Motion detect threshold value
* @mdfftmr: Motion detect and free fall time value
* @ffthr: Free fall threshold value
*/
struct cma3000_platform_data {
int fuzz_x;
int fuzz_y;
int fuzz_z;
int g_range;
uint8_t mode;
uint8_t mdthr;
uint8_t mdfftmr;
uint8_t ffthr;
unsigned long irqflags;
};
#endif

View file

@ -0,0 +1,10 @@
#ifndef _LINUX_CY8CTMG110_PDATA_H
#define _LINUX_CY8CTMG110_PDATA_H
struct cy8ctmg110_pdata
{
int reset_pin; /* Reset pin is wired to this GPIO (optional) */
int irq_pin; /* IRQ pin is wired to this GPIO */
};
#endif

View file

@ -0,0 +1,58 @@
/*
* Header file for:
* Cypress TrueTouch(TM) Standard Product (TTSP) touchscreen drivers.
* For use with Cypress Txx3xx parts.
* Supported parts include:
* CY8CTST341
* CY8CTMA340
*
* Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
* Copyright (C) 2012 Javier Martinez Canillas <javier@dowhile0.org>
*
* 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.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contact Cypress Semiconductor at www.cypress.com (kev@cypress.com)
*
*/
#ifndef _CYTTSP_H_
#define _CYTTSP_H_
#define CY_SPI_NAME "cyttsp-spi"
#define CY_I2C_NAME "cyttsp-i2c"
/* Active Power state scanning/processing refresh interval */
#define CY_ACT_INTRVL_DFLT 0x00 /* ms */
/* touch timeout for the Active power */
#define CY_TCH_TMOUT_DFLT 0xFF /* ms */
/* Low Power state scanning/processing refresh interval */
#define CY_LP_INTRVL_DFLT 0x0A /* ms */
/* Active distance in pixels for a gesture to be reported */
#define CY_ACT_DIST_DFLT 0xF8 /* pixels */
struct cyttsp_platform_data {
u32 maxx;
u32 maxy;
bool use_hndshk;
u8 act_dist; /* Active distance */
u8 act_intrvl; /* Active refresh interval; ms */
u8 tch_tmout; /* Active touch timeout; ms */
u8 lp_intrvl; /* Low power refresh interval; ms */
int (*init)(void);
void (*exit)(void);
char *name;
s16 irq_gpio;
u8 *bl_keys;
};
#endif /* _CYTTSP_H_ */

View file

@ -0,0 +1,24 @@
#ifndef _EDT_FT5X06_H
#define _EDT_FT5X06_H
/*
* Copyright (c) 2012 Simon Budig, <simon.budig@kernelconcepts.de>
*
* 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.
*/
struct edt_ft5x06_platform_data {
int irq_pin;
int reset_pin;
/* startup defaults for operational parameters */
bool use_parameters;
u8 gain;
u8 threshold;
u8 offset;
u8 report_rate;
};
#endif /* _EDT_FT5X06_H */

View file

@ -0,0 +1,10 @@
#ifndef LINUX_INPUT_EETI_TS_H
#define LINUX_INPUT_EETI_TS_H
struct eeti_ts_platform_data {
int irq_gpio;
unsigned int irq_active_high;
};
#endif /* LINUX_INPUT_EETI_TS_H */

View file

@ -0,0 +1,22 @@
#ifndef _GP2AP002A00F_H_
#define _GP2AP002A00F_H_
#include <linux/i2c.h>
#define GP2A_I2C_NAME "gp2ap002a00f"
/**
* struct gp2a_platform_data - Sharp gp2ap002a00f proximity platform data
* @vout_gpio: The gpio connected to the object detected pin (VOUT)
* @wakeup: Set to true if the proximity can wake the device from suspend
* @hw_setup: Callback for setting up hardware such as gpios and vregs
* @hw_shutdown: Callback for properly shutting down hardware
*/
struct gp2a_platform_data {
int vout_gpio;
bool wakeup;
int (*hw_setup)(struct i2c_client *client);
int (*hw_shutdown)(struct i2c_client *client);
};
#endif

View file

@ -0,0 +1,73 @@
#ifndef _INPUT_GPIO_TILT_H
#define _INPUT_GPIO_TILT_H
/**
* struct gpio_tilt_axis - Axis used by the tilt switch
* @axis: Constant describing the axis, e.g. ABS_X
* @min: minimum value for abs_param
* @max: maximum value for abs_param
* @fuzz: fuzz value for abs_param
* @flat: flat value for abs_param
*/
struct gpio_tilt_axis {
int axis;
int min;
int max;
int fuzz;
int flat;
};
/**
* struct gpio_tilt_state - state description
* @gpios: bitfield of gpio target-states for the value
* @axes: array containing the axes settings for the gpio state
* The array indizes must correspond to the axes defined
* in platform_data
*
* This structure describes a supported axis settings
* and the necessary gpio-state which represent it.
*
* The n-th bit in the bitfield describes the state of the n-th GPIO
* from the gpios-array defined in gpio_regulator_config below.
*/
struct gpio_tilt_state {
int gpios;
int *axes;
};
/**
* struct gpio_tilt_platform_data
* @gpios: Array containing the gpios determining the tilt state
* @nr_gpios: Number of gpios
* @axes: Array of gpio_tilt_axis descriptions
* @nr_axes: Number of axes
* @states: Array of gpio_tilt_state entries describing
* the gpio state for specific tilts
* @nr_states: Number of states available
* @debounce_interval: debounce ticks interval in msecs
* @poll_interval: polling interval in msecs - for polling driver only
* @enable: callback to enable the tilt switch
* @disable: callback to disable the tilt switch
*
* This structure contains gpio-tilt-switch configuration
* information that must be passed by platform code to the
* gpio-tilt input driver.
*/
struct gpio_tilt_platform_data {
struct gpio *gpios;
int nr_gpios;
struct gpio_tilt_axis *axes;
int nr_axes;
struct gpio_tilt_state *states;
int nr_states;
int debounce_interval;
unsigned int poll_interval;
int (*enable)(struct device *dev);
void (*disable)(struct device *dev);
};
#endif

View file

@ -0,0 +1,10 @@
#ifndef _ILI210X_H
#define _ILI210X_H
struct ili210x_platform_data {
unsigned long irq_flags;
unsigned int poll_period;
bool (*get_pendown_state)(void);
};
#endif

564
include/linux/input/input.h Normal file
View file

@ -0,0 +1,564 @@
#if !defined(CONFIG_INPUT_BOOSTER) // Input Booster +
#ifndef _INPUT_BOOSTER_H_
#define _INPUT_BOOSTER_H_
#include <linux/pm_qos.h>
#include <linux/of.h>
#ifdef CONFIG_SCHED_HMP
#define USE_HMP_BOOST
#endif
#undef pr_debug
#define pr_debug if(debug_flag) printk
#define MAX_MULTI_TOUCH_EVENTS 3
#define MAX_EVENTS MAX_MULTI_TOUCH_EVENTS * 10
#define HEADGAGE "******"
#define TAILGAGE "**** "
#define set_qos(req, pm_qos_class, value) { \
if (value) { \
if (pm_qos_request_active(req)) {\
pr_debug("[Input Booster2] %s pm_qos_update_request : %d\n", glGage, value); \
pm_qos_update_request(req, value); \
} else { \
pr_debug("[Input Booster2] %s pm_qos_add_request : %d\n", glGage, value); \
pm_qos_add_request(req, pm_qos_class, value); \
} \
} else { \
pr_debug("[Input Booster2] %s remove_qos\n", glGage); \
remove_qos(req); \
}\
}
#define remove_qos(req) { \
if (pm_qos_request_active(req)) \
pm_qos_remove_request(req); \
}
#ifdef USE_HMP_BOOST
#define set_hmp(enable) { \
if(enable != current_hmp_boost) { \
pr_debug("[Input Booster2] ****** set_hmp : %d ( %s )\n", enable, __FUNCTION__); \
if (set_hmp_boost(enable) < 0) {\
pr_debug("[Input Booster2] ****** !!! fail to HMP !!!\n"); \
} \
current_hmp_boost = enable; \
} \
}
#else
#define set_hmp(enable)
#endif
#if defined(CONFIG_ARCH_EXYNOS) //______________________________________________________________________________
#define SET_BOOSTER { \
set_hmp(_this->param[_this->index].hmp_boost); \
set_qos(&_this->kfc_qos, /*PM_QOS_KFC_FREQ_MIN*/PM_QOS_CLUSTER0_FREQ_MIN, _this->param[_this->index].kfc_freq); \
set_qos(&_this->mif_qos, PM_QOS_BUS_THROUGHPUT, _this->param[_this->index].mif_freq); \
set_qos(&_this->cpu_qos, /*PM_QOS_CPU_FREQ_MIN*/PM_QOS_CLUSTER1_FREQ_MIN, _this->param[_this->index].cpu_freq); \
set_qos(&_this->int_qos, PM_QOS_DEVICE_THROUGHPUT, _this->param[_this->index].int_freq); \
}
#define REMOVE_BOOSTER { \
set_hmp(0); \
remove_qos(&_this->kfc_qos); \
remove_qos(&_this->mif_qos); \
remove_qos(&_this->cpu_qos); \
remove_qos(&_this->int_qos); \
}
#define PROPERTY_BOOSTER(_device_param_, _dt_param_, _time_) { \
_device_param_.cpu_freq = _dt_param_.cpu_freq; \
_device_param_.kfc_freq = _dt_param_.kfc_freq; \
_device_param_.mif_freq = _dt_param_.mif_freq; \
_device_param_.int_freq = _dt_param_.int_freq; \
_device_param_.time = _dt_param_._time_; \
_device_param_.hmp_boost = _dt_param_.hmp_boost; \
}
#endif //______________________________________________________________________________
#define GET_BOOSTER_PARAM(_GENDER_, _HEAD_PARAM_, _TAIL_PARAM_) { \
int levels[][3] = { \
{1, 2, 0}, \
{2, 2, 3}, \
{3, 1, 1}, \
{4, 1, 2}}; \
int j, k; \
for(j = 0;j < (int)(sizeof(levels)/(3*sizeof(int)));j++) {\
if((_GENDER_->pDT->nlevels > 2 && levels[j][0] == _GENDER_->level) || (_GENDER_->pDT->nlevels == 1 && j == 2) || (_GENDER_->pDT->nlevels == 2 && j == 3)) { \
if(levels[j][1] > 0) { \
for(k = 0;k < _GENDER_->pDT->nlevels;k++) { \
if(levels[j][1] == _GENDER_->pDT->param_tables[k].ilevels) { \
_HEAD_PARAM_ = (_GENDER_->pDT->param_tables[k].head_time > 0) ? &_GENDER_->pDT->param_tables[k] : NULL; \
break; \
} \
} \
} \
if(levels[j][2] > 0) { \
for(k = 0;k < dt_gender->pDT->nlevels;k++) { \
if(levels[j][2] == dt_gender->pDT->param_tables[k].ilevels) { \
_TAIL_PARAM_ = &_GENDER_->pDT->param_tables[k]; \
break; \
} \
} \
} \
break; \
} \
} \
}
#define CHANGE_BOOSTER { \
struct t_input_booster_device_tree_param *head_param = NULL, *tail_param = NULL; \
GET_BOOSTER_PARAM(dt_gender, head_param, tail_param) \
memset(dt_gender->pBooster->param, 0x00, sizeof(struct t_input_booster_param)*2); \
if(head_param != NULL) { \
PROPERTY_BOOSTER(dt_gender->pBooster->param[0], (*head_param), head_time) \
} \
if(tail_param != NULL) { \
PROPERTY_BOOSTER(dt_gender->pBooster->param[1], (*tail_param), tail_time) \
} \
}
#define INIT_BOOSTER(_DEVICE_) { \
_DEVICE_##_booster.input_booster_state = input_booster_idle_state; \
INIT_DELAYED_WORK(&_DEVICE_##_booster.input_booster_timeout_work[0], TIMEOUT_FUNC(_DEVICE_)); \
INIT_DELAYED_WORK(&_DEVICE_##_booster.input_booster_timeout_work[1], TIMEOUT_FUNC(_DEVICE_)); \
INIT_WORK(&_DEVICE_##_booster.input_booster_set_booster_work, SET_BOOSTER_FUNC(_DEVICE_)); \
INIT_WORK(&_DEVICE_##_booster.input_booster_reset_booster_work, RESET_BOOSTER_FUNC(_DEVICE_)); \
mutex_init(&_DEVICE_##_booster.lock); \
_DEVICE_##_booster.change_on_release = 0; \
_DEVICE_##_booster.multi_events = 0; \
{ \
int i; \
for(i=0;i<ndevice_in_dt;i++) { \
if(device_tree_infor[i].type == _DEVICE_##_booster_dt.type) { \
struct t_input_booster_device_tree_gender *dt_gender = &_DEVICE_##_booster_dt; \
dt_gender->pDT = &device_tree_infor[i]; \
dt_gender->pBooster = &_DEVICE_##_booster; \
CHANGE_BOOSTER \
break; \
} \
} \
} \
}
#define TIMEOUT_FUNC(_DEVICE_) input_booster_##_DEVICE_##_timeout_work_func
#define DECLARE_TIMEOUT_FUNC(_DEVICE_) \
static void input_booster_##_DEVICE_##_timeout_work_func(struct work_struct *work) \
{ \
struct t_input_booster *_this = &_DEVICE_##_booster; \
int param_max = sizeof(_this->param)/sizeof(struct t_input_booster_param), temp_index = -1; \
mutex_lock(&_this->lock); \
pr_debug("[Input Booster] %s Timeout : changed index : %d (%s)\n", HEADGAGE, _this->index , __FUNCTION__); \
if(_this->index >= 2 && delayed_work_pending(&_this->input_booster_timeout_work[_this->index-2])) { \
mutex_unlock(&_this->lock); \
return; \
}\
if(_this->index == param_max && delayed_work_pending(&_this->input_booster_timeout_work[_this->index-1])) { \
temp_index = _this->index; \
_this->index = (_this->index) ? _this->index-1 : 0; \
} \
pr_debug("[Input Booster] %s Timeout : changed index : %d (%s)\n", HEADGAGE, _this->index , __FUNCTION__); \
if(_this->index < param_max) { \
pr_debug("[Input Booster] %s Timeout : changed index : %d, time : %d (%s)\n", HEADGAGE, _this->index, _this->param[_this->index].time, __FUNCTION__); \
pr_debug("[Input Booster] %s hmp : %d cpu : %d (%s)\n", TAILGAGE, _this->param[_this->index].hmp_boost, _this->param[_this->index].cpu_freq, __FUNCTION__); \
if(_this->param[(_this->index) ? _this->index-1 : 0].time > 0) { \
SET_BOOSTER; \
if(_this->change_on_release) { \
schedule_delayed_work(&_this->input_booster_timeout_work[_this->index], msecs_to_jiffies(_this->param[_this->index].time)); \
_this->index++; \
CHANGE_STATE_TO(idle); \
}\
}\
_this->index = (temp_index >= 0) ? temp_index : _this->index; \
} else { \
pr_debug("[Input Booster] Timeout : completed param_max : %d (%s)\n", param_max, __FUNCTION__); \
pr_debug("[Input Booster]\n"); \
REMOVE_BOOSTER; \
_this->index = 0; \
_this->multi_events = (_this->multi_events > 0) ? 0 : _this->multi_events; \
CHANGE_STATE_TO(idle); \
} \
mutex_unlock(&_this->lock); \
}
#define SET_BOOSTER_FUNC(_DEVICE_) input_booster_##_DEVICE_##_set_booster_work_func
#define DECLARE_SET_BOOSTER_FUNC(_DEVICE_) \
static void input_booster_##_DEVICE_##_set_booster_work_func(struct work_struct *work) \
{ \
struct t_input_booster *_this = (struct t_input_booster *)(&_DEVICE_##_booster); \
mutex_lock(&_this->lock); \
_this->input_booster_state(_this, _this->event_type); \
mutex_unlock(&_this->lock); \
}
#define RESET_BOOSTER_FUNC(_DEVICE_) input_booster_##_DEVICE_##_reset_booster_work_func
#define DECLARE_RESET_BOOSTER_FUNC(_DEVICE_) \
static void input_booster_##_DEVICE_##_reset_booster_work_func(struct work_struct *work) \
{ \
struct t_input_booster *_this = (struct t_input_booster *)(&_DEVICE_##_booster); \
int i; \
mutex_lock(&_this->lock); \
_this->multi_events = 0; \
_this->index=0; \
for(i=0;i<2;i++) { \
if(delayed_work_pending(&_this->input_booster_timeout_work[i])) { \
pr_debug("[Input Booster] **** cancel the pending workqueue for reset\n"); \
cancel_delayed_work(&_this->input_booster_timeout_work[i]); \
} \
} \
CHANGE_STATE_TO(idle); \
REMOVE_BOOSTER; \
mutex_unlock(&_this->lock); \
}
#define DECLARE_STATE_FUNC(_STATE_) void input_booster_##_STATE_##_state(void *__this, int input_booster_event)
#define CHANGE_STATE_TO(_STATE_) _this->input_booster_state = input_booster_##_STATE_##_state;
#define RUN_BOOSTER(_DEVICE_, _EVENT_) { \
if(_DEVICE_##_booster_dt.level > 0) { \
_DEVICE_##_booster.event_type = _EVENT_; \
(_EVENT_ == BOOSTER_ON) ? _DEVICE_##_booster.multi_events++ : _DEVICE_##_booster.multi_events--; \
schedule_work(&_DEVICE_##_booster.input_booster_set_booster_work); \
} \
}
//+++++++++++++++++++++++++++++++++++++++++++++++ STRUCT & VARIABLE FOR SYSFS +++++++++++++++++++++++++++++++++++++++++++++++//
#define SYSFS_CLASS(_ATTR_, _ARGU_, _COUNT_) \
static ssize_t input_booster_sysfs_class_show_##_ATTR_(struct class *dev, struct class_attribute *attr, char *buf) { \
struct t_input_booster_device_tree_gender *dt_gender = &touch_booster_dt; \
ssize_t ret; int level; \
unsigned int debug_level = 0, cpu_freq = 0, kfc_freq = 0, mif_freq = 0, int_freq = 0, hmp_boost = 0, head_time = 0, tail_time = 0; \
struct t_input_booster_device_tree_param *head_param = NULL, *tail_param = NULL; \
GET_BOOSTER_PARAM(dt_gender, head_param, tail_param) \
debug_level = debug_flag; \
level = dt_gender->level; \
if(strcmp(#_ATTR_,"head") == 0 && head_param != NULL) { \
cpu_freq = head_param->cpu_freq; \
kfc_freq = head_param->kfc_freq; \
mif_freq = head_param->mif_freq; \
int_freq = head_param->int_freq; \
hmp_boost = head_param->hmp_boost; \
head_time = head_param->head_time; \
tail_time = head_param->tail_time; \
} \
if(strcmp(#_ATTR_,"tail") == 0 && tail_param != NULL) { \
cpu_freq = tail_param->cpu_freq; \
kfc_freq = tail_param->kfc_freq; \
mif_freq = tail_param->mif_freq; \
int_freq = tail_param->int_freq; \
hmp_boost = tail_param->hmp_boost; \
head_time = tail_param->head_time; \
tail_time = tail_param->tail_time; \
} \
ret = sprintf _ARGU_; \
pr_debug("[Input Booster8] %s buf : %s\n", __FUNCTION__, buf); \
return ret; \
} \
static ssize_t input_booster_sysfs_class_store_##_ATTR_(struct class *dev, struct class_attribute *attr, const char *buf, size_t count) { \
struct t_input_booster_device_tree_gender *dt_gender = &touch_booster_dt; \
int level[1] = {-1}, len; \
unsigned int debug_level[1] = {-1}, cpu_freq[1] = {-1}, kfc_freq[1] = {-1}, mif_freq[1] = {-1}, int_freq[1] = {-1}, hmp_boost[1] = {-1}, head_time[1] = {-1}, tail_time[1] = {-1}; \
struct t_input_booster_device_tree_param *head_param = NULL, *tail_param = NULL; \
GET_BOOSTER_PARAM(dt_gender, head_param, tail_param) \
len = sscanf _ARGU_; \
pr_debug("[Input Booster8] %s buf : %s\n", __FUNCTION__, buf); \
if (sscanf _ARGU_ != _COUNT_) { \
return count; \
} \
debug_flag = (*debug_level == (unsigned int)(-1)) ? debug_flag : *debug_level; \
dt_gender->level = (*level == (unsigned int)(-1)) ? dt_gender->level : *level; \
if(*head_time != (unsigned int)(-1) && head_param != NULL) { \
head_param->cpu_freq = (*cpu_freq == (unsigned int)(-1)) ? head_param->cpu_freq : *cpu_freq; \
head_param->kfc_freq = (*kfc_freq == (unsigned int)(-1)) ? head_param->kfc_freq : *kfc_freq; \
head_param->mif_freq = (*mif_freq == (unsigned int)(-1)) ? head_param->mif_freq : *mif_freq; \
head_param->int_freq = (*int_freq == (unsigned int)(-1)) ? head_param->int_freq : *int_freq; \
head_param->hmp_boost = (*hmp_boost == (unsigned int)(-1)) ? head_param->hmp_boost : *hmp_boost; \
head_param->head_time = (*head_time == (unsigned int)(-1)) ? head_param->head_time : *head_time; \
head_param->tail_time = (*tail_time == (unsigned int)(-1)) ? head_param->tail_time : *tail_time; \
} \
if(*tail_time != (unsigned int)(-1) && tail_param != NULL) { \
tail_param->cpu_freq = (*cpu_freq == (unsigned int)(-1)) ? tail_param->cpu_freq : *cpu_freq; \
tail_param->kfc_freq = (*kfc_freq == (unsigned int)(-1)) ? tail_param->kfc_freq : *kfc_freq; \
tail_param->mif_freq = (*mif_freq == (unsigned int)(-1)) ? tail_param->mif_freq : *mif_freq; \
tail_param->int_freq = (*int_freq == (unsigned int)(-1)) ? tail_param->int_freq : *int_freq; \
tail_param->hmp_boost = (*hmp_boost == (unsigned int)(-1)) ? tail_param->hmp_boost : *hmp_boost; \
tail_param->head_time = (*head_time == (unsigned int)(-1)) ? tail_param->head_time : *head_time; \
tail_param->tail_time = (*tail_time == (unsigned int)(-1)) ? tail_param->tail_time : *tail_time; \
} \
CHANGE_BOOSTER \
return count; \
} \
static CLASS_ATTR(_ATTR_, S_IRUGO | S_IWUSR, input_booster_sysfs_class_show_##_ATTR_, input_booster_sysfs_class_store_##_ATTR_);
#define SYSFS_DEVICE(_ATTR_, _ARGU_, _COUNT_) \
static ssize_t input_booster_sysfs_device_show_##_ATTR_(struct device *dev, struct device_attribute *attr, char *buf) { \
struct t_input_booster_device_tree_gender *dt_gender = dev_get_drvdata(dev); \
ssize_t ret = 0; \
int level, Arg_count = _COUNT_; \
unsigned int cpu_freq, kfc_freq, mif_freq, int_freq, hmp_boost, head_time, tail_time, phase_time; \
struct t_input_booster_device_tree_param *head_param = NULL, *tail_param = NULL; \
if(dt_gender == NULL) { \
return ret; \
} \
GET_BOOSTER_PARAM(dt_gender, head_param, tail_param) \
if(Arg_count == 1) { \
level = dt_gender->level; \
ret = sprintf _ARGU_; \
pr_debug("[Input Booster8] %s buf : %s\n", __FUNCTION__, buf); \
} else { \
if(head_param != NULL) { \
level = head_param->ilevels; \
cpu_freq = head_param->cpu_freq; \
kfc_freq = head_param->kfc_freq; \
mif_freq = head_param->mif_freq; \
int_freq = head_param->int_freq; \
hmp_boost = head_param->hmp_boost; \
head_time = head_param->head_time; \
tail_time = head_param->tail_time; \
phase_time = head_param->phase_time; \
ret = sprintf _ARGU_; \
buf = buf + ret - 1; \
} \
*buf = '|'; \
*(buf+1) = '\n';\
if(tail_param != NULL) { \
buf = buf + 1; \
level = tail_param->ilevels; \
cpu_freq = tail_param->cpu_freq; \
kfc_freq = tail_param->kfc_freq; \
mif_freq = tail_param->mif_freq; \
int_freq = tail_param->int_freq; \
hmp_boost = tail_param->hmp_boost; \
head_time = tail_param->head_time; \
tail_time = tail_param->tail_time; \
phase_time = tail_param->phase_time; \
ret += sprintf _ARGU_; \
} \
pr_debug("[Input Booster8] %s buf : %s\n", __FUNCTION__, buf); \
} \
return ret; \
} \
static ssize_t input_booster_sysfs_device_store_##_ATTR_(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { \
struct t_input_booster_device_tree_gender *dt_gender = dev_get_drvdata(dev); \
struct t_input_booster_device_tree_infor *dt_infor = (dt_gender) ? dt_gender->pDT : NULL; \
int level[1] = {-1}, len; \
unsigned int cpu_freq[1] = {-1}, kfc_freq[1] = {-1}, mif_freq[1] = {-1}, int_freq[1] = {-1}, hmp_boost[1] = {-1}, head_time[1] = {-1}, tail_time[1] = {-1}, phase_time[1] = {-1}; \
len = sscanf _ARGU_; \
pr_debug("[Input Booster8] %s buf : %s\n", __FUNCTION__, buf); \
if(dt_infor == NULL) { \
return count; \
} \
if (len != _COUNT_) { \
pr_debug("### Keep this format : [level cpu_freq kfc_freq mif_freq int_freq hmp_boost] (Ex: 1 1600000 0 1500000 667000 333000 1###\n"); \
pr_debug("### Keep this format : [level head_time tail_time phase_time] (Ex: 1 130 500 50 ###\n"); \
pr_debug("### Keep this format : [type value] (Ex: 2 1 ###\n"); \
return count; \
} \
if(level[0] >= 0) { \
int Arg_count = _COUNT_; \
if(Arg_count == 1) { \
dt_gender->level = level[0]; \
} else { \
int k; \
for(k = 0;k < dt_infor->nlevels;k++) { \
if(level[0] == dt_infor->param_tables[k].ilevels) { \
dt_infor->param_tables[k].cpu_freq = (*cpu_freq == (unsigned int)(-1)) ? dt_infor->param_tables[k].cpu_freq : *cpu_freq; \
dt_infor->param_tables[k].kfc_freq = (*kfc_freq == (unsigned int)(-1)) ? dt_infor->param_tables[k].kfc_freq : *kfc_freq; \
dt_infor->param_tables[k].mif_freq = (*mif_freq == (unsigned int)(-1)) ? dt_infor->param_tables[k].mif_freq : *mif_freq; \
dt_infor->param_tables[k].int_freq = (*int_freq == (unsigned int)(-1)) ? dt_infor->param_tables[k].int_freq : *int_freq; \
dt_infor->param_tables[k].hmp_boost = (*hmp_boost == (unsigned int)(-1)) ? dt_infor->param_tables[k].hmp_boost : *hmp_boost; \
dt_infor->param_tables[k].head_time = (*head_time == (unsigned int)(-1)) ? dt_infor->param_tables[k].head_time : *head_time; \
dt_infor->param_tables[k].tail_time = (*tail_time == (unsigned int)(-1)) ? dt_infor->param_tables[k].tail_time : *tail_time; \
dt_infor->param_tables[k].phase_time = (*phase_time == (unsigned int)(-1)) ? dt_infor->param_tables[k].phase_time : *phase_time; \
pr_debug("[Input Booster8] %s time : %d %d %d\n", __FUNCTION__, dt_infor->param_tables[*level].head_time, dt_infor->param_tables[k].tail_time, dt_infor->param_tables[*level].phase_time); \
} \
} \
} \
CHANGE_BOOSTER \
} \
return count; \
} \
static DEVICE_ATTR(_ATTR_, S_IRUGO | S_IWUSR, input_booster_sysfs_device_show_##_ATTR_, input_booster_sysfs_device_store_##_ATTR_);
#define INIT_SYSFS_CLASS(_CLASS_) { \
int ret = class_create_file(sysfs_class, &class_attr_##_CLASS_); \
if (ret) { \
pr_debug("[Input Booster] Failed to create class\n"); \
class_destroy(sysfs_class); \
return; \
} \
}
#define INIT_SYSFS_DEVICE(_DEVICE_) { \
struct device *sysfs_dev; int ret = 0;\
sysfs_dev = device_create(sysfs_class, NULL, 0, &_DEVICE_##_booster_dt, #_DEVICE_); \
if (IS_ERR(sysfs_dev)) { \
ret = IS_ERR(sysfs_dev); \
pr_debug("[Input Booster] Failed to create %s sysfs device[%d]\n", #_DEVICE_, ret); \
return; \
} \
ret = sysfs_create_group(&sysfs_dev->kobj, &dvfs_attr_group); \
if (ret) { \
pr_debug("[Input Booster] Failed to create %s sysfs group\n", #_DEVICE_); \
return; \
} \
}
//----------------------------------------------- STRUCT & VARIABLE FOR SYSFS -----------------------------------------------//
enum booster_mode_on_off {
BOOSTER_OFF = 0,
BOOSTER_ON,
};
struct input_value input_events[MAX_EVENTS+1];
struct t_input_booster_param {
u32 cpu_freq;
u32 kfc_freq;
u32 mif_freq;
u32 int_freq;
u16 time;
u8 hmp_boost;
u8 dummy;
};
struct t_input_booster {
struct mutex lock;
struct t_input_booster_param param[2];
struct pm_qos_request cpu_qos;
struct pm_qos_request kfc_qos;
struct pm_qos_request mif_qos;
struct pm_qos_request int_qos;
struct delayed_work input_booster_timeout_work[2];
struct work_struct input_booster_set_booster_work;
struct work_struct input_booster_reset_booster_work;
int index;
int multi_events;
int event_type;
int change_on_release;
void (*input_booster_state)(void *__this, int input_booster_event);
};
//+++++++++++++++++++++++++++++++++++++++++++++++ STRUCT & VARIABLE FOR DEVICE TREE +++++++++++++++++++++++++++++++++++++++++++++++//
struct t_input_booster_device_tree_param {
u8 ilevels;
u8 hmp_boost;
u16 head_time;
u16 tail_time;
u16 phase_time;
u32 cpu_freq;
u32 kfc_freq;
u32 mif_freq;
u32 int_freq;
};
struct t_input_booster_device_tree_infor {
const char *label;
int type;
int nlevels;
struct t_input_booster_device_tree_param *param_tables;
};
struct t_input_booster_device_tree_gender {
int type;
int level;
struct t_input_booster *pBooster;
struct t_input_booster_device_tree_infor *pDT;
};
//______________________________________________________________________________ <<< in DTSI file >>>
//______________________________________________________________________________ input_booster,type = <4>; /* BOOSTER_DEVICE_KEYBOARD */
//______________________________________________________________________________
struct t_input_booster_device_tree_gender touch_booster_dt = {2,2,}; // type : 2, level : 2
struct t_input_booster_device_tree_gender multitouch_booster_dt = {3,1,}; // type : 3, level : 1
struct t_input_booster_device_tree_gender key_booster_dt = {0,1,}; // type : 0, level : 1
struct t_input_booster_device_tree_gender touchkey_booster_dt = {1,1,}; // type : 1, level : 1
struct t_input_booster_device_tree_gender keyboard_booster_dt = {4,1,}; // type : 4, level : 1
struct t_input_booster_device_tree_gender mouse_booster_dt = {5,1,}; // type : 5, level : 1
struct t_input_booster_device_tree_gender mouse_wheel_booster_dt = {6,1,}; // type : 6, level : 1
struct t_input_booster_device_tree_gender pen_booster_dt = {7,1,}; // type : 7, level : 1
struct t_input_booster_device_tree_gender hover_booster_dt = {7,1,}; // type : 7, level : 1
struct t_input_booster_device_tree_gender gamepad_booster_dt = {8,1,}; // type : 8, level : 1
struct t_input_booster_device_tree_infor *device_tree_infor = NULL;
int ndevice_in_dt;
//---------------------------------------------- STRUCT & VARIABLE FOR DEVICE TREE ----------------------------------------------//
//+++++++++++++++++++++++++++++++++++++++++++++++ STRUCT & VARIABLE FOR SYSFS +++++++++++++++++++++++++++++++++++++++++++++++//
unsigned int debug_flag = 0;
SYSFS_CLASS(debug_level, (buf, "%u\n", debug_level), 1)
SYSFS_CLASS(head, (buf, "%d %u %u %u %u %u\n", head_time, cpu_freq, kfc_freq, mif_freq, int_freq, hmp_boost), 6)
SYSFS_CLASS(tail, (buf, "%d %u %u %u %u %u\n", tail_time, cpu_freq, kfc_freq, mif_freq, int_freq, hmp_boost), 6)
SYSFS_CLASS(level, (buf, "%d\n", level), 1)
SYSFS_DEVICE(level, (buf, "%d\n", level), 1)
SYSFS_DEVICE(freq, (buf, "%d %u %u %u %u %u\n", level, cpu_freq, kfc_freq, mif_freq, int_freq, hmp_boost), 6)
SYSFS_DEVICE(time, (buf, "%d %u %u %u\n", level, head_time, tail_time, phase_time), 4)
static ssize_t input_booster_sysfs_device_store_control(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) {
struct t_input_booster_device_tree_gender *dt_gender = dev_get_drvdata(dev);
struct t_input_booster *dt_booster = (dt_gender) ? dt_gender->pBooster : NULL;
int value;
unsigned int type;
if(dt_booster == NULL) {
return count;
}
if(sscanf(buf, "%u %d",&type, &value) != 2) {
pr_debug("### Keep this format : [type value] (Ex: 2 1 ###\n");
return count;
}
dt_booster->event_type = value;
schedule_work(&dt_booster->input_booster_set_booster_work);
return count;
}
static DEVICE_ATTR(control, S_IRUGO | S_IWUSR, NULL, input_booster_sysfs_device_store_control);
static struct attribute *dvfs_attributes[] = {
&dev_attr_level.attr,
&dev_attr_freq.attr,
&dev_attr_time.attr,
&dev_attr_control.attr,
NULL,
};
static struct attribute_group dvfs_attr_group = {
.attrs = dvfs_attributes,
};
//---------------------------------------------- STRUCT & VARIABLE FOR SYSFS ----------------------------------------------//
int TouchIDs[MAX_MULTI_TOUCH_EVENTS];
char *glGage = HEADGAGE;
bool current_hmp_boost = 0;
struct t_input_booster touch_booster;
struct t_input_booster multitouch_booster;
struct t_input_booster key_booster;
struct t_input_booster touchkey_booster;
struct t_input_booster keyboard_booster;
struct t_input_booster mouse_booster;
struct t_input_booster mouse_wheel_booster;
struct t_input_booster pen_booster;
struct t_input_booster hover_booster;
struct t_input_booster gamepad_booster;
int input_count = 0, key_back = 0, key_home = 0, key_recent = 0;
void input_booster_idle_state(void *__this, int input_booster_event);
void input_booster_press_state(void *__this, int input_booster_event);
void input_booster(struct input_dev *dev);
void input_booster_init(void);
#endif
#endif // Input Booster -

View file

@ -0,0 +1,80 @@
#ifndef _INPUT_BOOSTER_H_
#define _INPUT_BOOSTER_H_
#include <linux/cpufreq.h>
#include <linux/device.h>
#define INPUT_BOOSTER_NAME "input_booster"
enum input_booster_id {
INPUT_BOOSTER_ID_TSP = 0,
INPUT_BOOSTER_ID_TKEY,
INPUT_BOOSTER_ID_WACOM,
};
#define DVFS_STAGE_NONE 1 << 0 // 0000 0000 0000 0001
#define DVFS_STAGE_SINGLE 1 << 1 // 0000 0000 0000 0010
#define DVFS_STAGE_DUAL 1 << 2 // 0000 0000 0000 0100
#define DVFS_STAGE_TRIPLE 1 << 3 // 0000 0000 0000 1000
#define DVFS_STAGE_PENTA 1 << 5 // 0000 0000 0010 0000
#define DVFS_STAGE_NINTH 1 << 9 // 0000 0010 0000 0000
/* Touchkey */
#define INPUT_BOOSTER_OFF_TIME_TKEY 500
#define INPUT_BOOSTER_CHG_TIME_TKEY 500
struct input_booster {
struct delayed_work work_dvfs_off;
struct delayed_work work_dvfs_chg;
struct mutex dvfs_lock;
bool dvfs_lock_status;
int dvfs_old_stauts;
int dvfs_boost_mode;
int dvfs_freq;
int bimc_freq;
int dvfs_id;
int dvfs_stage;
int (*dvfs_off)(struct input_booster *);
void (*dvfs_set)(struct input_booster *, int);
};
struct dvfs {
int time;
s32 cpu_freq;
s32 bimc_freq;
};
struct input_booster_dt_data {
int tsp_stage;
int tkey_stage;
int wacom_stage;
int level;
struct dvfs head;
struct dvfs tail;
};
struct input_booster_data {
struct device *dev;
struct input_booster_dt_data *dt_data;
struct class *booster_class;
int dbg_level;
int level;
struct dvfs head;
struct dvfs tail;
};
struct input_booster *input_booster_allocate(int id);
void input_booster_free(struct input_booster *booster);
void input_booster_get_default_setting(const char *flag, struct dvfs *value);
int input_booster_set_level_change(int val);
#ifdef CONFIG_DEBUG_BUS_VOTER
extern int msm_bus_floor_vote(const char *name, u64 floor_hz);
#endif
#endif /* _INPUT_BOOSTER_H_ */

View file

@ -0,0 +1,53 @@
/*
* Japan Display Inc. INPUT_MT_WRAPPER Device Driver
*
* Copyright (C) 2013-2014 Japan Display Inc.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
#ifndef _INPUT_MT_WRAPPER_H_
#define _INPUT_MT_WRAPPER_H_
#define INPUT_MT_WRAPPER_MAX_FINGERS (10)
#define INPUT_MT_WRAPPER_MIN_AREA (0)
#define INPUT_MT_WRAPPER_MAX_AREA (10)
#define INPUT_MT_WRAPPER_MIN_X (0)
#define INPUT_MT_WRAPPER_MAX_X (1080)
#define INPUT_MT_WRAPPER_MIN_Y (0)
#define INPUT_MT_WRAPPER_MAX_Y (1920)
#define INPUT_MT_WRAPPER_MIN_Z (0)
#define INPUT_MT_WRAPPER_MAX_Z (255)
struct input_mt_wrapper_touch_data {
unsigned short x;
unsigned short y;
unsigned short z;
unsigned short t;
};
struct input_mt_wrapper_ioctl_touch_data {
struct input_mt_wrapper_touch_data touch[INPUT_MT_WRAPPER_MAX_FINGERS];
unsigned char t_num;
};
/* commands */
#define INPUT_MT_WRAPPER_IO_TYPE (0xB9)
#define INPUT_MT_WRAPPER_IOCTL_CMD_SET_COORDINATES \
_IOWR(INPUT_MT_WRAPPER_IO_TYPE, 0x01, \
struct input_mt_wrapper_ioctl_touch_data)
#endif /* _INPUT_MT_WRAPPER_H_ */

View file

@ -0,0 +1,61 @@
/*
* Copyright (C) 2011 Kionix, Inc.
* Written by Chris Hudson <chudson@kionix.com>
*
* 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.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307, USA
*/
#ifndef __KXTJ9_H__
#define __KXTJ9_H__
#define KXTJ9_I2C_ADDR 0x0F
struct kxtj9_platform_data {
unsigned int min_interval; /* minimum poll interval (in milli-seconds) */
unsigned int init_interval; /* initial poll interval (in milli-seconds) */
/*
* By default, x is axis 0, y is axis 1, z is axis 2; these can be
* changed to account for sensor orientation within the host device.
*/
u8 axis_map_x;
u8 axis_map_y;
u8 axis_map_z;
/*
* Each axis can be negated to account for sensor orientation within
* the host device.
*/
bool negate_x;
bool negate_y;
bool negate_z;
/* CTRL_REG1: set resolution, g-range, data ready enable */
/* Output resolution: 8-bit valid or 12-bit valid */
#define RES_8BIT 0
#define RES_12BIT (1 << 6)
u8 res_12bit;
/* Output g-range: +/-2g, 4g, or 8g */
#define KXTJ9_G_2G 0
#define KXTJ9_G_4G (1 << 3)
#define KXTJ9_G_8G (1 << 4)
u8 g_range;
int (*init)(void);
void (*exit)(void);
int (*power_on)(void);
int (*power_off)(void);
};
#endif /* __KXTJ9_H__ */

View file

@ -0,0 +1,24 @@
/*
* public include for LM8333 keypad driver - same license as driver
* Copyright (C) 2012 Wolfram Sang, Pengutronix <w.sang@pengutronix.de>
*/
#ifndef _LM8333_H
#define _LM8333_H
struct lm8333;
struct lm8333_platform_data {
/* Keymap data */
const struct matrix_keymap_data *matrix_data;
/* Active timeout before enter HALT mode in microseconds */
unsigned active_time;
/* Debounce interval in microseconds */
unsigned debounce_time;
};
extern int lm8333_read8(struct lm8333 *lm8333, u8 cmd);
extern int lm8333_write8(struct lm8333 *lm8333, u8 cmd, u8 val);
extern int lm8333_read_block(struct lm8333 *lm8333, u8 cmd, u8 len, u8 *buf);
#endif /* _LM8333_H */

View file

@ -0,0 +1,103 @@
#ifndef _MATRIX_KEYPAD_H
#define _MATRIX_KEYPAD_H
#include <linux/types.h>
#include <linux/input.h>
#include <linux/of.h>
#define MATRIX_MAX_ROWS 32
#define MATRIX_MAX_COLS 32
#define KEY(row, col, val) ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\
(((col) & (MATRIX_MAX_COLS - 1)) << 16) |\
((val) & 0xffff))
#define KEY_ROW(k) (((k) >> 24) & 0xff)
#define KEY_COL(k) (((k) >> 16) & 0xff)
#define KEY_VAL(k) ((k) & 0xffff)
#define MATRIX_SCAN_CODE(row, col, row_shift) (((row) << (row_shift)) + (col))
/**
* struct matrix_keymap_data - keymap for matrix keyboards
* @keymap: pointer to array of uint32 values encoded with KEY() macro
* representing keymap
* @keymap_size: number of entries (initialized) in this keymap
*
* This structure is supposed to be used by platform code to supply
* keymaps to drivers that implement matrix-like keypads/keyboards.
*/
struct matrix_keymap_data {
const uint32_t *keymap;
unsigned int keymap_size;
};
/**
* struct matrix_keypad_platform_data - platform-dependent keypad data
* @keymap_data: pointer to &matrix_keymap_data
* @row_gpios: pointer to array of gpio numbers representing rows
* @col_gpios: pointer to array of gpio numbers reporesenting colums
* @num_row_gpios: actual number of row gpios used by device
* @num_col_gpios: actual number of col gpios used by device
* @col_scan_delay_us: delay, measured in microseconds, that is
* needed before we can keypad after activating column gpio
* @debounce_ms: debounce interval in milliseconds
* @clustered_irq: may be specified if interrupts of all row/column GPIOs
* are bundled to one single irq
* @clustered_irq_flags: flags that are needed for the clustered irq
* @active_low: gpio polarity
* @wakeup: controls whether the device should be set up as wakeup
* source
* @no_autorepeat: disable key autorepeat
*
* This structure represents platform-specific data that use used by
* matrix_keypad driver to perform proper initialization.
*/
struct matrix_keypad_platform_data {
const struct matrix_keymap_data *keymap_data;
const unsigned int *row_gpios;
const unsigned int *col_gpios;
unsigned int num_row_gpios;
unsigned int num_col_gpios;
unsigned int col_scan_delay_us;
/* key debounce interval in milli-second */
unsigned int debounce_ms;
unsigned int clustered_irq;
unsigned int clustered_irq_flags;
bool active_low;
bool wakeup;
bool no_autorepeat;
};
int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
const char *keymap_name,
unsigned int rows, unsigned int cols,
unsigned short *keymap,
struct input_dev *input_dev);
#ifdef CONFIG_OF
/**
* matrix_keypad_parse_of_params() - Read parameters from matrix-keypad node
*
* @dev: Device containing of_node
* @rows: Returns number of matrix rows
* @cols: Returns number of matrix columns
* @return 0 if OK, <0 on error
*/
int matrix_keypad_parse_of_params(struct device *dev,
unsigned int *rows, unsigned int *cols);
#else
static inline int matrix_keypad_parse_of_params(struct device *dev,
unsigned int *rows, unsigned int *cols)
{
return -ENOSYS;
}
#endif /* CONFIG_OF */
#endif /* _MATRIX_KEYPAD_H */

View file

@ -0,0 +1,34 @@
/*
* MELFAS MIP4 Touchkey
*
* Copyright (C) 2016 MELFAS Inc.
*
* melfas_mip4_tk.h : Platform data
*
* Default path : linux/input/melfas_mip4_tk.h
*/
#ifndef _MIP4_TOUCHKEY_H
#define _MIP4_TOUCHKEY_H
#define MIP_USE_CALLBACK 0 // 0 or 1 : Callback for inform charger, display, power, etc...
#define MIP_DEV_NAME "mip4_tk"
/*
* Platform Data
*/
struct mip4_tk_platform_data {
u32 gpio_intr;
u32 gpio_pwr_en;
u32 gpio_bus_en;
const char *pwr_reg_name;
const char *bus_reg_name;
const char *firmware_name;
#if MIP_USE_CALLBACK
void (*register_callback) (void *);
/* ... */
#endif
};
#endif

126
include/linux/input/mt.h Normal file
View file

@ -0,0 +1,126 @@
#ifndef _INPUT_MT_H
#define _INPUT_MT_H
/*
* Input Multitouch Library
*
* Copyright (c) 2010 Henrik Rydberg
*
* 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.
*/
#include <linux/input.h>
#define TRKID_MAX 0xffff
#define INPUT_MT_POINTER 0x0001 /* pointer device, e.g. trackpad */
#define INPUT_MT_DIRECT 0x0002 /* direct device, e.g. touchscreen */
#define INPUT_MT_DROP_UNUSED 0x0004 /* drop contacts not seen in frame */
#define INPUT_MT_TRACK 0x0008 /* use in-kernel tracking */
#define INPUT_MT_SEMI_MT 0x0010 /* semi-mt device, finger count handled manually */
/**
* struct input_mt_slot - represents the state of an input MT slot
* @abs: holds current values of ABS_MT axes for this slot
* @frame: last frame at which input_mt_report_slot_state() was called
* @key: optional driver designation of this slot
*/
struct input_mt_slot {
int abs[ABS_MT_LAST - ABS_MT_FIRST + 1];
unsigned int frame;
unsigned int key;
};
/**
* struct input_mt - state of tracked contacts
* @trkid: stores MT tracking ID for the next contact
* @num_slots: number of MT slots the device uses
* @slot: MT slot currently being transmitted
* @flags: input_mt operation flags
* @frame: increases every time input_mt_sync_frame() is called
* @red: reduced cost matrix for in-kernel tracking
* @slots: array of slots holding current values of tracked contacts
*/
struct input_mt {
int trkid;
int num_slots;
int slot;
unsigned int flags;
unsigned int frame;
int *red;
struct input_mt_slot slots[];
};
static inline void input_mt_set_value(struct input_mt_slot *slot,
unsigned code, int value)
{
slot->abs[code - ABS_MT_FIRST] = value;
}
static inline int input_mt_get_value(const struct input_mt_slot *slot,
unsigned code)
{
return slot->abs[code - ABS_MT_FIRST];
}
static inline bool input_mt_is_active(const struct input_mt_slot *slot)
{
return input_mt_get_value(slot, ABS_MT_TRACKING_ID) >= 0;
}
static inline bool input_mt_is_used(const struct input_mt *mt,
const struct input_mt_slot *slot)
{
return slot->frame == mt->frame;
}
int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,
unsigned int flags);
void input_mt_destroy_slots(struct input_dev *dev);
static inline int input_mt_new_trkid(struct input_mt *mt)
{
return mt->trkid++ & TRKID_MAX;
}
static inline void input_mt_slot(struct input_dev *dev, int slot)
{
input_event(dev, EV_ABS, ABS_MT_SLOT, slot);
}
static inline bool input_is_mt_value(int axis)
{
return axis >= ABS_MT_FIRST && axis <= ABS_MT_LAST;
}
static inline bool input_is_mt_axis(int axis)
{
return axis == ABS_MT_SLOT || input_is_mt_value(axis);
}
void input_mt_report_slot_state(struct input_dev *dev,
unsigned int tool_type, bool active);
void input_mt_report_finger_count(struct input_dev *dev, int count);
void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count);
void input_mt_drop_unused(struct input_dev *dev);
void input_mt_sync_frame(struct input_dev *dev);
/**
* struct input_mt_pos - contact position
* @x: horizontal coordinate
* @y: vertical coordinate
*/
struct input_mt_pos {
s16 x, y;
};
int input_mt_assign_slots(struct input_dev *dev, int *slots,
const struct input_mt_pos *pos, int num_pos);
int input_mt_get_slot_by_key(struct input_dev *dev, int key);
#endif

View file

@ -0,0 +1,12 @@
/*
* Copyright (C) 2012 Paul Parsons <lost.distance@yahoo.com>
*
* 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.
*/
struct navpoint_platform_data {
int port; /* PXA SSP port for pxa_ssp_request() */
int gpio; /* GPIO for power on/off */
};

View file

@ -0,0 +1,64 @@
#ifndef _PIXCIR_I2C_TS_H
#define _PIXCIR_I2C_TS_H
/*
* Register map
*/
#define PIXCIR_REG_POWER_MODE 51
#define PIXCIR_REG_INT_MODE 52
/*
* Power modes:
* active: max scan speed
* idle: lower scan speed with automatic transition to active on touch
* halt: datasheet says sleep but this is more like halt as the chip
* clocks are cut and it can only be brought out of this mode
* using the RESET pin.
*/
enum pixcir_power_mode {
PIXCIR_POWER_ACTIVE,
PIXCIR_POWER_IDLE,
PIXCIR_POWER_HALT,
};
#define PIXCIR_POWER_MODE_MASK 0x03
#define PIXCIR_POWER_ALLOW_IDLE (1UL << 2)
/*
* Interrupt modes:
* periodical: interrupt is asserted periodicaly
* diff coordinates: interrupt is asserted when coordinates change
* level on touch: interrupt level asserted during touch
* pulse on touch: interrupt pulse asserted druing touch
*
*/
enum pixcir_int_mode {
PIXCIR_INT_PERIODICAL,
PIXCIR_INT_DIFF_COORD,
PIXCIR_INT_LEVEL_TOUCH,
PIXCIR_INT_PULSE_TOUCH,
};
#define PIXCIR_INT_MODE_MASK 0x03
#define PIXCIR_INT_ENABLE (1UL << 3)
#define PIXCIR_INT_POL_HIGH (1UL << 2)
/**
* struct pixcir_irc_chip_data - chip related data
* @max_fingers: Max number of fingers reported simultaneously by h/w
* @has_hw_ids: Hardware supports finger tracking IDs
*
*/
struct pixcir_i2c_chip_data {
u8 max_fingers;
bool has_hw_ids;
};
struct pixcir_ts_platform_data {
int x_max;
int y_max;
int gpio_attb; /* GPIO connected to ATTB line */
struct pixcir_i2c_chip_data chip;
};
#endif

View file

@ -0,0 +1,43 @@
/*
* Samsung Keypad platform data definitions
*
* Copyright (C) 2010 Samsung Electronics Co.Ltd
* Author: Joonyoung Shim <jy0922.shim@samsung.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#ifndef __SAMSUNG_KEYPAD_H
#define __SAMSUNG_KEYPAD_H
#include <linux/input/matrix_keypad.h>
#define SAMSUNG_MAX_ROWS 8
#define SAMSUNG_MAX_COLS 8
/**
* struct samsung_keypad_platdata - Platform device data for Samsung Keypad.
* @keymap_data: pointer to &matrix_keymap_data.
* @rows: number of keypad row supported.
* @cols: number of keypad col supported.
* @no_autorepeat: disable key autorepeat.
* @wakeup: controls whether the device should be set up as wakeup source.
* @cfg_gpio: configure the GPIO.
*
* Initialisation data specific to either the machine or the platform
* for the device driver to use or call-back when configuring gpio.
*/
struct samsung_keypad_platdata {
const struct matrix_keymap_data *keymap_data;
unsigned int rows;
unsigned int cols;
bool no_autorepeat;
bool wakeup;
void (*cfg_gpio)(unsigned int rows, unsigned int cols);
};
#endif /* __SAMSUNG_KEYPAD_H */

View file

@ -0,0 +1,15 @@
#ifndef __SH_KEYSC_H__
#define __SH_KEYSC_H__
#define SH_KEYSC_MAXKEYS 64
struct sh_keysc_info {
enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3,
SH_KEYSC_MODE_4, SH_KEYSC_MODE_5, SH_KEYSC_MODE_6 } mode;
int scan_timing; /* 0 -> 7, see KYCR1, SCN[2:0] */
int delay;
int kycr2_delay;
int keycodes[SH_KEYSC_MAXKEYS]; /* KEYIN * KEYOUT */
};
#endif /* __SH_KEYSC_H__ */

View file

@ -0,0 +1,62 @@
#ifndef _SPARSE_KEYMAP_H
#define _SPARSE_KEYMAP_H
/*
* Copyright (c) 2009 Dmitry Torokhov
*
* 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.
*/
#define KE_END 0 /* Indicates end of keymap */
#define KE_KEY 1 /* Ordinary key/button */
#define KE_SW 2 /* Switch (predetermined value) */
#define KE_VSW 3 /* Switch (value supplied at runtime) */
#define KE_IGNORE 4 /* Known entry that should be ignored */
#define KE_LAST KE_IGNORE
/**
* struct key_entry - keymap entry for use in sparse keymap
* @type: Type of the key entry (KE_KEY, KE_SW, KE_VSW, KE_END);
* drivers are allowed to extend the list with their own
* private definitions.
* @code: Device-specific data identifying the button/switch
* @keycode: KEY_* code assigned to a key/button
* @sw.code: SW_* code assigned to a switch
* @sw.value: Value that should be sent in an input even when KE_SW
* switch is toggled. KE_VSW switches ignore this field and
* expect driver to supply value for the event.
*
* This structure defines an entry in a sparse keymap used by some
* input devices for which traditional table-based approach is not
* suitable.
*/
struct key_entry {
int type; /* See KE_* above */
u32 code;
union {
u16 keycode; /* For KE_KEY */
struct { /* For KE_SW, KE_VSW */
u8 code;
u8 value; /* For KE_SW, ignored by KE_VSW */
} sw;
};
};
struct key_entry *sparse_keymap_entry_from_scancode(struct input_dev *dev,
unsigned int code);
struct key_entry *sparse_keymap_entry_from_keycode(struct input_dev *dev,
unsigned int code);
int sparse_keymap_setup(struct input_dev *dev,
const struct key_entry *keymap,
int (*setup)(struct input_dev *, struct key_entry *));
void sparse_keymap_free(struct input_dev *dev);
void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *ke,
unsigned int value, bool autorelease);
bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code,
unsigned int value, bool autorelease);
#endif /* _SPARSE_KEYMAP_H */

View file

@ -0,0 +1,115 @@
/*
* Synaptics DSX touchscreen driver
*
* Copyright (C) 2012-2015 Synaptics Incorporated. All rights reserved.
*
* Copyright (C) 2012 Alexandra Chin <alexandra.chin@tw.synaptics.com>
* Copyright (C) 2012 Scott Lin <scott.lin@tw.synaptics.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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.
*
* INFORMATION CONTAINED IN THIS DOCUMENT IS PROVIDED "AS-IS," AND SYNAPTICS
* EXPRESSLY DISCLAIMS ALL EXPRESS AND IMPLIED WARRANTIES, INCLUDING ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE,
* AND ANY WARRANTIES OF NON-INFRINGEMENT OF ANY INTELLECTUAL PROPERTY RIGHTS.
* IN NO EVENT SHALL SYNAPTICS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR IN CONNECTION
* WITH THE USE OF THE INFORMATION CONTAINED IN THIS DOCUMENT, HOWEVER CAUSED
* AND BASED ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, AND EVEN IF SYNAPTICS WAS ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE. IF A TRIBUNAL OF COMPETENT JURISDICTION DOES
* NOT PERMIT THE DISCLAIMER OF DIRECT DAMAGES OR ANY OTHER DAMAGES, SYNAPTICS'
* TOTAL CUMULATIVE LIABILITY TO ANY PARTY SHALL NOT EXCEED ONE HUNDRED U.S.
* DOLLARS.
*/
#ifndef _SYNAPTICS_DSX_H_
#define _SYNAPTICS_DSX_H_
#define PLATFORM_DRIVER_NAME "synaptics_dsxv26"
#define STYLUS_DRIVER_NAME "synaptics_dsxv26_stylus"
#define ACTIVE_PEN_DRIVER_NAME "synaptics_dsxv26_active_pen"
#define PROXIMITY_DRIVER_NAME "synaptics_dsxv26_proximity"
#define GESTURE_DRIVER_NAME "synaptics_dsxv26_gesture"
#define I2C_DRIVER_NAME "synaptics_dsxv26"
#define SPI_DRIVER_NAME "synaptics_dsxv26"
/*
* struct synaptics_dsx_button_map - button map
* @nbuttons: number of buttons
* @map: pointer to array of button codes
*/
struct synaptics_dsx_button_map {
unsigned char nbuttons;
unsigned int *map;
};
/*
* struct synaptics_dsx_board_data - DSX board data
* @x_flip: x flip flag
* @y_flip: y flip flag
* @swap_axes: swap axes flag
* @irq_gpio: attention interrupt GPIO
* @irq_on_state: attention interrupt active state
* @power_gpio: power switch GPIO
* @power_on_state: power switch active state
* @reset_gpio: reset GPIO
* @reset_on_state: reset active state
* @max_y_for_2d: maximum y value for 2D area when virtual buttons are present
* @irq_flags: IRQ flags
* @i2c_addr: I2C slave address
* @ub_i2c_addr: microbootloader mode I2C slave address
* @device_descriptor_addr: HID device descriptor address
* @panel_x: x-axis resolution of display panel
* @panel_y: y-axis resolution of display panel
* @power_delay_ms: delay time to wait after powering up device
* @reset_delay_ms: delay time to wait after resetting device
* @reset_active_ms: reset active time
* @byte_delay_us: delay time between two bytes of SPI data
* @block_delay_us: delay time between two SPI transfers
* @pwr_reg_name: pointer to name of regulator for power control
* @bus_reg_name: pointer to name of regulator for bus pullup control
* @cap_button_map: pointer to 0D button map
* @vir_button_map: pointer to virtual button map
* @firmware_name: pointer to name of firmware
*/
struct synaptics_dsx_board_data {
bool x_flip;
bool y_flip;
bool swap_axes;
int gpio;
int irq_gpio;
int irq_on_state;
int power_gpio;
int power_on_state;
int reset_gpio;
int reset_on_state;
int max_y_for_2d;
unsigned long irq_flags;
unsigned short i2c_addr;
unsigned short ub_i2c_addr;
unsigned short device_descriptor_addr;
unsigned int panel_x;
unsigned int panel_y;
unsigned int power_delay_ms;
unsigned int reset_delay_ms;
unsigned int reset_active_ms;
unsigned int byte_delay_us;
unsigned int block_delay_us;
const char *pwr_reg_name;
const char *bus_reg_name;
struct synaptics_dsx_button_map *cap_button_map;
struct synaptics_dsx_button_map *vir_button_map;
const char *firmware_name;
const char *firmware_name_bl;
};
#endif

View file

@ -0,0 +1,44 @@
/*
* TCA8418 keypad platform support
*
* Copyright (C) 2011 Fuel7, Inc. All rights reserved.
*
* Author: Kyle Manna <kyle.manna@fuel7.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License v2 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.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 021110-1307, USA.
*
* If you can't comply with GPLv2, alternative licensing terms may be
* arranged. Please contact Fuel7, Inc. (http://fuel7.com/) for proprietary
* alternative licensing inquiries.
*/
#ifndef _TCA8418_KEYPAD_H
#define _TCA8418_KEYPAD_H
#include <linux/types.h>
#include <linux/input/matrix_keypad.h>
#define TCA8418_I2C_ADDR 0x34
#define TCA8418_NAME "tca8418_keypad"
struct tca8418_keypad_platform_data {
const struct matrix_keymap_data *keymap_data;
unsigned rows;
unsigned cols;
bool rep;
bool irq_is_gpio;
};
#endif

View file

@ -0,0 +1,22 @@
/*
* Copyright (c) 2014 Sebastian Reichel <sre@kernel.org>
*
* 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 _TOUCHSCREEN_H
#define _TOUCHSCREEN_H
#include <linux/input.h>
#ifdef CONFIG_OF
void touchscreen_parse_of_params(struct input_dev *dev);
#else
static inline void touchscreen_parse_of_params(struct input_dev *dev)
{
}
#endif
#endif

View file

@ -0,0 +1,23 @@
/* linux/i2c/tps6507x-ts.h
*
* Functions to access TPS65070 touch screen chip.
*
* Copyright (c) 2009 RidgeRun (todd.fischer@ridgerun.com)
*
*
* For licencing details see kernel-base/COPYING
*/
#ifndef __LINUX_I2C_TPS6507X_TS_H
#define __LINUX_I2C_TPS6507X_TS_H
/* Board specific touch screen initial values */
struct touchscreen_init_data {
int poll_period; /* ms */
__u16 min_pressure; /* min reading to be treated as a touch */
__u16 vendor;
__u16 product;
__u16 version;
};
#endif /* __LINUX_I2C_TPS6507X_TS_H */

View file

@ -0,0 +1,26 @@
#ifndef _TSP_TA_CALLBACK_H_
#define _TSP_TA_CALLBACK_H_
#ifdef CONFIG_EXTCON
#undef USE_TSP_TA_CALLBACKS
#else
/* Model define */
#if defined(CONFIG_TOUCHSCREEN_TA_CALLBACK_ENABLE)
#define USE_TSP_TA_CALLBACKS
#else /* default */
#undef USE_TSP_TA_CALLBACKS
#endif
#endif /* CONFIG_EXTCON */
#ifdef USE_TSP_TA_CALLBACKS
extern struct tsp_callbacks *charger_callbacks;
struct tsp_callbacks {
void (*inform_charger)(struct tsp_callbacks *, int);
};
#endif
#endif /* _TSP_TA_CALLBACK_H_ */