linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] cyapa patches instruction
@ 2015-07-24  5:05 Dudley Du
  2015-07-24  5:05 ` [PATCH 1/3] input: cyapa: add regulator vcc support Dudley Du
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Dudley Du @ 2015-07-24  5:05 UTC (permalink / raw)
  To: dmitry.torokhov, mark.rutland, robh+dt
  Cc: Dudley Du, bleung, jmmahler, devicetree, linux-input, linux-kernel

These patches are made based on Dmitry's next tree.
It's aimed to add regulator vcc and of match device tree supported, and also
fix the output unwanted wanring message issue when working with old Gen5
Trackpad device that doesn't support the proximity function.

Dudley Du (3):
  input: cyapa: add regulator vcc support
  input: cyapa: add of match device support and description document
  input: cyapa: fix output unwanted warning issue

 .../devicetree/bindings/input/cypress,cyapa.txt    | 44 ++++++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.txt        |  1 +
 drivers/input/mouse/cyapa.c                        | 38 +++++++++++++++++++
 drivers/input/mouse/cyapa.h                        |  1 +
 drivers/input/mouse/cyapa_gen5.c                   | 11 ++++--
 5 files changed, 91 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/cypress,cyapa.txt

-- 
1.9.1


---------------------------------------------------------------
This message and any attachments may contain Cypress (or its
subsidiaries) confidential information. If it has been received
in error, please advise the sender and immediately delete this
message.
---------------------------------------------------------------


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

* [PATCH 1/3] input: cyapa: add regulator vcc support
  2015-07-24  5:05 [PATCH 0/3] cyapa patches instruction Dudley Du
@ 2015-07-24  5:05 ` Dudley Du
  2015-07-30 18:33   ` Dmitry Torokhov
  2015-07-24  5:05 ` [PATCH 2/3] input: cyapa: add of match device support and description document Dudley Du
  2015-07-24  5:05 ` [PATCH 3/3] input: cyapa: fix output unwanted warning issue Dudley Du
  2 siblings, 1 reply; 8+ messages in thread
From: Dudley Du @ 2015-07-24  5:05 UTC (permalink / raw)
  To: dmitry.torokhov, mark.rutland, robh+dt
  Cc: Dudley Du, bleung, jmmahler, devicetree, linux-input, linux-kernel

Add power management regulator vcc support.
It's described to be supported in the cypress,cyapa.txt document.

Signed-off-by: Dudley Du <dudl@cypress.com>
---
 drivers/input/mouse/cyapa.c | 28 ++++++++++++++++++++++++++++
 drivers/input/mouse/cyapa.h |  1 +
 2 files changed, 29 insertions(+)

diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
index 6195ccb..2159c5e 100644
--- a/drivers/input/mouse/cyapa.c
+++ b/drivers/input/mouse/cyapa.c
@@ -1241,6 +1241,13 @@ static void cyapa_remove_sysfs_group(void *data)
 	sysfs_remove_group(&cyapa->client->dev.kobj, &cyapa_sysfs_group);
 }
 
+static void cyapa_disable_regulator(void *data)
+{
+	struct cyapa *cyapa = data;
+
+	regulator_disable(cyapa->vcc);
+}
+
 static int cyapa_probe(struct i2c_client *client,
 		       const struct i2c_device_id *dev_id)
 {
@@ -1274,6 +1281,27 @@ static int cyapa_probe(struct i2c_client *client,
 	sprintf(cyapa->phys, "i2c-%d-%04x/input0", client->adapter->nr,
 		client->addr);
 
+	cyapa->vcc = devm_regulator_get(dev, "vcc");
+	if (IS_ERR(cyapa->vcc)) {
+		error = PTR_ERR(cyapa->vcc);
+		dev_err(dev, "failed to get vcc regulator: %d\n", error);
+		return error;
+	}
+
+	error = regulator_enable(cyapa->vcc);
+	if (error) {
+		dev_err(dev, "failed to enable regulator: %d\n", error);
+		return error;
+	}
+
+	error = devm_add_action(dev, cyapa_disable_regulator, cyapa);
+	if (error) {
+		cyapa_disable_regulator(cyapa);
+		dev_err(dev, "failed to add disable regulator action: %d\n",
+			error);
+		return error;
+	}
+
 	error = cyapa_initialize(cyapa);
 	if (error) {
 		dev_err(dev, "failed to detect and initialize tp device.\n");
diff --git a/drivers/input/mouse/cyapa.h b/drivers/input/mouse/cyapa.h
index af12536..b812bba 100644
--- a/drivers/input/mouse/cyapa.h
+++ b/drivers/input/mouse/cyapa.h
@@ -321,6 +321,7 @@ struct cyapa {
 	u8 status[BL_STATUS_SIZE];
 	bool operational; /* true: ready for data reporting; false: not. */
 
+	struct regulator *vcc;
 	struct i2c_client *client;
 	struct input_dev *input;
 	char phys[32];	/* Device physical location */
-- 
1.9.1


---------------------------------------------------------------
This message and any attachments may contain Cypress (or its
subsidiaries) confidential information. If it has been received
in error, please advise the sender and immediately delete this
message.
---------------------------------------------------------------


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

* [PATCH 2/3] input: cyapa: add of match device support and description document
  2015-07-24  5:05 [PATCH 0/3] cyapa patches instruction Dudley Du
  2015-07-24  5:05 ` [PATCH 1/3] input: cyapa: add regulator vcc support Dudley Du
