> On 2020-05-20 13:23:35 [+0800], yhchuang@xxxxxxxxxxx wrote: > > From: Tzu-En Huang <tehuang@xxxxxxxxxxx> > > > > In order to get a better tramit EVM, we need to perform calibration > > s/tramit/transmit/ ? > > > after association. > > The calibration needed for 8821c is called iq calibration, which is > > done in firmware. Implement the callback function for triggering > > firmware to do it. > > > > Signed-off-by: Tzu-En Huang <tehuang@xxxxxxxxxxx> > > Signed-off-by: Yan-Hsuan Chuang <yhchuang@xxxxxxxxxxx> > > --- > > drivers/net/wireless/realtek/rtw88/rtw8821c.c | 34 > +++++++++++++++++++ > > 1 file changed, 34 insertions(+) > > > > diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c > b/drivers/net/wireless/realtek/rtw88/rtw8821c.c > > index 7169e6fb9ca9..749569eab912 100644 > > --- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c > > +++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c > > @@ -555,6 +555,39 @@ static void rtw8821c_false_alarm_statistics(struct > rtw_dev *rtwdev) > > rtw_write32_clr(rtwdev, 0xb58, BIT(0)); > > } > > > > +static void rtw8821c_do_iqk(struct rtw_dev *rtwdev) > > +{ > > + static int do_iqk_cnt; > > + struct rtw_iqk_para para = {.clear = 0, .segment_iqk = 0}; > > + u32 rf_reg, iqk_fail_mask; > > + int counter; > > + bool reload; > > + > > + if (rtw_is_assoc(rtwdev)) > > + para.segment_iqk = 1; > > + > > + rtw_fw_do_iqk(rtwdev, ¶); > > + > > + for (counter = 0; counter < 300; counter++) { > > + rf_reg = rtw_read_rf(rtwdev, RF_PATH_A, RF_DTXLOK, > RFREG_MASK); > > + if (rf_reg == 0xabcde) > > + break; > > + msleep(20); > > + } > > + rtw_write_rf(rtwdev, RF_PATH_A, RF_DTXLOK, RFREG_MASK, 0x0); > > + > > + reload = !!rtw_read32_mask(rtwdev, REG_IQKFAILMSK, BIT(16)); > > + iqk_fail_mask = rtw_read32_mask(rtwdev, REG_IQKFAILMSK, GENMASK(7, > 0)); > > + rtw_dbg(rtwdev, RTW_DBG_PHY, > > + "iqk counter=%d reload=%d do_iqk_cnt=%d > n_iqk_fail(mask)=0x%02x\n", > > + counter, reload, ++do_iqk_cnt, iqk_fail_mask); > > +} > > + > > +static void rtw8821c_phy_calibration(struct rtw_dev *rtwdev) > > +{ > > + rtw8821c_do_iqk(rtwdev); > > Why this extra step? You could name it rtw8821c_phy_calibration_iqk(). > This is hooked at rtw_chip_ops::phy_calibration(). For 8821C, only IQK is required. So just keep the name consistent. Yan-Hsuan