Skip to contentSkip to conversation

touchscreen: mms114: add support for mms152

PATCH In review Simon Shields 6 participants 7 messages Dec 18, 2017 – Dec 20, 2017 3 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 touchscreen: mms114: add support for mms152

MMS152 has no configuration registers, but the packet format used in interrupts is identical to mms114.

---
 .../bindings/input/touchscreen/mms114.txt          |  8 ++--
 drivers/input/touchscreen/mms114.c                 | 55 +++++++++++++++++++---
 include/linux/platform_data/mms114.h               |  6 +++
 3 files changed, 58 insertions(+), 11 deletions(-)
Documentation/devicetree/bindings/input/touchscreen/mms114.txt +4 -4
index 89d4c56c5671..733411020ced 100644
@@ -1,15 +1,15 @@
-* MELFAS MMS114 touchscreen controller
+* MELFAS MMS114/MMS152 touchscreen controller
 
 Required properties:
-- compatible: must be "melfas,mms114"
+- compatible: "melfas,mms114" for MMS114, or "melfas,mms152" for 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
 
 Optional properties:
-- contact-threshold:
-- moving-threshold:
+- contact-threshold: only with "melfas,mms114"
+- moving-threshold: only with "melfas,mms114"
 - x-invert: invert X axis
 - y-invert: invert Y axis
 
drivers/input/touchscreen/mms114.c +48 -7

104 lines not on this page · raw message

include/linux/platform_data/mms114.h +6 -0
index 5722ebfb2738..58e4c463bf0c 100644
@@ -10,6 +10,11 @@
 #ifndef __LINUX_MMS114_H
 #define __LINUX_MMS114_H
 
+enum mms_type {
+	TYPE_MMS114,
+	TYPE_MMS152,
+};
+
 struct mms114_platform_data {
 	unsigned int x_size;
 	unsigned int y_size;
@@ -17,6 +22,7 @@ struct mms114_platform_data {
 	unsigned int moving_threshold;
 	bool x_invert;
 	bool y_invert;
+	enum mms_type type;
 
 	void (*cfg_pin)(bool);
 };
Signature · 6 lines
2.15.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

Hi Simon,

drivers/input/touchscreen/mms114.c static int mms114_setup_regs(struct mms114_data *data) · line 297

Quoted 5 lines
drivers/input/touchscreen/mms114.c +5 -0
+	if (data->pdata->type == TYPE_MMS152) {
+		/* MMS152 has no configuration or power on registers */
+		return 0;
+	}
+

Please drop the brackets here accorting to the
Documentation/process/coding-style.rst file.

drivers/input/touchscreen/mms114.c static struct mms114_platform_data *mms114_parse_dt(struct device *dev) · line 440

Quoted 10 lines
drivers/input/touchscreen/mms114.c +3 -0
+	pdata->type = (enum mms_type)of_device_get_match_data(dev);
+
 	if (of_property_read_u32(np, "x-size", &pdata->x_size)) {
 		dev_err(dev, "failed to get x-size property\n");
 		return NULL;
@@ -411,6 +437,7 @@ static struct mms114_platform_data *mms114_parse_dt(struct device *dev)
 	if (of_find_property(np, "y-invert", NULL))
 		pdata->y_invert = true;
 
+

Please do not add extra lines

Quoted 21 lines
drivers/input/touchscreen/mms114.c +9 -1
 	return pdata;
 }
 #else
@@ -456,7 +483,15 @@ static int mms114_probe(struct i2c_client *client,
 	data->input_dev = input_dev;
 	data->pdata = pdata;
 
-	input_dev->name = "MELFAS MMS114 Touchscreen";
+	switch (pdata->type) {
+	case TYPE_MMS114:
+		input_dev->name = "MELFAS MMS114 Touchscreen";
+		break;
+	case TYPE_MMS152:
+		input_dev->name = "MELFAS MMS152 Touchscreen";
+		break;
+	}
+
 	input_dev->id.bustype = BUS_I2C;
 	input_dev->dev.parent = &client->dev;
 	input_dev->open = mms114_input_open;

drivers/input/touchscreen/mms114.c MODULE_DEVICE_TABLE(i2c, mms114_id); · line 612

Quoted 10 lines
drivers/input/touchscreen/mms114.c +6 -1
@@ -569,7 +604,13 @@ MODULE_DEVICE_TABLE(i2c, mms114_id);
 
 #ifdef CONFIG_OF
 static const struct of_device_id mms114_dt_match[] = {
-	{ .compatible = "melfas,mms114" },
+	{
+		.compatible = "melfas,mms114",
+		.data = (void *)TYPE_MMS114,
+	}, {
+		.compatible = "melfas,mms152",
+		.data = (void *)TYPE_MMS152,

You are not documenting the new "melfas,mms152" compatible in Documentation/devicetree/bindings/input/touchscreen/mms114.txt

Andi

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Hi Andi,

Thanks for the review.

Quoted 46 lines · Andi Shyti

Hi Simon,

drivers/input/touchscreen/mms114.c static int mms114_setup_regs(struct mms114_data *data) · line 297

Quoted 5 lines
drivers/input/touchscreen/mms114.c +5 -0
+	if (data->pdata->type == TYPE_MMS152) {
+		/* MMS152 has no configuration or power on registers */
+		return 0;
+	}
+

Please drop the brackets here accorting to the
Documentation/process/coding-style.rst file.

drivers/input/touchscreen/mms114.c static struct mms114_platform_data *mms114_parse_dt(struct device *dev) · line 440

Quoted 10 lines
drivers/input/touchscreen/mms114.c +3 -0
+	pdata->type = (enum mms_type)of_device_get_match_data(dev);
+
 	if (of_property_read_u32(np, "x-size", &pdata->x_size)) {
 		dev_err(dev, "failed to get x-size property\n");
 		return NULL;
@@ -411,6 +437,7 @@ static struct mms114_platform_data *mms114_parse_dt(struct device *dev)
 	if (of_find_property(np, "y-invert", NULL))
 		pdata->y_invert = true;
 
+

Please do not add extra lines

Quoted 22 lines
drivers/input/touchscreen/mms114.c +9 -1
 	return pdata;
 }
 #else
@@ -456,7 +483,15 @@ static int mms114_probe(struct i2c_client *client,
 	data->input_dev = input_dev;
 	data->pdata = pdata;
 
-	input_dev->name = "MELFAS MMS114 Touchscreen";
+	switch (pdata->type) {
+	case TYPE_MMS114:
+		input_dev->name = "MELFAS MMS114 Touchscreen";
+		break;
+	case TYPE_MMS152:
+		input_dev->name = "MELFAS MMS152 Touchscreen";
+		break;
+	}
+
 	input_dev->id.bustype = BUS_I2C;
 	input_dev->dev.parent = &client->dev;
 	input_dev->open = mms114_input_open;
@@ -569,7 +604,13 @@ MODULE_DEVICE_TABLE(i2c, mms114_id);
 
Quoted 12 lines

drivers/input/touchscreen/mms114.c MODULE_DEVICE_TABLE(i2c, mms114_id); · line 612

Quoted 9 lines
drivers/input/touchscreen/mms114.c +6 -1
 #ifdef CONFIG_OF
 static const struct of_device_id mms114_dt_match[] = {
-	{ .compatible = "melfas,mms114" },
+	{
+		.compatible = "melfas,mms114",
+		.data = (void *)TYPE_MMS114,
+	}, {
+		.compatible = "melfas,mms152",
+		.data = (void *)TYPE_MMS152,

You are not documenting the new "melfas,mms152" compatible in Documentation/devicetree/bindings/input/touchscreen/mms114.txt

Yes I am - "melfas,mms152" is added to the documentation as part of this patch. Is there something wrong with what I've done there?

Quoted 2 lines

Andi

I will send a v2 addressing the style issues.

Cheers,
Simon
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Hi Simon,

Quoted 13 lines
Quoted 4 lines
Quoted 4 lines

#ifdef CONFIG_OF
static const struct of_device_id mms114_dt_match[] = {

drivers/input/touchscreen/mms114.c +1 -1
-	{ .compatible = "melfas,mms114" },
+	{
Quoted 8 lines

drivers/input/touchscreen/mms114.c MODULE_DEVICE_TABLE(i2c, mms114_id); · line 612

Quoted 5 lines
drivers/input/touchscreen/mms114.c +5 -0
+		.compatible = "melfas,mms114",
+		.data = (void *)TYPE_MMS114,
+	}, {
+		.compatible = "melfas,mms152",
+		.data = (void *)TYPE_MMS152,

You are not documenting the new "melfas,mms152" compatible in Documentation/devicetree/bindings/input/touchscreen/mms114.txt

Quoted 3 lines

Yes I am - "melfas,mms152" is added to the documentation as part of this patch. Is there something wrong with what I've done there?

Oh yes, sorry! I missed it while snipping the code :)

Please ignore this comment, then.

Andi
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw

PATCH v2 1/1 Input: mms114 - add support for mms152

In reply to Simon Shields

MMS152 has no configuration registers, but the packet format used in interrupts is identical to mms114.

---
 .../bindings/input/touchscreen/mms114.txt          |  8 ++--
 drivers/input/touchscreen/mms114.c                 | 53 +++++++++++++++++++---
 include/linux/platform_data/mms114.h               |  6 +++
 3 files changed, 56 insertions(+), 11 deletions(-)
Documentation/devicetree/bindings/input/touchscreen/mms114.txt +4 -4
index 89d4c56c5671..733411020ced 100644
@@ -1,15 +1,15 @@
-* MELFAS MMS114 touchscreen controller
+* MELFAS MMS114/MMS152 touchscreen controller
 
 Required properties:
-- compatible: must be "melfas,mms114"
+- compatible: "melfas,mms114" for MMS114, or "melfas,mms152" for 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
 
 Optional properties:
-- contact-threshold:
-- moving-threshold:
+- contact-threshold: only with "melfas,mms114"
+- moving-threshold: only with "melfas,mms114"
 - x-invert: invert X axis
 - y-invert: invert Y axis
 
drivers/input/touchscreen/mms114.c +46 -7

96 lines not on this page · raw message

include/linux/platform_data/mms114.h +6 -0
index 5722ebfb2738..58e4c463bf0c 100644
@@ -10,6 +10,11 @@
 #ifndef __LINUX_MMS114_H
 #define __LINUX_MMS114_H
 
+enum mms_type {
+	TYPE_MMS114,
+	TYPE_MMS152,
+};
+
 struct mms114_platform_data {
 	unsigned int x_size;
 	unsigned int y_size;
@@ -17,6 +22,7 @@ struct mms114_platform_data {
 	unsigned int moving_threshold;
 	bool x_invert;
 	bool y_invert;
+	enum mms_type type;
 
 	void (*cfg_pin)(bool);
 };
Signature · 1 line
2.15.1
maintainer
#7 lore raw

Re: [PATCH v2] Input: mms114 - add support for mms152

[resending as plain text]

Hi Simon,

Quoted 2 lines · Simon Shields

MMS152 has no configuration registers, but the packet format used in interrupts is identical to mms114.

Since there seems to be renewed interest in mms114 driver, I would like for it to get a facelift and switch to using the standard touchscreen properties rather than the custom ones (we still need to keep compatibility though). Also, we do not seem to have any in-tree users of the mms114_platform_data structure. Can you please see if you can:

- switch the driver to use the generic device properties (device_property_*() API)
- use touchscreen_parse_properties() to parse the standard touchscreen properties
- use touchscreen_report_pos() to report coordinates
- drop mms114_platform_data

Thanks!

Signature · 1 line
Dmitry

A message that is not in the archive (sent off-list or not yet received): 20171218124933.1803-1-simon-WP75azK+jQYgsBAKwltoeQ@public.gmane.org

#9 lore raw
Quoted 15 lines · Simon Shields

MMS152 has no configuration registers, but the packet format used in interrupts is identical to mms114.

---
 .../bindings/input/touchscreen/mms114.txt          |  8 ++--
 drivers/input/touchscreen/mms114.c                 | 55 +++++++++++++++++++---
 include/linux/platform_data/mms114.h               |  6 +++
 3 files changed, 58 insertions(+), 11 deletions(-)
Documentation/devicetree/bindings/input/touchscreen/mms114.txt +0 -0
index 89d4c56c5671..733411020ced 100644

Documentation/devicetree/bindings/input/touchscreen/mms114.txt line 4

Quoted 6 lines
Documentation/devicetree/bindings/input/touchscreen/mms114.txt +2 -2
@@ -1,15 +1,15 @@
-* MELFAS MMS114 touchscreen controller
+* MELFAS MMS114/MMS152 touchscreen controller
 
 Required properties:
-- compatible: must be "melfas,mms114"
+- compatible: "melfas,mms114" for MMS114, or "melfas,mms152" for MMS152

Please reformat to 1 per line.

Documentation/devicetree/bindings/input/touchscreen/mms114.txt line 15

Quoted 13 lines
Documentation/devicetree/bindings/input/touchscreen/mms114.txt +2 -2
 - 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
 
 Optional properties:
-- contact-threshold:
-- moving-threshold:
+- contact-threshold: only with "melfas,mms114"
+- moving-threshold: only with "melfas,mms114"
 - x-invert: invert X axis
 - y-invert: invert Y axis
 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html