@@ -912,7 +912,7 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context)
912912 struct tasdevice_priv * tas_priv = context ;
913913 struct tas2781_hda * tas_hda = dev_get_drvdata (tas_priv -> dev );
914914 struct hda_codec * codec = tas_priv -> codec ;
915- int i , j , ret ;
915+ int i , j , ret , val ;
916916
917917 pm_runtime_get_sync (tas_priv -> dev );
918918 guard (mutex )(& tas_priv -> codec_lock );
@@ -981,13 +981,16 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context)
981981
982982 /* Perform AMP reset before firmware download. */
983983 tas_priv -> rcabin .profile_cfg_id = TAS2781_PRE_POST_RESET_CFG ;
984- tasdevice_spi_tuning_switch (tas_priv , 0 );
985984 tas2781_spi_reset (tas_priv );
986985 tas_priv -> rcabin .profile_cfg_id = 0 ;
987- tasdevice_spi_tuning_switch (tas_priv , 1 );
988986
989987 tas_priv -> fw_state = TASDEVICE_DSP_FW_ALL_OK ;
990- ret = tasdevice_spi_prmg_load (tas_priv , 0 );
988+ ret = tasdevice_spi_dev_read (tas_priv , TAS2781_REG_CLK_CONFIG , & val );
989+ if (ret < 0 )
990+ goto out ;
991+
992+ if (val == TAS2781_REG_CLK_CONFIG_RESET )
993+ ret = tasdevice_spi_prmg_load (tas_priv , 0 );
991994 if (ret < 0 ) {
992995 dev_err (tas_priv -> dev , "FW download failed = %d\n" , ret );
993996 goto out ;
@@ -1001,7 +1004,6 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context)
10011004 * If calibrated data occurs error, dsp will still works with default
10021005 * calibrated data inside algo.
10031006 */
1004- tas_priv -> save_calibration (tas_priv );
10051007
10061008out :
10071009 if (fmw )
@@ -1160,7 +1162,8 @@ static int tas2781_runtime_suspend(struct device *dev)
11601162
11611163 guard (mutex )(& tas_hda -> priv -> codec_lock );
11621164
1163- tasdevice_spi_tuning_switch (tas_hda -> priv , 1 );
1165+ if (tas_hda -> priv -> playback_started )
1166+ tasdevice_spi_tuning_switch (tas_hda -> priv , 1 );
11641167
11651168 tas_hda -> priv -> cur_book = -1 ;
11661169 tas_hda -> priv -> cur_conf = -1 ;
@@ -1174,7 +1177,8 @@ static int tas2781_runtime_resume(struct device *dev)
11741177
11751178 guard (mutex )(& tas_hda -> priv -> codec_lock );
11761179
1177- tasdevice_spi_tuning_switch (tas_hda -> priv , 0 );
1180+ if (tas_hda -> priv -> playback_started )
1181+ tasdevice_spi_tuning_switch (tas_hda -> priv , 0 );
11781182
11791183 return 0 ;
11801184}
@@ -1189,12 +1193,9 @@ static int tas2781_system_suspend(struct device *dev)
11891193 return ret ;
11901194
11911195 /* Shutdown chip before system suspend */
1192- tasdevice_spi_tuning_switch (tas_hda -> priv , 1 );
1193- tas2781_spi_reset (tas_hda -> priv );
1194- /*
1195- * Reset GPIO may be shared, so cannot reset here.
1196- * However beyond this point, amps may be powered down.
1197- */
1196+ if (tas_hda -> priv -> playback_started )
1197+ tasdevice_spi_tuning_switch (tas_hda -> priv , 1 );
1198+
11981199 return 0 ;
11991200}
12001201
0 commit comments