From: Stephen Boyd <sboyd@codeaurora.org>
To: Eric Anholt <eric@anholt.net>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
Michael Turquette <mturquette@baylibre.com>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
dri-devel@lists.freedesktop.org,
linux-rpi-kernel@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Stephen Warren <swarren@wwwdotorg.org>,
Lee Jones <lee@kernel.org>,
bcm-kernel-feedback-list@broadcom.com, linux-clk@vger.kernel.org
Subject: Re: [PATCH 2/2] drm/vc4: Add DSI driver
Date: Fri, 27 Jan 2017 12:04:36 -0800 [thread overview]
Message-ID: <20170127200436.GI8801@codeaurora.org> (raw)
In-Reply-To: <20170124003853.16418-3-eric@anholt.net>
On 01/23, Eric Anholt wrote:
> +static int
> +vc4_dsi_init_phy_clocks(struct vc4_dsi *dsi)
> +{
> + struct device *dev = &dsi->pdev->dev;
> + const char *parent_name = __clk_get_name(dsi->pll_phy_clock);
> + static const struct {
> + const char *dsi0_name, *dsi1_name;
> + int div;
> + } phy_clocks[] = {
> + { "dsi0_byte", "dsi1_byte", 8 },
> + { "dsi0_ddr2", "dsi1_ddr2", 4 },
> + { "dsi0_ddr", "dsi1_ddr", 2 },
> + };
> + int i;
> +
> + dsi->clk_onecell.clk_num = ARRAY_SIZE(phy_clocks);
> + dsi->clk_onecell.clks = devm_kcalloc(dev,
> + dsi->clk_onecell.clk_num,
> + sizeof(*dsi->clk_onecell.clks),
> + GFP_KERNEL);
> + if (!dsi->clk_onecell.clks)
> + return -ENOMEM;
> +
> + for (i = 0; i < ARRAY_SIZE(phy_clocks); i++) {
> + struct clk_fixed_factor *fix = &dsi->phy_clocks[i];
> + struct clk_init_data init;
> + struct clk *clk;
> +
> + /* We just use core fixed factor clock ops for the PHY
> + * clocks. The clocks are actually gated by the
> + * PHY_AFEC0_DDRCLK_EN bits, which we should be
> + * setting if we use the DDR/DDR2 clocks. However,
> + * vc4_dsi_encoder_enable() is setting up both AFEC0,
> + * setting both our parent DSI PLL's rate and this
> + * clock's rate, so it knows if DDR/DDR2 are going to
> + * be used and could enable the gates itself.
> + */
> + fix->mult = 1;
> + fix->div = phy_clocks[i].div;
> + fix->hw.init = &init;
> +
> + memset(&init, 0, sizeof(init));
> + init.parent_names = &parent_name;
> + init.num_parents = 1;
> + if (dsi->port == 1)
> + init.name = phy_clocks[i].dsi1_name;
> + else
> + init.name = phy_clocks[i].dsi0_name;
> + init.ops = &clk_fixed_factor_ops;
> + init.flags = CLK_IS_BASIC;
Please don't use this flag unless you need it for something.
> +
> + clk = devm_clk_register(dev, &fix->hw);
Can you use devm_clk_hw_register() instead please?
> + if (IS_ERR(clk))
> + return PTR_ERR(clk);
> +
> + dsi->clk_onecell.clks[i] = clk;
> + }
> +
> + return of_clk_add_provider(dev->of_node,
And the of_clk_add_hw_provider() API too.
> + of_clk_src_onecell_get,
> + &dsi->clk_onecell);
> +}
> +
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
WARNING: multiple messages have this Message-ID (diff)
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] drm/vc4: Add DSI driver
Date: Fri, 27 Jan 2017 12:04:36 -0800 [thread overview]
Message-ID: <20170127200436.GI8801@codeaurora.org> (raw)
In-Reply-To: <20170124003853.16418-3-eric@anholt.net>
On 01/23, Eric Anholt wrote:
> +static int
> +vc4_dsi_init_phy_clocks(struct vc4_dsi *dsi)
> +{
> + struct device *dev = &dsi->pdev->dev;
> + const char *parent_name = __clk_get_name(dsi->pll_phy_clock);
> + static const struct {
> + const char *dsi0_name, *dsi1_name;
> + int div;
> + } phy_clocks[] = {
> + { "dsi0_byte", "dsi1_byte", 8 },
> + { "dsi0_ddr2", "dsi1_ddr2", 4 },
> + { "dsi0_ddr", "dsi1_ddr", 2 },
> + };
> + int i;
> +
> + dsi->clk_onecell.clk_num = ARRAY_SIZE(phy_clocks);
> + dsi->clk_onecell.clks = devm_kcalloc(dev,
> + dsi->clk_onecell.clk_num,
> + sizeof(*dsi->clk_onecell.clks),
> + GFP_KERNEL);
> + if (!dsi->clk_onecell.clks)
> + return -ENOMEM;
> +
> + for (i = 0; i < ARRAY_SIZE(phy_clocks); i++) {
> + struct clk_fixed_factor *fix = &dsi->phy_clocks[i];
> + struct clk_init_data init;
> + struct clk *clk;
> +
> + /* We just use core fixed factor clock ops for the PHY
> + * clocks. The clocks are actually gated by the
> + * PHY_AFEC0_DDRCLK_EN bits, which we should be
> + * setting if we use the DDR/DDR2 clocks. However,
> + * vc4_dsi_encoder_enable() is setting up both AFEC0,
> + * setting both our parent DSI PLL's rate and this
> + * clock's rate, so it knows if DDR/DDR2 are going to
> + * be used and could enable the gates itself.
> + */
> + fix->mult = 1;
> + fix->div = phy_clocks[i].div;
> + fix->hw.init = &init;
> +
> + memset(&init, 0, sizeof(init));
> + init.parent_names = &parent_name;
> + init.num_parents = 1;
> + if (dsi->port == 1)
> + init.name = phy_clocks[i].dsi1_name;
> + else
> + init.name = phy_clocks[i].dsi0_name;
> + init.ops = &clk_fixed_factor_ops;
> + init.flags = CLK_IS_BASIC;
Please don't use this flag unless you need it for something.
> +
> + clk = devm_clk_register(dev, &fix->hw);
Can you use devm_clk_hw_register() instead please?
> + if (IS_ERR(clk))
> + return PTR_ERR(clk);
> +
> + dsi->clk_onecell.clks[i] = clk;
> + }
> +
> + return of_clk_add_provider(dev->of_node,
And the of_clk_add_hw_provider() API too.
> + of_clk_src_onecell_get,
> + &dsi->clk_onecell);
> +}
> +
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd@codeaurora.org>
To: Eric Anholt <eric@anholt.net>
Cc: Mark Rutland <mark.rutland@arm.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Stephen Warren <swarren@wwwdotorg.org>,
Michael Turquette <mturquette@baylibre.com>,
Lee Jones <lee@kernel.org>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Rob Herring <robh+dt@kernel.org>,
bcm-kernel-feedback-list@broadcom.com,
linux-rpi-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/2] drm/vc4: Add DSI driver
Date: Fri, 27 Jan 2017 12:04:36 -0800 [thread overview]
Message-ID: <20170127200436.GI8801@codeaurora.org> (raw)
In-Reply-To: <20170124003853.16418-3-eric@anholt.net>
On 01/23, Eric Anholt wrote:
> +static int
> +vc4_dsi_init_phy_clocks(struct vc4_dsi *dsi)
> +{
> + struct device *dev = &dsi->pdev->dev;
> + const char *parent_name = __clk_get_name(dsi->pll_phy_clock);
> + static const struct {
> + const char *dsi0_name, *dsi1_name;
> + int div;
> + } phy_clocks[] = {
> + { "dsi0_byte", "dsi1_byte", 8 },
> + { "dsi0_ddr2", "dsi1_ddr2", 4 },
> + { "dsi0_ddr", "dsi1_ddr", 2 },
> + };
> + int i;
> +
> + dsi->clk_onecell.clk_num = ARRAY_SIZE(phy_clocks);
> + dsi->clk_onecell.clks = devm_kcalloc(dev,
> + dsi->clk_onecell.clk_num,
> + sizeof(*dsi->clk_onecell.clks),
> + GFP_KERNEL);
> + if (!dsi->clk_onecell.clks)
> + return -ENOMEM;
> +
> + for (i = 0; i < ARRAY_SIZE(phy_clocks); i++) {
> + struct clk_fixed_factor *fix = &dsi->phy_clocks[i];
> + struct clk_init_data init;
> + struct clk *clk;
> +
> + /* We just use core fixed factor clock ops for the PHY
> + * clocks. The clocks are actually gated by the
> + * PHY_AFEC0_DDRCLK_EN bits, which we should be
> + * setting if we use the DDR/DDR2 clocks. However,
> + * vc4_dsi_encoder_enable() is setting up both AFEC0,
> + * setting both our parent DSI PLL's rate and this
> + * clock's rate, so it knows if DDR/DDR2 are going to
> + * be used and could enable the gates itself.
> + */
> + fix->mult = 1;
> + fix->div = phy_clocks[i].div;
> + fix->hw.init = &init;
> +
> + memset(&init, 0, sizeof(init));
> + init.parent_names = &parent_name;
> + init.num_parents = 1;
> + if (dsi->port == 1)
> + init.name = phy_clocks[i].dsi1_name;
> + else
> + init.name = phy_clocks[i].dsi0_name;
> + init.ops = &clk_fixed_factor_ops;
> + init.flags = CLK_IS_BASIC;
Please don't use this flag unless you need it for something.
> +
> + clk = devm_clk_register(dev, &fix->hw);
Can you use devm_clk_hw_register() instead please?
> + if (IS_ERR(clk))
> + return PTR_ERR(clk);
> +
> + dsi->clk_onecell.clks[i] = clk;
> + }
> +
> + return of_clk_add_provider(dev->of_node,
And the of_clk_add_hw_provider() API too.
> + of_clk_src_onecell_get,
> + &dsi->clk_onecell);
> +}
> +
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-01-27 20:04 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-24 0:38 [PATCH 0/2] drm/vc4: DSI display output support Eric Anholt
2017-01-24 0:38 ` Eric Anholt
2017-01-24 0:38 ` Eric Anholt
2017-01-24 0:38 ` [PATCH 1/2] dt-bindings: Document the VC4 DSI module nodes Eric Anholt
2017-01-24 0:38 ` Eric Anholt
2017-01-27 22:34 ` Rob Herring
2017-01-27 22:34 ` Rob Herring
2017-01-27 22:34 ` Rob Herring
2017-01-28 2:41 ` Eric Anholt
2017-01-28 2:41 ` Eric Anholt
2017-01-28 2:41 ` Eric Anholt
2017-01-30 16:51 ` Rob Herring
2017-01-30 16:51 ` Rob Herring
2017-01-30 16:51 ` Rob Herring
2017-01-24 0:38 ` [PATCH 2/2] drm/vc4: Add DSI driver Eric Anholt
2017-01-24 0:38 ` Eric Anholt
2017-01-24 0:38 ` Eric Anholt
2017-01-27 20:04 ` Stephen Boyd [this message]
2017-01-27 20:04 ` Stephen Boyd
2017-01-27 20:04 ` Stephen Boyd
2017-01-31 19:29 ` [PATCH 2/2 v2] " Eric Anholt
2017-01-31 19:29 ` Eric Anholt
2017-01-31 19:29 ` Eric Anholt
2017-01-31 19:29 ` Eric Anholt
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=20170127200436.GI8801@codeaurora.org \
--to=sboyd@codeaurora.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=eric@anholt.net \
--cc=f.fainelli@gmail.com \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=mturquette@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=swarren@wwwdotorg.org \
/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.