[PATCH 03/13] s5p-g2d: Make it possible to instantiate driver from DT

From: Karol Lewandowski
Date: Thu Apr 12 2012 - 14:49:31 EST


This driver requires standard properties like (address and irq)
which are automatically marshalled for drivers by OF core.

Signed-off-by: Karol Lewandowski <k.lewandowsk@xxxxxxxxxxx>
Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
Cc: Kamil Debski <k.debski@xxxxxxxxxxx>
---
.../devicetree/bindings/arm/trivial-devices.txt | 1 +
drivers/media/video/s5p-g2d/g2d.c | 10 ++++++++++
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/trivial-devices.txt b/Documentation/devicetree/bindings/arm/trivial-devices.txt
index 443814a..d0f6c45 100644
--- a/Documentation/devicetree/bindings/arm/trivial-devices.txt
+++ b/Documentation/devicetree/bindings/arm/trivial-devices.txt
@@ -8,3 +8,4 @@ document for it just like any other devices.

Compatible Vendor / Chip
======================== =============
+samsung,s5pv210-g2d 2D graphics accelerator found on s5pv210+ SoCs
diff --git a/drivers/media/video/s5p-g2d/g2d.c b/drivers/media/video/s5p-g2d/g2d.c
index 789de74..96fd584 100644
--- a/drivers/media/video/s5p-g2d/g2d.c
+++ b/drivers/media/video/s5p-g2d/g2d.c
@@ -20,6 +20,7 @@
#include <linux/interrupt.h>

#include <linux/platform_device.h>
+#include <linux/of.h>
#include <media/v4l2-mem2mem.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ioctl.h>
@@ -832,12 +833,21 @@ static int g2d_remove(struct platform_device *pdev)
return 0;
}

+#ifdef CONFIG_OF
+static struct of_device_id g2d_dt_match[] = {
+ { .compatible = "samsung,s5pv210-g2d" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, g2d_dt_match);
+#endif
+
static struct platform_driver g2d_pdrv = {
.probe = g2d_probe,
.remove = g2d_remove,
.driver = {
.name = G2D_NAME,
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(g2d_dt_match),
},
};

--
1.7.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/