lkml.org 
[lkml]   [2015]   [Mar]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] firmware_class: Add firmware filename overrides
Specifically this was motivated by a situation where we have one
device with a dual-sourced touchscreen. Both use the same driver but
have different hardware & fw. Our FW updating software therefore,
needs to be able to update with the correct FW and detect all this at
runtime due to a read-only partition (so moving the firmware binaries
around isn't really an option)
Here the device has only one touchscreen at a time, but it isn't known
until run-time which will be present.

So in this case the driver is serving the same function in each
situation (running a touchscreen) but may be working with different
hardware.

Another situation where I've personally wanted this functionality is
on a device that uses the same touch driver for both a touchscreen and
a touchpad on the same device. If the driver only grabs a copy of FW
from, say, /lib/firmware/touch_fw.bin then you either need to move the
firmware binaries around on disk to update either device, or have a
change like this that allows you to override which filename it loads.
The moving option is not viable if you're using a RO filesystem.

-Charlie

On Thu, Mar 5, 2015 at 12:14 AM Ming Lei <ming.lei@canonical.com> wrote:

On Thu, Mar 5, 2015 at 8:48 AM, Dmitry Torokhov <dtor@chromium.org> wrote:
> On Wed, Mar 04, 2015 at 03:57:09PM -0800, Greg KH wrote:
>> On Wed, Mar 04, 2015 at 03:25:10PM -0800, Charlie Mooney wrote:
>> > This patch adds an additional feature to the firmware_class.c module.
>> > To allow a unified method of specifying new firmware locations when
>> > drivers request a firmware binary to update their devices with, we
>> > have added the concept of a "fw override"
>> >
>> > A fw override is a rule that matches firmware requests based on the
>> > name of the device requesting the fw and what the filename for the
>> > fw they are requesting is, and overrides their requests with a new
>> > value.
>> >
>> > Overrides are set up by piping a description of the override into
>> > an attribute set up at /sys/class/firmware/fw_override. The string
>> > should be a null-deliminited list of the firmware name you want to
>> > over ride, the new name to replace it with, and the device name that
>> > you want the override to apply to. For example you could set up
>> > an override for a device called "my_device" so that any time it
>> > requests a firmware called "my_fw.bin" it instead gets "new_fw.bin"
>> > with the following command:
>> >
>> > echo -e 'my_fw.bin\0new_fw.bin\0my_device\0' >
>> > /sys/class/firmware/fw_override
>>
>> I hate to ask, but I have to, why do you need this?
>
> We may have single driver serve several devices (a touchscreen and a
> touchpad) that require different firmware/config file to function. We have

I remember some wifi drivers have similar usage too: one driver serves
several functions, and each function need its own firmware. So looks
it is fine to use different firmware name for each different function, or
my understanding about the use case is wrong?

Thanks,
Ming Lei

> several options:
>
> - modify the driver to allow changing firmware name from userspace - gets
> old when there are several drivers that need that;
> - encode part numbers in the driver and request different firmware - not
> easily maintainable, still has an issue that same part might be used for
> different devices;
> - replace the firmware file on disk before initiating firmware load - does
> not work well with read-only file systems;
> - have udev supply different data - udev went out of fashion;
> - have one central place (firmware loader) that users can control to
> override the names - this solution.
>
> Thanks.
>
> --
> Dmitry
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/


\
 
 \ /
  Last update: 2015-03-05 18:41    [W:1.545 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site