linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Syscon support for iProc touchscreen driver
@ 2016-02-17  9:43 Raveendra Padasalagi
  2016-02-17  9:43 ` [PATCH v2 1/3] input: cygnus-update touchscreen dt node document Raveendra Padasalagi
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Raveendra Padasalagi @ 2016-02-17  9:43 UTC (permalink / raw)
  To: Dmitry Torokhov, Russell King, Rob Herring, Arnd Bergmann,
	devicetree, linux-arm-kernel, linux-input
  Cc: Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Jonathan Richardson, Jon Mason, Florian Fainelli, Anup Patel,
	Ray Jui, Scott Branden, linux-kernel, bcm-kernel-feedback-list,
	Raveendra Padasalagi

This patchset is based on v4.5-rc3 tag and its tested on
Broadcom Cygnus SoC.

The patches can be fetched from iproc-tsc-v2 branch of
https://github.com/Broadcom/arm64-linux.git

Changes since v1:
 - Enhanced touchscreen driver to handle syscon based register access if
   "brcm,iproc-touchscreen-syscon" compatible string is provided in dt
 - Normal register access is handled through readl and writel API's if
   "brcm,iproc-touchscreen" compatible string is provided.
 - Updated touchscreen dt node document to reflect the new changes.
 - Updated change logs in each patchset to reflect the new changes.

Raveendra Padasalagi (3):
  input: cygnus-update touchscreen dt node document
  input: syscon support in bcm_iproc_tsc driver
  ARM: dts: use syscon in cygnus touchscreen dt node

 .../input/touchscreen/brcm,iproc-touchscreen.txt   |  57 +++++++-
 arch/arm/boot/dts/bcm-cygnus.dtsi                  |  11 +-
 drivers/input/touchscreen/bcm_iproc_tsc.c          | 152 +++++++++++++++------
 3 files changed, 172 insertions(+), 48 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/3] input: cygnus-update touchscreen dt node document
  2016-02-17  9:43 [PATCH v2 0/3] Syscon support for iProc touchscreen driver Raveendra Padasalagi
@ 2016-02-17  9:43 ` Raveendra Padasalagi
  2016-02-17  9:45   ` Arnd Bergmann
  2016-02-18 14:36   ` Rob Herring
  2016-02-17  9:43 ` [PATCH v2 2/3] input: syscon support in bcm_iproc_tsc driver Raveendra Padasalagi
  2016-02-17  9:43 ` [PATCH v2 3/3] ARM: dts: use syscon in cygnus touchscreen dt node Raveendra Padasalagi
  2 siblings, 2 replies; 12+ messages in thread
From: Raveendra Padasalagi @ 2016-02-17  9:43 UTC (permalink / raw)
  To: Dmitry Torokhov, Russell King, Rob Herring, Arnd Bergmann,
	devicetree, linux-arm-kernel, linux-input
  Cc: Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Jonathan Richardson, Jon Mason, Florian Fainelli, Anup Patel,
	Ray Jui, Scott Branden, linux-kernel, bcm-kernel-feedback-list,
	Raveendra Padasalagi

In Cygnus SOC touch screen controller registers are shared
with ADC and flex timer. Using readl/writel could lead to
race condition. So touch screen driver is enhanced to support

1. If touchscreen register's are not shared. Register access
is handled through readl/writel if "brcm,iproc-touchscreen"
compatible is provided in touchscreen dt node. This will help
for future SOC's if comes with dedicated touchscreen IP register's.

2. If touchscreen register's are shared with other IP's, register
access is handled through syscon framework API's to take care of
mutually exclusive access. This feature can be enabled by selecting
"brcm,iproc-touchscreen-syscon" compatible string in the touchscreen
dt node.

Hence touchscreen dt node bindings document is updated to take care
of above changes in the touchscreen driver.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-by: Scott Branden <scott.branden@broadcom.com>
---
 .../input/touchscreen/brcm,iproc-touchscreen.txt   | 57 +++++++++++++++++++---
 1 file changed, 51 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt b/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
index 34e3382..f530c25 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
@@ -1,12 +1,30 @@
 * Broadcom's IPROC Touchscreen Controller
 
 Required properties:
-- compatible: must be "brcm,iproc-touchscreen"
-- reg: physical base address of the controller and length of memory mapped
-  region.
+- compatible: should be one of
+        "brcm,iproc-touchscreen"
+        "brcm,iproc-touchscreen-syscon"
+- ts_syscon: if "brcm,iproc-touchscreen-syscon" compatible string
+  is selected then "ts_syscon" is mandatory or else not required.
+  The "ts_syscon" is handler of syscon node defining physical base
+  address of the controller and length of memory mapped region.
+  If this property is selected please make sure MFD_SYSCON config
+  is enabled in the defconfig file.
+- reg: if "brcm,iproc-touchscreen" compatible string is selected
+  then "reg" property is mandatory or else not required.
+  The "reg" should be physical base address of the controller and
+  length of memory mapped region.
 - clocks:  The clock provided by the SOC to driver the tsc
 - clock-name:  name for the clock
 - interrupts: The touchscreen controller's interrupt
+- address-cells: Specify the number of u32 entries needed in child nodes.
+                 Should set to 1. This property is mandatory when
+                 "brcm,iproc-touchscreen-syscon" compatible string is selected
+                 or else not required.
+- size-cells: Specify number of u32 entries needed to specify child nodes size
+              in reg property. Should set to 1.This property is mandatory when
+              "brcm,iproc-touchscreen-syscon" compatible string is selected or
+              else not required.
 
 Optional properties:
 - scanning_period: Time between scans. Each step is 1024 us.  Valid 1-256.
@@ -53,13 +71,40 @@ Optional properties:
 - touchscreen-inverted-x: X axis is inverted (boolean)
 - touchscreen-inverted-y: Y axis is inverted (boolean)
 
-Example:
+Example 1: An example of touchscreen node with "brcm,iproc-touchscreen-syscon"
+           compatible string.
+
+	ts_adc_syscon: ts_adc_syscon@0x180a6000 {
+		compatible = "syscon";
+		reg = <0x180a6000 0xc30>;
+	};
 
 	touchscreen: tsc@0x180A6000 {
-		compatible = "brcm,iproc-touchscreen";
+		compatible = "brcm,iproc-touchscreen-syscon";
 		#address-cells = <1>;
 		#size-cells = <1>;
-		reg = <0x180A6000 0x40>;
+		ts_syscon = <&ts_adc_syscon>;
+		clocks = <&adc_clk>;
+		clock-names = "tsc_clk";
+		interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>;
+
+		scanning_period = <5>;
+		debounce_timeout = <40>;
+		settling_timeout = <7>;
+		touch_timeout = <10>;
+		average_data = <5>;
+		fifo_threshold = <1>;
+		/* Touchscreen is rotated 180 degrees. */
+		touchscreen-inverted-x;
+		touchscreen-inverted-y;
+	};
+
+Example 2: An example of touchscreen node with "brcm,iproc-touchscreen"
+          compatible string.
+
+	touchscreen: tsc@0x180A6000 {
+		compatible = "brcm,iproc-touchscreen";
+		reg = <0x180a6000 0x40>;
 		clocks = <&adc_clk>;
 		clock-names = "tsc_clk";
 		interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/3] input: syscon support in bcm_iproc_tsc driver
  2016-02-17  9:43 [PATCH v2 0/3] Syscon support for iProc touchscreen driver Raveendra Padasalagi
  2016-02-17  9:43 ` [PATCH v2 1/3] input: cygnus-update touchscreen dt node document Raveendra Padasalagi
@ 2016-02-17  9:43 ` Raveendra Padasalagi
  2016-02-17  9:43 ` [PATCH v2 3/3] ARM: dts: use syscon in cygnus touchscreen dt node Raveendra Padasalagi
  2 siblings, 0 replies; 12+ messages in thread
From: Raveendra Padasalagi @ 2016-02-17  9:43 UTC (permalink / raw)
  To: Dmitry Torokhov, Russell King, Rob Herring, Arnd Bergmann,
	devicetree, linux-arm-kernel, linux-input
  Cc: Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Jonathan Richardson, Jon Mason, Florian Fainelli, Anup Patel,
	Ray Jui, Scott Branden, linux-kernel, bcm-kernel-feedback-list,
	Raveendra Padasalagi

In Cygnus SOC touch screen controller registers are shared
with ADC and flex timer. Using readl/writel could lead to
race condition. So touch screen driver is enhanced to support

1. If touchscreen register's are not shared. Register access
is handled through readl/writel if "brcm,iproc-touchscreen"
compatible is provided in touchscreen dt node. This will help
for future SOC's if comes with dedicated touchscreen IP register's.

2. If touchscreen register's are shared with other IP's, register
access is handled through syscon framework API's to take care of
mutually exclusive access. This feature can be enabled by selecting
"brcm,iproc-touchscreen-syscon" compatible string in the touchscreen
dt node.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-by: Scott Branden <scott.branden@broadcom.com>
---
 drivers/input/touchscreen/bcm_iproc_tsc.c | 152 ++++++++++++++++++++++--------
 1 file changed, 112 insertions(+), 40 deletions(-)

diff --git a/drivers/input/touchscreen/bcm_iproc_tsc.c b/drivers/input/touchscreen/bcm_iproc_tsc.c
index ae460a5c..3ef80c6 100644
--- a/drivers/input/touchscreen/bcm_iproc_tsc.c
+++ b/drivers/input/touchscreen/bcm_iproc_tsc.c
@@ -23,6 +23,8 @@
 #include <linux/io.h>
 #include <linux/clk.h>
 #include <linux/serio.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
 
 #define IPROC_TS_NAME "iproc-ts"
 
@@ -88,7 +90,7 @@
 #define TS_WIRE_MODE_BIT        BIT(1)
 
 #define dbg_reg(dev, priv, reg) \
-	dev_dbg(dev, "%20s= 0x%08x\n", #reg, readl((priv)->regs + reg))
+	dev_dbg(dev, "%20s= 0x%08x\n", #reg, iproc_reg_read(priv, reg))
 
 struct tsc_param {
 	/* Each step is 1024 us.  Valid 1-256 */
@@ -142,12 +144,18 @@ struct iproc_ts_priv {
 	struct input_dev *idev;
 
 	void __iomem *regs;
+	struct regmap *regmap;
 	struct clk *tsc_clk;
 
 	int  pen_status;
 	struct tsc_param cfg_params;
 };
 
+enum iproc_ts_reg_type {
+	IPROC_TS_REG,
+	IPROC_TS_SYSCON,
+};
+
 /*
  * Set default values the same as hardware reset values
  * except for fifo_threshold with is set to 1.
@@ -163,6 +171,41 @@ static const struct tsc_param iproc_default_config = {
 	.max_y            = Y_MAX,
 };
 
+static int iproc_reg_update_bits(struct iproc_ts_priv *priv, u32 reg,
+			   u32 mask, u32 val)
+{
+	int ret = 0;
+	u32 tmp, orig;
+
+	if (priv->regs) {
+		orig = readl(priv->regs);
+		tmp = orig & ~mask;
+		tmp |= val & mask;
+		writel(tmp, priv->regs + reg);
+	} else
+		ret = regmap_update_bits(priv->regmap, reg, mask, val);
+	return ret;
+}
+
+static void iproc_reg_write(struct iproc_ts_priv *priv, u32 reg, u32 val)
+{
+	if (priv->regs)
+		writel(val, priv->regs + reg);
+	else
+		regmap_write(priv->regmap, reg, val);
+}
+
+static u32 iproc_reg_read(struct iproc_ts_priv *priv, u32 reg)
+{
+	u32 val;
+
+	if (priv->regs)
+		val = readl(priv->regs + reg);
+	else
+		regmap_read(priv->regmap, reg, &val);
+	return val;
+}
+
 static void ts_reg_dump(struct iproc_ts_priv *priv)
 {
 	struct device *dev = &priv->pdev->dev;
@@ -196,22 +239,22 @@ static irqreturn_t iproc_touchscreen_interrupt(int irq, void *data)
 	int i;
 	bool needs_sync = false;
 
-	intr_status = readl(priv->regs + INTERRUPT_STATUS);
-	intr_status &= TS_PEN_INTR_MASK | TS_FIFO_INTR_MASK;
+	intr_status = iproc_reg_read(priv, INTERRUPT_STATUS);
+	intr_status &= (TS_PEN_INTR_MASK | TS_FIFO_INTR_MASK);
 	if (intr_status == 0)
 		return IRQ_NONE;
 
 	/* Clear all interrupt status bits, write-1-clear */
-	writel(intr_status, priv->regs + INTERRUPT_STATUS);
-
+	iproc_reg_write(priv, INTERRUPT_STATUS, intr_status);
 	/* Pen up/down */
 	if (intr_status & TS_PEN_INTR_MASK) {
-		if (readl(priv->regs + CONTROLLER_STATUS) & TS_PEN_DOWN)
+		priv->pen_status = iproc_reg_read(priv, CONTROLLER_STATUS);
+		if (priv->pen_status & TS_PEN_DOWN)
 			priv->pen_status = PEN_DOWN_STATUS;
 		else
 			priv->pen_status = PEN_UP_STATUS;
 
-		input_report_key(priv->idev, BTN_TOUCH, priv->pen_status);
+		input_report_key(priv->idev, BTN_TOUCH,	priv->pen_status);
 		needs_sync = true;
 
 		dev_dbg(&priv->pdev->dev,
@@ -221,7 +264,7 @@ static irqreturn_t iproc_touchscreen_interrupt(int irq, void *data)
 	/* coordinates in FIFO exceed the theshold */
 	if (intr_status & TS_FIFO_INTR_MASK) {
 		for (i = 0; i < priv->cfg_params.fifo_threshold; i++) {
-			raw_coordinate = readl(priv->regs + FIFO_DATA);
+			raw_coordinate = iproc_reg_read(priv, FIFO_DATA);
 			if (raw_coordinate == INVALID_COORD)
 				continue;
 
@@ -239,7 +282,7 @@ static irqreturn_t iproc_touchscreen_interrupt(int irq, void *data)
 			x = (x >> 4) & 0x0FFF;
 			y = (y >> 4) & 0x0FFF;
 
-			/* adjust x y according to lcd tsc mount angle */
+			/* Adjust x y according to LCD tsc mount angle. */
 			if (priv->cfg_params.invert_x)
 				x = priv->cfg_params.max_x - x;
 
@@ -262,9 +305,10 @@ static irqreturn_t iproc_touchscreen_interrupt(int irq, void *data)
 
 static int iproc_ts_start(struct input_dev *idev)
 {
-	struct iproc_ts_priv *priv = input_get_drvdata(idev);
 	u32 val;
+	u32 mask;
 	int error;
+	struct iproc_ts_priv *priv = input_get_drvdata(idev);
 
 	/* Enable clock */
 	error = clk_prepare_enable(priv->tsc_clk);
@@ -279,9 +323,10 @@ static int iproc_ts_start(struct input_dev *idev)
 	 *  FIFO reaches the int_th value, and pen event(up/down)
 	 */
 	val = TS_PEN_INTR_MASK | TS_FIFO_INTR_MASK;
-	writel(val, priv->regs + INTERRUPT_MASK);
+	iproc_reg_update_bits(priv, INTERRUPT_MASK, val, val);
 
-	writel(priv->cfg_params.fifo_threshold, priv->regs + INTERRUPT_THRES);
+	val = priv->cfg_params.fifo_threshold;
+	iproc_reg_write(priv, INTERRUPT_THRES, val);
 
 	/* Initialize control reg1 */
 	val = 0;
@@ -289,26 +334,23 @@ static int iproc_ts_start(struct input_dev *idev)
 	val |= priv->cfg_params.debounce_timeout << DEBOUNCE_TIMEOUT_SHIFT;
 	val |= priv->cfg_params.settling_timeout << SETTLING_TIMEOUT_SHIFT;
 	val |= priv->cfg_params.touch_timeout << TOUCH_TIMEOUT_SHIFT;
-	writel(val, priv->regs + REGCTL1);
+	iproc_reg_write(priv, REGCTL1, val);
 
 	/* Try to clear all interrupt status */
-	val = readl(priv->regs + INTERRUPT_STATUS);
-	val |= TS_FIFO_INTR_MASK | TS_PEN_INTR_MASK;
-	writel(val, priv->regs + INTERRUPT_STATUS);
+	val = TS_FIFO_INTR_MASK | TS_PEN_INTR_MASK;
+	iproc_reg_update_bits(priv, INTERRUPT_STATUS, val, val);
 
 	/* Initialize control reg2 */
-	val = readl(priv->regs + REGCTL2);
-	val |= TS_CONTROLLER_EN_BIT | TS_WIRE_MODE_BIT;
-
-	val &= ~TS_CONTROLLER_AVGDATA_MASK;
+	val = TS_CONTROLLER_EN_BIT | TS_WIRE_MODE_BIT;
 	val |= priv->cfg_params.average_data << TS_CONTROLLER_AVGDATA_SHIFT;
 
-	val &= ~(TS_CONTROLLER_PWR_LDO |	/* PWR up LDO */
+	mask = (TS_CONTROLLER_AVGDATA_MASK);
+	mask |= (TS_CONTROLLER_PWR_LDO |	/* PWR up LDO */
 		   TS_CONTROLLER_PWR_ADC |	/* PWR up ADC */
 		   TS_CONTROLLER_PWR_BGP |	/* PWR up BGP */
 		   TS_CONTROLLER_PWR_TS);	/* PWR up TS */
-
-	writel(val, priv->regs + REGCTL2);
+	mask |= val;
+	iproc_reg_update_bits(priv, REGCTL2, mask, val);
 
 	ts_reg_dump(priv);
 
@@ -320,12 +362,17 @@ static void iproc_ts_stop(struct input_dev *dev)
 	u32 val;
 	struct iproc_ts_priv *priv = input_get_drvdata(dev);
 
-	writel(0, priv->regs + INTERRUPT_MASK); /* Disable all interrupts */
+	/*
+	 * Disable FIFO int_th and pen event(up/down)Interrupts only
+	 * as the interrupt mask register is shared between ADC, TS and
+	 * flextimer.
+	 */
+	val = TS_PEN_INTR_MASK | TS_FIFO_INTR_MASK;
+	iproc_reg_update_bits(priv, INTERRUPT_MASK, val, 0);
 
 	/* Only power down touch screen controller */
-	val = readl(priv->regs + REGCTL2);
-	val |= TS_CONTROLLER_PWR_TS;
-	writel(val, priv->regs + REGCTL2);
+	val = TS_CONTROLLER_PWR_TS;
+	iproc_reg_update_bits(priv, REGCTL2, val, val);
 
 	clk_disable(priv->tsc_clk);
 }
@@ -410,25 +457,56 @@ static int iproc_get_tsc_config(struct device *dev, struct iproc_ts_priv *priv)
 	return 0;
 }
 
+static const struct of_device_id iproc_ts_of_match[] = {
+	{.compatible = "brcm,iproc-touchscreen",
+	 .data = (void *) IPROC_TS_REG },
+	{.compatible = "brcm,iproc-touchscreen-syscon",
+	 .data = (void *) IPROC_TS_SYSCON },
+	{},
+};
+MODULE_DEVICE_TABLE(of, iproc_ts_of_match);
+
 static int iproc_ts_probe(struct platform_device *pdev)
 {
 	struct iproc_ts_priv *priv;
 	struct input_dev *idev;
 	struct resource *res;
+	const struct of_device_id *of_id;
 	int irq;
 	int error;
+	enum iproc_ts_reg_type reg_access;
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
-	/* touchscreen controller memory mapped regs */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	priv->regs = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(priv->regs)) {
-		error = PTR_ERR(priv->regs);
-		dev_err(&pdev->dev, "unable to map I/O memory: %d\n", error);
-		return error;
+	of_id = of_match_node(iproc_ts_of_match, pdev->dev.of_node);
+	if (of_id)
+		reg_access = (enum iproc_ts_reg_type)of_id->data;
+	else
+		return -ENODEV;
+
+	if (reg_access == IPROC_TS_SYSCON) {
+		/* touchscreen controller memory mapped regs via syscon */
+		priv->regmap = syscon_regmap_lookup_by_phandle(
+						pdev->dev.of_node,
+						"ts_syscon");
+		if (IS_ERR(priv->regmap)) {
+			error = PTR_ERR(priv->regs);
+			dev_err(&pdev->dev, "unable to map I/O memory:%d\n",
+				error);
+			return error;
+		}
+	} else {
+		/* touchscreen controller memory mapped regs */
+		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+		priv->regs = devm_ioremap_resource(&pdev->dev, res);
+		if (IS_ERR(priv->regs)) {
+			error = PTR_ERR(priv->regs);
+			dev_err(&pdev->dev, "unable to map I/O memory:%d\n",
+				error);
+			return error;
+		}
 	}
 
 	priv->tsc_clk = devm_clk_get(&pdev->dev, "tsc_clk");
@@ -501,12 +579,6 @@ static int iproc_ts_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct of_device_id iproc_ts_of_match[] = {
-	{.compatible = "brcm,iproc-touchscreen", },
-	{ },
-};
-MODULE_DEVICE_TABLE(of, iproc_ts_of_match);
-
 static struct platform_driver iproc_ts_driver = {
 	.probe = iproc_ts_probe,
 	.driver = {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 3/3] ARM: dts: use syscon in cygnus touchscreen dt node
  2016-02-17  9:43 [PATCH v2 0/3] Syscon support for iProc touchscreen driver Raveendra Padasalagi
  2016-02-17  9:43 ` [PATCH v2 1/3] input: cygnus-update touchscreen dt node document Raveendra Padasalagi
  2016-02-17  9:43 ` [PATCH v2 2/3] input: syscon support in bcm_iproc_tsc driver Raveendra Padasalagi
@ 2016-02-17  9:43 ` Raveendra Padasalagi
  2 siblings, 0 replies; 12+ messages in thread
From: Raveendra Padasalagi @ 2016-02-17  9:43 UTC (permalink / raw)
  To: Dmitry Torokhov, Russell King, Rob Herring, Arnd Bergmann,
	devicetree, linux-arm-kernel, linux-input
  Cc: Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Jonathan Richardson, Jon Mason, Florian Fainelli, Anup Patel,
	Ray Jui, Scott Branden, linux-kernel, bcm-kernel-feedback-list,
	Raveendra Padasalagi

In Cygnus SOC touch screen controller registers are shared
with ADC and flex timer. Using readl/writel could lead to
race condition. So in such case register access is handled
through syscon framework API's in the touch screen driver.
This feature is enabled if "brcm,iproc-touchscreen-syscon"
compatible string is selected in touchscreen dt node.

So this patch enables syscon support in touchscreen driver
by adding necessary properties in touchscreen dt node.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-by: Scott Branden <scott.branden@broadcom.com>
---
 arch/arm/boot/dts/bcm-cygnus.dtsi | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/bcm-cygnus.dtsi b/arch/arm/boot/dts/bcm-cygnus.dtsi
index 3878793..79678c1 100644
--- a/arch/arm/boot/dts/bcm-cygnus.dtsi
+++ b/arch/arm/boot/dts/bcm-cygnus.dtsi
@@ -351,9 +351,16 @@
 					<&pinctrl 142 10 1>;
 		};
 
