Skip to content

Commit

Permalink
wifi: mt76: mt7921: move hif_ops macro in mt792x.h
Browse files Browse the repository at this point in the history
Move the following hif_ops macro in mt792x.h:
- mt7925_init_reset
- mt7925_dev_reset
- mt7925_mcu_init
- __mt7925_mcu_drv_pmctrl
- __mt7925_mcu_fw_pmctrl

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
LorenzoBianconi authored and nbd168 committed Jul 26, 2023
1 parent ff65517 commit 5c04132
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions drivers/net/wireless/mediatek/mt76/mt7921/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static int __mt7921_init_hardware(struct mt792x_dev *dev)
* which should be set before firmware download stage.
*/
mt76_wr(dev, MT_SWDEF_MODE, MT_SWDEF_NORMAL_MODE);
ret = mt7921_mcu_init(dev);
ret = mt792x_mcu_init(dev);
if (ret)
goto out;

Expand All @@ -133,7 +133,7 @@ static int mt7921_init_hardware(struct mt792x_dev *dev)
if (!ret)
break;

mt7921_init_reset(dev);
mt792x_init_reset(dev);
}

if (i == MT7921_MCU_INIT_RETRY_COUNT) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/mediatek/mt76/mt7921/mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ void mt7921_mac_reset_work(struct work_struct *work)

for (i = 0; i < 10; i++) {
mutex_lock(&dev->mt76.mutex);
ret = mt7921_dev_reset(dev);
ret = mt792x_dev_reset(dev);
mutex_unlock(&dev->mt76.mutex);

if (!ret)
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,9 @@ static int mt7921_load_firmware(struct mt792x_dev *dev)

if (mt76_is_sdio(&dev->mt76)) {
/* activate again */
ret = __mt7921_mcu_fw_pmctrl(dev);
ret = __mt792x_mcu_fw_pmctrl(dev);
if (!ret)
ret = __mt7921_mcu_drv_pmctrl(dev);
ret = __mt792x_mcu_drv_pmctrl(dev);
}

ret = mt76_connac2_load_ram(&dev->mt76, mt7921_ram_name(dev), NULL);
Expand Down Expand Up @@ -953,7 +953,7 @@ int mt7921_mcu_drv_pmctrl(struct mt792x_dev *dev)
if (!test_bit(MT76_STATE_PM, &mphy->state))
goto out;

err = __mt7921_mcu_drv_pmctrl(dev);
err = __mt792x_mcu_drv_pmctrl(dev);
out:
mutex_unlock(&pm->mutex);

Expand All @@ -975,7 +975,7 @@ int mt7921_mcu_fw_pmctrl(struct mt792x_dev *dev)
if (mt76_connac_skip_fw_pmctrl(mphy, pm))
goto out;

err = __mt7921_mcu_fw_pmctrl(dev);
err = __mt792x_mcu_fw_pmctrl(dev);
out:
mutex_unlock(&pm->mutex);

Expand Down
6 changes: 0 additions & 6 deletions drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,6 @@ enum mt7921_eeprom_field {

#define MT_EE_HW_TYPE_ENCAP BIT(0)

#define mt7921_init_reset(dev) ((dev)->hif_ops->init_reset(dev))
#define mt7921_dev_reset(dev) ((dev)->hif_ops->reset(dev))
#define mt7921_mcu_init(dev) ((dev)->hif_ops->mcu_init(dev))
#define __mt7921_mcu_drv_pmctrl(dev) ((dev)->hif_ops->drv_own(dev))
#define __mt7921_mcu_fw_pmctrl(dev) ((dev)->hif_ops->fw_own(dev))

enum {
TXPWR_USER,
TXPWR_EEPROM,
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/mediatek/mt76/mt7921/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static void mt7921e_unregister_device(struct mt792x_dev *dev)
cancel_work_sync(&dev->reset_work);

mt76_connac2_tx_token_put(&dev->mt76);
__mt7921_mcu_drv_pmctrl(dev);
__mt792x_mcu_drv_pmctrl(dev);
mt792x_dma_cleanup(dev);
mt792x_wfsys_reset(dev);
skb_queue_purge(&dev->mt76.mcu.res_q);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/mediatek/mt76/mt7921/testmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ mt7921_tm_set(struct mt792x_dev *dev, struct mt7921_tm_cmd *req)
pm->enable = false;
cancel_delayed_work_sync(&pm->ps_work);
cancel_work_sync(&pm->wake_work);
__mt7921_mcu_drv_pmctrl(dev);
__mt792x_mcu_drv_pmctrl(dev);

phy->test.state = MT76_TM_STATE_ON;
}
Expand Down
6 changes: 6 additions & 0 deletions drivers/net/wireless/mediatek/mt76/mt792x.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ struct mt792x_irq_map {
} rx;
};

#define mt792x_init_reset(dev) ((dev)->hif_ops->init_reset(dev))
#define mt792x_dev_reset(dev) ((dev)->hif_ops->reset(dev))
#define mt792x_mcu_init(dev) ((dev)->hif_ops->mcu_init(dev))
#define __mt792x_mcu_drv_pmctrl(dev) ((dev)->hif_ops->drv_own(dev))
#define __mt792x_mcu_fw_pmctrl(dev) ((dev)->hif_ops->fw_own(dev))

struct mt792x_hif_ops {
int (*init_reset)(struct mt792x_dev *dev);
int (*reset)(struct mt792x_dev *dev);
Expand Down

0 comments on commit 5c04132

Please sign in to comment.