Re: [PATCH 1/4] drm/msm/dsi: convert to msm_clk_get()

From: Sean Paul
Date: Tue Oct 24 2017 - 08:12:51 EST


On Tue, Oct 17, 2017 at 06:49:55AM -0400, Rob Clark wrote:
> We already have, as a result of upstreaming the gpu bindings,
> msm_clk_get() which will try to get the clock both without and with a
> "_clk" suffix. Use this in DSI code so we can drop the "_clk" suffix
> in bindings while maintaing backwards compatibility.
>
> Signed-off-by: Rob Clark <robdclark@xxxxxxxxx>

Reviewed-by: Sean Paul <seanpaul@xxxxxxxxxxxx>

> ---
> drivers/gpu/drm/msm/dsi/dsi_cfg.c | 8 ++++----
> drivers/gpu/drm/msm/dsi/dsi_host.c | 30 +++++++++++++++---------------
> drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 2 +-
> 3 files changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
> index a5d75c9b3a73..65c1dfbbe019 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
> @@ -14,7 +14,7 @@
> #include "dsi_cfg.h"
>
> static const char * const dsi_v2_bus_clk_names[] = {
> - "core_mmss_clk", "iface_clk", "bus_clk",
> + "core_mmss", "iface", "bus",
> };
>
> static const struct msm_dsi_config apq8064_dsi_cfg = {
> @@ -34,7 +34,7 @@ static const struct msm_dsi_config apq8064_dsi_cfg = {
> };
>
> static const char * const dsi_6g_bus_clk_names[] = {
> - "mdp_core_clk", "iface_clk", "bus_clk", "core_mmss_clk",
> + "mdp_core", "iface", "bus", "core_mmss",
> };
>
> static const struct msm_dsi_config msm8974_apq8084_dsi_cfg = {
> @@ -55,7 +55,7 @@ static const struct msm_dsi_config msm8974_apq8084_dsi_cfg = {
> };
>
> static const char * const dsi_8916_bus_clk_names[] = {
> - "mdp_core_clk", "iface_clk", "bus_clk",
> + "mdp_core", "iface", "bus",
> };
>
> static const struct msm_dsi_config msm8916_dsi_cfg = {
> @@ -99,7 +99,7 @@ static const struct msm_dsi_config msm8994_dsi_cfg = {
> * without it too. Figure out why it doesn't enable and uncomment below
> */
> static const char * const dsi_8996_bus_clk_names[] = {
> - "mdp_core_clk", "iface_clk", "bus_clk", /* "core_mmss_clk", */
> + "mdp_core", "iface", "bus", /* "core_mmss", */
> };
>
> static const struct msm_dsi_config msm8996_dsi_cfg = {
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index deaf869374ea..0f7324a686ca 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -334,46 +334,46 @@ static int dsi_regulator_init(struct msm_dsi_host *msm_host)
>
> static int dsi_clk_init(struct msm_dsi_host *msm_host)
> {
> - struct device *dev = &msm_host->pdev->dev;
> + struct platform_device *pdev = msm_host->pdev;
> const struct msm_dsi_cfg_handler *cfg_hnd = msm_host->cfg_hnd;
> const struct msm_dsi_config *cfg = cfg_hnd->cfg;
> int i, ret = 0;
>
> /* get bus clocks */
> for (i = 0; i < cfg->num_bus_clks; i++) {
> - msm_host->bus_clks[i] = devm_clk_get(dev,
> + msm_host->bus_clks[i] = msm_clk_get(pdev,
> cfg->bus_clk_names[i]);
> if (IS_ERR(msm_host->bus_clks[i])) {
> ret = PTR_ERR(msm_host->bus_clks[i]);
> - pr_err("%s: Unable to get %s, ret = %d\n",
> + pr_err("%s: Unable to get %s clock, ret = %d\n",
> __func__, cfg->bus_clk_names[i], ret);
> goto exit;
> }
> }
>
> /* get link and source clocks */
> - msm_host->byte_clk = devm_clk_get(dev, "byte_clk");
> + msm_host->byte_clk = msm_clk_get(pdev, "byte");
> if (IS_ERR(msm_host->byte_clk)) {
> ret = PTR_ERR(msm_host->byte_clk);
> - pr_err("%s: can't find dsi_byte_clk. ret=%d\n",
> + pr_err("%s: can't find dsi_byte clock. ret=%d\n",
> __func__, ret);
> msm_host->byte_clk = NULL;
> goto exit;
> }
>
> - msm_host->pixel_clk = devm_clk_get(dev, "pixel_clk");
> + msm_host->pixel_clk = msm_clk_get(pdev, "pixel");
> if (IS_ERR(msm_host->pixel_clk)) {
> ret = PTR_ERR(msm_host->pixel_clk);
> - pr_err("%s: can't find dsi_pixel_clk. ret=%d\n",
> + pr_err("%s: can't find dsi_pixel clock. ret=%d\n",
> __func__, ret);
> msm_host->pixel_clk = NULL;
> goto exit;
> }
>
> - msm_host->esc_clk = devm_clk_get(dev, "core_clk");
> + msm_host->esc_clk = msm_clk_get(pdev, "core");
> if (IS_ERR(msm_host->esc_clk)) {
> ret = PTR_ERR(msm_host->esc_clk);
> - pr_err("%s: can't find dsi_esc_clk. ret=%d\n",
> + pr_err("%s: can't find dsi_esc clock. ret=%d\n",
> __func__, ret);
> msm_host->esc_clk = NULL;
> goto exit;
> @@ -382,22 +382,22 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host)
> msm_host->byte_clk_src = clk_get_parent(msm_host->byte_clk);
> if (!msm_host->byte_clk_src) {
> ret = -ENODEV;
> - pr_err("%s: can't find byte_clk_src. ret=%d\n", __func__, ret);
> + pr_err("%s: can't find byte_clk clock. ret=%d\n", __func__, ret);
> goto exit;
> }
>
> msm_host->pixel_clk_src = clk_get_parent(msm_host->pixel_clk);
> if (!msm_host->pixel_clk_src) {
> ret = -ENODEV;
> - pr_err("%s: can't find pixel_clk_src. ret=%d\n", __func__, ret);
> + pr_err("%s: can't find pixel_clk clock. ret=%d\n", __func__, ret);
> goto exit;
> }
>
> if (cfg_hnd->major == MSM_DSI_VER_MAJOR_V2) {
> - msm_host->src_clk = devm_clk_get(dev, "src_clk");
> + msm_host->src_clk = msm_clk_get(pdev, "src");
> if (IS_ERR(msm_host->src_clk)) {
> ret = PTR_ERR(msm_host->src_clk);
> - pr_err("%s: can't find dsi_src_clk. ret=%d\n",
> + pr_err("%s: can't find src clock. ret=%d\n",
> __func__, ret);
> msm_host->src_clk = NULL;
> goto exit;
> @@ -406,7 +406,7 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host)
> msm_host->esc_clk_src = clk_get_parent(msm_host->esc_clk);
> if (!msm_host->esc_clk_src) {
> ret = -ENODEV;
> - pr_err("%s: can't get esc_clk_src. ret=%d\n",
> + pr_err("%s: can't get esc clock parent. ret=%d\n",
> __func__, ret);
> goto exit;
> }
> @@ -414,7 +414,7 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host)
> msm_host->dsi_clk_src = clk_get_parent(msm_host->src_clk);
> if (!msm_host->dsi_clk_src) {
> ret = -ENODEV;
> - pr_err("%s: can't get dsi_clk_src. ret=%d\n",
> + pr_err("%s: can't get src clock parent. ret=%d\n",
> __func__, ret);
> }
> }
> diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
> index 7c9bf91bc22b..790ca280cbfd 100644
> --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
> +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
> @@ -482,7 +482,7 @@ static int dsi_phy_driver_probe(struct platform_device *pdev)
> goto fail;
> }
>
> - phy->ahb_clk = devm_clk_get(dev, "iface_clk");
> + phy->ahb_clk = msm_clk_get(pdev, "iface");
> if (IS_ERR(phy->ahb_clk)) {
> dev_err(dev, "%s: Unable to get ahb clk\n", __func__);
> ret = PTR_ERR(phy->ahb_clk);
> --
> 2.13.6
>

--
Sean Paul, Software Engineer, Google / Chromium OS