Skip to content

Commit

Permalink
Merge tag 'platform-drivers-x86-v6.14-5' of git://git.kernel.org/pub/…
Browse files Browse the repository at this point in the history
…scm/linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform driver fixes from Ilpo Järvinen:
 "Fixes and new HW support.

  The diff is a bit larger than I'd prefer at this point due to
  unwinding the amd/pmf driver's error handling properly instead of
  calling a deinit function that was a can full of worms.

  Summary:

   - amd/pmf:
       - Fix error handling in amd_pmf_init_smart_pc()
       - Fix missing hidden options for Smart PC

   - surface: aggregator_registry: Add Support for Surface Pro 11"

* tag 'platform-drivers-x86-v6.14-5' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
  MAINTAINERS: Update Ike Panhc's email address
  platform/x86/amd: pmf: Fix missing hidden options for Smart PC
  platform/surface: aggregator_registry: Add Support for Surface Pro 11
  platform/x86/amd/pmf: fix cleanup in amd_pmf_init_smart_pc()
  • Loading branch information
Linus Torvalds committed Mar 14, 2025
2 parents 6efcfe1 + 03fc0a2 commit 83158b2
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 13 deletions.
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ Henrik Rydberg <rydberg@bitmath.org>
Herbert Xu <herbert@gondor.apana.org.au>
Huacai Chen <chenhuacai@kernel.org> <chenhc@lemote.com>
Huacai Chen <chenhuacai@kernel.org> <chenhuacai@loongson.cn>
Ike Panhc <ikepanhc@gmail.com> <ike.pan@canonical.com>
J. Bruce Fields <bfields@fieldses.org> <bfields@redhat.com>
J. Bruce Fields <bfields@fieldses.org> <bfields@citi.umich.edu>
Jacob Shin <Jacob.Shin@amd.com>
Expand Down
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -11141,7 +11141,7 @@ S: Maintained
F: drivers/i2c/busses/i2c-icy.c

IDEAPAD LAPTOP EXTRAS DRIVER
M: Ike Panhc <ike.pan@canonical.com>
M: Ike Panhc <ikepanhc@gmail.com>
L: platform-driver-x86@vger.kernel.org
S: Maintained
W: http://launchpad.net/ideapad-laptop
Expand Down
5 changes: 4 additions & 1 deletion drivers/platform/surface/surface_aggregator_registry.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ static const struct software_node *ssam_node_group_sp8[] = {
NULL,
};

/* Devices for Surface Pro 9 (Intel/x86) and 10 */
/* Devices for Surface Pro 9, 10 and 11 (Intel/x86) */
static const struct software_node *ssam_node_group_sp9[] = {
&ssam_node_root,
&ssam_node_hub_kip,
Expand Down Expand Up @@ -430,6 +430,9 @@ static const struct acpi_device_id ssam_platform_hub_acpi_match[] = {
/* Surface Pro 10 */
{ "MSHW0510", (unsigned long)ssam_node_group_sp9 },

/* Surface Pro 11 */
{ "MSHW0583", (unsigned long)ssam_node_group_sp9 },

/* Surface Book 2 */
{ "MSHW0107", (unsigned long)ssam_node_group_gen5 },

Expand Down
2 changes: 2 additions & 0 deletions drivers/platform/x86/amd/pmf/spc.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,14 @@ static int amd_pmf_get_slider_info(struct amd_pmf_dev *dev, struct ta_pmf_enact_

switch (dev->current_profile) {
case PLATFORM_PROFILE_PERFORMANCE:
case PLATFORM_PROFILE_BALANCED_PERFORMANCE:
val = TA_BEST_PERFORMANCE;
break;
case PLATFORM_PROFILE_BALANCED:
val = TA_BETTER_PERFORMANCE;
break;
case PLATFORM_PROFILE_LOW_POWER:
case PLATFORM_PROFILE_QUIET:
val = TA_BEST_BATTERY;
break;
default:
Expand Down
36 changes: 25 additions & 11 deletions drivers/platform/x86/amd/pmf/tee-if.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,18 +510,18 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)

ret = amd_pmf_set_dram_addr(dev, true);
if (ret)
goto error;
goto err_cancel_work;

dev->policy_base = devm_ioremap_resource(dev->dev, dev->res);
if (IS_ERR(dev->policy_base)) {
ret = PTR_ERR(dev->policy_base);
goto error;
goto err_free_dram_buf;
}

dev->policy_buf = kzalloc(dev->policy_sz, GFP_KERNEL);
if (!dev->policy_buf) {
ret = -ENOMEM;
goto error;
goto err_free_dram_buf;
}

memcpy_fromio(dev->policy_buf, dev->policy_base, dev->policy_sz);
Expand All @@ -531,13 +531,13 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
dev->prev_data = kzalloc(sizeof(*dev->prev_data), GFP_KERNEL);
if (!dev->prev_data) {
ret = -ENOMEM;
goto error;
goto err_free_policy;
}

for (i = 0; i < ARRAY_SIZE(amd_pmf_ta_uuid); i++) {
ret = amd_pmf_tee_init(dev, &amd_pmf_ta_uuid[i]);
if (ret)
return ret;
goto err_free_prev_data;

ret = amd_pmf_start_policy_engine(dev);
switch (ret) {
Expand All @@ -550,27 +550,41 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
status = false;
break;
default:
goto error;
ret = -EINVAL;
amd_pmf_tee_deinit(dev);
goto err_free_prev_data;
}

if (status)
break;
}

if (!status && !pb_side_load)
goto error;
if (!status && !pb_side_load) {
ret = -EINVAL;
goto err_free_prev_data;
}

if (pb_side_load)
amd_pmf_open_pb(dev, dev->dbgfs_dir);

ret = amd_pmf_register_input_device(dev);
if (ret)
goto error;
goto err_pmf_remove_pb;

return 0;

error:
amd_pmf_deinit_smart_pc(dev);
err_pmf_remove_pb:
if (pb_side_load && dev->esbin)
amd_pmf_remove_pb(dev);
amd_pmf_tee_deinit(dev);
err_free_prev_data:
kfree(dev->prev_data);
err_free_policy:
kfree(dev->policy_buf);
err_free_dram_buf:
kfree(dev->buf);
err_cancel_work:
cancel_delayed_work_sync(&dev->pb_work);

return ret;
}
Expand Down

0 comments on commit 83158b2

Please sign in to comment.