[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <547A0AEB.2020002@roeck-us.net>
Date: Sat, 29 Nov 2014 10:05:31 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Pali Rohár <pali.rohar@...il.com>
CC: Arnd Bergmann <arnd@...db.de>,
Steven Honeyman <stevenhoneyman@...il.com>,
linux-kernel@...r.kernel.org,
Gabriele Mazzotta <gabriele.mzt@...il.com>
Subject: Re: [PATCH] i8k: Add support for temperature sensor labels
On 11/29/2014 09:51 AM, Greg Kroah-Hartman wrote:
> On Sat, Nov 29, 2014 at 06:49:43PM +0100, Pali Rohár wrote:
>> On Saturday 29 November 2014 18:43:15 Greg Kroah-Hartman wrote:
>>> On Sat, Nov 29, 2014 at 05:04:07PM +0100, Pali Rohár wrote:
>>>> This patch adds labels for temperature sensors if SMM
>>>> function with EAX register 0x11a3 reports it. These
>>>> informations was taken from DOS binary NBSVC.MDM.
>>>>
>>>> Signed-off-by: Pali Rohár <pali.rohar@...il.com>
>>>> ---
>>>>
>>>> drivers/char/i8k.c | 110
>>>> +++++++++++++++++++++++++++++++++++++++++----------- 1
>>>> file changed, 88 insertions(+), 22 deletions(-)
>>>>
>>>> diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c
>>>> index e34a019..77af46b 100644
>>>> --- a/drivers/char/i8k.c
>>>> +++ b/drivers/char/i8k.c
>>>> @@ -42,6 +42,7 @@
>>>>
>>>> #define I8K_SMM_GET_FAN 0x00a3
>>>> #define I8K_SMM_GET_SPEED 0x02a3
>>>> #define I8K_SMM_GET_TEMP 0x10a3
>>>>
>>>> +#define I8K_SMM_GET_TEMP_TYPE 0x11a3
>>>>
>>>> #define I8K_SMM_GET_DELL_SIG1 0xfea3
>>>> #define I8K_SMM_GET_DELL_SIG2 0xffa3
>>>>
>>>> @@ -288,6 +289,14 @@ static int i8k_set_fan(int fan, int
>>>> speed)
>>>>
>>>> return i8k_smm(®s) ? : i8k_get_fan_status(fan);
>>>>
>>>> }
>>>>
>>>> +static int i8k_get_temp_type(int sensor)
>>>> +{
>>>> + struct smm_regs regs = { .eax = I8K_SMM_GET_TEMP_TYPE, };
>>>> +
>>>> + regs.ebx = sensor & 0xff;
>>>> + return i8k_smm(®s) ? : regs.eax & 0xff;
>>>> +}
>>>> +
>>>>
>>>> /*
>>>>
>>>> * Read the cpu temperature.
>>>> */
>>>>
>>>> @@ -493,6 +502,29 @@ static int i8k_open_fs(struct inode
>>>> *inode, struct file *file)
>>>>
>>>> * Hwmon interface
>>>> */
>>>>
>>>> +static ssize_t i8k_hwmon_show_temp_label(struct device
>>>> *dev, + struct device_attribute *devattr,
>>>> + char *buf)
>>>> +{
>>>> + static const char * const labels[] = {
>>>> + "CPU",
>>>> + "GPU",
>>>> + "SODIMM",
>>>> + "Other",
>>>> + "Ambient",
>>>> + "Other",
>>>> + };
>>>> + int index = to_sensor_dev_attr(devattr)->index;
>>>> + int type;
>>>> +
>>>> + type = i8k_get_temp_type(index);
>>>> + if (type < 0)
>>>> + return type;
>>>> + if (type >= ARRAY_SIZE(labels))
>>>> + type = ARRAY_SIZE(labels) - 1;
>>>> + return sprintf(buf, "%s\n", labels[type]);
>>>> +}
>>>
>>> No Documentation/ABI/ entry for your new sysfs file?
>>
>> It is standard hwmon sysfs entry which is used by other hwmon
>> drivers... It is not i8k.ko driver specific.
>
> Ok, then why is this driver not in a "hwmon-standard" location in the
> kernel tree?
>
Another historic reason. hwmon support was added to the driver
only in 2011. Initially it only had support for the proc interface.
The driver exists at least since 2005, when Linux started to use git.
Maybe we should move it ?
Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists