drm/bridge: display-connector: add external supply support
Subsystems (4)
v3 cover drm/bridge: display-connector: add external supply support
On some devices the 5V pin of the HDMI connector and/or the ESD protection logic is powered on by a separate regulator. The dp-connector for such usecases provides dp-pwr supply support. Follow this example and make hdmi-connector support the hdmi-pwr supply.
Changes since v2:
- Changed to use proper supply name instead of hardcoded "dp-pwr" (Neil)
Changes since v1:
- Changed the pin description to HDMI +5V Power
- Renamed 'connector_pwr' to simpler 'supply'
- Extracted the common supply-handling code for DP and HDMI
Dmitry Baryshkov (3):
dt-bindings: display: hdmi-connector: add hdmi-pwr supply drm/bridge: display-connector: rename dp_pwr to connector_pwr drm/bridge: display-connector: handle hdmi-pwr supply
.../display/connector/hdmi-connector.yaml | 3 + drivers/gpu/drm/bridge/display-connector.c | 61 ++++++++++--------- 2 files changed, 35 insertions(+), 29 deletions(-)
Signature · 1 line
2.39.2
PATCH v3 1/3 dt-bindings: display: hdmi-connector: add hdmi-pwr supply
Follow the dp-connector example and add hdmi-pwr supply to drive the 5V pin of the HDMI connector (together with some simple glue logic possibly attached to the connector).
--- .../devicetree/bindings/display/connector/hdmi-connector.yaml | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/display/connector/hdmi-connector.yaml +3 -0
@@ -36,6 +36,9 @@ properties: description: GPIO signal to enable DDC bus maxItems: 1 + hdmi-pwr-supply: + description: Power supply for the HDMI +5V Power pin + port: $ref: /schemas/graph.yaml#/properties/port description: Connection to controller providing HDMI signals
Signature · 1 line
2.39.2
PATCH v3 2/3 drm/bridge: display-connector: rename dp_pwr to connector_pwr
In reply to Dmitry BaryshkovIn preparation to adding support for the hdmi_pwr supply, rename dp_pwr structure field to the generic connector_pwr.
--- drivers/gpu/drm/bridge/display-connector.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/bridge/display-connector.c +9 -9
@@ -24,7 +24,7 @@ struct display_connector {struct gpio_desc *hpd_gpio;int hpd_irq; -struct regulator *dp_pwr; +struct regulator *supply;struct gpio_desc *ddc_en; };
@@ -316,14 +316,14 @@ static int display_connector_probe(struct platform_device *pdev)if (type == DRM_MODE_CONNECTOR_DisplayPort) {int ret; - conn->dp_pwr =devm_regulator_get_optional (&pdev->dev,"dp-pwr" ); + conn->supply =devm_regulator_get_optional (&pdev->dev,"dp-pwr" ); -if (IS_ERR (conn->dp_pwr)) { - ret =PTR_ERR (conn->dp_pwr); +if (IS_ERR (conn->supply)) { + ret =PTR_ERR (conn->supply);switch (ret) {case -ENODEV : - conn->dp_pwr =NULL ; + conn->supply =NULL ;break ;case -EPROBE_DEFER :
@@ -335,8 +335,8 @@ static int display_connector_probe(struct platform_device *pdev) } } -if (conn->dp_pwr) { - ret =regulator_enable (conn->dp_pwr); +if (conn->supply) { + ret =regulator_enable (conn->supply);if (ret) {dev_err (&pdev->dev,"failed to enable DP PWR regulator: %d\n" , ret);return ret;
@@ -386,8 +386,8 @@ static void display_connector_remove(struct platform_device *pdev)if (conn->ddc_en)gpiod_set_value (conn->ddc_en,0 ); -if (conn->dp_pwr) -regulator_disable (conn->dp_pwr); +if (conn->supply) +regulator_disable (conn->supply);drm_bridge_remove (&conn->bridge);
Signature · 1 line
2.39.2
PATCH v3 3/3 drm/bridge: display-connector: handle hdmi-pwr supply
In reply to Dmitry BaryshkovOn some devices the +5V Power pin of the HDMI connector and/or the ESD protection logic is powered on by a separate regulator. Instead of declaring this regulator as always-on, make hdmi-connector support the additional hdmi-pwr supply.
--- drivers/gpu/drm/bridge/display-connector.c | 55 ++++++++++++---------- 1 file changed, 29 insertions(+), 26 deletions(-)
drivers/gpu/drm/bridge/display-connector.c +29 -26
@@ -191,6 +191,18 @@ static irqreturn_t display_connector_hpd_irq(int irq, void *arg)return IRQ_HANDLED ; } +static int display_connector_get_supply (struct platform_device *pdev, +struct display_connector *conn, +const char *name) +{ + conn->supply =devm_regulator_get_optional (&pdev->dev, name); + +if (conn->supply ==ERR_PTR (-ENODEV )) + conn->supply =NULL ; + +return PTR_ERR_OR_ZERO (conn->supply); +} +static int display_connector_probe (struct platform_device *pdev) {struct display_connector *conn;
@@ -316,36 +328,15 @@ static int display_connector_probe(struct platform_device *pdev)if (type == DRM_MODE_CONNECTOR_DisplayPort) {int ret; - conn->supply =devm_regulator_get_optional (&pdev->dev,"dp-pwr" ); - -if (IS_ERR (conn->supply)) { - ret =PTR_ERR (conn->supply); - -switch (ret) { -case -ENODEV : - conn->supply =NULL ; -break ; - -case -EPROBE_DEFER : -return -EPROBE_DEFER ; - -default : -dev_err (&pdev->dev,"failed to get DP PWR regulator: %d\n" , ret); -return ret; - } - } - -if (conn->supply) { - ret =regulator_enable (conn->supply); -if (ret) { -dev_err (&pdev->dev,"failed to enable DP PWR regulator: %d\n" , ret); -return ret; - } - } + ret =display_connector_get_supply (pdev, conn,"dp-pwr" ); +if (ret <0 ) +return dev_err_probe (&pdev->dev, ret,"failed to get DP PWR regulator\n" ); }/* enable DDC */ if (type ==DRM_MODE_CONNECTOR_HDMIA ) { +int ret; + conn->ddc_en =devm_gpiod_get_optional (&pdev->dev,"ddc-en" ,GPIOD_OUT_HIGH );
@@ -353,6 +344,18 @@ static int display_connector_probe(struct platform_device *pdev)dev_err (&pdev->dev,"Couldn't get ddc-en gpio\n" );return PTR_ERR (conn->ddc_en); } + + ret =display_connector_get_supply (pdev, conn,"hdmi-pwr" ); +if (ret <0 ) +return dev_err_probe (&pdev->dev, ret,"failed to get HDMI +5V Power regulator\n" ); + } + +if (conn->supply) { + ret =regulator_enable (conn->supply); +if (ret) { +dev_err (&pdev->dev,"failed to enable PWR regulator: %d\n" , ret); +return ret; + } } conn->bridge.funcs = &display_connector_bridge_funcs;
Signature · 1 line
2.39.2
Hi,
Quoted 9 lines · Dmitry Baryshkov
On some devices the 5V pin of the HDMI connector and/or the ESD protection logic is powered on by a separate regulator. The dp-connector for such usecases provides dp-pwr supply support. Follow this example and make hdmi-connector support the hdmi-pwr supply.
Changes since v2:
- Changed to use proper supply name instead of hardcoded "dp-pwr" (Neil)[...]
Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next)
[1/3] dt-bindings: display: hdmi-connector: add hdmi-pwr supply
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=41b74821751466457dc8b87606ac4d71ec568d4e [2/3] drm/bridge: display-connector: rename dp_pwr to connector_pwr https://cgit.freedesktop.org/drm/drm-misc/commit/?id=99304fd0050314a0c998c28300393ec574998db9 [3/3] drm/bridge: display-connector: handle hdmi-pwr supply https://cgit.freedesktop.org/drm/drm-misc/commit/?id=6eb6b6f0a012993070b26dacb5ea1ff5fc233c18
Signature · 1 line
Neil