* [PATCH RFT v1 0/3] devfreq fixes for panfrost @ 2020-01-07 23:06 ` Martin Blumenstingl 0 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-07 23:06 UTC (permalink / raw) To: dri-devel, alyssa, steven.price, tomeu.vizoso, robh Cc: linux-kernel, daniel, airlied, robin.murphy, linux-amlogic, linux-rockchip, Martin Blumenstingl These are a bunch of devfreq fixes for panfrost that came up in a discussion with Robin Murphy during the code-review of the lima devfreq patches: [0] I am only able to test patch #1 properly because the only boards with panfrost GPU that I have are using an Amlogic SoC. We don't have support for the OPP tables or dynamic clock changes there yet. So patches #2 and #3 are compile-tested only. [0] https://patchwork.freedesktop.org/patch/346898/ Martin Blumenstingl (3): drm/panfrost: enable devfreq based the "operating-points-v2" property drm/panfrost: call dev_pm_opp_of_remove_table() in all error-paths drm/panfrost: Use the mali-supply regulator for control again drivers/gpu/drm/panfrost/panfrost_devfreq.c | 33 ++++++++++++++++++--- drivers/gpu/drm/panfrost/panfrost_device.h | 1 + 2 files changed, 30 insertions(+), 4 deletions(-) -- 2.24.1 ^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH RFT v1 0/3] devfreq fixes for panfrost @ 2020-01-07 23:06 ` Martin Blumenstingl 0 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-07 23:06 UTC (permalink / raw) To: dri-devel, alyssa, steven.price, tomeu.vizoso, robh Cc: airlied, linux-kernel, Martin Blumenstingl, linux-rockchip, daniel, linux-amlogic, robin.murphy These are a bunch of devfreq fixes for panfrost that came up in a discussion with Robin Murphy during the code-review of the lima devfreq patches: [0] I am only able to test patch #1 properly because the only boards with panfrost GPU that I have are using an Amlogic SoC. We don't have support for the OPP tables or dynamic clock changes there yet. So patches #2 and #3 are compile-tested only. [0] https://patchwork.freedesktop.org/patch/346898/ Martin Blumenstingl (3): drm/panfrost: enable devfreq based the "operating-points-v2" property drm/panfrost: call dev_pm_opp_of_remove_table() in all error-paths drm/panfrost: Use the mali-supply regulator for control again drivers/gpu/drm/panfrost/panfrost_devfreq.c | 33 ++++++++++++++++++--- drivers/gpu/drm/panfrost/panfrost_device.h | 1 + 2 files changed, 30 insertions(+), 4 deletions(-) -- 2.24.1 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic ^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH RFT v1 0/3] devfreq fixes for panfrost @ 2020-01-07 23:06 ` Martin Blumenstingl 0 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-07 23:06 UTC (permalink / raw) To: dri-devel, alyssa, steven.price, tomeu.vizoso, robh Cc: airlied, linux-kernel, Martin Blumenstingl, linux-rockchip, linux-amlogic, robin.murphy These are a bunch of devfreq fixes for panfrost that came up in a discussion with Robin Murphy during the code-review of the lima devfreq patches: [0] I am only able to test patch #1 properly because the only boards with panfrost GPU that I have are using an Amlogic SoC. We don't have support for the OPP tables or dynamic clock changes there yet. So patches #2 and #3 are compile-tested only. [0] https://patchwork.freedesktop.org/patch/346898/ Martin Blumenstingl (3): drm/panfrost: enable devfreq based the "operating-points-v2" property drm/panfrost: call dev_pm_opp_of_remove_table() in all error-paths drm/panfrost: Use the mali-supply regulator for control again drivers/gpu/drm/panfrost/panfrost_devfreq.c | 33 ++++++++++++++++++--- drivers/gpu/drm/panfrost/panfrost_device.h | 1 + 2 files changed, 30 insertions(+), 4 deletions(-) -- 2.24.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH RFT v1 1/3] drm/panfrost: enable devfreq based the "operating-points-v2" property 2020-01-07 23:06 ` Martin Blumenstingl (?) @ 2020-01-07 23:06 ` Martin Blumenstingl -1 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-07 23:06 UTC (permalink / raw) To: dri-devel, alyssa, steven.price, tomeu.vizoso, robh Cc: linux-kernel, daniel, airlied, robin.murphy, linux-amlogic, linux-rockchip, Martin Blumenstingl Decouple the check to see whether we want to enable devfreq for the GPU from dev_pm_opp_set_regulators(). This is preparation work for adding back support for regulator control (which means we need to call dev_pm_opp_set_regulators() before dev_pm_opp_of_add_table(), which means having a check for "is devfreq enabled" that is not tied to dev_pm_opp_of_add_table() makes things easier). Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 413987038fbf..1471588763ce 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -5,6 +5,7 @@ #include <linux/platform_device.h> #include <linux/pm_opp.h> #include <linux/clk.h> +#include <linux/property.h> #include <linux/regulator/consumer.h> #include "panfrost_device.h" @@ -79,10 +80,12 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) struct devfreq *devfreq; struct thermal_cooling_device *cooling; - ret = dev_pm_opp_of_add_table(dev); - if (ret == -ENODEV) /* Optional, continue without devfreq */ + if (!device_property_present(dev, "operating-points-v2")) + /* Optional, continue without devfreq */ return 0; - else if (ret) + + ret = dev_pm_opp_of_add_table(dev); + if (ret) return ret; panfrost_devfreq_reset(pfdev); -- 2.24.1 ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH RFT v1 1/3] drm/panfrost: enable devfreq based the "operating-points-v2" property @ 2020-01-07 23:06 ` Martin Blumenstingl 0 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-07 23:06 UTC (permalink / raw) To: dri-devel, alyssa, steven.price, tomeu.vizoso, robh Cc: airlied, linux-kernel, Martin Blumenstingl, linux-rockchip, daniel, linux-amlogic, robin.murphy Decouple the check to see whether we want to enable devfreq for the GPU from dev_pm_opp_set_regulators(). This is preparation work for adding back support for regulator control (which means we need to call dev_pm_opp_set_regulators() before dev_pm_opp_of_add_table(), which means having a check for "is devfreq enabled" that is not tied to dev_pm_opp_of_add_table() makes things easier). Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 413987038fbf..1471588763ce 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -5,6 +5,7 @@ #include <linux/platform_device.h> #include <linux/pm_opp.h> #include <linux/clk.h> +#include <linux/property.h> #include <linux/regulator/consumer.h> #include "panfrost_device.h" @@ -79,10 +80,12 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) struct devfreq *devfreq; struct thermal_cooling_device *cooling; - ret = dev_pm_opp_of_add_table(dev); - if (ret == -ENODEV) /* Optional, continue without devfreq */ + if (!device_property_present(dev, "operating-points-v2")) + /* Optional, continue without devfreq */ return 0; - else if (ret) + + ret = dev_pm_opp_of_add_table(dev); + if (ret) return ret; panfrost_devfreq_reset(pfdev); -- 2.24.1 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH RFT v1 1/3] drm/panfrost: enable devfreq based the "operating-points-v2" property @ 2020-01-07 23:06 ` Martin Blumenstingl 0 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-07 23:06 UTC (permalink / raw) To: dri-devel, alyssa, steven.price, tomeu.vizoso, robh Cc: airlied, linux-kernel, Martin Blumenstingl, linux-rockchip, linux-amlogic, robin.murphy Decouple the check to see whether we want to enable devfreq for the GPU from dev_pm_opp_set_regulators(). This is preparation work for adding back support for regulator control (which means we need to call dev_pm_opp_set_regulators() before dev_pm_opp_of_add_table(), which means having a check for "is devfreq enabled" that is not tied to dev_pm_opp_of_add_table() makes things easier). Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 413987038fbf..1471588763ce 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -5,6 +5,7 @@ #include <linux/platform_device.h> #include <linux/pm_opp.h> #include <linux/clk.h> +#include <linux/property.h> #include <linux/regulator/consumer.h> #include "panfrost_device.h" @@ -79,10 +80,12 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) struct devfreq *devfreq; struct thermal_cooling_device *cooling; - ret = dev_pm_opp_of_add_table(dev); - if (ret == -ENODEV) /* Optional, continue without devfreq */ + if (!device_property_present(dev, "operating-points-v2")) + /* Optional, continue without devfreq */ return 0; - else if (ret) + + ret = dev_pm_opp_of_add_table(dev); + if (ret) return ret; panfrost_devfreq_reset(pfdev); -- 2.24.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 1/3] drm/panfrost: enable devfreq based the "operating-points-v2" property 2020-01-07 23:06 ` Martin Blumenstingl (?) @ 2020-01-08 11:18 ` Robin Murphy -1 siblings, 0 replies; 37+ messages in thread From: Robin Murphy @ 2020-01-08 11:18 UTC (permalink / raw) To: Martin Blumenstingl, dri-devel, alyssa, steven.price, tomeu.vizoso, robh Cc: linux-kernel, daniel, airlied, linux-amlogic, linux-rockchip On 07/01/2020 11:06 pm, Martin Blumenstingl wrote: > Decouple the check to see whether we want to enable devfreq for the GPU > from dev_pm_opp_set_regulators(). This is preparation work for adding > back support for regulator control (which means we need to call > dev_pm_opp_set_regulators() before dev_pm_opp_of_add_table(), which > means having a check for "is devfreq enabled" that is not tied to > dev_pm_opp_of_add_table() makes things easier). Hmm, what about cases like the SCMI DVFS protocol where the OPPs are dynamically discovered rather than statically defined in DT? Robin. > Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> > --- > drivers/gpu/drm/panfrost/panfrost_devfreq.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > index 413987038fbf..1471588763ce 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > @@ -5,6 +5,7 @@ > #include <linux/platform_device.h> > #include <linux/pm_opp.h> > #include <linux/clk.h> > +#include <linux/property.h> > #include <linux/regulator/consumer.h> > > #include "panfrost_device.h" > @@ -79,10 +80,12 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > struct devfreq *devfreq; > struct thermal_cooling_device *cooling; > > - ret = dev_pm_opp_of_add_table(dev); > - if (ret == -ENODEV) /* Optional, continue without devfreq */ > + if (!device_property_present(dev, "operating-points-v2")) > + /* Optional, continue without devfreq */ > return 0; > - else if (ret) > + > + ret = dev_pm_opp_of_add_table(dev); > + if (ret) > return ret; > > panfrost_devfreq_reset(pfdev); > ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 1/3] drm/panfrost: enable devfreq based the "operating-points-v2" property @ 2020-01-08 11:18 ` Robin Murphy 0 siblings, 0 replies; 37+ messages in thread From: Robin Murphy @ 2020-01-08 11:18 UTC (permalink / raw) To: Martin Blumenstingl, dri-devel, alyssa, steven.price, tomeu.vizoso, robh Cc: airlied, linux-amlogic, linux-kernel, daniel, linux-rockchip On 07/01/2020 11:06 pm, Martin Blumenstingl wrote: > Decouple the check to see whether we want to enable devfreq for the GPU > from dev_pm_opp_set_regulators(). This is preparation work for adding > back support for regulator control (which means we need to call > dev_pm_opp_set_regulators() before dev_pm_opp_of_add_table(), which > means having a check for "is devfreq enabled" that is not tied to > dev_pm_opp_of_add_table() makes things easier). Hmm, what about cases like the SCMI DVFS protocol where the OPPs are dynamically discovered rather than statically defined in DT? Robin. > Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> > --- > drivers/gpu/drm/panfrost/panfrost_devfreq.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > index 413987038fbf..1471588763ce 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > @@ -5,6 +5,7 @@ > #include <linux/platform_device.h> > #include <linux/pm_opp.h> > #include <linux/clk.h> > +#include <linux/property.h> > #include <linux/regulator/consumer.h> > > #include "panfrost_device.h" > @@ -79,10 +80,12 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > struct devfreq *devfreq; > struct thermal_cooling_device *cooling; > > - ret = dev_pm_opp_of_add_table(dev); > - if (ret == -ENODEV) /* Optional, continue without devfreq */ > + if (!device_property_present(dev, "operating-points-v2")) > + /* Optional, continue without devfreq */ > return 0; > - else if (ret) > + > + ret = dev_pm_opp_of_add_table(dev); > + if (ret) > return ret; > > panfrost_devfreq_reset(pfdev); > _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 1/3] drm/panfrost: enable devfreq based the "operating-points-v2" property @ 2020-01-08 11:18 ` Robin Murphy 0 siblings, 0 replies; 37+ messages in thread From: Robin Murphy @ 2020-01-08 11:18 UTC (permalink / raw) To: Martin Blumenstingl, dri-devel, alyssa, steven.price, tomeu.vizoso, robh Cc: airlied, linux-amlogic, linux-kernel, linux-rockchip On 07/01/2020 11:06 pm, Martin Blumenstingl wrote: > Decouple the check to see whether we want to enable devfreq for the GPU > from dev_pm_opp_set_regulators(). This is preparation work for adding > back support for regulator control (which means we need to call > dev_pm_opp_set_regulators() before dev_pm_opp_of_add_table(), which > means having a check for "is devfreq enabled" that is not tied to > dev_pm_opp_of_add_table() makes things easier). Hmm, what about cases like the SCMI DVFS protocol where the OPPs are dynamically discovered rather than statically defined in DT? Robin. > Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> > --- > drivers/gpu/drm/panfrost/panfrost_devfreq.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > index 413987038fbf..1471588763ce 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > @@ -5,6 +5,7 @@ > #include <linux/platform_device.h> > #include <linux/pm_opp.h> > #include <linux/clk.h> > +#include <linux/property.h> > #include <linux/regulator/consumer.h> > > #include "panfrost_device.h" > @@ -79,10 +80,12 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > struct devfreq *devfreq; > struct thermal_cooling_device *cooling; > > - ret = dev_pm_opp_of_add_table(dev); > - if (ret == -ENODEV) /* Optional, continue without devfreq */ > + if (!device_property_present(dev, "operating-points-v2")) > + /* Optional, continue without devfreq */ > return 0; > - else if (ret) > + > + ret = dev_pm_opp_of_add_table(dev); > + if (ret) > return ret; > > panfrost_devfreq_reset(pfdev); > _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 1/3] drm/panfrost: enable devfreq based the "operating-points-v2" property 2020-01-08 11:18 ` Robin Murphy (?) @ 2020-01-08 12:38 ` Martin Blumenstingl -1 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-08 12:38 UTC (permalink / raw) To: Robin Murphy Cc: dri-devel, alyssa, steven.price, tomeu.vizoso, robh, linux-kernel, daniel, airlied, linux-amlogic, linux-rockchip Hi Robin, On Wed, Jan 8, 2020 at 12:18 PM Robin Murphy <robin.murphy@arm.com> wrote: > > On 07/01/2020 11:06 pm, Martin Blumenstingl wrote: > > Decouple the check to see whether we want to enable devfreq for the GPU > > from dev_pm_opp_set_regulators(). This is preparation work for adding > > back support for regulator control (which means we need to call > > dev_pm_opp_set_regulators() before dev_pm_opp_of_add_table(), which > > means having a check for "is devfreq enabled" that is not tied to > > dev_pm_opp_of_add_table() makes things easier). > > Hmm, what about cases like the SCMI DVFS protocol where the OPPs are > dynamically discovered rather than statically defined in DT? where can I find such an example (Amlogic SoCs use SCPI instead of SCMI, so I don't think that I have any board with SCMI support) or some documentation? (I could only find SCPI clock and CPU DVFS implementations, but no generic "OPPs for any device" implementation) Martin ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 1/3] drm/panfrost: enable devfreq based the "operating-points-v2" property @ 2020-01-08 12:38 ` Martin Blumenstingl 0 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-08 12:38 UTC (permalink / raw) To: Robin Murphy Cc: robh, tomeu.vizoso, airlied, linux-kernel, dri-devel, steven.price, linux-rockchip, daniel, linux-amlogic, alyssa Hi Robin, On Wed, Jan 8, 2020 at 12:18 PM Robin Murphy <robin.murphy@arm.com> wrote: > > On 07/01/2020 11:06 pm, Martin Blumenstingl wrote: > > Decouple the check to see whether we want to enable devfreq for the GPU > > from dev_pm_opp_set_regulators(). This is preparation work for adding > > back support for regulator control (which means we need to call > > dev_pm_opp_set_regulators() before dev_pm_opp_of_add_table(), which > > means having a check for "is devfreq enabled" that is not tied to > > dev_pm_opp_of_add_table() makes things easier). > > Hmm, what about cases like the SCMI DVFS protocol where the OPPs are > dynamically discovered rather than statically defined in DT? where can I find such an example (Amlogic SoCs use SCPI instead of SCMI, so I don't think that I have any board with SCMI support) or some documentation? (I could only find SCPI clock and CPU DVFS implementations, but no generic "OPPs for any device" implementation) Martin _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 1/3] drm/panfrost: enable devfreq based the "operating-points-v2" property @ 2020-01-08 12:38 ` Martin Blumenstingl 0 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-08 12:38 UTC (permalink / raw) To: Robin Murphy Cc: tomeu.vizoso, airlied, linux-kernel, dri-devel, steven.price, linux-rockchip, linux-amlogic, alyssa Hi Robin, On Wed, Jan 8, 2020 at 12:18 PM Robin Murphy <robin.murphy@arm.com> wrote: > > On 07/01/2020 11:06 pm, Martin Blumenstingl wrote: > > Decouple the check to see whether we want to enable devfreq for the GPU > > from dev_pm_opp_set_regulators(). This is preparation work for adding > > back support for regulator control (which means we need to call > > dev_pm_opp_set_regulators() before dev_pm_opp_of_add_table(), which > > means having a check for "is devfreq enabled" that is not tied to > > dev_pm_opp_of_add_table() makes things easier). > > Hmm, what about cases like the SCMI DVFS protocol where the OPPs are > dynamically discovered rather than statically defined in DT? where can I find such an example (Amlogic SoCs use SCPI instead of SCMI, so I don't think that I have any board with SCMI support) or some documentation? (I could only find SCPI clock and CPU DVFS implementations, but no generic "OPPs for any device" implementation) Martin _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 1/3] drm/panfrost: enable devfreq based the "operating-points-v2" property 2020-01-08 12:38 ` Martin Blumenstingl (?) @ 2020-01-08 14:20 ` Robin Murphy -1 siblings, 0 replies; 37+ messages in thread From: Robin Murphy @ 2020-01-08 14:20 UTC (permalink / raw) To: Martin Blumenstingl Cc: dri-devel, alyssa, steven.price, tomeu.vizoso, robh, linux-kernel, daniel, airlied, linux-amlogic, linux-rockchip, Sudeep Holla [ +Sudeep ] On 08/01/2020 12:38 pm, Martin Blumenstingl wrote: > Hi Robin, > > On Wed, Jan 8, 2020 at 12:18 PM Robin Murphy <robin.murphy@arm.com> wrote: >> >> On 07/01/2020 11:06 pm, Martin Blumenstingl wrote: >>> Decouple the check to see whether we want to enable devfreq for the GPU >>> from dev_pm_opp_set_regulators(). This is preparation work for adding >>> back support for regulator control (which means we need to call >>> dev_pm_opp_set_regulators() before dev_pm_opp_of_add_table(), which >>> means having a check for "is devfreq enabled" that is not tied to >>> dev_pm_opp_of_add_table() makes things easier). >> >> Hmm, what about cases like the SCMI DVFS protocol where the OPPs are >> dynamically discovered rather than statically defined in DT? > where can I find such an example (Amlogic SoCs use SCPI instead of > SCMI, so I don't think that I have any board with SCMI support) or > some documentation? > (I could only find SCPI clock and CPU DVFS implementations, but no > generic "OPPs for any device" implementation) On closer inspection I think this applies to the SCPI DVFS protocol too[1]. AIUI the fact that neither is wired up to a devfreq driver yet is merely due to lack of demand and suitable systems to develop/test on so far - the panfrost devfreq code is only now looking like the first viable upstream use-case ;) Robin. [1] http://infocenter.arm.com/help/topic/com.arm.doc.dui0922g/BABFEBCD.html ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 1/3] drm/panfrost: enable devfreq based the "operating-points-v2" property @ 2020-01-08 14:20 ` Robin Murphy 0 siblings, 0 replies; 37+ messages in thread From: Robin Murphy @ 2020-01-08 14:20 UTC (permalink / raw) To: Martin Blumenstingl Cc: robh, tomeu.vizoso, airlied, linux-kernel, dri-devel, steven.price, linux-rockchip, daniel, Sudeep Holla, linux-amlogic, alyssa [ +Sudeep ] On 08/01/2020 12:38 pm, Martin Blumenstingl wrote: > Hi Robin, > > On Wed, Jan 8, 2020 at 12:18 PM Robin Murphy <robin.murphy@arm.com> wrote: >> >> On 07/01/2020 11:06 pm, Martin Blumenstingl wrote: >>> Decouple the check to see whether we want to enable devfreq for the GPU >>> from dev_pm_opp_set_regulators(). This is preparation work for adding >>> back support for regulator control (which means we need to call >>> dev_pm_opp_set_regulators() before dev_pm_opp_of_add_table(), which >>> means having a check for "is devfreq enabled" that is not tied to >>> dev_pm_opp_of_add_table() makes things easier). >> >> Hmm, what about cases like the SCMI DVFS protocol where the OPPs are >> dynamically discovered rather than statically defined in DT? > where can I find such an example (Amlogic SoCs use SCPI instead of > SCMI, so I don't think that I have any board with SCMI support) or > some documentation? > (I could only find SCPI clock and CPU DVFS implementations, but no > generic "OPPs for any device" implementation) On closer inspection I think this applies to the SCPI DVFS protocol too[1]. AIUI the fact that neither is wired up to a devfreq driver yet is merely due to lack of demand and suitable systems to develop/test on so far - the panfrost devfreq code is only now looking like the first viable upstream use-case ;) Robin. [1] http://infocenter.arm.com/help/topic/com.arm.doc.dui0922g/BABFEBCD.html _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 1/3] drm/panfrost: enable devfreq based the "operating-points-v2" property @ 2020-01-08 14:20 ` Robin Murphy 0 siblings, 0 replies; 37+ messages in thread From: Robin Murphy @ 2020-01-08 14:20 UTC (permalink / raw) To: Martin Blumenstingl Cc: tomeu.vizoso, airlied, linux-kernel, dri-devel, steven.price, linux-rockchip, Sudeep Holla, linux-amlogic, alyssa [ +Sudeep ] On 08/01/2020 12:38 pm, Martin Blumenstingl wrote: > Hi Robin, > > On Wed, Jan 8, 2020 at 12:18 PM Robin Murphy <robin.murphy@arm.com> wrote: >> >> On 07/01/2020 11:06 pm, Martin Blumenstingl wrote: >>> Decouple the check to see whether we want to enable devfreq for the GPU >>> from dev_pm_opp_set_regulators(). This is preparation work for adding >>> back support for regulator control (which means we need to call >>> dev_pm_opp_set_regulators() before dev_pm_opp_of_add_table(), which >>> means having a check for "is devfreq enabled" that is not tied to >>> dev_pm_opp_of_add_table() makes things easier). >> >> Hmm, what about cases like the SCMI DVFS protocol where the OPPs are >> dynamically discovered rather than statically defined in DT? > where can I find such an example (Amlogic SoCs use SCPI instead of > SCMI, so I don't think that I have any board with SCMI support) or > some documentation? > (I could only find SCPI clock and CPU DVFS implementations, but no > generic "OPPs for any device" implementation) On closer inspection I think this applies to the SCPI DVFS protocol too[1]. AIUI the fact that neither is wired up to a devfreq driver yet is merely due to lack of demand and suitable systems to develop/test on so far - the panfrost devfreq code is only now looking like the first viable upstream use-case ;) Robin. [1] http://infocenter.arm.com/help/topic/com.arm.doc.dui0922g/BABFEBCD.html _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH RFT v1 2/3] drm/panfrost: call dev_pm_opp_of_remove_table() in all error-paths 2020-01-07 23:06 ` Martin Blumenstingl (?) @ 2020-01-07 23:06 ` Martin Blumenstingl -1 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-07 23:06 UTC (permalink / raw) To: dri-devel, alyssa, steven.price, tomeu.vizoso, robh Cc: linux-kernel, daniel, airlied, robin.murphy, linux-amlogic, linux-rockchip, Martin Blumenstingl If devfreq_recommended_opp() fails we need to undo dev_pm_opp_of_add_table() by calling dev_pm_opp_of_remove_table() (just like we do it in the other error-path below). Fixes: f3ba91228e8e91 ("drm/panfrost: Add initial panfrost driver") Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 1471588763ce..170f6c8c9651 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -93,8 +93,10 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) cur_freq = clk_get_rate(pfdev->clock); opp = devfreq_recommended_opp(dev, &cur_freq, 0); - if (IS_ERR(opp)) + if (IS_ERR(opp)) { + dev_pm_opp_of_remove_table(dev); return PTR_ERR(opp); + } panfrost_devfreq_profile.initial_freq = cur_freq; dev_pm_opp_put(opp); -- 2.24.1 ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH RFT v1 2/3] drm/panfrost: call dev_pm_opp_of_remove_table() in all error-paths @ 2020-01-07 23:06 ` Martin Blumenstingl 0 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-07 23:06 UTC (permalink / raw) To: dri-devel, alyssa, steven.price, tomeu.vizoso, robh Cc: airlied, linux-kernel, Martin Blumenstingl, linux-rockchip, daniel, linux-amlogic, robin.murphy If devfreq_recommended_opp() fails we need to undo dev_pm_opp_of_add_table() by calling dev_pm_opp_of_remove_table() (just like we do it in the other error-path below). Fixes: f3ba91228e8e91 ("drm/panfrost: Add initial panfrost driver") Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 1471588763ce..170f6c8c9651 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -93,8 +93,10 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) cur_freq = clk_get_rate(pfdev->clock); opp = devfreq_recommended_opp(dev, &cur_freq, 0); - if (IS_ERR(opp)) + if (IS_ERR(opp)) { + dev_pm_opp_of_remove_table(dev); return PTR_ERR(opp); + } panfrost_devfreq_profile.initial_freq = cur_freq; dev_pm_opp_put(opp); -- 2.24.1 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH RFT v1 2/3] drm/panfrost: call dev_pm_opp_of_remove_table() in all error-paths @ 2020-01-07 23:06 ` Martin Blumenstingl 0 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-07 23:06 UTC (permalink / raw) To: dri-devel, alyssa, steven.price, tomeu.vizoso, robh Cc: airlied, linux-kernel, Martin Blumenstingl, linux-rockchip, linux-amlogic, robin.murphy If devfreq_recommended_opp() fails we need to undo dev_pm_opp_of_add_table() by calling dev_pm_opp_of_remove_table() (just like we do it in the other error-path below). Fixes: f3ba91228e8e91 ("drm/panfrost: Add initial panfrost driver") Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 1471588763ce..170f6c8c9651 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -93,8 +93,10 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) cur_freq = clk_get_rate(pfdev->clock); opp = devfreq_recommended_opp(dev, &cur_freq, 0); - if (IS_ERR(opp)) + if (IS_ERR(opp)) { + dev_pm_opp_of_remove_table(dev); return PTR_ERR(opp); + } panfrost_devfreq_profile.initial_freq = cur_freq; dev_pm_opp_put(opp); -- 2.24.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 2/3] drm/panfrost: call dev_pm_opp_of_remove_table() in all error-paths 2020-01-07 23:06 ` Martin Blumenstingl (?) @ 2020-01-09 11:31 ` Steven Price -1 siblings, 0 replies; 37+ messages in thread From: Steven Price @ 2020-01-09 11:31 UTC (permalink / raw) To: Martin Blumenstingl, dri-devel, alyssa, tomeu.vizoso, robh Cc: airlied, linux-kernel, linux-rockchip, linux-amlogic, robin.murphy On 07/01/2020 23:06, Martin Blumenstingl wrote: > If devfreq_recommended_opp() fails we need to undo > dev_pm_opp_of_add_table() by calling dev_pm_opp_of_remove_table() (just > like we do it in the other error-path below). > > Fixes: f3ba91228e8e91 ("drm/panfrost: Add initial panfrost driver") > Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Reviewed-by: Steven Price <steven.price@arm.com> > --- > drivers/gpu/drm/panfrost/panfrost_devfreq.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > index 1471588763ce..170f6c8c9651 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > @@ -93,8 +93,10 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > cur_freq = clk_get_rate(pfdev->clock); > > opp = devfreq_recommended_opp(dev, &cur_freq, 0); > - if (IS_ERR(opp)) > + if (IS_ERR(opp)) { > + dev_pm_opp_of_remove_table(dev); > return PTR_ERR(opp); > + } > > panfrost_devfreq_profile.initial_freq = cur_freq; > dev_pm_opp_put(opp); > ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 2/3] drm/panfrost: call dev_pm_opp_of_remove_table() in all error-paths @ 2020-01-09 11:31 ` Steven Price 0 siblings, 0 replies; 37+ messages in thread From: Steven Price @ 2020-01-09 11:31 UTC (permalink / raw) To: Martin Blumenstingl, dri-devel, alyssa, tomeu.vizoso, robh Cc: airlied, linux-rockchip, robin.murphy, linux-kernel, linux-amlogic On 07/01/2020 23:06, Martin Blumenstingl wrote: > If devfreq_recommended_opp() fails we need to undo > dev_pm_opp_of_add_table() by calling dev_pm_opp_of_remove_table() (just > like we do it in the other error-path below). > > Fixes: f3ba91228e8e91 ("drm/panfrost: Add initial panfrost driver") > Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Reviewed-by: Steven Price <steven.price@arm.com> > --- > drivers/gpu/drm/panfrost/panfrost_devfreq.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > index 1471588763ce..170f6c8c9651 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > @@ -93,8 +93,10 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > cur_freq = clk_get_rate(pfdev->clock); > > opp = devfreq_recommended_opp(dev, &cur_freq, 0); > - if (IS_ERR(opp)) > + if (IS_ERR(opp)) { > + dev_pm_opp_of_remove_table(dev); > return PTR_ERR(opp); > + } > > panfrost_devfreq_profile.initial_freq = cur_freq; > dev_pm_opp_put(opp); > _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 2/3] drm/panfrost: call dev_pm_opp_of_remove_table() in all error-paths @ 2020-01-09 11:31 ` Steven Price 0 siblings, 0 replies; 37+ messages in thread From: Steven Price @ 2020-01-09 11:31 UTC (permalink / raw) To: Martin Blumenstingl, dri-devel, alyssa, tomeu.vizoso, robh Cc: airlied, linux-rockchip, robin.murphy, linux-kernel, linux-amlogic On 07/01/2020 23:06, Martin Blumenstingl wrote: > If devfreq_recommended_opp() fails we need to undo > dev_pm_opp_of_add_table() by calling dev_pm_opp_of_remove_table() (just > like we do it in the other error-path below). > > Fixes: f3ba91228e8e91 ("drm/panfrost: Add initial panfrost driver") > Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Reviewed-by: Steven Price <steven.price@arm.com> > --- > drivers/gpu/drm/panfrost/panfrost_devfreq.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > index 1471588763ce..170f6c8c9651 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > @@ -93,8 +93,10 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > cur_freq = clk_get_rate(pfdev->clock); > > opp = devfreq_recommended_opp(dev, &cur_freq, 0); > - if (IS_ERR(opp)) > + if (IS_ERR(opp)) { > + dev_pm_opp_of_remove_table(dev); > return PTR_ERR(opp); > + } > > panfrost_devfreq_profile.initial_freq = cur_freq; > dev_pm_opp_put(opp); > _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again 2020-01-07 23:06 ` Martin Blumenstingl (?) @ 2020-01-07 23:06 ` Martin Blumenstingl -1 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-07 23:06 UTC (permalink / raw) To: dri-devel, alyssa, steven.price, tomeu.vizoso, robh Cc: linux-kernel, daniel, airlied, robin.murphy, linux-amlogic, linux-rockchip, Martin Blumenstingl dev_pm_opp_set_rate() needs a reference to the regulator which should be updated when updating the GPU frequency. The name of the regulator has to be passed at initialization-time using dev_pm_opp_set_regulators(). Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() will update the GPU regulator when updating the frequency (just like we did this manually before when we open-coded dev_pm_opp_set_rate()). Fixes: 221bc77914cbcc ("drm/panfrost: Use generic code for devfreq") Reported-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 22 ++++++++++++++++++++- drivers/gpu/drm/panfrost/panfrost_device.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 170f6c8c9651..4f7999c7b44c 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -74,6 +74,7 @@ static struct devfreq_dev_profile panfrost_devfreq_profile = { int panfrost_devfreq_init(struct panfrost_device *pfdev) { int ret; + struct opp_table *opp_table; struct dev_pm_opp *opp; unsigned long cur_freq; struct device *dev = &pfdev->pdev->dev; @@ -84,9 +85,24 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) /* Optional, continue without devfreq */ return 0; + opp_table = dev_pm_opp_set_regulators(dev, + (const char *[]){ "mali" }, + 1); + if (IS_ERR(opp_table)) { + ret = PTR_ERR(opp_table); + + /* Continue if the optional regulator is missing */ + if (ret != -ENODEV) + return ret; + } else { + pfdev->devfreq.regulators_opp_table = opp_table; + } + ret = dev_pm_opp_of_add_table(dev); - if (ret) + if (ret) { + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); return ret; + } panfrost_devfreq_reset(pfdev); @@ -95,6 +111,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) opp = devfreq_recommended_opp(dev, &cur_freq, 0); if (IS_ERR(opp)) { dev_pm_opp_of_remove_table(dev); + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); return PTR_ERR(opp); } @@ -106,6 +123,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) if (IS_ERR(devfreq)) { DRM_DEV_ERROR(dev, "Couldn't initialize GPU devfreq\n"); dev_pm_opp_of_remove_table(dev); + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); return PTR_ERR(devfreq); } pfdev->devfreq.devfreq = devfreq; @@ -124,6 +142,8 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev) if (pfdev->devfreq.cooling) devfreq_cooling_unregister(pfdev->devfreq.cooling); dev_pm_opp_of_remove_table(&pfdev->pdev->dev); + if (pfdev->devfreq.regulators_opp_table) + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); } void panfrost_devfreq_resume(struct panfrost_device *pfdev) diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h index 06713811b92c..4878b239e301 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.h +++ b/drivers/gpu/drm/panfrost/panfrost_device.h @@ -85,6 +85,7 @@ struct panfrost_device { struct { struct devfreq *devfreq; + struct opp_table *regulators_opp_table; struct thermal_cooling_device *cooling; ktime_t busy_time; ktime_t idle_time; -- 2.24.1 ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again @ 2020-01-07 23:06 ` Martin Blumenstingl 0 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-07 23:06 UTC (permalink / raw) To: dri-devel, alyssa, steven.price, tomeu.vizoso, robh Cc: airlied, linux-kernel, Martin Blumenstingl, linux-rockchip, daniel, linux-amlogic, robin.murphy dev_pm_opp_set_rate() needs a reference to the regulator which should be updated when updating the GPU frequency. The name of the regulator has to be passed at initialization-time using dev_pm_opp_set_regulators(). Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() will update the GPU regulator when updating the frequency (just like we did this manually before when we open-coded dev_pm_opp_set_rate()). Fixes: 221bc77914cbcc ("drm/panfrost: Use generic code for devfreq") Reported-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 22 ++++++++++++++++++++- drivers/gpu/drm/panfrost/panfrost_device.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 170f6c8c9651..4f7999c7b44c 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -74,6 +74,7 @@ static struct devfreq_dev_profile panfrost_devfreq_profile = { int panfrost_devfreq_init(struct panfrost_device *pfdev) { int ret; + struct opp_table *opp_table; struct dev_pm_opp *opp; unsigned long cur_freq; struct device *dev = &pfdev->pdev->dev; @@ -84,9 +85,24 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) /* Optional, continue without devfreq */ return 0; + opp_table = dev_pm_opp_set_regulators(dev, + (const char *[]){ "mali" }, + 1); + if (IS_ERR(opp_table)) { + ret = PTR_ERR(opp_table); + + /* Continue if the optional regulator is missing */ + if (ret != -ENODEV) + return ret; + } else { + pfdev->devfreq.regulators_opp_table = opp_table; + } + ret = dev_pm_opp_of_add_table(dev); - if (ret) + if (ret) { + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); return ret; + } panfrost_devfreq_reset(pfdev); @@ -95,6 +111,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) opp = devfreq_recommended_opp(dev, &cur_freq, 0); if (IS_ERR(opp)) { dev_pm_opp_of_remove_table(dev); + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); return PTR_ERR(opp); } @@ -106,6 +123,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) if (IS_ERR(devfreq)) { DRM_DEV_ERROR(dev, "Couldn't initialize GPU devfreq\n"); dev_pm_opp_of_remove_table(dev); + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); return PTR_ERR(devfreq); } pfdev->devfreq.devfreq = devfreq; @@ -124,6 +142,8 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev) if (pfdev->devfreq.cooling) devfreq_cooling_unregister(pfdev->devfreq.cooling); dev_pm_opp_of_remove_table(&pfdev->pdev->dev); + if (pfdev->devfreq.regulators_opp_table) + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); } void panfrost_devfreq_resume(struct panfrost_device *pfdev) diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h index 06713811b92c..4878b239e301 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.h +++ b/drivers/gpu/drm/panfrost/panfrost_device.h @@ -85,6 +85,7 @@ struct panfrost_device { struct { struct devfreq *devfreq; + struct opp_table *regulators_opp_table; struct thermal_cooling_device *cooling; ktime_t busy_time; ktime_t idle_time; -- 2.24.1 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again @ 2020-01-07 23:06 ` Martin Blumenstingl 0 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-07 23:06 UTC (permalink / raw) To: dri-devel, alyssa, steven.price, tomeu.vizoso, robh Cc: airlied, linux-kernel, Martin Blumenstingl, linux-rockchip, linux-amlogic, robin.murphy dev_pm_opp_set_rate() needs a reference to the regulator which should be updated when updating the GPU frequency. The name of the regulator has to be passed at initialization-time using dev_pm_opp_set_regulators(). Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() will update the GPU regulator when updating the frequency (just like we did this manually before when we open-coded dev_pm_opp_set_rate()). Fixes: 221bc77914cbcc ("drm/panfrost: Use generic code for devfreq") Reported-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 22 ++++++++++++++++++++- drivers/gpu/drm/panfrost/panfrost_device.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 170f6c8c9651..4f7999c7b44c 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -74,6 +74,7 @@ static struct devfreq_dev_profile panfrost_devfreq_profile = { int panfrost_devfreq_init(struct panfrost_device *pfdev) { int ret; + struct opp_table *opp_table; struct dev_pm_opp *opp; unsigned long cur_freq; struct device *dev = &pfdev->pdev->dev; @@ -84,9 +85,24 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) /* Optional, continue without devfreq */ return 0; + opp_table = dev_pm_opp_set_regulators(dev, + (const char *[]){ "mali" }, + 1); + if (IS_ERR(opp_table)) { + ret = PTR_ERR(opp_table); + + /* Continue if the optional regulator is missing */ + if (ret != -ENODEV) + return ret; + } else { + pfdev->devfreq.regulators_opp_table = opp_table; + } + ret = dev_pm_opp_of_add_table(dev); - if (ret) + if (ret) { + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); return ret; + } panfrost_devfreq_reset(pfdev); @@ -95,6 +111,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) opp = devfreq_recommended_opp(dev, &cur_freq, 0); if (IS_ERR(opp)) { dev_pm_opp_of_remove_table(dev); + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); return PTR_ERR(opp); } @@ -106,6 +123,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) if (IS_ERR(devfreq)) { DRM_DEV_ERROR(dev, "Couldn't initialize GPU devfreq\n"); dev_pm_opp_of_remove_table(dev); + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); return PTR_ERR(devfreq); } pfdev->devfreq.devfreq = devfreq; @@ -124,6 +142,8 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev) if (pfdev->devfreq.cooling) devfreq_cooling_unregister(pfdev->devfreq.cooling); dev_pm_opp_of_remove_table(&pfdev->pdev->dev); + if (pfdev->devfreq.regulators_opp_table) + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); } void panfrost_devfreq_resume(struct panfrost_device *pfdev) diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h index 06713811b92c..4878b239e301 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.h +++ b/drivers/gpu/drm/panfrost/panfrost_device.h @@ -85,6 +85,7 @@ struct panfrost_device { struct { struct devfreq *devfreq; + struct opp_table *regulators_opp_table; struct thermal_cooling_device *cooling; ktime_t busy_time; ktime_t idle_time; -- 2.24.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again 2020-01-07 23:06 ` Martin Blumenstingl (?) (?) @ 2020-01-09 11:31 ` Steven Price -1 siblings, 0 replies; 37+ messages in thread From: Steven Price @ 2020-01-09 11:31 UTC (permalink / raw) To: Martin Blumenstingl, dri-devel, alyssa, tomeu.vizoso, robh Cc: airlied, linux-kernel, linux-rockchip, linux-amlogic, robin.murphy On 07/01/2020 23:06, Martin Blumenstingl wrote: > dev_pm_opp_set_rate() needs a reference to the regulator which should be > updated when updating the GPU frequency. The name of the regulator has > to be passed at initialization-time using dev_pm_opp_set_regulators(). > Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() > will update the GPU regulator when updating the frequency (just like > we did this manually before when we open-coded dev_pm_opp_set_rate()). This patch causes a warning from debugfs on my firefly (RK3288) board: debugfs: Directory 'ffa30000.gpu-mali' with parent 'vdd_gpu' already present! So it looks like the regulator is being added twice - but I haven't investigated further. > Fixes: 221bc77914cbcc ("drm/panfrost: Use generic code for devfreq") > Reported-by: Robin Murphy <robin.murphy@arm.com> > Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> > --- > drivers/gpu/drm/panfrost/panfrost_devfreq.c | 22 ++++++++++++++++++++- > drivers/gpu/drm/panfrost/panfrost_device.h | 1 + > 2 files changed, 22 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > index 170f6c8c9651..4f7999c7b44c 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > @@ -74,6 +74,7 @@ static struct devfreq_dev_profile panfrost_devfreq_profile = { > int panfrost_devfreq_init(struct panfrost_device *pfdev) > { > int ret; > + struct opp_table *opp_table; > struct dev_pm_opp *opp; > unsigned long cur_freq; > struct device *dev = &pfdev->pdev->dev; > @@ -84,9 +85,24 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > /* Optional, continue without devfreq */ > return 0; > > + opp_table = dev_pm_opp_set_regulators(dev, > + (const char *[]){ "mali" }, > + 1); > + if (IS_ERR(opp_table)) { > + ret = PTR_ERR(opp_table); > + > + /* Continue if the optional regulator is missing */ > + if (ret != -ENODEV) > + return ret; > + } else { > + pfdev->devfreq.regulators_opp_table = opp_table; > + } > + > ret = dev_pm_opp_of_add_table(dev); > - if (ret) > + if (ret) { > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); If we don't have a regulator then regulators_opp_table will be NULL and sadly dev_pm_opp_put_regulators() doesn't handle a NULL argument. The same applies to the two below calls obviously. Steve > return ret; > + } > > panfrost_devfreq_reset(pfdev); > > @@ -95,6 +111,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > opp = devfreq_recommended_opp(dev, &cur_freq, 0); > if (IS_ERR(opp)) { > dev_pm_opp_of_remove_table(dev); > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > return PTR_ERR(opp); > } > > @@ -106,6 +123,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > if (IS_ERR(devfreq)) { > DRM_DEV_ERROR(dev, "Couldn't initialize GPU devfreq\n"); > dev_pm_opp_of_remove_table(dev); > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > return PTR_ERR(devfreq); > } > pfdev->devfreq.devfreq = devfreq; > @@ -124,6 +142,8 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev) > if (pfdev->devfreq.cooling) > devfreq_cooling_unregister(pfdev->devfreq.cooling); > dev_pm_opp_of_remove_table(&pfdev->pdev->dev); > + if (pfdev->devfreq.regulators_opp_table) > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > } > > void panfrost_devfreq_resume(struct panfrost_device *pfdev) > diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h > index 06713811b92c..4878b239e301 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_device.h > +++ b/drivers/gpu/drm/panfrost/panfrost_device.h > @@ -85,6 +85,7 @@ struct panfrost_device { > > struct { > struct devfreq *devfreq; > + struct opp_table *regulators_opp_table; > struct thermal_cooling_device *cooling; > ktime_t busy_time; > ktime_t idle_time; > ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again @ 2020-01-09 11:31 ` Steven Price 0 siblings, 0 replies; 37+ messages in thread From: Steven Price @ 2020-01-09 11:31 UTC (permalink / raw) To: Martin Blumenstingl, dri-devel, alyssa, tomeu.vizoso, robh Cc: airlied, linux-rockchip, robin.murphy, linux-kernel, linux-amlogic On 07/01/2020 23:06, Martin Blumenstingl wrote: > dev_pm_opp_set_rate() needs a reference to the regulator which should be > updated when updating the GPU frequency. The name of the regulator has > to be passed at initialization-time using dev_pm_opp_set_regulators(). > Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() > will update the GPU regulator when updating the frequency (just like > we did this manually before when we open-coded dev_pm_opp_set_rate()). This patch causes a warning from debugfs on my firefly (RK3288) board: debugfs: Directory 'ffa30000.gpu-mali' with parent 'vdd_gpu' already present! So it looks like the regulator is being added twice - but I haven't investigated further. > Fixes: 221bc77914cbcc ("drm/panfrost: Use generic code for devfreq") > Reported-by: Robin Murphy <robin.murphy@arm.com> > Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> > --- > drivers/gpu/drm/panfrost/panfrost_devfreq.c | 22 ++++++++++++++++++++- > drivers/gpu/drm/panfrost/panfrost_device.h | 1 + > 2 files changed, 22 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > index 170f6c8c9651..4f7999c7b44c 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > @@ -74,6 +74,7 @@ static struct devfreq_dev_profile panfrost_devfreq_profile = { > int panfrost_devfreq_init(struct panfrost_device *pfdev) > { > int ret; > + struct opp_table *opp_table; > struct dev_pm_opp *opp; > unsigned long cur_freq; > struct device *dev = &pfdev->pdev->dev; > @@ -84,9 +85,24 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > /* Optional, continue without devfreq */ > return 0; > > + opp_table = dev_pm_opp_set_regulators(dev, > + (const char *[]){ "mali" }, > + 1); > + if (IS_ERR(opp_table)) { > + ret = PTR_ERR(opp_table); > + > + /* Continue if the optional regulator is missing */ > + if (ret != -ENODEV) > + return ret; > + } else { > + pfdev->devfreq.regulators_opp_table = opp_table; > + } > + > ret = dev_pm_opp_of_add_table(dev); > - if (ret) > + if (ret) { > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); If we don't have a regulator then regulators_opp_table will be NULL and sadly dev_pm_opp_put_regulators() doesn't handle a NULL argument. The same applies to the two below calls obviously. Steve > return ret; > + } > > panfrost_devfreq_reset(pfdev); > > @@ -95,6 +111,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > opp = devfreq_recommended_opp(dev, &cur_freq, 0); > if (IS_ERR(opp)) { > dev_pm_opp_of_remove_table(dev); > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > return PTR_ERR(opp); > } > > @@ -106,6 +123,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > if (IS_ERR(devfreq)) { > DRM_DEV_ERROR(dev, "Couldn't initialize GPU devfreq\n"); > dev_pm_opp_of_remove_table(dev); > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > return PTR_ERR(devfreq); > } > pfdev->devfreq.devfreq = devfreq; > @@ -124,6 +142,8 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev) > if (pfdev->devfreq.cooling) > devfreq_cooling_unregister(pfdev->devfreq.cooling); > dev_pm_opp_of_remove_table(&pfdev->pdev->dev); > + if (pfdev->devfreq.regulators_opp_table) > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > } > > void panfrost_devfreq_resume(struct panfrost_device *pfdev) > diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h > index 06713811b92c..4878b239e301 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_device.h > +++ b/drivers/gpu/drm/panfrost/panfrost_device.h > @@ -85,6 +85,7 @@ struct panfrost_device { > > struct { > struct devfreq *devfreq; > + struct opp_table *regulators_opp_table; > struct thermal_cooling_device *cooling; > ktime_t busy_time; > ktime_t idle_time; > _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again @ 2020-01-09 11:31 ` Steven Price 0 siblings, 0 replies; 37+ messages in thread From: Steven Price @ 2020-01-09 11:31 UTC (permalink / raw) To: Martin Blumenstingl, dri-devel, alyssa, tomeu.vizoso, robh Cc: airlied, linux-rockchip, robin.murphy, linux-kernel, linux-amlogic On 07/01/2020 23:06, Martin Blumenstingl wrote: > dev_pm_opp_set_rate() needs a reference to the regulator which should be > updated when updating the GPU frequency. The name of the regulator has > to be passed at initialization-time using dev_pm_opp_set_regulators(). > Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() > will update the GPU regulator when updating the frequency (just like > we did this manually before when we open-coded dev_pm_opp_set_rate()). This patch causes a warning from debugfs on my firefly (RK3288) board: debugfs: Directory 'ffa30000.gpu-mali' with parent 'vdd_gpu' already present! So it looks like the regulator is being added twice - but I haven't investigated further. > Fixes: 221bc77914cbcc ("drm/panfrost: Use generic code for devfreq") > Reported-by: Robin Murphy <robin.murphy@arm.com> > Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> > --- > drivers/gpu/drm/panfrost/panfrost_devfreq.c | 22 ++++++++++++++++++++- > drivers/gpu/drm/panfrost/panfrost_device.h | 1 + > 2 files changed, 22 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > index 170f6c8c9651..4f7999c7b44c 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > @@ -74,6 +74,7 @@ static struct devfreq_dev_profile panfrost_devfreq_profile = { > int panfrost_devfreq_init(struct panfrost_device *pfdev) > { > int ret; > + struct opp_table *opp_table; > struct dev_pm_opp *opp; > unsigned long cur_freq; > struct device *dev = &pfdev->pdev->dev; > @@ -84,9 +85,24 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > /* Optional, continue without devfreq */ > return 0; > > + opp_table = dev_pm_opp_set_regulators(dev, > + (const char *[]){ "mali" }, > + 1); > + if (IS_ERR(opp_table)) { > + ret = PTR_ERR(opp_table); > + > + /* Continue if the optional regulator is missing */ > + if (ret != -ENODEV) > + return ret; > + } else { > + pfdev->devfreq.regulators_opp_table = opp_table; > + } > + > ret = dev_pm_opp_of_add_table(dev); > - if (ret) > + if (ret) { > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); If we don't have a regulator then regulators_opp_table will be NULL and sadly dev_pm_opp_put_regulators() doesn't handle a NULL argument. The same applies to the two below calls obviously. Steve > return ret; > + } > > panfrost_devfreq_reset(pfdev); > > @@ -95,6 +111,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > opp = devfreq_recommended_opp(dev, &cur_freq, 0); > if (IS_ERR(opp)) { > dev_pm_opp_of_remove_table(dev); > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > return PTR_ERR(opp); > } > > @@ -106,6 +123,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > if (IS_ERR(devfreq)) { > DRM_DEV_ERROR(dev, "Couldn't initialize GPU devfreq\n"); > dev_pm_opp_of_remove_table(dev); > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > return PTR_ERR(devfreq); > } > pfdev->devfreq.devfreq = devfreq; > @@ -124,6 +142,8 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev) > if (pfdev->devfreq.cooling) > devfreq_cooling_unregister(pfdev->devfreq.cooling); > dev_pm_opp_of_remove_table(&pfdev->pdev->dev); > + if (pfdev->devfreq.regulators_opp_table) > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > } > > void panfrost_devfreq_resume(struct panfrost_device *pfdev) > diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h > index 06713811b92c..4878b239e301 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_device.h > +++ b/drivers/gpu/drm/panfrost/panfrost_device.h > @@ -85,6 +85,7 @@ struct panfrost_device { > > struct { > struct devfreq *devfreq; > + struct opp_table *regulators_opp_table; > struct thermal_cooling_device *cooling; > ktime_t busy_time; > ktime_t idle_time; > _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again @ 2020-01-09 11:31 ` Steven Price 0 siblings, 0 replies; 37+ messages in thread From: Steven Price @ 2020-01-09 11:31 UTC (permalink / raw) To: Martin Blumenstingl, dri-devel, alyssa, tomeu.vizoso, robh Cc: airlied, linux-rockchip, robin.murphy, linux-kernel, linux-amlogic On 07/01/2020 23:06, Martin Blumenstingl wrote: > dev_pm_opp_set_rate() needs a reference to the regulator which should be > updated when updating the GPU frequency. The name of the regulator has > to be passed at initialization-time using dev_pm_opp_set_regulators(). > Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() > will update the GPU regulator when updating the frequency (just like > we did this manually before when we open-coded dev_pm_opp_set_rate()). This patch causes a warning from debugfs on my firefly (RK3288) board: debugfs: Directory 'ffa30000.gpu-mali' with parent 'vdd_gpu' already present! So it looks like the regulator is being added twice - but I haven't investigated further. > Fixes: 221bc77914cbcc ("drm/panfrost: Use generic code for devfreq") > Reported-by: Robin Murphy <robin.murphy@arm.com> > Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> > --- > drivers/gpu/drm/panfrost/panfrost_devfreq.c | 22 ++++++++++++++++++++- > drivers/gpu/drm/panfrost/panfrost_device.h | 1 + > 2 files changed, 22 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > index 170f6c8c9651..4f7999c7b44c 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c > +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c > @@ -74,6 +74,7 @@ static struct devfreq_dev_profile panfrost_devfreq_profile = { > int panfrost_devfreq_init(struct panfrost_device *pfdev) > { > int ret; > + struct opp_table *opp_table; > struct dev_pm_opp *opp; > unsigned long cur_freq; > struct device *dev = &pfdev->pdev->dev; > @@ -84,9 +85,24 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > /* Optional, continue without devfreq */ > return 0; > > + opp_table = dev_pm_opp_set_regulators(dev, > + (const char *[]){ "mali" }, > + 1); > + if (IS_ERR(opp_table)) { > + ret = PTR_ERR(opp_table); > + > + /* Continue if the optional regulator is missing */ > + if (ret != -ENODEV) > + return ret; > + } else { > + pfdev->devfreq.regulators_opp_table = opp_table; > + } > + > ret = dev_pm_opp_of_add_table(dev); > - if (ret) > + if (ret) { > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); If we don't have a regulator then regulators_opp_table will be NULL and sadly dev_pm_opp_put_regulators() doesn't handle a NULL argument. The same applies to the two below calls obviously. Steve > return ret; > + } > > panfrost_devfreq_reset(pfdev); > > @@ -95,6 +111,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > opp = devfreq_recommended_opp(dev, &cur_freq, 0); > if (IS_ERR(opp)) { > dev_pm_opp_of_remove_table(dev); > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > return PTR_ERR(opp); > } > > @@ -106,6 +123,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) > if (IS_ERR(devfreq)) { > DRM_DEV_ERROR(dev, "Couldn't initialize GPU devfreq\n"); > dev_pm_opp_of_remove_table(dev); > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > return PTR_ERR(devfreq); > } > pfdev->devfreq.devfreq = devfreq; > @@ -124,6 +142,8 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev) > if (pfdev->devfreq.cooling) > devfreq_cooling_unregister(pfdev->devfreq.cooling); > dev_pm_opp_of_remove_table(&pfdev->pdev->dev); > + if (pfdev->devfreq.regulators_opp_table) > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > } > > void panfrost_devfreq_resume(struct panfrost_device *pfdev) > diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h > index 06713811b92c..4878b239e301 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_device.h > +++ b/drivers/gpu/drm/panfrost/panfrost_device.h > @@ -85,6 +85,7 @@ struct panfrost_device { > > struct { > struct devfreq *devfreq; > + struct opp_table *regulators_opp_table; > struct thermal_cooling_device *cooling; > ktime_t busy_time; > ktime_t idle_time; > ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again 2020-01-09 11:31 ` Steven Price (?) @ 2020-01-09 17:27 ` Martin Blumenstingl -1 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-09 17:27 UTC (permalink / raw) To: Steven Price Cc: dri-devel, alyssa, tomeu.vizoso, robh, airlied, linux-kernel, linux-rockchip, linux-amlogic, robin.murphy On Thu, Jan 9, 2020 at 12:31 PM Steven Price <steven.price@arm.com> wrote: > > On 07/01/2020 23:06, Martin Blumenstingl wrote: > > dev_pm_opp_set_rate() needs a reference to the regulator which should be > > updated when updating the GPU frequency. The name of the regulator has > > to be passed at initialization-time using dev_pm_opp_set_regulators(). > > Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() > > will update the GPU regulator when updating the frequency (just like > > we did this manually before when we open-coded dev_pm_opp_set_rate()). > > This patch causes a warning from debugfs on my firefly (RK3288) board: > > debugfs: Directory 'ffa30000.gpu-mali' with parent 'vdd_gpu' already > present! > > So it looks like the regulator is being added twice - but I haven't > investigated further. I *think* it's because the regulator is already fetched by the panfrost driver itself to enable it (the devfreq code currently does not support enabling the regulator, it can only control the voltage) I'm not sure what to do about this though [...] > > ret = dev_pm_opp_of_add_table(dev); > > - if (ret) > > + if (ret) { > > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > > If we don't have a regulator then regulators_opp_table will be NULL and > sadly dev_pm_opp_put_regulators() doesn't handle a NULL argument. The > same applies to the two below calls obviously. good catch, thank you! are you happy with the general approach here or do you think that dev_pm_opp_set_regulators is the wrong way to go (for whatever reason)? Martin ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again @ 2020-01-09 17:27 ` Martin Blumenstingl 0 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-09 17:27 UTC (permalink / raw) To: Steven Price Cc: robh, tomeu.vizoso, airlied, linux-kernel, dri-devel, linux-rockchip, linux-amlogic, robin.murphy, alyssa On Thu, Jan 9, 2020 at 12:31 PM Steven Price <steven.price@arm.com> wrote: > > On 07/01/2020 23:06, Martin Blumenstingl wrote: > > dev_pm_opp_set_rate() needs a reference to the regulator which should be > > updated when updating the GPU frequency. The name of the regulator has > > to be passed at initialization-time using dev_pm_opp_set_regulators(). > > Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() > > will update the GPU regulator when updating the frequency (just like > > we did this manually before when we open-coded dev_pm_opp_set_rate()). > > This patch causes a warning from debugfs on my firefly (RK3288) board: > > debugfs: Directory 'ffa30000.gpu-mali' with parent 'vdd_gpu' already > present! > > So it looks like the regulator is being added twice - but I haven't > investigated further. I *think* it's because the regulator is already fetched by the panfrost driver itself to enable it (the devfreq code currently does not support enabling the regulator, it can only control the voltage) I'm not sure what to do about this though [...] > > ret = dev_pm_opp_of_add_table(dev); > > - if (ret) > > + if (ret) { > > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > > If we don't have a regulator then regulators_opp_table will be NULL and > sadly dev_pm_opp_put_regulators() doesn't handle a NULL argument. The > same applies to the two below calls obviously. good catch, thank you! are you happy with the general approach here or do you think that dev_pm_opp_set_regulators is the wrong way to go (for whatever reason)? Martin _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again @ 2020-01-09 17:27 ` Martin Blumenstingl 0 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-09 17:27 UTC (permalink / raw) To: Steven Price Cc: tomeu.vizoso, airlied, linux-kernel, dri-devel, linux-rockchip, linux-amlogic, robin.murphy, alyssa On Thu, Jan 9, 2020 at 12:31 PM Steven Price <steven.price@arm.com> wrote: > > On 07/01/2020 23:06, Martin Blumenstingl wrote: > > dev_pm_opp_set_rate() needs a reference to the regulator which should be > > updated when updating the GPU frequency. The name of the regulator has > > to be passed at initialization-time using dev_pm_opp_set_regulators(). > > Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() > > will update the GPU regulator when updating the frequency (just like > > we did this manually before when we open-coded dev_pm_opp_set_rate()). > > This patch causes a warning from debugfs on my firefly (RK3288) board: > > debugfs: Directory 'ffa30000.gpu-mali' with parent 'vdd_gpu' already > present! > > So it looks like the regulator is being added twice - but I haven't > investigated further. I *think* it's because the regulator is already fetched by the panfrost driver itself to enable it (the devfreq code currently does not support enabling the regulator, it can only control the voltage) I'm not sure what to do about this though [...] > > ret = dev_pm_opp_of_add_table(dev); > > - if (ret) > > + if (ret) { > > + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > > If we don't have a regulator then regulators_opp_table will be NULL and > sadly dev_pm_opp_put_regulators() doesn't handle a NULL argument. The > same applies to the two below calls obviously. good catch, thank you! are you happy with the general approach here or do you think that dev_pm_opp_set_regulators is the wrong way to go (for whatever reason)? Martin _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again 2020-01-09 17:27 ` Martin Blumenstingl (?) @ 2020-01-13 17:10 ` Steven Price -1 siblings, 0 replies; 37+ messages in thread From: Steven Price @ 2020-01-13 17:10 UTC (permalink / raw) To: Martin Blumenstingl Cc: tomeu.vizoso, airlied, linux-kernel, dri-devel, linux-rockchip, linux-amlogic, robin.murphy, alyssa On 09/01/2020 17:27, Martin Blumenstingl wrote: > On Thu, Jan 9, 2020 at 12:31 PM Steven Price <steven.price@arm.com> wrote: >> >> On 07/01/2020 23:06, Martin Blumenstingl wrote: >>> dev_pm_opp_set_rate() needs a reference to the regulator which should be >>> updated when updating the GPU frequency. The name of the regulator has >>> to be passed at initialization-time using dev_pm_opp_set_regulators(). >>> Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() >>> will update the GPU regulator when updating the frequency (just like >>> we did this manually before when we open-coded dev_pm_opp_set_rate()). >> >> This patch causes a warning from debugfs on my firefly (RK3288) board: >> >> debugfs: Directory 'ffa30000.gpu-mali' with parent 'vdd_gpu' already >> present! >> >> So it looks like the regulator is being added twice - but I haven't >> investigated further. > I *think* it's because the regulator is already fetched by the > panfrost driver itself to enable it > (the devfreq code currently does not support enabling the regulator, > it can only control the voltage) > > I'm not sure what to do about this though Having a little play around with this, I think you can simply remove the panfrost_regulator_init() call. This at least works for me - the call to dev_pm_opp_set_regulators() seems to set everything up. However I suspect you need to do this unconditionally even if there are no operating points defined. > [...] >>> ret = dev_pm_opp_of_add_table(dev); >>> - if (ret) >>> + if (ret) { >>> + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); >> >> If we don't have a regulator then regulators_opp_table will be NULL and >> sadly dev_pm_opp_put_regulators() doesn't handle a NULL argument. The >> same applies to the two below calls obviously. > good catch, thank you! > are you happy with the general approach here or do you think that > dev_pm_opp_set_regulators is the wrong way to go (for whatever > reason)? To be honest this is an area I still don't fully understand. There's a lot of magic helper functions and very little in the way of helpful documentation to work out which are the right ones to call. It seems reasonable to me, hopefully someone more in the know will chime in it there's something fundamentally wrong! Thanks, Steve ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again @ 2020-01-13 17:10 ` Steven Price 0 siblings, 0 replies; 37+ messages in thread From: Steven Price @ 2020-01-13 17:10 UTC (permalink / raw) To: Martin Blumenstingl Cc: tomeu.vizoso, airlied, linux-kernel, dri-devel, linux-rockchip, linux-amlogic, robin.murphy, alyssa On 09/01/2020 17:27, Martin Blumenstingl wrote: > On Thu, Jan 9, 2020 at 12:31 PM Steven Price <steven.price@arm.com> wrote: >> >> On 07/01/2020 23:06, Martin Blumenstingl wrote: >>> dev_pm_opp_set_rate() needs a reference to the regulator which should be >>> updated when updating the GPU frequency. The name of the regulator has >>> to be passed at initialization-time using dev_pm_opp_set_regulators(). >>> Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() >>> will update the GPU regulator when updating the frequency (just like >>> we did this manually before when we open-coded dev_pm_opp_set_rate()). >> >> This patch causes a warning from debugfs on my firefly (RK3288) board: >> >> debugfs: Directory 'ffa30000.gpu-mali' with parent 'vdd_gpu' already >> present! >> >> So it looks like the regulator is being added twice - but I haven't >> investigated further. > I *think* it's because the regulator is already fetched by the > panfrost driver itself to enable it > (the devfreq code currently does not support enabling the regulator, > it can only control the voltage) > > I'm not sure what to do about this though Having a little play around with this, I think you can simply remove the panfrost_regulator_init() call. This at least works for me - the call to dev_pm_opp_set_regulators() seems to set everything up. However I suspect you need to do this unconditionally even if there are no operating points defined. > [...] >>> ret = dev_pm_opp_of_add_table(dev); >>> - if (ret) >>> + if (ret) { >>> + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); >> >> If we don't have a regulator then regulators_opp_table will be NULL and >> sadly dev_pm_opp_put_regulators() doesn't handle a NULL argument. The >> same applies to the two below calls obviously. > good catch, thank you! > are you happy with the general approach here or do you think that > dev_pm_opp_set_regulators is the wrong way to go (for whatever > reason)? To be honest this is an area I still don't fully understand. There's a lot of magic helper functions and very little in the way of helpful documentation to work out which are the right ones to call. It seems reasonable to me, hopefully someone more in the know will chime in it there's something fundamentally wrong! Thanks, Steve _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again @ 2020-01-13 17:10 ` Steven Price 0 siblings, 0 replies; 37+ messages in thread From: Steven Price @ 2020-01-13 17:10 UTC (permalink / raw) To: Martin Blumenstingl Cc: tomeu.vizoso, airlied, linux-kernel, dri-devel, linux-rockchip, linux-amlogic, robin.murphy, alyssa On 09/01/2020 17:27, Martin Blumenstingl wrote: > On Thu, Jan 9, 2020 at 12:31 PM Steven Price <steven.price@arm.com> wrote: >> >> On 07/01/2020 23:06, Martin Blumenstingl wrote: >>> dev_pm_opp_set_rate() needs a reference to the regulator which should be >>> updated when updating the GPU frequency. The name of the regulator has >>> to be passed at initialization-time using dev_pm_opp_set_regulators(). >>> Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() >>> will update the GPU regulator when updating the frequency (just like >>> we did this manually before when we open-coded dev_pm_opp_set_rate()). >> >> This patch causes a warning from debugfs on my firefly (RK3288) board: >> >> debugfs: Directory 'ffa30000.gpu-mali' with parent 'vdd_gpu' already >> present! >> >> So it looks like the regulator is being added twice - but I haven't >> investigated further. > I *think* it's because the regulator is already fetched by the > panfrost driver itself to enable it > (the devfreq code currently does not support enabling the regulator, > it can only control the voltage) > > I'm not sure what to do about this though Having a little play around with this, I think you can simply remove the panfrost_regulator_init() call. This at least works for me - the call to dev_pm_opp_set_regulators() seems to set everything up. However I suspect you need to do this unconditionally even if there are no operating points defined. > [...] >>> ret = dev_pm_opp_of_add_table(dev); >>> - if (ret) >>> + if (ret) { >>> + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); >> >> If we don't have a regulator then regulators_opp_table will be NULL and >> sadly dev_pm_opp_put_regulators() doesn't handle a NULL argument. The >> same applies to the two below calls obviously. > good catch, thank you! > are you happy with the general approach here or do you think that > dev_pm_opp_set_regulators is the wrong way to go (for whatever > reason)? To be honest this is an area I still don't fully understand. There's a lot of magic helper functions and very little in the way of helpful documentation to work out which are the right ones to call. It seems reasonable to me, hopefully someone more in the know will chime in it there's something fundamentally wrong! Thanks, Steve _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again 2020-01-13 17:10 ` Steven Price (?) @ 2020-01-14 20:21 ` Martin Blumenstingl -1 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-14 20:21 UTC (permalink / raw) To: Steven Price Cc: tomeu.vizoso, airlied, linux-kernel, dri-devel, linux-rockchip, linux-amlogic, robin.murphy, alyssa Hi Steven, On Mon, Jan 13, 2020 at 6:10 PM Steven Price <steven.price@arm.com> wrote: > > On 09/01/2020 17:27, Martin Blumenstingl wrote: > > On Thu, Jan 9, 2020 at 12:31 PM Steven Price <steven.price@arm.com> wrote: > >> > >> On 07/01/2020 23:06, Martin Blumenstingl wrote: > >>> dev_pm_opp_set_rate() needs a reference to the regulator which should be > >>> updated when updating the GPU frequency. The name of the regulator has > >>> to be passed at initialization-time using dev_pm_opp_set_regulators(). > >>> Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() > >>> will update the GPU regulator when updating the frequency (just like > >>> we did this manually before when we open-coded dev_pm_opp_set_rate()). > >> > >> This patch causes a warning from debugfs on my firefly (RK3288) board: > >> > >> debugfs: Directory 'ffa30000.gpu-mali' with parent 'vdd_gpu' already > >> present! > >> > >> So it looks like the regulator is being added twice - but I haven't > >> investigated further. > > I *think* it's because the regulator is already fetched by the > > panfrost driver itself to enable it > > (the devfreq code currently does not support enabling the regulator, > > it can only control the voltage) > > > > I'm not sure what to do about this though > > Having a little play around with this, I think you can simply remove the > panfrost_regulator_init() call. This at least works for me - the call to > dev_pm_opp_set_regulators() seems to set everything up. However I > suspect you need to do this unconditionally even if there are no > operating points defined. I'm not sure if I can safely remove panfrost_regulator_init() because it calls regulator_enable() but there's no regulator_enable() equivalent in devfreq or OPP I'm not sure how this is supposed to work if someone has an idea: please let me know > > [...] > >>> ret = dev_pm_opp_of_add_table(dev); > >>> - if (ret) > >>> + if (ret) { > >>> + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > >> > >> If we don't have a regulator then regulators_opp_table will be NULL and > >> sadly dev_pm_opp_put_regulators() doesn't handle a NULL argument. The > >> same applies to the two below calls obviously. > > good catch, thank you! > > are you happy with the general approach here or do you think that > > dev_pm_opp_set_regulators is the wrong way to go (for whatever > > reason)? > > To be honest this is an area I still don't fully understand. There's a > lot of magic helper functions and very little in the way of helpful > documentation to work out which are the right ones to call. It seems > reasonable to me, hopefully someone more in the know will chime in it > there's something fundamentally wrong! OK, if you know anybody who could help then please Cc them Martin ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again @ 2020-01-14 20:21 ` Martin Blumenstingl 0 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-14 20:21 UTC (permalink / raw) To: Steven Price Cc: tomeu.vizoso, airlied, linux-kernel, dri-devel, linux-rockchip, linux-amlogic, robin.murphy, alyssa Hi Steven, On Mon, Jan 13, 2020 at 6:10 PM Steven Price <steven.price@arm.com> wrote: > > On 09/01/2020 17:27, Martin Blumenstingl wrote: > > On Thu, Jan 9, 2020 at 12:31 PM Steven Price <steven.price@arm.com> wrote: > >> > >> On 07/01/2020 23:06, Martin Blumenstingl wrote: > >>> dev_pm_opp_set_rate() needs a reference to the regulator which should be > >>> updated when updating the GPU frequency. The name of the regulator has > >>> to be passed at initialization-time using dev_pm_opp_set_regulators(). > >>> Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() > >>> will update the GPU regulator when updating the frequency (just like > >>> we did this manually before when we open-coded dev_pm_opp_set_rate()). > >> > >> This patch causes a warning from debugfs on my firefly (RK3288) board: > >> > >> debugfs: Directory 'ffa30000.gpu-mali' with parent 'vdd_gpu' already > >> present! > >> > >> So it looks like the regulator is being added twice - but I haven't > >> investigated further. > > I *think* it's because the regulator is already fetched by the > > panfrost driver itself to enable it > > (the devfreq code currently does not support enabling the regulator, > > it can only control the voltage) > > > > I'm not sure what to do about this though > > Having a little play around with this, I think you can simply remove the > panfrost_regulator_init() call. This at least works for me - the call to > dev_pm_opp_set_regulators() seems to set everything up. However I > suspect you need to do this unconditionally even if there are no > operating points defined. I'm not sure if I can safely remove panfrost_regulator_init() because it calls regulator_enable() but there's no regulator_enable() equivalent in devfreq or OPP I'm not sure how this is supposed to work if someone has an idea: please let me know > > [...] > >>> ret = dev_pm_opp_of_add_table(dev); > >>> - if (ret) > >>> + if (ret) { > >>> + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > >> > >> If we don't have a regulator then regulators_opp_table will be NULL and > >> sadly dev_pm_opp_put_regulators() doesn't handle a NULL argument. The > >> same applies to the two below calls obviously. > > good catch, thank you! > > are you happy with the general approach here or do you think that > > dev_pm_opp_set_regulators is the wrong way to go (for whatever > > reason)? > > To be honest this is an area I still don't fully understand. There's a > lot of magic helper functions and very little in the way of helpful > documentation to work out which are the right ones to call. It seems > reasonable to me, hopefully someone more in the know will chime in it > there's something fundamentally wrong! OK, if you know anybody who could help then please Cc them Martin _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again @ 2020-01-14 20:21 ` Martin Blumenstingl 0 siblings, 0 replies; 37+ messages in thread From: Martin Blumenstingl @ 2020-01-14 20:21 UTC (permalink / raw) To: Steven Price Cc: tomeu.vizoso, airlied, linux-kernel, dri-devel, linux-rockchip, linux-amlogic, robin.murphy, alyssa Hi Steven, On Mon, Jan 13, 2020 at 6:10 PM Steven Price <steven.price@arm.com> wrote: > > On 09/01/2020 17:27, Martin Blumenstingl wrote: > > On Thu, Jan 9, 2020 at 12:31 PM Steven Price <steven.price@arm.com> wrote: > >> > >> On 07/01/2020 23:06, Martin Blumenstingl wrote: > >>> dev_pm_opp_set_rate() needs a reference to the regulator which should be > >>> updated when updating the GPU frequency. The name of the regulator has > >>> to be passed at initialization-time using dev_pm_opp_set_regulators(). > >>> Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() > >>> will update the GPU regulator when updating the frequency (just like > >>> we did this manually before when we open-coded dev_pm_opp_set_rate()). > >> > >> This patch causes a warning from debugfs on my firefly (RK3288) board: > >> > >> debugfs: Directory 'ffa30000.gpu-mali' with parent 'vdd_gpu' already > >> present! > >> > >> So it looks like the regulator is being added twice - but I haven't > >> investigated further. > > I *think* it's because the regulator is already fetched by the > > panfrost driver itself to enable it > > (the devfreq code currently does not support enabling the regulator, > > it can only control the voltage) > > > > I'm not sure what to do about this though > > Having a little play around with this, I think you can simply remove the > panfrost_regulator_init() call. This at least works for me - the call to > dev_pm_opp_set_regulators() seems to set everything up. However I > suspect you need to do this unconditionally even if there are no > operating points defined. I'm not sure if I can safely remove panfrost_regulator_init() because it calls regulator_enable() but there's no regulator_enable() equivalent in devfreq or OPP I'm not sure how this is supposed to work if someone has an idea: please let me know > > [...] > >>> ret = dev_pm_opp_of_add_table(dev); > >>> - if (ret) > >>> + if (ret) { > >>> + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); > >> > >> If we don't have a regulator then regulators_opp_table will be NULL and > >> sadly dev_pm_opp_put_regulators() doesn't handle a NULL argument. The > >> same applies to the two below calls obviously. > > good catch, thank you! > > are you happy with the general approach here or do you think that > > dev_pm_opp_set_regulators is the wrong way to go (for whatever > > reason)? > > To be honest this is an area I still don't fully understand. There's a > lot of magic helper functions and very little in the way of helpful > documentation to work out which are the right ones to call. It seems > reasonable to me, hopefully someone more in the know will chime in it > there's something fundamentally wrong! OK, if you know anybody who could help then please Cc them Martin _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 37+ messages in thread
end of thread, other threads:[~2020-01-15 8:28 UTC | newest] Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-01-07 23:06 [PATCH RFT v1 0/3] devfreq fixes for panfrost Martin Blumenstingl 2020-01-07 23:06 ` Martin Blumenstingl 2020-01-07 23:06 ` Martin Blumenstingl 2020-01-07 23:06 ` [PATCH RFT v1 1/3] drm/panfrost: enable devfreq based the "operating-points-v2" property Martin Blumenstingl 2020-01-07 23:06 ` Martin Blumenstingl 2020-01-07 23:06 ` Martin Blumenstingl 2020-01-08 11:18 ` Robin Murphy 2020-01-08 11:18 ` Robin Murphy 2020-01-08 11:18 ` Robin Murphy 2020-01-08 12:38 ` Martin Blumenstingl 2020-01-08 12:38 ` Martin Blumenstingl 2020-01-08 12:38 ` Martin Blumenstingl 2020-01-08 14:20 ` Robin Murphy 2020-01-08 14:20 ` Robin Murphy 2020-01-08 14:20 ` Robin Murphy 2020-01-07 23:06 ` [PATCH RFT v1 2/3] drm/panfrost: call dev_pm_opp_of_remove_table() in all error-paths Martin Blumenstingl 2020-01-07 23:06 ` Martin Blumenstingl 2020-01-07 23:06 ` Martin Blumenstingl 2020-01-09 11:31 ` Steven Price 2020-01-09 11:31 ` Steven Price 2020-01-09 11:31 ` Steven Price 2020-01-07 23:06 ` [PATCH RFT v1 3/3] drm/panfrost: Use the mali-supply regulator for control again Martin Blumenstingl 2020-01-07 23:06 ` Martin Blumenstingl 2020-01-07 23:06 ` Martin Blumenstingl 2020-01-09 11:31 ` Steven Price 2020-01-09 11:31 ` Steven Price 2020-01-09 11:31 ` Steven Price 2020-01-09 11:31 ` Steven Price 2020-01-09 17:27 ` Martin Blumenstingl 2020-01-09 17:27 ` Martin Blumenstingl 2020-01-09 17:27 ` Martin Blumenstingl 2020-01-13 17:10 ` Steven Price 2020-01-13 17:10 ` Steven Price 2020-01-13 17:10 ` Steven Price 2020-01-14 20:21 ` Martin Blumenstingl 2020-01-14 20:21 ` Martin Blumenstingl 2020-01-14 20:21 ` Martin Blumenstingl
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.