Message ID | 1611002626-5889-5-git-send-email-jeff@labundy.com |
---|---|
State | New |
Headers | show |
Series | input: iqs5xx: Minor enhancements and optimizations | expand |
Hi Jeff, On Mon, Jan 18, 2021 at 02:43:40PM -0600, Jeff LaBundy wrote: > 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). No, let's not overload this attribute and instead create a dedicated fw_version or similar read-only attribute to expose active firmware version to userspace. Thanks. -- Dmitry
Hi Dmitry, Thank you for taking a look at this series and I do apologize for the complaint from the bot this morning. On Sun, Jan 24, 2021 at 08:22:01PM -0800, Dmitry Torokhov wrote: > Hi Jeff, > > On Mon, Jan 18, 2021 at 02:43:40PM -0600, Jeff LaBundy wrote: > > 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). > > No, let's not overload this attribute and instead create a dedicated > fw_version or similar read-only attribute to expose active firmware > version to userspace. Not a problem; I'll create a new R/O attribute for this purpose. > > Thanks. > > -- > Dmitry Kind regards, Jeff LaBundy
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,
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(-)