aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i2c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2014-06-15 06:11:10 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2015-01-16 12:45:48 -0500
commit5dbcf319b283276468a52feafefeb5802d87cb8a (patch)
tree2611bd126299e6e8cdac2bb60f575991b0daf7aa /drivers/gpu/drm/i2c
parent97bf6af1f928216fd6c5a66e8a57bfa95a659672 (diff)
drm/i2c: tda998x: add OF support for finding attached CRTCs
Add support to find the attached CRTCs via OF using the newly introduced helper. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/gpu/drm/i2c')
-rw-r--r--drivers/gpu/drm/i2c/tda998x_drv.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index d4762799351d..4dcf47417aee 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -25,6 +25,7 @@
25#include <drm/drm_crtc_helper.h> 25#include <drm/drm_crtc_helper.h>
26#include <drm/drm_encoder_slave.h> 26#include <drm/drm_encoder_slave.h>
27#include <drm/drm_edid.h> 27#include <drm/drm_edid.h>
28#include <drm/drm_of.h>
28#include <drm/i2c/tda998x.h> 29#include <drm/i2c/tda998x.h>
29 30
30#define DBG(fmt, ...) DRM_DEBUG(fmt"\n", ##__VA_ARGS__) 31#define DBG(fmt, ...) DRM_DEBUG(fmt"\n", ##__VA_ARGS__)
@@ -1515,6 +1516,7 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data)
1515 struct i2c_client *client = to_i2c_client(dev); 1516 struct i2c_client *client = to_i2c_client(dev);
1516 struct drm_device *drm = data; 1517 struct drm_device *drm = data;
1517 struct tda998x_priv2 *priv; 1518 struct tda998x_priv2 *priv;
1519 uint32_t crtcs = 0;
1518 int ret; 1520 int ret;
1519 1521
1520 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 1522 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -1523,9 +1525,18 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data)
1523 1525
1524 dev_set_drvdata(dev, priv); 1526 dev_set_drvdata(dev, priv);
1525 1527
1528 if (dev->of_node)
1529 crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
1530
1531 /* If no CRTCs were found, fall back to our old behaviour */
1532 if (crtcs == 0) {
1533 dev_warn(dev, "Falling back to first CRTC\n");
1534 crtcs = 1 << 0;
1535 }
1536
1526 priv->base.encoder = &priv->encoder; 1537 priv->base.encoder = &priv->encoder;
1527 priv->connector.interlace_allowed = 1; 1538 priv->connector.interlace_allowed = 1;
1528 priv->encoder.possible_crtcs = 1 << 0; 1539 priv->encoder.possible_crtcs = crtcs;
1529 1540
1530 ret = tda998x_create(client, &priv->base); 1541 ret = tda998x_create(client, &priv->base);
1531 if (ret) 1542 if (ret)