Skip to content

Commit 2a22e35

Browse files
j-schambacherpopcornmix
authored andcommitted
rpi-simple-soundcard: limits sample rate of Merus Amp board
Adding a dedicated hw_params function to limit the maximum sample rate of the IFX/Merus board to 48000ksps. Thanks to Ariel Muszkat for the support. Signed-off-by: Joerg Schambacher <[email protected]>
1 parent 554a017 commit 2a22e35

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

sound/soc/bcm/rpi-simple-soundcard.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,26 @@ static struct snd_soc_ops snd_rpi_simple_ops = {
145145
.hw_params = snd_rpi_simple_hw_params,
146146
};
147147

148+
static int snd_merus_amp_hw_params(struct snd_pcm_substream *substream,
149+
struct snd_pcm_hw_params *params)
150+
{
151+
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
152+
int rate;
153+
154+
rate = params_rate(params);
155+
if (rate > 48000) {
156+
dev_err(rtd->card->dev,
157+
"Unsupported samplerate %d\n",
158+
rate);
159+
return -EINVAL;
160+
}
161+
return 0;
162+
}
163+
164+
static struct snd_soc_ops snd_merus_amp_ops = {
165+
.hw_params = snd_merus_amp_hw_params,
166+
};
167+
148168
enum adau1977_clk_id {
149169
ADAU1977_SYSCLK,
150170
};
@@ -340,13 +360,14 @@ static struct snd_rpi_simple_drvdata drvdata_rpi_dac = {
340360

341361
SND_SOC_DAILINK_DEFS(merus_amp,
342362
DAILINK_COMP_ARRAY(COMP_EMPTY()),
343-
DAILINK_COMP_ARRAY(COMP_CODEC("ma120x0p.1-0020","ma120x0p-amp")),
363+
DAILINK_COMP_ARRAY(COMP_CODEC("ma120x0p.1-0020", "ma120x0p-amp")),
344364
DAILINK_COMP_ARRAY(COMP_EMPTY()));
345365

346366
static struct snd_soc_dai_link snd_merus_amp_dai[] = {
347367
{
348368
.name = "MerusAmp",
349369
.stream_name = "Merus Audio Amp",
370+
.ops = &snd_merus_amp_ops,
350371
.dai_fmt = SND_SOC_DAIFMT_I2S |
351372
SND_SOC_DAIFMT_NB_NF |
352373
SND_SOC_DAIFMT_CBS_CFS,

0 commit comments

Comments
 (0)