+		ts_adc_syscon: ts_adc_syscon@0x180a6000 {
+			compatible = "syscon";
+			reg = <0x180a6000 0xc30>;
+		};
+
 		touchscreen: tsc@180a6000 {
-			compatible = "brcm,iproc-touchscreen";
-			reg = <0x180a6000 0x40>;
+			compatible = "brcm,iproc-touchscreen-syscon";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ts_syscon = <&ts_adc_syscon>;
 			clocks = <&asiu_clks BCM_CYGNUS_ASIU_ADC_CLK>;
 			clock-names = "tsc_clk";
 			interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/3] input: cygnus-update touchscreen dt node document
  2016-02-17  9:43 ` [PATCH v2 1/3] input: cygnus-update touchscreen dt node document Raveendra Padasalagi
@ 2016-02-17  9:45   ` Arnd Bergmann
  2016-02-17  9:53     ` Raveendra Padasalagi
  2016-02-18 14:36   ` Rob Herring
  1 sibling, 1 reply; 12+ messages in thread
From: Arnd Bergmann @ 2016-02-17  9:45 UTC (permalink / raw)
  To: Raveendra Padasalagi
  Cc: Dmitry Torokhov, Russell King, Rob Herring, devicetree,
	linux-arm-kernel, linux-input, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Jonathan Richardson, Jon Mason,
	Florian Fainelli, Anup Patel, Ray Jui, Scott Branden,
	linux-kernel, bcm-kernel-feedback-list

On Wednesday 17 February 2016 15:13:44 Raveendra Padasalagi wrote:
> +
> +       ts_adc_syscon: ts_adc_syscon@0x180a6000 {
> +               compatible = "syscon";
> +               reg = <0x180a6000 0xc30>;
> +       };
> 

This should have a more specific compatible string in addition to the
generic "syscon" one.

	Arnd

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH v2 1/3] input: cygnus-update touchscreen dt node document
  2016-02-17  9:45   ` Arnd Bergmann
@ 2016-02-17  9:53     ` Raveendra Padasalagi
  0 siblings, 0 replies; 12+ messages in thread
From: Raveendra Padasalagi @ 2016-02-17  9:53 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Dmitry Torokhov, Russell King, Rob Herring, devicetree,
	linux-arm-kernel, linux-input, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Jonathan Richardson, Jon Mason,
	Florian Fainelli, Anup Patel, Ray Jui, Scott Branden,
	linux-kernel, bcm-kernel-feedback-list

> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd@arndb.de]
> Sent: 17 February 2016 15:16
> To: Raveendra Padasalagi
> Cc: Dmitry Torokhov; Russell King; Rob Herring;
devicetree@vger.kernel.org;
> linux-arm-kernel@lists.infradead.org; linux-input@vger.kernel.org; Pawel
Moll;
> Mark Rutland; Ian Campbell; Kumar Gala; Jonathan Richardson; Jon Mason;
> Florian Fainelli; Anup Patel; Ray Jui; Scott Branden; linux-
> kernel@vger.kernel.org; bcm-kernel-feedback-list@broadcom.com
> Subject: Re: [PATCH v2 1/3] input: cygnus-update touchscreen dt node
> document
>
> On Wednesday 17 February 2016 15:13:44 Raveendra Padasalagi wrote:
> > +
> > +       ts_adc_syscon: ts_adc_syscon@0x180a6000 {
> > +               compatible = "syscon";
> > +               reg = <0x180a6000 0xc30>;
> > +       };
> >
>
> This should have a more specific compatible string in addition to the
generic
> "syscon" one.

Ok, Thanks Arnd. I will address this in the next patch.

> 	Arnd

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/3] input: cygnus-update touchscreen dt node document
  2016-02-17  9:43 ` [PATCH v2 1/3] input: cygnus-update touchscreen dt node document Raveendra Padasalagi
  2016-02-17  9:45   ` Arnd Bergmann
@ 2016-02-18 14:36   ` Rob Herring
  2016-02-19  6:13     ` Raveendra Padasalagi
  1 sibling, 1 reply; 12+ messages in thread
From: Rob Herring @ 2016-02-18 14:36 UTC (permalink / raw)
  To: Raveendra Padasalagi
  Cc: Dmitry Torokhov, Russell King, Arnd Bergmann, devicetree,
	linux-arm-kernel, linux-input, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Jonathan Richardson, Jon Mason,
	Florian Fainelli, Anup Patel, Ray Jui, Scott Branden,
	linux-kernel, bcm-kernel-feedback-list

On Wed, Feb 17, 2016 at 03:13:44PM +0530, Raveendra Padasalagi wrote:
> In Cygnus SOC touch screen controller registers are shared
> with ADC and flex timer. Using readl/writel could lead to
> race condition. So touch screen driver is enhanced to support
> 
> 1. If touchscreen register's are not shared. Register access
> is handled through readl/writel if "brcm,iproc-touchscreen"
> compatible is provided in touchscreen dt node. This will help
> for future SOC's if comes with dedicated touchscreen IP register's.
> 
> 2. If touchscreen register's are shared with other IP's, register
> access is handled through syscon framework API's to take care of
> mutually exclusive access. This feature can be enabled by selecting
> "brcm,iproc-touchscreen-syscon" compatible string in the touchscreen
> dt node.
> 
> Hence touchscreen dt node bindings document is updated to take care
> of above changes in the touchscreen driver.
> 
> Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
> Reviewed-by: Ray Jui <ray.jui@broadcom.com>
> Reviewed-by: Scott Branden <scott.branden@broadcom.com>
> ---
>  .../input/touchscreen/brcm,iproc-touchscreen.txt   | 57 +++++++++++++++++++---
>  1 file changed, 51 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt b/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
> index 34e3382..f530c25 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
> +++ b/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
> @@ -1,12 +1,30 @@
>  * Broadcom's IPROC Touchscreen Controller
>  
>  Required properties:
> -- compatible: must be "brcm,iproc-touchscreen"
> -- reg: physical base address of the controller and length of memory mapped
> -  region.
> +- compatible: should be one of
> +        "brcm,iproc-touchscreen"
> +        "brcm,iproc-touchscreen-syscon"

More specific and this is not how you do syscon. Either the block is or 
isn't. You can't have it both ways.

> +- ts_syscon: if "brcm,iproc-touchscreen-syscon" compatible string
> +  is selected then "ts_syscon" is mandatory or else not required.
> +  The "ts_syscon" is handler of syscon node defining physical base
> +  address of the controller and length of memory mapped region.
> +  If this property is selected please make sure MFD_SYSCON config
> +  is enabled in the defconfig file.
> +- reg: if "brcm,iproc-touchscreen" compatible string is selected
> +  then "reg" property is mandatory or else not required.
> +  The "reg" should be physical base address of the controller and
> +  length of memory mapped region.

I thought every chip to date is a syscon. Add reg support when you 
actually need it.

>  - clocks:  The clock provided by the SOC to driver the tsc
>  - clock-name:  name for the clock
>  - interrupts: The touchscreen controller's interrupt
> +- address-cells: Specify the number of u32 entries needed in child nodes.
> +                 Should set to 1. This property is mandatory when
> +                 "brcm,iproc-touchscreen-syscon" compatible string is selected
> +                 or else not required.
> +- size-cells: Specify number of u32 entries needed to specify child nodes size
> +              in reg property. Should set to 1.This property is mandatory when
> +              "brcm,iproc-touchscreen-syscon" compatible string is selected or
> +              else not required.
>  
>  Optional properties:
>  - scanning_period: Time between scans. Each step is 1024 us.  Valid 1-256.
> @@ -53,13 +71,40 @@ Optional properties:
>  - touchscreen-inverted-x: X axis is inverted (boolean)
>  - touchscreen-inverted-y: Y axis is inverted (boolean)
>  
> -Example:
> +Example 1: An example of touchscreen node with "brcm,iproc-touchscreen-syscon"
> +           compatible string.
> +
> +	ts_adc_syscon: ts_adc_syscon@0x180a6000 {
> +		compatible = "syscon";
> +		reg = <0x180a6000 0xc30>;
> +	};
>  
>  	touchscreen: tsc@0x180A6000 {

Drop the '0x' and the node name should be touchscreen, not tsc.

> -		compatible = "brcm,iproc-touchscreen";
> +		compatible = "brcm,iproc-touchscreen-syscon";
>  		#address-cells = <1>;
>  		#size-cells = <1>;
> -		reg = <0x180A6000 0x40>;
> +		ts_syscon = <&ts_adc_syscon>;
> +		clocks = <&adc_clk>;
> +		clock-names = "tsc_clk";
> +		interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>;
> +

> +		scanning_period = <5>;
> +		debounce_timeout = <40>;
> +		settling_timeout = <7>;
> +		touch_timeout = <10>;
> +		average_data = <5>;
> +		fifo_threshold = <1>;

New properties?

> +		/* Touchscreen is rotated 180 degrees. */
> +		touchscreen-inverted-x;
> +		touchscreen-inverted-y;
> +	};
> +
> +Example 2: An example of touchscreen node with "brcm,iproc-touchscreen"
> +          compatible string.
> +
> +	touchscreen: tsc@0x180A6000 {
> +		compatible = "brcm,iproc-touchscreen";
> +		reg = <0x180a6000 0x40>;
>  		clocks = <&adc_clk>;
>  		clock-names = "tsc_clk";
>  		interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>;
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/3] input: cygnus-update touchscreen dt node document
  2016-02-18 14:36   ` Rob Herring
@ 2016-02-19  6:13     ` Raveendra Padasalagi
  2016-02-22 19:36       ` Dmitry Torokhov
  0 siblings, 1 reply; 12+ messages in thread
From: Raveendra Padasalagi @ 2016-02-19  6:13 UTC (permalink / raw)
  To: Rob Herring
  Cc: Dmitry Torokhov, Russell King, Arnd Bergmann, devicetree,
	linux-arm-kernel, linux-input, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Jonathan Richardson, Jon Mason,
	Florian Fainelli, Anup Patel, Ray Jui, Scott Branden,
	linux-kernel, bcm-kernel-feedback-list

On Thu, Feb 18, 2016 at 8:06 PM, Rob Herring <robh@kernel.org> wrote:
> On Wed, Feb 17, 2016 at 03:13:44PM +0530, Raveendra Padasalagi wrote:
>> In Cygnus SOC touch screen controller registers are shared
>> with ADC and flex timer. Using readl/writel could lead to
>> race condition. So touch screen driver is enhanced to support
>>
>> 1. If touchscreen register's are not shared. Register access
>> is handled through readl/writel if "brcm,iproc-touchscreen"
>> compatible is provided in touchscreen dt node. This will help
>> for future SOC's if comes with dedicated touchscreen IP register's.
>>
>> 2. If touchscreen register's are shared with other IP's, register
>> access is handled through syscon framework API's to take care of
>> mutually exclusive access. This feature can be enabled by selecting
>> "brcm,iproc-touchscreen-syscon" compatible string in the touchscreen
>> dt node.
>>
>> Hence touchscreen dt node bindings document is updated to take care
>> of above changes in the touchscreen driver.
>>
>> Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
>> Reviewed-by: Ray Jui <ray.jui@broadcom.com>
>> Reviewed-by: Scott Branden <scott.branden@broadcom.com>
>> ---
>>  .../input/touchscreen/brcm,iproc-touchscreen.txt   | 57 +++++++++++++++++++---
>>  1 file changed, 51 insertions(+), 6 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt b/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
>> index 34e3382..f530c25 100644
>> --- a/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
>> +++ b/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
>> @@ -1,12 +1,30 @@
>>  * Broadcom's IPROC Touchscreen Controller
>>
>>  Required properties:
>> -- compatible: must be "brcm,iproc-touchscreen"
>> -- reg: physical base address of the controller and length of memory mapped
>> -  region.
>> +- compatible: should be one of
>> +        "brcm,iproc-touchscreen"
>> +        "brcm,iproc-touchscreen-syscon"
>
> More specific and this is not how you do syscon. Either the block is or
> isn't. You can't have it both ways.

Existing driver has support for reg, if we modify now to support only syscon
then this driver will not work if some one wishes to use previous
kernel version's
dt and vice versa. Basically this breaks dt compatibility. Is that ok ?

>> +- ts_syscon: if "brcm,iproc-touchscreen-syscon" compatible string
>> +  is selected then "ts_syscon" is mandatory or else not required.
>> +  The "ts_syscon" is handler of syscon node defining physical base
>> +  address of the controller and length of memory mapped region.
>> +  If this property is selected please make sure MFD_SYSCON config
>> +  is enabled in the defconfig file.
>> +- reg: if "brcm,iproc-touchscreen" compatible string is selected
>> +  then "reg" property is mandatory or else not required.
>> +  The "reg" should be physical base address of the controller and
>> +  length of memory mapped region.
>
> I thought every chip to date is a syscon. Add reg support when you
> actually need it.

Since the existing driver has support for reg and now if we modify it to
support syscon only then we break the dt compatibility with previous kernel
versions. So keeping support for both will help to avoid dt
compatibility issues.

I will change the driver if you still think syscon only support is fine.
Let me know your opinion.

>>  - clocks:  The clock provided by the SOC to driver the tsc
>>  - clock-name:  name for the clock
>>  - interrupts: The touchscreen controller's interrupt
>> +- address-cells: Specify the number of u32 entries needed in child nodes.
>> +                 Should set to 1. This property is mandatory when
>> +                 "brcm,iproc-touchscreen-syscon" compatible string is selected
>> +                 or else not required.
>> +- size-cells: Specify number of u32 entries needed to specify child nodes size
>> +              in reg property. Should set to 1.This property is mandatory when
>> +              "brcm,iproc-touchscreen-syscon" compatible string is selected or
>> +              else not required.
>>
>>  Optional properties:
>>  - scanning_period: Time between scans. Each step is 1024 us.  Valid 1-256.
>> @@ -53,13 +71,40 @@ Optional properties:
>>  - touchscreen-inverted-x: X axis is inverted (boolean)
>>  - touchscreen-inverted-y: Y axis is inverted (boolean)
>>
>> -Example:
>> +Example 1: An example of touchscreen node with "brcm,iproc-touchscreen-syscon"
>> +           compatible string.
>> +
>> +     ts_adc_syscon: ts_adc_syscon@0x180a6000 {
>> +             compatible = "syscon";
>> +             reg = <0x180a6000 0xc30>;
>> +     };
>>
>>       touchscreen: tsc@0x180A6000 {
>
> Drop the '0x' and the node name should be touchscreen, not tsc.

I will address this in the next patch.

>> -             compatible = "brcm,iproc-touchscreen";
>> +             compatible = "brcm,iproc-touchscreen-syscon";
>>               #address-cells = <1>;
>>               #size-cells = <1>;
>> -             reg = <0x180A6000 0x40>;
>> +             ts_syscon = <&ts_adc_syscon>;
>> +             clocks = <&adc_clk>;
>> +             clock-names = "tsc_clk";
>> +             interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>;
>> +
>
>> +             scanning_period = <5>;
>> +             debounce_timeout = <40>;
>> +             settling_timeout = <7>;
>> +             touch_timeout = <10>;
>> +             average_data = <5>;
>> +             fifo_threshold = <1>;
>
> New properties?

No, These are existing properties.

>> +             /* Touchscreen is rotated 180 degrees. */
>> +             touchscreen-inverted-x;
>> +             touchscreen-inverted-y;
>> +     };
>> +
>> +Example 2: An example of touchscreen node with "brcm,iproc-touchscreen"
>> +          compatible string.
>> +
>> +     touchscreen: tsc@0x180A6000 {
>> +             compatible = "brcm,iproc-touchscreen";
>> +             reg = <0x180a6000 0x40>;
>>               clocks = <&adc_clk>;
>>               clock-names = "tsc_clk";
>>               interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>;
>> --
>> 1.9.1
>>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/3] input: cygnus-update touchscreen dt node document
  2016-02-19  6:13     ` Raveendra Padasalagi
