@@ -2151,6 +2151,24 @@ static int tasdevice_load_data(struct tasdevice_priv *tas_priv,
2151
2151
return ret ;
2152
2152
}
2153
2153
2154
+ static void tasdev_load_calibrated_data (struct tasdevice_priv * priv , int i )
2155
+ {
2156
+ struct tasdevice_calibration * cal ;
2157
+ struct tasdevice_fw * cal_fmw ;
2158
+
2159
+ cal_fmw = priv -> tasdevice [i ].cali_data_fmw ;
2160
+
2161
+ /* No calibrated data for current devices, playback will go ahead. */
2162
+ if (!cal_fmw )
2163
+ return ;
2164
+
2165
+ cal = cal_fmw -> calibrations ;
2166
+ if (cal )
2167
+ return ;
2168
+
2169
+ load_calib_data (priv , & cal -> dev_data );
2170
+ }
2171
+
2154
2172
int tasdevice_select_tuningprm_cfg (void * context , int prm_no ,
2155
2173
int cfg_no , int rca_conf_no )
2156
2174
{
@@ -2210,21 +2228,9 @@ int tasdevice_select_tuningprm_cfg(void *context, int prm_no,
2210
2228
for (i = 0 ; i < tas_priv -> ndev ; i ++ ) {
2211
2229
if (tas_priv -> tasdevice [i ].is_loaderr == true)
2212
2230
continue ;
2213
- else if (tas_priv -> tasdevice [i ].is_loaderr == false
2214
- && tas_priv -> tasdevice [i ].is_loading == true) {
2215
- struct tasdevice_fw * cal_fmw =
2216
- tas_priv -> tasdevice [i ].cali_data_fmw ;
2217
-
2218
- if (cal_fmw ) {
2219
- struct tasdevice_calibration
2220
- * cal = cal_fmw -> calibrations ;
2221
-
2222
- if (cal )
2223
- load_calib_data (tas_priv ,
2224
- & (cal -> dev_data ));
2225
- }
2231
+ if (tas_priv -> tasdevice [i ].is_loaderr == false &&
2232
+ tas_priv -> tasdevice [i ].is_loading == true)
2226
2233
tas_priv -> tasdevice [i ].cur_prog = prm_no ;
2227
- }
2228
2234
}
2229
2235
}
2230
2236
@@ -2245,11 +2251,15 @@ int tasdevice_select_tuningprm_cfg(void *context, int prm_no,
2245
2251
tasdevice_load_data (tas_priv , & (conf -> dev_data ));
2246
2252
for (i = 0 ; i < tas_priv -> ndev ; i ++ ) {
2247
2253
if (tas_priv -> tasdevice [i ].is_loaderr == true) {
2248
- status |= 1 << (i + 4 );
2254
+ status |= BIT (i + 4 );
2249
2255
continue ;
2250
- } else if (tas_priv -> tasdevice [i ].is_loaderr == false
2251
- && tas_priv -> tasdevice [i ].is_loading == true)
2256
+ }
2257
+
2258
+ if (tas_priv -> tasdevice [i ].is_loaderr == false &&
2259
+ tas_priv -> tasdevice [i ].is_loading == true) {
2260
+ tasdev_load_calibrated_data (tas_priv , i );
2252
2261
tas_priv -> tasdevice [i ].cur_conf = cfg_no ;
2262
+ }
2253
2263
}
2254
2264
} else
2255
2265
dev_dbg (tas_priv -> dev , "%s: Unneeded loading dsp conf %d\n" ,
@@ -2308,65 +2318,6 @@ int tasdevice_prmg_load(void *context, int prm_no)
2308
2318
}
2309
2319
EXPORT_SYMBOL_NS_GPL (tasdevice_prmg_load , SND_SOC_TAS2781_FMWLIB );
2310
2320
2311
- int tasdevice_prmg_calibdata_load (void * context , int prm_no )
2312
- {
2313
- struct tasdevice_priv * tas_priv = (struct tasdevice_priv * ) context ;
2314
- struct tasdevice_fw * tas_fmw = tas_priv -> fmw ;
2315
- struct tasdevice_prog * program ;
2316
- int prog_status = 0 ;
2317
- int i ;
2318
-
2319
- if (!tas_fmw ) {
2320
- dev_err (tas_priv -> dev , "%s: Firmware is NULL\n" , __func__ );
2321
- goto out ;
2322
- }
2323
-
2324
- if (prm_no >= tas_fmw -> nr_programs ) {
2325
- dev_err (tas_priv -> dev ,
2326
- "%s: prm(%d) is not in range of Programs %u\n" ,
2327
- __func__ , prm_no , tas_fmw -> nr_programs );
2328
- goto out ;
2329
- }
2330
-
2331
- for (i = 0 , prog_status = 0 ; i < tas_priv -> ndev ; i ++ ) {
2332
- if (prm_no >= 0 && tas_priv -> tasdevice [i ].cur_prog != prm_no ) {
2333
- tas_priv -> tasdevice [i ].cur_conf = -1 ;
2334
- tas_priv -> tasdevice [i ].is_loading = true;
2335
- prog_status ++ ;
2336
- }
2337
- tas_priv -> tasdevice [i ].is_loaderr = false;
2338
- }
2339
-
2340
- if (prog_status ) {
2341
- program = & (tas_fmw -> programs [prm_no ]);
2342
- tasdevice_load_data (tas_priv , & (program -> dev_data ));
2343
- for (i = 0 ; i < tas_priv -> ndev ; i ++ ) {
2344
- if (tas_priv -> tasdevice [i ].is_loaderr == true)
2345
- continue ;
2346
- else if (tas_priv -> tasdevice [i ].is_loaderr == false
2347
- && tas_priv -> tasdevice [i ].is_loading == true) {
2348
- struct tasdevice_fw * cal_fmw =
2349
- tas_priv -> tasdevice [i ].cali_data_fmw ;
2350
-
2351
- if (cal_fmw ) {
2352
- struct tasdevice_calibration * cal =
2353
- cal_fmw -> calibrations ;
2354
-
2355
- if (cal )
2356
- load_calib_data (tas_priv ,
2357
- & (cal -> dev_data ));
2358
- }
2359
- tas_priv -> tasdevice [i ].cur_prog = prm_no ;
2360
- }
2361
- }
2362
- }
2363
-
2364
- out :
2365
- return prog_status ;
2366
- }
2367
- EXPORT_SYMBOL_NS_GPL (tasdevice_prmg_calibdata_load ,
2368
- SND_SOC_TAS2781_FMWLIB );
2369
-
2370
2321
void tasdevice_tuning_switch (void * context , int state )
2371
2322
{
2372
2323
struct tasdevice_priv * tas_priv = (struct tasdevice_priv * ) context ;
0 commit comments