@ 2015-07-24  5:05 ` Dudley Du
  2015-07-30 18:33   ` Dmitry Torokhov
  2015-07-24  5:05 ` [PATCH 3/3] input: cyapa: fix output unwanted warning issue Dudley Du
  2 siblings, 1 reply; 8+ messages in thread
From: Dudley Du @ 2015-07-24  5:05 UTC (permalink / raw)
  To: dmitry.torokhov, mark.rutland, robh+dt
  Cc: Dudley Du, bleung, jmmahler, devicetree, linux-input, linux-kernel

Add of_match_device mechanism support for Cypress trackpad device, and
add the sample description document on how to adding the trackpad device node
in the device tree.

Signed-off-by: Dudley Du <dudl@cypress.com>
---
 .../devicetree/bindings/input/cypress,cyapa.txt    | 44 ++++++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.txt        |  1 +
 drivers/input/mouse/cyapa.c                        | 10 +++++
 3 files changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/cypress,cyapa.txt

diff --git a/Documentation/devicetree/bindings/input/cypress,cyapa.txt b/Documentation/devicetree/bindings/input/cypress,cyapa.txt
new file mode 100644
index 0000000..9be2b44
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/cypress,cyapa.txt
@@ -0,0 +1,44 @@
+Cypress I2C Touchpad
+
+Required properties:
+- compatible: must be "cypress,cyapa".
+- reg: I2C address of the chip.
+- interrupt-parent: a phandle for the interrupt controller (see interrupt
+  binding[0]).
+- interrupts: interrupt to which the chip is connected (see interrupt
+  binding[0]).
+
+Optional properties:
+- wakeup-source: touchpad can be used as a wakeup source.
+- pinctrl-names: should be "default" (see pinctrl binding [1]).
+- pinctrl-0: a phandle pointing to the pin settings for the device (see
+  pinctrl binding [1]).
+- vcc-supply: a phandle for the regulator supplying 3.3V power.
+
+[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
+[1]: Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
+
+Example:
+	&i2c0 {
+		/* ... */
+
+		/* Cypress Gen3 touchpad */
+		touchpad@67 {
+			compatible = "cypress,cyapa";
+			reg = <0x24>;
+			interrupt-parent = <&gpio>;
+			interrupts = <2 IRQ_TYPE_EDGE_FALLING>;	/* GPIO 2 */
+			wakeup-source;
+		};
+
+		/* Cypress Gen5 and later touchpad */
+		touchpad@24 {
+			compatible = "cypress,cyapa";
+			reg = <0x24>;
+			interrupt-parent = <&gpio>;
+			interrupts = <2 IRQ_TYPE_EDGE_FALLING>;	/* GPIO 2 */
+			wakeup-source;
+		};
+
+		/* ... */
+	};
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index d444757..57c0f5f 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -54,6 +54,7 @@ cortina	Cortina Systems, Inc.
 cosmic	Cosmic Circuits
 crystalfontz	Crystalfontz America, Inc.
 cubietech	Cubietech, Ltd.
+cypress	Cypress Semiconductor Corporation
 dallas	Maxim Integrated Products (formerly Dallas Semiconductor)
 davicom	DAVICOM Semiconductor, Inc.
 delta	Delta Electronics, Inc.
diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
index 2159c5e..3431510 100644
--- a/drivers/input/mouse/cyapa.c
+++ b/drivers/input/mouse/cyapa.c
@@ -25,6 +25,7 @@
 #include <linux/uaccess.h>
 #include <linux/pm_runtime.h>
 #include <linux/acpi.h>
+#include <linux/of.h>
 #include "cyapa.h"
 
 
@@ -1486,11 +1487,20 @@ static const struct acpi_device_id cyapa_acpi_id[] = {
 MODULE_DEVICE_TABLE(acpi, cyapa_acpi_id);
 #endif
 
+#ifdef CONFIG_OF
+static const struct of_device_id cyapa_of_match[] = {
+	{ .compatible = "cypress,cyapa" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, cyapa_of_match);
+#endif
+
 static struct i2c_driver cyapa_driver = {
 	.driver = {
 		.name = "cyapa",
 		.pm = &cyapa_pm_ops,
 		.acpi_match_table = ACPI_PTR(cyapa_acpi_id),
+		.of_match_table = of_match_ptr(cyapa_of_match),
 	},
 
 	.probe = cyapa_probe,
-- 
1.9.1


---------------------------------------------------------------
This message and any attachments may contain Cypress (or its
subsidiaries) confidential information. If it has been received
in error, please advise the sender and immediately delete this
message.
---------------------------------------------------------------


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

* [PATCH 3/3] input: cyapa: fix output unwanted warning issue
  2015-07-24  5:05 [PATCH 0/3] cyapa patches instruction Dudley Du
  2015-07-24  5:05 ` [PATCH 1/3] input: cyapa: add regulator vcc support Dudley Du
  2015-07-24  5:05 ` [PATCH 2/3] input: cyapa: add of match device support and description document Dudley Du
@ 2015-07-24  5:05 ` Dudley Du
  2015-07-30 18:33   ` Dmitry Torokhov
  2 siblings, 1 reply; 8+ messages in thread
From: Dudley Du @ 2015-07-24  5:05 UTC (permalink / raw)
  To: dmitry.torokhov, mark.rutland, robh+dt
  Cc: Dudley Du, bleung, jmmahler, devicetree, linux-input, linux-kernel

Avoid the driver generate warning message when the cyapa driver working
with the old Gen5 trackpad device which does not support the proximity function.
Those old Gen5 trackpad device all have the platform version less than 2.

Signed-off-by: Dudley Du <dudl@cypress.com>
---
 drivers/input/mouse/cyapa_gen5.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/input/mouse/cyapa_gen5.c b/drivers/input/mouse/cyapa_gen5.c
index 6d7abbe..118ba97 100644
--- a/drivers/input/mouse/cyapa_gen5.c
+++ b/drivers/input/mouse/cyapa_gen5.c
@@ -2519,10 +2519,13 @@ static int cyapa_gen5_do_operational_check(struct cyapa *cyapa)
 				__func__);
 
 		/* By default, the trackpad proximity function is enabled. */
-		error = cyapa_pip_set_proximity(cyapa, true);
-		if (error)
-			dev_warn(dev, "%s: failed to enable proximity.\n",
-				__func__);
+		if (cyapa->platform_ver >= 2) {
+			error = cyapa_pip_set_proximity(cyapa, true);
+			if (error)
+				dev_warn(dev,
+					"%s: failed to enable proximity.\n",
+					__func__);
+		}
 
 		/* Get trackpad product information. */
 		error = cyapa_gen5_get_query_data(cyapa);
-- 
1.9.1


---------------------------------------------------------------
This message and any attachments may contain Cypress (or its
subsidiaries) confidential information. If it has been received
in error, please advise the sender and immediately delete this
message.
---------------------------------------------------------------


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

* Re: [PATCH 1/3] input: cyapa: add regulator vcc support
  2015-07-24  5:05 ` [PATCH 1/3] input: cyapa: add regulator vcc support Dudley Du