@ 2016-02-22 19:36       ` Dmitry Torokhov
  2016-02-22 19:41         ` Scott Branden
  0 siblings, 1 reply; 12+ messages in thread
From: Dmitry Torokhov @ 2016-02-22 19:36 UTC (permalink / raw)
  To: Raveendra Padasalagi
  Cc: Rob Herring, Russell King, Arnd Bergmann, devicetree,
	linux-arm-kernel, linux-input, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Jonathan Richardson, Jon Mason,
	Florian Fainelli, Anup Patel, Ray Jui, Scott Branden,
	linux-kernel, bcm-kernel-feedback-list

On Fri, Feb 19, 2016 at 11:43:50AM +0530, Raveendra Padasalagi wrote:
> On Thu, Feb 18, 2016 at 8:06 PM, Rob Herring <robh@kernel.org> wrote:
> > On Wed, Feb 17, 2016 at 03:13:44PM +0530, Raveendra Padasalagi wrote:
> >> In Cygnus SOC touch screen controller registers are shared
> >> with ADC and flex timer. Using readl/writel could lead to
> >> race condition. So touch screen driver is enhanced to support
> >>
> >> 1. If touchscreen register's are not shared. Register access
> >> is handled through readl/writel if "brcm,iproc-touchscreen"
> >> compatible is provided in touchscreen dt node. This will help
> >> for future SOC's if comes with dedicated touchscreen IP register's.
> >>
> >> 2. If touchscreen register's are shared with other IP's, register
> >> access is handled through syscon framework API's to take care of
> >> mutually exclusive access. This feature can be enabled by selecting
> >> "brcm,iproc-touchscreen-syscon" compatible string in the touchscreen
> >> dt node.
> >>
> >> Hence touchscreen dt node bindings document is updated to take care
> >> of above changes in the touchscreen driver.
> >>
> >> Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
> >> Reviewed-by: Ray Jui <ray.jui@broadcom.com>
> >> Reviewed-by: Scott Branden <scott.branden@broadcom.com>
> >> ---
> >>  .../input/touchscreen/brcm,iproc-touchscreen.txt   | 57 +++++++++++++++++++---
> >>  1 file changed, 51 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt b/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
> >> index 34e3382..f530c25 100644
> >> --- a/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
> >> +++ b/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
> >> @@ -1,12 +1,30 @@
> >>  * Broadcom's IPROC Touchscreen Controller
> >>
> >>  Required properties:
> >> -- compatible: must be "brcm,iproc-touchscreen"
> >> -- reg: physical base address of the controller and length of memory mapped
> >> -  region.
> >> +- compatible: should be one of
> >> +        "brcm,iproc-touchscreen"
> >> +        "brcm,iproc-touchscreen-syscon"
> >
> > More specific and this is not how you do syscon. Either the block is or
> > isn't. You can't have it both ways.
> 
> Existing driver has support for reg, if we modify now to support only syscon
> then this driver will not work if some one wishes to use previous
> kernel version's
> dt and vice versa. Basically this breaks dt compatibility. Is that ok ?

But the issue is that the driver does not actually work correctly with
direct register access on those systems, since the registers are
actually shared with other components. I am not quite sure if it is OK
to break DT binding in this case...

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/3] input: cygnus-update touchscreen dt node document
  2016-02-22 19:36       ` Dmitry Torokhov
@ 2016-02-22 19:41         ` Scott Branden
  2016-02-22 19:48           ` Ray Jui
  0 siblings, 1 reply; 12+ messages in thread
From: Scott Branden @ 2016-02-22 19:41 UTC (permalink / raw)
  To: Dmitry Torokhov, Raveendra Padasalagi
  Cc: Rob Herring, Russell King, Arnd Bergmann, devicetree,
	linux-arm-kernel, linux-input, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Jonathan Richardson, Jon Mason,
	Florian Fainelli, Anup Patel, Ray Jui, Scott Branden,
	linux-kernel, bcm-kernel-feedback-list

My comments below

On 16-02-22 11:36 AM, Dmitry Torokhov wrote:
> On Fri, Feb 19, 2016 at 11:43:50AM +0530, Raveendra Padasalagi wrote:
>> On Thu, Feb 18, 2016 at 8:06 PM, Rob Herring <robh@kernel.org> wrote:
>>> On Wed, Feb 17, 2016 at 03:13:44PM +0530, Raveendra Padasalagi wrote:
>>>> In Cygnus SOC touch screen controller registers are shared
>>>> with ADC and flex timer. Using readl/writel could lead to
>>>> race condition. So touch screen driver is enhanced to support
>>>>
>>>> 1. If touchscreen register's are not shared. Register access
>>>> is handled through readl/writel if "brcm,iproc-touchscreen"
>>>> compatible is provided in touchscreen dt node. This will help
>>>> for future SOC's if comes with dedicated touchscreen IP register's.
>>>>
>>>> 2. If touchscreen register's are shared with other IP's, register
>>>> access is handled through syscon framework API's to take care of
>>>> mutually exclusive access. This feature can be enabled by selecting
>>>> "brcm,iproc-touchscreen-syscon" compatible string in the touchscreen
>>>> dt node.
>>>>
>>>> Hence touchscreen dt node bindings document is updated to take care
>>>> of above changes in the touchscreen driver.
>>>>
>>>> Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
>>>> Reviewed-by: Ray Jui <ray.jui@broadcom.com>
>>>> Reviewed-by: Scott Branden <scott.branden@broadcom.com>
>>>> ---
>>>>   .../input/touchscreen/brcm,iproc-touchscreen.txt   | 57 +++++++++++++++++++---
>>>>   1 file changed, 51 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt b/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
>>>> index 34e3382..f530c25 100644
>>>> --- a/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
>>>> +++ b/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
>>>> @@ -1,12 +1,30 @@
>>>>   * Broadcom's IPROC Touchscreen Controller
>>>>
>>>>   Required properties:
>>>> -- compatible: must be "brcm,iproc-touchscreen"
>>>> -- reg: physical base address of the controller and length of memory mapped
>>>> -  region.
>>>> +- compatible: should be one of
>>>> +        "brcm,iproc-touchscreen"
>>>> +        "brcm,iproc-touchscreen-syscon"
>>>
>>> More specific and this is not how you do syscon. Either the block is or
>>> isn't. You can't have it both ways.
>>
>> Existing driver has support for reg, if we modify now to support only syscon
>> then this driver will not work if some one wishes to use previous
>> kernel version's
>> dt and vice versa. Basically this breaks dt compatibility. Is that ok ?
>
> But the issue is that the driver does not actually work correctly with
> direct register access on those systems, since the registers are
> actually shared with other components. I am not quite sure if it is OK
> to break DT binding in this case...

The driver does work correctly with direct register access on those 
systems because the other components using those registers are not 
active in those systems - so syscon is not needed in those cases.

I'm ok with not containing backwards compatibility though and always 
using syscon.  There are no deployed systems using older versions of the 
upstreamed kernel.
>
> Thanks.
>

Regards,
Scott

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/3] input: cygnus-update touchscreen dt node document
  2016-02-22 19:41         ` Scott Branden
@ 2016-02-22 19:48           ` Ray Jui
  2016-02-27  6:49             ` Raveendra Padasalagi
  0 siblings, 1 reply; 12+ messages in thread
From: Ray Jui @ 2016-02-22 19:48 UTC (permalink / raw)
  To: Scott Branden, Dmitry Torokhov, Raveendra Padasalagi
  Cc: Rob Herring, Russell King, Arnd Bergmann, devicetree,
	linux-arm-kernel, linux-input, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Jonathan Richardson, Jon Mason,
	Florian Fainelli, Anup Patel, Ray Jui, Scott Branden,
	linux-kernel, bcm-kernel-feedback-list



On 2/22/2016 11:41 AM, Scott Branden wrote:
> My comments below
>
> On 16-02-22 11:36 AM, Dmitry Torokhov wrote:
>> On Fri, Feb 19, 2016 at 11:43:50AM +0530, Raveendra Padasalagi wrote:
>>> On Thu, Feb 18, 2016 at 8:06 PM, Rob Herring <robh@kernel.org> wrote:
>>>> On Wed, Feb 17, 2016 at 03:13:44PM +0530, Raveendra Padasalagi wrote:
>>>>> In Cygnus SOC touch screen controller registers are shared
>>>>> with ADC and flex timer. Using readl/writel could lead to
>>>>> race condition. So touch screen driver is enhanced to support
>>>>>
>>>>> 1. If touchscreen register's are not shared. Register access
>>>>> is handled through readl/writel if "brcm,iproc-touchscreen"
>>>>> compatible is provided in touchscreen dt node. This will help
>>>>> for future SOC's if comes with dedicated touchscreen IP register's.
>>>>>
>>>>> 2. If touchscreen register's are shared with other IP's, register
>>>>> access is handled through syscon framework API's to take care of
>>>>> mutually exclusive access. This feature can be enabled by selecting
>>>>> "brcm,iproc-touchscreen-syscon" compatible string in the touchscreen
>>>>> dt node.
>>>>>
>>>>> Hence touchscreen dt node bindings document is updated to take care
>>>>> of above changes in the touchscreen driver.
>>>>>
>>>>> Signed-off-by: Raveendra Padasalagi
>>>>> <raveendra.padasalagi@broadcom.com>
>>>>> Reviewed-by: Ray Jui <ray.jui@broadcom.com>
>>>>> Reviewed-by: Scott Branden <scott.branden@broadcom.com>
>>>>> ---
>>>>>   .../input/touchscreen/brcm,iproc-touchscreen.txt   | 57
>>>>> +++++++++++++++++++---
>>>>>   1 file changed, 51 insertions(+), 6 deletions(-)
>>>>>
>>>>> diff --git
>>>>> a/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
>>>>> b/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
>>>>>
>>>>> index 34e3382..f530c25 100644
>>>>> ---
>>>>> a/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
>>>>>
>>>>> +++
>>>>> b/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
>>>>>
>>>>> @@ -1,12 +1,30 @@
>>>>>   * Broadcom's IPROC Touchscreen Controller
>>>>>
>>>>>   Required properties:
>>>>> -- compatible: must be "brcm,iproc-touchscreen"
>>>>> -- reg: physical base address of the controller and length of
>>>>> memory mapped
>>>>> -  region.
>>>>> +- compatible: should be one of
>>>>> +        "brcm,iproc-touchscreen"
>>>>> +        "brcm,iproc-touchscreen-syscon"
>>>>
>>>> More specific and this is not how you do syscon. Either the block is or
>>>> isn't. You can't have it both ways.
>>>
>>> Existing driver has support for reg, if we modify now to support only
>>> syscon
>>> then this driver will not work if some one wishes to use previous
>>> kernel version's
>>> dt and vice versa. Basically this breaks dt compatibility. Is that ok ?
>>
>> But the issue is that the driver does not actually work correctly with
>> direct register access on those systems, since the registers are
>> actually shared with other components. I am not quite sure if it is OK
>> to break DT binding in this case...
>
> The driver does work correctly with direct register access on those
> systems because the other components using those registers are not
> active in those systems - so syscon is not needed in those cases.
>
> I'm ok with not containing backwards compatibility though and always
> using syscon.  There are no deployed systems using older versions of the
> upstreamed kernel.
>>
>> Thanks.
>>
>
> Regards,
> Scott

The iproc touchscreen is currently activated in the "bcm9hmidc.dtsi" 
that represents the optional daughter card installed on reference boards 
bcm958300k and bcm958305k. While not maintaining backwards compatibility 
*might not* be a serious issue, it would be nice if we can at least make 
sure the driver change and DT are merged into the same kernel version so 
they stay in sync.

Going forward, if we are only going to support syscon based 
implementation, the existing compatible string "brcm,iproc-touchscreen" 
is preferred over "brcm,iproc-touchscreen-syscon".

Thanks,

Ray

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/3] input: cygnus-update touchscreen dt node document
  2016-02-22 19:48           ` Ray Jui
@ 2016-02-27  6:49             ` Raveendra Padasalagi
  0 siblings, 0 replies; 12+ messages in thread
From: Raveendra Padasalagi @ 2016-02-27  6:49 UTC (permalink / raw)
  To: Ray Jui
  Cc: Scott Branden, Dmitry Torokhov, Rob Herring, Russell King,
	Arnd Bergmann, devicetree, linux-arm-kernel, linux-input,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Jonathan Richardson, Jon Mason, Florian Fainelli, Anup Patel,
	Ray Jui, Scott Branden, linux-kernel, bcm-kernel-feedback-list

Thanks Scott and Ray for the inputs. I will implement syscon only
register access and send out the changes in patch set - v4.

Regards,
Raveendra

On Tue, Feb 23, 2016 at 1:18 AM, Ray Jui <ray.jui@broadcom.com> wrote:
>
>
> On 2/22/2016 11:41 AM, Scott Branden wrote:
>>
>> My comments below
>>
>> On 16-02-22 11:36 AM, Dmitry Torokhov wrote:
>>>
>>> On Fri, Feb 19, 2016 at 11:43:50AM +0530, Raveendra Padasalagi wrote:
>>>>
>>>> On Thu, Feb 18, 2016 at 8:06 PM, Rob Herring <robh@kernel.org> wrote:
>>>>>
>>>>> On Wed, Feb 17, 2016 at 03:13:44PM +0530, Raveendra Padasalagi wrote:
>>>>>>
>>>>>> In Cygnus SOC touch screen controller registers are shared
>>>>>> with ADC and flex timer. Using readl/writel could lead to
>>>>>> race condition. So touch screen driver is enhanced to support
>>>>>>
>>>>>> 1. If touchscreen register's are not shared. Register access
>>>>>> is handled through readl/writel if "brcm,iproc-touchscreen"
>>>>>> compatible is provided in touchscreen dt node. This will help
>>>>>> for future SOC's if comes with dedicated touchscreen IP register's.
>>>>>>
>>>>>> 2. If touchscreen register's are shared with other IP's, register
>>>>>> access is handled through syscon framework API's to take care of
>>>>>> mutually exclusive access. This feature can be enabled by selecting
>>>>>> "brcm,iproc-touchscreen-syscon" compatible string in the touchscreen
>>>>>> dt node.
>>>>>>
>>>>>> Hence touchscreen dt node bindings document is updated to take care
>>>>>> of above changes in the touchscreen driver.
>>>>>>
>>>>>> Signed-off-by: Raveendra Padasalagi
>>>>>> <raveendra.padasalagi@broadcom.com>
>>>>>> Reviewed-by: Ray Jui <ray.jui@broadcom.com>
>>>>>> Reviewed-by: Scott Branden <scott.branden@broadcom.com>
>>>>>> ---
>>>>>>   .../input/touchscreen/brcm,iproc-touchscreen.txt   | 57
>>>>>> +++++++++++++++++++---
>>>>>>   1 file changed, 51 insertions(+), 6 deletions(-)
>>>>>>
>>>>>> diff --git
>>>>>>
>>>>>> a/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
>>>>>>
>>>>>> b/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
>>>>>>
>>>>>> index 34e3382..f530c25 100644
>>>>>> ---
>>>>>>
>>>>>> a/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
>>>>>>
>>>>>> +++
>>>>>>
>>>>>> b/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
>>>>>>
>>>>>> @@ -1,12 +1,30 @@
>>>>>>   * Broadcom's IPROC Touchscreen Controller
>>>>>>
>>>>>>   Required properties:
>>>>>> -- compatible: must be "brcm,iproc-touchscreen"
>>>>>> -- reg: physical base address of the controller and length of
>>>>>> memory mapped
>>>>>> -  region.
>>>>>> +- compatible: should be one of
>>>>>> +        "brcm,iproc-touchscreen"
>>>>>> +        "brcm,iproc-touchscreen-syscon"
>>>>>
>>>>>
>>>>> More specific and this is not how you do syscon. Either the block is or
>>>>> isn't. You can't have it both ways.
>>>>
>>>>
>>>> Existing driver has support for reg, if we modify now to support only
>>>> syscon
>>>> then this driver will not work if some one wishes to use previous
>>>> kernel version's
>>>> dt and vice versa. Basically this breaks dt compatibility. Is that ok ?
>>>
>>>
>>> But the issue is that the driver does not actually work correctly with
>>> direct register access on those systems, since the registers are
>>> actually shared with other components. I am not quite sure if it is OK
>>> to break DT binding in this case...
>>
>>
>> The driver does work correctly with direct register access on those
>> systems because the other components using those registers are not
>> active in those systems - so syscon is not needed in those cases.
>>
>> I'm ok with not containing backwards compatibility though and always
>> using syscon.  There are no deployed systems using older versions of the
>> upstreamed kernel.
>>>
>>>
>>> Thanks.
>>>
>>
>> Regards,
>> Scott
>
>
> The iproc touchscreen is currently activated in the "bcm9hmidc.dtsi" that
> represents the optional daughter card installed on reference boards
> bcm958300k and bcm958305k. While not maintaining backwards compatibility
> *might not* be a serious issue, it would be nice if we can at least make
> sure the driver change and DT are merged into the same kernel version so
> they stay in sync.
>
> Going forward, if we are only going to support syscon based implementation,
> the existing compatible string "brcm,iproc-touchscreen" is preferred over
> "brcm,iproc-touchscreen-syscon".
>
> Thanks,
>
> Ray

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-02-27  6:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-17  9:43 [PATCH v2 0/3] Syscon support for iProc touchscreen driver Raveendra Padasalagi
2016-02-17  9:43 ` [PATCH v2 1/3] input: cygnus-update touchscreen dt node document Raveendra Padasalagi
2016-02-17  9:45   ` Arnd Bergmann
2016-02-17  9:53     ` Raveendra Padasalagi
2016-02-18 14:36   ` Rob Herring
2016-02-19  6:13     ` Raveendra Padasalagi
2016-02-22 19:36       ` Dmitry Torokhov
2016-02-22 19:41         ` Scott Branden
2016-02-22 19:48           ` Ray Jui
2016-02-27  6:49             ` Raveendra Padasalagi
2016-02-17  9:43 ` [PATCH v2 2/3] input: syscon support in bcm_iproc_tsc driver Raveendra Padasalagi
2016-02-17  9:43 ` [PATCH v2 3/3] ARM: dts: use syscon in cygnus touchscreen dt node Raveendra Padasalagi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).