From: CK Hu <ck.hu@mediatek.com>
To: Bibby Hsieh <bibby.hsieh@mediatek.com>
Cc: Junzhi Zhao <junzhi.zhao@mediatek.com>,
linux-kernel@vger.kernel.org,
Sascha Hauer <kernel@pengutronix.de>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Cawa Cheng <cawa.cheng@mediatek.com>,
dri-devel@lists.freedesktop.org,
Mao Huang <littlecvr@chromium.org>,
linux-mediatek@lists.infradead.org,
Matthias Brugger <matthias.bgg@gmail.com>,
Yingjoe Chen <yingjoe.chen@mediatek.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/4] drm/mediatek: fix the wrong pixel clock when resolution is 4K
Date: Mon, 25 Jul 2016 14:49:35 +0800 [thread overview]
Message-ID: <1469429375.11841.69.camel@mtksdaap41> (raw)
In-Reply-To: <1469427845.26205.17.camel@mtksdaap41>
Hi, Bibby:
On Mon, 2016-07-25 at 14:24 +0800, Bibby Hsieh wrote:
> Hi, CK,
>
> Thanks for your comments.
>
> On Wed, 2016-07-20 at 15:57 +0800, CK Hu wrote:
> > Hi, Bibby:
> >
> > Some comments inline.
> >
> > On Wed, 2016-07-20 at 12:03 +0800, Bibby Hsieh wrote:
> > > From: Junzhi Zhao <junzhi.zhao@mediatek.com>
> > >
> > > Pixel clock should be 297MHz when resolution is 4K.
> > >
> > > Signed-off-by: Junzhi Zhao <junzhi.zhao@mediatek.com>
> > > Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
> > > ---
> > > drivers/gpu/drm/mediatek/mtk_dpi.c | 184 +++++++++++++++++++++++++-----------
> > > 1 file changed, 131 insertions(+), 53 deletions(-)
> > >
[snip...]
> > >
> > > +static int mt8173_parse_clk_from_dt(struct mtk_dpi *dpi, struct device_node *np)
> > > +{
> > > + int i;
> > > +
> > > + for (i = 0; i < ARRAY_SIZE(mtk_dpi_clk_names); i++) {
> > > + dpi->clk[i] = of_clk_get_by_name(np,
> > > + mtk_dpi_clk_names[i]);
> > > + if (IS_ERR(dpi->clk[i]))
> > > + return PTR_ERR(dpi->clk[i]);
> > > + }
> > > + return 0;
> > > +}
> >
> > I think parsing device tree is a pure SW behavior. Would this vary for
> > different MTK soc?
> >
> Yes
I can not imaging that, so could you give me an example source code of
other MTK soc for parse_clk_from_dt()?
> > > +
> > > +
> > > +static const struct mtk_dpi_conf mt8173_conf = {
> > > + .parse_clk_from_dt = mt8173_parse_clk_from_dt,
> > > + .clk_config = mt8173_clk_config,
> > > +};
> > > +
> > > +static const struct of_device_id mtk_dpi_of_ids[] = {
> > > + { .compatible = "mediatek,mt8173-dpi",
> > > + .data = &mt8173_conf,
> > > + },
> > > + {}
> > > +};
> > > +
> > > static int mtk_dpi_probe(struct platform_device *pdev)
> > > {
> > > struct device *dev = &pdev->dev;
> > > struct mtk_dpi *dpi;
> > > struct resource *mem;
> > > + struct device_node *np = dev->of_node;
> > > struct device_node *ep, *bridge_node = NULL;
> > > int comp_id;
> > > + const struct of_device_id *match;
> > > + struct mtk_dpi_conf *conf;
> > > int ret;
> > >
> > > + match = of_match_node(mtk_dpi_of_ids, dev->of_node);
> > > + if (!match)
> > > + return -ENODEV;
> > > +
> > > dpi = devm_kzalloc(dev, sizeof(*dpi), GFP_KERNEL);
> > > if (!dpi)
> > > return -ENOMEM;
> > >
> > > dpi->dev = dev;
> > > + dpi->data = (void *)match->data;
> > > + conf = (struct mtk_dpi_conf *)match->data;
> > >
> > > mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > > dpi->regs = devm_ioremap_resource(dev, mem);
> > > @@ -679,24 +777,9 @@ static int mtk_dpi_probe(struct platform_device *pdev)
> > > return ret;
> > > }
> > >
> > > - dpi->engine_clk = devm_clk_get(dev, "engine");
> > > - if (IS_ERR(dpi->engine_clk)) {
> > > - ret = PTR_ERR(dpi->engine_clk);
> > > - dev_err(dev, "Failed to get engine clock: %d\n", ret);
> > > - return ret;
> > > - }
> > > -
> > > - dpi->pixel_clk = devm_clk_get(dev, "pixel");
> > > - if (IS_ERR(dpi->pixel_clk)) {
> > > - ret = PTR_ERR(dpi->pixel_clk);
> > > - dev_err(dev, "Failed to get pixel clock: %d\n", ret);
> > > - return ret;
> > > - }
> > > -
> > > - dpi->tvd_clk = devm_clk_get(dev, "pll");
> > > - if (IS_ERR(dpi->tvd_clk)) {
> > > - ret = PTR_ERR(dpi->tvd_clk);
> > > - dev_err(dev, "Failed to get tvdpll clock: %d\n", ret);
> > > + ret = conf->parse_clk_from_dt(dpi, np);
> > > + if (ret) {
> > > + dev_err(dev, "parse tvd div clk failed!");
> > > return ret;
> > > }
> > >
> > > @@ -754,11 +837,6 @@ static int mtk_dpi_remove(struct platform_device *pdev)
> > > return 0;
> > > }
> > >
> > > -static const struct of_device_id mtk_dpi_of_ids[] = {
> > > - { .compatible = "mediatek,mt8173-dpi", },
> > > - {}
> > > -};
> > > -
> > > struct platform_driver mtk_dpi_driver = {
> > > .probe = mtk_dpi_probe,
> > > .remove = mtk_dpi_remove,
> >
> > Regards,
> > CK
> >
>
Regards,
CK
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: ck.hu@mediatek.com (CK Hu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] drm/mediatek: fix the wrong pixel clock when resolution is 4K
Date: Mon, 25 Jul 2016 14:49:35 +0800 [thread overview]
Message-ID: <1469429375.11841.69.camel@mtksdaap41> (raw)
In-Reply-To: <1469427845.26205.17.camel@mtksdaap41>
Hi, Bibby:
On Mon, 2016-07-25 at 14:24 +0800, Bibby Hsieh wrote:
> Hi, CK,
>
> Thanks for your comments.
>
> On Wed, 2016-07-20 at 15:57 +0800, CK Hu wrote:
> > Hi, Bibby:
> >
> > Some comments inline.
> >
> > On Wed, 2016-07-20 at 12:03 +0800, Bibby Hsieh wrote:
> > > From: Junzhi Zhao <junzhi.zhao@mediatek.com>
> > >
> > > Pixel clock should be 297MHz when resolution is 4K.
> > >
> > > Signed-off-by: Junzhi Zhao <junzhi.zhao@mediatek.com>
> > > Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
> > > ---
> > > drivers/gpu/drm/mediatek/mtk_dpi.c | 184 +++++++++++++++++++++++++-----------
> > > 1 file changed, 131 insertions(+), 53 deletions(-)
> > >
[snip...]
> > >
> > > +static int mt8173_parse_clk_from_dt(struct mtk_dpi *dpi, struct device_node *np)
> > > +{
> > > + int i;
> > > +
> > > + for (i = 0; i < ARRAY_SIZE(mtk_dpi_clk_names); i++) {
> > > + dpi->clk[i] = of_clk_get_by_name(np,
> > > + mtk_dpi_clk_names[i]);
> > > + if (IS_ERR(dpi->clk[i]))
> > > + return PTR_ERR(dpi->clk[i]);
> > > + }
> > > + return 0;
> > > +}
> >
> > I think parsing device tree is a pure SW behavior. Would this vary for
> > different MTK soc?
> >
> Yes
I can not imaging that, so could you give me an example source code of
other MTK soc for parse_clk_from_dt()?
> > > +
> > > +
> > > +static const struct mtk_dpi_conf mt8173_conf = {
> > > + .parse_clk_from_dt = mt8173_parse_clk_from_dt,
> > > + .clk_config = mt8173_clk_config,
> > > +};
> > > +
> > > +static const struct of_device_id mtk_dpi_of_ids[] = {
> > > + { .compatible = "mediatek,mt8173-dpi",
> > > + .data = &mt8173_conf,
> > > + },
> > > + {}
> > > +};
> > > +
> > > static int mtk_dpi_probe(struct platform_device *pdev)
> > > {
> > > struct device *dev = &pdev->dev;
> > > struct mtk_dpi *dpi;
> > > struct resource *mem;
> > > + struct device_node *np = dev->of_node;
> > > struct device_node *ep, *bridge_node = NULL;
> > > int comp_id;
> > > + const struct of_device_id *match;
> > > + struct mtk_dpi_conf *conf;
> > > int ret;
> > >
> > > + match = of_match_node(mtk_dpi_of_ids, dev->of_node);
> > > + if (!match)
> > > + return -ENODEV;
> > > +
> > > dpi = devm_kzalloc(dev, sizeof(*dpi), GFP_KERNEL);
> > > if (!dpi)
> > > return -ENOMEM;
> > >
> > > dpi->dev = dev;
> > > + dpi->data = (void *)match->data;
> > > + conf = (struct mtk_dpi_conf *)match->data;
> > >
> > > mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > > dpi->regs = devm_ioremap_resource(dev, mem);
> > > @@ -679,24 +777,9 @@ static int mtk_dpi_probe(struct platform_device *pdev)
> > > return ret;
> > > }
> > >
> > > - dpi->engine_clk = devm_clk_get(dev, "engine");
> > > - if (IS_ERR(dpi->engine_clk)) {
> > > - ret = PTR_ERR(dpi->engine_clk);
> > > - dev_err(dev, "Failed to get engine clock: %d\n", ret);
> > > - return ret;
> > > - }
> > > -
> > > - dpi->pixel_clk = devm_clk_get(dev, "pixel");
> > > - if (IS_ERR(dpi->pixel_clk)) {
> > > - ret = PTR_ERR(dpi->pixel_clk);
> > > - dev_err(dev, "Failed to get pixel clock: %d\n", ret);
> > > - return ret;
> > > - }
> > > -
> > > - dpi->tvd_clk = devm_clk_get(dev, "pll");
> > > - if (IS_ERR(dpi->tvd_clk)) {
> > > - ret = PTR_ERR(dpi->tvd_clk);
> > > - dev_err(dev, "Failed to get tvdpll clock: %d\n", ret);
> > > + ret = conf->parse_clk_from_dt(dpi, np);
> > > + if (ret) {
> > > + dev_err(dev, "parse tvd div clk failed!");
> > > return ret;
> > > }
> > >
> > > @@ -754,11 +837,6 @@ static int mtk_dpi_remove(struct platform_device *pdev)
> > > return 0;
> > > }
> > >
> > > -static const struct of_device_id mtk_dpi_of_ids[] = {
> > > - { .compatible = "mediatek,mt8173-dpi", },
> > > - {}
> > > -};
> > > -
> > > struct platform_driver mtk_dpi_driver = {
> > > .probe = mtk_dpi_probe,
> > > .remove = mtk_dpi_remove,
> >
> > Regards,
> > CK
> >
>
Regards,
CK
>
WARNING: multiple messages have this Message-ID (diff)
From: CK Hu <ck.hu@mediatek.com>
To: Bibby Hsieh <bibby.hsieh@mediatek.com>
Cc: David Airlie <airlied@linux.ie>,
Matthias Brugger <matthias.bgg@gmail.com>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
<dri-devel@lists.freedesktop.org>,
<linux-mediatek@lists.infradead.org>,
Yingjoe Chen <yingjoe.chen@mediatek.com>,
Cawa Cheng <cawa.cheng@mediatek.com>,
Daniel Kurtz <djkurtz@chromium.org>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
YT Shen <yt.shen@mediatek.com>,
"Thierry Reding" <thierry.reding@gmail.com>,
Mao Huang <littlecvr@chromium.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
"Sascha Hauer" <kernel@pengutronix.de>,
Junzhi Zhao <junzhi.zhao@mediatek.com>
Subject: Re: [PATCH 3/4] drm/mediatek: fix the wrong pixel clock when resolution is 4K
Date: Mon, 25 Jul 2016 14:49:35 +0800 [thread overview]
Message-ID: <1469429375.11841.69.camel@mtksdaap41> (raw)
In-Reply-To: <1469427845.26205.17.camel@mtksdaap41>
Hi, Bibby:
On Mon, 2016-07-25 at 14:24 +0800, Bibby Hsieh wrote:
> Hi, CK,
>
> Thanks for your comments.
>
> On Wed, 2016-07-20 at 15:57 +0800, CK Hu wrote:
> > Hi, Bibby:
> >
> > Some comments inline.
> >
> > On Wed, 2016-07-20 at 12:03 +0800, Bibby Hsieh wrote:
> > > From: Junzhi Zhao <junzhi.zhao@mediatek.com>
> > >
> > > Pixel clock should be 297MHz when resolution is 4K.
> > >
> > > Signed-off-by: Junzhi Zhao <junzhi.zhao@mediatek.com>
> > > Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
> > > ---
> > > drivers/gpu/drm/mediatek/mtk_dpi.c | 184 +++++++++++++++++++++++++-----------
> > > 1 file changed, 131 insertions(+), 53 deletions(-)
> > >
[snip...]
> > >
> > > +static int mt8173_parse_clk_from_dt(struct mtk_dpi *dpi, struct device_node *np)
> > > +{
> > > + int i;
> > > +
> > > + for (i = 0; i < ARRAY_SIZE(mtk_dpi_clk_names); i++) {
> > > + dpi->clk[i] = of_clk_get_by_name(np,
> > > + mtk_dpi_clk_names[i]);
> > > + if (IS_ERR(dpi->clk[i]))
> > > + return PTR_ERR(dpi->clk[i]);
> > > + }
> > > + return 0;
> > > +}
> >
> > I think parsing device tree is a pure SW behavior. Would this vary for
> > different MTK soc?
> >
> Yes
I can not imaging that, so could you give me an example source code of
other MTK soc for parse_clk_from_dt()?
> > > +
> > > +
> > > +static const struct mtk_dpi_conf mt8173_conf = {
> > > + .parse_clk_from_dt = mt8173_parse_clk_from_dt,
> > > + .clk_config = mt8173_clk_config,
> > > +};
> > > +
> > > +static const struct of_device_id mtk_dpi_of_ids[] = {
> > > + { .compatible = "mediatek,mt8173-dpi",
> > > + .data = &mt8173_conf,
> > > + },
> > > + {}
> > > +};
> > > +
> > > static int mtk_dpi_probe(struct platform_device *pdev)
> > > {
> > > struct device *dev = &pdev->dev;
> > > struct mtk_dpi *dpi;
> > > struct resource *mem;
> > > + struct device_node *np = dev->of_node;
> > > struct device_node *ep, *bridge_node = NULL;
> > > int comp_id;
> > > + const struct of_device_id *match;
> > > + struct mtk_dpi_conf *conf;
> > > int ret;
> > >
> > > + match = of_match_node(mtk_dpi_of_ids, dev->of_node);
> > > + if (!match)
> > > + return -ENODEV;
> > > +
> > > dpi = devm_kzalloc(dev, sizeof(*dpi), GFP_KERNEL);
> > > if (!dpi)
> > > return -ENOMEM;
> > >
> > > dpi->dev = dev;
> > > + dpi->data = (void *)match->data;
> > > + conf = (struct mtk_dpi_conf *)match->data;
> > >
> > > mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > > dpi->regs = devm_ioremap_resource(dev, mem);
> > > @@ -679,24 +777,9 @@ static int mtk_dpi_probe(struct platform_device *pdev)
> > > return ret;
> > > }
> > >
> > > - dpi->engine_clk = devm_clk_get(dev, "engine");
> > > - if (IS_ERR(dpi->engine_clk)) {
> > > - ret = PTR_ERR(dpi->engine_clk);
> > > - dev_err(dev, "Failed to get engine clock: %d\n", ret);
> > > - return ret;
> > > - }
> > > -
> > > - dpi->pixel_clk = devm_clk_get(dev, "pixel");
> > > - if (IS_ERR(dpi->pixel_clk)) {
> > > - ret = PTR_ERR(dpi->pixel_clk);
> > > - dev_err(dev, "Failed to get pixel clock: %d\n", ret);
> > > - return ret;
> > > - }
> > > -
> > > - dpi->tvd_clk = devm_clk_get(dev, "pll");
> > > - if (IS_ERR(dpi->tvd_clk)) {
> > > - ret = PTR_ERR(dpi->tvd_clk);
> > > - dev_err(dev, "Failed to get tvdpll clock: %d\n", ret);
> > > + ret = conf->parse_clk_from_dt(dpi, np);
> > > + if (ret) {
> > > + dev_err(dev, "parse tvd div clk failed!");
> > > return ret;
> > > }
> > >
> > > @@ -754,11 +837,6 @@ static int mtk_dpi_remove(struct platform_device *pdev)
> > > return 0;
> > > }
> > >
> > > -static const struct of_device_id mtk_dpi_of_ids[] = {
> > > - { .compatible = "mediatek,mt8173-dpi", },
> > > - {}
> > > -};
> > > -
> > > struct platform_driver mtk_dpi_driver = {
> > > .probe = mtk_dpi_probe,
> > > .remove = mtk_dpi_remove,
> >
> > Regards,
> > CK
> >
>
Regards,
CK
>
next prev parent reply other threads:[~2016-07-25 6:49 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-20 4:03 [PATCH 0/4] MT8173 HDMI 4K support Bibby Hsieh
2016-07-20 4:03 ` Bibby Hsieh
2016-07-20 4:03 ` Bibby Hsieh
2016-07-20 4:03 ` [PATCH 1/4] drm/mediatek: do mtk_hdmi_send_infoframe after HDMI clock enable Bibby Hsieh
2016-07-20 4:03 ` Bibby Hsieh
2016-07-20 4:03 ` Bibby Hsieh
[not found] ` <1468987385-37353-1-git-send-email-bibby.hsieh-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2016-07-20 4:03 ` [PATCH 2/4] drm/mediatek: enhance the HDMI driving current Bibby Hsieh
2016-07-20 4:03 ` Bibby Hsieh
2016-07-20 4:03 ` Bibby Hsieh
2016-07-20 7:15 ` CK Hu
2016-07-20 7:15 ` CK Hu
2016-07-20 7:15 ` CK Hu
2016-07-25 6:15 ` Bibby Hsieh
2016-07-25 6:15 ` Bibby Hsieh
2016-07-25 6:15 ` Bibby Hsieh
2016-07-20 4:03 ` [PATCH 3/4] drm/mediatek: fix the wrong pixel clock when resolution is 4K Bibby Hsieh
2016-07-20 4:03 ` Bibby Hsieh
2016-07-20 4:03 ` Bibby Hsieh
2016-07-20 7:57 ` CK Hu
2016-07-20 7:57 ` CK Hu
2016-07-20 7:57 ` CK Hu
2016-07-25 6:24 ` Bibby Hsieh
2016-07-25 6:24 ` Bibby Hsieh
2016-07-25 6:24 ` Bibby Hsieh
2016-07-25 6:49 ` CK Hu [this message]
2016-07-25 6:49 ` CK Hu
2016-07-25 6:49 ` CK Hu
2016-07-25 8:37 ` Bibby Hsieh
2016-07-25 8:37 ` Bibby Hsieh
2016-07-25 8:37 ` Bibby Hsieh
2016-07-20 9:41 ` Philipp Zabel
2016-07-20 9:41 ` Philipp Zabel
2016-07-20 9:41 ` Philipp Zabel
2016-07-25 6:25 ` Bibby Hsieh
2016-07-25 6:25 ` Bibby Hsieh
2016-07-25 6:25 ` Bibby Hsieh
2016-07-20 4:03 ` [PATCH 4/4] drm/mediatek: adjust VENCPLL clock for 4K HDMI output Bibby Hsieh
2016-07-20 4:03 ` Bibby Hsieh
2016-07-20 4:03 ` Bibby Hsieh
2016-07-20 9:55 ` Philipp Zabel
2016-07-20 9:55 ` Philipp Zabel
2016-07-20 9:55 ` Philipp Zabel
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=1469429375.11841.69.camel@mtksdaap41 \
--to=ck.hu@mediatek.com \
--cc=bibby.hsieh@mediatek.com \
--cc=cawa.cheng@mediatek.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=junzhi.zhao@mediatek.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=littlecvr@chromium.org \
--cc=matthias.bgg@gmail.com \
--cc=yingjoe.chen@mediatek.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.