From: Liviu Dudau <Liviu.Dudau@arm.com>
To: "james qian wang (Arm Technology China)" <james.qian.wang@arm.com>
Cc: "Jonathan Chai (Arm Technology China)" <Jonathan.Chai@arm.com>,
Brian Starkey <Brian.Starkey@arm.com>,
"Julien Yin (Arm Technology China)" <Julien.Yin@arm.com>,
"thomas Sun (Arm Technology China)" <thomas.Sun@arm.com>,
Alexandru-Cosmin Gheorghe <Alexandru-Cosmin.Gheorghe@arm.com>,
"Lowry Li (Arm Technology China)" <Lowry.Li@arm.com>,
Ayan Halder <Ayan.Halder@arm.com>,
"Tiannan Zhu (Arm Technology China)" <Tiannan.Zhu@arm.com>,
"Jin Gao (Arm Technology China)" <Jin.Gao@arm.com>,
"Yiqi Kang (Arm Technology China)" <Yiqi.Kang@arm.com>,
nd <nd@arm.com>, "malidp@foss.arm.com" <malidp@foss.arm.com>,
"maarten.lankhorst@linux.intel.com"
<maarten.lankhorst@linux.intel.com>,
"maxime.ripard@bootlin.com" <maxime.ripard@bootlin.com>,
"sean@poorly.run" <sean@poorly.run>,
"corbet@lwn.net" <corbet@lwn.net>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"rdunlap@infradead.org" <rdunlap@infradead.org>,
"mchehab+samsung@kernel.org" <mchehab+samsung@kernel.org>,
"davem@davemloft.net" <davem@davemloft.net>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"nicolas.ferre@microchip.com" <nicolas.ferre@microchip.com>,
"arnd@arndb.de" <arnd@arndb.de>,
"robh+dt@kernel.org" <robh+dt@kernel.org>,
Mark Rutland <Mark.Rutland@arm.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"airlied@linux.ie" <airlied@linux.ie>,
"yamada.masahiro@socionext.com" <yamada.masahiro@socionext.com>
Subject: Re: [PATCH v3 4/9] drm/komeda: Add DT parsing
Date: Mon, 24 Dec 2018 12:03:04 +0000 [thread overview]
Message-ID: <20181224120304.GF22341@e110455-lin.cambridge.arm.com> (raw)
In-Reply-To: <20181221095757.15510-5-james.qian.wang@arm.com>
On Fri, Dec 21, 2018 at 09:59:44AM +0000, james qian wang (Arm Technology China) wrote:
> Parse DT and initialize corresponding dev/pipeline attributes.
>
> Changes in v3:
> - Fixed style problem found by checkpatch.pl --strict.
>
> Changes in v2:
> - Unified abbreviation of "pipeline" to "pipe".
>
> Signed-off-by: James (Qian) Wang <james.qian.wang@arm.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Best regards,
Liviu
> ---
> .../gpu/drm/arm/display/komeda/komeda_dev.c | 76 +++++++++++++++++++
> .../gpu/drm/arm/display/komeda/komeda_dev.h | 3 +
> .../drm/arm/display/komeda/komeda_pipeline.c | 4 +
> .../drm/arm/display/komeda/komeda_pipeline.h | 7 ++
> 4 files changed, 90 insertions(+)
>
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> index 887a17005367..d0cc4f758077 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> @@ -12,6 +12,76 @@
> #include <linux/version.h>
> #include "komeda_dev.h"
>
> +static int komeda_parse_pipe_dt(struct komeda_dev *mdev, struct device_node *np)
> +{
> + struct komeda_pipeline *pipe;
> + struct clk *clk;
> + u32 pipe_id;
> + int ret = 0;
> +
> + ret = of_property_read_u32(np, "reg", &pipe_id);
> + if (ret != 0 || pipe_id >= mdev->n_pipelines)
> + return -EINVAL;
> +
> + pipe = mdev->pipelines[pipe_id];
> +
> + clk = of_clk_get_by_name(np, "aclk");
> + if (IS_ERR(clk)) {
> + DRM_ERROR("get aclk for pipeline %d failed!\n", pipe_id);
> + return PTR_ERR(clk);
> + }
> + pipe->aclk = clk;
> +
> + clk = of_clk_get_by_name(np, "pxclk");
> + if (IS_ERR(clk)) {
> + DRM_ERROR("get pxclk for pipeline %d failed!\n", pipe_id);
> + return PTR_ERR(clk);
> + }
> + pipe->pxlclk = clk;
> +
> + /* enum ports */
> + pipe->of_output_dev =
> + of_graph_get_remote_node(np, KOMEDA_OF_PORT_OUTPUT, 0);
> + pipe->of_output_port =
> + of_graph_get_port_by_id(np, KOMEDA_OF_PORT_OUTPUT);
> +
> + pipe->of_node = np;
> +
> + return 0;
> +}
> +
> +static int komeda_parse_dt(struct device *dev, struct komeda_dev *mdev)
> +{
> + struct platform_device *pdev = to_platform_device(dev);
> + struct device_node *child, *np = dev->of_node;
> + struct clk *clk;
> + int ret;
> +
> + clk = devm_clk_get(dev, "mclk");
> + if (IS_ERR(clk))
> + return PTR_ERR(clk);
> +
> + mdev->mclk = clk;
> + mdev->irq = platform_get_irq(pdev, 0);
> + if (mdev->irq < 0) {
> + DRM_ERROR("could not get IRQ number.\n");
> + return mdev->irq;
> + }
> +
> + for_each_available_child_of_node(np, child) {
> + if (of_node_cmp(child->name, "pipeline") == 0) {
> + ret = komeda_parse_pipe_dt(mdev, child);
> + if (ret) {
> + DRM_ERROR("parse pipeline dt error!\n");
> + of_node_put(child);
> + break;
> + }
> + }
> + }
> +
> + return ret;
> +}
> +
> struct komeda_dev *komeda_dev_create(struct device *dev)
> {
> struct platform_device *pdev = to_platform_device(dev);
> @@ -74,6 +144,12 @@ struct komeda_dev *komeda_dev_create(struct device *dev)
> goto err_cleanup;
> }
>
> + err = komeda_parse_dt(dev, mdev);
> + if (err) {
> + DRM_ERROR("parse device tree failed.\n");
> + goto err_cleanup;
> + }
> +
> return mdev;
>
> err_cleanup:
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> index 680e3e2cf100..4a27a44e2ec6 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> @@ -72,6 +72,9 @@ struct komeda_dev {
> /** @mck: HW main engine clk */
> struct clk *mclk;
>
> + /** @irq: irq number */
> + u32 irq;
> +
> int n_pipelines;
> struct komeda_pipeline *pipelines[KOMEDA_MAX_PIPELINES];
>
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
> index 9293598b0533..e731b2a85c3a 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
> @@ -55,6 +55,10 @@ void komeda_pipeline_destroy(struct komeda_dev *mdev,
> clk_put(pipe->pxlclk);
> clk_put(pipe->aclk);
>
> + of_node_put(pipe->of_output_dev);
> + of_node_put(pipe->of_output_port);
> + of_node_put(pipe->of_node);
> +
> devm_kfree(mdev->dev, pipe);
> }
>
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h
> index 2174796d47c5..d1e0c1140273 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h
> @@ -290,6 +290,13 @@ struct komeda_pipeline {
> struct komeda_improc *improc;
> struct komeda_timing_ctrlr *ctrlr;
> struct komeda_pipeline_funcs *funcs; /* private pipeline functions */
> +
> + /** @of_node: pipeline dt node */
> + struct device_node *of_node;
> + /** @of_output_port: pipeline output port */
> + struct device_node *of_output_port;
> + /** @of_output_dev: output connector device node */
> + struct device_node *of_output_dev;
> };
>
> /**
> --
> 2.17.1
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
next prev parent reply other threads:[~2018-12-24 12:03 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-21 9:58 [PATCH v3 0/9] Overview of Arm komeda display driver james qian wang (Arm Technology China)
2018-12-21 9:58 ` [PATCH v3 1/9] drm/komeda: komeda_dev/pipeline/component definition and initialzation james qian wang (Arm Technology China)
2018-12-24 11:57 ` Liviu Dudau
2018-12-27 6:37 ` james qian wang (Arm Technology China)
2018-12-21 9:59 ` [PATCH v3 2/9] dt/bindings: drm/komeda: Add DT bindings for ARM display processor D71 james qian wang (Arm Technology China)
2018-12-24 12:00 ` Liviu Dudau
2018-12-27 6:39 ` james qian wang (Arm Technology China)
2018-12-21 9:59 ` [PATCH v3 3/9] drm/komeda: Build komeda to be a platform module james qian wang (Arm Technology China)
2018-12-24 12:02 ` Liviu Dudau
2018-12-21 9:59 ` [PATCH v3 4/9] drm/komeda: Add DT parsing james qian wang (Arm Technology China)
2018-12-24 12:03 ` Liviu Dudau [this message]
2018-12-21 10:00 ` [PATCH v3 5/9] drm/komeda: Add komeda_format_caps for format handling james qian wang (Arm Technology China)
2018-12-24 12:05 ` Liviu Dudau
2018-12-21 10:00 ` [PATCH v3 6/9] drm/komeda: Add komeda_framebuffer james qian wang (Arm Technology China)
2018-12-24 12:15 ` Liviu Dudau
2018-12-21 10:00 ` [PATCH v3 7/9] drm/komeda: Attach komeda_dev to DRM-KMS james qian wang (Arm Technology China)
2018-12-24 12:32 ` Liviu Dudau
2018-12-27 7:09 ` james qian wang (Arm Technology China)
2018-12-27 14:28 ` Liviu Dudau
2018-12-27 14:31 ` Liviu Dudau
2018-12-28 6:51 ` james qian wang (Arm Technology China)
2018-12-21 10:00 ` [PATCH v3 8/9] drm/doc: Add initial komeda driver documentation james qian wang (Arm Technology China)
2018-12-24 12:32 ` Liviu Dudau
2018-12-21 10:01 ` [PATCH v3 9/9] MAINTAINERS: Add maintainer for arm komeda driver james qian wang (Arm Technology China)
2018-12-24 12:33 ` Liviu Dudau
2018-12-24 13:05 ` Daniel Vetter
2018-12-28 11:15 ` james qian wang (Arm Technology China)
2018-12-28 11:56 ` Daniel Vetter
2018-12-28 16:34 ` Liviu Dudau
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=20181224120304.GF22341@e110455-lin.cambridge.arm.com \
--to=liviu.dudau@arm.com \
--cc=Alexandru-Cosmin.Gheorghe@arm.com \
--cc=Ayan.Halder@arm.com \
--cc=Brian.Starkey@arm.com \
--cc=Jin.Gao@arm.com \
--cc=Jonathan.Chai@arm.com \
--cc=Julien.Yin@arm.com \
--cc=Lowry.Li@arm.com \
--cc=Mark.Rutland@arm.com \
--cc=Tiannan.Zhu@arm.com \
--cc=Yiqi.Kang@arm.com \
--cc=airlied@linux.ie \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=james.qian.wang@arm.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=malidp@foss.arm.com \
--cc=maxime.ripard@bootlin.com \
--cc=mchehab+samsung@kernel.org \
--cc=nd@arm.com \
--cc=nicolas.ferre@microchip.com \
--cc=rdunlap@infradead.org \
--cc=robh+dt@kernel.org \
--cc=sean@poorly.run \
--cc=thomas.Sun@arm.com \
--cc=yamada.masahiro@socionext.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).