Skip to contentSkip to conversation

mt76: mt7915: add device name in eeprom request

PATCH Felix Fietkau 1 participant 1 message Apr 12, 2022 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 15 lines · Daniel Danzberger

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.

---
  mt7915/eeprom.c |  7 ++++++-
  mt7915/mt7915.h | 16 ++++++++--------
  2 files changed, 14 insertions(+), 9 deletions(-)
mt7915/eeprom.c +0 -0
index 4b1a9811..99c1d650 100644

mt7915/eeprom.c mt7915_eeprom_load_default(struct mt7915_dev *dev) · line 83

Quoted 9 lines
mt7915/eeprom.c +4 -1
@@ -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