diff options
author | Karol Lewandowski <k.lewandowsk@samsung.com> | 2012-04-12 20:45:25 +0200 |
---|---|---|
committer | Tushar Behera <tushar.behera@linaro.org> | 2012-12-13 14:53:46 +0530 |
commit | 3dc6a8c5d5c558ab4f90a2640dcf13757ff8727e (patch) | |
tree | 5db9b2d55a969597d22570fd98a62554e988eeed | |
parent | 8fa629792e73fabf01a194ef741b29ad8a1b1624 (diff) | |
download | linux-topics-3dc6a8c5d5c558ab4f90a2640dcf13757ff8727e.tar.gz |
s5p-tv: Add initial DT-support for SiI9234
Make it possible to instantiate SiI9234, Mobile HD Link driver (MHL),
from regular device tree description.
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Tomasz Stanislawski <t.stanislaws@samsung.com>
-rw-r--r-- | Documentation/devicetree/bindings/i2c/sil-mhl9234.txt | 14 | ||||
-rw-r--r-- | drivers/media/platform/s5p-tv/sii9234_drv.c | 21 |
2 files changed, 34 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/i2c/sil-mhl9234.txt b/Documentation/devicetree/bindings/i2c/sil-mhl9234.txt new file mode 100644 index 00000000000..b5d92ea6bd7 --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/sil-mhl9234.txt @@ -0,0 +1,14 @@ +* Silicon Image Mobile HD Link (MHL) 9234 + +Required properties : + - compatible : "sil,mhl-9234" + - reg : i2c device address + - gpio-reset : gpio line used to reset IC + +Example: + + mhl@39 { + compatible = "sil,mhl-9234"; + reg = <0x39>; + gpio-reset = <&gpf3 4 0 0 0>; + }; diff --git a/drivers/media/platform/s5p-tv/sii9234_drv.c b/drivers/media/platform/s5p-tv/sii9234_drv.c index 716d4846f8b..26ba39f1155 100644 --- a/drivers/media/platform/s5p-tv/sii9234_drv.c +++ b/drivers/media/platform/s5p-tv/sii9234_drv.c @@ -22,6 +22,8 @@ #include <linux/pm_runtime.h> #include <linux/regulator/machine.h> #include <linux/slab.h> +#include <linux/of.h> +#include <linux/of_gpio.h> #include <mach/gpio.h> #include <plat/gpio-cfg.h> @@ -337,7 +339,16 @@ static int __devinit sii9234_probe(struct i2c_client *client, return PTR_ERR(ctx->power); } - ctx->gpio_n_reset = pdata->gpio_n_reset; + if (dev->of_node) { + ctx->gpio_n_reset = of_get_named_gpio(dev->of_node, "gpio-reset", 0); + if (!gpio_is_valid(ctx->gpio_n_reset)) { + ret = -ENODEV; + goto fail_power; + } + } else { + ctx->gpio_n_reset = pdata->gpio_n_reset; + } + ret = gpio_request(ctx->gpio_n_reset, "MHL_RST"); if (ret) { dev_err(dev, "failed to acquire MHL_RST gpio\n"); @@ -392,6 +403,13 @@ static int __devexit sii9234_remove(struct i2c_client *client) return 0; } +#ifdef CONFIG_OF +static const struct of_device_id sii9234_dt_match[] = { + { .compatible = "sil,mhl-9234" }, + { }, +}; +MODULE_DEVICE_TABLE(of, sii9234_dt_match); +#endif static const struct i2c_device_id sii9234_id[] = { { "SII9234", 0 }, @@ -404,6 +422,7 @@ static struct i2c_driver sii9234_driver = { .name = "sii9234", .owner = THIS_MODULE, .pm = &sii9234_pm_ops, + .of_match_table = of_match_ptr(sii9234_dt_match), }, .probe = sii9234_probe, .remove = __devexit_p(sii9234_remove), |