@ 2015-07-30 18:33   ` Dmitry Torokhov
  2015-07-31  1:45     ` Dudley Du
  0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Torokhov @ 2015-07-30 18:33 UTC (permalink / raw)
  To: Dudley Du
  Cc: mark.rutland, robh+dt, bleung, jmmahler, devicetree, linux-input,
	linux-kernel

On Fri, Jul 24, 2015 at 01:05:57PM +0800, Dudley Du wrote:
> Add power management regulator vcc support.
> It's described to be supported in the cypress,cyapa.txt document.
> 
> Signed-off-by: Dudley Du <dudl@cypress.com>

It looks like we were missing linux/regulator/consumer.h include, I
added it and applied.

Thanks.

> ---
>  drivers/input/mouse/cyapa.c | 28 ++++++++++++++++++++++++++++
>  drivers/input/mouse/cyapa.h |  1 +
>  2 files changed, 29 insertions(+)
> 
> diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
> index 6195ccb..2159c5e 100644
> --- a/drivers/input/mouse/cyapa.c
> +++ b/drivers/input/mouse/cyapa.c
> @@ -1241,6 +1241,13 @@ static void cyapa_remove_sysfs_group(void *data)
>  	sysfs_remove_group(&cyapa->client->dev.kobj, &cyapa_sysfs_group);
>  }
>  
> +static void cyapa_disable_regulator(void *data)
> +{
> +	struct cyapa *cyapa = data;
> +
> +	regulator_disable(cyapa->vcc);
> +}
> +
>  static int cyapa_probe(struct i2c_client *client,
>  		       const struct i2c_device_id *dev_id)
>  {
> @@ -1274,6 +1281,27 @@ static int cyapa_probe(struct i2c_client *client,
>  	sprintf(cyapa->phys, "i2c-%d-%04x/input0", client->adapter->nr,
>  		client->addr);
>  
> +	cyapa->vcc = devm_regulator_get(dev, "vcc");
> +	if (IS_ERR(cyapa->vcc)) {
> +		error = PTR_ERR(cyapa->vcc);
> +		dev_err(dev, "failed to get vcc regulator: %d\n", error);
> +		return error;
> +	}
> +
> +	error = regulator_enable(cyapa->vcc);
> +	if (error) {
> +		dev_err(dev, "failed to enable regulator: %d\n", error);
> +		return error;
> +	}
> +
> +	error = devm_add_action(dev, cyapa_disable_regulator, cyapa);
> +	if (error) {
> +		cyapa_disable_regulator(cyapa);
> +		dev_err(dev, "failed to add disable regulator action: %d\n",
> +			error);
> +		return error;
> +	}
> +
>  	error = cyapa_initialize(cyapa);
>  	if (error) {
>  		dev_err(dev, "failed to detect and initialize tp device.\n");
> diff --git a/drivers/input/mouse/cyapa.h b/drivers/input/mouse/cyapa.h
> index af12536..b812bba 100644
> --- a/drivers/input/mouse/cyapa.h
> +++ b/drivers/input/mouse/cyapa.h
> @@ -321,6 +321,7 @@ struct cyapa {
>  	u8 status[BL_STATUS_SIZE];
>  	bool operational; /* true: ready for data reporting; false: not. */
>  
> +	struct regulator *vcc;
>  	struct i2c_client *client;
>  	struct input_dev *input;
>  	char phys[32];	/* Device physical location */
> -- 
> 1.9.1
> 
> 
> ---------------------------------------------------------------
> This message and any attachments may contain Cypress (or its
> subsidiaries) confidential information. If it has been received
> in error, please advise the sender and immediately delete this
> message.
> ---------------------------------------------------------------
> 

-- 
Dmitry

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

* Re: [PATCH 2/3] input: cyapa: add of match device support and description document
  2015-07-24  5:05 ` [PATCH 2/3] input: cyapa: add of match device support and description document Dudley Du
@ 2015-07-30 18:33   ` Dmitry Torokhov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Torokhov @ 2015-07-30 18:33 UTC (permalink / raw)
  To: Dudley Du
  Cc: mark.rutland, robh+dt, bleung, jmmahler, devicetree, linux-input,
	linux-kernel

On Fri, Jul 24, 2015 at 01:05:58PM +0800, Dudley Du wrote:
> Add of_match_device mechanism support for Cypress trackpad device, and
> add the sample description document on how to adding the trackpad device node
> in the device tree.
> 
> Signed-off-by: Dudley Du <dudl@cypress.com>

Applied, thank you.

> ---
>  .../devicetree/bindings/input/cypress,cyapa.txt    | 44 ++++++++++++++++++++++
>  .../devicetree/bindings/vendor-prefixes.txt        |  1 +
>  drivers/input/mouse/cyapa.c                        | 10 +++++
>  3 files changed, 55 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/cypress,cyapa.txt
> 
> diff --git a/Documentation/devicetree/bindings/input/cypress,cyapa.txt b/Documentation/devicetree/bindings/input/cypress,cyapa.txt
> new file mode 100644
> index 0000000..9be2b44
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/cypress,cyapa.txt
> @@ -0,0 +1,44 @@
> +Cypress I2C Touchpad
> +
> +Required properties:
> +- compatible: must be "cypress,cyapa".
> +- reg: I2C address of the chip.
> +- interrupt-parent: a phandle for the interrupt controller (see interrupt
> +  binding[0]).
> +- interrupts: interrupt to which the chip is connected (see interrupt
> +  binding[0]).
> +
> +Optional properties:
> +- wakeup-source: touchpad can be used as a wakeup source.
> +- pinctrl-names: should be "default" (see pinctrl binding [1]).
> +- pinctrl-0: a phandle pointing to the pin settings for the device (see
> +  pinctrl binding [1]).
> +- vcc-supply: a phandle for the regulator supplying 3.3V power.
> +
> +[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
> +[1]: Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
> +
> +Example:
> +	&i2c0 {
> +		/* ... */
> +
> +		/* Cypress Gen3 touchpad */
> +		touchpad@67 {
> +			compatible = "cypress,cyapa";
> +			reg = <0x24>;
> +			interrupt-parent = <&gpio>;
> +			interrupts = <2 IRQ_TYPE_EDGE_FALLING>;	/* GPIO 2 */
> +			wakeup-source;
> +		};
> +
> +		/* Cypress Gen5 and later touchpad */
> +		touchpad@24 {
> +			compatible = "cypress,cyapa";
> +			reg = <0x24>;
> +			interrupt-parent = <&gpio>;
> +			interrupts = <2 IRQ_TYPE_EDGE_FALLING>;	/* GPIO 2 */
> +			wakeup-source;
> +		};
> +
> +		/* ... */
> +	};
> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
> index d444757..57c0f5f 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.txt
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
> @@ -54,6 +54,7 @@ cortina	Cortina Systems, Inc.
>  cosmic	Cosmic Circuits
>  crystalfontz	Crystalfontz America, Inc.
>  cubietech	Cubietech, Ltd.
> +cypress	Cypress Semiconductor Corporation
>  dallas	Maxim Integrated Products (formerly Dallas Semiconductor)
>  davicom	DAVICOM Semiconductor, Inc.
>  delta	Delta Electronics, Inc.
> diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
> index 2159c5e..3431510 100644
> --- a/drivers/input/mouse/cyapa.c
> +++ b/drivers/input/mouse/cyapa.c
> @@ -25,6 +25,7 @@
>  #include <linux/uaccess.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/acpi.h>
> +#include <linux/of.h>
>  #include "cyapa.h"
>  
>  
> @@ -1486,11 +1487,20 @@ static const struct acpi_device_id cyapa_acpi_id[] = {
>  MODULE_DEVICE_TABLE(acpi, cyapa_acpi_id);
>  #endif
>  
> +#ifdef CONFIG_OF
> +static const struct of_device_id cyapa_of_match[] = {
> +	{ .compatible = "cypress,cyapa" },
> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, cyapa_of_match);
> +#endif
> +
>  static struct i2c_driver cyapa_driver = {
>  	.driver = {
>  		.name = "cyapa",
>  		.pm = &cyapa_pm_ops,
>  		.acpi_match_table = ACPI_PTR(cyapa_acpi_id),
> +		.of_match_table = of_match_ptr(cyapa_of_match),
>  	},
>  
>  	.probe = cyapa_probe,
> -- 
> 1.9.1
> 
> 
> ---------------------------------------------------------------
> This message and any attachments may contain Cypress (or its
> subsidiaries) confidential information. If it has been received
> in error, please advise the sender and immediately delete this
> message.
> ---------------------------------------------------------------
> 

-- 
Dmitry

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

* Re: [PATCH 3/3] input: cyapa: fix output unwanted warning issue
  2015-07-24  5:05 ` [PATCH 3/3] input: cyapa: fix output unwanted warning issue Dudley Du
@ 2015-07-30 18:33   ` Dmitry Torokhov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Torokhov @ 2015-07-30 18:33 UTC (permalink / raw)
  To: Dudley Du
  Cc: mark.rutland, robh+dt, bleung, jmmahler, devicetree, linux-input,
	linux-kernel

On Fri, Jul 24, 2015 at 01:05:59PM +0800, Dudley Du wrote:
> Avoid the driver generate warning message when the cyapa driver working
> with the old Gen5 trackpad device which does not support the proximity function.
> Those old Gen5 trackpad device all have the platform version less than 2.
> 
> Signed-off-by: Dudley Du <dudl@cypress.com>

Applied, thank you.

> ---
>  drivers/input/mouse/cyapa_gen5.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/mouse/cyapa_gen5.c b/drivers/input/mouse/cyapa_gen5.c
> index 6d7abbe..118ba97 100644
> --- a/drivers/input/mouse/cyapa_gen5.c
> +++ b/drivers/input/mouse/cyapa_gen5.c
> @@ -2519,10 +2519,13 @@ static int cyapa_gen5_do_operational_check(struct cyapa *cyapa)
>  				__func__);
>  
>  		/* By default, the trackpad proximity function is enabled. */
> -		error = cyapa_pip_set_proximity(cyapa, true);
> -		if (error)
> -			dev_warn(dev, "%s: failed to enable proximity.\n",
> -				__func__);
> +		if (cyapa->platform_ver >= 2) {
> +			error = cyapa_pip_set_proximity(cyapa, true);
> +			if (error)
> +				dev_warn(dev,
> +					"%s: failed to enable proximity.\n",
> +					__func__);
> +		}
>  
>  		/* Get trackpad product information. */
>  		error = cyapa_gen5_get_query_data(cyapa);
> -- 
> 1.9.1
> 
> 
> ---------------------------------------------------------------
> This message and any attachments may contain Cypress (or its
> subsidiaries) confidential information. If it has been received
> in error, please advise the sender and immediately delete this
> message.
> ---------------------------------------------------------------
> 

-- 
Dmitry

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

* RE: [PATCH 1/3] input: cyapa: add regulator vcc support
  2015-07-30 18:33   ` Dmitry Torokhov
@ 2015-07-31  1:45     ` Dudley Du
  0 siblings, 0 replies; 8+ messages in thread
From: Dudley Du @ 2015-07-31  1:45 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: mark.rutland, robh+dt, bleung, jmmahler, devicetree, linux-input,
	linux-kernel

Dmitry,

Thank your very much.

Thanks,
Dudley

> -----Original Message-----
> From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com]
> Sent: 2015?7?31? 2:33
> To: Dudley Du
> Cc: mark.rutland@arm.com; robh+dt@kernel.org; bleung@google.com;
> jmmahler@gmail.com; devicetree@vger.kernel.org; linux-input@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 1/3] input: cyapa: add regulator vcc support
>
> On Fri, Jul 24, 2015 at 01:05:57PM +0800, Dudley Du wrote:
> > Add power management regulator vcc support.
> > It's described to be supported in the cypress,cyapa.txt document.
> >
> > Signed-off-by: Dudley Du <dudl@cypress.com>
>
> It looks like we were missing linux/regulator/consumer.h include, I
> added it and applied.
>
> Thanks.
>
> > ---
> >  drivers/input/mouse/cyapa.c | 28 ++++++++++++++++++++++++++++
> >  drivers/input/mouse/cyapa.h |  1 +
> >  2 files changed, 29 insertions(+)
> >
> > diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
> > index 6195ccb..2159c5e 100644
> > --- a/drivers/input/mouse/cyapa.c
> > +++ b/drivers/input/mouse/cyapa.c
> > @@ -1241,6 +1241,13 @@ static void cyapa_remove_sysfs_group(void *data)
> >  sysfs_remove_group(&cyapa->client->dev.kobj, &cyapa_sysfs_group);
> >  }
> >
> > +static void cyapa_disable_regulator(void *data)
> > +{
> > +struct cyapa *cyapa = data;
> > +
> > +regulator_disable(cyapa->vcc);
> > +}
> > +
> >  static int cyapa_probe(struct i2c_client *client,
> >         const struct i2c_device_id *dev_id)
> >  {
> > @@ -1274,6 +1281,27 @@ static int cyapa_probe(struct i2c_client *client,
> >  sprintf(cyapa->phys, "i2c-%d-%04x/input0", client->adapter->nr,
> >  client->addr);
> >
> > +cyapa->vcc = devm_regulator_get(dev, "vcc");
> > +if (IS_ERR(cyapa->vcc)) {
> > +error = PTR_ERR(cyapa->vcc);
> > +dev_err(dev, "failed to get vcc regulator: %d\n", error);
> > +return error;
> > +}
> > +
> > +error = regulator_enable(cyapa->vcc);
> > +if (error) {
> > +dev_err(dev, "failed to enable regulator: %d\n", error);
> > +return error;
> > +}
> > +
> > +error = devm_add_action(dev, cyapa_disable_regulator, cyapa);
> > +if (error) {
> > +cyapa_disable_regulator(cyapa);
> > +dev_err(dev, "failed to add disable regulator action: %d\n",
> > +error);
> > +return error;
> > +}
> > +
> >  error = cyapa_initialize(cyapa);
> >  if (error) {
> >  dev_err(dev, "failed to detect and initialize tp device.\n");
> > diff --git a/drivers/input/mouse/cyapa.h b/drivers/input/mouse/cyapa.h
> > index af12536..b812bba 100644
> > --- a/drivers/input/mouse/cyapa.h
> > +++ b/drivers/input/mouse/cyapa.h
> > @@ -321,6 +321,7 @@ struct cyapa {
> >  u8 status[BL_STATUS_SIZE];
> >  bool operational; /* true: ready for data reporting; false: not. */
> >
> > +struct regulator *vcc;
> >  struct i2c_client *client;
> >  struct input_dev *input;
> >  char phys[32];/* Device physical location */
> > --
> > 1.9.1
> >
> >
> > ---------------------------------------------------------------
> > This message and any attachments may contain Cypress (or its
> > subsidiaries) confidential information. If it has been received
> > in error, please advise the sender and immediately delete this
> > message.
> > ---------------------------------------------------------------
> >
>
> --
> Dmitry

This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.

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

end of thread, other threads:[~2015-07-31  1:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-24  5:05 [PATCH 0/3] cyapa patches instruction Dudley Du
2015-07-24  5:05 ` [PATCH 1/3] input: cyapa: add regulator vcc support Dudley Du
2015-07-30 18:33   ` Dmitry Torokhov
2015-07-31  1:45     ` Dudley Du
2015-07-24  5:05 ` [PATCH 2/3] input: cyapa: add of match device support and description document Dudley Du
2015-07-30 18:33   ` Dmitry Torokhov
2015-07-24  5:05 ` [PATCH 3/3] input: cyapa: fix output unwanted warning issue Dudley Du
2015-07-30 18:33   ` Dmitry Torokhov

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).