From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> To: Stephen Boyd <swboyd@chromium.org> Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>, Bjorn Andersson <bjorn.andersson@linaro.org>, Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>, David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: Re: [PATCH v3 2/3] drm/msm/dpu: simplify clocks handling Date: Fri, 21 Jan 2022 10:37:45 +0300 [thread overview] Message-ID: <CAA8EJprSTDhox33q0d37NQVKrkdhh+Ubq5_8wXqgstFkr_EtaQ@mail.gmail.com> (raw) In-Reply-To: <CAE-0n53=vj53a_u-5rUmrhV79_-c=F5gtjbejoVs+=PR=hc1Nw@mail.gmail.com> On Fri, 21 Jan 2022 at 07:30, Stephen Boyd <swboyd@chromium.org> wrote: > > Quoting Dmitry Baryshkov (2022-01-19 14:16:15) > > diff --git a/drivers/gpu/drm/msm/msm_io_utils.c b/drivers/gpu/drm/msm/msm_io_utils.c > > index 7b504617833a..5533c87c7158 100644 > > --- a/drivers/gpu/drm/msm/msm_io_utils.c > > +++ b/drivers/gpu/drm/msm/msm_io_utils.c > > @@ -5,6 +5,8 @@ > > * Author: Rob Clark <robdclark@gmail.com> > > */ > > > > +#include <linux/clk/clk-conf.h> > > + > > #include "msm_drv.h" > > > > /* > > @@ -47,6 +49,54 @@ struct clk *msm_clk_get(struct platform_device *pdev, const char *name) > > return clk; > > } > > > > +int msm_parse_clock(struct platform_device *pdev, struct clk_bulk_data **clocks) > > +{ > > + u32 i, rc = 0; > > + const char *clock_name; > > + struct clk_bulk_data *bulk; > > + int num_clk = 0; > > No need to assign and then reassign before testing. Same goes for 'rc'. Ack > > > + > > + if (!pdev) > > + return -EINVAL; > > + > > + num_clk = of_property_count_strings(pdev->dev.of_node, "clock-names"); > > + if (num_clk <= 0) { > > + pr_debug("clocks are not defined\n"); > > + return 0; > > + } > > + > > + bulk = devm_kcalloc(&pdev->dev, num_clk, sizeof(struct clk_bulk_data), GFP_KERNEL); > > + if (!bulk) > > + return -ENOMEM; > > + > > + for (i = 0; i < num_clk; i++) { > > + rc = of_property_read_string_index(pdev->dev.of_node, > > + "clock-names", i, > > + &clock_name); > > + if (rc) { > > + DRM_DEV_ERROR(&pdev->dev, "Failed to get clock name for %d\n", i); > > + return rc; > > + } > > + bulk[i].id = devm_kstrdup(&pdev->dev, clock_name, GFP_KERNEL); > > + } > > + > > + rc = devm_clk_bulk_get(&pdev->dev, num_clk, bulk); > > Use devm_clk_bulk_get_all()? Oh, wow. I missed this API. Then this function becomes unnecessary. > > > + if (rc) { > > + DRM_DEV_ERROR(&pdev->dev, "Failed to get clock refs %d\n", rc); > > + return rc; > > + } > > + > > + rc = of_clk_set_defaults(pdev->dev.of_node, false); > > Why is this needed? Both mdss and mdp devices use assigned-clocks properties, while not being a clock provider (or a child of it). So I assumed it should call the of_clk_set_defaults(node, false) Not to mention that this call exists in the msm_dss_parse_clock(), which is being refactored/replaced. > > > + if (rc) { > > + DRM_DEV_ERROR(&pdev->dev, "Failed to set clock defaults %d\n", rc); > > + return rc; > > + } > > + > > + *clocks = bulk; > > + > > + return num_clk; -- With best wishes Dmitry
WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> To: Stephen Boyd <swboyd@chromium.org> Cc: freedreno@lists.freedesktop.org, David Airlie <airlied@linux.ie>, linux-arm-msm@vger.kernel.org, Abhinav Kumar <quic_abhinavk@quicinc.com>, dri-devel@lists.freedesktop.org, Bjorn Andersson <bjorn.andersson@linaro.org>, Sean Paul <sean@poorly.run> Subject: Re: [PATCH v3 2/3] drm/msm/dpu: simplify clocks handling Date: Fri, 21 Jan 2022 10:37:45 +0300 [thread overview] Message-ID: <CAA8EJprSTDhox33q0d37NQVKrkdhh+Ubq5_8wXqgstFkr_EtaQ@mail.gmail.com> (raw) In-Reply-To: <CAE-0n53=vj53a_u-5rUmrhV79_-c=F5gtjbejoVs+=PR=hc1Nw@mail.gmail.com> On Fri, 21 Jan 2022 at 07:30, Stephen Boyd <swboyd@chromium.org> wrote: > > Quoting Dmitry Baryshkov (2022-01-19 14:16:15) > > diff --git a/drivers/gpu/drm/msm/msm_io_utils.c b/drivers/gpu/drm/msm/msm_io_utils.c > > index 7b504617833a..5533c87c7158 100644 > > --- a/drivers/gpu/drm/msm/msm_io_utils.c > > +++ b/drivers/gpu/drm/msm/msm_io_utils.c > > @@ -5,6 +5,8 @@ > > * Author: Rob Clark <robdclark@gmail.com> > > */ > > > > +#include <linux/clk/clk-conf.h> > > + > > #include "msm_drv.h" > > > > /* > > @@ -47,6 +49,54 @@ struct clk *msm_clk_get(struct platform_device *pdev, const char *name) > > return clk; > > } > > > > +int msm_parse_clock(struct platform_device *pdev, struct clk_bulk_data **clocks) > > +{ > > + u32 i, rc = 0; > > + const char *clock_name; > > + struct clk_bulk_data *bulk; > > + int num_clk = 0; > > No need to assign and then reassign before testing. Same goes for 'rc'. Ack > > > + > > + if (!pdev) > > + return -EINVAL; > > + > > + num_clk = of_property_count_strings(pdev->dev.of_node, "clock-names"); > > + if (num_clk <= 0) { > > + pr_debug("clocks are not defined\n"); > > + return 0; > > + } > > + > > + bulk = devm_kcalloc(&pdev->dev, num_clk, sizeof(struct clk_bulk_data), GFP_KERNEL); > > + if (!bulk) > > + return -ENOMEM; > > + > > + for (i = 0; i < num_clk; i++) { > > + rc = of_property_read_string_index(pdev->dev.of_node, > > + "clock-names", i, > > + &clock_name); > > + if (rc) { > > + DRM_DEV_ERROR(&pdev->dev, "Failed to get clock name for %d\n", i); > > + return rc; > > + } > > + bulk[i].id = devm_kstrdup(&pdev->dev, clock_name, GFP_KERNEL); > > + } > > + > > + rc = devm_clk_bulk_get(&pdev->dev, num_clk, bulk); > > Use devm_clk_bulk_get_all()? Oh, wow. I missed this API. Then this function becomes unnecessary. > > > + if (rc) { > > + DRM_DEV_ERROR(&pdev->dev, "Failed to get clock refs %d\n", rc); > > + return rc; > > + } > > + > > + rc = of_clk_set_defaults(pdev->dev.of_node, false); > > Why is this needed? Both mdss and mdp devices use assigned-clocks properties, while not being a clock provider (or a child of it). So I assumed it should call the of_clk_set_defaults(node, false) Not to mention that this call exists in the msm_dss_parse_clock(), which is being refactored/replaced. > > > + if (rc) { > > + DRM_DEV_ERROR(&pdev->dev, "Failed to set clock defaults %d\n", rc); > > + return rc; > > + } > > + > > + *clocks = bulk; > > + > > + return num_clk; -- With best wishes Dmitry
next prev parent reply other threads:[~2022-01-21 7:37 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-01-19 22:16 [PATCH v3 0/3] drm/msm: rework clock handling Dmitry Baryshkov 2022-01-19 22:16 ` Dmitry Baryshkov 2022-01-19 22:16 ` [PATCH v3 1/3] drm/msm: move utility functions from msm_drv.c Dmitry Baryshkov 2022-01-19 22:16 ` Dmitry Baryshkov 2022-01-20 2:17 ` [Freedreno] " Jessica Zhang 2022-01-20 2:17 ` Jessica Zhang 2022-01-19 22:16 ` [PATCH v3 2/3] drm/msm/dpu: simplify clocks handling Dmitry Baryshkov 2022-01-19 22:16 ` Dmitry Baryshkov 2022-01-20 2:20 ` Jessica Zhang 2022-01-20 2:20 ` Jessica Zhang 2022-01-21 4:30 ` Stephen Boyd 2022-01-21 4:30 ` Stephen Boyd 2022-01-21 7:37 ` Dmitry Baryshkov [this message] 2022-01-21 7:37 ` Dmitry Baryshkov 2022-01-21 20:44 ` Stephen Boyd 2022-01-21 20:44 ` Stephen Boyd 2022-01-24 11:15 ` Dmitry Baryshkov 2022-01-24 11:15 ` Dmitry Baryshkov 2022-01-19 22:16 ` [PATCH v3 3/3] drm/msm/dp: rewrite dss_module_power to use bulk clock functions Dmitry Baryshkov 2022-01-19 22:16 ` Dmitry Baryshkov
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=CAA8EJprSTDhox33q0d37NQVKrkdhh+Ubq5_8wXqgstFkr_EtaQ@mail.gmail.com \ --to=dmitry.baryshkov@linaro.org \ --cc=airlied@linux.ie \ --cc=bjorn.andersson@linaro.org \ --cc=daniel@ffwll.ch \ --cc=dri-devel@lists.freedesktop.org \ --cc=freedreno@lists.freedesktop.org \ --cc=linux-arm-msm@vger.kernel.org \ --cc=quic_abhinavk@quicinc.com \ --cc=robdclark@gmail.com \ --cc=sean@poorly.run \ --cc=swboyd@chromium.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: linkBe 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.