Input: atmel_mxt_ts - allow specification of config name
diff mbox series

Message ID 20190712135338.6211-1-l.stach@pengutronix.de
State Changes Requested
Headers show
Series
  • Input: atmel_mxt_ts - allow specification of config name
Related show

Checks

Context Check Description
robh/checkpatch warning "total: 0 errors, 1 warnings, 33 lines checked"

Commit Message

Lucas Stach July 12, 2019, 1:53 p.m. UTC
From: Nick Dyer <nick@shmanahar.org>

Some systems require different touchscreen configurations depending on the
populated touchscreen. To allow different configs to co-exist in the file
system we need a way to tell the driver, which config should be loaded.

Signed-off-by: Nick Dyer <nick@shmanahar.org>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
lst:
- switch to property name to not use underscore
- Add more elaborate commit message
---
 Documentation/devicetree/bindings/input/atmel,maxtouch.txt | 3 +++
 drivers/input/touchscreen/atmel_mxt_ts.c                   | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

Comments

Dmitry Torokhov July 17, 2019, 3:33 a.m. UTC | #1
Hi Lucas,

On Fri, Jul 12, 2019 at 03:53:38PM +0200, Lucas Stach wrote:
> From: Nick Dyer <nick@shmanahar.org>
> 
> Some systems require different touchscreen configurations depending on the
> populated touchscreen. To allow different configs to co-exist in the file
> system we need a way to tell the driver, which config should be loaded.
> 
> Signed-off-by: Nick Dyer <nick@shmanahar.org>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> lst:
> - switch to property name to not use underscore
> - Add more elaborate commit message

I believe we have already discussed this patch and back then I said that
the "atmel" prefix was not appropriate, as it describes not hardware
specifics but rather Linux kernel behavior and therefore we should be
using "linux,cfg-name" as the property. Unfortunately that version of
the patch got lost in my mailbox.

I will fish it out and apply.

Thanks.

Patch
diff mbox series

diff --git a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
index c88919480d37..dd2c278824b8 100644
--- a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
+++ b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
@@ -31,6 +31,9 @@  Optional properties for main touchpad device:
 
 - reset-gpios: GPIO specifier for the touchscreen's reset pin (active low)
 
+- atmel,cfg-name: Provide name of configuration file in OBP_RAW format. This
+    will be downloaded from the firmware loader on probe to the device.
+
 Example:
 
 	touch@4b {
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 19378f200c63..c37c5ab8d847 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -318,6 +318,7 @@  struct mxt_data {
 	struct t7_config t7_cfg;
 	struct mxt_dbg dbg;
 	struct gpio_desc *reset_gpio;
+	const char *cfg_name;
 
 	/* Cached parameters from object table */
 	u16 T5_address;
@@ -2151,7 +2152,8 @@  static int mxt_initialize(struct mxt_data *data)
 	if (error)
 		return error;
 
-	error = request_firmware_nowait(THIS_MODULE, true, MXT_CFG_NAME,
+	error = request_firmware_nowait(THIS_MODULE, true,
+					data->cfg_name ? : MXT_CFG_NAME,
 					&client->dev, GFP_KERNEL, data,
 					mxt_config_cb);
 	if (error) {
@@ -3015,6 +3017,8 @@  static int mxt_parse_device_properties(struct mxt_data *data)
 		data->t19_num_keys = n_keys;
 	}
 
+	device_property_read_string(dev, "atmel,cfg-name", &data->cfg_name);
+
 	return 0;
 }