From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758588AbcHDK6X (ORCPT ); Thu, 4 Aug 2016 06:58:23 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36034 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751024AbcHDK6U (ORCPT ); Thu, 4 Aug 2016 06:58:20 -0400 Date: Thu, 4 Aug 2016 12:58:15 +0200 From: Daniel Vetter To: Enric Balletbo Serra Cc: Daniel Vetter , Daniel Kurtz , Mark Rutland , stonea168@163.com, ML dri-devel , Ajay Kumar , Vincent Palatin , cawa cheng , Russell King , Thierry Reding , devicetree , Jitao Shi , Pawel Moll , Ian Campbell , Rob Herring , "moderated list:ARM/Mediatek SoC support" , Yingjoe Chen , Matthias Brugger , Eddie Huang =?utf-8?B?KOm7g+aZuuWCkSk=?= , LAKML , Rahul Sharma , srv_heupstream , Emil Velikov , "Linux-Kernel@Vger. Kernel. Org" , Sascha Hauer , Kumar Gala , Andy Yan Subject: Re: [PATCH 2/2 v16] drm/bridge: Add I2C based driver for ps8640 bridge Message-ID: <20160804105814.GH6232@phenom.ffwll.local> Mail-Followup-To: Enric Balletbo Serra , Daniel Kurtz , Mark Rutland , stonea168@163.com, ML dri-devel , Ajay Kumar , Vincent Palatin , cawa cheng , Russell King , Thierry Reding , devicetree , Jitao Shi , Pawel Moll , Ian Campbell , Rob Herring , "moderated list:ARM/Mediatek SoC support" , Yingjoe Chen , Matthias Brugger , Eddie Huang =?utf-8?B?KOm7g+aZuuWCkSk=?= , LAKML , Rahul Sharma , srv_heupstream , Emil Velikov , "Linux-Kernel@Vger. Kernel. Org" , Sascha Hauer , Kumar Gala , Andy Yan References: <1464861445-11086-1-git-send-email-jitao.shi@mediatek.com> <1464861445-11086-2-git-send-email-jitao.shi@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 4.6.0-1-amd64 User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 04, 2016 at 12:35:59PM +0200, Enric Balletbo Serra wrote: > 2016-07-12 12:13 GMT+02:00 Daniel Vetter : > > On Wed, Jun 29, 2016 at 6:31 AM, Daniel Kurtz wrote: > >> On Fri, Jun 17, 2016 at 3:14 AM, Emil Velikov wrote: > >>>> +static ssize_t ps8640_update_fw_store(struct device *dev, > >>>> + struct device_attribute *attr, > >>>> + const char *buf, size_t count) > >>>> +{ > >>>> + struct i2c_client *client = to_i2c_client(dev); > >>>> + struct ps8640 *ps_bridge = i2c_get_clientdata(client); > >>>> + const struct firmware *fw; > >>>> + int error; > >>>> + > >>>> + error = request_firmware(&fw, PS_FW_NAME, dev); > >>> Can the device operate without a firmware ? If not, why is the > >>> firmware loaded so later/after user interaction (via sysfs) ? I don't > >>> recall any other driver in DRM to use such an approach. > >> > >> The PS8640 has internal flash, so it should always already have a > >> working firmware. > >> This sysfs interface is useful for user space initiated field firmware updates. > > > > Might be better to just do a request_firmware on driver load, and > > simply proceed if it's not there. Adding a sysfs interface (which is > > abi) seems way too much overkill for this imo. If you want to upgrade > > the firmware you can then just drop it into the right directory, with > > no further interaction needed. > > IMHO I'm not sure if for this use case request_firmware on driver load > is a good idea. Flash the non-volatile internal chip can be a slow > operation and if you forget to remove the firmware after drop it into > the right directory apart from slow down the driver probe you can > damage the chip depending on the write endurance of the chip. Ah ok. Explaining this in the commit message would be really good. > This sysfs interface is used on other subsystems when there is a > non-volatile memory, as example you can see at [1], [2]. Unfortunately > not all are using the same sysfs interface and maybe this should be > standardized (maybe it's an opportunity to define it) +1 on standardizing this. -Daniel > > Regards, > Enric > > [1] http://lxr.free-electrons.com/source/drivers/input/touchscreen/wdt87xx_i2c.c#L922 > [2] http://lxr.free-electrons.com/source/drivers/scsi/pm8001/pm8001_ctl.c#L732 > > > > -Daniel > > -- > > Daniel Vetter > > Software Engineer, Intel Corporation > > +41 (0) 79 365 57 48 - http://blog.ffwll.ch > > _______________________________________________ > > dri-devel mailing list > > dri-devel@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 2/2 v16] drm/bridge: Add I2C based driver for ps8640 bridge Date: Thu, 4 Aug 2016 12:58:15 +0200 Message-ID: <20160804105814.GH6232@phenom.ffwll.local> References: <1464861445-11086-1-git-send-email-jitao.shi@mediatek.com> <1464861445-11086-2-git-send-email-jitao.shi@mediatek.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Enric Balletbo Serra Cc: Daniel Vetter , Daniel Kurtz , Mark Rutland , stonea168@163.com, ML dri-devel , Ajay Kumar , Vincent Palatin , cawa cheng , Russell King , Thierry Reding , devicetree , Jitao Shi , Pawel Moll , Ian Campbell , Rob Herring , "moderated list:ARM/Mediatek SoC support" , Yingjoe Chen , Matthias Brugger , Eddie Huang =?utf-8?B?KOm7g+aZuuWCkSk=?= , LAKML , Rahul Sharma List-Id: devicetree@vger.kernel.org On Thu, Aug 04, 2016 at 12:35:59PM +0200, Enric Balletbo Serra wrote: > 2016-07-12 12:13 GMT+02:00 Daniel Vetter : > > On Wed, Jun 29, 2016 at 6:31 AM, Daniel Kurtz wrote: > >> On Fri, Jun 17, 2016 at 3:14 AM, Emil Velikov wrote: > >>>> +static ssize_t ps8640_update_fw_store(struct device *dev, > >>>> + struct device_attribute *attr, > >>>> + const char *buf, size_t count) > >>>> +{ > >>>> + struct i2c_client *client = to_i2c_client(dev); > >>>> + struct ps8640 *ps_bridge = i2c_get_clientdata(client); > >>>> + const struct firmware *fw; > >>>> + int error; > >>>> + > >>>> + error = request_firmware(&fw, PS_FW_NAME, dev); > >>> Can the device operate without a firmware ? If not, why is the > >>> firmware loaded so later/after user interaction (via sysfs) ? I don't > >>> recall any other driver in DRM to use such an approach. > >> > >> The PS8640 has internal flash, so it should always already have a > >> working firmware. > >> This sysfs interface is useful for user space initiated field firmware updates. > > > > Might be better to just do a request_firmware on driver load, and > > simply proceed if it's not there. Adding a sysfs interface (which is > > abi) seems way too much overkill for this imo. If you want to upgrade > > the firmware you can then just drop it into the right directory, with > > no further interaction needed. > > IMHO I'm not sure if for this use case request_firmware on driver load > is a good idea. Flash the non-volatile internal chip can be a slow > operation and if you forget to remove the firmware after drop it into > the right directory apart from slow down the driver probe you can > damage the chip depending on the write endurance of the chip. Ah ok. Explaining this in the commit message would be really good. > This sysfs interface is used on other subsystems when there is a > non-volatile memory, as example you can see at [1], [2]. Unfortunately > not all are using the same sysfs interface and maybe this should be > standardized (maybe it's an opportunity to define it) +1 on standardizing this. -Daniel > > Regards, > Enric > > [1] http://lxr.free-electrons.com/source/drivers/input/touchscreen/wdt87xx_i2c.c#L922 > [2] http://lxr.free-electrons.com/source/drivers/scsi/pm8001/pm8001_ctl.c#L732 > > > > -Daniel > > -- > > Daniel Vetter > > Software Engineer, Intel Corporation > > +41 (0) 79 365 57 48 - http://blog.ffwll.ch > > _______________________________________________ > > dri-devel mailing list > > dri-devel@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch From mboxrd@z Thu Jan 1 00:00:00 1970 From: daniel@ffwll.ch (Daniel Vetter) Date: Thu, 4 Aug 2016 12:58:15 +0200 Subject: [PATCH 2/2 v16] drm/bridge: Add I2C based driver for ps8640 bridge In-Reply-To: References: <1464861445-11086-1-git-send-email-jitao.shi@mediatek.com> <1464861445-11086-2-git-send-email-jitao.shi@mediatek.com> Message-ID: <20160804105814.GH6232@phenom.ffwll.local> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Thu, Aug 04, 2016 at 12:35:59PM +0200, Enric Balletbo Serra wrote: > 2016-07-12 12:13 GMT+02:00 Daniel Vetter : > > On Wed, Jun 29, 2016 at 6:31 AM, Daniel Kurtz wrote: > >> On Fri, Jun 17, 2016 at 3:14 AM, Emil Velikov wrote: > >>>> +static ssize_t ps8640_update_fw_store(struct device *dev, > >>>> + struct device_attribute *attr, > >>>> + const char *buf, size_t count) > >>>> +{ > >>>> + struct i2c_client *client = to_i2c_client(dev); > >>>> + struct ps8640 *ps_bridge = i2c_get_clientdata(client); > >>>> + const struct firmware *fw; > >>>> + int error; > >>>> + > >>>> + error = request_firmware(&fw, PS_FW_NAME, dev); > >>> Can the device operate without a firmware ? If not, why is the > >>> firmware loaded so later/after user interaction (via sysfs) ? I don't > >>> recall any other driver in DRM to use such an approach. > >> > >> The PS8640 has internal flash, so it should always already have a > >> working firmware. > >> This sysfs interface is useful for user space initiated field firmware updates. > > > > Might be better to just do a request_firmware on driver load, and > > simply proceed if it's not there. Adding a sysfs interface (which is > > abi) seems way too much overkill for this imo. If you want to upgrade > > the firmware you can then just drop it into the right directory, with > > no further interaction needed. > > IMHO I'm not sure if for this use case request_firmware on driver load > is a good idea. Flash the non-volatile internal chip can be a slow > operation and if you forget to remove the firmware after drop it into > the right directory apart from slow down the driver probe you can > damage the chip depending on the write endurance of the chip. Ah ok. Explaining this in the commit message would be really good. > This sysfs interface is used on other subsystems when there is a > non-volatile memory, as example you can see at [1], [2]. Unfortunately > not all are using the same sysfs interface and maybe this should be > standardized (maybe it's an opportunity to define it) +1 on standardizing this. -Daniel > > Regards, > Enric > > [1] http://lxr.free-electrons.com/source/drivers/input/touchscreen/wdt87xx_i2c.c#L922 > [2] http://lxr.free-electrons.com/source/drivers/scsi/pm8001/pm8001_ctl.c#L732 > > > > -Daniel > > -- > > Daniel Vetter > > Software Engineer, Intel Corporation > > +41 (0) 79 365 57 48 - http://blog.ffwll.ch > > _______________________________________________ > > dri-devel mailing list > > dri-devel at lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch