diff --git a/mt7915/regs.h b/mt7915/regs.h index 71f325ae..8fe24ab4 100644 --- a/mt7915/regs.h +++ b/mt7915/regs.h @@ -781,7 +781,8 @@ enum offs_rev { /* ADIE */ #define MT_ADIE_CHIP_ID 0x02c #define MT_ADIE_CHIP_ID_MASK GENMASK(31, 16) -#define MT_ADIE_IDX(x) ((x) ? GENMASK(31, 16) : GENMASK(15, 0)) +#define MT_ADIE_IDX0 GENMASK(15, 0) +#define MT_ADIE_IDX1 GENMASK(31, 16) #define MT_ADIE_RG_TOP_THADC_BG 0x034 #define MT_ADIE_VRPI_SEL_CR_MASK GENMASK(15, 12) diff --git a/mt7915/soc.c b/mt7915/soc.c index decf2885..8e2d46a4 100644 --- a/mt7915/soc.c +++ b/mt7915/soc.c @@ -327,14 +327,22 @@ out: return 0; } +static inline u16 mt7986_adie_idx(u8 adie, u32 adie_type) +{ + if (adie == 0) + return u32_get_bits(adie_type, MT_ADIE_IDX0); + else + return u32_get_bits(adie_type, MT_ADIE_IDX1); +} + static inline bool is_7975(struct mt7915_dev *dev, u8 adie, u32 adie_type) { - return u32_get_bits(adie_type, MT_ADIE_IDX(adie)) == 0x7975; + return mt7986_adie_idx(adie, adie_type) == 0x7975; } static inline bool is_7976(struct mt7915_dev *dev, u8 adie, u32 adie_type) { - return u32_get_bits(adie_type, MT_ADIE_IDX(adie)) == 0x7976; + return mt7986_adie_idx(adie, adie_type) == 0x7976; } static int mt7986_wmac_adie_thermal_cal(struct mt7915_dev *dev, u8 adie)