]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
PM / devfreq: Allow devfreq driver to add custom sysfs ABIs
authorJie Zhan <zhanjie9@hisilicon.com>
Mon, 23 Jun 2025 14:34:00 +0000 (22:34 +0800)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 14 Jul 2025 11:22:59 +0000 (20:22 +0900)
Extend the devfreq_dev_profile to allow drivers optionally create
device-specific sysfs ABIs together with other common devfreq ABIs under
the devfreq device path.

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Jie Zhan <zhanjie9@hisilicon.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Link: https://patchwork.kernel.org/project/linux-pm/patch/20250623143401.4095045-2-zhanjie9@hisilicon.com/
drivers/devfreq/devfreq.c
include/linux/devfreq.h

index c5f5960e643ba40304893ec011deb0c27e85ed9e..2e8d01d47f6996a634a8ad5ddf20c5a68d1a299d 100644 (file)
@@ -831,6 +831,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
        mutex_lock(&devfreq->lock);
        devfreq->dev.parent = dev;
        devfreq->dev.class = devfreq_class;
+       devfreq->dev.groups = profile->dev_groups;
        devfreq->dev.release = devfreq_dev_release;
        INIT_LIST_HEAD(&devfreq->node);
        devfreq->profile = profile;
index d312ffbac4dd55733203d6763b15ada90b91b872..dc1075dc344606877e3e54c4c39e2150f8b0fb37 100644 (file)
@@ -103,6 +103,8 @@ struct devfreq_dev_status {
  *
  * @is_cooling_device: A self-explanatory boolean giving the device a
  *                     cooling effect property.
+ * @dev_groups:                Optional device-specific sysfs attribute groups that to
+ *                     be attached to the devfreq device.
  */
 struct devfreq_dev_profile {
        unsigned long initial_freq;
@@ -119,6 +121,8 @@ struct devfreq_dev_profile {
        unsigned int max_state;
 
        bool is_cooling_device;
+
+       const struct attribute_group **dev_groups;
 };
 
 /**