Hi,
could I please get an Acked-by for patch 3 from someone who feels responsible for the rockchip hdmi driver? This patch factors out the mostly identical imx_drm_encoder_get_mux_id and rockchip_drm_encoder_get_mux_id functions into a common helper to parse the active endpoint and two inline functions to return its id or port id.
Changes since v2: - Add missing #include drm_of.h to imx-ldb.c
regards Philipp
Philipp Zabel (3): drm: add drm_of_encoder_active_endpoint helpers drm/imx: remove imx_drm_encoder_get_mux_id drm/rockchip: remove rockchip_drm_encoder_get_mux_id
drivers/gpu/drm/drm_of.c | 34 +++++++++++++++++++++++++++++ drivers/gpu/drm/imx/dw_hdmi-imx.c | 2 +- drivers/gpu/drm/imx/imx-drm-core.c | 30 ------------------------- drivers/gpu/drm/imx/imx-drm.h | 2 -- drivers/gpu/drm/imx/imx-ldb.c | 5 +++-- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 30 ------------------------- drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 2 -- include/drm/drm_of.h | 33 ++++++++++++++++++++++++++++ 9 files changed, 72 insertions(+), 68 deletions(-)
This patch adds a helper to parse the encoder endpoint connected to the encoder's crtc and two helpers to return its id and port id.
This can be used to determine input mux setting from endpoint or port ids.
Suggested-by: Daniel Kurtz djkurtz@chromium.org Reviewed-by: Daniel Kurtz djkurtz@chromium.org Signed-off-by: Philipp Zabel p.zabel@pengutronix.de --- drivers/gpu/drm/drm_of.c | 34 ++++++++++++++++++++++++++++++++++ include/drm/drm_of.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+)
diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index be38840..0c9714cd 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -61,3 +61,37 @@ uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, return possible_crtcs; } EXPORT_SYMBOL(drm_of_find_possible_crtcs); + +/* + * drm_of_encoder_active_endpoint - return the active encoder endpoint + * @node: device tree node containing encoder input ports + * @encoder: drm_encoder + * + * Given an encoder device node and a drm_encoder with a connected crtc, + * parse the encoder endpoint connecting to the crtc port. + */ +int drm_of_encoder_active_endpoint(struct device_node *node, + struct drm_encoder *encoder, + struct of_endpoint *endpoint) +{ + struct device_node *ep; + struct drm_crtc *crtc = encoder->crtc; + struct device_node *port; + int ret; + + if (!node || !crtc) + return -EINVAL; + + for_each_endpoint_of_node(node, ep) { + port = of_graph_get_remote_port(ep); + of_node_put(port); + if (port == crtc->port) { + ret = of_graph_parse_endpoint(ep, endpoint); + of_node_put(ep); + return ret; + } + } + + return -EINVAL; +} +EXPORT_SYMBOL_GPL(drm_of_encoder_active_endpoint); diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index 2441f71..efd3b44 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -1,18 +1,51 @@ #ifndef __DRM_OF_H__ #define __DRM_OF_H__
+#include <linux/of_graph.h> + struct drm_device; +struct drm_encoder; struct device_node;
#ifdef CONFIG_OF extern uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, struct device_node *port); +extern int drm_of_encoder_active_endpoint(struct device_node *node, + struct drm_encoder *encoder, + struct of_endpoint *endpoint); #else static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, struct device_node *port) { return 0; } + +static inline int drm_of_encoder_active_endpoint(struct device_node *node, + struct drm_encoder *encoder, + struct of_endpoint *endpoint) +{ + return -EINVAL; +} #endif
+static inline int drm_of_encoder_active_endpoint_id(struct device_node *node, + struct drm_encoder *encoder) +{ + struct of_endpoint endpoint; + int ret = drm_of_encoder_active_endpoint(node, encoder, + &endpoint); + + return ret ?: endpoint.id; +} + +static inline int drm_of_encoder_active_port_id(struct device_node *node, + struct drm_encoder *encoder) +{ + struct of_endpoint endpoint; + int ret = drm_of_encoder_active_endpoint(node, encoder, + &endpoint); + + return ret ?: endpoint.port; +} + #endif /* __DRM_OF_H__ */
On Thu, Aug 27, 2015 at 12:56:05PM +0200, Philipp Zabel wrote:
This patch adds a helper to parse the encoder endpoint connected to the encoder's crtc and two helpers to return its id and port id.
This can be used to determine input mux setting from endpoint or port ids.
Suggested-by: Daniel Kurtz djkurtz@chromium.org Reviewed-by: Daniel Kurtz djkurtz@chromium.org Signed-off-by: Philipp Zabel p.zabel@pengutronix.de
drivers/gpu/drm/drm_of.c | 34 ++++++++++++++++++++++++++++++++++ include/drm/drm_of.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+)
diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index be38840..0c9714cd 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -61,3 +61,37 @@ uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, return possible_crtcs; } EXPORT_SYMBOL(drm_of_find_possible_crtcs);
+/*
- drm_of_encoder_active_endpoint - return the active encoder endpoint
- @node: device tree node containing encoder input ports
- @encoder: drm_encoder
- Given an encoder device node and a drm_encoder with a connected crtc,
- parse the encoder endpoint connecting to the crtc port.
- */
Can you please write proper kerneldoc for this plus pull drm_of.c into the docbook template? Some overview comments in a DOC: section (maybe even with code snippets/examples, we can do those now in 4.3) would be even better. -Daniel
+int drm_of_encoder_active_endpoint(struct device_node *node,
struct drm_encoder *encoder,
struct of_endpoint *endpoint)
+{
- struct device_node *ep;
- struct drm_crtc *crtc = encoder->crtc;
- struct device_node *port;
- int ret;
- if (!node || !crtc)
return -EINVAL;
- for_each_endpoint_of_node(node, ep) {
port = of_graph_get_remote_port(ep);
of_node_put(port);
if (port == crtc->port) {
ret = of_graph_parse_endpoint(ep, endpoint);
of_node_put(ep);
return ret;
}
- }
- return -EINVAL;
+} +EXPORT_SYMBOL_GPL(drm_of_encoder_active_endpoint); diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index 2441f71..efd3b44 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -1,18 +1,51 @@ #ifndef __DRM_OF_H__ #define __DRM_OF_H__
+#include <linux/of_graph.h>
struct drm_device; +struct drm_encoder; struct device_node;
#ifdef CONFIG_OF extern uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, struct device_node *port); +extern int drm_of_encoder_active_endpoint(struct device_node *node,
struct drm_encoder *encoder,
struct of_endpoint *endpoint);
#else static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, struct device_node *port) { return 0; }
+static inline int drm_of_encoder_active_endpoint(struct device_node *node,
struct drm_encoder *encoder,
struct of_endpoint *endpoint)
+{
- return -EINVAL;
+} #endif
+static inline int drm_of_encoder_active_endpoint_id(struct device_node *node,
struct drm_encoder *encoder)
+{
- struct of_endpoint endpoint;
- int ret = drm_of_encoder_active_endpoint(node, encoder,
&endpoint);
- return ret ?: endpoint.id;
+}
+static inline int drm_of_encoder_active_port_id(struct device_node *node,
struct drm_encoder *encoder)
+{
- struct of_endpoint endpoint;
- int ret = drm_of_encoder_active_endpoint(node, encoder,
&endpoint);
- return ret ?: endpoint.port;
+}
#endif /* __DRM_OF_H__ */
2.5.0
Hi Daniel,
Am Donnerstag, den 27.08.2015, 16:22 +0200 schrieb Daniel Vetter: [...]
+/*
- drm_of_encoder_active_endpoint - return the active encoder endpoint
- @node: device tree node containing encoder input ports
- @encoder: drm_encoder
- Given an encoder device node and a drm_encoder with a connected crtc,
- parse the encoder endpoint connecting to the crtc port.
- */
Can you please write proper kerneldoc for this plus pull drm_of.c into the docbook template? Some overview comments in a DOC: section (maybe even with code snippets/examples, we can do those now in 4.3) would be even better.
Ok. Do you have a pointer or example how to include code snippets in DOC: sections? Where would you put this into drm.tmpl? I could add a device tree section at the end, before the legacy section:
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 9ddf8c6..b396fa1 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl @@ -3755,6 +3755,17 @@ int num_ioctls;</synopsis> </sect2> </sect1> <sect1> + <title>Device Tree Helper Functions</title> + <para> + This section covers helper functions for common device tree bindings. + </para> + <sect2> +!Edrivers/gpu/drm/drm_of.c +!Iinclude/drm/drm_of.h +!Pdrivers/gpu/drm/drm_of.c overview + </sect2> + </sect1> + <sect1> <title>Legacy Support Code</title> <para> The section very briefly covers some of the old legacy support code which
thanks Philipp
It is replaced by drm_of_encoder_active_port_id.
Suggested-by: Daniel Kurtz djkurtz@chromium.org Signed-off-by: Philipp Zabel p.zabel@pengutronix.de --- Changes since v2: - Add missing #include drm_of.h to imx-ldb.c --- drivers/gpu/drm/imx/dw_hdmi-imx.c | 2 +- drivers/gpu/drm/imx/imx-drm-core.c | 30 ------------------------------ drivers/gpu/drm/imx/imx-drm.h | 2 -- drivers/gpu/drm/imx/imx-ldb.c | 5 +++-- 4 files changed, 4 insertions(+), 35 deletions(-)
diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c b/drivers/gpu/drm/imx/dw_hdmi-imx.c index 644edf6..4aad6bc 100644 --- a/drivers/gpu/drm/imx/dw_hdmi-imx.c +++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c @@ -119,7 +119,7 @@ static void dw_hdmi_imx_encoder_mode_set(struct drm_encoder *encoder, static void dw_hdmi_imx_encoder_commit(struct drm_encoder *encoder) { struct imx_hdmi *hdmi = container_of(encoder, struct imx_hdmi, encoder); - int mux = imx_drm_encoder_get_mux_id(hdmi->dev->of_node, encoder); + int mux = drm_of_encoder_active_port_id(hdmi->dev->of_node, encoder);
regmap_update_bits(hdmi->regmap, IOMUXC_GPR3, IMX6Q_GPR3_HDMI_MUX_CTL_MASK, diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 74f505b..8f85585 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -431,36 +431,6 @@ int imx_drm_encoder_parse_of(struct drm_device *drm, } EXPORT_SYMBOL_GPL(imx_drm_encoder_parse_of);
-/* - * @node: device tree node containing encoder input ports - * @encoder: drm_encoder - */ -int imx_drm_encoder_get_mux_id(struct device_node *node, - struct drm_encoder *encoder) -{ - struct imx_drm_crtc *imx_crtc = imx_drm_find_crtc(encoder->crtc); - struct device_node *ep; - struct of_endpoint endpoint; - struct device_node *port; - int ret; - - if (!node || !imx_crtc) - return -EINVAL; - - for_each_endpoint_of_node(node, ep) { - port = of_graph_get_remote_port(ep); - of_node_put(port); - if (port == imx_crtc->crtc->port) { - ret = of_graph_parse_endpoint(ep, &endpoint); - of_node_put(ep); - return ret ? ret : endpoint.port; - } - } - - return -EINVAL; -} -EXPORT_SYMBOL_GPL(imx_drm_encoder_get_mux_id); - static const struct drm_ioctl_desc imx_drm_ioctls[] = { /* none so far */ }; diff --git a/drivers/gpu/drm/imx/imx-drm.h b/drivers/gpu/drm/imx/imx-drm.h index 28e776d..10ed4e1 100644 --- a/drivers/gpu/drm/imx/imx-drm.h +++ b/drivers/gpu/drm/imx/imx-drm.h @@ -45,8 +45,6 @@ int imx_drm_set_bus_format_pins(struct drm_encoder *encoder, int imx_drm_set_bus_format(struct drm_encoder *encoder, u32 bus_format);
-int imx_drm_encoder_get_mux_id(struct device_node *node, - struct drm_encoder *encoder); int imx_drm_encoder_parse_of(struct drm_device *drm, struct drm_encoder *encoder, struct device_node *np);
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c index abacc8f..9a0347e 100644 --- a/drivers/gpu/drm/imx/imx-ldb.c +++ b/drivers/gpu/drm/imx/imx-ldb.c @@ -19,6 +19,7 @@ #include <drm/drmP.h> #include <drm/drm_fb_helper.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_of.h> #include <drm/drm_panel.h> #include <linux/mfd/syscon.h> #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> @@ -215,7 +216,7 @@ static void imx_ldb_encoder_commit(struct drm_encoder *encoder) struct imx_ldb_channel *imx_ldb_ch = enc_to_imx_ldb_ch(encoder); struct imx_ldb *ldb = imx_ldb_ch->ldb; int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; - int mux = imx_drm_encoder_get_mux_id(imx_ldb_ch->child, encoder); + int mux = drm_of_encoder_active_port_id(imx_ldb_ch->child, encoder);
drm_panel_prepare(imx_ldb_ch->panel);
@@ -265,7 +266,7 @@ static void imx_ldb_encoder_mode_set(struct drm_encoder *encoder, int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; unsigned long serial_clk; unsigned long di_clk = mode->clock * 1000; - int mux = imx_drm_encoder_get_mux_id(imx_ldb_ch->child, encoder); + int mux = drm_of_encoder_active_port_id(imx_ldb_ch->child, encoder);
if (mode->clock > 170000) { dev_warn(ldb->dev,
It is replaced by drm_of_encoder_active_endpoint_id.
Suggested-by: Daniel Kurtz djkurtz@chromium.org Reviewed-by: Daniel Kurtz djkurtz@chromium.org Signed-off-by: Philipp Zabel p.zabel@pengutronix.de --- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 30 ----------------------------- drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 2 -- 3 files changed, 1 insertion(+), 33 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index 80d6fc8..042eb95 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -201,7 +201,7 @@ static void dw_hdmi_rockchip_encoder_commit(struct drm_encoder *encoder) u32 val; int mux;
- mux = rockchip_drm_encoder_get_mux_id(hdmi->dev->of_node, encoder); + mux = drm_of_encoder_active_endpoint_id(hdmi->dev->of_node, encoder); if (mux) val = HDMI_SEL_VOP_LIT | (HDMI_SEL_VOP_LIT << 16); else diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 9a0c291..12094d0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -379,36 +379,6 @@ static const struct dev_pm_ops rockchip_drm_pm_ops = { rockchip_drm_sys_resume) };
-/* - * @node: device tree node containing encoder input ports - * @encoder: drm_encoder - */ -int rockchip_drm_encoder_get_mux_id(struct device_node *node, - struct drm_encoder *encoder) -{ - struct device_node *ep; - struct drm_crtc *crtc = encoder->crtc; - struct of_endpoint endpoint; - struct device_node *port; - int ret; - - if (!node || !crtc) - return -EINVAL; - - for_each_endpoint_of_node(node, ep) { - port = of_graph_get_remote_port(ep); - of_node_put(port); - if (port == crtc->port) { - ret = of_graph_parse_endpoint(ep, &endpoint); - of_node_put(ep); - return ret ?: endpoint.id; - } - } - - return -EINVAL; -} -EXPORT_SYMBOL_GPL(rockchip_drm_encoder_get_mux_id); - static int compare_of(struct device *dev, void *data) { struct device_node *np = data; diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h index dc4e5f0..20d6ac1 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h @@ -56,8 +56,6 @@ int rockchip_register_crtc_funcs(struct drm_device *dev, const struct rockchip_crtc_funcs *crtc_funcs, int pipe); void rockchip_unregister_crtc_funcs(struct drm_device *dev, int pipe); -int rockchip_drm_encoder_get_mux_id(struct device_node *node, - struct drm_encoder *encoder); int rockchip_drm_crtc_mode_config(struct drm_crtc *crtc, int connector_type, int out_mode); int rockchip_drm_dma_attach_device(struct drm_device *drm_dev,
Hi Philipp,
Am Donnerstag, 27. August 2015, 12:56:07 schrieb Philipp Zabel:
It is replaced by drm_of_encoder_active_endpoint_id.
Suggested-by: Daniel Kurtz djkurtz@chromium.org Reviewed-by: Daniel Kurtz djkurtz@chromium.org Signed-off-by: Philipp Zabel p.zabel@pengutronix.de
the person working the most on the rockchip dw_hdmi currently is probably Yakir Yang (included now).
But even to me with my general Rockchip work area outside the drm this looks good, as there isn't any functional change present in the moved function, so
Reviewed-by: Heiko Stuebner heiko@sntech.de
Heiko
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 30 ----------------------------- drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 2 -- 3 files changed, 1 insertion(+), 33 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index 80d6fc8..042eb95 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -201,7 +201,7 @@ static void dw_hdmi_rockchip_encoder_commit(struct drm_encoder *encoder) u32 val; int mux;
- mux = rockchip_drm_encoder_get_mux_id(hdmi->dev->of_node, encoder);
- mux = drm_of_encoder_active_endpoint_id(hdmi->dev->of_node, encoder); if (mux) val = HDMI_SEL_VOP_LIT | (HDMI_SEL_VOP_LIT << 16); else
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 9a0c291..12094d0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -379,36 +379,6 @@ static const struct dev_pm_ops rockchip_drm_pm_ops = { rockchip_drm_sys_resume) };
-/*
- @node: device tree node containing encoder input ports
- @encoder: drm_encoder
- */
-int rockchip_drm_encoder_get_mux_id(struct device_node *node,
struct drm_encoder *encoder)
-{
- struct device_node *ep;
- struct drm_crtc *crtc = encoder->crtc;
- struct of_endpoint endpoint;
- struct device_node *port;
- int ret;
- if (!node || !crtc)
return -EINVAL;
- for_each_endpoint_of_node(node, ep) {
port = of_graph_get_remote_port(ep);
of_node_put(port);
if (port == crtc->port) {
ret = of_graph_parse_endpoint(ep, &endpoint);
of_node_put(ep);
return ret ?: endpoint.id;
}
- }
- return -EINVAL;
-} -EXPORT_SYMBOL_GPL(rockchip_drm_encoder_get_mux_id);
static int compare_of(struct device *dev, void *data) { struct device_node *np = data; diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h index dc4e5f0..20d6ac1 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h @@ -56,8 +56,6 @@ int rockchip_register_crtc_funcs(struct drm_device *dev, const struct rockchip_crtc_funcs *crtc_funcs, int pipe); void rockchip_unregister_crtc_funcs(struct drm_device *dev, int pipe); -int rockchip_drm_encoder_get_mux_id(struct device_node *node,
struct drm_encoder *encoder);
int rockchip_drm_crtc_mode_config(struct drm_crtc *crtc, int connector_type, int out_mode); int rockchip_drm_dma_attach_device(struct drm_device *drm_dev,
Hi Philipp,
在 2015/8/27 19:26, Heiko Stuebner 写道:
Hi Philipp,
Am Donnerstag, 27. August 2015, 12:56:07 schrieb Philipp Zabel:
It is replaced by drm_of_encoder_active_endpoint_id.
Suggested-by: Daniel Kurtz djkurtz@chromium.org Reviewed-by: Daniel Kurtz djkurtz@chromium.org Signed-off-by: Philipp Zabel p.zabel@pengutronix.de
the person working the most on the rockchip dw_hdmi currently is probably Yakir Yang (included now).
But even to me with my general Rockchip work area outside the drm this looks good, as there isn't any functional change present in the moved function, so
Reviewed-by: Heiko Stuebner heiko@sntech.de
I cherry-pick 1/3 and 3/3 to my chromeos-3.14 tree, both HDMI and eDP works perfectly, so
Test-by: Yakir Yang ykk@rock-chips.com
Thanks, - Yakir
Heiko
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 30 ----------------------------- drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 2 -- 3 files changed, 1 insertion(+), 33 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index 80d6fc8..042eb95 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -201,7 +201,7 @@ static void dw_hdmi_rockchip_encoder_commit(struct drm_encoder *encoder) u32 val; int mux;
- mux = rockchip_drm_encoder_get_mux_id(hdmi->dev->of_node, encoder);
- mux = drm_of_encoder_active_endpoint_id(hdmi->dev->of_node, encoder); if (mux) val = HDMI_SEL_VOP_LIT | (HDMI_SEL_VOP_LIT << 16); else
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 9a0c291..12094d0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -379,36 +379,6 @@ static const struct dev_pm_ops rockchip_drm_pm_ops = { rockchip_drm_sys_resume) };
-/*
- @node: device tree node containing encoder input ports
- @encoder: drm_encoder
- */
-int rockchip_drm_encoder_get_mux_id(struct device_node *node,
struct drm_encoder *encoder)
-{
- struct device_node *ep;
- struct drm_crtc *crtc = encoder->crtc;
- struct of_endpoint endpoint;
- struct device_node *port;
- int ret;
- if (!node || !crtc)
return -EINVAL;
- for_each_endpoint_of_node(node, ep) {
port = of_graph_get_remote_port(ep);
of_node_put(port);
if (port == crtc->port) {
ret = of_graph_parse_endpoint(ep, &endpoint);
of_node_put(ep);
return ret ?: endpoint.id;
}
- }
- return -EINVAL;
-} -EXPORT_SYMBOL_GPL(rockchip_drm_encoder_get_mux_id);
- static int compare_of(struct device *dev, void *data) { struct device_node *np = data;
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h index dc4e5f0..20d6ac1 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h @@ -56,8 +56,6 @@ int rockchip_register_crtc_funcs(struct drm_device *dev, const struct rockchip_crtc_funcs *crtc_funcs, int pipe); void rockchip_unregister_crtc_funcs(struct drm_device *dev, int pipe); -int rockchip_drm_encoder_get_mux_id(struct device_node *node,
int rockchip_drm_crtc_mode_config(struct drm_crtc *crtc, intstruct drm_encoder *encoder);
connector_type, int out_mode); int rockchip_drm_dma_attach_device(struct drm_device *drm_dev,
Hi Philipp & Heiko,
在 2015/8/28 9:17, Yakir Yang 写道:
Hi Philipp,
在 2015/8/27 19:26, Heiko Stuebner 写道:
Hi Philipp,
Am Donnerstag, 27. August 2015, 12:56:07 schrieb Philipp Zabel:
It is replaced by drm_of_encoder_active_endpoint_id.
Suggested-by: Daniel Kurtz djkurtz@chromium.org Reviewed-by: Daniel Kurtz djkurtz@chromium.org Signed-off-by: Philipp Zabel p.zabel@pengutronix.de
the person working the most on the rockchip dw_hdmi currently is probably Yakir Yang (included now).
But even to me with my general Rockchip work area outside the drm this looks good, as there isn't any functional change present in the moved function, so
Reviewed-by: Heiko Stuebner heiko@sntech.de
I cherry-pick 1/3 and 3/3 to my chromeos-3.14 tree, both HDMI and eDP works perfectly, so
Test-by: Yakir Yang ykk@rock-chips.com
Actually, I do feel some strange limit with this change.
If we take the endpoint id as the vop id, then we must ensure the remote point order in dtsi file. hdmi_in_vopb: endpoint@0 { reg = <0>; remote-endpoint = <&vopb_out_hdmi>; }; hdmi_in_vopl: endpoint@1 { reg = <1>; remote-endpoint = <&vopl_out_hdmi>; };
This is strange limite, don't you think?
- Yakir
Thanks,
- Yakir
Heiko
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 30
drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 2 -- 3 files changed, 1 insertion(+), 33 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index 80d6fc8..042eb95 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -201,7 +201,7 @@ static void dw_hdmi_rockchip_encoder_commit(struct drm_encoder *encoder) u32 val; int mux;
- mux = rockchip_drm_encoder_get_mux_id(hdmi->dev->of_node,
encoder);
- mux = drm_of_encoder_active_endpoint_id(hdmi->dev->of_node,
encoder); if (mux) val = HDMI_SEL_VOP_LIT | (HDMI_SEL_VOP_LIT << 16); else diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 9a0c291..12094d0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -379,36 +379,6 @@ static const struct dev_pm_ops rockchip_drm_pm_ops = { rockchip_drm_sys_resume) };
-/*
- @node: device tree node containing encoder input ports
- @encoder: drm_encoder
- */
-int rockchip_drm_encoder_get_mux_id(struct device_node *node,
struct drm_encoder *encoder)
-{
- struct device_node *ep;
- struct drm_crtc *crtc = encoder->crtc;
- struct of_endpoint endpoint;
- struct device_node *port;
- int ret;
- if (!node || !crtc)
return -EINVAL;
- for_each_endpoint_of_node(node, ep) {
port = of_graph_get_remote_port(ep);
of_node_put(port);
if (port == crtc->port) {
ret = of_graph_parse_endpoint(ep, &endpoint);
of_node_put(ep);
return ret ?: endpoint.id;
}
- }
- return -EINVAL;
-} -EXPORT_SYMBOL_GPL(rockchip_drm_encoder_get_mux_id);
- static int compare_of(struct device *dev, void *data) { struct device_node *np = data;
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h index dc4e5f0..20d6ac1 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h @@ -56,8 +56,6 @@ int rockchip_register_crtc_funcs(struct drm_device *dev, const struct rockchip_crtc_funcs *crtc_funcs, int pipe); void rockchip_unregister_crtc_funcs(struct drm_device *dev, int pipe); -int rockchip_drm_encoder_get_mux_id(struct device_node *node,
int rockchip_drm_crtc_mode_config(struct drm_crtc *crtc, intstruct drm_encoder *encoder);
connector_type, int out_mode); int rockchip_drm_dma_attach_device(struct drm_device *drm_dev,
Hi Heiko, Mark, Yakir,
thank you for review & testing!
Am Freitag, den 28.08.2015, 11:18 +0800 schrieb Yakir Yang:
Actually, I do feel some strange limit with this change.
If we take the endpoint id as the vop id, then we must ensure the remote point order in dtsi file. hdmi_in_vopb: endpoint@0 { reg = <0>; remote-endpoint = <&vopb_out_hdmi>; }; hdmi_in_vopl: endpoint@1 { reg = <1>; remote-endpoint = <&vopl_out_hdmi>; };
This is strange limite, don't you think?
Not the order, but the reg property must be set as documented in Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt:
- ports: contain a port node with endpoint definitions as defined in Documentation/devicetree/bindings/media/video-interfaces.txt. For vopb,set the reg = <0> and set the reg = <1> for vopl.
This has been exactly the same before.
regards Philipp
On 2015年08月27日 18:56, Philipp Zabel wrote:
It is replaced by drm_of_encoder_active_endpoint_id.
Suggested-by: Daniel Kurtz djkurtz@chromium.org Reviewed-by: Daniel Kurtz djkurtz@chromium.org Signed-off-by: Philipp Zabel p.zabel@pengutronix.de
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 30 ----------------------------- drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 2 -- 3 files changed, 1 insertion(+), 33 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index 80d6fc8..042eb95 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -201,7 +201,7 @@ static void dw_hdmi_rockchip_encoder_commit(struct drm_encoder *encoder) u32 val; int mux;
- mux = rockchip_drm_encoder_get_mux_id(hdmi->dev->of_node, encoder);
- mux = drm_of_encoder_active_endpoint_id(hdmi->dev->of_node, encoder); if (mux) val = HDMI_SEL_VOP_LIT | (HDMI_SEL_VOP_LIT << 16); else
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 9a0c291..12094d0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -379,36 +379,6 @@ static const struct dev_pm_ops rockchip_drm_pm_ops = { rockchip_drm_sys_resume) };
-/*
- @node: device tree node containing encoder input ports
- @encoder: drm_encoder
- */
-int rockchip_drm_encoder_get_mux_id(struct device_node *node,
struct drm_encoder *encoder)
-{
- struct device_node *ep;
- struct drm_crtc *crtc = encoder->crtc;
- struct of_endpoint endpoint;
- struct device_node *port;
- int ret;
- if (!node || !crtc)
return -EINVAL;
- for_each_endpoint_of_node(node, ep) {
port = of_graph_get_remote_port(ep);
of_node_put(port);
if (port == crtc->port) {
ret = of_graph_parse_endpoint(ep, &endpoint);
of_node_put(ep);
return ret ?: endpoint.id;
}
- }
- return -EINVAL;
-} -EXPORT_SYMBOL_GPL(rockchip_drm_encoder_get_mux_id);
Dw-hdmi driver can reuse this fuction, so
Acked-by: Mark Yao mark.yao@rock-chips.com
static int compare_of(struct device *dev, void *data) { struct device_node *np = data; diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h index dc4e5f0..20d6ac1 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h @@ -56,8 +56,6 @@ int rockchip_register_crtc_funcs(struct drm_device *dev, const struct rockchip_crtc_funcs *crtc_funcs, int pipe); void rockchip_unregister_crtc_funcs(struct drm_device *dev, int pipe); -int rockchip_drm_encoder_get_mux_id(struct device_node *node,
int rockchip_drm_crtc_mode_config(struct drm_crtc *crtc, int connector_type, int out_mode); int rockchip_drm_dma_attach_device(struct drm_device *drm_dev,struct drm_encoder *encoder);
dri-devel@lists.freedesktop.org