Skip to contentSkip to conversation

drm/bridge: anx7625: Fill in empty ELD when no connector

PATCH Applied Hsin-Yi Wang 3 participants 3 messages Apr 14, 2022 – Apr 19, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +6 -6
index 6516f9570b86..f2bc30c98c77 100644
@@ -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;
 }
 
Signature · 1 line
2.35.1.1178.g4f1659d476-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 22 lines · Hsin-Yi Wang

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.

---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +3 -2
index 6516f9570b86..f2bc30c98c77 100644
@@ -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 {

drivers/gpu/drm/bridge/analogix/anx7625.c static int anx7625_audio_get_eld(struct device *dev, void *data, · line 1943

Quoted 10 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +3 -4
+		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.

Thanks,
Xin

Quoted 4 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0 -0
 }
 
Signature · 1 line
2.35.1.1178.g4f1659d476-goog
Applied
#2 lore raw
Quoted 29 lines · Xin Ji
Quoted 27 lines · Hsin-Yi Wang

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.

---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +6 -2
index 6516f9570b86..f2bc30c98c77 100644
@@ -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));
      }
 
Quoted 7 lines

drivers/gpu/drm/bridge/analogix/anx7625.c static int anx7625_audio_get_eld(struct device *dev, void *data, · line 1943

Quoted 5 lines
drivers/gpu/drm/bridge/analogix/anx7625.c +0 -4
-     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.

Applied to drm-misc-next