• Kirill Marinushkin's avatar
    ASoC: pcm512x: Move format check into `set_fmt()` · 26b97d95
    Kirill Marinushkin authored
    I would like to describe the reasoning by quoting Peter Ujfalusi
    <peter.ujfalusi@ti.com> from his review of this patch series v1 [1]:
    
    > When you bind a link you will use set_fmt for the two sides to see if
    > they can agree, that both can support what has been asked.
    >
    > The pcm512x driver just saves the fmt and say back to that card:
    > whatever, I'm fine with it. But runtime during hw_params it can fail due
    > to unsupported bus format, which it actually acked to be ok.
    >
    > This is the difference.
    >
    > Sure, some device have constraint based on the fmt towards the hw_params
    > and it is perfectly OK to do such a checks and rejections or build
    > rules/constraints based on fmt, but failing hw_params just because
    > set_fmt did not checked that the bus format is not even supported is not
    > a nice thing to do.
    
    [1] https://patchwork.kernel.org/project/alsa-devel/patch/
        20201109212133.25869-1-kmarinushkin@birdec.com/
    Signed-off-by: default avatarKirill Marinushkin <kmarinushkin@birdec.com>
    Cc: Mark Brown <broonie@kernel.org>
    Cc: Takashi Iwai <tiwai@suse.com>
    Cc: Liam Girdwood <lgirdwood@gmail.com>
    Cc: Matthias Reichl <hias@horus.com>
    Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
    Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
    Cc: alsa-devel@alsa-project.org
    Cc: linux-kernel@vger.kernel.org
    Reviewed-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
    Link: https://lore.kernel.org/r/20201115122306.18164-4-kmarinushkin@birdec.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    26b97d95
pcm512x.c 45.2 KB