linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff LaBundy <jeff@labundy.com>
To: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org, Jeff LaBundy <jeff@labundy.com>
Subject: [PATCH 04/10] input: iqs5xx: Expose firmware revision to user space
Date: Mon, 18 Jan 2021 14:43:40 -0600	[thread overview]
Message-ID: <1611002626-5889-5-git-send-email-jeff@labundy.com> (raw)
In-Reply-To: <1611002626-5889-1-git-send-email-jeff@labundy.com>

The device's firmware accommodates a revision field that customers
can assign when firmware is exported from the vendor's development
tool. Having the ability to read this field from user space can be
useful during development.

As such, promote the fw_file attribute from W/O to R/W. Writing to
the attribute pushes firmware to the device as normal, but reading
from it will now return the customer-assigned revision field as an
unsigned integer (e.g. 256 = 1.0, 257 = 1.1 and so on).

Signed-off-by: Jeff LaBundy <jeff@labundy.com>
---
 drivers/input/touchscreen/iqs5xx.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/iqs5xx.c b/drivers/input/touchscreen/iqs5xx.c
index b2de8c67..5ee22ab 100644
--- a/drivers/input/touchscreen/iqs5xx.c
+++ b/drivers/input/touchscreen/iqs5xx.c
@@ -64,6 +64,7 @@
 #define IQS5XX_XY_CFG0		0x0669
 #define IQS5XX_X_RES		0x066E
 #define IQS5XX_Y_RES		0x0670
+#define IQS5XX_EXP_FILE		0x0677
 #define IQS5XX_CHKSM		0x83C0
 #define IQS5XX_APP		0x8400
 #define IQS5XX_CSTM		0xBE00
@@ -99,6 +100,7 @@ struct iqs5xx_private {
 	struct input_dev *input;
 	struct gpio_desc *reset_gpio;
 	struct mutex lock;
+	u16 exp_file;
 	u8 bl_status;
 };
 
@@ -666,6 +668,10 @@ static int iqs5xx_dev_init(struct i2c_client *client)
 		return -EINVAL;
 	}
 
+	error = iqs5xx_read_word(client, IQS5XX_EXP_FILE, &iqs5xx->exp_file);
+	if (error)
+		return error;
+
 	error = iqs5xx_axis_init(client);
 	if (error)
 		return error;
@@ -1004,7 +1010,15 @@ static ssize_t fw_file_store(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR_WO(fw_file);
+static ssize_t fw_file_show(struct device *dev,
+			    struct device_attribute *attr, char *buf)
+{
+	struct iqs5xx_private *iqs5xx = dev_get_drvdata(dev);
+
+	return scnprintf(buf, PAGE_SIZE, "%u\n", iqs5xx->exp_file);
+}
+
+static DEVICE_ATTR_RW(fw_file);
 
 static struct attribute *iqs5xx_attrs[] = {
 	&dev_attr_fw_file.attr,
-- 
2.7.4


  parent reply	other threads:[~2021-01-18 20:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-18 20:43 [PATCH 00/10] input: iqs5xx: Minor enhancements and optimizations Jeff LaBundy
2021-01-18 20:43 ` [PATCH 01/10] input: iqs5xx: Minor cosmetic improvements Jeff LaBundy
2021-01-25  4:16   ` Dmitry Torokhov
2021-01-18 20:43 ` [PATCH 02/10] input: iqs5xx: Preserve bootloader errors Jeff LaBundy
2021-01-25  4:16   ` Dmitry Torokhov
2021-01-18 20:43 ` [PATCH 03/10] input: iqs5xx: Accommodate bootloader latency Jeff LaBundy
2021-01-25  4:19   ` Dmitry Torokhov
2021-01-18 20:43 ` Jeff LaBundy [this message]
2021-01-25  4:22   ` [PATCH 04/10] input: iqs5xx: Expose firmware revision to user space Dmitry Torokhov
2021-01-26  2:54     ` Jeff LaBundy
2021-01-18 20:43 ` [PATCH 05/10] input: iqs5xx: Re-initialize device upon warm reset Jeff LaBundy
2021-01-25  4:32   ` Dmitry Torokhov
2021-01-18 20:43 ` [PATCH 06/10] input: iqs5xx: Simplify axis setup logic Jeff LaBundy
2021-01-25  4:40   ` Dmitry Torokhov
2021-01-18 20:43 ` [PATCH 07/10] input: iqs5xx: Eliminate unnecessary register read Jeff LaBundy
2021-01-25  4:41   ` Dmitry Torokhov
2021-01-18 20:43 ` [PATCH 08/10] input: iqs5xx: Allow more time for ATI to complete Jeff LaBundy
2021-01-25  4:41   ` Dmitry Torokhov
2021-01-18 20:43 ` [PATCH 09/10] input: iqs5xx: Make reset GPIO optional Jeff LaBundy
2021-01-25  4:43   ` Dmitry Torokhov
2021-01-26  3:10     ` Jeff LaBundy
2021-01-18 20:43 ` [PATCH 10/10] input: iqs5xx: Allow device to be a wake-up source Jeff LaBundy
2021-01-25  4:44   ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1611002626-5889-5-git-send-email-jeff@labundy.com \
    --to=jeff@labundy.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).