@@ -912,7 +912,7 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context)
912
912
struct tasdevice_priv * tas_priv = context ;
913
913
struct tas2781_hda * tas_hda = dev_get_drvdata (tas_priv -> dev );
914
914
struct hda_codec * codec = tas_priv -> codec ;
915
- int i , j , ret ;
915
+ int i , j , ret , val ;
916
916
917
917
pm_runtime_get_sync (tas_priv -> dev );
918
918
guard (mutex )(& tas_priv -> codec_lock );
@@ -981,13 +981,16 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context)
981
981
982
982
/* Perform AMP reset before firmware download. */
983
983
tas_priv -> rcabin .profile_cfg_id = TAS2781_PRE_POST_RESET_CFG ;
984
- tasdevice_spi_tuning_switch (tas_priv , 0 );
985
984
tas2781_spi_reset (tas_priv );
986
985
tas_priv -> rcabin .profile_cfg_id = 0 ;
987
- tasdevice_spi_tuning_switch (tas_priv , 1 );
988
986
989
987
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 );
991
994
if (ret < 0 ) {
992
995
dev_err (tas_priv -> dev , "FW download failed = %d\n" , ret );
993
996
goto out ;
@@ -1001,7 +1004,6 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context)
1001
1004
* If calibrated data occurs error, dsp will still works with default
1002
1005
* calibrated data inside algo.
1003
1006
*/
1004
- tas_priv -> save_calibration (tas_priv );
1005
1007
1006
1008
out :
1007
1009
if (fmw )
@@ -1160,7 +1162,8 @@ static int tas2781_runtime_suspend(struct device *dev)
1160
1162
1161
1163
guard (mutex )(& tas_hda -> priv -> codec_lock );
1162
1164
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 );
1164
1167
1165
1168
tas_hda -> priv -> cur_book = -1 ;
1166
1169
tas_hda -> priv -> cur_conf = -1 ;
@@ -1174,7 +1177,8 @@ static int tas2781_runtime_resume(struct device *dev)
1174
1177
1175
1178
guard (mutex )(& tas_hda -> priv -> codec_lock );
1176
1179
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 );
1178
1182
1179
1183
return 0 ;
1180
1184
}
@@ -1189,12 +1193,9 @@ static int tas2781_system_suspend(struct device *dev)
1189
1193
return ret ;
1190
1194
1191
1195
/* 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
+
1198
1199
return 0 ;
1199
1200
}
1200
1201
0 commit comments