From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: duson <dusonlin@emc.com.tw>
Cc: Charlie Mooney <charliemooney@chromium.org>,
linux-input@vger.kernel.org, bleung@chromium.org,
nicolas.iooss_linux@m4x.org,
Charles Mooney <charliemooney@google.com>,
JeffChuang <Jeff.chuang@emc.com.tw>
Subject: Re: [PATCH] input: elan_i2c - Add product IDs FW names
Date: Mon, 8 Jun 2015 17:11:22 -0700 [thread overview]
Message-ID: <20150609001122.GD420@dtor-ws> (raw)
In-Reply-To: <88477951-A1EC-4B02-B745-E946DB0E495F@emc.com.tw>
On Sat, Jun 06, 2015 at 11:01:03AM +0800, duson wrote:
> Hi Charlie,
>
> Thanks for your help to upstream this patch, it is a good idea to update right firmware to right touchpad.
> In order to distinguish between old and new driver, could you also modify the driver version for this patch?
> Thank you very much.
>
> In elan_i2c_core.c
> line 7, * Version: 1.5.7 -> 1.5.8
> line 48, #define ELAN_DRIVER_VERSION “1.5.7” -> “1.5.8"
I changed to to 1.5.9.
>
>
>
> ----------------------------------------------
> Thanks,
> ELAN Duson
> ✉ Email: dusonlin@emc.com.tw
> ----------------------------------------------
>
>
>
>
>
> > Charlie Mooney <charliemooney@chromium.org> 於 2015年6月6日 上午12:25 寫道:
> >
> > Previously the elan_i2c touchpad driver would simply request the
> > firmware "/lib/firmware/elan_i2c.bin"
> >
> > This CL appends the "product ID" (by using the same function as
> > the sysfs interface for consistency) to the filename. This results in
> > filenames of the form "/lib/firmware/elan_i2c_72.0.bin", allowing you
> > to support multiple elan_i2c touchpads on the same device by simply
> > naming each device's FW with its corresponding product ID. This way
> > when you trigger a fw update the driver will load the correct binary.
> >
> > Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
> > ---
> > drivers/input/mouse/elan_i2c.h | 4 +++-
> > drivers/input/mouse/elan_i2c_core.c | 19 +++++++++++++++----
> > 2 files changed, 18 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h
> > index 6d5f8a4..d793184 100644
> > --- a/drivers/input/mouse/elan_i2c.h
> > +++ b/drivers/input/mouse/elan_i2c.h
> > @@ -28,7 +28,9 @@
> > #define ETP_PRESSURE_OFFSET 25
> >
> > /* IAP Firmware handling */
> > -#define ETP_FW_NAME "elan_i2c.bin"
> > +#define ETP_FW_BASENAME "elan_i2c"
> > +#define ETP_FW_EXTENSION "bin"
> > +#define ETP_PRODUCT_ID_FORMAT_STRING "%d.0"
I adjusted ETP_FW_NAME to be:
"elan_i2c_" ETP_PRODUCT_ID_FORMAT_STRING ".bin"
and got rid of ETP_FW_BASENAME and ETP_FW_EXTENSION.
> > #define ETP_IAP_START_ADDR 0x0083
> > #define ETP_FW_IAP_PAGE_ERR (1 << 5)
> > #define ETP_FW_IAP_INTF_ERR (1 << 4)
> > diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
> > index fd5068b..fea9837 100644
> > --- a/drivers/input/mouse/elan_i2c_core.c
> > +++ b/drivers/input/mouse/elan_i2c_core.c
> > @@ -403,7 +403,8 @@ static ssize_t elan_sysfs_read_product_id(struct device *dev,
> > struct i2c_client *client = to_i2c_client(dev);
> > struct elan_tp_data *data = i2c_get_clientdata(client);
> >
> > - return sprintf(buf, "%d.0\n", data->product_id);
> > + return sprintf(buf, ETP_PRODUCT_ID_FORMAT_STRING "\n",
> > + data->product_id);
> > }
> >
> > static ssize_t elan_sysfs_read_fw_ver(struct device *dev,
> > @@ -446,10 +447,20 @@ static ssize_t elan_sysfs_update_fw(struct device *dev,
> > const u8 *fw_signature;
> > static const u8 signature[] = {0xAA, 0x55, 0xCC, 0x33, 0xFF, 0xFF};
> >
> > - error = request_firmware(&fw, ETP_FW_NAME, dev);
> > + /* Look for a firmware with the product id appended. */
> > + char *full_fw_name = kasprintf(GFP_KERNEL,
> > + "%s_" ETP_PRODUCT_ID_FORMAT_STRING ".%s",
> > + ETP_FW_BASENAME, data->product_id, ETP_FW_EXTENSION);
> > + if (!full_fw_name) {
> > + dev_err(dev, "failed fw filename memory allocation.");
> > + return -ENOMEM;
> > + }
> > + dev_info(dev, "requesting fw '%s'\n", fw_name);
> > + error = request_firmware(&fw, full_fw_name, dev);
> > + kfree(full_fw_name);
> > if (error) {
> > - dev_err(dev, "cannot load firmware %s: %d\n",
> > - ETP_FW_NAME, error);
> > + dev_err(dev, "cannot load firmware '%s': %d\n",
> > + full_fw_name, error);
We are using freed memory here, I fixed it up.
> > return error;
> > }
> >
> > --
> > 2.1.2
> >
> >
>
Thanks.
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2015-06-09 0:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-05 16:25 [PATCH] input: elan_i2c - Add product IDs FW names Charlie Mooney
2015-06-06 3:01 ` duson
2015-06-09 0:11 ` 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=20150609001122.GD420@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=Jeff.chuang@emc.com.tw \
--cc=bleung@chromium.org \
--cc=charliemooney@chromium.org \
--cc=charliemooney@google.com \
--cc=dusonlin@emc.com.tw \
--cc=linux-input@vger.kernel.org \
--cc=nicolas.iooss_linux@m4x.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).