Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d67ad78e authored by Dmitry Torokhov's avatar Dmitry Torokhov
Browse files

Merge branch 'next' into for-linus

Prepare input updates for 4.16 merge window.
parents 060403f3 fafef982
Loading
Loading
Loading
Loading
+21 −14
Original line number Diff line number Diff line
* MELFAS MMS114 touchscreen controller
* MELFAS MMS114/MMS152 touchscreen controller

Required properties:
- compatible: must be "melfas,mms114"
- compatible: should be one of:
	- "melfas,mms114"
	- "melfas,mms152"
- reg: I2C address of the chip
- interrupts: interrupt to which the chip is connected
- x-size: horizontal resolution of touchscreen
- y-size: vertical resolution of touchscreen
- touchscreen-size-x: See [1]
- touchscreen-size-y: See [1]

Optional properties:
- contact-threshold:
- moving-threshold:
- x-invert: invert X axis
- y-invert: invert Y axis
- touchscreen-fuzz-x: See [1]
- touchscreen-fuzz-y: See [1]
- touchscreen-fuzz-pressure: See [1]
- touchscreen-inverted-x: See [1]
- touchscreen-inverted-y: See [1]
- touchscreen-swapped-x-y: See [1]

[1]: Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt

Example:

@@ -22,12 +28,13 @@ Example:
			compatible = "melfas,mms114";
			reg = <0x48>;
			interrupts = <39 0>;
			x-size = <720>;
			y-size = <1280>;
			contact-threshold = <10>;
			moving-threshold = <10>;
			x-invert;
			y-invert;
			touchscreen-size-x = <720>;
			touchscreen-size-y = <1280>;
			touchscreen-fuzz-x = <10>;
			touchscreen-fuzz-y = <10>;
			touchscreen-fuzz-pressure = <10>;
			touchscreen-inverted-x;
			touchscreen-inverted-y;
		};

		/* ... */
+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ Optional properties:
- touchscreen-inverted-y  : See touchscreen.txt
- touchscreen-swapped-x-y : See touchscreen.txt
- silead,max-fingers	  : maximum number of fingers the touchscreen can detect
- silead,home-button	  : Boolean, set to true on devices which have a
			    capacitive home-button build into the touchscreen
- vddio-supply		  : regulator phandle for controller VDDIO
- avdd-supply		  : regulator phandle for controller AVDD

+0 −5
Original line number Diff line number Diff line
@@ -28,11 +28,6 @@ hardware descriptions such as device tree or ACPI:
- gpio-beeper: drivers/input/misc/gpio-beeper.c is used to provide a beep from
  an external speaker connected to a GPIO line.

- gpio-tilt-polled: drivers/input/misc/gpio_tilt_polled.c provides tilt
  detection switches using GPIO, which is useful for your homebrewn pinball
  machine if for nothing else. It can detect different tilt angles of the
  monitored object.

- extcon-gpio: drivers/extcon/extcon-gpio.c is used when you need to read an
  external connector status, such as a headset line for an audio driver or an
  HDMI connector. It will provide a better userspace sysfs interface than GPIO.
+0 −103
Original line number Diff line number Diff line
Driver for tilt-switches connected via GPIOs
============================================

Generic driver to read data from tilt switches connected via gpios.
Orientation can be provided by one or more than one tilt switches,
i.e. each tilt switch providing one axis, and the number of axes
is also not limited.


Data structures
---------------

The array of struct gpio in the gpios field is used to list the gpios
that represent the current tilt state.

The array of struct gpio_tilt_axis describes the axes that are reported
to the input system. The values set therein are used for the
input_set_abs_params calls needed to init the axes.

The array of struct gpio_tilt_state maps gpio states to the corresponding
values to report. The gpio state is represented as a bitfield where the
bit-index corresponds to the index of the gpio in the struct gpio array.
In the same manner the values stored in the axes array correspond to
the elements of the gpio_tilt_axis-array.


Example
-------

Example configuration for a single TS1003 tilt switch that rotates around
one axis in 4 steps and emits the current tilt via two GPIOs::

    static int sg060_tilt_enable(struct device *dev) {
	    /* code to enable the sensors */
    };

    static void sg060_tilt_disable(struct device *dev) {
	    /* code to disable the sensors */
    };

    static struct gpio sg060_tilt_gpios[] = {
	    { SG060_TILT_GPIO_SENSOR1, GPIOF_IN, "tilt_sensor1" },
	    { SG060_TILT_GPIO_SENSOR2, GPIOF_IN, "tilt_sensor2" },
    };

    static struct gpio_tilt_state sg060_tilt_states[] = {
	    {
		    .gpios = (0 << 1) | (0 << 0),
		    .axes = (int[]) {
			    0,
		    },
	    }, {
		    .gpios = (0 << 1) | (1 << 0),
		    .axes = (int[]) {
			    1, /* 90 degrees */
		    },
	    }, {
		    .gpios = (1 << 1) | (1 << 0),
		    .axes = (int[]) {
			    2, /* 180 degrees */
		    },
	    }, {
		    .gpios = (1 << 1) | (0 << 0),
		    .axes = (int[]) {
			    3, /* 270 degrees */
		    },
	    },
    };

    static struct gpio_tilt_axis sg060_tilt_axes[] = {
	    {
		    .axis = ABS_RY,
		    .min = 0,
		    .max = 3,
		    .fuzz = 0,
		    .flat = 0,
	    },
    };

    static struct gpio_tilt_platform_data sg060_tilt_pdata= {
	    .gpios = sg060_tilt_gpios,
	    .nr_gpios = ARRAY_SIZE(sg060_tilt_gpios),

	    .axes = sg060_tilt_axes,
	    .nr_axes = ARRAY_SIZE(sg060_tilt_axes),

	    .states = sg060_tilt_states,
	    .nr_states = ARRAY_SIZE(sg060_tilt_states),

	    .debounce_interval = 100,

	    .poll_interval = 1000,
	    .enable = sg060_tilt_enable,
	    .disable = sg060_tilt_disable,
    };

    static struct platform_device sg060_device_tilt = {
	    .name = "gpio-tilt-polled",
	    .id = -1,
	    .dev = {
		    .platform_data = &sg060_tilt_pdata,
	    },
    };
+3 −3
Original line number Diff line number Diff line
@@ -108,9 +108,9 @@ example below:
	};

	static const struct property_entry rotary_encoder_properties[] __initconst = {
		PROPERTY_ENTRY_INTEGER("rotary-encoder,steps-per-period", u32, 24),
		PROPERTY_ENTRY_INTEGER("linux,axis",			  u32, ABS_X),
		PROPERTY_ENTRY_INTEGER("rotary-encoder,relative_axis",	  u32, 0),
		PROPERTY_ENTRY_U32("rotary-encoder,steps-per-period", 24),
		PROPERTY_ENTRY_U32("linux,axis",		      ABS_X),
		PROPERTY_ENTRY_U32("rotary-encoder,relative_axis",    0),
		{ },
	};

Loading