linux/sound/soc/meson/gx-interface.h
Valerio Setti e82159384a
ASoC: meson: aiu-encoder-i2s: use the core symmetric_rate handling
The driver manually implement the interface-wide rate symmetry enforcement
in hw_params(), which suffers from the same problem addressed in the
previous patch: the restriction is not visible in the hw parameter
constraints, so a stream with a mismatching rate only finds out via
-EINVAL late in the stream setup.

The ASoC core already provides this feature through the DAI's
'symmetric_rate' flag: when another stream of the DAI is active,
soc_pcm_apply_symmetry() constrains the rate at open time so the
restriction shows up during parameter refinement, and
soc_pcm_params_symmetry() still rejects a mismatch at hw_params()
time as a backstop.

Set 'symmetric_rate' on the I2S encoder DAI and drop the open-coded
check along with the now unused 'rate' member of struct gx_iface.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Link: https://patch.msgid.link/20260710-aiu-improve-quirk-check-v1-3-2fdd1b6f8896@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2026-07-27 14:39:24 +01:00

43 lines
934 B
C

/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
/*
* Copyright (c) 2026 Baylibre SAS.
* Author: Valerio Setti <vsetti@baylibre.com>
*/
#ifndef _MESON_GX_INTERFACE_H
#define _MESON_GX_INTERFACE_H
#include <linux/clk.h>
#include <linux/regmap.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/soc-dai.h>
struct gx_iface {
struct clk *mclk;
unsigned long mclk_rate;
/* format is common to all the DAIs of the iface */
unsigned int fmt;
};
struct gx_stream {
struct gx_iface *iface;
struct list_head formatter_list;
struct mutex lock;
unsigned int channels;
unsigned int width;
unsigned int physical_width;
bool ready;
/* For continuous clock tracking */
bool clk_enabled;
};
struct gx_stream *gx_stream_alloc(struct gx_iface *iface);
void gx_stream_free(struct gx_stream *ts);
int gx_stream_start(struct gx_stream *ts);
void gx_stream_stop(struct gx_stream *ts);
#endif /* _MESON_GX_INTERFACE_H */