Skip to content

Commit 45b9d1d

Browse files
jiezhan0214chanwoochoi
authored andcommitted
PM / devfreq: Allow devfreq driver to add custom sysfs ABIs
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/
1 parent c3bc361 commit 45b9d1d

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/devfreq/devfreq.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
831831
mutex_lock(&devfreq->lock);
832832
devfreq->dev.parent = dev;
833833
devfreq->dev.class = devfreq_class;
834+
devfreq->dev.groups = profile->dev_groups;
834835
devfreq->dev.release = devfreq_dev_release;
835836
INIT_LIST_HEAD(&devfreq->node);
836837
devfreq->profile = profile;

include/linux/devfreq.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ struct devfreq_dev_status {
103103
*
104104
* @is_cooling_device: A self-explanatory boolean giving the device a
105105
* cooling effect property.
106+
* @dev_groups: Optional device-specific sysfs attribute groups that to
107+
* be attached to the devfreq device.
106108
*/
107109
struct devfreq_dev_profile {
108110
unsigned long initial_freq;
@@ -119,6 +121,8 @@ struct devfreq_dev_profile {
119121
unsigned int max_state;
120122

121123
bool is_cooling_device;
124+
125+
const struct attribute_group **dev_groups;
122126
};
123127

124128
/**

0 commit comments

Comments
 (0)