All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sony-laptop: add new thermal control handle and setting
@ 2016-09-13 13:41 Stefan Seidel
  2016-09-29  0:00 ` Darren Hart
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Seidel @ 2016-09-13 13:41 UTC (permalink / raw)
  To: platform-driver-x86; +Cc: Darren Hart, Mattia Dongili, Stefan Seidel

On at least the SVD11 there is an additional thermal control handle that
is found at a different handle address but otherwise behaves the same as
the other one. This patch also introduces an additional thermal control
setting "cooling", which, however, may not be available on all platforms.

Signed-off-by: Stefan Seidel <lkml@stefanseidel.info>
---
 drivers/platform/x86/sony-laptop.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 1dba359..6c9deb3 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -148,7 +148,8 @@ static int sony_nc_battery_care_setup(struct platform_device *pd,
 		unsigned int handle);
 static void sony_nc_battery_care_cleanup(struct platform_device *pd);
 
-static int sony_nc_thermal_setup(struct platform_device *pd);
+static int sony_nc_thermal_setup(struct platform_device *pd,
+				 unsigned int handle);
 static void sony_nc_thermal_cleanup(struct platform_device *pd);
 
 static int sony_nc_lid_resume_setup(struct platform_device *pd,
@@ -1363,7 +1364,8 @@ static void sony_nc_function_setup(struct acpi_device *device,
 						result);
 			break;
 		case 0x0122:
-			result = sony_nc_thermal_setup(pf_device);
+		case 0x015F:
+			result = sony_nc_thermal_setup(pf_device, handle);
 			if (result)
 				pr_err("couldn't set up thermal profile function (%d)\n",
 						result);
@@ -1476,6 +1478,7 @@ static void sony_nc_function_cleanup(struct platform_device *pd)
 			sony_nc_lid_resume_cleanup(pd);
 			break;
 		case 0x0122:
+		case 0x015F:
 			sony_nc_thermal_cleanup(pd);
 			break;
 		case 0x0128:
@@ -1547,6 +1550,7 @@ static void sony_nc_function_resume(void)
 			sony_call_snc_handle(handle, 0x100, &result);
 			break;
 		case 0x0122:
+		case 0x015F:
 			sony_nc_thermal_resume();
 			break;
 		case 0x0124:
@@ -2150,14 +2154,16 @@ struct snc_thermal_ctrl {
 	unsigned int profiles;
 	struct device_attribute mode_attr;
 	struct device_attribute profiles_attr;
+	unsigned int handle;
 };
 static struct snc_thermal_ctrl *th_handle;
 
-#define THM_PROFILE_MAX 3
+#define THM_PROFILE_MAX 4
 static const char * const snc_thermal_profiles[] = {
 	"balanced",
 	"silent",
-	"performance"
+	"performance",
+	"cooling"
 };
 
 static int sony_nc_thermal_mode_set(unsigned short mode)
@@ -2173,7 +2179,8 @@ static int sony_nc_thermal_mode_set(unsigned short mode)
 	if ((mode && !(th_handle->profiles & mode)) || mode >= THM_PROFILE_MAX)
 		return -EINVAL;
 
-	if (sony_call_snc_handle(0x0122, mode << 0x10 | 0x0200, &result))
+	if (sony_call_snc_handle(th_handle->handle, mode << 0x10 | 0x0200,
+				 &result))
 		return -EIO;
 
 	th_handle->mode = mode;
@@ -2185,7 +2192,7 @@ static int sony_nc_thermal_mode_get(void)
 {
 	unsigned int result;
 
-	if (sony_call_snc_handle(0x0122, 0x0100, &result))
+	if (sony_call_snc_handle(th_handle->handle, 0x0100, &result))
 		return -EIO;
 
 	return result & 0xff;
@@ -2245,14 +2252,17 @@ static ssize_t sony_nc_thermal_mode_show(struct device *dev,
 	return count;
 }
 
-static int sony_nc_thermal_setup(struct platform_device *pd)
+static int sony_nc_thermal_setup(struct platform_device *pd,
+				 unsigned int handle)
 {
 	int ret = 0;
 	th_handle = kzalloc(sizeof(struct snc_thermal_ctrl), GFP_KERNEL);
 	if (!th_handle)
 		return -ENOMEM;
 
-	ret = sony_call_snc_handle(0x0122, 0x0000, &th_handle->profiles);
+	th_handle->handle = handle;
+
+	ret = sony_call_snc_handle(handle, 0x0000, &th_handle->profiles);
 	if (ret) {
 		pr_warn("couldn't to read the thermal profiles\n");
 		goto outkzalloc;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sony-laptop: add new thermal control handle and setting
  2016-09-13 13:41 [PATCH] sony-laptop: add new thermal control handle and setting Stefan Seidel
@ 2016-09-29  0:00 ` Darren Hart
  0 siblings, 0 replies; 2+ messages in thread
From: Darren Hart @ 2016-09-29  0:00 UTC (permalink / raw)
  To: Stefan Seidel; +Cc: platform-driver-x86, Mattia Dongili

On Tue, Sep 13, 2016 at 01:41:09PM +0000, Stefan Seidel wrote:
> On at least the SVD11 there is an additional thermal control handle that
> is found at a different handle address but otherwise behaves the same as
> the other one. This patch also introduces an additional thermal control
> setting "cooling", which, however, may not be available on all platforms.
> 

Thanks Stefan, and sorry for the long delay.

These sound like to two distinct functional changes to the driver. Is there a
compelling reason to merge them together in one patch? (I suspect not)

Please split these apart and submit separately.

Thanks,

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-29  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-13 13:41 [PATCH] sony-laptop: add new thermal control handle and setting Stefan Seidel
2016-09-29  0:00 ` Darren Hart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.