From: Tomi Valkeinen <tomi.valkeinen@ti.com> To: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, devicetree@vger.kernel.org Cc: Archit Taneja <archit@ti.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Nishanth Menon <nm@ti.com>, Felipe Balbi <balbi@ti.com>, Santosh Shilimkar <santosh.shilimkar@ti.com>, Tony Lindgren <tony@atomide.com>, Tomi Valkeinen <tomi.valkeinen@ti.com> Subject: [RFC 16/22] OMAPDSS: panel-dsi-cm: Add DT support Date: Fri, 9 Aug 2013 11:39:01 +0300 [thread overview] Message-ID: <1376037547-10859-17-git-send-email-tomi.valkeinen@ti.com> (raw) In-Reply-To: <1376037547-10859-1-git-send-email-tomi.valkeinen@ti.com> XXX ULPS and backlight missing. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> --- drivers/video/omap2/displays-new/panel-dsi-cm.c | 87 +++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/drivers/video/omap2/displays-new/panel-dsi-cm.c b/drivers/video/omap2/displays-new/panel-dsi-cm.c index aaaea64..f65ea4d 100644 --- a/drivers/video/omap2/displays-new/panel-dsi-cm.c +++ b/drivers/video/omap2/displays-new/panel-dsi-cm.c @@ -22,6 +22,8 @@ #include <linux/sched.h> #include <linux/slab.h> #include <linux/workqueue.h> +#include <linux/of_device.h> +#include <linux/of_gpio.h> #include <video/omapdss.h> #include <video/omap-panel-data.h> @@ -1156,6 +1158,79 @@ static int dsicm_probe_pdata(struct platform_device *pdev) return 0; } +static int dsicm_probe_of(struct platform_device *pdev) +{ + struct device_node *node = pdev->dev.of_node; + struct panel_drv_data *ddata = platform_get_drvdata(pdev); + struct omap_dss_device *in; + struct property *prop; + struct device_node *src_node; + u32 lane_arr[10]; + int gpio, len, num_pins; + int r, i; + + src_node = of_parse_phandle(node, "video-source", 0); + if (!src_node) { + dev_err(&pdev->dev, "failed to parse video source\n"); + return -ENODEV; + } + + in = omap_dss_find_output_by_node(src_node); + if (in == NULL) { + dev_err(&pdev->dev, "failed to find video source\n"); + return -EPROBE_DEFER; + } + ddata->in = in; + + gpio = of_get_gpio(node, 0); + if (!gpio_is_valid(gpio)) { + dev_err(&pdev->dev, "failed to parse reset gpio\n"); + return gpio; + } + ddata->reset_gpio = gpio; + + if (of_gpio_count(node) > 1) { + gpio = of_get_gpio(node, 1); + + if (gpio_is_valid(gpio) || gpio == -ENOENT) { + ddata->ext_te_gpio = gpio; + } else { + dev_err(&pdev->dev, "failed to parse TE gpio\n"); + return gpio; + } + } else { + ddata->ext_te_gpio = -1; + } + + prop = of_find_property(node, "lanes", &len); + if (prop == NULL) { + dev_err(&pdev->dev, "failed to find lane data\n"); + return -EINVAL; + } + + num_pins = len / sizeof(u32); + + if (num_pins < 4 || num_pins % 2 != 0 + || num_pins > ARRAY_SIZE(lane_arr)) { + dev_err(&pdev->dev, "bad number of lanes\n"); + return -EINVAL; + } + + r = of_property_read_u32_array(node, "lanes", lane_arr, num_pins); + if (r) { + dev_err(&pdev->dev, "failed to read lane data\n"); + return r; + } + + ddata->pin_config.num_pins = num_pins; + for (i = 0; i < num_pins; ++i) + ddata->pin_config.pins[i] = (int)lane_arr[i]; + + /* TODO: ulps, backlight */ + + return 0; +} + static int dsicm_probe(struct platform_device *pdev) { struct backlight_properties props; @@ -1178,6 +1253,10 @@ static int dsicm_probe(struct platform_device *pdev) r = dsicm_probe_pdata(pdev); if (r) return r; + } else if (pdev->dev.of_node) { + r = dsicm_probe_of(pdev); + if (r) + return r; } else { return -ENODEV; } @@ -1320,12 +1399,20 @@ static int __exit dsicm_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id dsicm_of_match[] = { + { .compatible = "panel-dsi-cm", }, + {}, +}; + +MODULE_DEVICE_TABLE(of, dsicm_of_match); + static struct platform_driver dsicm_driver = { .probe = dsicm_probe, .remove = __exit_p(dsicm_remove), .driver = { .name = "panel-dsi-cm", .owner = THIS_MODULE, + .of_match_table = dsicm_of_match, }, }; -- 1.8.1.2
WARNING: multiple messages have this Message-ID (diff)
From: Tomi Valkeinen <tomi.valkeinen@ti.com> To: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, devicetree@vger.kernel.org Cc: Archit Taneja <archit@ti.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Nishanth Menon <nm@ti.com>, Felipe Balbi <balbi@ti.com>, Santosh Shilimkar <santosh.shilimkar@ti.com>, Tony Lindgren <tony@atomide.com>, Tomi Valkeinen <tomi.valkeinen@ti.com> Subject: [RFC 16/22] OMAPDSS: panel-dsi-cm: Add DT support Date: Fri, 09 Aug 2013 08:39:01 +0000 [thread overview] Message-ID: <1376037547-10859-17-git-send-email-tomi.valkeinen@ti.com> (raw) In-Reply-To: <1376037547-10859-1-git-send-email-tomi.valkeinen@ti.com> XXX ULPS and backlight missing. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> --- drivers/video/omap2/displays-new/panel-dsi-cm.c | 87 +++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/drivers/video/omap2/displays-new/panel-dsi-cm.c b/drivers/video/omap2/displays-new/panel-dsi-cm.c index aaaea64..f65ea4d 100644 --- a/drivers/video/omap2/displays-new/panel-dsi-cm.c +++ b/drivers/video/omap2/displays-new/panel-dsi-cm.c @@ -22,6 +22,8 @@ #include <linux/sched.h> #include <linux/slab.h> #include <linux/workqueue.h> +#include <linux/of_device.h> +#include <linux/of_gpio.h> #include <video/omapdss.h> #include <video/omap-panel-data.h> @@ -1156,6 +1158,79 @@ static int dsicm_probe_pdata(struct platform_device *pdev) return 0; } +static int dsicm_probe_of(struct platform_device *pdev) +{ + struct device_node *node = pdev->dev.of_node; + struct panel_drv_data *ddata = platform_get_drvdata(pdev); + struct omap_dss_device *in; + struct property *prop; + struct device_node *src_node; + u32 lane_arr[10]; + int gpio, len, num_pins; + int r, i; + + src_node = of_parse_phandle(node, "video-source", 0); + if (!src_node) { + dev_err(&pdev->dev, "failed to parse video source\n"); + return -ENODEV; + } + + in = omap_dss_find_output_by_node(src_node); + if (in = NULL) { + dev_err(&pdev->dev, "failed to find video source\n"); + return -EPROBE_DEFER; + } + ddata->in = in; + + gpio = of_get_gpio(node, 0); + if (!gpio_is_valid(gpio)) { + dev_err(&pdev->dev, "failed to parse reset gpio\n"); + return gpio; + } + ddata->reset_gpio = gpio; + + if (of_gpio_count(node) > 1) { + gpio = of_get_gpio(node, 1); + + if (gpio_is_valid(gpio) || gpio = -ENOENT) { + ddata->ext_te_gpio = gpio; + } else { + dev_err(&pdev->dev, "failed to parse TE gpio\n"); + return gpio; + } + } else { + ddata->ext_te_gpio = -1; + } + + prop = of_find_property(node, "lanes", &len); + if (prop = NULL) { + dev_err(&pdev->dev, "failed to find lane data\n"); + return -EINVAL; + } + + num_pins = len / sizeof(u32); + + if (num_pins < 4 || num_pins % 2 != 0 + || num_pins > ARRAY_SIZE(lane_arr)) { + dev_err(&pdev->dev, "bad number of lanes\n"); + return -EINVAL; + } + + r = of_property_read_u32_array(node, "lanes", lane_arr, num_pins); + if (r) { + dev_err(&pdev->dev, "failed to read lane data\n"); + return r; + } + + ddata->pin_config.num_pins = num_pins; + for (i = 0; i < num_pins; ++i) + ddata->pin_config.pins[i] = (int)lane_arr[i]; + + /* TODO: ulps, backlight */ + + return 0; +} + static int dsicm_probe(struct platform_device *pdev) { struct backlight_properties props; @@ -1178,6 +1253,10 @@ static int dsicm_probe(struct platform_device *pdev) r = dsicm_probe_pdata(pdev); if (r) return r; + } else if (pdev->dev.of_node) { + r = dsicm_probe_of(pdev); + if (r) + return r; } else { return -ENODEV; } @@ -1320,12 +1399,20 @@ static int __exit dsicm_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id dsicm_of_match[] = { + { .compatible = "panel-dsi-cm", }, + {}, +}; + +MODULE_DEVICE_TABLE(of, dsicm_of_match); + static struct platform_driver dsicm_driver = { .probe = dsicm_probe, .remove = __exit_p(dsicm_remove), .driver = { .name = "panel-dsi-cm", .owner = THIS_MODULE, + .of_match_table = dsicm_of_match, }, }; -- 1.8.1.2
next prev parent reply other threads:[~2013-08-09 8:40 UTC|newest] Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-08-09 8:38 [RFC 00/22] OMAPDSS: DT support Tomi Valkeinen 2013-08-09 8:38 ` Tomi Valkeinen 2013-08-09 8:38 ` [RFC 01/22] ARM: OMAP: remove DSS DT hack Tomi Valkeinen 2013-08-09 8:38 ` Tomi Valkeinen 2013-08-09 8:38 ` [RFC 02/22] OMAPDSS: remove DT hacks for regulators Tomi Valkeinen 2013-08-09 8:38 ` Tomi Valkeinen 2013-08-09 8:38 ` [RFC 03/22] ARM: OMAP2+: add omapdss_init_of() Tomi Valkeinen 2013-08-09 8:38 ` Tomi Valkeinen 2013-08-09 8:38 ` [RFC 04/22] OMAPDSS: if dssdev->name==NULL, use alias Tomi Valkeinen 2013-08-09 8:38 ` Tomi Valkeinen 2013-08-09 8:38 ` [RFC 05/22] OMAPDSS: get dssdev->alias from DT alias Tomi Valkeinen 2013-08-09 8:38 ` Tomi Valkeinen 2013-08-09 8:38 ` [RFC 06/22] OMAPFB: clean up default display search Tomi Valkeinen 2013-08-09 8:38 ` Tomi Valkeinen 2013-08-09 8:38 ` [RFC 07/22] OMAPFB: search for default display with DT alias Tomi Valkeinen 2013-08-09 8:38 ` Tomi Valkeinen 2013-08-09 8:38 ` [RFC 08/22] OMAPDSS: Add DT support to DSS, DISPC, DPI, HDMI, VENC Tomi Valkeinen 2013-08-09 8:38 ` Tomi Valkeinen 2013-08-09 8:38 ` [RFC 09/22] OMAPDSS: Add DT support to DSI Tomi Valkeinen 2013-08-09 8:38 ` Tomi Valkeinen 2013-08-09 8:38 ` [RFC 10/22] ARM: omap3.dtsi: add omapdss information Tomi Valkeinen 2013-08-09 8:38 ` Tomi Valkeinen 2013-08-09 8:38 ` [RFC 11/22] ARM: omap4.dtsi: " Tomi Valkeinen 2013-08-09 8:38 ` Tomi Valkeinen 2013-08-09 8:38 ` [RFC 12/22] ARM: omap4-panda.dts: add display information Tomi Valkeinen 2013-08-09 8:38 ` Tomi Valkeinen 2013-08-09 8:38 ` [RFC 13/22] ARM: omap4-sdp.dts: " Tomi Valkeinen 2013-08-09 8:38 ` Tomi Valkeinen 2013-08-09 8:38 ` [RFC 14/22] ARM: omap3-tobi.dts: add lcd (TEST) Tomi Valkeinen 2013-08-09 8:38 ` Tomi Valkeinen 2013-08-09 8:39 ` [RFC 15/22] ARM: omap3-beagle.dts: add display information Tomi Valkeinen 2013-08-09 8:39 ` Tomi Valkeinen 2013-08-09 8:39 ` Tomi Valkeinen [this message] 2013-08-09 8:39 ` [RFC 16/22] OMAPDSS: panel-dsi-cm: Add DT support Tomi Valkeinen 2013-08-09 8:39 ` [RFC 17/22] OMAPDSS: encoder-tfp410: " Tomi Valkeinen 2013-08-09 8:39 ` Tomi Valkeinen 2013-08-09 8:39 ` [RFC 18/22] OMAPDSS: connector-dvi: " Tomi Valkeinen 2013-08-09 8:39 ` Tomi Valkeinen 2013-08-09 8:39 ` [RFC 19/22] OMAPDSS: encoder-tpd12s015: " Tomi Valkeinen 2013-08-09 8:39 ` Tomi Valkeinen 2013-08-09 8:39 ` [RFC 20/22] OMAPDSS: hdmi-connector: " Tomi Valkeinen 2013-08-09 8:39 ` Tomi Valkeinen 2013-08-09 8:39 ` [RFC 21/22] OMAPDSS: panel-dpi: " Tomi Valkeinen 2013-08-09 8:39 ` Tomi Valkeinen 2013-08-09 8:39 ` [RFC 22/22] OMAPDSS: connector-analog-tv: " Tomi Valkeinen 2013-08-09 8:39 ` Tomi Valkeinen 2013-08-13 7:54 ` [RFC 00/22] OMAPDSS: " Tony Lindgren 2013-08-13 7:54 ` Tony Lindgren 2013-08-30 9:47 ` Tomi Valkeinen 2013-08-30 9:47 ` Tomi Valkeinen 2013-09-02 6:15 ` Tony Lindgren 2013-09-02 6:15 ` Tony Lindgren 2013-09-02 6:42 ` Tomi Valkeinen 2013-09-02 6:42 ` Tomi Valkeinen 2013-09-04 17:20 ` Tony Lindgren 2013-09-04 17:20 ` Tony Lindgren 2013-08-21 21:07 ` Laurent Pinchart 2013-08-21 21:07 ` Laurent Pinchart 2013-09-02 8:00 ` Tomi Valkeinen 2013-09-02 8:00 ` Tomi Valkeinen 2013-09-03 10:56 ` Laurent Pinchart 2013-09-03 10:56 ` Laurent Pinchart 2013-09-04 7:29 ` Stefan Roese 2013-09-04 7:29 ` Stefan Roese 2013-09-04 7:41 ` Tomi Valkeinen 2013-09-04 7:41 ` Tomi Valkeinen
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1376037547-10859-17-git-send-email-tomi.valkeinen@ti.com \ --to=tomi.valkeinen@ti.com \ --cc=archit@ti.com \ --cc=balbi@ti.com \ --cc=devicetree@vger.kernel.org \ --cc=laurent.pinchart@ideasonboard.com \ --cc=linux-fbdev@vger.kernel.org \ --cc=linux-omap@vger.kernel.org \ --cc=nm@ti.com \ --cc=santosh.shilimkar@ti.com \ --cc=tony@atomide.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.