[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230218111712.2380225-3-treapking@chromium.org>
Date: Sat, 18 Feb 2023 19:17:09 +0800
From: Pin-yen Lin <treapking@...omium.org>
To: Andrzej Hajda <andrzej.hajda@...el.com>,
Neil Armstrong <neil.armstrong@...aro.org>,
Robert Foss <rfoss@...nel.org>,
Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...il.com>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Benson Leung <bleung@...omium.org>
Cc: Chun-Kuang Hu <chunkuang.hu@...nel.org>,
devicetree@...r.kernel.org,
Nicolas Boichat <drinkcat@...omium.org>,
chrome-platform@...ts.linux.dev, linux-kernel@...r.kernel.org,
Guenter Roeck <groeck@...omium.org>,
Matthias Brugger <matthias.bgg@...il.com>,
dri-devel@...ts.freedesktop.org,
linux-mediatek@...ts.infradead.org,
Philipp Zabel <p.zabel@...gutronix.de>,
linux-arm-kernel@...ts.infradead.org,
Pin-yen Lin <treapking@...omium.org>
Subject: [PATCH v3 2/5] drm/bridge: Add .get_edid callback for anx7688 driver
Allow the driver to read EDID when ddc-i2c-bus phandle is present in
the device node.
Signed-off-by: Pin-yen Lin <treapking@...omium.org>
---
Changes in v3:
- New in v3
drivers/gpu/drm/bridge/cros-ec-anx7688.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/gpu/drm/bridge/cros-ec-anx7688.c b/drivers/gpu/drm/bridge/cros-ec-anx7688.c
index fa91bdeddef0..a16294c87940 100644
--- a/drivers/gpu/drm/bridge/cros-ec-anx7688.c
+++ b/drivers/gpu/drm/bridge/cros-ec-anx7688.c
@@ -6,6 +6,7 @@
*/
#include <drm/drm_bridge.h>
+#include <drm/drm_edid.h>
#include <drm/drm_print.h>
#include <linux/i2c.h>
#include <linux/module.h>
@@ -91,14 +92,24 @@ static bool cros_ec_anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
return totalbw >= requiredbw;
}
+static struct edid *cros_ec_anx7688_get_edid(struct drm_bridge *bridge,
+ struct drm_connector *connector)
+{
+ struct cros_ec_anx7688 *anx7688 = bridge_to_cros_ec_anx7688(bridge);
+
+ return drm_get_edid(connector, anx7688->bridge.ddc);
+}
+
static const struct drm_bridge_funcs cros_ec_anx7688_bridge_funcs = {
.mode_fixup = cros_ec_anx7688_bridge_mode_fixup,
+ .get_edid = cros_ec_anx7688_get_edid,
};
static int cros_ec_anx7688_bridge_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
struct cros_ec_anx7688 *anx7688;
+ struct device_node *phandle;
u16 vendor, device, fw_version;
u8 buffer[4];
int ret;
@@ -153,6 +164,19 @@ static int cros_ec_anx7688_bridge_probe(struct i2c_client *client)
DRM_WARN("Old ANX7688 FW version (0x%04x), not filtering\n",
fw_version);
+
+ phandle = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0);
+ if (phandle) {
+ anx7688->bridge.ddc = of_get_i2c_adapter_by_node(phandle);
+ of_node_put(phandle);
+ if (!anx7688->bridge.ddc)
+ return -EPROBE_DEFER;
+ } else {
+ dev_dbg(dev, "No I2C bus specified, disabling EDID readout\n");
+ }
+ if (anx7688->bridge.ddc)
+ anx7688->bridge.ops |= DRM_BRIDGE_OP_EDID;
+
anx7688->bridge.funcs = &cros_ec_anx7688_bridge_funcs;
drm_bridge_add(&anx7688->bridge);
--
2.39.2.637.g21b0678d19-goog
Powered by blists - more mailing lists