Re: [PATCH v2 09/10] drm/panthor: devfreq: add pluggable devfreq providers

Chia-I Wu
2025-09-12T22:54:02Z

On Fri, Sep 12, 2025 at 11:38 AM Nicolas Frattaroli
<nicolas.frattaroli@collabora.com> wrote:
<snipped>
> diff --git a/drivers/gpu/drm/panthor/panthor_devfreq.h b/drivers/gpu/drm/panthor/panthor_devfreq.h
> index a891cb5fdc34636444f141e10f5d45828fc35b51..94c9768d5d038c4ba8516929edb565a1f13443fb 100644
> --- a/drivers/gpu/drm/panthor/panthor_devfreq.h
> +++ b/drivers/gpu/drm/panthor/panthor_devfreq.h
> @@ -8,6 +8,7 @@
>
> struct devfreq;
> struct thermal_cooling_device;
> +struct platform_device;
>
> struct panthor_device;
>
> @@ -43,6 +44,19 @@ struct panthor_devfreq {
> spinlock_t lock;
> };
>
> +struct panthor_devfreq_provider {
> + /** @dev: device pointer to the provider device */
> + struct device *dev;
> + /**
> + * @init: the provider's init callback that allocates a
> + * &struct panthor_devfreq, adds it to panthor, and adds a devfreq
> + * device to panthor. Will be called during panthor's probe.
> + */
> + int (*init)(struct panthor_device *ptdev, struct device *dev);
> +
> + struct list_head node;
> +};
On mt8196, we have performance-domains to replace several other
properties: clocks, *-supply, power-domains, operating-points-v2.
There are also quirks, such as GPU_SHADER_PRESENT should be masked by
GF_REG_SHADER_PRESENT. It feels like that the scope of
panthor_devfreq_provider is more broader, and at least the naming is
not right.

Another issue is I am not sure if we need to expose panthor_device
internals to the provider. mtk_mfg accesses very few fields of
panthor_device. It seems we can make the two less coupled.

I might change my view as mtk_mfg evolves and requires tigher
integration with panthor. But as is, I might prefer for mtk_mfg to
live under drivers/soc/mediatek and provide a header for panthor to
use in soc-specific path.

> +
>
> int panthor_devfreq_init(struct panthor_device *ptdev);
>
> @@ -57,4 +71,6 @@ int panthor_devfreq_get_dev_status(struct device *dev,
>
> unsigned long panthor_devfreq_get_freq(struct panthor_device *ptdev);
>
> +int panthor_devfreq_register_provider(struct panthor_devfreq_provider *prov);
> +
> #endif /* __PANTHOR_DEVFREQ_H__ */
>
> --
> 2.51.0
>