Commit 95ff66d1 authored by Felix Fietkau's avatar Felix Fietkau

wifi: mt76: mt7915: add fallback in case of missing precal data

When pre-calibration data is missing, do not fail the driver probe.
Instead, just print a warning and fall back to regular calibration.
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 19a954ed
......@@ -28,7 +28,15 @@ static int mt7915_eeprom_load_precal(struct mt7915_dev *dev)
if (!ret)
return ret;
return mt76_get_of_data_from_nvmem(mdev, dev->cal, "precal", size);
ret = mt76_get_of_data_from_nvmem(mdev, dev->cal, "precal", size);
if (!ret)
return ret;
dev_warn(mdev->dev, "missing precal data, size=%d\n", size);
devm_kfree(mdev->dev, dev->cal);
dev->cal = NULL;
return ret;
}
static int mt7915_check_eeprom(struct mt7915_dev *dev)
......@@ -254,10 +262,7 @@ int mt7915_eeprom_init(struct mt7915_dev *dev)
return ret;
}
ret = mt7915_eeprom_load_precal(dev);
if (ret)
return ret;
mt7915_eeprom_load_precal(dev);
mt7915_eeprom_parse_hw_cap(dev, &dev->phy);
memcpy(dev->mphy.macaddr, dev->mt76.eeprom.data + MT_EE_MAC_ADDR,
ETH_ALEN);
......
......@@ -823,7 +823,7 @@ mt7915_init_hardware(struct mt7915_dev *dev, struct mt7915_phy *phy2)
if (ret < 0)
return ret;
if (dev->flash_mode) {
if (dev->cal) {
ret = mt7915_mcu_apply_group_cal(dev);
if (ret)
return ret;
......
......@@ -329,7 +329,7 @@ int mt7915_set_channel(struct mt7915_phy *phy)
mt76_set_channel(phy->mt76);
if (dev->flash_mode) {
if (dev->cal) {
ret = mt7915_mcu_apply_tx_dpd(phy);
if (ret)
goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment