Skip to content

Commit 9201690

Browse files
smaeulmripard
authored andcommitted
drm/sun4i: dw-hdmi: Fix ddc-en GPIO consumer conflict
commit 6de79dd ("drm/bridge: display-connector: add ddc-en gpio support") added a consumer for this GPIO in the HDMI connector device. This new consumer conflicts with the pre-existing GPIO consumer in the sun8i HDMI controller driver, which prevents the driver from probing: [ 4.983358] display-connector connector: GPIO lookup for consumer ddc-en [ 4.983364] display-connector connector: using device tree for GPIO lookup [ 4.983392] gpio-226 (ddc-en): gpiod_request: status -16 [ 4.983399] sun8i-dw-hdmi 6000000.hdmi: Couldn't get ddc-en gpio [ 4.983618] sun4i-drm display-engine: failed to bind 6000000.hdmi (ops sun8i_dw_hdmi_ops [sun8i_drm_hdmi]): -16 [ 4.984082] sun4i-drm display-engine: Couldn't bind all pipelines components [ 4.984171] sun4i-drm display-engine: adev bind failed: -16 [ 4.984179] sun8i-dw-hdmi: probe of 6000000.hdmi failed with error -16 Both drivers have the same behavior: they leave the GPIO active for the life of the device. Let's take advantage of the new implementation, and drop the now-obsolete code from the HDMI controller driver. Fixes: 6de79dd ("drm/bridge: display-connector: add ddc-en gpio support") Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://lore.kernel.org/r/20220614073100.11550-1-samuel@sholland.org
1 parent 0f9cd1e commit 9201690

2 files changed

Lines changed: 4 additions & 52 deletions

File tree

drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -93,34 +93,10 @@ static u32 sun8i_dw_hdmi_find_possible_crtcs(struct drm_device *drm,
9393
return crtcs;
9494
}
9595

96-
static int sun8i_dw_hdmi_find_connector_pdev(struct device *dev,
97-
struct platform_device **pdev_out)
98-
{
99-
struct platform_device *pdev;
100-
struct device_node *remote;
101-
102-
remote = of_graph_get_remote_node(dev->of_node, 1, -1);
103-
if (!remote)
104-
return -ENODEV;
105-
106-
if (!of_device_is_compatible(remote, "hdmi-connector")) {
107-
of_node_put(remote);
108-
return -ENODEV;
109-
}
110-
111-
pdev = of_find_device_by_node(remote);
112-
of_node_put(remote);
113-
if (!pdev)
114-
return -ENODEV;
115-
116-
*pdev_out = pdev;
117-
return 0;
118-
}
119-
12096
static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
12197
void *data)
12298
{
123-
struct platform_device *pdev = to_platform_device(dev), *connector_pdev;
99+
struct platform_device *pdev = to_platform_device(dev);
124100
struct dw_hdmi_plat_data *plat_data;
125101
struct drm_device *drm = data;
126102
struct device_node *phy_node;
@@ -167,30 +143,16 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
167143
return dev_err_probe(dev, PTR_ERR(hdmi->regulator),
168144
"Couldn't get regulator\n");
169145

170-
ret = sun8i_dw_hdmi_find_connector_pdev(dev, &connector_pdev);
171-
if (!ret) {
172-
hdmi->ddc_en = gpiod_get_optional(&connector_pdev->dev,
173-
"ddc-en", GPIOD_OUT_HIGH);
174-
platform_device_put(connector_pdev);
175-
176-
if (IS_ERR(hdmi->ddc_en)) {
177-
dev_err(dev, "Couldn't get ddc-en gpio\n");
178-
return PTR_ERR(hdmi->ddc_en);
179-
}
180-
}
181-
182146
ret = regulator_enable(hdmi->regulator);
183147
if (ret) {
184148
dev_err(dev, "Failed to enable regulator\n");
185-
goto err_unref_ddc_en;
149+
return ret;
186150
}
187151

188-
gpiod_set_value(hdmi->ddc_en, 1);
189-
190152
ret = reset_control_deassert(hdmi->rst_ctrl);
191153
if (ret) {
192154
dev_err(dev, "Could not deassert ctrl reset control\n");
193-
goto err_disable_ddc_en;
155+
goto err_disable_regulator;
194156
}
195157

196158
ret = clk_prepare_enable(hdmi->clk_tmds);
@@ -245,12 +207,8 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
245207
clk_disable_unprepare(hdmi->clk_tmds);
246208
err_assert_ctrl_reset:
247209
reset_control_assert(hdmi->rst_ctrl);
248-
err_disable_ddc_en:
249-
gpiod_set_value(hdmi->ddc_en, 0);
210+
err_disable_regulator:
250211
regulator_disable(hdmi->regulator);
251-
err_unref_ddc_en:
252-
if (hdmi->ddc_en)
253-
gpiod_put(hdmi->ddc_en);
254212

255213
return ret;
256214
}
@@ -264,11 +222,7 @@ static void sun8i_dw_hdmi_unbind(struct device *dev, struct device *master,
264222
sun8i_hdmi_phy_deinit(hdmi->phy);
265223
clk_disable_unprepare(hdmi->clk_tmds);
266224
reset_control_assert(hdmi->rst_ctrl);
267-
gpiod_set_value(hdmi->ddc_en, 0);
268225
regulator_disable(hdmi->regulator);
269-
270-
if (hdmi->ddc_en)
271-
gpiod_put(hdmi->ddc_en);
272226
}
273227

274228
static const struct component_ops sun8i_dw_hdmi_ops = {

drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <drm/bridge/dw_hdmi.h>
1010
#include <drm/drm_encoder.h>
1111
#include <linux/clk.h>
12-
#include <linux/gpio/consumer.h>
1312
#include <linux/regmap.h>
1413
#include <linux/regulator/consumer.h>
1514
#include <linux/reset.h>
@@ -193,7 +192,6 @@ struct sun8i_dw_hdmi {
193192
struct regulator *regulator;
194193
const struct sun8i_dw_hdmi_quirks *quirks;
195194
struct reset_control *rst_ctrl;
196-
struct gpio_desc *ddc_en;
197195
};
198196

199197
extern struct platform_driver sun8i_hdmi_phy_driver;

0 commit comments

Comments
 (0)