On Fri, May 03, 2024 at 07:24:49AM +0800, Shenghao Ding wrote: > Calibrated data will be set to default after loading DSP config params, > which will cause speaker protection work abnormally. Reload calibrated > data after loading DSP config params. ... > +static void tasdev_load_calibrated_data(struct tasdevice_priv *priv, int i) > +{ > + struct tasdevice_fw *cal_fmw = priv->tasdevice[i].cali_data_fmw; > + > + if (cal_fmw) { Better variant is struct tasdevice_calibration *cal; struct tasdevice_fw *cal_fmw; cal_fmw = priv->tasdevice[i].cali_data_fmw; if (!cal_fmw) return; > + struct tasdevice_calibration *cal = cal_fmw->calibrations; > + > + if (cal) > + load_calib_data(priv, &cal->dev_data); > + } In the similar way cal = cal_fmw->calibrations; if (!cal) return; load_calib_data(priv, &cal->dev_data); > +} The result is much easier to read and understand and maintain, as it makes harder to squeeze the code between initialization and use and breaking things. ... > + if (tas_priv->tasdevice[i].is_loaderr == false > + && tas_priv->tasdevice[i].is_loading == true) > tas_priv->tasdevice[i].cur_prog = prm_no; While at it, make it better (fix the indentation and move operator to the previous line): if (tas_priv->tasdevice[i].is_loaderr == false && tas_priv->tasdevice[i].is_loading == true) tas_priv->tasdevice[i].cur_prog = prm_no; ... > if (tas_priv->tasdevice[i].is_loaderr == true) { > status |= 1 << (i + 4); Side note: Use BIT() > continue; ... > + if (tas_priv->tasdevice[i].is_loaderr == false > + && tas_priv->tasdevice[i].is_loading == true) { As per above. > + tasdev_load_calibrated_data(tas_priv, i); > tas_priv->tasdevice[i].cur_conf = cfg_no; > + } -- With Best Regards, Andy Shevchenko