On 16/01/2023 16:12, Vincenzo Frascino wrote:
Currently the tda998x driver always includes the hdmi-codec definition. These make sense only when CONFIG_SND_SOC_HDMI_CODEC is enabled.
Address the issue guarding correctly the interested sections of the tda998x driver.
Co-developed-by: Kevin Brodsky kevin.brodsky@arm.com Signed-off-by: Vincenzo Frascino vincenzo.frascino@arm.com
drivers/gpu/drm/i2c/tda998x_drv.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index b7ec6c374fbd..0da792f3dacd 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -10,8 +10,13 @@ #include <linux/module.h> #include <linux/platform_data/tda9950.h> #include <linux/irq.h> +#ifdef CONFIG_SND_SOC_HDMI_CODEC #include <sound/asoundef.h> #include <sound/hdmi-codec.h> +#else +#include <linux/delay.h> +#include <linux/platform_device.h> +#endif #include <drm/drm_atomic_helper.h> #include <drm/drm_bridge.h> @@ -896,6 +901,7 @@ static const struct tda998x_audio_route tda998x_audio_route[AUDIO_ROUTE_NUM] = { }, }; +#ifdef CONFIG_SND_SOC_HDMI_CODEC /* Configure the TDA998x audio data and clock routing. */ static int tda998x_derive_routing(struct tda998x_priv *priv, struct tda998x_audio_settings *s, @@ -910,6 +916,7 @@ static int tda998x_derive_routing(struct tda998x_priv *priv, return 0; } +#endif /*
- The audio clock divisor register controls a divider producing Audio_Clk_Out
@@ -1059,6 +1066,7 @@ static void tda998x_configure_audio(struct tda998x_priv *priv) tda998x_write_aif(priv, &settings->cea); } +#ifdef CONFIG_SND_SOC_HDMI_CODEC static int tda998x_audio_hw_params(struct device *dev, void *data, struct hdmi_codec_daifmt *daifmt, struct hdmi_codec_params *params) @@ -1158,7 +1166,9 @@ static int tda998x_audio_get_eld(struct device *dev, void *data, return 0; } +#endif +#ifdef CONFIG_SND_SOC_HDMI_CODEC
Nit: I suppose we don't need this #ifdef and the #endif above, as it all forms just one (logical) block?
static const struct hdmi_codec_ops audio_codec_ops = { .hw_params = tda998x_audio_hw_params, .audio_shutdown = tda998x_audio_shutdown, @@ -1186,6 +1196,7 @@ static int tda998x_audio_codec_init(struct tda998x_priv *priv, return PTR_ERR_OR_ZERO(priv->audio_pdev); } +#endif
Nit: /* CONFIG_SND_SOC_HDMI_CODEC */ (the block is big so hard to see where it starts)
Kevin
/* DRM connector functions */ @@ -1975,9 +1986,11 @@ static int tda998x_create(struct device *dev) if (ret) goto fail; +#ifdef CONFIG_SND_SOC_HDMI_CODEC if (priv->audio_port_enable[AUDIO_ROUTE_I2S] || priv->audio_port_enable[AUDIO_ROUTE_SPDIF]) tda998x_audio_codec_init(priv, &client->dev); +#endif } else if (dev->platform_data) { ret = tda998x_set_config(priv, dev->platform_data); if (ret)