Skip to contentSkip to conversation

mc13892 touchscreen support

PATCH New Marc Reilly 3 participants 7 messages Jan 29, 2012 – Jan 30, 2012

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH 1/4 input: mc13783_ts: rename to mc13xxx_ts

Start moving this driver towards support for both mc13892 and mc13783.

This patch simply renames mc13783 specific identifiers to the generic mc13xxx. A platform_device_id table is also added so that the driver is still created correctly for the mc13783 only.

---
 drivers/input/touchscreen/Kconfig      |    8 +-
 drivers/input/touchscreen/Makefile     |    2 +-
 drivers/input/touchscreen/mc13783_ts.c |  259 -------------------------------
 drivers/input/touchscreen/mc13xxx_ts.c |  267 ++++++++++++++++++++++++++++++++
 4 files changed, 272 insertions(+), 264 deletions(-)
 delete mode 100644 drivers/input/touchscreen/mc13783_ts.c
 create mode 100644 drivers/input/touchscreen/mc13xxx_ts.c
drivers/input/touchscreen/Kconfig +4 -4
index 3488ffe..79831d9 100644
@@ -548,9 +548,9 @@ config TOUCHSCREEN_USB_COMPOSITE
 	  To compile this driver as a module, choose M here: the
 	  module will be called usbtouchscreen.
 
-config TOUCHSCREEN_MC13783
-	tristate "Freescale MC13783 touchscreen input driver"
-	depends on MFD_MC13783
+config TOUCHSCREEN_MC13XXX
+	tristate "Freescale MC13xxx touchscreen input driver"
+	depends on MFD_MC13XXX
 	help
 	  Say Y here if you have an Freescale MC13783 PMIC on your
 	  board and want to use its touchscreen
@@ -558,7 +558,7 @@ config TOUCHSCREEN_MC13783
 	  If unsure, say N.
 
 	  To compile this driver as a module, choose M here: the
-	  module will be called mc13783_ts.
+	  module will be called mc13xxx_ts.
 
 config TOUCHSCREEN_USB_EGALAX
 	default y
drivers/input/touchscreen/Makefile +1 -1
index f957676..919c254 100644
@@ -28,7 +28,7 @@ obj-$(CONFIG_TOUCHSCREEN_INEXIO)	+= inexio.o
 obj-$(CONFIG_TOUCHSCREEN_INTEL_MID)	+= intel-mid-touch.o
 obj-$(CONFIG_TOUCHSCREEN_LPC32XX)	+= lpc32xx_ts.o
 obj-$(CONFIG_TOUCHSCREEN_MAX11801)	+= max11801_ts.o
-obj-$(CONFIG_TOUCHSCREEN_MC13783)	+= mc13783_ts.o
+obj-$(CONFIG_TOUCHSCREEN_MC13XXX)	+= mc13xxx_ts.o
 obj-$(CONFIG_TOUCHSCREEN_MCS5000)	+= mcs5000_ts.o
 obj-$(CONFIG_TOUCHSCREEN_MIGOR)		+= migor_ts.o
 obj-$(CONFIG_TOUCHSCREEN_MTOUCH)	+= mtouch.o
drivers/input/touchscreen/mc13783_ts.c deleted +0 -259

259 lines not on this page · raw message

drivers/input/touchscreen/mc13xxx_ts.c new file +267 -0

267 lines not on this page · raw message

Signature · 1 line
1.7.3.4
#2 lore raw

PATCH 1/4 input: mc13783_ts: rename to mc13xxx_ts

Hi Marc,

Quoted 7 lines · Marc Reilly

Start moving this driver towards support for both mc13892 and mc13783.

This patch simply renames mc13783 specific identifiers to the generic mc13xxx. A platform_device_id table is also added so that the driver is still created correctly for the mc13783 only.

Quoted 8 lines

---

?drivers/input/touchscreen/Kconfig ? ? ?| ? ?8 +-
?drivers/input/touchscreen/Makefile ? ? | ? ?2 +-
?drivers/input/touchscreen/mc13783_ts.c | ?259 -------------------------------
?drivers/input/touchscreen/mc13xxx_ts.c | ?267 ++++++++++++++++++++++++++++++++

?4 files changed, 272 insertions(+), 264 deletions(-) ?delete mode 100644 drivers/input/touchscreen/mc13783_ts.c ?create mode 100644 drivers/input/touchscreen/mc13xxx_ts.c

For the rename, it is better to do:
git mv drivers/input/touchscreen/mc13783_ts.c
drivers/input/touchscreen/mc13xxx_ts.c

git commit -a

and then git format -M -1 , as it will detect the rename.

Regards,

Fabio Estevam

#3 lore raw

PATCH 1/4 input: mc13783_ts: rename to mc13xxx_ts

Hello,

Quoted 17 lines · Fabio Estevam
Quoted 7 lines · Marc Reilly

Start moving this driver towards support for both mc13892 and mc13783.

This patch simply renames mc13783 specific identifiers to the generic mc13xxx. A platform_device_id table is also added so that the driver is still created correctly for the mc13783 only.

Quoted 8 lines

---

?drivers/input/touchscreen/Kconfig ? ? ?| ? ?8 +-
?drivers/input/touchscreen/Makefile ? ? | ? ?2 +-
?drivers/input/touchscreen/mc13783_ts.c | ?259 -------------------------------
?drivers/input/touchscreen/mc13xxx_ts.c | ?267 ++++++++++++++++++++++++++++++++

?4 files changed, 272 insertions(+), 264 deletions(-) ?delete mode 100644 drivers/input/touchscreen/mc13783_ts.c ?create mode 100644 drivers/input/touchscreen/mc13xxx_ts.c

Quoted 7 lines

For the rename, it is better to do:
git mv drivers/input/touchscreen/mc13783_ts.c
drivers/input/touchscreen/mc13xxx_ts.c

git commit -a

and then git format -M -1 , as it will detect the rename.

git format-patch -M will detect the rename independently of how the commit was created. Using git mv doesn't result in adding any special metadata to the commit, it's just mv $old $new; git rm $old; git add $new.

But +1 on using -M (or not renaming the driver).

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#4 lore raw

PATCH 2/4 input: mc13xxx_ts: add support for mc13892

In reply to Marc Reilly

The way the raw touchscreen co-ordinates are sampled have some minor differences for the mc13892 and mc13873. This patch introduces an IC specific handler to convert the raw samples into x, y, pressure readings for the input sub-system.
The mc13892 ignores samples that have too high a contact resistance. Behaviour for the mc13873 is (intended to be) preserved.

Help text for the config item changes to reflect support for both IC types

---
 drivers/input/touchscreen/Kconfig      |    2 +-
 drivers/input/touchscreen/mc13xxx_ts.c |  132 +++++++++++++++++++++++++++-----
 2 files changed, 115 insertions(+), 19 deletions(-)
drivers/input/touchscreen/Kconfig +1 -1
index 79831d9..0c44b37 100644
@@ -552,7 +552,7 @@ config TOUCHSCREEN_MC13XXX
 	tristate "Freescale MC13xxx touchscreen input driver"
 	depends on MFD_MC13XXX
 	help
-	  Say Y here if you have an Freescale MC13783 PMIC on your
+	  Say Y here if you have an Freescale MC13xxx PMIC on your
 	  board and want to use its touchscreen
 
 	  If unsure, say N.
drivers/input/touchscreen/mc13xxx_ts.c +114 -18

209 lines not on this page · raw message

Signature · 1 line
1.7.3.4
#5 lore raw

PATCH 3/4 input: mc13xxx_ts: handle bad adc conversions

In reply to Marc Reilly

Before, if the adc conversion failed for some reason then no more samples would be taken until the after the next pen up/down interrupt.

---
 drivers/input/touchscreen/mc13xxx_ts.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/input/touchscreen/mc13xxx_ts.c +5 -1
index 264b977..8924d66 100644
@@ -199,8 +199,12 @@ static void mc13xxx_ts_work(struct work_struct *work)
 	unsigned int channel = 12;
 
 	if (mc13xxx_adc_do_conversion(priv->mc13xxx,
-				mode, channel, priv->sample) == 0)
+				mode, channel, priv->sample) == 0) {
 		mc13xxx_ts_report_sample(priv);
+	} else {
+		dev_warn(&priv->idev->dev, "bad conversion");
+		queue_delayed_work(priv->workq, &priv->work, HZ / 50);
+	}
 }
 
 static int mc13xxx_ts_open(struct input_dev *dev)
Signature · 1 line
1.7.3.4
#6 lore raw

PATCH 4/4 input: mc13xxx_ts: intersperse delays between ts samples

In reply to Marc Reilly

The mc13xxx ICs have the ability to add a small delay in between each sample taken in a set of TS samples. This allows time for the ts to be biased correctly, and improved accuracy of raw readings.

---
 drivers/input/touchscreen/mc13xxx_ts.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/input/touchscreen/mc13xxx_ts.c +6 -2
index 8924d66..f46e49d 100644
@@ -197,9 +197,13 @@ static void mc13xxx_ts_work(struct work_struct *work)
 		container_of(work, struct mc13xxx_ts_priv, work.work);
 	unsigned int mode = MC13XXX_ADC_MODE_TS;
 	unsigned int channel = 12;
+	u32 adc1_mask = MC13XXX_ADC1_ATOX | MC13XXX_ADC1_ATO_MASK;
+	u32 adc1_val = MC13XXX_ADC1_ATOX | (3 << MC13XXX_ADC1_ATO_SHIFT);
 
-	if (mc13xxx_adc_do_conversion(priv->mc13xxx,
-				mode, channel, priv->sample) == 0) {
+	if (mc13xxx_adc_do_conversion_ex(priv->mc13xxx,
+				mode, channel, priv->sample,
+				0, 0,
+				adc1_mask, adc1_val) == 0) {
 		mc13xxx_ts_report_sample(priv);
 	} else {
 		dev_warn(&priv->idev->dev, "bad conversion");
Signature · 1 line
1.7.3.4