Skip to content

Commit

Permalink
Exploration around using the properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwanders committed Dec 15, 2023
1 parent 05b8480 commit 38475da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 11 additions & 1 deletion drivers/platform/surface/surface_aggregator_registry.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ static const struct software_node ssam_node_tmp_pprof = {
.parent = &ssam_node_root,
};

static const struct property_entry ssam_node_tmp_pprof_fan_control[] = {
PROPERTY_ENTRY_BOOL("control_fan"),
{ }
};
static const struct software_node ssam_node_tmp_pprof_with_fan = {
.name = "ssam:01:03:01:00:01",
.parent = &ssam_node_root,
.properties = ssam_node_tmp_pprof_fan_control,
};

/* Fan subsystem. */
static const struct software_node ssam_node_fan = {
.name = "ssam:01:05:01:01:00",
Expand Down Expand Up @@ -324,7 +334,7 @@ static const struct software_node *ssam_node_group_sp9[] = {
&ssam_node_hub_kip,
&ssam_node_bat_ac,
&ssam_node_bat_main,
&ssam_node_tmp_pprof,
&ssam_node_tmp_pprof_with_fan,
&ssam_node_fan,
&ssam_node_pos_tablet_switch,
&ssam_node_hid_kip_keyboard,
Expand Down
4 changes: 4 additions & 0 deletions drivers/platform/surface/surface_platform_profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ static int ssam_platform_profile_set(struct platform_profile_handler *pprof,
static int surface_platform_profile_probe(struct ssam_device *sdev)
{
struct ssam_tmp_profile_device *tpd;
bool fan_profile;

tpd = devm_kzalloc(&sdev->dev, sizeof(*tpd), GFP_KERNEL);
if (!tpd)
Expand All @@ -154,6 +155,9 @@ static int surface_platform_profile_probe(struct ssam_device *sdev)
tpd->handler.profile_get = ssam_platform_profile_get;
tpd->handler.profile_set = ssam_platform_profile_set;

fan_profile = fwnode_property_read_bool(sdev->dev.fwnode, "control_fan");
printk(KERN_INFO "Message: %d\n", fan_profile);

set_bit(PLATFORM_PROFILE_LOW_POWER, tpd->handler.choices);
set_bit(PLATFORM_PROFILE_BALANCED, tpd->handler.choices);
set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, tpd->handler.choices);
Expand Down

0 comments on commit 38475da

Please sign in to comment.