2022-04-14 22:08:22

by Hsin-Yi Wang

[permalink] [raw]
Subject: [PATCH] drm/bridge: anx7625: Fill in empty ELD when no connector

Speaker may share I2S with DP and .get_eld callback will be called when
speaker is playing. When HDMI wans't connected, the connector will be
null. Instead of return an error, fill in empty ELD.

Signed-off-by: Hsin-Yi Wang <[email protected]>
---
drivers/gpu/drm/bridge/analogix/anx7625.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index 6516f9570b86..f2bc30c98c77 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -1932,14 +1932,14 @@ static int anx7625_audio_get_eld(struct device *dev, void *data,
struct anx7625_data *ctx = dev_get_drvdata(dev);

if (!ctx->connector) {
- dev_err(dev, "connector not initial\n");
- return -EINVAL;
+ /* Pass en empty ELD if connector not available */
+ memset(buf, 0, len);
+ } else {
+ dev_dbg(dev, "audio copy eld\n");
+ memcpy(buf, ctx->connector->eld,
+ min(sizeof(ctx->connector->eld), len));
}

- dev_dbg(dev, "audio copy eld\n");
- memcpy(buf, ctx->connector->eld,
- min(sizeof(ctx->connector->eld), len));
-
return 0;
}

--
2.35.1.1178.g4f1659d476-goog


2022-04-19 08:55:59

by Xin Ji

[permalink] [raw]
Subject: Re: [PATCH] drm/bridge: anx7625: Fill in empty ELD when no connector

On Thu, Apr 14, 2022 at 05:00:04PM +0800, Hsin-Yi Wang wrote:
> Speaker may share I2S with DP and .get_eld callback will be called when
> speaker is playing. When HDMI wans't connected, the connector will be
> null. Instead of return an error, fill in empty ELD.
>
> Signed-off-by: Hsin-Yi Wang <[email protected]>
> ---
> drivers/gpu/drm/bridge/analogix/anx7625.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
> index 6516f9570b86..f2bc30c98c77 100644
> --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> @@ -1932,14 +1932,14 @@ static int anx7625_audio_get_eld(struct device *dev, void *data,
> struct anx7625_data *ctx = dev_get_drvdata(dev);
>
> if (!ctx->connector) {
> - dev_err(dev, "connector not initial\n");
> - return -EINVAL;
> + /* Pass en empty ELD if connector not available */
> + memset(buf, 0, len);
> + } else {
> + dev_dbg(dev, "audio copy eld\n");
> + memcpy(buf, ctx->connector->eld,
> + min(sizeof(ctx->connector->eld), len));
> }
>
> - dev_dbg(dev, "audio copy eld\n");
> - memcpy(buf, ctx->connector->eld,
> - min(sizeof(ctx->connector->eld), len));
> -
> return 0;
Hi Hsin-Yi, it's OK for me.
Reviewed-by: Xin Ji <[email protected]>

Thanks,
Xin
> }
>
> --
> 2.35.1.1178.g4f1659d476-goog

2022-04-19 22:11:18

by Robert Foss

[permalink] [raw]
Subject: Re: [PATCH] drm/bridge: anx7625: Fill in empty ELD when no connector

On Tue, 19 Apr 2022 at 04:29, Xin Ji <[email protected]> wrote:
>
> On Thu, Apr 14, 2022 at 05:00:04PM +0800, Hsin-Yi Wang wrote:
> > Speaker may share I2S with DP and .get_eld callback will be called when
> > speaker is playing. When HDMI wans't connected, the connector will be
> > null. Instead of return an error, fill in empty ELD.
> >
> > Signed-off-by: Hsin-Yi Wang <[email protected]>
> > ---
> > drivers/gpu/drm/bridge/analogix/anx7625.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > index 6516f9570b86..f2bc30c98c77 100644
> > --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> > +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > @@ -1932,14 +1932,14 @@ static int anx7625_audio_get_eld(struct device *dev, void *data,
> > struct anx7625_data *ctx = dev_get_drvdata(dev);
> >
> > if (!ctx->connector) {
> > - dev_err(dev, "connector not initial\n");
> > - return -EINVAL;
> > + /* Pass en empty ELD if connector not available */
> > + memset(buf, 0, len);
> > + } else {
> > + dev_dbg(dev, "audio copy eld\n");
> > + memcpy(buf, ctx->connector->eld,
> > + min(sizeof(ctx->connector->eld), len));
> > }
> >
> > - dev_dbg(dev, "audio copy eld\n");
> > - memcpy(buf, ctx->connector->eld,
> > - min(sizeof(ctx->connector->eld), len));
> > -
> > return 0;
> Hi Hsin-Yi, it's OK for me.
> Reviewed-by: Xin Ji <[email protected]>

Applied to drm-misc-next