Re: [PATCHv9][ 2/3] ARM: dts: cpuimx51 Add touchscreen support.
On 14:17 Fri 08 Nov , Denis Carikli wrote: > Cc: Rob Herring > Cc: Pawel Moll > Cc: Mark Rutland > Cc: Stephen Warren > Cc: Ian Campbell > Cc: Grant Likely > Cc: devicet...@vger.kernel.org > Cc: Dmitry Torokhov > Cc: linux-input@vger.kernel.org > Cc: Sascha Hauer > Cc: linux-arm-ker...@lists.infradead.org > Cc: Lothar Waßmann > Cc: Shawn Guo > Cc: Eric Bénard > Signed-off-by: Denis Carikli > --- > ChangeLog v8->v9: > - Added Grant Likely in the Cc list. > - Adapted to the removal of the pinctrl properties in the tsc2007 > documentation. > - Fixed the gpios property (before, it was set to active high by error). > > ChangeLog v7->v8: > - Added Shawn Guo in the cc list. > --- > arch/arm/boot/dts/imx51-eukrea-cpuimx51.dtsi | 14 +- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/boot/dts/imx51-eukrea-cpuimx51.dtsi > b/arch/arm/boot/dts/imx51-eukrea-cpuimx51.dtsi > index b22841a..b04c65b 100644 > --- a/arch/arm/boot/dts/imx51-eukrea-cpuimx51.dtsi > +++ b/arch/arm/boot/dts/imx51-eukrea-cpuimx51.dtsi > @@ -42,11 +42,23 @@ > compatible = "nxp,pcf8563"; > reg = <0x51>; > }; > + > + tsc2007: tsc2007@49 { > + compatible = "ti,tsc2007"; > + reg = <0x49>; > + interrupt-parent = <&gpio4>; > + interrupts = <0x0 0x8>; > + gpios = <&gpio4 0 1>; > + ti,x-plate-ohms = <180>; as explain on the binding drop this gpios this is an IRQ not a gpio NACK Best Regards, J. > + }; > }; > > &iomuxc { > + pinctrl-names = "default"; > + pinctrl-0 = <&pinctrl_hog>; > + > imx51-eukrea { > - pinctrl_tsc2007_1: tsc2007grp-1 { > + pinctrl_hog: hoggrp { > fsl,pins = < > MX51_PAD_GPIO_NAND__GPIO_NAND 0x1f5 > MX51_PAD_NANDF_D8__GPIO4_0 0x1f5 > -- > 1.7.9.5 > -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv9][ 3/3] ARM: dts: cpuimx35 Add touchscreen support.
On 14:17 Fri 08 Nov , Denis Carikli wrote: > Cc: Rob Herring > Cc: Pawel Moll > Cc: Mark Rutland > Cc: Stephen Warren > Cc: Ian Campbell > Cc: Grant Likely > Cc: devicet...@vger.kernel.org > Cc: Dmitry Torokhov > Cc: linux-input@vger.kernel.org > Cc: Sascha Hauer > Cc: linux-arm-ker...@lists.infradead.org > Cc: Lothar Waßmann > Cc: Shawn Guo > Cc: Eric Bénard > Signed-off-by: Denis Carikli > --- > ChangeLog v8->v9: > - Added Grant Likely in the cc list. > - Adapted to the removal of the pinctrl properties in the tsc2007 > documentation. > - Fixed the gpios property (before, it was set to active high by error). > > ChangeLog v7->v8: > - Added Shawn Guo in the cc list. > --- > arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi | 21 + > 1 file changed, 21 insertions(+) > > diff --git a/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi > b/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi > index b9cb5a5..f25a40f 100644 > --- a/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi > +++ b/arch/arm/boot/dts/imx35-eukrea-cpuimx35.dtsi > @@ -36,6 +36,27 @@ > compatible = "nxp,pcf8563"; > reg = <0x51>; > }; > + > + tsc2007: tsc2007@48 { > + compatible = "ti,tsc2007"; > + reg = <0x48>; > + interrupt-parent = <&gpio3>; > + interrupts = <0x2 0x8>; > + gpios = <&gpio3 2 1>; as explain on the binding drop this gpios this is an IRQ not a gpio NACK Best Regards, J. > + ti,x-plate-ohms = <180>; > +}; > + > +}; > + > +&iomuxc { > + pinctrl-names = "default"; > + pinctrl-0 = <&pinctrl_hog>; > + > + imx35-eukrea { > + pinctrl_hog: hoggrp { > + fsl,pins = ; > + }; > + }; > }; > > &nfc { > -- > 1.7.9.5 > -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Input: tsc2007 - convert to use devres-managed resources
This simplifies error handling path and allows us get rid of tsc2007_remove(). Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/tsc2007.c | 79 +++-- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c index 48a165a..bd51eee 100644 --- a/drivers/input/touchscreen/tsc2007.c +++ b/drivers/input/touchscreen/tsc2007.c @@ -366,6 +366,14 @@ static int tsc2007_probe_pdev(struct i2c_client *client, struct tsc2007 *ts, return 0; } +static void tsc2007_call_exit_platform_hw(void *data) +{ + struct device *dev = data; + const struct tsc2007_platform_data *pdata = dev_get_platdata(dev); + + pdata->exit_platform_hw(); +} + static int tsc2007_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -389,11 +397,9 @@ static int tsc2007_probe(struct i2c_client *client, if (err) return err; - input_dev = input_allocate_device(); - if (!input_dev) { - err = -ENOMEM; - goto err_free_input; - }; + input_dev = devm_input_allocate_device(&client->dev); + if (!input_dev) + return -ENOMEM; i2c_set_clientdata(client, ts); @@ -422,45 +428,41 @@ static int tsc2007_probe(struct i2c_client *client, input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_12BIT, ts->fuzzz, 0); - if (pdata && pdata->init_platform_hw) - pdata->init_platform_hw(); + if (pdata) { + if (pdata->exit_platform_hw) { + err = devm_add_action(&client->dev, + tsc2007_call_exit_platform_hw, + &client->dev); + if (err) { + dev_err(&client->dev, + "Failed to register exit_platform_hw action, %d\n", + err); + return err; + } + } + + if (pdata->init_platform_hw) + pdata->init_platform_hw(); + } - err = request_threaded_irq(ts->irq, tsc2007_hard_irq, tsc2007_soft_irq, - IRQF_ONESHOT, client->dev.driver->name, ts); - if (err < 0) { - dev_err(&client->dev, "irq %d busy?\n", ts->irq); - goto err_free_input; + err = devm_request_threaded_irq(&client->dev, ts->irq, + tsc2007_hard_irq, tsc2007_soft_irq, + IRQF_ONESHOT, + client->dev.driver->name, ts); + if (err) { + dev_err(&client->dev, "Failed to request irq %d: %d\n", + ts->irq, err); + return err; } tsc2007_stop(ts); err = input_register_device(input_dev); - if (err) - goto err_free_irq; - - return 0; - - err_free_irq: - free_irq(ts->irq, ts); - if (pdata && pdata->exit_platform_hw) - pdata->exit_platform_hw(); - err_free_input: - input_free_device(input_dev); - return err; -} - -static int tsc2007_remove(struct i2c_client *client) -{ - const struct tsc2007_platform_data *pdata = dev_get_platdata(&client->dev); - struct tsc2007 *ts = i2c_get_clientdata(client); - - free_irq(ts->irq, ts); - - if (pdata && pdata->exit_platform_hw) - pdata->exit_platform_hw(); - - input_unregister_device(ts->input); - kfree(ts); + if (err) { + dev_err(&client->dev, + "Failed to register input device: %d\n", err); + return err; + } return 0; } @@ -488,7 +490,6 @@ static struct i2c_driver tsc2007_driver = { }, .id_table = tsc2007_idtable, .probe = tsc2007_probe, - .remove = tsc2007_remove, }; module_i2c_driver(tsc2007_driver); -- 1.8.3.1 -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv9][ 1/3] Input: tsc2007: Add device tree support.
On 14:17 Fri 08 Nov , Denis Carikli wrote: > Cc: Rob Herring > Cc: Pawel Moll > Cc: Mark Rutland > Cc: Stephen Warren > Cc: Ian Campbell > Cc: Grant Likely > Cc: devicet...@vger.kernel.org > Cc: Dmitry Torokhov > Cc: linux-input@vger.kernel.org > Cc: Sascha Hauer > Cc: linux-arm-ker...@lists.infradead.org > Cc: Lothar Waßmann > Cc: Shawn Guo > Cc: Eric Bénard > Signed-off-by: Denis Carikli > --- > ChangeLog v8->v9: > - Added Grant Likely in the Cc list. > - Removed the mention of the pinctrl properties in the documentation. > > ChangeLog v7->v8: > - Fixed the lack of x and z fuzz properties. > - The pendown gpio is better documented. > - Added Shawn Guo in the cc list. > --- > .../bindings/input/touchscreen/tsc2007.txt | 41 > drivers/input/touchscreen/tsc2007.c| 204 > > 2 files changed, 204 insertions(+), 41 deletions(-) > create mode 100644 > Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt > > diff --git a/Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt > b/Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt > new file mode 100644 > index 000..028aba66d > --- /dev/null > +++ b/Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt > @@ -0,0 +1,41 @@ > +* Texas Instruments tsc2007 touchscreen controller > + > +Required properties: > +- compatible: must be "ti,tsc2007". > +- reg: I2C address of the chip. > +- ti,x-plate-ohms: X-plate resistance in ohms. > + > +Optional properties: > +- gpios: the interrupt gpio the chip is connected to (trough the penirq pin). nack use interrupt property this a non-sense that we do today to pass irq via gpio property the should NEVER known it's a gpio just an irq > + The penirq pin goes to low when the panel is touched. > + (see GPIO binding[1] for more details). > +- interrupt-parent: the phandle for the gpio controller > + (see interrupt binding[0]). > +- interrupts: (gpio) interrupt to which the chip is connected > + (see interrupt binding[0]). > +- ti,max-rt: maximum pressure. > +- ti,fuzzx: specifies the absolute input fuzz x value. > + If set, it will permit noise in the data up to +- the value given to the > fuzz > + parameter, that is used to filter noise from the event stream. > +- ti,fuzzy: specifies the absolute input fuzz y value. > +- ti,fuzzz: specifies the absolute input fuzz z value. fuzz{x,y,z} look a weird name > +- ti,poll-period: how much time to wait(in millisecond) before reading again > the > + values from the tsc2007. so put -ms in the binding to de clear and does not requiere to read the doc Best Regards, J. > + > +[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt > +[1]: Documentation/devicetree/bindings/gpio/gpio.txt > + > +Example: > + &i2c1 { > + /* ... */ > + tsc2007@49 { > + compatible = "ti,tsc2007"; > + reg = <0x49>; > + interrupt-parent = <&gpio4>; > + interrupts = <0x0 0x8>; > + gpios = <&gpio4 0 0>; > + ti,x-plate-ohms = <180>; > + }; > + > + /* ... */ > + }; > diff --git a/drivers/input/touchscreen/tsc2007.c > b/drivers/input/touchscreen/tsc2007.c > index 0b67ba4..3168a99 100644 > --- a/drivers/input/touchscreen/tsc2007.c > +++ b/drivers/input/touchscreen/tsc2007.c > @@ -26,6 +26,9 @@ > #include > #include > #include > +#include > +#include > +#include > > #define TSC2007_MEASURE_TEMP0(0x0 << 4) > #define TSC2007_MEASURE_AUX (0x2 << 4) > @@ -74,7 +77,12 @@ struct tsc2007 { > u16 max_rt; > unsigned long poll_delay; > unsigned long poll_period; > + int fuzzx; > + int fuzzy; > + int fuzzz; > + charof; > > + unsignedgpio; > int irq; > > wait_queue_head_t wait; > @@ -84,6 +92,11 @@ struct tsc2007 { > void(*clear_penirq)(void); > }; > > +static int tsc2007_get_pendown_state_dt(struct tsc2007 *ts) > +{ > + return !gpio_get_value(ts->gpio); > +} > + > static inline int tsc2007_xfer(struct tsc2007 *tsc, u8 cmd) > { > s32 data; > @@ -142,6 +155,14 @@ static u32 tsc2007_calculate_pressure(struct tsc2007 > *tsc, struct ts_event *tc) > return rt; > } > > +static bool tsc2007_is_pen_down_valid(struct tsc2007 *ts) > +{ > + if (ts->of) > + return gpio_is_valid(ts->gpio); > + else > + return ts->get_pendown_state ? true : false; > +} > + > static bool tsc2007_is_pen_down(struct tsc2007 *ts) > { > /* > @@ -158,10 +179,13 @@ static bool tsc2007_is_pen_down(struct tsc2007 *ts) >* to fall back on the pressure reading. >*/ > > - if (!ts->get_pendown_state) >
[PATCH] Input: tsc2007 - remove unused poll_delay from platform data
Dmitry Torokhov (maintainer:INPUT (KEYBOARD,...,commit_signer:7/7=100%,commit_signer:2/2=100%) Bill Pemberton (commit_signer:3/7=43%) Mark Brown (commit_signer:2/7=29%) Javier Martinez Canillas (commit_signer:1/7=14%) Russell King (commit_signer:1/7=14%) linux-input@vger.kernel.org (open list:INPUT (KEYBOARD,...) linux-ker...@vger.kernel.org (open list) Authors drivers/input/touchscreen/tsc2007.c: Kwangwoo Lee include/linux/i2c/tsc2007.h: Kwangwoo Lee The driver does not use poll_delay parameter, so let's remove it. Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/tsc2007.c | 2 -- include/linux/i2c/tsc2007.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c index 390148c..48a165a 100644 --- a/drivers/input/touchscreen/tsc2007.c +++ b/drivers/input/touchscreen/tsc2007.c @@ -75,7 +75,6 @@ struct tsc2007 { u16 model; u16 x_plate_ohms; u16 max_rt; - unsigned long poll_delay; unsigned long poll_period; int fuzzx; int fuzzy; @@ -352,7 +351,6 @@ static int tsc2007_probe_pdev(struct i2c_client *client, struct tsc2007 *ts, ts->model = pdata->model; ts->x_plate_ohms = pdata->x_plate_ohms; ts->max_rt= pdata->max_rt ? : MAX_12BIT; - ts->poll_delay= pdata->poll_delay ? : 1; ts->poll_period = pdata->poll_period ? : 1; ts->get_pendown_state = pdata->get_pendown_state; ts->clear_penirq = pdata->clear_penirq; diff --git a/include/linux/i2c/tsc2007.h b/include/linux/i2c/tsc2007.h index 041c8e8..4f35b6a 100644 --- a/include/linux/i2c/tsc2007.h +++ b/include/linux/i2c/tsc2007.h @@ -7,8 +7,6 @@ struct tsc2007_platform_data { u16 model; /* 2007. */ u16 x_plate_ohms; /* must be non-zero value */ u16 max_rt; /* max. resistance above which samples are ignored */ - unsigned long poll_delay; /* delay (in ms) after pen-down event -before polling starts */ unsigned long poll_period; /* time (in ms) between samples */ int fuzzx; /* fuzz factor for X, Y and pressure axes */ int fuzzy; -- 1.8.3.1 -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: randconfig build error with next-20131120, in drivers/input/touchscreen
Hi Jim, On Wed, Nov 20, 2013 at 11:23:31AM -0700, Jim Davis wrote: > Building with the attached random configuration file, > > drivers/built-in.o: In function `sur40_disconnect': > sur40.c:(.text+0x15c1cc): undefined reference to > `input_unregister_polled_device' > sur40.c:(.text+0x15c1d5): undefined reference to `input_free_polled_device' > drivers/built-in.o: In function `sur40_probe': > sur40.c:(.text+0x15c47a): undefined reference to > `input_allocate_polled_device' > sur40.c:(.text+0x15c65b): undefined reference to > `input_register_polled_device' > sur40.c:(.text+0x15c68b): undefined reference to `input_free_polled_device' > make: *** [vmlinux] Error 1 Thanks for the report. I amended the commit to select INPUT_POLLDEV. -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] Input: Added thumb detection in BCM5974 multitouch driver
Hi Friedrich, On Wed, Nov 20, 2013 at 11:54:12PM +0100, Friedrich Schöller wrote: > Trackpads with integrated buttons are hard to use when the driver responds to > movements of the thumb that is resting or clicking on the surface of the > trackpad. This patch adds rudimentary support to filter out these touch > events. > > The feature can be turned on via sysfs: > /sys/class/input/input[0-9]+/thumb_ignore: > Enables thumb detection > Values: 0/1 > /sys/class/input/input[0-9]+/thumb_ratio_on: > When the ratio of ABS_MT_TOUCH_MINOR / ABS_MT_TOUCH_MAJOR > times 100 is smaller than this value the touch qualifies > as a thumb. > /sys/class/input/input[0-9]+/thumb_ratio_off: > When the ratio of ABS_MT_TOUCH_MINOR / ABS_MT_TOUCH_MAJOR > times 100 is bigger than this value the touch no longer > qualifies as a thumb. > /sys/class/input/input[0-9]+/thumb_y_on: > When ABS_MT_POSITION_Y is bigger than this value the touch > qualifies as a thumb. > /sys/class/input/input[0-9]+/thumb_y_off: > When ABS_MT_POSITION_Y is smaller than this value the touch > no longer qualifies as a thumb. I'd rather this been implemented in userspace (synaptics and/or evdev X drivers). Thanks. -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] input: Introduce INPUT_PROP_MT
On Wed, Nov 20, 2013 at 04:32:20PM -0500, Benjamin Tissoires wrote: > There may be a clash with devices presenting a lot of absolute axis > (like the PS3 Sixaxis) and true multitouch devices. Both those kinds > of devices may present some ABS_MT_* capabilities, so setting this > property ensures user-space knows what to do with the input device. > No, let's not use the same ABS_* values to mean different things and define proper values instead. Thanks. -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] Only process ABS_MT_SLOT where there are slots available
Hi Benjamin, Antonio, On Wed, Nov 20, 2013 at 04:32:19PM -0500, Benjamin Tissoires wrote: > From: Antonio Ospite > > This fixes the case when a non-multitouch device happens to have a HID > code equal to ABS_MT_SLOT, like the Sony Sixaxis has for the left dpad > analog control. > > Updated to latest tree by Benjamin Tissoires. I do not think this is a proper way to address the issue. Generic HID driver should not encroach onto multitouch ABS range and either stop mapping absolute axis or map them properly. Thanks. -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [appleir] BUG: unable to handle kernel NULL pointer dereference
On Tue, Nov 19, 2013 at 10:33 PM, Jiri Kosina wrote: > On Thu, 7 Nov 2013, Benjamin Tissoires wrote: > >> >> [ adding some more CCs ] >> >> >> >> Okay, so apparently we didn't register with input, but only hiddev / >> >> hidraw. >> >> >> >> appleir 0003:05AC:8240.0005: hiddev0,hidraw4: USB HID v1.11 Device [Apple >> >> Computer, Inc. IR Receiver] on usb-:00:1d.3-2/input0 >> >> >> >> Therefore ->input_configured() callback has never been called, and thus we >> >> oops due to appleir->input_dev being NULL when the first raw event is >> >> reported. >> >> >> >> Could you please provide report descriptor of the device? >> >> >> >> The driver apparently relies on it being registered with hid-input, but >> >> for some reason that doesn't happen. >> > >> > Here is the relevant lsusb output that I think contains what you're >> > asking for (I had to unbind usbhid for it to include the descriptor): >> > >> > Bus 005 Device 003: ID 05ac:8240 Apple, Inc. Built-in IR Receiver >> > Device Descriptor: >> > bLength18 >> > bDescriptorType 1 >> > bcdUSB 2.00 >> > ... >> >> Ok, thanks for the report. Could you please test the following patch >> which should solve your problem (hopefully)? > > James, > > any reults from testing Benjamin's patch, please? Sorry for the delays in testing out the patch. I have tried a kernel with the patch applied, and can no longer reproduce the oops. The hid-appleir driver appears to be working correctly, generating key press events in response to the remote, and LIRC functions correctly via hiddev. Thanks for the everyone's help with this. James. -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] Only process ABS_MT_SLOT where there are slots available
> From: Antonio Ospite > > This fixes the case when a non-multitouch device happens to have a HID > code equal to ABS_MT_SLOT, like the Sony Sixaxis has for the left dpad > analog control. > > Updated to latest tree by Benjamin Tissoires. > > Signed-off-by: Benjamin Tissoires Wow, its been a great week for the DualShock - got rumble and LED control, and now I can confirm that the 'left D pad' analogue axis works. Thanks guys, Simon tested-by: Simon Wood -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] Input: Fixed pressure and tool width calculation in BCM5974 multitouch driver
Previously ABS_PRESSURE and ABS_TOOL_WIDTH were calculated by looking at the size of the first touch in the list reported by the trackpad. This is not necessarily the same touch as the one used to perform pointer emulation in the input multitouch library (input-mt). By using the sum of the sizes of all touches as a basis for this calculation we get more coherent values. --- drivers/input/mouse/bcm5974.c | 21 +++-- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index af15410..ecbf359 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c @@ -539,19 +539,10 @@ static void report_finger_data(struct input_dev *input, static void report_synaptics_data(struct input_dev *input, const struct bcm5974_config *cfg, - const struct tp_finger *f, int raw_n) + int p, int w) { - int abs_p = 0, abs_w = 0; - - if (raw_n) { - int p = raw2int(f->touch_major); - int w = raw2int(f->tool_major); - if (p > 0 && raw2int(f->origin)) { - abs_p = clamp_val(256 * p / cfg->p.max, 0, 255); - abs_w = clamp_val(16 * w / cfg->w.max, 0, 15); - } - } - + int abs_p = clamp_val(256 * p / cfg->p.max, 0, 255); + int abs_w = clamp_val(16 * w / cfg->w.max, 0, 15); input_report_abs(input, ABS_PRESSURE, abs_p); input_report_abs(input, ABS_TOOL_WIDTH, abs_w); } @@ -562,7 +553,7 @@ static int report_tp_state(struct bcm5974 *dev, int size) const struct bcm5974_config *c = &dev->cfg; const struct tp_finger *f; struct input_dev *input = dev->input; - int raw_n, i, n = 0; + int raw_n, i, n = 0, p = 0, w = 0; if (size < c->tp_offset || (size - c->tp_offset) % SIZEOF_FINGER != 0) return -EIO; @@ -577,6 +568,8 @@ static int report_tp_state(struct bcm5974 *dev, int size) dev->pos[n].x = raw2int(f[i].abs_x); dev->pos[n].y = c->y.min + c->y.max - raw2int(f[i].abs_y); dev->index[n++] = &f[i]; + p += raw2int(f[i].touch_major); + w += raw2int(f[i].tool_major); } input_mt_assign_slots(input, dev->slots, dev->pos, n); @@ -587,7 +580,7 @@ static int report_tp_state(struct bcm5974 *dev, int size) input_mt_sync_frame(input); - report_synaptics_data(input, c, f, raw_n); + report_synaptics_data(input, c, p, w); /* type 2 reports button events via ibt only */ if (c->tp_type == TYPE2) { -- 1.8.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] Input: Fixed ABS_MT_TOUCH_MINOR scale factor in BCM5974 multitouch driver
On wellspring3 devices ABS_MT_TOUCH_MINOR was sometimes reported bigger than ABS_MT_TOUCH_MAJOR. This is fixed by rescaling ABS_MT_TOUCH_MINOR by a factor of 0.85 instead of 2. Excessive tapping on the trackpad shows this to be the right value. Circular touches should now lead to values for ABS_MT_TOUCH_MAJOR and ABS_MT_TOUCH_MINOR that are similar, with ABS_MT_TOUCH_MINOR never greater than ABS_MT_TOUCH_MAJOR. --- drivers/input/mouse/bcm5974.c | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index a73f961..af15410 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c @@ -235,6 +235,7 @@ struct bcm5974_config { enum tp_type tp_type; /* type of trackpad interface */ int tp_offset; /* offset to trackpad finger data */ int tp_datalen; /* data length of the trackpad interface */ + float touch_minor_f;/* factor for ABS_MT_TOUCH_MINOR */ struct bcm5974_param p; /* finger pressure limits */ struct bcm5974_param w; /* finger width limits */ struct bcm5974_param x; /* horizontal limits */ @@ -275,6 +276,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { 0, 0x84, sizeof(struct bt_data), 0x81, TYPE1, FINGER_TYPE1, FINGER_TYPE1 + SIZEOF_ALL_FINGERS, + 2, /* verify me! */ { SN_PRESSURE, 0, 256 }, { SN_WIDTH, 0, 2048 }, { SN_COORD, -4824, 5342 }, @@ -288,6 +290,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { 0, 0x84, sizeof(struct bt_data), 0x81, TYPE1, FINGER_TYPE1, FINGER_TYPE1 + SIZEOF_ALL_FINGERS, + 2, /* verify me! */ { SN_PRESSURE, 0, 256 }, { SN_WIDTH, 0, 2048 }, { SN_COORD, -4824, 4824 }, @@ -301,6 +304,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { HAS_INTEGRATED_BUTTON, 0x84, sizeof(struct bt_data), 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, + 0.85, { SN_PRESSURE, 0, 300 }, { SN_WIDTH, 0, 2048 }, { SN_COORD, -4460, 5166 }, @@ -314,6 +318,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { HAS_INTEGRATED_BUTTON, 0x84, sizeof(struct bt_data), 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, + 2, /* verify me! */ { SN_PRESSURE, 0, 300 }, { SN_WIDTH, 0, 2048 }, { SN_COORD, -4620, 5140 }, @@ -327,6 +332,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { HAS_INTEGRATED_BUTTON, 0x84, sizeof(struct bt_data), 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, + 2, /* verify me! */ { SN_PRESSURE, 0, 300 }, { SN_WIDTH, 0, 2048 }, { SN_COORD, -4616, 5112 }, @@ -340,6 +346,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { HAS_INTEGRATED_BUTTON, 0x84, sizeof(struct bt_data), 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, + 2, /* verify me! */ { SN_PRESSURE, 0, 300 }, { SN_WIDTH, 0, 2048 }, { SN_COORD, -4415, 5050 }, @@ -353,6 +360,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { HAS_INTEGRATED_BUTTON, 0x84, sizeof(struct bt_data), 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, + 2, /* verify me! */ { SN_PRESSURE, 0, 300 }, { SN_WIDTH, 0, 2048 }, { SN_COORD, -4620, 5140 }, @@ -366,6 +374,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { HAS_INTEGRATED_BUTTON, 0x84, sizeof(struct bt_data), 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, + 2, /* verify me! */ { SN_PRESSURE, 0, 300 }, { SN_WIDTH, 0, 2048 }, { SN_COORD, -4750, 5280 }, @@ -379,6 +388,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { HAS_INTEGRATED_BUTTON, 0x84, sizeof(struct bt_data), 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, + 2, /* verify me! */ { SN_PRESSURE, 0, 300 }, { SN_WIDTH, 0, 2048 }, { SN_COORD, -4620, 5140 }, @@ -392,6 +402,7 @@ static const struct bcm5974_config bcm5974_config_table[] = { HAS_INTEGRATED_BUTTON, 0x84, sizeof(struct bt_data), 0x81, TYPE2, FINGER_TYP
[PATCH 3/3] Input: Added thumb detection in BCM5974 multitouch driver
Trackpads with integrated buttons are hard to use when the driver responds to movements of the thumb that is resting or clicking on the surface of the trackpad. This patch adds rudimentary support to filter out these touch events. The feature can be turned on via sysfs: /sys/class/input/input[0-9]+/thumb_ignore: Enables thumb detection Values: 0/1 /sys/class/input/input[0-9]+/thumb_ratio_on: When the ratio of ABS_MT_TOUCH_MINOR / ABS_MT_TOUCH_MAJOR times 100 is smaller than this value the touch qualifies as a thumb. /sys/class/input/input[0-9]+/thumb_ratio_off: When the ratio of ABS_MT_TOUCH_MINOR / ABS_MT_TOUCH_MAJOR times 100 is bigger than this value the touch no longer qualifies as a thumb. /sys/class/input/input[0-9]+/thumb_y_on: When ABS_MT_POSITION_Y is bigger than this value the touch qualifies as a thumb. /sys/class/input/input[0-9]+/thumb_y_off: When ABS_MT_POSITION_Y is smaller than this value the touch no longer qualifies as a thumb. --- drivers/input/mouse/bcm5974.c | 150 ++ 1 file changed, 150 insertions(+) diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index ecbf359..826cdb4 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c @@ -259,6 +259,12 @@ struct bcm5974 { const struct tp_finger *index[MAX_FINGERS]; /* finger index data */ struct input_mt_pos pos[MAX_FINGERS]; /* position array */ int slots[MAX_FINGERS]; /* slot assignments */ + bool thb_ignore;/* ignore thumb */ + unsigned int thb_r_on; /* ratio to start ignoring thumb */ + unsigned int thb_r_off; /* ratio to stop ignoring thumb */ + int thb_y_on; /* y coord. to start ignoring thumb */ + int thb_y_off; /* y coord. to stop ignoring thumb */ + bool thb_found; /* thumb detected */ }; /* logical signal quality */ @@ -554,6 +560,7 @@ static int report_tp_state(struct bcm5974 *dev, int size) const struct tp_finger *f; struct input_dev *input = dev->input; int raw_n, i, n = 0, p = 0, w = 0; + int thb_r = 0, thb_y = 0; if (size < c->tp_offset || (size - c->tp_offset) % SIZEOF_FINGER != 0) return -EIO; @@ -562,11 +569,30 @@ static int report_tp_state(struct bcm5974 *dev, int size) f = (const struct tp_finger *)(dev->tp_data + c->tp_offset); raw_n = (size - c->tp_offset) / SIZEOF_FINGER; + if (dev->thb_ignore) { + if (dev->thb_found) { + thb_r = dev->thb_r_off; + thb_y = dev->thb_y_off; + } else { + thb_r = dev->thb_r_on; + thb_y = dev->thb_y_on; + } + dev->thb_found = false; + } + for (i = 0; i < raw_n; i++) { if (raw2int(f[i].touch_major) == 0) continue; dev->pos[n].x = raw2int(f[i].abs_x); dev->pos[n].y = c->y.min + c->y.max - raw2int(f[i].abs_y); + + if (dev->thb_ignore && thb_y < dev->pos[n].y && + thb_r * 2 * raw2int(f[i].touch_major) > + 100 * c->touch_minor_f * raw2int(f[i].touch_minor)) { + dev->thb_found = true; + continue; + } + dev->index[n++] = &f[i]; p += raw2int(f[i].touch_major); w += raw2int(f[i].tool_major); @@ -596,6 +622,118 @@ static int report_tp_state(struct bcm5974 *dev, int size) return 0; } +static ssize_t bcm5974_thb_ignore_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct bcm5974 *bcm5974_dev = dev_get_drvdata(dev); + return scnprintf(buf, PAGE_SIZE, "%d\n", bcm5974_dev->thb_ignore); +} + +static ssize_t bcm5974_thb_ignore_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct bcm5974 *bcm5974_dev = dev_get_drvdata(dev); + int val; + + unsigned int error = kstrtoint(buf, 10, &val); + if (error) + return error; + + bcm5974_dev->thb_ignore = !!val; + bcm5974_dev->thb_found = false; + + return count; +} + +static ssize_t bcm5974_thb_r_on_show(struct device *dev, +struct device_attribute *attr, char *buf) +{ + struct bcm5974 *bcm5974_dev = dev_get_drvdata(dev); + return scnprintf(buf, PAGE_SIZE, "%d%%\n", bcm5974_dev->thb_r_on); +} + +static
[PATCH 1/3] Only process ABS_MT_SLOT where there are slots available
From: Antonio Ospite This fixes the case when a non-multitouch device happens to have a HID code equal to ABS_MT_SLOT, like the Sony Sixaxis has for the left dpad analog control. Updated to latest tree by Benjamin Tissoires. Signed-off-by: Benjamin Tissoires --- This patch was sent back in 2011 by Antonio and it was forgotten in the depth of the LKML: http://www.spinics.net/lists/linux-input/msg16881.html Resurecting it now, as the bug is still there. Antonio, could you please tell me if you still add your Signed-of-by line and if I can keep your from? Cheers, Benjamin drivers/input/input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/input/input.c b/drivers/input/input.c index fb513da..1198785 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -213,12 +213,12 @@ static int input_handle_abs_event(struct input_dev *dev, bool is_mt_event; int *pold; - if (code == ABS_MT_SLOT) { + if (code == ABS_MT_SLOT && mt) { /* * "Stage" the event; we'll flush it later, when we * get actual touch data. */ - if (mt && *pval >= 0 && *pval < mt->num_slots) + if (*pval >= 0 && *pval < mt->num_slots) mt->slot = *pval; return INPUT_IGNORE_EVENT; -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] input: Introduce INPUT_PROP_MT
There may be a clash with devices presenting a lot of absolute axis (like the PS3 Sixaxis) and true multitouch devices. Both those kinds of devices may present some ABS_MT_* capabilities, so setting this property ensures user-space knows what to do with the input device. Signed-off-by: Benjamin Tissoires --- Documentation/input/event-codes.txt | 7 +++ Documentation/input/multi-touch-protocol.txt | 5 + drivers/hid/hid-ntrig.c | 1 + drivers/input/input-mt.c | 2 ++ drivers/input/touchscreen/auo-pixcir-ts.c| 1 + drivers/input/touchscreen/bu21013_ts.c | 1 + drivers/input/touchscreen/pixcir_i2c_ts.c| 1 + drivers/input/touchscreen/st1232.c | 1 + include/uapi/linux/input.h | 1 + 9 files changed, 20 insertions(+) diff --git a/Documentation/input/event-codes.txt b/Documentation/input/event-codes.txt index f1ea2c6..b54feb3 100644 --- a/Documentation/input/event-codes.txt +++ b/Documentation/input/event-codes.txt @@ -281,6 +281,13 @@ gestures can normally be extracted from it. If INPUT_PROP_SEMI_MT is not set, the device is assumed to be a true MT device. +INPUT_PROP_MT: +- +There may be a clash with devices presenting a lot of absolute axis (like the +PS3 Sixaxis) and true multitouch devices. Both those kinds of devices may +present some ABS_MT_* capabilities, so setting this property ensures user-space +knows what to do with the input device. + Guidelines: == The guidelines below ensure proper single-touch and multi-finger functionality. diff --git a/Documentation/input/multi-touch-protocol.txt b/Documentation/input/multi-touch-protocol.txt index de139b1..420444f 100644 --- a/Documentation/input/multi-touch-protocol.txt +++ b/Documentation/input/multi-touch-protocol.txt @@ -54,6 +54,11 @@ enumeration of the full set of anonymous contacts currently on the surface. The order in which the packets appear in the event stream is not important. Event filtering and finger tracking is left to user space [3]. +Note that type A device are requested to manually set the property +INPUT_PROP_MT. +Type B devices does not need to set INPUT_PROP_MT manually, as this is done +by calling input_mt_init_slot(). + For type B devices, the kernel driver should associate a slot with each identified contact, and use that slot to propagate changes for the contact. Creation, replacement and destruction of contacts is achieved by modifying diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c index 600f207..6dedc64 100644 --- a/drivers/hid/hid-ntrig.c +++ b/drivers/hid/hid-ntrig.c @@ -879,6 +879,7 @@ static void ntrig_input_configured(struct hid_device *hid, __clear_bit(BTN_TOOL_FINGER, input->keybit); __clear_bit(BTN_0, input->keybit); __set_bit(BTN_TOOL_DOUBLETAP, input->keybit); + __set_bit(INPUT_PROP_MT, input->propbit); /* * The physical touchscreen (single touch) * input has a value for physical, whereas diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index d398f13..f9b70e7 100644 --- a/drivers/input/input-mt.c +++ b/drivers/input/input-mt.c @@ -58,6 +58,8 @@ int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots, input_set_abs_params(dev, ABS_MT_SLOT, 0, num_slots - 1, 0, 0); input_set_abs_params(dev, ABS_MT_TRACKING_ID, 0, TRKID_MAX, 0, 0); + __set_bit(INPUT_PROP_MT, dev->propbit); + if (flags & (INPUT_MT_POINTER | INPUT_MT_DIRECT)) { __set_bit(EV_KEY, dev->evbit); __set_bit(BTN_TOUCH, dev->keybit); diff --git a/drivers/input/touchscreen/auo-pixcir-ts.c b/drivers/input/touchscreen/auo-pixcir-ts.c index d3f9f6b..70836cd 100644 --- a/drivers/input/touchscreen/auo-pixcir-ts.c +++ b/drivers/input/touchscreen/auo-pixcir-ts.c @@ -594,6 +594,7 @@ static int auo_pixcir_probe(struct i2c_client *client, input_set_abs_params(input_dev, ABS_Y, 0, pdata->y_max, 0, 0); /* For multi touch */ + __set_bit(INPUT_PROP_MT, input_dev->propbit); input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, pdata->x_max, 0, 0); input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c index b9b5dda..4ce6220 100644 --- a/drivers/input/touchscreen/bu21013_ts.c +++ b/drivers/input/touchscreen/bu21013_ts.c @@ -573,6 +573,7 @@ static int bu21013_probe(struct i2c_client *client, __set_bit(EV_SYN, in_dev->evbit); __set_bit(EV_KEY, in_dev->evbit); __set_bit(EV_ABS, in_dev->evbit); + __set_bit(INPUT_PROP_MT, in_dev->propbit); input_set_abs_params(in_dev, ABS_MT_POSITION_X, 0, pdata->touch_x_max, 0, 0); diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/inp
[PATCH 3/3] input: reintroduce filtering of mt axis when the device is not multitouch
Some devices (like the PS3 Sixaxis) have a lot of absolute axis which are mapped by hid-input on ABS_MISC and beyond. These axis interfere with the multitouch protocol. The kernel considers those device to be following the multitouch protocol A, and removes the filtering of such events. We can rely on INPUT_PROP_MT to know if the device is multitouch or not, and then rely on mt to know if the device uses the protocol B. Signed-off-by: Benjamin Tissoires --- Documentation/input/multi-touch-protocol.txt | 3 ++- drivers/input/input.c| 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/input/multi-touch-protocol.txt b/Documentation/input/multi-touch-protocol.txt index 420444f..b476845 100644 --- a/Documentation/input/multi-touch-protocol.txt +++ b/Documentation/input/multi-touch-protocol.txt @@ -55,7 +55,8 @@ surface. The order in which the packets appear in the event stream is not important. Event filtering and finger tracking is left to user space [3]. Note that type A device are requested to manually set the property -INPUT_PROP_MT. +INPUT_PROP_MT. If this property is not set, the absolute multitouch axis +will be statefull, so this step is now mandatory. Type B devices does not need to set INPUT_PROP_MT manually, as this is done by calling input_mt_init_slot(). diff --git a/drivers/input/input.c b/drivers/input/input.c index 1198785..239639e 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -224,7 +224,8 @@ static int input_handle_abs_event(struct input_dev *dev, return INPUT_IGNORE_EVENT; } - is_mt_event = input_is_mt_value(code); + is_mt_event = test_bit(INPUT_PROP_MT, dev->propbit) && + input_is_mt_value(code); if (!is_mt_event) { pold = &dev->absinfo[code].value; -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/3] Fixes for multitouch / generic gamepads interaction
Hi guys, I have been reported recently a problem with the Sixaxis controller (http://www.spinics.net/lists/linux-input/msg28098.html). The root of the problem comes from hid-input, which maps unknown axis to ABS_MISC. However, when an event code is already in use, hid-input uses the one after, leading to uses of ABS_MISC + N, where N is the number of unknown axis. We are encountering a problem with the multitouch protocol here because if a device has more than 7 unknown axis (which is the case for the PS3 Sixaxis controller), then the unknown axis get maps to ABS_MT_SLOT and beyond. This infers two problems: - the axis currently mapped on ABS_MT_SLOT is a special case in the kernel, and it is not updated - the axis after ABS_MT_SLOT are not filtered anymore, as the kernel things the device is using a multitouch protocol A. The patch 0001 solves the first problem, whereas the patches 0002 and 0003 fix the second. Bonus point: the userspace is now correctly notified that one of the multitouch protocols is in used, so it does not have to rely on bad designed heuristics. Cheers, Benjamin Antonio Ospite (1): Only process ABS_MT_SLOT where there are slots available Benjamin Tissoires (2): input: Introduce INPUT_PROP_MT input: reintroduce filtering of mt axis when the device is not multitouch Documentation/input/event-codes.txt | 7 +++ Documentation/input/multi-touch-protocol.txt | 6 ++ drivers/hid/hid-ntrig.c | 1 + drivers/input/input-mt.c | 2 ++ drivers/input/input.c| 7 --- drivers/input/touchscreen/auo-pixcir-ts.c| 1 + drivers/input/touchscreen/bu21013_ts.c | 1 + drivers/input/touchscreen/pixcir_i2c_ts.c| 1 + drivers/input/touchscreen/st1232.c | 1 + include/uapi/linux/input.h | 1 + 10 files changed, 25 insertions(+), 3 deletions(-) -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: input question: ambient light sensor button
Hi, On Wed, Nov 20, 2013 at 9:50 AM, Pali Rohár wrote: >> > > I guess we need patch adding >> > > >> > > #define KEY_ALS_TOGGLE 0x230 >> > > >> > > Thanks. >> > >> > So there is no good key for als yet? >> >> No, but if you send me a patch adding it I will gladly apply >> it. >> >> Thanks. > > Ok, here is patch: > > Add key code for ambient light sensor button > > More notebooks have special button for enabling/disabling ambient > light sensor. This patch adding new als code to input.h header file. > > Signed-off-by: Pali Rohár > > diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h > index a372627..1562f10 100644 > --- a/include/uapi/linux/input.h > +++ b/include/uapi/linux/input.h > @@ -719,6 +719,8 @@ struct input_keymap_entry { > #define BTN_DPAD_LEFT 0x222 > #define BTN_DPAD_RIGHT 0x223 > > +#define KEY_ALS_TOGGLE 0x230 Could you just add a comment explaining that ALS is ambiant light sensor? Otherwise, I'm sure someone else will use this event code for an other thing... :) Cheers, Benjamin -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] HID: kye: fix unresponsive keyboard
The manticore keyboard requires that all usb EP are opened at least once to be fully functional. The third EP forwards to the user space some vendor specific information about the keyboard state, but are useless currently for the kernel. Opening them and closing them makes the keyboard responsive again. Reported-and-tested-by: Adam Kulagowski Signed-off-by: Benjamin Tissoires --- Hi Jiri, well, this one was a long shot as I do not have the hardware to actually spot the exact call which enables the keyboard. Adam told me that just opening and closing once all the /dev/hidrawX attached to the keyboard makes the keyboard functional, so, here is the kernel version of this. Anyway, it just works, so I think we can take this one as well. Cheers, Benjamin drivers/hid/hid-kye.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c index 35a4f9c..ecb5ca6 100644 --- a/drivers/hid/hid-kye.c +++ b/drivers/hid/hid-kye.c @@ -421,6 +421,14 @@ static int kye_probe(struct hid_device *hdev, const struct hid_device_id *id) goto enabling_err; } break; + case USB_DEVICE_ID_GENIUS_MANTICORE: + /* +* The manticore keyboard needs to have all the interfaces +* opened at least once to be fully functional. +*/ + if (hid_hw_open(hdev)) + hid_hw_close(hdev); + break; } return 0; -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: input question: ambient light sensor button
On Tuesday 19 November 2013 22:27:36 Dmitry Torokhov wrote: > On Thu, Nov 14, 2013 at 01:02:31PM +0100, Pali Rohár wrote: > > On Wednesday 13 November 2013 17:28:40 Dmitry Torokhov wrote: > > > On Wed, Nov 13, 2013 at 11:47:18AM +0100, Jiri Kosina wrote: > > > > On Sun, 15 Sep 2013, Pali Rohár wrote: > > > > > I do not know where to ask this question, but I think > > > > > that kernel developers could help me. > > > > > > > > > > I have notebook with one special button on keyboard > > > > > which is designed for turning ambient light sensor on > > > > > and off. By default pressing button do nothing (I can > > > > > turn ambient light sensor on/off via sysfs platform > > > > > wmi module). Button press is reported by kernel input > > > > > device AT Translated Set 2 keyboard and reports it as > > > > > button "touchpad off". > > > > > > > > > > Of course "touchpad off" is incorrect and I'd like to > > > > > ask which kernel key or button from > > > > > /usr/include/linux/input.h should be mapped for my > > > > > ambient light sensor button? Is there already some? > > > > > And what is strategy for allocating KEY_* and BTN_* > > > > > numbers? > > > > > > > > This is maintained by Dmitry, so he's the one to answer > > > > this. I am adding him to CC. > > > > > > I guess we need patch adding > > > > > > #define KEY_ALS_TOGGLE 0x230 > > > > > > Thanks. > > > > So there is no good key for als yet? > > No, but if you send me a patch adding it I will gladly apply > it. > > Thanks. Ok, here is patch: Add key code for ambient light sensor button More notebooks have special button for enabling/disabling ambient light sensor. This patch adding new als code to input.h header file. Signed-off-by: Pali Rohár diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h index a372627..1562f10 100644 --- a/include/uapi/linux/input.h +++ b/include/uapi/linux/input.h @@ -719,6 +719,8 @@ struct input_keymap_entry { #define BTN_DPAD_LEFT 0x222 #define BTN_DPAD_RIGHT 0x223 +#define KEY_ALS_TOGGLE 0x230 + #define BTN_TRIGGER_HAPPY 0x2c0 #define BTN_TRIGGER_HAPPY1 0x2c0 #define BTN_TRIGGER_HAPPY2 0x2c1 -- Pali Rohár pali.ro...@gmail.com signature.asc Description: This is a digitally signed message part.
[PATCH 1/2] HID: kye: Add report fixup for Genius Manticore Keyboard
Genius Manticore Keyboard presents the same problem in its report descriptors than Genius Gila Gaming Mouse and Genius Imperator Keyboard. Use the same fixup. Reported-and-tested-by: Adam Kulagowski Signed-off-by: Benjamin Tissoires --- drivers/hid/hid-core.c | 1 + drivers/hid/hid-ids.h | 1 + drivers/hid/hid-kye.c | 5 + 3 files changed, 7 insertions(+) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 972..0a82fdb 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1722,6 +1722,7 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) }, { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, + { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_MANTICORE) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GX_IMPERATOR) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_I405X) }, diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 7655962..c8c7cb1 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -489,6 +489,7 @@ #define USB_VENDOR_ID_KYE 0x0458 #define USB_DEVICE_ID_KYE_ERGO_525V0x0087 #define USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE 0x0138 +#define USB_DEVICE_ID_GENIUS_MANTICORE 0x0153 #define USB_DEVICE_ID_GENIUS_GX_IMPERATOR 0x4018 #define USB_DEVICE_ID_KYE_GPEN_560 0x5003 #define USB_DEVICE_ID_KYE_EASYPEN_I405X0x5010 diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c index 7384512..35a4f9c 100644 --- a/drivers/hid/hid-kye.c +++ b/drivers/hid/hid-kye.c @@ -341,6 +341,9 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, case USB_DEVICE_ID_GENIUS_GX_IMPERATOR: rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 83, "Genius Gx Imperator Keyboard"); + case USB_DEVICE_ID_GENIUS_MANTICORE: + rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104, + "Genius Manticore Keyboard"); break; } return rdesc; @@ -439,6 +442,8 @@ static const struct hid_device_id kye_devices[] = { USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GX_IMPERATOR) }, + { HID_USB_DEVICE(USB_VENDOR_ID_KYE, + USB_DEVICE_ID_GENIUS_MANTICORE) }, { } }; MODULE_DEVICE_TABLE(hid, kye_devices); -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: input question: ambient light sensor button
On Thu, Nov 14, 2013 at 01:02:31PM +0100, Pali Rohár wrote: > On Wednesday 13 November 2013 17:28:40 Dmitry Torokhov wrote: > > On Wed, Nov 13, 2013 at 11:47:18AM +0100, Jiri Kosina wrote: > > > On Sun, 15 Sep 2013, Pali Rohár wrote: > > > > I do not know where to ask this question, but I think that > > > > kernel developers could help me. > > > > > > > > I have notebook with one special button on keyboard which > > > > is designed for turning ambient light sensor on and off. > > > > By default pressing button do nothing (I can turn ambient > > > > light sensor on/off via sysfs platform wmi module). > > > > Button press is reported by kernel input device AT > > > > Translated Set 2 keyboard and reports it as button > > > > "touchpad off". > > > > > > > > Of course "touchpad off" is incorrect and I'd like to ask > > > > which kernel key or button from > > > > /usr/include/linux/input.h should be mapped for my > > > > ambient light sensor button? Is there already some? And > > > > what is strategy for allocating KEY_* and BTN_* numbers? > > > > > > This is maintained by Dmitry, so he's the one to answer > > > this. I am adding him to CC. > > > > I guess we need patch adding > > > > #define KEY_ALS_TOGGLE 0x230 > > > > Thanks. > > So there is no good key for als yet? No, but if you send me a patch adding it I will gladly apply it. Thanks. -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv9][ 1/3] Input: tsc2007: Add device tree support.
Hi Denis, On Fri, Nov 08, 2013 at 02:17:37PM +0100, Denis Carikli wrote: > Cc: Rob Herring > Cc: Pawel Moll > Cc: Mark Rutland > Cc: Stephen Warren > Cc: Ian Campbell > Cc: Grant Likely > Cc: devicet...@vger.kernel.org > Cc: Dmitry Torokhov > Cc: linux-input@vger.kernel.org > Cc: Sascha Hauer > Cc: linux-arm-ker...@lists.infradead.org > Cc: Lothar Waßmann > Cc: Shawn Guo > Cc: Eric Bénard > Signed-off-by: Denis Carikli > --- > ChangeLog v8->v9: > - Added Grant Likely in the Cc list. > - Removed the mention of the pinctrl properties in the documentation. > > ChangeLog v7->v8: > - Fixed the lack of x and z fuzz properties. > - The pendown gpio is better documented. > - Added Shawn Guo in the cc list. Does the device still work if you drop the patch below on top of yours? Thanks! -- Dmitry Input: tsc2007 misc fixes From: Dmitry Torokhov Signed-off-by: Dmitry Torokhov --- arch/arm/mach-imx/mach-cpuimx35.c|2 - arch/arm/mach-imx/mach-cpuimx51sd.c |2 - arch/sh/boards/mach-ecovec24/setup.c |2 - drivers/input/touchscreen/tsc2007.c | 126 +- include/linux/i2c/tsc2007.h |6 +- 5 files changed, 55 insertions(+), 83 deletions(-) diff --git a/arch/arm/mach-imx/mach-cpuimx35.c b/arch/arm/mach-imx/mach-cpuimx35.c index 771362d..65e4c53 100644 --- a/arch/arm/mach-imx/mach-cpuimx35.c +++ b/arch/arm/mach-imx/mach-cpuimx35.c @@ -53,7 +53,7 @@ static const struct imxi2c_platform_data }; #define TSC2007_IRQGPIOIMX_GPIO_NR(3, 2) -static int tsc2007_get_pendown_state(void) +static int tsc2007_get_pendown_state(struct device *dev) { return !gpio_get_value(TSC2007_IRQGPIO); } diff --git a/arch/arm/mach-imx/mach-cpuimx51sd.c b/arch/arm/mach-imx/mach-cpuimx51sd.c index 9b5ddf5..1fba2b8 100644 --- a/arch/arm/mach-imx/mach-cpuimx51sd.c +++ b/arch/arm/mach-imx/mach-cpuimx51sd.c @@ -121,7 +121,7 @@ static const struct imxuart_platform_data uart_pdata __initconst = { .flags = IMXUART_HAVE_RTSCTS, }; -static int tsc2007_get_pendown_state(void) +static int tsc2007_get_pendown_state(struct device *dev) { if (mx51_revision() < IMX_CHIP_REVISION_3_0) return !gpio_get_value(TSC2007_IRQGPIO_REV2); diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index 1fa8be4..23d7e45 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -501,7 +501,7 @@ static struct platform_device keysc_device = { /* TouchScreen */ #define IRQ0 evt2irq(0x600) -static int ts_get_pendown_state(void) +static int ts_get_pendown_state(struct device *dev) { int val = 0; gpio_free(GPIO_FN_INTC_IRQ0); diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c index 3168a99..390148c 100644 --- a/drivers/input/touchscreen/tsc2007.c +++ b/drivers/input/touchscreen/tsc2007.c @@ -88,15 +88,10 @@ struct tsc2007 { wait_queue_head_t wait; boolstopped; - int (*get_pendown_state)(void); + int (*get_pendown_state)(struct device *); void(*clear_penirq)(void); }; -static int tsc2007_get_pendown_state_dt(struct tsc2007 *ts) -{ - return !gpio_get_value(ts->gpio); -} - static inline int tsc2007_xfer(struct tsc2007 *tsc, u8 cmd) { s32 data; @@ -155,14 +150,6 @@ static u32 tsc2007_calculate_pressure(struct tsc2007 *tsc, struct ts_event *tc) return rt; } -static bool tsc2007_is_pen_down_valid(struct tsc2007 *ts) -{ - if (ts->of) - return gpio_is_valid(ts->gpio); - else - return ts->get_pendown_state ? true : false; -} - static bool tsc2007_is_pen_down(struct tsc2007 *ts) { /* @@ -179,13 +166,10 @@ static bool tsc2007_is_pen_down(struct tsc2007 *ts) * to fall back on the pressure reading. */ - if (!tsc2007_is_pen_down_valid(ts)) + if (!ts->get_pendown_state) return true; - if (ts->of) - return tsc2007_get_pendown_state_dt(ts); - else - return ts->get_pendown_state(); + return ts->get_pendown_state(&ts->client->dev); } static irqreturn_t tsc2007_soft_irq(int irq, void *handle) @@ -202,7 +186,7 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle) rt = tsc2007_calculate_pressure(ts, &tc); - if (!rt && !tsc2007_is_pen_down_valid(ts)) { + if (!rt && !ts->get_pendown_state) { /* * If pressure reported is 0 and we don't have * callback to check pendown state, we have to @@ -298,13 +282,25 @@ static void tsc2007_close(struct input_dev *input_dev) } #ifdef CONFIG_OF -static int tsc2007_probe_dt(struct i2c_client *client, struct tsc2007 *ts, - struct device_node *np)
Re: [PATCH] Input: Add new driver for GPIO beeper
On Tue, Nov 12, 2013 at 12:23:46PM -0700, Stephen Warren wrote: > On 11/12/2013 03:59 AM, Mark Rutland wrote: > > On Tue, Nov 12, 2013 at 10:47:57AM +, Alexander Shiyan wrote: > >> Hello. > >> > >>> On Tue, Nov 12, 2013 at 10:07:13AM +, Alexander Shiyan wrote: > This patch adds a new driver for the beeper controlled via GPIO pin. > The driver does not depend on the architecture and is positioned as > a replacement for the specific drivers that are used for this function. > > Signed-off-by: Alexander Shiyan > >> ... > diff --git a/Documentation/devicetree/bindings/input/gpio-beeper.txt > b/Documentation/devicetree/bindings/input/gpio-beeper.txt > >> ... > +Example: > + > +beeper: input@0 { > +compatible = "gpio-beeper"; > +reg = <0>; > +gpios = <&gpio3 23 0>; > +}; > >>> > >>> What are the reg / unit-address for? > >> > >> Just an example from "simple-bus" container. > > > > If they have no meaning, they should go. They're unnecessary and make > > things more confusing. > > > > I'd expect the example to be: > > > > beeper: beeper { > > compatible = "gpio-beeper"; > > gpios - <&gpio3 23 0>; > > }; > > > > And if we have multiple beepers, something like: > > > > beeper0: beeper0 { ... }; > > beeper1: beeper1 { ... }; > > DT node names aren't meant to encode identity though. What we've done in > the past for nodes without a reg where multiple instances were desired > is to put them into simple-bus and add a reg, so: > > beeper0: beeper@0 { reg = <0>; ... }; > beeper1: beeper@1 { reg = <1>; ... }; > > Of course, if there's only one of them, then it could just be "beeper" > with no reg. The binding and example should probably reflect that simple > case. So do we have an agreement on bindings? Otherwise the driver looks good to me. -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch] Input: hp_sdc_rtc - unlock on error in hp_sdc_rtc_read_i8042timer()
On Thu, Nov 14, 2013 at 11:18:08AM +0300, Dan Carpenter wrote: > The transaction task here is hp_sdc_tasklet() and it releases the lock. > The problem is if we aren't able to queue the transaction then we need > to release the lock ourselves. > > Signed-off-by: Dan Carpenter Applied, thank you. > > diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c > index 86b8228..45e0e3e 100644 > --- a/drivers/input/misc/hp_sdc_rtc.c > +++ b/drivers/input/misc/hp_sdc_rtc.c > @@ -180,7 +180,10 @@ static int64_t hp_sdc_rtc_read_i8042timer (uint8_t > loadcmd, int numreg) > if (WARN_ON(down_interruptible(&i8042tregs))) > return -1; > > - if (hp_sdc_enqueue_transaction(&t)) return -1; > + if (hp_sdc_enqueue_transaction(&t)) { > + up(&i8042tregs); > + return -1; > + } > > /* Sleep until results come back. */ > if (WARN_ON(down_interruptible(&i8042tregs))) -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 26/31] Input: tegra-kbc - use reset framework
On Fri, Nov 15, 2013 at 01:54:21PM -0700, Stephen Warren wrote: > From: Stephen Warren > > Tegra's clock driver now provides an implementation of the common > reset API (include/linux/reset.h). Use this instead of the old Tegra- > specific API; that will soon be removed. > > Cc: tred...@nvidia.com > Cc: pdeschrij...@nvidia.com > Cc: linux-te...@vger.kernel.org > Cc: linux-arm-ker...@lists.infradead.org > Cc: Dmitry Torokhov > Cc: Dmitry Torokhov > Cc: linux-input@vger.kernel.org > Signed-off-by: Stephen Warren Acked-by: Dmitry Torokhov > --- > This patch is part of a series with strong internal depdendencies. I'm > looking for an ack so that I can take the entire series through the Tegra > and arm-soc trees. The series will be part of a stable branch that can be > merged into other subsystems if needed to avoid/resolve dependencies. > --- > drivers/input/keyboard/tegra-kbc.c | 13 ++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/drivers/input/keyboard/tegra-kbc.c > b/drivers/input/keyboard/tegra-kbc.c > index 8508879f6faf..9757a58bc897 100644 > --- a/drivers/input/keyboard/tegra-kbc.c > +++ b/drivers/input/keyboard/tegra-kbc.c > @@ -31,7 +31,7 @@ > #include > #include > #include > -#include > +#include > #include > > #define KBC_MAX_KPENT8 > @@ -116,6 +116,7 @@ struct tegra_kbc { > u32 wakeup_key; > struct timer_list timer; > struct clk *clk; > + struct reset_control *rst; > const struct tegra_kbc_hw_support *hw_support; > int max_keys; > int num_rows_and_columns; > @@ -373,9 +374,9 @@ static int tegra_kbc_start(struct tegra_kbc *kbc) > clk_prepare_enable(kbc->clk); > > /* Reset the KBC controller to clear all previous status.*/ > - tegra_periph_reset_assert(kbc->clk); > + reset_control_assert(kbc->rst); > udelay(100); > - tegra_periph_reset_deassert(kbc->clk); > + reset_control_assert(kbc->rst); > udelay(100); > > tegra_kbc_config_pins(kbc); > @@ -663,6 +664,12 @@ static int tegra_kbc_probe(struct platform_device *pdev) > return PTR_ERR(kbc->clk); > } > > + kbc->rst = devm_reset_control_get(&pdev->dev, "kbc"); > + if (IS_ERR(kbc->rst)) { > + dev_err(&pdev->dev, "failed to get keyboard reset\n"); > + return PTR_ERR(kbc->rst); > + } > + > /* >* The time delay between two consecutive reads of the FIFO is >* the sum of the repeat time and the time taken for scanning > -- > 1.8.1.5 > -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv4 0/5] HID: sony: Dualshock3 USB and LED support
On Tue, 19 Nov 2013, Sven Eckelmann wrote: > this is a resent of the patchset "[PATCHv3 0/5] HID: sony: Dualshock3 USB FF > deadlock fix and LED support". It is necessary because the patches 2-5 of that > patchset cannot be applied anymore. This happened because the v2 of the patch > "HID: sony: Send FF commands in non-atomic context" instead of the v3 was > applied in the repository jikos/hid.git. The differences between these two > patch versions can now be found in the new patch "[PATCHv4 1/5] HID: sony: > Rename rumble_* functions/variables to state_*" Queued for 3.14. Thanks, -- Jiri Kosina SUSE Labs -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html