linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Archit Taneja <architt@codeaurora.org>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 03/12] drm/msm/dsi: Add DSI PLL for 28nm 8960 PHY
Date: Fri, 16 Oct 2015 18:38:41 +0530	[thread overview]
Message-ID: <5620F6D9.6050305@codeaurora.org> (raw)
In-Reply-To: <20151014203520.GA4558@codeaurora.org>



On 10/15/2015 02:05 AM, Stephen Boyd wrote:
> On 10/14, Archit Taneja wrote:
>> diff --git a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_28nm_8960.c b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_28nm_8960.c
>> new file mode 100644
>> index 0000000..e71b4ee
>> --- /dev/null
>> +++ b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_28nm_8960.c
>> @@ -0,0 +1,529 @@
>> +/*
>> + * Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 and
>> + * only version 2 as published by the Free Software Foundation.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + * GNU General Public License for more details.
>> + */
>> +
>> +#include <linux/clk.h>
>
> Is this include used?

It isn't. I'll remove it.

>
>> +#include <linux/clk-provider.h>
>> +
>> +#include "dsi_pll.h"
>> +#include "dsi.xml.h"
>> +
>> +/*
> [..]
>> +
>> +#define to_pll_28nm(x)	container_of(x, struct dsi_pll_28nm, base)
>> +
>> +static bool pll_28nm_poll_for_ready(struct dsi_pll_28nm *pll_28nm,
>> +				    u32 nb_tries, u32 timeout_us)
>
> Why not use unsigned types for these counts? I don't imagine we
> care about being precisely 32 bits.

Yeah. We don't even need an unsigned type. I'll replace it with integer 
type.

>
>> +{
>> +	bool pll_locked = false;
>> +	u32 val;
>> +
> [..]
>> +	DBG("id=%d", pll_28nm->id);
>> +
>> +	/*
>> +	 * before enabling the PLL, configure the bit clock divider since we
>> +	 * don't expose it as a clock to the outside world
>> +	 * 1: read back the byte clock divider that should aready be set
>
> s/aready/already/

Thanks, I'll fix this.

>
>> +	 * 2: divide by 8 to get bit clock divider
>> +	 * 3: write it to POSTDIV1
>> +	 */
>> +	val = pll_read(base + REG_DSI_28nm_8960_PHY_PLL_CTRL_9);
>> +	byte_div = val + 1;
>> +	bit_div = byte_div / 8;
>> +
>> +	val = pll_read(base + REG_DSI_28nm_8960_PHY_PLL_CTRL_8);
> [..]
>> +
>> +static void dsi_pll_28nm_destroy(struct msm_dsi_pll *pll)
>> +{
>> +	struct dsi_pll_28nm *pll_28nm = to_pll_28nm(pll);
>> +	int i;
>> +
>> +	msm_dsi_pll_helper_unregister_clks(pll_28nm->pdev,
>> +					pll_28nm->clks, pll_28nm->num_clks);
>> +
>> +	for (i = 0; i < NUM_PROVIDED_CLKS; i++)
>> +		pll_28nm->provided_clks[i] = NULL;
>> +
>> +	pll_28nm->num_clks = 0;
>> +	pll_28nm->clk_data.clks = NULL;
>> +	pll_28nm->clk_data.clk_num = 0;
>
> Is all this really necessary?

It isn't. I copy pasted from dsi_pll_28nm.c and it had this. Will make
a patch to remove it from that file too.

>
>> +}
>> +
>> +static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm)
>> +{
>> +	char clk_name[32], parent[32], vco_name[32];
>> +	struct clk_init_data vco_init = {
>> +		.parent_names = (const char *[]){ "pxo" },
>> +		.num_parents = 1,
>> +		.name = vco_name,
>> +		.ops = &clk_ops_dsi_pll_28nm_vco,
>> +	};
>> +	struct device *dev = &pll_28nm->pdev->dev;
>> +	struct clk **clks = pll_28nm->clks;
>> +	struct clk **provided_clks = pll_28nm->provided_clks;
>> +	struct clk_bytediv *bytediv;
>> +	struct clk_init_data bytediv_init;
>
>
> 	struct clk_init_data bytediv_init = { };
>
> Just in case we add some new field there?

Will do.

>
>> +	int ret, num = 0;
>> +
>> +	DBG("%d", pll_28nm->id);
>> +
>> +	bytediv = devm_kzalloc(dev, sizeof(*bytediv), GFP_KERNEL);
>> +	if (!bytediv)
>> +		return -ENOMEM;
>> +
>> +	pll_28nm->bytediv = bytediv;
>> +
>> +	snprintf(vco_name, 32, "dsi%dvco_clk", pll_28nm->id);
>> +	pll_28nm->base.clk_hw.init = &vco_init;
>> +
>> +	clks[num++] = clk_register(dev, &pll_28nm->base.clk_hw);
>> +
>> +	/* prepare and register bytediv */
>> +	bytediv->hw.init = &bytediv_init;
>> +	bytediv->reg = pll_28nm->mmio + REG_DSI_28nm_8960_PHY_PLL_CTRL_9;
>> +
>> +	snprintf(parent, 32, "dsi%dvco_clk", pll_28nm->id);
>> +	snprintf(clk_name, 32, "dsi%dpllbyte", pll_28nm->id);
>> +
>> +	bytediv_init.name = clk_name;
>> +	bytediv_init.ops = &clk_bytediv_ops;
>> +	bytediv_init.flags = CLK_SET_RATE_PARENT;
>> +	bytediv_init.parent_names = (const char *[]) { parent };
>
> Can't we just do &parent instead of this anonymous array?

&parent doesn't make sense here. parent in this function is an array
of characters, not a pointer to a character.

I can think of only this way. We do something similar when we call
clk_register_mux() in dsi_pll_28nm.c.

Archit

>
>> +	bytediv_init.num_parents = 1;
>> +
>> +	/* DIV2 */
>

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum, hosted by The Linux Foundation
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2015-10-16 13:08 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-14 12:58 [PATCH 00/12] drm/msm/dsi: Add support for DSI on MSM8960/APQ8064 Archit Taneja
2015-10-14 12:58 ` [PATCH 01/12] drm/msm/dsi: Update generated header for 8960 Archit Taneja
2015-10-14 12:58 ` [PATCH 02/12] drm/msm/dsi: Add support for 28nm PHY on 8960 Archit Taneja
2015-10-14 12:58 ` [PATCH 03/12] drm/msm/dsi: Add DSI PLL for 28nm 8960 PHY Archit Taneja
2015-10-14 20:35   ` Stephen Boyd
2015-10-16 13:08     ` Archit Taneja [this message]
2015-10-16 18:28       ` Stephen Boyd
2015-10-14 12:58 ` [PATCH 04/12] drm/msm/dsi: Use a better way to figure out DSI version Archit Taneja
2015-10-14 12:58 ` [PATCH 05/12] drm/msm/dsi: Delay dsi_clk_init Archit Taneja
2015-10-14 12:58 ` [PATCH 06/12] drm/msm/dsi: Parse bus clocks from a list Archit Taneja
2015-10-14 12:58 ` [PATCH 07/12] drm/msm/dsi: Set up link clocks for DSIv2 Archit Taneja
2015-10-14 12:59 ` [PATCH 08/12] drm/msm/dsi: Add dsi_cfg for APQ8064 Archit Taneja
2015-10-14 12:59 ` [PATCH 09/12] drm/msm/dsi: Don't use iommu for command TX buffer for DSIv2 Archit Taneja
2015-10-14 12:59 ` [PATCH 10/12] drm/msm/dsi: SFPB: Update generated headers Archit Taneja
2015-10-14 12:59 ` [PATCH 11/12] drm/msm/dsi: Enable MMSS SPFB port via syscon Archit Taneja
2015-10-14 12:59 ` [PATCH 12/12] dt-bindings: Add DSIv2 documentation Archit Taneja
2015-11-18 10:55 ` [PATCH v2 00/10] drm/msm/dsi: Add support for DSI on MSM8960/APQ8064 Archit Taneja
2015-11-18 10:55   ` [PATCH v2 01/10] drm/msm/dsi: Add support for 28nm PHY on 8960 Archit Taneja
2015-11-18 10:55   ` [PATCH v2 02/10] drm/msm/dsi: Add DSI PLL for 28nm 8960 PHY Archit Taneja
2015-11-18 10:55   ` [PATCH v2 03/10] drm/msm/dsi: Use a better way to figure out DSI version Archit Taneja
2015-11-18 10:55   ` [PATCH v2 04/10] drm/msm/dsi: Delay dsi_clk_init Archit Taneja
2015-11-18 10:55   ` [PATCH v2 05/10] drm/msm/dsi: Parse bus clocks from a list Archit Taneja
2015-11-18 10:55   ` [PATCH v2 06/10] drm/msm/dsi: Set up link clocks for DSIv2 Archit Taneja
2015-11-18 10:55   ` [PATCH v2 07/10] drm/msm/dsi: Add dsi_cfg for APQ8064 Archit Taneja
2015-11-18 10:55   ` [PATCH v2 08/10] drm/msm/dsi: Don't use iommu for command TX buffer for DSIv2 Archit Taneja
2015-11-18 10:55   ` [PATCH v2 09/10] drm/msm/dsi: Enable MMSS SPFB port via syscon Archit Taneja
2015-11-18 10:55   ` [PATCH v2 10/10] dt-bindings: Add DSIv2 documentation Archit Taneja
2015-11-18 13:18     ` Rob Herring
2015-11-18 15:24       ` Archit Taneja
     [not found]         ` <564C981F.3040907-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-11-20 19:59           ` Rob Herring
2015-11-23  6:13             ` Archit Taneja
2015-12-02  8:20               ` Stephen Boyd
2015-12-02  8:34                 ` Stephen Boyd
2015-12-07  6:51                   ` Archit Taneja
2015-12-02  9:56                 ` Archit Taneja
2015-12-03  7:16                   ` Stephen Boyd
2015-12-03 11:11                     ` Archit Taneja
2015-12-01  9:59   ` [PATCH v3 00/12] drm/msm/dsi: Add support for DSI on MSM8960/APQ8064 Archit Taneja
2015-12-01  9:59     ` [PATCH v3 01/12] drm/msm/dsi: Don't get byte/pixel source clocks from DT Archit Taneja
2015-12-01 10:00     ` [PATCH v3 02/12] drm/msm/dsi: Add support for 28nm PHY on 8960 Archit Taneja
2015-12-01 10:00     ` [PATCH v3 03/12] drm/msm/dsi: Add DSI PLL for 28nm 8960 PHY Archit Taneja
2015-12-01 10:00     ` [PATCH v3 04/12] drm/msm/dsi: Use a better way to figure out DSI version Archit Taneja
2015-12-01 10:00     ` [PATCH v3 05/12] drm/msm/dsi: Delay dsi_clk_init Archit Taneja
2015-12-01 10:00     ` [PATCH v3 06/12] drm/msm/dsi: Parse bus clocks from a list Archit Taneja
2015-12-01 10:00     ` [PATCH v3 07/12] drm/msm/dsi: Set up link clocks for DSIv2 Archit Taneja
2015-12-01 10:00     ` [PATCH v3 08/12] drm/msm/dsi: Add dsi_cfg for APQ8064 Archit Taneja
2015-12-01 10:00     ` [PATCH v3 09/12] drm/msm/dsi: Don't use iommu for command TX buffer for DSIv2 Archit Taneja
2015-12-01 10:00     ` [PATCH v3 10/12] drm/msm/dsi: Enable MMSS SPFB port via syscon Archit Taneja
2015-12-01 10:00     ` [PATCH v3 11/12] dt-bindings: msm/dsi: Fix the order in which clocks are listed Archit Taneja
2015-12-04 14:45       ` Rob Herring
2015-12-01 10:00     ` [PATCH v3 12/12] dt-bindings: msm/dsi: Add DSIv2 documentation Archit Taneja
2015-12-04 14:46       ` Rob Herring

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=5620F6D9.6050305@codeaurora.org \
    --to=architt@codeaurora.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=sboyd@codeaurora.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 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).