CC: [email protected]
TO: "Shengjiu, Wang," <[email protected]>
CC: Mark Brown <[email protected]>
CC: "Cosmin-Gabriel Samoila" <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
pending-fixes
head:   4973fabb59f61553da8b677333357e016550eeef
commit: 955ac624058f91172b3b8820280556e699e1e0ff [1045/3707] ASoC: fsl_easrc: 
Add EASRC ASoC CPU DAI drivers
:::::: branch date: 11 hours ago
:::::: commit date: 6 weeks ago
config: microblaze-randconfig-s031-20200603 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-244-g0ee050a8-dirty
        git checkout 955ac624058f91172b3b8820280556e699e1e0ff
        # save the attached .config to linux build tree
        make W=1 C=1 ARCH=microblaze CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


sparse warnings: (new ones prefixed by >>)

   sound/soc/fsl/fsl_easrc.c:566:33: sparse: sparse: restricted 
snd_pcm_format_t degrades to integer
   sound/soc/fsl/fsl_easrc.c:567:34: sparse: sparse: restricted 
snd_pcm_format_t degrades to integer
   sound/soc/fsl/fsl_easrc.c:569:38: sparse: sparse: restricted 
snd_pcm_format_t degrades to integer
   sound/soc/fsl/fsl_easrc.c:570:39: sparse: sparse: restricted 
snd_pcm_format_t degrades to integer
   sound/soc/fsl/fsl_easrc.c:612:33: sparse: sparse: restricted 
snd_pcm_format_t degrades to integer
   sound/soc/fsl/fsl_easrc.c:613:34: sparse: sparse: restricted 
snd_pcm_format_t degrades to integer
   sound/soc/fsl/fsl_easrc.c:619:40: sparse: sparse: restricted 
snd_pcm_format_t degrades to integer
   sound/soc/fsl/fsl_easrc.c:620:41: sparse: sparse: restricted 
snd_pcm_format_t degrades to integer
   sound/soc/fsl/fsl_easrc.c:967:5: sparse: sparse: symbol 
'fsl_easrc_config_context' was not declared. Should it be static?
   sound/soc/fsl/fsl_easrc.c:1128:5: sparse: sparse: symbol 
'fsl_easrc_set_ctx_format' was not declared. Should it be static?
   sound/soc/fsl/fsl_easrc.c:1201:5: sparse: sparse: symbol 
'fsl_easrc_set_ctx_organziation' was not declared. Should it be static?
   sound/soc/fsl/fsl_easrc.c:1245:5: sparse: sparse: symbol 
'fsl_easrc_request_context' was not declared. Should it be static?
   sound/soc/fsl/fsl_easrc.c:1290:6: sparse: sparse: symbol 
'fsl_easrc_release_context' was not declared. Should it be static?
   sound/soc/fsl/fsl_easrc.c:1317:5: sparse: sparse: symbol 
'fsl_easrc_start_context' was not declared. Should it be static?
   sound/soc/fsl/fsl_easrc.c:1335:5: sparse: sparse: symbol 
'fsl_easrc_stop_context' was not declared. Should it be static?
   sound/soc/fsl/fsl_easrc.c:1474:51: sparse: sparse: incorrect type in 
assignment (different base types) @@     expected unsigned int sample_format @@ 
    got restricted snd_pcm_format_t [usertype] format @@
>> sound/soc/fsl/fsl_easrc.c:1474:51: sparse:     expected unsigned int 
>> sample_format
>> sound/soc/fsl/fsl_easrc.c:1474:51: sparse:     got restricted 
>> snd_pcm_format_t [usertype] format
   sound/soc/fsl/fsl_easrc.c:1476:52: sparse: sparse: incorrect type in 
assignment (different base types) @@     expected unsigned int sample_format @@ 
    got restricted snd_pcm_format_t [usertype] asrc_format @@
   sound/soc/fsl/fsl_easrc.c:1476:52: sparse:     expected unsigned int 
sample_format
>> sound/soc/fsl/fsl_easrc.c:1476:52: sparse:     got restricted 
>> snd_pcm_format_t [usertype] asrc_format
   sound/soc/fsl/fsl_easrc.c:1479:52: sparse: sparse: incorrect type in 
assignment (different base types) @@     expected unsigned int sample_format @@ 
    got restricted snd_pcm_format_t [usertype] format @@
   sound/soc/fsl/fsl_easrc.c:1479:52: sparse:     expected unsigned int 
sample_format
   sound/soc/fsl/fsl_easrc.c:1479:52: sparse:     got restricted 
snd_pcm_format_t [usertype] format
   sound/soc/fsl/fsl_easrc.c:1481:51: sparse: sparse: incorrect type in 
assignment (different base types) @@     expected unsigned int sample_format @@ 
    got restricted snd_pcm_format_t [usertype] asrc_format @@
   sound/soc/fsl/fsl_easrc.c:1481:51: sparse:     expected unsigned int 
sample_format
   sound/soc/fsl/fsl_easrc.c:1481:51: sparse:     got restricted 
snd_pcm_format_t [usertype] asrc_format
   sound/soc/fsl/fsl_easrc.c:1493:41: sparse: sparse: incorrect type in 
argument 2 (different base types) @@     expected restricted snd_pcm_format_t 
[usertype] *in_raw_format @@     got unsigned int * @@
>> sound/soc/fsl/fsl_easrc.c:1493:41: sparse:     expected restricted 
>> snd_pcm_format_t [usertype] *in_raw_format
>> sound/soc/fsl/fsl_easrc.c:1493:41: sparse:     got unsigned int *
   sound/soc/fsl/fsl_easrc.c:1494:41: sparse: sparse: incorrect type in 
argument 3 (different base types) @@     expected restricted snd_pcm_format_t 
[usertype] *out_raw_format @@     got unsigned int * @@
>> sound/soc/fsl/fsl_easrc.c:1494:41: sparse:     expected restricted 
>> snd_pcm_format_t [usertype] *out_raw_format
   sound/soc/fsl/fsl_easrc.c:1494:41: sparse:     got unsigned int *
   sound/soc/fsl/fsl_easrc.c:1946:60: sparse: sparse: incorrect type in 
argument 3 (different base types) @@     expected unsigned int [usertype] 
*out_value @@     got restricted snd_pcm_format_t * @@
>> sound/soc/fsl/fsl_easrc.c:1946:60: sparse:     expected unsigned int 
>> [usertype] *out_value
>> sound/soc/fsl/fsl_easrc.c:1946:60: sparse:     got restricted 
>> snd_pcm_format_t *
   sound/soc/fsl/fsl_easrc.c:1952:49: sparse: sparse: restricted 
snd_pcm_format_t degrades to integer

# 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=955ac624058f91172b3b8820280556e699e1e0ff
git remote add linux-next 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git remote update linux-next
git checkout 955ac624058f91172b3b8820280556e699e1e0ff
vim +1474 sound/soc/fsl/fsl_easrc.c

955ac624058f91 Shengjiu Wang 2020-04-16  1284  
955ac624058f91 Shengjiu Wang 2020-04-16  1285  /*
955ac624058f91 Shengjiu Wang 2020-04-16  1286   * Release the context
955ac624058f91 Shengjiu Wang 2020-04-16  1287   *
955ac624058f91 Shengjiu Wang 2020-04-16  1288   * This funciton is mainly doing 
the revert thing in request context
955ac624058f91 Shengjiu Wang 2020-04-16  1289   */
955ac624058f91 Shengjiu Wang 2020-04-16 @1290  void 
fsl_easrc_release_context(struct fsl_asrc_pair *ctx)
955ac624058f91 Shengjiu Wang 2020-04-16  1291  {
955ac624058f91 Shengjiu Wang 2020-04-16  1292   unsigned long lock_flags;
955ac624058f91 Shengjiu Wang 2020-04-16  1293   struct fsl_asrc *easrc;
955ac624058f91 Shengjiu Wang 2020-04-16  1294   struct device *dev;
955ac624058f91 Shengjiu Wang 2020-04-16  1295  
955ac624058f91 Shengjiu Wang 2020-04-16  1296   if (!ctx)
955ac624058f91 Shengjiu Wang 2020-04-16  1297           return;
955ac624058f91 Shengjiu Wang 2020-04-16  1298  
955ac624058f91 Shengjiu Wang 2020-04-16  1299   easrc = ctx->asrc;
955ac624058f91 Shengjiu Wang 2020-04-16  1300   dev = &easrc->pdev->dev;
955ac624058f91 Shengjiu Wang 2020-04-16  1301  
955ac624058f91 Shengjiu Wang 2020-04-16  1302   spin_lock_irqsave(&easrc->lock, 
lock_flags);
955ac624058f91 Shengjiu Wang 2020-04-16  1303  
955ac624058f91 Shengjiu Wang 2020-04-16  1304   fsl_easrc_release_slot(easrc, 
ctx->index);
955ac624058f91 Shengjiu Wang 2020-04-16  1305  
955ac624058f91 Shengjiu Wang 2020-04-16  1306   easrc->channel_avail += 
ctx->channels;
955ac624058f91 Shengjiu Wang 2020-04-16  1307   easrc->pair[ctx->index] = NULL;
955ac624058f91 Shengjiu Wang 2020-04-16  1308  
955ac624058f91 Shengjiu Wang 2020-04-16  1309   
spin_unlock_irqrestore(&easrc->lock, lock_flags);
955ac624058f91 Shengjiu Wang 2020-04-16  1310  }
955ac624058f91 Shengjiu Wang 2020-04-16  1311  
955ac624058f91 Shengjiu Wang 2020-04-16  1312  /*
955ac624058f91 Shengjiu Wang 2020-04-16  1313   * Start the context
955ac624058f91 Shengjiu Wang 2020-04-16  1314   *
955ac624058f91 Shengjiu Wang 2020-04-16  1315   * Enable the DMA request and 
context
955ac624058f91 Shengjiu Wang 2020-04-16  1316   */
955ac624058f91 Shengjiu Wang 2020-04-16  1317  int 
fsl_easrc_start_context(struct fsl_asrc_pair *ctx)
955ac624058f91 Shengjiu Wang 2020-04-16  1318  {
955ac624058f91 Shengjiu Wang 2020-04-16  1319   struct fsl_asrc *easrc = 
ctx->asrc;
955ac624058f91 Shengjiu Wang 2020-04-16  1320  
955ac624058f91 Shengjiu Wang 2020-04-16  1321   
regmap_update_bits(easrc->regmap, REG_EASRC_CC(ctx->index),
955ac624058f91 Shengjiu Wang 2020-04-16  1322                      
EASRC_CC_FWMDE_MASK, EASRC_CC_FWMDE);
955ac624058f91 Shengjiu Wang 2020-04-16  1323   
regmap_update_bits(easrc->regmap, REG_EASRC_COC(ctx->index),
955ac624058f91 Shengjiu Wang 2020-04-16  1324                      
EASRC_COC_FWMDE_MASK, EASRC_COC_FWMDE);
955ac624058f91 Shengjiu Wang 2020-04-16  1325   
regmap_update_bits(easrc->regmap, REG_EASRC_CC(ctx->index),
955ac624058f91 Shengjiu Wang 2020-04-16  1326                      
EASRC_CC_EN_MASK, EASRC_CC_EN);
955ac624058f91 Shengjiu Wang 2020-04-16  1327   return 0;
955ac624058f91 Shengjiu Wang 2020-04-16  1328  }
955ac624058f91 Shengjiu Wang 2020-04-16  1329  
955ac624058f91 Shengjiu Wang 2020-04-16  1330  /*
955ac624058f91 Shengjiu Wang 2020-04-16  1331   * Stop the context
955ac624058f91 Shengjiu Wang 2020-04-16  1332   *
955ac624058f91 Shengjiu Wang 2020-04-16  1333   * Disable the DMA request and 
context
955ac624058f91 Shengjiu Wang 2020-04-16  1334   */
955ac624058f91 Shengjiu Wang 2020-04-16  1335  int 
fsl_easrc_stop_context(struct fsl_asrc_pair *ctx)
955ac624058f91 Shengjiu Wang 2020-04-16  1336  {
955ac624058f91 Shengjiu Wang 2020-04-16  1337   struct fsl_asrc *easrc = 
ctx->asrc;
955ac624058f91 Shengjiu Wang 2020-04-16  1338   int val, i;
955ac624058f91 Shengjiu Wang 2020-04-16  1339   int size = 0;
955ac624058f91 Shengjiu Wang 2020-04-16  1340   int retry = 200;
955ac624058f91 Shengjiu Wang 2020-04-16  1341  
955ac624058f91 Shengjiu Wang 2020-04-16  1342   regmap_read(easrc->regmap, 
REG_EASRC_CC(ctx->index), &val);
955ac624058f91 Shengjiu Wang 2020-04-16  1343  
955ac624058f91 Shengjiu Wang 2020-04-16  1344   if (val & EASRC_CC_EN_MASK) {
955ac624058f91 Shengjiu Wang 2020-04-16  1345           
regmap_update_bits(easrc->regmap,
955ac624058f91 Shengjiu Wang 2020-04-16  1346                              
REG_EASRC_CC(ctx->index),
955ac624058f91 Shengjiu Wang 2020-04-16  1347                              
EASRC_CC_STOP_MASK, EASRC_CC_STOP);
955ac624058f91 Shengjiu Wang 2020-04-16  1348           do {
955ac624058f91 Shengjiu Wang 2020-04-16  1349                   
regmap_read(easrc->regmap, REG_EASRC_SFS(ctx->index), &val);
955ac624058f91 Shengjiu Wang 2020-04-16  1350                   val &= 
EASRC_SFS_NSGO_MASK;
955ac624058f91 Shengjiu Wang 2020-04-16  1351                   size = val >> 
EASRC_SFS_NSGO_SHIFT;
955ac624058f91 Shengjiu Wang 2020-04-16  1352  
955ac624058f91 Shengjiu Wang 2020-04-16  1353                   /* Read FIFO, 
drop the data */
955ac624058f91 Shengjiu Wang 2020-04-16  1354                   for (i = 0; i < 
size * ctx->channels; i++)
955ac624058f91 Shengjiu Wang 2020-04-16  1355                           
regmap_read(easrc->regmap, REG_EASRC_RDFIFO(ctx->index), &val);
955ac624058f91 Shengjiu Wang 2020-04-16  1356                   /* Check 
RUN_STOP_DONE */
955ac624058f91 Shengjiu Wang 2020-04-16  1357                   
regmap_read(easrc->regmap, REG_EASRC_IRQF, &val);
955ac624058f91 Shengjiu Wang 2020-04-16  1358                   if (val & 
EASRC_IRQF_RSD(1 << ctx->index)) {
955ac624058f91 Shengjiu Wang 2020-04-16  1359                           /*Clear 
RUN_STOP_DONE*/
955ac624058f91 Shengjiu Wang 2020-04-16  1360                           
regmap_write_bits(easrc->regmap,
955ac624058f91 Shengjiu Wang 2020-04-16  1361                                   
          REG_EASRC_IRQF,
955ac624058f91 Shengjiu Wang 2020-04-16  1362                                   
          EASRC_IRQF_RSD(1 << ctx->index),
955ac624058f91 Shengjiu Wang 2020-04-16  1363                                   
          EASRC_IRQF_RSD(1 << ctx->index));
955ac624058f91 Shengjiu Wang 2020-04-16  1364                           break;
955ac624058f91 Shengjiu Wang 2020-04-16  1365                   }
955ac624058f91 Shengjiu Wang 2020-04-16  1366                   udelay(100);
955ac624058f91 Shengjiu Wang 2020-04-16  1367           } while (--retry);
955ac624058f91 Shengjiu Wang 2020-04-16  1368  
955ac624058f91 Shengjiu Wang 2020-04-16  1369           if (retry == 0)
955ac624058f91 Shengjiu Wang 2020-04-16  1370                   
dev_warn(&easrc->pdev->dev, "RUN STOP fail\n");
955ac624058f91 Shengjiu Wang 2020-04-16  1371   }
955ac624058f91 Shengjiu Wang 2020-04-16  1372  
955ac624058f91 Shengjiu Wang 2020-04-16  1373   
regmap_update_bits(easrc->regmap, REG_EASRC_CC(ctx->index),
955ac624058f91 Shengjiu Wang 2020-04-16  1374                      
EASRC_CC_EN_MASK | EASRC_CC_STOP_MASK, 0);
955ac624058f91 Shengjiu Wang 2020-04-16  1375   
regmap_update_bits(easrc->regmap, REG_EASRC_CC(ctx->index),
955ac624058f91 Shengjiu Wang 2020-04-16  1376                      
EASRC_CC_FWMDE_MASK, 0);
955ac624058f91 Shengjiu Wang 2020-04-16  1377   
regmap_update_bits(easrc->regmap, REG_EASRC_COC(ctx->index),
955ac624058f91 Shengjiu Wang 2020-04-16  1378                      
EASRC_COC_FWMDE_MASK, 0);
955ac624058f91 Shengjiu Wang 2020-04-16  1379   return 0;
955ac624058f91 Shengjiu Wang 2020-04-16  1380  }
955ac624058f91 Shengjiu Wang 2020-04-16  1381  
955ac624058f91 Shengjiu Wang 2020-04-16  1382  struct dma_chan 
*fsl_easrc_get_dma_channel(struct fsl_asrc_pair *ctx,
955ac624058f91 Shengjiu Wang 2020-04-16  1383                                   
   bool dir)
955ac624058f91 Shengjiu Wang 2020-04-16  1384  {
955ac624058f91 Shengjiu Wang 2020-04-16  1385   struct fsl_asrc *easrc = 
ctx->asrc;
955ac624058f91 Shengjiu Wang 2020-04-16  1386   enum asrc_pair_index index = 
ctx->index;
955ac624058f91 Shengjiu Wang 2020-04-16  1387   char name[8];
955ac624058f91 Shengjiu Wang 2020-04-16  1388  
955ac624058f91 Shengjiu Wang 2020-04-16  1389   /* Example of dma name: ctx0_rx 
*/
955ac624058f91 Shengjiu Wang 2020-04-16  1390   sprintf(name, "ctx%c_%cx", 
index + '0', dir == IN ? 'r' : 't');
955ac624058f91 Shengjiu Wang 2020-04-16  1391  
955ac624058f91 Shengjiu Wang 2020-04-16  1392   return 
dma_request_slave_channel(&easrc->pdev->dev, name);
955ac624058f91 Shengjiu Wang 2020-04-16  1393  };
955ac624058f91 Shengjiu Wang 2020-04-16  1394  
EXPORT_SYMBOL_GPL(fsl_easrc_get_dma_channel);
955ac624058f91 Shengjiu Wang 2020-04-16  1395  
955ac624058f91 Shengjiu Wang 2020-04-16  1396  static const unsigned int 
easrc_rates[] = {
955ac624058f91 Shengjiu Wang 2020-04-16  1397   8000, 11025, 12000, 16000,
955ac624058f91 Shengjiu Wang 2020-04-16  1398   22050, 24000, 32000, 44100,
955ac624058f91 Shengjiu Wang 2020-04-16  1399   48000, 64000, 88200, 96000,
955ac624058f91 Shengjiu Wang 2020-04-16  1400   128000, 176400, 192000, 256000,
955ac624058f91 Shengjiu Wang 2020-04-16  1401   352800, 384000, 705600, 768000,
955ac624058f91 Shengjiu Wang 2020-04-16  1402  };
955ac624058f91 Shengjiu Wang 2020-04-16  1403  
955ac624058f91 Shengjiu Wang 2020-04-16  1404  static const struct 
snd_pcm_hw_constraint_list easrc_rate_constraints = {
955ac624058f91 Shengjiu Wang 2020-04-16  1405   .count = 
ARRAY_SIZE(easrc_rates),
955ac624058f91 Shengjiu Wang 2020-04-16  1406   .list = easrc_rates,
955ac624058f91 Shengjiu Wang 2020-04-16  1407  };
955ac624058f91 Shengjiu Wang 2020-04-16  1408  
955ac624058f91 Shengjiu Wang 2020-04-16  1409  static int 
fsl_easrc_startup(struct snd_pcm_substream *substream,
955ac624058f91 Shengjiu Wang 2020-04-16  1410                        struct 
snd_soc_dai *dai)
955ac624058f91 Shengjiu Wang 2020-04-16  1411  {
955ac624058f91 Shengjiu Wang 2020-04-16  1412   return 
snd_pcm_hw_constraint_list(substream->runtime, 0,
955ac624058f91 Shengjiu Wang 2020-04-16  1413                                   
  SNDRV_PCM_HW_PARAM_RATE,
955ac624058f91 Shengjiu Wang 2020-04-16  1414                                   
  &easrc_rate_constraints);
955ac624058f91 Shengjiu Wang 2020-04-16  1415  }
955ac624058f91 Shengjiu Wang 2020-04-16  1416  
955ac624058f91 Shengjiu Wang 2020-04-16  1417  static int 
fsl_easrc_trigger(struct snd_pcm_substream *substream,
955ac624058f91 Shengjiu Wang 2020-04-16  1418                        int cmd, 
struct snd_soc_dai *dai)
955ac624058f91 Shengjiu Wang 2020-04-16  1419  {
955ac624058f91 Shengjiu Wang 2020-04-16  1420   struct snd_pcm_runtime *runtime 
= substream->runtime;
955ac624058f91 Shengjiu Wang 2020-04-16  1421   struct fsl_asrc_pair *ctx = 
runtime->private_data;
955ac624058f91 Shengjiu Wang 2020-04-16  1422   int ret;
955ac624058f91 Shengjiu Wang 2020-04-16  1423  
955ac624058f91 Shengjiu Wang 2020-04-16  1424   switch (cmd) {
955ac624058f91 Shengjiu Wang 2020-04-16  1425   case SNDRV_PCM_TRIGGER_START:
955ac624058f91 Shengjiu Wang 2020-04-16  1426   case SNDRV_PCM_TRIGGER_RESUME:
955ac624058f91 Shengjiu Wang 2020-04-16  1427   case 
SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
955ac624058f91 Shengjiu Wang 2020-04-16  1428           ret = 
fsl_easrc_start_context(ctx);
955ac624058f91 Shengjiu Wang 2020-04-16  1429           if (ret)
955ac624058f91 Shengjiu Wang 2020-04-16  1430                   return ret;
955ac624058f91 Shengjiu Wang 2020-04-16  1431           break;
955ac624058f91 Shengjiu Wang 2020-04-16  1432   case SNDRV_PCM_TRIGGER_STOP:
955ac624058f91 Shengjiu Wang 2020-04-16  1433   case SNDRV_PCM_TRIGGER_SUSPEND:
955ac624058f91 Shengjiu Wang 2020-04-16  1434   case 
SNDRV_PCM_TRIGGER_PAUSE_PUSH:
955ac624058f91 Shengjiu Wang 2020-04-16  1435           ret = 
fsl_easrc_stop_context(ctx);
955ac624058f91 Shengjiu Wang 2020-04-16  1436           if (ret)
955ac624058f91 Shengjiu Wang 2020-04-16  1437                   return ret;
955ac624058f91 Shengjiu Wang 2020-04-16  1438           break;
955ac624058f91 Shengjiu Wang 2020-04-16  1439   default:
955ac624058f91 Shengjiu Wang 2020-04-16  1440           return -EINVAL;
955ac624058f91 Shengjiu Wang 2020-04-16  1441   }
955ac624058f91 Shengjiu Wang 2020-04-16  1442  
955ac624058f91 Shengjiu Wang 2020-04-16  1443   return 0;
955ac624058f91 Shengjiu Wang 2020-04-16  1444  }
955ac624058f91 Shengjiu Wang 2020-04-16  1445  
955ac624058f91 Shengjiu Wang 2020-04-16  1446  static int 
fsl_easrc_hw_params(struct snd_pcm_substream *substream,
955ac624058f91 Shengjiu Wang 2020-04-16  1447                          struct 
snd_pcm_hw_params *params,
955ac624058f91 Shengjiu Wang 2020-04-16  1448                          struct 
snd_soc_dai *dai)
955ac624058f91 Shengjiu Wang 2020-04-16  1449  {
955ac624058f91 Shengjiu Wang 2020-04-16  1450   struct fsl_asrc *easrc = 
snd_soc_dai_get_drvdata(dai);
955ac624058f91 Shengjiu Wang 2020-04-16  1451   struct snd_pcm_runtime *runtime 
= substream->runtime;
955ac624058f91 Shengjiu Wang 2020-04-16  1452   struct device *dev = 
&easrc->pdev->dev;
955ac624058f91 Shengjiu Wang 2020-04-16  1453   struct fsl_asrc_pair *ctx = 
runtime->private_data;
955ac624058f91 Shengjiu Wang 2020-04-16  1454   struct fsl_easrc_ctx_priv 
*ctx_priv = ctx->private;
955ac624058f91 Shengjiu Wang 2020-04-16  1455   unsigned int channels = 
params_channels(params);
955ac624058f91 Shengjiu Wang 2020-04-16  1456   unsigned int rate = 
params_rate(params);
955ac624058f91 Shengjiu Wang 2020-04-16  1457   snd_pcm_format_t format = 
params_format(params);
955ac624058f91 Shengjiu Wang 2020-04-16  1458   int ret;
955ac624058f91 Shengjiu Wang 2020-04-16  1459  
955ac624058f91 Shengjiu Wang 2020-04-16  1460   ret = 
fsl_easrc_request_context(channels, ctx);
955ac624058f91 Shengjiu Wang 2020-04-16  1461   if (ret) {
955ac624058f91 Shengjiu Wang 2020-04-16  1462           dev_err(dev, "failed to 
request context\n");
955ac624058f91 Shengjiu Wang 2020-04-16  1463           return ret;
955ac624058f91 Shengjiu Wang 2020-04-16  1464   }
955ac624058f91 Shengjiu Wang 2020-04-16  1465  
955ac624058f91 Shengjiu Wang 2020-04-16  1466   ctx_priv->ctx_streams |= 
BIT(substream->stream);
955ac624058f91 Shengjiu Wang 2020-04-16  1467  
955ac624058f91 Shengjiu Wang 2020-04-16  1468   /*
955ac624058f91 Shengjiu Wang 2020-04-16  1469    * Set the input and output 
ratio so we can compute
955ac624058f91 Shengjiu Wang 2020-04-16  1470    * the resampling ratio in 
RS_LOW/HIGH
955ac624058f91 Shengjiu Wang 2020-04-16  1471    */
955ac624058f91 Shengjiu Wang 2020-04-16  1472   if (substream->stream == 
SNDRV_PCM_STREAM_PLAYBACK) {
955ac624058f91 Shengjiu Wang 2020-04-16  1473           
ctx_priv->in_params.sample_rate = rate;
955ac624058f91 Shengjiu Wang 2020-04-16 @1474           
ctx_priv->in_params.sample_format = format;
955ac624058f91 Shengjiu Wang 2020-04-16  1475           
ctx_priv->out_params.sample_rate = easrc->asrc_rate;
955ac624058f91 Shengjiu Wang 2020-04-16 @1476           
ctx_priv->out_params.sample_format = easrc->asrc_format;
955ac624058f91 Shengjiu Wang 2020-04-16  1477   } else {
955ac624058f91 Shengjiu Wang 2020-04-16  1478           
ctx_priv->out_params.sample_rate = rate;
955ac624058f91 Shengjiu Wang 2020-04-16 @1479           
ctx_priv->out_params.sample_format = format;
955ac624058f91 Shengjiu Wang 2020-04-16  1480           
ctx_priv->in_params.sample_rate = easrc->asrc_rate;
955ac624058f91 Shengjiu Wang 2020-04-16 @1481           
ctx_priv->in_params.sample_format = easrc->asrc_format;
955ac624058f91 Shengjiu Wang 2020-04-16  1482   }
955ac624058f91 Shengjiu Wang 2020-04-16  1483  
955ac624058f91 Shengjiu Wang 2020-04-16  1484   ctx->channels = channels;
955ac624058f91 Shengjiu Wang 2020-04-16  1485   ctx_priv->in_params.fifo_wtmk  
= 0x20;
955ac624058f91 Shengjiu Wang 2020-04-16  1486   ctx_priv->out_params.fifo_wtmk 
= 0x20;
955ac624058f91 Shengjiu Wang 2020-04-16  1487  
955ac624058f91 Shengjiu Wang 2020-04-16  1488   /*
955ac624058f91 Shengjiu Wang 2020-04-16  1489    * Do only rate conversion and 
keep the same format for input
955ac624058f91 Shengjiu Wang 2020-04-16  1490    * and output data
955ac624058f91 Shengjiu Wang 2020-04-16  1491    */
955ac624058f91 Shengjiu Wang 2020-04-16  1492   ret = 
fsl_easrc_set_ctx_format(ctx,
955ac624058f91 Shengjiu Wang 2020-04-16 @1493                                  
&ctx_priv->in_params.sample_format,
955ac624058f91 Shengjiu Wang 2020-04-16 @1494                                  
&ctx_priv->out_params.sample_format);
955ac624058f91 Shengjiu Wang 2020-04-16  1495   if (ret) {
955ac624058f91 Shengjiu Wang 2020-04-16  1496           dev_err(dev, "failed to 
set format %d", ret);
955ac624058f91 Shengjiu Wang 2020-04-16  1497           return ret;
955ac624058f91 Shengjiu Wang 2020-04-16  1498   }
955ac624058f91 Shengjiu Wang 2020-04-16  1499  
955ac624058f91 Shengjiu Wang 2020-04-16  1500   ret = 
fsl_easrc_config_context(easrc, ctx->index);
955ac624058f91 Shengjiu Wang 2020-04-16  1501   if (ret) {
955ac624058f91 Shengjiu Wang 2020-04-16  1502           dev_err(dev, "failed to 
config context\n");
955ac624058f91 Shengjiu Wang 2020-04-16  1503           return ret;
955ac624058f91 Shengjiu Wang 2020-04-16  1504   }
955ac624058f91 Shengjiu Wang 2020-04-16  1505  
955ac624058f91 Shengjiu Wang 2020-04-16  1506   ctx_priv->in_params.iterations 
= 1;
955ac624058f91 Shengjiu Wang 2020-04-16  1507   ctx_priv->in_params.group_len = 
ctx->channels;
955ac624058f91 Shengjiu Wang 2020-04-16  1508   ctx_priv->in_params.access_len 
= ctx->channels;
955ac624058f91 Shengjiu Wang 2020-04-16  1509   ctx_priv->out_params.iterations 
= 1;
955ac624058f91 Shengjiu Wang 2020-04-16  1510   ctx_priv->out_params.group_len 
= ctx->channels;
955ac624058f91 Shengjiu Wang 2020-04-16  1511   ctx_priv->out_params.access_len 
= ctx->channels;
955ac624058f91 Shengjiu Wang 2020-04-16  1512  
955ac624058f91 Shengjiu Wang 2020-04-16  1513   ret = 
fsl_easrc_set_ctx_organziation(ctx);
955ac624058f91 Shengjiu Wang 2020-04-16  1514   if (ret) {
955ac624058f91 Shengjiu Wang 2020-04-16  1515           dev_err(dev, "failed to 
set fifo organization\n");
955ac624058f91 Shengjiu Wang 2020-04-16  1516           return ret;
955ac624058f91 Shengjiu Wang 2020-04-16  1517   }
955ac624058f91 Shengjiu Wang 2020-04-16  1518  
955ac624058f91 Shengjiu Wang 2020-04-16  1519   return 0;
955ac624058f91 Shengjiu Wang 2020-04-16  1520  }
955ac624058f91 Shengjiu Wang 2020-04-16  1521  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to