From patchwork Fri Jan 5 12:12:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Jeffrey Lin (???)" X-Patchwork-Id: 10146397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EBF5B604D3 for ; Fri, 5 Jan 2018 12:38:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB92728771 for ; Fri, 5 Jan 2018 12:38:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D00D028898; Fri, 5 Jan 2018 12:38:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7F5F28771 for ; Fri, 5 Jan 2018 12:38:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751067AbeAEMiY (ORCPT ); Fri, 5 Jan 2018 07:38:24 -0500 Received: from 59-124-178-101.HINET-IP.hinet.net ([59.124.178.101]:26348 "EHLO mse2.corp.rad-ic.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751469AbeAEMiW (ORCPT ); Fri, 5 Jan 2018 07:38:22 -0500 X-Greylist: delayed 1529 seconds by postgrey-1.27 at vger.kernel.org; Fri, 05 Jan 2018 07:38:22 EST Received: from mse2.corp.rad-ic.com (localhost [127.0.0.2] (may be forged)) by mse2.corp.rad-ic.com with ESMTP id w05CCtnJ054007 for ; Fri, 5 Jan 2018 20:12:55 +0800 (GMT-8) (envelope-from Jeffrey.Lin@rad-ic.com) Received: from RADHCMS4.corp.rad-ic.com ([192.168.2.26]) by mse2.corp.rad-ic.com with ESMTP id w05CCMDV053981; Fri, 5 Jan 2018 20:12:23 +0800 (GMT-8) (envelope-from Jeffrey.Lin@rad-ic.com) Received: from RADHCMS7.corp.rad-ic.com (192.168.2.52) by RADHCMS4.corp.rad-ic.com (192.168.2.26) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 5 Jan 2018 20:12:19 +0800 Received: from RADHCMS5.corp.rad-ic.com ([::1]) by RADHCMS7.corp.rad-ic.com ([fe80::c0ff:d6d2:66c3:cfcc%13]) with mapi id 14.03.0339.000; Fri, 5 Jan 2018 20:12:19 +0800 From: =?big5?B?SmVmZnJleSBMaW4gKKpMuHGzuSk=?= To: Dmitry Torokhov , "jeffrey.lin" CC: "groeck@chromium.org" , "keith.tzeng@quantatw.com" , "Katherine.Hsieh@quantatw.com" , "bleung@google.com" , =?big5?B?S1AgTGkgKKf1qfitvyk=?= , =?big5?B?QWxiZXJ0IFNoaWVoICjBwqpZ3rMp?= , =?big5?B?Q2FsdmluIFRzZW5nICAotL+w6ql2KQ==?= , "linux-kernel@vger.kernel.org" , "linux-input@vger.kernel.org" , =?big5?B?S2V2aW4gQ2hpdSAoqvSrVLrNKQ==?= , =?big5?B?SmFja3kgTGluICiqTKthqfop?= Subject: RE: [PATCH] driver: input :touchscreen :Modify Raydium Firmware update input file Thread-Topic: [PATCH] driver: input :touchscreen :Modify Raydium Firmware update input file Thread-Index: AQHThemRfSrhVm924ES5jvBNXRqDhKNlL+ew Date: Fri, 5 Jan 2018 12:12:18 +0000 Message-ID: <9BE4B49389AB2F41A64A32DFC844F1DF759C9C14@RADHCMS5.corp.rad-ic.com> References: <20171221135122.345-1-jeffrey.lin@raydium.corp-partner.google.com> <20180105055338.cogtaty5p5r5gglt@dtor-ws> In-Reply-To: <20180105055338.cogtaty5p5r5gglt@dtor-ws> Accept-Language: zh-TW, en-US Content-Language: zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.17.7.166] MIME-Version: 1.0 X-MAIL: mse2.corp.rad-ic.com w05CCMDV053981 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Dmitry: I've verified pass the patch you had modified. Many thanks. Best Regards ---------------------------------------------------------------------- Jeffrey Lin, 林義章 Raydium Semiconductor Corporation, 瑞鼎科技 Tel:(03)666-1818 Ext.4163 Fax:(03)666-1919 -----Original Message----- From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com] Sent: Friday, January 05, 2018 1:54 PM To: jeffrey.lin Cc: groeck@chromium.org; keith.tzeng@quantatw.com; Katherine.Hsieh@quantatw.com; bleung@google.com; Jeffrey Lin (林義章); KP Li (李昆倍); Albert Shieh (謝欣瑋); Calvin Tseng (曾國宗); linux-kernel@vger.kernel.org; linux-input@vger.kernel.org Subject: Re: [PATCH] driver: input :touchscreen :Modify Raydium Firmware update input file Hi Jeffrey, On Thu, Dec 21, 2017 at 09:51:22PM +0800, jeffrey.lin wrote: > Modify update firmware to accept alternative file name > > Signed-off-by: jeffrey.lin > --- > drivers/input/touchscreen/raydium_i2c_ts.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c > index a99fb5cac5a0..439d43c3519c 100644 > --- a/drivers/input/touchscreen/raydium_i2c_ts.c > +++ b/drivers/input/touchscreen/raydium_i2c_ts.c > @@ -130,6 +130,7 @@ struct raydium_data { > struct gpio_desc *reset_gpio; > > struct raydium_info info; > + char fw_file[64]; You do not really need to keep the firmware name in driver data, just use a temporary in raydium_i2c_fw_update(). > > struct mutex sysfs_mutex; > > @@ -752,12 +753,16 @@ static int raydium_i2c_fw_update(struct raydium_data *ts) > { > struct i2c_client *client = ts->client; > const struct firmware *fw = NULL; > - const char *fw_file = "raydium.fw"; > int error; > > - error = request_firmware(&fw, fw_file, &client->dev); > + /* Firmware name */ > + snprintf(ts->fw_file, sizeof(ts->fw_file), > + "raydium_%x.fw", ts->info.hw_ver); hw_ver is LE32, you need to convert it to CPU endianness before using. Also it would be better if we used the same encoding for the hardware version as the one that we use when we output it in sysfs. It makes userspace life a bit easier I think. How about the version of the patch below? Thanks. --- Dmitry Input: raydium_i2c_ts - include hardware version in firmware name From: Jeffrey Lin Add hardware version to the firmware file name to handle scenarios where single system image supports variety of devices. Signed-off-by: Jeffrey Lin Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/raydium_i2c_ts.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) CONFIDENTIALITY AND PROPRIETARY REMINDER: This message and any attachment may contain confidential information. All rights including intellectual property rights arising out of this correspondence shall belong to Raydium Semiconductor Corp. Any unauthorized disclosure, forwarding, using, modifying, spreading, publishing or copying this email and the content is illegal and strictly prohibited. If you are not the intended recipient, please notify the sender by replying to this message and delete all copies of it from your system. Thank you for cooperation. diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c index 100538d64fff..d1c09e6a2cb6 100644 --- a/drivers/input/touchscreen/raydium_i2c_ts.c +++ b/drivers/input/touchscreen/raydium_i2c_ts.c @@ -752,13 +752,20 @@ static int raydium_i2c_fw_update(struct raydium_data *ts) { struct i2c_client *client = ts->client; const struct firmware *fw = NULL; - const char *fw_file = "raydium.fw"; + char *fw_file; int error; + fw_file = kasprintf(GFP_KERNEL, "raydium_%#04x.fw", + le32_to_cpu(ts->info.hw_ver)); + if (!fw_file) + return -ENOMEM; + + dev_dbg(&client->dev, "firmware name: %s\n", fw_file); + error = request_firmware(&fw, fw_file, &client->dev); if (error) { dev_err(&client->dev, "Unable to open firmware %s\n", fw_file); - return error; + goto out_free_fw_file; } disable_irq(client->irq); @@ -787,6 +794,9 @@ static int raydium_i2c_fw_update(struct raydium_data *ts) release_firmware(fw); +out_free_fw_file: + kfree(fw_file); + return error; }