mbox series

[v5,0/2] add support for the Samsung S6SY761 touchscreen

Message ID 20171102060726.3745-1-andi@etezian.org
Headers show
Series add support for the Samsung S6SY761 touchscreen | expand

Message

Andi Shyti Nov. 2, 2017, 6:07 a.m. UTC
Hi,

This patchset adds support for the Samsung s6sy761 touchscreen.

Thanks,
Andi

v4 - v5
 - The previous patch has been split in two parts as requested
   by Rob and added his ack in the dt-binding patch.
 - I tried to fix all the reviews from Dmitry[*]
 - other random cleanups

[*] https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1523520.html

v3 - v4
 - fixed a mismatch on the module name

v2 - v3
 - added security check on an unsigned value which can (unlikely)
   get a "negative" value

 - in the probe function the interrupt is requested after the
   input device registration in order to avoid checking in the
   interrupt handler whether the input device has been registered

 - removed the 'prev_pm_state' variable. Its original meaning
   was to restore the state of the device when coming back from
   sleep mode, but because I removed in patch v2 the low power
   mode, now the device works only in two modes and therefore
   'prev_pm_state' is not required any longer.

v1 - v2
 - remove the low power functionality as it doesn't bring any
   benefit
 - use get_unaligned_be16 instead of the form 'a << 8 | b'
 - use max_t instead of '? :'
 - use managed 'devm_device_add_group()'

Andi Shyti (2):
  dt-bindings: Input: add Samsung S6SY761 touchscreen binding file
  Input: add support for the Samsung S6SY761 touchscreen

 .../bindings/input/touchscreen/samsung,s6sy761.txt |  34 ++
 drivers/input/touchscreen/Kconfig                  |  11 +
 drivers/input/touchscreen/Makefile                 |   1 +
 drivers/input/touchscreen/s6sy761.c                | 548 +++++++++++++++++++++
 4 files changed, 594 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/samsung,s6sy761.txt
 create mode 100644 drivers/input/touchscreen/s6sy761.c

Comments

Dmitry Torokhov Nov. 3, 2017, 11:57 p.m. UTC | #1
Hi Andi,

On Thu, Nov 02, 2017 at 03:07:26PM +0900, Andi Shyti wrote:
> +
> +	err = s6sy761_hw_init(sdata);
> +	if (err)
> +		return err;
> +
> +	sdata->input = devm_input_allocate_device(&client->dev);
> +	if (!sdata->input)
> +		return -ENOMEM;
> +
> +	sdata->input->name = S6SY761_DEV_NAME;
> +	sdata->input->id.bustype = BUS_I2C;
> +	sdata->input->open = s6sy761_input_open;
> +	sdata->input->close = s6sy761_input_close;
> +
> +	/* the range has been previously read in hw_init */
> +	if (sdata->prop.max_x && sdata->prop.max_y) {

You do not need make this a conditional, if sdata->prop.max_x or
sdata->prop.max_y is 0 is it OK.

However, there is a slight problem: you call hw_init() on resume,
potentially updating prop.max_x and prop.max_y and taking them out of
sync if they have been overridden by the DT data and
touchscreen_parse_properties(). I think it would be best if
s6sy761_hw_init() had 2 additional arguments for max_x and max_y and you
passed them to input_set_abs_params() and left sdata->prop to be managed
solely by touchscreen_parse_properties().

Also, is everything in s6sy761_hw_init() needed at resume time?

Thanks.