mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
Allwinner: linux: workaround EDID reading failure
This commit is contained in:
parent
6285fc141b
commit
612505170b
@ -4168,7 +4168,7 @@ CONFIG_DRM_PANEL_BRIDGE=y
|
||||
# CONFIG_DRM_CDNS_DSI is not set
|
||||
# CONFIG_DRM_CHIPONE_ICN6211 is not set
|
||||
# CONFIG_DRM_CHRONTEL_CH7033 is not set
|
||||
CONFIG_DRM_DISPLAY_CONNECTOR=y
|
||||
# CONFIG_DRM_DISPLAY_CONNECTOR is not set
|
||||
# CONFIG_DRM_ITE_IT6505 is not set
|
||||
# CONFIG_DRM_LONTIUM_LT8912B is not set
|
||||
# CONFIG_DRM_LONTIUM_LT9211 is not set
|
||||
|
@ -0,0 +1,131 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Date: Fri, 14 Oct 2022 23:35:13 +0200
|
||||
Subject: [PATCH] Revert "drm/sun4i: dw-hdmi: Fix ddc-en GPIO consumer
|
||||
conflict"
|
||||
|
||||
This reverts commit 920169041baa0a7497ed702aa97d6a2d6285efd3.
|
||||
---
|
||||
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 54 +++++++++++++++++++++++++--
|
||||
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 2 +
|
||||
2 files changed, 52 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
|
||||
index 477cb6985b4d..a8d75fd7e9f4 100644
|
||||
--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
|
||||
+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
|
||||
@@ -93,10 +93,34 @@ static u32 sun8i_dw_hdmi_find_possible_crtcs(struct drm_device *drm,
|
||||
return crtcs;
|
||||
}
|
||||
|
||||
+static int sun8i_dw_hdmi_find_connector_pdev(struct device *dev,
|
||||
+ struct platform_device **pdev_out)
|
||||
+{
|
||||
+ struct platform_device *pdev;
|
||||
+ struct device_node *remote;
|
||||
+
|
||||
+ remote = of_graph_get_remote_node(dev->of_node, 1, -1);
|
||||
+ if (!remote)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ if (!of_device_is_compatible(remote, "hdmi-connector")) {
|
||||
+ of_node_put(remote);
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+
|
||||
+ pdev = of_find_device_by_node(remote);
|
||||
+ of_node_put(remote);
|
||||
+ if (!pdev)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ *pdev_out = pdev;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
|
||||
void *data)
|
||||
{
|
||||
- struct platform_device *pdev = to_platform_device(dev);
|
||||
+ struct platform_device *pdev = to_platform_device(dev), *connector_pdev;
|
||||
struct dw_hdmi_plat_data *plat_data;
|
||||
struct drm_device *drm = data;
|
||||
struct device_node *phy_node;
|
||||
@@ -143,16 +167,30 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
|
||||
return dev_err_probe(dev, PTR_ERR(hdmi->regulator),
|
||||
"Couldn't get regulator\n");
|
||||
|
||||
+ ret = sun8i_dw_hdmi_find_connector_pdev(dev, &connector_pdev);
|
||||
+ if (!ret) {
|
||||
+ hdmi->ddc_en = gpiod_get_optional(&connector_pdev->dev,
|
||||
+ "ddc-en", GPIOD_OUT_HIGH);
|
||||
+ platform_device_put(connector_pdev);
|
||||
+
|
||||
+ if (IS_ERR(hdmi->ddc_en)) {
|
||||
+ dev_err(dev, "Couldn't get ddc-en gpio\n");
|
||||
+ return PTR_ERR(hdmi->ddc_en);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
ret = regulator_enable(hdmi->regulator);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to enable regulator\n");
|
||||
- return ret;
|
||||
+ goto err_unref_ddc_en;
|
||||
}
|
||||
|
||||
+ gpiod_set_value(hdmi->ddc_en, 1);
|
||||
+
|
||||
ret = reset_control_deassert(hdmi->rst_ctrl);
|
||||
if (ret) {
|
||||
dev_err(dev, "Could not deassert ctrl reset control\n");
|
||||
- goto err_disable_regulator;
|
||||
+ goto err_disable_ddc_en;
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(hdmi->clk_tmds);
|
||||
@@ -207,8 +245,12 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
|
||||
clk_disable_unprepare(hdmi->clk_tmds);
|
||||
err_assert_ctrl_reset:
|
||||
reset_control_assert(hdmi->rst_ctrl);
|
||||
-err_disable_regulator:
|
||||
+err_disable_ddc_en:
|
||||
+ gpiod_set_value(hdmi->ddc_en, 0);
|
||||
regulator_disable(hdmi->regulator);
|
||||
+err_unref_ddc_en:
|
||||
+ if (hdmi->ddc_en)
|
||||
+ gpiod_put(hdmi->ddc_en);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -222,7 +264,11 @@ static void sun8i_dw_hdmi_unbind(struct device *dev, struct device *master,
|
||||
sun8i_hdmi_phy_deinit(hdmi->phy);
|
||||
clk_disable_unprepare(hdmi->clk_tmds);
|
||||
reset_control_assert(hdmi->rst_ctrl);
|
||||
+ gpiod_set_value(hdmi->ddc_en, 0);
|
||||
regulator_disable(hdmi->regulator);
|
||||
+
|
||||
+ if (hdmi->ddc_en)
|
||||
+ gpiod_put(hdmi->ddc_en);
|
||||
}
|
||||
|
||||
static const struct component_ops sun8i_dw_hdmi_ops = {
|
||||
diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
|
||||
index ab80d52a70bb..f082b8ecfe2c 100644
|
||||
--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
|
||||
+++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <drm/bridge/dw_hdmi.h>
|
||||
#include <drm/drm_encoder.h>
|
||||
#include <linux/clk.h>
|
||||
+#include <linux/gpio/consumer.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/reset.h>
|
||||
@@ -187,6 +188,7 @@ struct sun8i_dw_hdmi {
|
||||
struct regulator *regulator;
|
||||
const struct sun8i_dw_hdmi_quirks *quirks;
|
||||
struct reset_control *rst_ctrl;
|
||||
+ struct gpio_desc *ddc_en;
|
||||
};
|
||||
|
||||
extern struct platform_driver sun8i_hdmi_phy_driver;
|
Loading…
x
Reference in New Issue
Block a user