mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
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: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
@@ -28,7 +28,15 @@ static int mt7915_eeprom_load_precal(struct mt7915_dev *dev)
|
|||||||
if (!ret)
|
if (!ret)
|
||||||
return 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)
|
static int mt7915_check_eeprom(struct mt7915_dev *dev)
|
||||||
@@ -254,10 +262,7 @@ int mt7915_eeprom_init(struct mt7915_dev *dev)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = mt7915_eeprom_load_precal(dev);
|
mt7915_eeprom_load_precal(dev);
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
mt7915_eeprom_parse_hw_cap(dev, &dev->phy);
|
mt7915_eeprom_parse_hw_cap(dev, &dev->phy);
|
||||||
memcpy(dev->mphy.macaddr, dev->mt76.eeprom.data + MT_EE_MAC_ADDR,
|
memcpy(dev->mphy.macaddr, dev->mt76.eeprom.data + MT_EE_MAC_ADDR,
|
||||||
ETH_ALEN);
|
ETH_ALEN);
|
||||||
|
|||||||
@@ -823,7 +823,7 @@ mt7915_init_hardware(struct mt7915_dev *dev, struct mt7915_phy *phy2)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (dev->flash_mode) {
|
if (dev->cal) {
|
||||||
ret = mt7915_mcu_apply_group_cal(dev);
|
ret = mt7915_mcu_apply_group_cal(dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ int mt7915_set_channel(struct mt7915_phy *phy)
|
|||||||
|
|
||||||
mt76_set_channel(phy->mt76);
|
mt76_set_channel(phy->mt76);
|
||||||
|
|
||||||
if (dev->flash_mode) {
|
if (dev->cal) {
|
||||||
ret = mt7915_mcu_apply_tx_dpd(phy);
|
ret = mt7915_mcu_apply_tx_dpd(phy);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|||||||
Reference in New Issue
Block a user