From: Archit Taneja <a0393947@ti.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
Subject: Re: [PATCH 11/25] OMAPDSS: create custom pdevs for DSS omap_devices
Date: Fri, 04 May 2012 08:29:21 +0000 [thread overview]
Message-ID: <4FA39091.8010007@ti.com> (raw)
In-Reply-To: <1336053481-25433-12-git-send-email-tomi.valkeinen@ti.com>
On Thursday 03 May 2012 07:27 PM, Tomi Valkeinen wrote:
> Instead of using omap_device_build() to create the omap_devices for DSS
> hwmods, create them with a custom function. This will allow us to create
> a parent-child hierarchy for the devices so that the omapdss_core device
> is parent for the rest of the dss hwmod devices.
>
> Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
> ---
> arch/arm/mach-omap2/display.c | 88 ++++++++++++++++++++++++++++++++++-------
> 1 file changed, 74 insertions(+), 14 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
> index 07232fd..46d2a98 100644
> --- a/arch/arm/mach-omap2/display.c
> +++ b/arch/arm/mach-omap2/display.c
> @@ -185,13 +185,71 @@ static int omap_dss_set_min_bus_tput(struct device *dev, unsigned long tput)
> return omap_pm_set_min_bus_tput(dev, OCP_INITIATOR_AGENT, tput);
> }
>
> +static struct platform_device *create_dss_pdev(const char *pdev_name,
> + int pdev_id, const char *oh_name, void *pdata, int pdata_len,
> + struct platform_device *parent)
> +{
> + struct platform_device *pdev;
> + struct omap_device *od;
> + struct omap_hwmod *ohs[1];
> + struct omap_hwmod *oh;
> + int r;
> +
> + oh = omap_hwmod_lookup(oh_name);
> + if (!oh) {
> + pr_err("Could not look up %s\n", oh_name);
> + r = -ENODEV;
> + goto err;
> + }
> +
> + pdev = platform_device_alloc(pdev_name, pdev_id);
> + if (!pdev) {
> + pr_err("Could not create pdev for %s\n", pdev_name);
> + r = -ENOMEM;
> + goto err;
> + }
> +
> + if (parent != NULL)
> + pdev->dev.parent =&parent->dev;
> +
> + if (pdev->id != -1)
> + dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);
> + else
> + dev_set_name(&pdev->dev, "%s", pdev->name);
> +
> + ohs[0] = oh;
> + od = omap_device_alloc(pdev, ohs, 1, NULL, 0);
> + if (!od) {
> + pr_err("Could not alloc omap_device for %s\n", pdev_name);
> + r = -ENOMEM;
> + goto err;
> + }
> +
> + r = platform_device_add_data(pdev, pdata, pdata_len);
> + if (r) {
> + pr_err("Could not set pdata for %s\n", pdev_name);
> + goto err;
> + }
> +
> + r = omap_device_register(pdev);
> + if (r) {
> + pr_err("Could not register omap_device for %s\n", pdev_name);
> + goto err;
> + }
> +
> + return pdev;
> +
> +err:
> + return ERR_PTR(r);
> +}
> +
> int __init omap_display_init(struct omap_dss_board_info *board_data)
> {
> int r = 0;
> - struct omap_hwmod *oh;
> struct platform_device *pdev;
> int i, oh_count;
> const struct omap_dss_hwmod_data *curr_dss_hwmod;
> + struct platform_device *dss_pdev;
>
> /* create omapdss device */
>
> @@ -221,22 +279,24 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
> oh_count = ARRAY_SIZE(omap4_dss_hwmod_data);
> }
>
> - for (i = 0; i< oh_count; i++) {
> - oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name);
> - if (!oh) {
> - pr_err("Could not look up %s\n",
> - curr_dss_hwmod[i].oh_name);
> - return -ENODEV;
> - }
> + dss_pdev = NULL;
>
> - pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
> - curr_dss_hwmod[i].id, oh,
> + for (i = 0; i< oh_count; i++) {
> + pdev = create_dss_pdev(curr_dss_hwmod[i].dev_name,
> + curr_dss_hwmod[i].id,
> + curr_dss_hwmod[i].oh_name,
> NULL, 0,
> - NULL, 0, 0);
> + dss_pdev);
> +
> + if (IS_ERR(pdev)) {
> + pr_err("Could not build omap_device for %s\n",
> + curr_dss_hwmod[i].oh_name);
> +
> + return PTR_ERR(pdev);
> + }
>
> - if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n",
> - curr_dss_hwmod[i].oh_name))
> - return -ENODEV;
> + if (i = 0)
> + dss_pdev = pdev;
The above line is a bit tricky to understand, maybe something like this
may explain the parent-child setting better:
if (!strcmp(curr_dss_hwmod[i].oh_name, "dss_core"))
dss_pdev = pdev;
I had another general question about the parent-child series. What is
the use of the platform device omap_display_device (with the name
"omapdss"). Is it just a way to get the board data?
Archit
> }
>
> return 0;
WARNING: multiple messages have this Message-ID (diff)
From: Archit Taneja <a0393947@ti.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
Subject: Re: [PATCH 11/25] OMAPDSS: create custom pdevs for DSS omap_devices
Date: Fri, 4 May 2012 13:47:21 +0530 [thread overview]
Message-ID: <4FA39091.8010007@ti.com> (raw)
In-Reply-To: <1336053481-25433-12-git-send-email-tomi.valkeinen@ti.com>
On Thursday 03 May 2012 07:27 PM, Tomi Valkeinen wrote:
> Instead of using omap_device_build() to create the omap_devices for DSS
> hwmods, create them with a custom function. This will allow us to create
> a parent-child hierarchy for the devices so that the omapdss_core device
> is parent for the rest of the dss hwmod devices.
>
> Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
> ---
> arch/arm/mach-omap2/display.c | 88 ++++++++++++++++++++++++++++++++++-------
> 1 file changed, 74 insertions(+), 14 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
> index 07232fd..46d2a98 100644
> --- a/arch/arm/mach-omap2/display.c
> +++ b/arch/arm/mach-omap2/display.c
> @@ -185,13 +185,71 @@ static int omap_dss_set_min_bus_tput(struct device *dev, unsigned long tput)
> return omap_pm_set_min_bus_tput(dev, OCP_INITIATOR_AGENT, tput);
> }
>
> +static struct platform_device *create_dss_pdev(const char *pdev_name,
> + int pdev_id, const char *oh_name, void *pdata, int pdata_len,
> + struct platform_device *parent)
> +{
> + struct platform_device *pdev;
> + struct omap_device *od;
> + struct omap_hwmod *ohs[1];
> + struct omap_hwmod *oh;
> + int r;
> +
> + oh = omap_hwmod_lookup(oh_name);
> + if (!oh) {
> + pr_err("Could not look up %s\n", oh_name);
> + r = -ENODEV;
> + goto err;
> + }
> +
> + pdev = platform_device_alloc(pdev_name, pdev_id);
> + if (!pdev) {
> + pr_err("Could not create pdev for %s\n", pdev_name);
> + r = -ENOMEM;
> + goto err;
> + }
> +
> + if (parent != NULL)
> + pdev->dev.parent =&parent->dev;
> +
> + if (pdev->id != -1)
> + dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);
> + else
> + dev_set_name(&pdev->dev, "%s", pdev->name);
> +
> + ohs[0] = oh;
> + od = omap_device_alloc(pdev, ohs, 1, NULL, 0);
> + if (!od) {
> + pr_err("Could not alloc omap_device for %s\n", pdev_name);
> + r = -ENOMEM;
> + goto err;
> + }
> +
> + r = platform_device_add_data(pdev, pdata, pdata_len);
> + if (r) {
> + pr_err("Could not set pdata for %s\n", pdev_name);
> + goto err;
> + }
> +
> + r = omap_device_register(pdev);
> + if (r) {
> + pr_err("Could not register omap_device for %s\n", pdev_name);
> + goto err;
> + }
> +
> + return pdev;
> +
> +err:
> + return ERR_PTR(r);
> +}
> +
> int __init omap_display_init(struct omap_dss_board_info *board_data)
> {
> int r = 0;
> - struct omap_hwmod *oh;
> struct platform_device *pdev;
> int i, oh_count;
> const struct omap_dss_hwmod_data *curr_dss_hwmod;
> + struct platform_device *dss_pdev;
>
> /* create omapdss device */
>
> @@ -221,22 +279,24 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
> oh_count = ARRAY_SIZE(omap4_dss_hwmod_data);
> }
>
> - for (i = 0; i< oh_count; i++) {
> - oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name);
> - if (!oh) {
> - pr_err("Could not look up %s\n",
> - curr_dss_hwmod[i].oh_name);
> - return -ENODEV;
> - }
> + dss_pdev = NULL;
>
> - pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
> - curr_dss_hwmod[i].id, oh,
> + for (i = 0; i< oh_count; i++) {
> + pdev = create_dss_pdev(curr_dss_hwmod[i].dev_name,
> + curr_dss_hwmod[i].id,
> + curr_dss_hwmod[i].oh_name,
> NULL, 0,
> - NULL, 0, 0);
> + dss_pdev);
> +
> + if (IS_ERR(pdev)) {
> + pr_err("Could not build omap_device for %s\n",
> + curr_dss_hwmod[i].oh_name);
> +
> + return PTR_ERR(pdev);
> + }
>
> - if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n",
> - curr_dss_hwmod[i].oh_name))
> - return -ENODEV;
> + if (i == 0)
> + dss_pdev = pdev;
The above line is a bit tricky to understand, maybe something like this
may explain the parent-child setting better:
if (!strcmp(curr_dss_hwmod[i].oh_name, "dss_core"))
dss_pdev = pdev;
I had another general question about the parent-child series. What is
the use of the platform device omap_display_device (with the name
"omapdss"). Is it just a way to get the board data?
Archit
> }
>
> return 0;
next prev parent reply other threads:[~2012-05-04 8:29 UTC|newest]
Thread overview: 96+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-03 13:57 [PATCH 00/25] OMAPDSS: DT preparation patches v2 Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 01/25] OMAPDSS: panel-dvi: add PD gpio handling Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-09 16:50 ` Russ Dill
2012-05-09 16:50 ` Russ Dill
2012-05-09 17:32 ` Tomi Valkeinen
2012-05-09 17:32 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 02/25] OMAP: board-files: remove custom PD GPIO handling for DVI output Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 03/25] OMAPDSS: TFP410: rename dvi -> tfp410 Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 04/25] OMAPDSS: TFP410: rename dvi files to tfp410 Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 05/25] OMAPDSS: TFP410: pdata rewrite Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 06/25] OMAPDSS: DSI: use dsi_get_dsidev_id(dsidev) instead of dsidev->id Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 07/25] OMAPDSS: Taal: move reset gpio handling to taal driver Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 08/25] OMAPDSS: clean up the omapdss platform data mess Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-04 5:32 ` Archit Taneja
2012-05-04 5:44 ` Archit Taneja
2012-05-04 8:32 ` Tomi Valkeinen
2012-05-04 8:32 ` Tomi Valkeinen
2012-05-04 8:36 ` Archit Taneja
2012-05-04 8:48 ` Archit Taneja
2012-05-04 8:49 ` Tomi Valkeinen
2012-05-04 8:49 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 09/25] OMAPDSS: remove return from platform_driver_unreg Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 10/25] OMAPDSS: use platform_driver_probe for core/dispc/dss Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 11/25] OMAPDSS: create custom pdevs for DSS omap_devices Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-04 6:03 ` Archit Taneja
2012-05-04 6:15 ` Archit Taneja
2012-05-04 8:37 ` Tomi Valkeinen
2012-05-04 8:37 ` Tomi Valkeinen
2012-05-04 8:17 ` Archit Taneja [this message]
2012-05-04 8:29 ` Archit Taneja
2012-05-04 9:00 ` Tomi Valkeinen
2012-05-04 9:00 ` Tomi Valkeinen
2012-05-04 9:13 ` Archit Taneja
2012-05-04 9:25 ` Archit Taneja
2012-05-03 13:57 ` [PATCH 12/25] OMAPDSS: create DPI & SDI devices Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 13/25] OMAPDSS: create DPI & SDI drivers Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 14/25] OMAPDSS: remove uses of dss_runtime_get/put Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 15/25] OMAPDSS: handle output-driver reg/unreg more dynamically Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 16/25] OMAPDSS: move the creation of debugfs files Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 17/25] OMAPDSS: use platform_driver_probe for dsi/hdmi/rfbi/venc/dpi/sdi Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 18/25] OMAPDSS: add __init & __exit Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 19/25] OMAPFB: " Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 20/25] OMAPDSS: change default_device handling Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 21/25] OMAPDSS: interface drivers register their panel devices Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 22/25] OMAPDSS: init omap_dss_devices internally Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:57 ` [PATCH 23/25] OMAPDSS: DSI: implement generic DSI pin config Tomi Valkeinen
2012-05-03 13:57 ` Tomi Valkeinen
2012-05-03 13:58 ` [PATCH 24/25] OMAPDSS: DSI: improve DSI module id handling Tomi Valkeinen
2012-05-03 13:58 ` Tomi Valkeinen
2012-05-04 9:09 ` Archit Taneja
2012-05-04 9:21 ` Archit Taneja
2012-05-04 9:53 ` Tomi Valkeinen
2012-05-04 9:53 ` Tomi Valkeinen
2012-05-04 10:05 ` Archit Taneja
2012-05-04 10:17 ` Archit Taneja
2012-05-04 10:11 ` Tomi Valkeinen
2012-05-04 10:11 ` Tomi Valkeinen
2012-05-03 13:58 ` [PATCH 25/25] OMAPDSS: separate pdata based initialization Tomi Valkeinen
2012-05-03 13:58 ` Tomi Valkeinen
2012-05-07 17:46 ` [PATCH 00/25] OMAPDSS: DT preparation patches v2 Tony Lindgren
2012-05-07 17:46 ` Tony Lindgren
2012-05-08 8:44 ` Tomi Valkeinen
2012-05-08 8:44 ` Tomi Valkeinen
2012-05-08 16:00 ` Tony Lindgren
2012-05-08 16:00 ` Tony Lindgren
2012-05-09 8:09 ` Tomi Valkeinen
2012-05-09 8:09 ` Tomi Valkeinen
2012-05-09 15:45 ` Tony Lindgren
2012-05-09 15:45 ` Tony Lindgren
2012-05-10 7:11 ` Tomi Valkeinen
2012-05-10 7:11 ` Tomi Valkeinen
2012-05-10 16:13 ` Tony Lindgren
2012-05-10 16:13 ` Tony Lindgren
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=4FA39091.8010007@ti.com \
--to=a0393947@ti.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=tomi.valkeinen@ti.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: link
Be 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.