linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Sangwon Jee <jeesw@melfas.com>
Cc: linux-input@vger.kernel.org
Subject: Re: Input: melfas_mip4 - add hw_version sysfs attribute
Date: Fri, 18 Mar 2016 10:02:04 -0700	[thread overview]
Message-ID: <20160318170204.GB27348@dtor-ws> (raw)
In-Reply-To: <1457778170-31320-1-git-send-email-jeesw@melfas.com>

On Sat, Mar 12, 2016 at 07:22:50PM +0900, Sangwon Jee wrote:
> Add hw_version sysfs attribute for retrieving hardware information
> from firmware.
> 
> Signed-off-by: Sangwon Jee <jeesw@melfas.com>

Applied, thank you.

> ---
>  drivers/input/touchscreen/melfas_mip4.c | 28 +++++++++++++++++++++++++++-
>  1 file changed, 27 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c
> index 89272973..fb5fb91 100644
> --- a/drivers/input/touchscreen/melfas_mip4.c
> +++ b/drivers/input/touchscreen/melfas_mip4.c
> @@ -1310,8 +1310,34 @@ static ssize_t mip4_sysfs_read_fw_version(struct device *dev,
>  
>  static DEVICE_ATTR(fw_version, S_IRUGO, mip4_sysfs_read_fw_version, NULL);
>  
> +static ssize_t mip4_sysfs_read_hw_version(struct device *dev,
> +					  struct device_attribute *attr,
> +					  char *buf)
> +{
> +	struct i2c_client *client = to_i2c_client(dev);
> +	struct mip4_ts *ts = i2c_get_clientdata(client);
> +	size_t count;
> +
> +	/* Take lock to prevent racing with firmware update */
> +	mutex_lock(&ts->input->mutex);
> +
> +	/*
> +	 * product_name shows the name or version of the hardware
> +	 * paired with current firmware in the chip.
> +	 */
> +	count = snprintf(buf, PAGE_SIZE, "%.*s\n",
> +		(int)sizeof(ts->product_name), ts->product_name);
> +
> +	mutex_unlock(&ts->input->mutex);
> +
> +	return count;
> +}
> +
> +static DEVICE_ATTR(hw_version, S_IRUGO, mip4_sysfs_read_hw_version, NULL);
> +
>  static struct attribute *mip4_attrs[] = {
>  	&dev_attr_fw_version.attr,
> +	&dev_attr_hw_version.attr,
>  	&dev_attr_update_fw.attr,
>  	NULL,
>  };
> @@ -1512,6 +1538,6 @@ static struct i2c_driver mip4_driver = {
>  module_i2c_driver(mip4_driver);
>  
>  MODULE_DESCRIPTION("MELFAS MIP4 Touchscreen");
> -MODULE_VERSION("2016.03.03");
> +MODULE_VERSION("2016.03.12");
>  MODULE_AUTHOR("Sangwon Jee <jeesw@melfas.com>");
>  MODULE_LICENSE("GPL");
> -- 
> 1.9.1
> 

-- 
Dmitry

      reply	other threads:[~2016-03-18 17:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-12 10:22 Input: melfas_mip4 - add hw_version sysfs attribute Sangwon Jee
2016-03-18 17:02 ` Dmitry Torokhov [this message]

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=20160318170204.GB27348@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=jeesw@melfas.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).