<div dir="ltr">Hi Jingoo,<br><br><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 18, 2014 at 2:55 PM, Jingoo Han <span dir="ltr"><<a href="mailto:jg1.han@samsung.com" target="_blank">jg1.han@samsung.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wednesday, April 16, 2014 11:33 PM, Ajay Kumar wrote:<br>
><br>
> attach ptn3460 connector to drm_panel and support drm_panel routines,<br>
> if a valid drm_panel object is passed to ptn3460_init.<br>
><br>
> Signed-off-by: Ajay Kumar <<a href="mailto:ajaykumar.rs@samsung.com">ajaykumar.rs@samsung.com</a>><br>
> ---<br>
> drivers/gpu/drm/bridge/Kconfig | 1 +<br>
> drivers/gpu/drm/bridge/ptn3460.c | 17 ++++++++++++++++-<br>
> drivers/gpu/drm/exynos/exynos_dp_core.c | 15 +++++++++++----<br>
> include/drm/bridge/ptn3460.h | 6 ++++--<br>
> 4 files changed, 32 insertions(+), 7 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig<br>
> index 884923f..3bc6845 100644<br>
> --- a/drivers/gpu/drm/bridge/Kconfig<br>
> +++ b/drivers/gpu/drm/bridge/Kconfig<br>
> @@ -2,4 +2,5 @@ config DRM_PTN3460<br>
> tristate "PTN3460 DP/LVDS bridge"<br>
> depends on DRM<br>
> select DRM_KMS_HELPER<br>
> + select DRM_PANEL<br>
> ---help---<br>
> diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c<br>
> index f1d2afc..736c7a8 100644<br>
> --- a/drivers/gpu/drm/bridge/ptn3460.c<br>
> +++ b/drivers/gpu/drm/bridge/ptn3460.c<br>
> @@ -24,6 +24,7 @@<br>
> #include "drm_edid.h"<br>
> #include "drm_crtc.h"<br>
> #include "drm_crtc_helper.h"<br>
> +#include <drm/drm_panel.h><br>
<br>
</div></div>Move '<drm/drm_panel.h>' as below.<br>
<br>
#include <linux/gpio.h><br>
#include <linux/delay.h><br>
+#include <drm/drm_panel.h><br>
<br>
#include "drmP.h"<br>
<div><div class="h5"><br>
<br>
><br>
> #include "bridge/ptn3460.h"<br>
><br>
> @@ -38,6 +39,7 @@ struct ptn3460_bridge {<br>
> struct i2c_client *client;<br>
> struct drm_encoder *encoder;<br>
> struct drm_bridge *bridge;<br>
> + struct drm_panel *panel;<br>
> struct edid *edid;<br>
> int gpio_pd_n;<br>
> int gpio_rst_n;<br>
> @@ -126,6 +128,8 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge)<br>
> gpio_set_value(ptn_bridge->gpio_rst_n, 1);<br>
> }<br>
><br>
> + drm_panel_pre_enable(ptn_bridge->panel);<br>
> +<br>
> /*<br>
> * There's a bug in the PTN chip where it falsely asserts hotplug before<br>
> * it is fully functional. We're forced to wait for the maximum start up<br>
> @@ -142,6 +146,9 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge)<br>
><br>
> static void ptn3460_enable(struct drm_bridge *bridge)<br>
> {<br>
> + struct ptn3460_bridge *ptn_bridge = bridge->driver_private;<br>
> +<br>
> + drm_panel_enable(ptn_bridge->panel);<br>
> }<br>
><br>
> static void ptn3460_disable(struct drm_bridge *bridge)<br>
> @@ -153,6 +160,8 @@ static void ptn3460_disable(struct drm_bridge *bridge)<br>
><br>
> ptn_bridge->enabled = false;<br>
><br>
> + drm_panel_disable(ptn_bridge->panel);<br>
> +<br>
> if (gpio_is_valid(ptn_bridge->gpio_rst_n))<br>
> gpio_set_value(ptn_bridge->gpio_rst_n, 1);<br>
><br>
> @@ -265,7 +274,8 @@ struct drm_connector_funcs ptn3460_connector_funcs = {<br>
> };<br>
><br>
> int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,<br>
> - struct i2c_client *client, struct device_node *node)<br>
> + struct i2c_client *client, struct device_node *node,<br>
> + struct drm_panel *panel)<br>
> {<br>
> int ret;<br>
> struct drm_bridge *bridge;<br>
> @@ -324,6 +334,11 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,<br>
> goto err;<br>
> }<br>
><br>
> + if (panel) {<br>
> + ptn_bridge->panel = panel;<br>
> + drm_panel_attach(ptn_bridge->panel, &ptn_bridge->connector);<br>
> + }<br>
> +<br>
> bridge->driver_private = ptn_bridge;<br>
> encoder->bridge = bridge;<br>
> ptn_bridge->connector.polled = DRM_CONNECTOR_POLL_HPD;<br>
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c<br>
> index 6beeab6..7f550b6 100644<br>
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c<br>
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c<br>
> @@ -989,13 +989,14 @@ static bool find_bridge(const char *compat, struct bridge_init *bridge)<br>
><br>
> /* returns the number of bridges attached */<br>
> static int exynos_drm_attach_lcd_bridge(struct drm_device *dev,<br>
> - struct drm_encoder *encoder)<br>
> + struct drm_encoder *encoder, struct drm_panel *panel)<br>
> {<br>
> struct bridge_init bridge;<br>
> int ret;<br>
><br>
> if (find_bridge("nxp,ptn3460", &bridge)) {<br>
> - ret = ptn3460_init(dev, encoder, bridge.client, bridge.node);<br>
> + ret = ptn3460_init(dev, encoder, bridge.client, bridge.node,<br>
> + panel);<br>
<br>
</div></div>'panel' is too far. Please fix it as below.<br>
<div class=""><br>
if (find_bridge("nxp,ptn3460", &bridge)) {<br>
</div><div class=""> ret = ptn3460_init(dev, encoder, bridge.client, bridge.node,<br>
</div><div class=""> panel);<br>
<br></div></blockquote><div>Ok. <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
<br>
> if (!ret)<br>
> return 1;<br>
> }<br>
> @@ -1012,9 +1013,15 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,<br>
> dp->encoder = encoder;<br>
><br>
> /* Pre-empt DP connector creation if there's a bridge */<br>
> - ret = exynos_drm_attach_lcd_bridge(dp->drm_dev, encoder);<br>
> - if (ret)<br>
> + ret = exynos_drm_attach_lcd_bridge(dp->drm_dev, encoder, dp->drm_panel);<br>
> + if (ret) {<br>
> + /* Also set "dp->drm_panel = NULL" so that we don't end up<br>
> + * controlling panel power both in exynos_dp and bridge<br>
> + * DPMS routines.<br>
> + */<br>
<br>
</div>Please fix it as below.<br>
<br>
+ /*<br>
+ * Also set "dp->drm_panel = NULL" so that we don't end up<br>
<div class=""> + * controlling panel power both in exynos_dp and bridge<br>
+ * DPMS routines.<br>
+ */<br>
<br></div></blockquote><div>Right. I used wrong style for commenting!<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
</div>Best regards,<br>
Jingoo Han<br>
<div class="HOEnZb"><div class="h5"><br>
> + dp->drm_panel = NULL;<br>
> return 0;<br>
> + }<br>
><br>
> connector->polled = DRM_CONNECTOR_POLL_HPD;<br>
><br>
> diff --git a/include/drm/bridge/ptn3460.h b/include/drm/bridge/ptn3460.h<br>
> index ff62344..570cebb 100644<br>
> --- a/include/drm/bridge/ptn3460.h<br>
> +++ b/include/drm/bridge/ptn3460.h<br>
> @@ -18,16 +18,18 @@ struct drm_device;<br>
> struct drm_encoder;<br>
> struct i2c_client;<br>
> struct device_node;<br>
> +struct drm_panel;<br>
><br>
> #if defined(CONFIG_DRM_PTN3460) || defined(CONFIG_DRM_PTN3460_MODULE)<br>
><br>
> int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,<br>
> - struct i2c_client *client, struct device_node *node);<br>
> + struct i2c_client *client, struct device_node *node,<br>
> + struct drm_panel *panel);<br>
> #else<br>
><br>
> static inline int ptn3460_init(struct drm_device *dev,<br>
> struct drm_encoder *encoder, struct i2c_client *client,<br>
> - struct device_node *node)<br>
> + struct device_node *node, struct drm_panel *panel)<br>
> {<br>
> return 0;<br>
> }<br>
> --<br>
> 1.8.1.2<br>
<br>
</div></div></blockquote></div><br></div><div class="gmail_extra">Thanks and regards,<br>Ajay Kumar<br></div></div>