Commit e411295e authored by Dave Airlie's avatar Dave Airlie

Merge tag 'imx-drm-fixes-2016-05-24' of git://git.pengutronix.de/git/pza/linux into drm-next

imx-drm probing fix

Commit 950b410dd1ab ("gpu: ipu-v3: Fix imx-ipuv3-crtc module autoloading")
broke probing of the imx-drm driver in the non-modular case because the
unset dev->of_node during probing of imx-ipuv3-crtc would cause the
component matching to fail. This patch patch instead matches against
an of_node pointer stored in platform data, allowing dev->of_node to
be left unset for the platform probed imx-ipuv3-crtc devices.

* tag 'imx-drm-fixes-2016-05-24' of git://git.pengutronix.de/git/pza/linux:
  drm/imx: Match imx-ipuv3-crtc components using device node in platform data
parents 92181d47 310944d1
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_cma_helper.h>
#include <drm/drm_plane_helper.h> #include <drm/drm_plane_helper.h>
#include <drm/drm_of.h> #include <drm/drm_of.h>
#include <video/imx-ipu-v3.h>
#include "imx-drm.h" #include "imx-drm.h"
...@@ -437,6 +438,13 @@ static int compare_of(struct device *dev, void *data) ...@@ -437,6 +438,13 @@ static int compare_of(struct device *dev, void *data)
{ {
struct device_node *np = data; struct device_node *np = data;
/* Special case for DI, dev->of_node may not be set yet */
if (strcmp(dev->driver->name, "imx-ipuv3-crtc") == 0) {
struct ipu_client_platformdata *pdata = dev->platform_data;
return pdata->of_node == np;
}
/* Special case for LDB, one device for two channels */ /* Special case for LDB, one device for two channels */
if (of_node_cmp(np->name, "lvds-channel") == 0) { if (of_node_cmp(np->name, "lvds-channel") == 0) {
np = of_get_parent(np); np = of_get_parent(np);
......
...@@ -473,7 +473,7 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, ...@@ -473,7 +473,7 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc,
ret = imx_drm_add_crtc(drm, &ipu_crtc->base, &ipu_crtc->imx_crtc, ret = imx_drm_add_crtc(drm, &ipu_crtc->base, &ipu_crtc->imx_crtc,
&ipu_crtc->plane[0]->base, &ipu_crtc_helper_funcs, &ipu_crtc->plane[0]->base, &ipu_crtc_helper_funcs,
ipu_crtc->dev->of_node); pdata->of_node);
if (ret) { if (ret) {
dev_err(ipu_crtc->dev, "adding crtc failed with %d.\n", ret); dev_err(ipu_crtc->dev, "adding crtc failed with %d.\n", ret);
goto err_put_resources; goto err_put_resources;
......
...@@ -997,7 +997,7 @@ struct ipu_platform_reg { ...@@ -997,7 +997,7 @@ struct ipu_platform_reg {
}; };
/* These must be in the order of the corresponding device tree port nodes */ /* These must be in the order of the corresponding device tree port nodes */
static const struct ipu_platform_reg client_reg[] = { static struct ipu_platform_reg client_reg[] = {
{ {
.pdata = { .pdata = {
.csi = 0, .csi = 0,
...@@ -1048,7 +1048,7 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base) ...@@ -1048,7 +1048,7 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
mutex_unlock(&ipu_client_id_mutex); mutex_unlock(&ipu_client_id_mutex);
for (i = 0; i < ARRAY_SIZE(client_reg); i++) { for (i = 0; i < ARRAY_SIZE(client_reg); i++) {
const struct ipu_platform_reg *reg = &client_reg[i]; struct ipu_platform_reg *reg = &client_reg[i];
struct platform_device *pdev; struct platform_device *pdev;
struct device_node *of_node; struct device_node *of_node;
...@@ -1070,6 +1070,7 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base) ...@@ -1070,6 +1070,7 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
pdev->dev.parent = dev; pdev->dev.parent = dev;
reg->pdata.of_node = of_node;
ret = platform_device_add_data(pdev, &reg->pdata, ret = platform_device_add_data(pdev, &reg->pdata,
sizeof(reg->pdata)); sizeof(reg->pdata));
if (!ret) if (!ret)
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/videodev2.h> #include <linux/videodev2.h>
#include <linux/bitmap.h> #include <linux/bitmap.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/of.h>
#include <media/v4l2-mediabus.h> #include <media/v4l2-mediabus.h>
#include <video/videomode.h> #include <video/videomode.h>
...@@ -345,6 +346,7 @@ struct ipu_client_platformdata { ...@@ -345,6 +346,7 @@ struct ipu_client_platformdata {
int dc; int dc;
int dp; int dp;
int dma[2]; int dma[2];
struct device_node *of_node;
}; };
#endif /* __DRM_IPU_H__ */ #endif /* __DRM_IPU_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment