2022-04-12 22:55:23

by Felix Fietkau

[permalink] [raw]
Subject: Re: [PATCH] mt76: mt7915: add device name in eeprom request


On 11.04.22 16:23, Daniel Danzberger wrote:
> When an eerpom is requested from userspace via request_firmware, the
> device name is appened to the firmware name so the userspace can load
> different eeproms/caldata for different devices.
>
> Signed-off-by: Daniel Danzberger <[email protected]>
> ---
> mt7915/eeprom.c | 7 ++++++-
> mt7915/mt7915.h | 16 ++++++++--------
> 2 files changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/mt7915/eeprom.c b/mt7915/eeprom.c
> index 4b1a9811..99c1d650 100644
> --- a/mt7915/eeprom.c
> +++ b/mt7915/eeprom.c
> @@ -76,8 +76,13 @@ mt7915_eeprom_load_default(struct mt7915_dev *dev)
> u8 *eeprom = dev->mt76.eeprom.data;
> const struct firmware *fw = NULL;
> int ret;
> + char eeprom_name[100];
>
> - ret = request_firmware(&fw, mt7915_eeprom_name(dev), dev->mt76.dev);
> + scnprintf(eeprom_name, sizeof(eeprom_name),
> + "mediatek/%s-%s.bin",
> + mt7915_eeprom_name(dev), dev_name(dev->mt76.dev));
In order to not break compatibility, please keep the existing code that
loads eeprom files based on the chip name.
For the device name based eeprom file, you don't need to include the
chip id. Just make it mt76-eeprom-<name>.bin or something like that.
I also think you don't need the mediatek/ prefix here, since that's
usually used for files shipped with linux-firmware.git

- Felix