8
8
9
9
#include <linux/module.h>
10
10
#include <linux/platform_device.h>
11
+ #include <sound/pcm_params.h>
11
12
#include <sound/soc.h>
12
13
#include <sound/soc-acpi.h>
13
14
#include <sound/soc-dapm.h>
@@ -24,6 +25,26 @@ static const struct snd_soc_dapm_route card_base_routes[] = {
24
25
{ "Spk" , NULL , "Speaker" },
25
26
};
26
27
28
+ static int
29
+ avs_max98357a_be_fixup (struct snd_soc_pcm_runtime * runrime , struct snd_pcm_hw_params * params )
30
+ {
31
+ struct snd_interval * rate , * channels ;
32
+ struct snd_mask * fmt ;
33
+
34
+ rate = hw_param_interval (params , SNDRV_PCM_HW_PARAM_RATE );
35
+ channels = hw_param_interval (params , SNDRV_PCM_HW_PARAM_CHANNELS );
36
+ fmt = hw_param_mask (params , SNDRV_PCM_HW_PARAM_FORMAT );
37
+
38
+ /* The ADSP will convert the FE rate to 48k, stereo */
39
+ rate -> min = rate -> max = 48000 ;
40
+ channels -> min = channels -> max = 2 ;
41
+
42
+ /* set SSP0 to 16 bit */
43
+ snd_mask_none (fmt );
44
+ snd_mask_set_format (fmt , SNDRV_PCM_FORMAT_S16_LE );
45
+ return 0 ;
46
+ }
47
+
27
48
static int avs_create_dai_link (struct device * dev , const char * platform_name , int ssp_port ,
28
49
struct snd_soc_dai_link * * dai_link )
29
50
{
@@ -55,6 +76,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in
55
76
dl -> num_platforms = 1 ;
56
77
dl -> id = 0 ;
57
78
dl -> dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS ;
79
+ dl -> be_hw_params_fixup = avs_max98357a_be_fixup ;
58
80
dl -> nonatomic = 1 ;
59
81
dl -> no_pcm = 1 ;
60
82
dl -> dpcm_playback = 1 ;
0 commit comments