Skip to content

Commit

Permalink
Prepare applesmc patches again for 6.10
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaGarg8 committed Jun 29, 2024
1 parent 677fbaf commit 6570a9c
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 66 deletions.
14 changes: 7 additions & 7 deletions 3001-applesmc-convert-static-structures-to-drvdata.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 09dd6c563cd73d72e917de07e8d59358c41e051d Mon Sep 17 00:00:00 2001
From aa8cbca2aa7fa99119fe0e7de616d5b0dcde3a15 Mon Sep 17 00:00:00 2001
From: Paul Pawlowski <[email protected]>
Date: Sun, 17 Nov 2019 23:12:55 +0100
Subject: [PATCH 1/6] applesmc: convert static structures to drvdata
Subject: [PATCH 1/9] applesmc: convert static structures to drvdata

All static data structures have been moved to an applesmc_device struct,
which is then associated with the platform device.
Expand All @@ -14,7 +14,7 @@ Signed-off-by: Aun-Ali Zaidi <[email protected]>
1 file changed, 319 insertions(+), 221 deletions(-)

diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 79b498f816fe..62211b590a61 100644
index fc6d6a905..7fb40738d 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -6,6 +6,7 @@
Expand Down Expand Up @@ -1040,7 +1040,7 @@ index 79b498f816fe..62211b590a61 100644
}

static int applesmc_dmi_match(const struct dmi_system_id *id)
@@ -1302,86 +1393,100 @@ static const struct dmi_system_id applesmc_whitelist[] __initconst = {
@@ -1306,86 +1397,100 @@ static const struct dmi_system_id applesmc_whitelist[] __initconst = {
{ .ident = NULL }
};

Expand Down Expand Up @@ -1190,7 +1190,7 @@ index 79b498f816fe..62211b590a61 100644
out_driver:
platform_driver_unregister(&applesmc_driver);
out_region:
@@ -1393,14 +1498,6 @@ static int __init applesmc_init(void)
@@ -1397,14 +1502,6 @@ static int __init applesmc_init(void)

static void __exit applesmc_exit(void)
{
Expand All @@ -1205,7 +1205,7 @@ index 79b498f816fe..62211b590a61 100644
platform_device_unregister(pdev);
platform_driver_unregister(&applesmc_driver);
release_region(APPLESMC_DATA_PORT, APPLESMC_NR_PORTS);
@@ -1410,6 +1507,7 @@ module_init(applesmc_init);
@@ -1414,6 +1511,7 @@ module_init(applesmc_init);
module_exit(applesmc_exit);

MODULE_AUTHOR("Nicolas Boichat");
Expand All @@ -1214,5 +1214,5 @@ index 79b498f816fe..62211b590a61 100644
MODULE_LICENSE("GPL v2");
MODULE_DEVICE_TABLE(dmi, applesmc_whitelist);
--
2.30.0
2.45.2

14 changes: 7 additions & 7 deletions 3002-applesmc-make-io-port-base-addr-dynamic.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 713e78b8dbb8adb92d4ee09ea11e726b05577689 Mon Sep 17 00:00:00 2001
From d0b5f668d43281eda94dd64d48e39973139d107c Mon Sep 17 00:00:00 2001
From: Paul Pawlowski <[email protected]>
Date: Sun, 17 Nov 2019 23:11:56 +0100
Subject: [PATCH 2/6] applesmc: make io port base addr dynamic
Subject: [PATCH 2/9] applesmc: make io port base addr dynamic

This change makes the port base runtime configurable.
The reason why this change is made is so that when we switch to an
Expand All @@ -16,7 +16,7 @@ Signed-off-by: Aun-Ali Zaidi <[email protected]>
1 file changed, 49 insertions(+), 42 deletions(-)

diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 62211b590a61..39ed0bb21365 100644
index 7fb40738d..a599db68b 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -35,10 +35,11 @@
Expand Down Expand Up @@ -280,7 +280,7 @@ index 62211b590a61..39ed0bb21365 100644
if (ret)
return ret;

@@ -1468,7 +1475,7 @@ static int __init applesmc_init(void)
@@ -1472,7 +1479,7 @@ static int __init applesmc_init(void)
goto out;
}

Expand All @@ -289,7 +289,7 @@ index 62211b590a61..39ed0bb21365 100644
"applesmc")) {
ret = -ENXIO;
goto out;
@@ -1490,7 +1497,7 @@ static int __init applesmc_init(void)
@@ -1494,7 +1501,7 @@ static int __init applesmc_init(void)
out_driver:
platform_driver_unregister(&applesmc_driver);
out_region:
Expand All @@ -298,7 +298,7 @@ index 62211b590a61..39ed0bb21365 100644
out:
pr_warn("driver init failed (ret=%d)!\n", ret);
return ret;
@@ -1500,7 +1507,7 @@ static void __exit applesmc_exit(void)
@@ -1504,7 +1511,7 @@ static void __exit applesmc_exit(void)
{
platform_device_unregister(pdev);
platform_driver_unregister(&applesmc_driver);
Expand All @@ -308,5 +308,5 @@ index 62211b590a61..39ed0bb21365 100644

module_init(applesmc_init);
--
2.30.0
2.45.2

30 changes: 14 additions & 16 deletions 3003-applesmc-switch-to-acpi_device-from-platform.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From ee3d4bf4a01bc94553bde2ae3e806a63a13faa12 Mon Sep 17 00:00:00 2001
From c405f826e30e0035581b350084d61457ddde6146 Mon Sep 17 00:00:00 2001
From: Paul Pawlowski <[email protected]>
Date: Sun, 17 Nov 2019 23:12:08 +0100
Subject: [PATCH 3/6] applesmc: switch to acpi_device (from platform)
Date: Sat, 29 Jun 2024 04:49:16 +0000
Subject: [PATCH 3/9] applesmc: switch to acpi_device (from platform)

This change makes the change from platform_device
to acpi_device. The rationale for this change is
Expand All @@ -17,11 +17,11 @@ should not result in any incompatibilities.

Signed-off-by: Aun-Ali Zaidi <[email protected]>
---
drivers/hwmon/applesmc.c | 125 ++++++++++++++++++++++++++-------------
1 file changed, 85 insertions(+), 40 deletions(-)
drivers/hwmon/applesmc.c | 124 ++++++++++++++++++++++++++-------------
1 file changed, 84 insertions(+), 40 deletions(-)

diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 39ed0bb21365..bdaaf696f7b6 100644
index a599db68b..b4fe412c0 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -19,7 +19,7 @@
Expand Down Expand Up @@ -167,7 +167,7 @@ index 39ed0bb21365..bdaaf696f7b6 100644
/* Synchronize device with memorized backlight state */
static int applesmc_pm_resume(struct device *dev)
{
@@ -763,18 +820,28 @@ static int applesmc_pm_restore(struct device *dev)
@@ -763,17 +820,26 @@ static int applesmc_pm_restore(struct device *dev)
return applesmc_pm_resume(dev);
}

Expand All @@ -194,23 +194,21 @@ index 39ed0bb21365..bdaaf696f7b6 100644
+ .ops = {
+ .add = applesmc_add,
+ .remove = applesmc_remove
},
+ },
+ .drv = {
+ .pm = &applesmc_pm_ops
+ },
+ .owner = THIS_MODULE
},
};

/*
@@ -1262,7 +1329,6 @@ static int applesmc_create_nodes(struct applesmc_device *smc,
@@ -1262,7 +1328,6 @@ static int applesmc_create_nodes(struct applesmc_device *smc,
static int applesmc_create_accelerometer(struct applesmc_device *smc)
{
int ret;
-
if (!smc->reg.has_accelerometer)
return 0;

@@ -1463,8 +1529,6 @@ static void applesmc_destroy_modules(struct applesmc_device *smc)
@@ -1467,8 +1532,6 @@ static void applesmc_destroy_modules(struct applesmc_device *smc)
applesmc_destroy_nodes(smc, info_group);
}

Expand All @@ -219,7 +217,7 @@ index 39ed0bb21365..bdaaf696f7b6 100644
static int __init applesmc_init(void)
{
int ret;
@@ -1475,29 +1539,12 @@ static int __init applesmc_init(void)
@@ -1479,29 +1542,12 @@ static int __init applesmc_init(void)
goto out;
}

Expand Down Expand Up @@ -251,7 +249,7 @@ index 39ed0bb21365..bdaaf696f7b6 100644
out:
pr_warn("driver init failed (ret=%d)!\n", ret);
return ret;
@@ -1505,9 +1552,7 @@ static int __init applesmc_init(void)
@@ -1509,9 +1555,7 @@ static int __init applesmc_init(void)

static void __exit applesmc_exit(void)
{
Expand All @@ -263,5 +261,5 @@ index 39ed0bb21365..bdaaf696f7b6 100644

module_init(applesmc_init);
--
2.30.0
2.45.2

8 changes: 4 additions & 4 deletions 3004-applesmc-key-interface-wrappers.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 43df89a1377782788760808d8ea4bcf0730effbb Mon Sep 17 00:00:00 2001
From 1ce5dd27e4464383ddfba3ee0d7ffdc7020bd81c Mon Sep 17 00:00:00 2001
From: Paul Pawlowski <[email protected]>
Date: Sun, 17 Nov 2019 23:12:14 +0100
Subject: [PATCH 4/6] applesmc: key interface wrappers
Subject: [PATCH 4/9] applesmc: key interface wrappers

This change replaces the read_smc and write_smc
methods with wrappers, additionally removing the
Expand All @@ -20,7 +20,7 @@ Signed-off-by: Aun-Ali Zaidi <[email protected]>
1 file changed, 79 insertions(+), 40 deletions(-)

diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index bdaaf696f7b6..3017d8ca2c79 100644
index b4fe412c0..5442897e3 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -172,7 +172,7 @@ static const int debug;
Expand Down Expand Up @@ -294,5 +294,5 @@ index bdaaf696f7b6..3017d8ca2c79 100644

out:
--
2.30.0
2.45.2

8 changes: 4 additions & 4 deletions 3005-applesmc-basic-mmio-interface-implementation.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 799e7a54c62a36007f7874c58d7dac87c9651759 Mon Sep 17 00:00:00 2001
From 665609158a43eb6ab3d79e6ee06b9c1edf1cd331 Mon Sep 17 00:00:00 2001
From: Aun-Ali Zaidi <[email protected]>
Date: Sun, 17 Nov 2019 23:12:16 +0100
Subject: [PATCH 5/6] applesmc: basic mmio interface implementation
Subject: [PATCH 5/9] applesmc: basic mmio interface implementation

This change introduces a basic MMIO-based
interface implementation required to communicate
Expand All @@ -21,7 +21,7 @@ Signed-off-by: Aun-Ali Zaidi <[email protected]>
1 file changed, 231 insertions(+), 6 deletions(-)

diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 3017d8ca2c79..2d23bb9ad9dd 100644
index 5442897e3..435541f9f 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -42,6 +42,18 @@
Expand Down Expand Up @@ -339,5 +339,5 @@ index 3017d8ca2c79..2d23bb9ad9dd 100644
}

--
2.30.0
2.45.2

20 changes: 10 additions & 10 deletions 3006-applesmc-fan-support-on-T2-Macs.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 4e63e9b77422aae8e7411ddc7a8458c2585c86df Mon Sep 17 00:00:00 2001
From e77e6a12cd389d1d61b861a1c88a6f393daa6d91 Mon Sep 17 00:00:00 2001
From: Paul Pawlowski <[email protected]>
Date: Sun, 17 Nov 2019 23:12:18 +0100
Subject: [PATCH 6/6] applesmc: fan support on T2 Macs
Subject: [PATCH 6/9] applesmc: fan support on T2 Macs

T2 Macs changed the fan values from shorts to
floats, and changed the fan manual override
Expand All @@ -19,7 +19,7 @@ Signed-off-by: Aun-Ali Zaidi <[email protected]>
1 file changed, 102 insertions(+), 17 deletions(-)

diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 2d23bb9ad9dd..0938227be612 100644
index 435541f9f..46b64eba7 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -87,6 +87,7 @@
Expand Down Expand Up @@ -81,15 +81,15 @@ index 2d23bb9ad9dd..0938227be612 100644
/*
* applesmc_device_init - initialize the accelerometer. Can sleep.
*/
@@ -1242,6 +1280,7 @@ static ssize_t applesmc_show_fan_speed(struct device *dev,
@@ -1241,6 +1279,7 @@ static ssize_t applesmc_show_fan_speed(struct device *dev,
struct device_attribute *attr, char *sysfsbuf)
{
struct applesmc_device *smc = dev_get_drvdata(dev);
+ const struct applesmc_entry *entry;
int ret;
unsigned int speed = 0;
char newkey[5];
@@ -1250,11 +1289,21 @@ static ssize_t applesmc_show_fan_speed(struct device *dev,
@@ -1249,11 +1288,21 @@ static ssize_t applesmc_show_fan_speed(struct device *dev,
scnprintf(newkey, sizeof(newkey), fan_speed_fmt[to_option(attr)],
to_index(attr));

Expand All @@ -113,15 +113,15 @@ index 2d23bb9ad9dd..0938227be612 100644
return sysfs_emit(sysfsbuf, "%u\n", speed);
}

@@ -1263,6 +1312,7 @@ static ssize_t applesmc_store_fan_speed(struct device *dev,
@@ -1262,6 +1311,7 @@ static ssize_t applesmc_store_fan_speed(struct device *dev,
const char *sysfsbuf, size_t count)
{
struct applesmc_device *smc = dev_get_drvdata(dev);
+ const struct applesmc_entry *entry;
int ret;
unsigned long speed;
char newkey[5];
@@ -1274,9 +1324,18 @@ static ssize_t applesmc_store_fan_speed(struct device *dev,
@@ -1273,9 +1323,18 @@ static ssize_t applesmc_store_fan_speed(struct device *dev,
scnprintf(newkey, sizeof(newkey), fan_speed_fmt[to_option(attr)],
to_index(attr));

Expand All @@ -143,7 +143,7 @@ index 2d23bb9ad9dd..0938227be612 100644

if (ret)
return ret;
@@ -1291,12 +1350,26 @@ static ssize_t applesmc_show_fan_manual(struct device *dev,
@@ -1290,12 +1349,26 @@ static ssize_t applesmc_show_fan_manual(struct device *dev,
int ret;
u16 manual = 0;
u8 buffer[2];
Expand Down Expand Up @@ -172,7 +172,7 @@ index 2d23bb9ad9dd..0938227be612 100644
return sysfs_emit(sysfsbuf, "%d\n", manual);
}

@@ -1307,27 +1380,39 @@ static ssize_t applesmc_store_fan_manual(struct device *dev,
@@ -1306,27 +1379,39 @@ static ssize_t applesmc_store_fan_manual(struct device *dev,
struct applesmc_device *smc = dev_get_drvdata(dev);
int ret;
u8 buffer[2];
Expand Down Expand Up @@ -223,5 +223,5 @@ index 2d23bb9ad9dd..0938227be612 100644
out:
if (ret)
--
2.30.0
2.45.2

10 changes: 5 additions & 5 deletions 3007-applesmc-Add-iMacPro-to-applesmc_whitelist.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 58868e6f356229eab48cfdee1603011653a19c79 Mon Sep 17 00:00:00 2001
From 5c95c8e1ada14babfba0f21a2f481d7ff53d17c7 Mon Sep 17 00:00:00 2001
From: Orlando Chamberlain <[email protected]>
Date: Sun, 9 Oct 2022 15:59:01 +0530
Subject: [PATCH] applesmc: Add iMacPro to applesmc_whitelist
Subject: [PATCH 7/9] applesmc: Add iMacPro to applesmc_whitelist

The iMacPro1,1 is the only iMacPro released before the line was
discontinued. Add it to the applesmc_whitelist.
Expand All @@ -12,10 +12,10 @@ Signed-off-by: Orlando Chamberlain <[email protected]>
1 file changed, 4 insertions(+)

diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 8b3f73fcb..493f95bb0 100644
index 46b64eba7..8c7b2e2cd 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -1804,6 +1804,10 @@ static const struct dmi_system_id applesmc_whitelist[] __initconst = {
@@ -1803,6 +1803,10 @@ static const struct dmi_system_id applesmc_whitelist[] __initconst = {
DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
DMI_MATCH(DMI_PRODUCT_NAME, "Macmini") },
},
Expand All @@ -27,5 +27,5 @@ index 8b3f73fcb..493f95bb0 100644
DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
DMI_MATCH(DMI_PRODUCT_NAME, "MacPro") },
--
2.34.1
2.45.2

8 changes: 4 additions & 4 deletions 3008-applesmc-make-applesmc_remove-void.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
From e52b0fad357b6203691942831715fce4f26d66e2 Mon Sep 17 00:00:00 2001
From 4d444d98c6f5f7f39540386b97aa8d77102ada74 Mon Sep 17 00:00:00 2001
From: Orlando Chamberlain <[email protected]>
Date: Tue, 24 Jan 2023 15:46:48 +1100
Subject: [PATCH 1/1] applesmc: make applesmc_remove void
Subject: [PATCH 8/9] applesmc: make applesmc_remove void

for linux6.2 compatibility
---
drivers/hwmon/applesmc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index d071130ff68d..12be9269a314 100644
index 8c7b2e2cd..5f67d7362 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -979,7 +979,7 @@ static int applesmc_add(struct acpi_device *dev)
Expand All @@ -31,5 +31,5 @@ index d071130ff68d..12be9269a314 100644

static acpi_status applesmc_walk_resources(struct acpi_resource *res,
--
2.39.1
2.45.2

Loading

0 comments on commit 6570a9c

Please sign in to comment.