Re: [PATCH 3.2 042/221] ALSA: hdspm - Constrain periods to 2 on older cards

From: Adrian Knoth
Date: Tue May 05 2015 - 08:54:44 EST


On 05/05/15 03:16, Ben Hutchings wrote:

> 3.2.69-rc1 review patch. If anyone has any objections, please let me know.

I do! :)

>
> From: Adrian Knoth <adi@xxxxxxxxxxxxxxxxxxxxx>
>
> commit f0153c3d948c1764f6c920a0675d86fc1d75813e upstream.
>
> RME RayDAT and AIO use a fixed buffer size of 16384 samples. With period
> sizes of 32-4096, this translates to 4-512 periods.
>
> The older RME cards have a variable buffer size but require exactly two
> periods.
>
> This patch enforces nperiods=2 on those cards.
>
> Signed-off-by: Adrian Knoth <adi@xxxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
> Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
> ---
> sound/pci/rme9652/hdspm.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> --- a/sound/pci/rme9652/hdspm.c
> +++ b/sound/pci/rme9652/hdspm.c
> @@ -6040,6 +6040,12 @@ static int snd_hdspm_capture_open(struct
> snd_pcm_hw_constraint_minmax(runtime,
> SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
> 64, 8192);
> + snd_pcm_hw_constraint_minmax(runtime,
> + SNDRV_PCM_HW_PARAM_PERIODS,
> + 2, 2);
> + snd_pcm_hw_constraint_minmax(runtime,
> + SNDRV_PCM_HW_PARAM_PERIODS,
> + 2, 2);
> break;
> }

This is not correct, those lines need to go to two different functions
(snd_hdspm_playback_open and snd_hdspm_capture_open)

Here is how the patch should look like:


--- old/hdspm.c 2015-05-05 14:37:06.265978237 +0200
+++ new/hdspm.c 2015-05-05 14:42:43.670742548 +0200
@@ -5966,6 +5966,9 @@ static int snd_hdspm_playback_open(struc
snd_pcm_hw_constraint_minmax(runtime,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
64, 8192);
+ snd_pcm_hw_constraint_minmax(runtime,
+ SNDRV_PCM_HW_PARAM_PERIODS,
+ 2, 2);
break;
}

@@ -6040,6 +6043,9 @@ static int snd_hdspm_capture_open(struct
snd_pcm_hw_constraint_minmax(runtime,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
64, 8192);
+ snd_pcm_hw_constraint_minmax(runtime,
+ SNDRV_PCM_HW_PARAM_PERIODS,
+ 2, 2);
break;
}


Cheers

PS: This exact same problem happened to GregKH for one of his stable
branches. Not sure what's the root cause and if it's worth
investigating.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/