History log of /drivers/hwmon/applesmc.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
684f49c63edb17b18b8ffc84495e0b0aacc8f4ad 07-Jun-2012 Henrik Rydberg <rydberg@euromail.se> hwmon: (applesmc) Limit key length in warning messages

commit ac852edb47b15900886ba2564eeeb13b3b526e3e upstream.

Key lookups may call read_smc() with a fixed-length key string,
and if the lookup fails, trailing stack content may appear in the
kernel log. Fixed with this patch.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
/drivers/hwmon/applesmc.c
0fc86eca1b338d06ec500b34ef7def79c32b602b 26-Jan-2012 Henrik Rydberg <rydberg@euromail.se> hwmon: (applesmc) Silence uninitialized warnings

Some error paths do not set a result, leading to the (false)
assumption that the value may be used uninitialized. Set results for
those paths as well.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
/drivers/hwmon/applesmc.c
85ebfd3ef9a52abe6426cc5e96604f2dd0e9b375 19-Jan-2012 Guenter Roeck <linux@roeck-us.net> hwmon: (applesmc) Fix multi-line comments

Cc: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Henrik Rydberg <rydberg@euromail.se>
/drivers/hwmon/applesmc.c
179c4fdb565dd2157e5dfe89318b74868e3b523d 04-Jan-2012 Frans Meulenbroeks <fransmeulenbroeks@gmail.com> hwmon: replaced strict_str* with kstr*

replaced strict_strtol with kstrtol and
replaced strict_strtuol with kstrtuol

This satisfies checkpatch -f
Compile tested only: no warnings or errors given

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
/drivers/hwmon/applesmc.c
9d1f8a40ddab65a5cedb69b369ee4c0c6e4acf6b 22-Jan-2011 Henrik Rydberg <rydberg@euromail.se> hwmon: (applesmc) Properly initialize lockdep attributes

The switch to dynamically allocated sysfs attributes left the
internal lockdep members uninitialized, causing a formal bug.
This patch adds sysfs_attr_init() to the node creation function,
remedying the problem.

Reported-and-tested-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
/drivers/hwmon/applesmc.c
2bfe814826b7266a489895f731a777f8cbe37963 10-Nov-2010 Guenter Roeck <guenter.roeck@ericsson.com> hwmon: (applesmc) Fix checkpatch errors and fix value range checks

This patch fixes all checkpatch errors and most of the checkpatch warnings.
It also fixes the range check in applesmc_store_fan_speed().

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Henrik Rydberg <rydberg@euromail.se>
/drivers/hwmon/applesmc.c
41e71f97174ba08fcca7f31bf448de92abc8862e 09-Nov-2010 Henrik Rydberg <rydberg@euromail.se> hwmon: (applesmc) Update copyright information

With the preceding patches, git blame assigns about half of
the file to the present author. Add a line to the copyright
to reflect this.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
/drivers/hwmon/applesmc.c
0b8ad5a57b75322e4b671ef420b5fe90e5154912 09-Nov-2010 Henrik Rydberg <rydberg@euromail.se> hwmon: (applesmc) Silence driver

Make the driver report a single line on success.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
/drivers/hwmon/applesmc.c
0b0b5dff8967a4468f05174d0d74e1ed6e369776 09-Nov-2010 Henrik Rydberg <rydberg@euromail.se> hwmon: (applesmc) Simplify feature sysfs handling

Given the dynamic node construction method, the setup of the
accelerometer, light sensor and keyboard backlight sysfs nodes
can be simplified. This patch does not contain any logic changes.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
/drivers/hwmon/applesmc.c
3eba2bf7c5fb7863412554cd73646cb80ac293ff 09-Nov-2010 Henrik Rydberg <rydberg@euromail.se> hwmon: (applesmc) Dynamic creation of fan files

With the dynamic temperature group in place, the setup of fans
can be simplified. This patch sets up the fans dynamically, removing
a hundred lines of code.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
/drivers/hwmon/applesmc.c
40ef06f1120bcc0a2ad483b5cd42f58c4df78a5b 10-Nov-2010 Henrik Rydberg <rydberg@euromail.se> hwmon: (applesmc) Extract all features generically

With temperature keys being determined automatically, the dmi match
data is only used to assign features that can easily be detected from
the smc. This patch removes the dmi match data altogether, and reduces
the match table to the main machine models.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
/drivers/hwmon/applesmc.c
dcdea2614ab9b7864a3ae620419d04e0cc4a65cc 09-Nov-2010 Henrik Rydberg <rydberg@euromail.se> hwmon: (applesmc) Handle new temperature format

The recent Macbooks have temperature registers of a new type.
This patch adds the logic to handle them.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
/drivers/hwmon/applesmc.c
9792dadfce22ae1518c88577ac743a3077a85084 10-Nov-2010 Henrik Rydberg <rydberg@euromail.se> hwmon: (applesmc) Dynamic creation of temperature files

The current driver creates temperature files based on a list
of temperature keys given per device. Apart from slow adaption
to new machine models, the number of sensors also depends on
the number of processors. This patch looks up the temperature
keys dynamically, thereby supporting all models.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
/drivers/hwmon/applesmc.c
5874583d5662de5550b0ed1c54a9dea70bcdcba4 10-Nov-2010 Henrik Rydberg <rydberg@euromail.se> hwmon: (applesmc) Introduce a register lookup table

One main problem with the current driver is the inability to quickly
search for supported keys, resulting in detailed feature maps per
machine model which are cumbersome to maintain.

This patch adds a register lookup table, which enables binary search
for supported keys. The lookup also reduces the io frequency, so the
original mutex is replaced by locks around the actual io.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
[guenter.roeck@ericsson.com: Added value range check to key_at_index_store()]
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
/drivers/hwmon/applesmc.c
1ee7c71bd1aa9758f14e1be92310215a5bd0abe7 09-Nov-2010 Joe Perches <joe@perches.com> hwmon: (applesmc) Use pr_fmt and pr_<level>

Added #define pr_fmt KBUILD_MODNAME ": " fmt
Converted printks to pr_<level>
Coalesced any long formats
Removed prefixes from formats

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
/drivers/hwmon/applesmc.c
2344cd0c2e9ea8f3037be11fb997ddbeda0237ca 09-Nov-2010 Henrik Rydberg <rydberg@euromail.se> hwmon: (applesmc) Relax the severity of device init failure

The device init is used to reset the accelerometer. Failure to reset
is not severe enough to stop loading the module or to resume from
hibernation. This patch relaxes failure to a warning and drops
output in case of success.

Cc: stable@kernel.org
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
/drivers/hwmon/applesmc.c
132af03233b493101a53010383b5abb5b9ff1e51 09-Nov-2010 Edgar Hucek <gimli@dark-green.com> hwmon: (applesmc) Add MacBookAir3,1(3,2) support

This patch add support for the MacBookAir3,1 and MacBookAir3,2 to the
applesmc driver.

[rydberg@euromail.se: minor cleanup]
Cc: stable@kernel.org
Signed-off-by: Edgar Hucek <gimli@dark-green.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
/drivers/hwmon/applesmc.c
fa5575cff92eb43f467b9b00468d70d073e8b3d2 27-May-2010 Alex Murray <murray.alex@gmail.com> hwmon: (applesmc) Add temperature sensor labels to sysfs interface

The Apple SMC uses a systematic labeling scheme for the hardware
temperature sensors. This scheme is currently hidden from
userland. Since the sensor set, and consequently the numbering,
differs between models, an extensive database of configurations is
required for an application such as fan control. This patch adds the
SMC labels to the hwmon sysfs interface, allowing applications to use
the sensors more intelligibly.

[rydberg@euromail.se: fixed error handling]
Signed-off-by: Alex Murray <murray.alex@gmail.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
/drivers/hwmon/applesmc.c
405eaa1c1d045cdd872802fc515f638573984880 27-May-2010 Henrik Rydberg <rydberg@euromail.se> hwmon: (applesmc) Add generic support for MacBook Pro 7

This patch adds generic support for the MacBook Pro 7 family
based on the 7,1 model.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
/drivers/hwmon/applesmc.c
872bad55e2d3fcc13e1e8770a3b200f0c6ca5126 27-May-2010 Bernhard Froemel <froemel@vmars.tuwien.ac.at> hwmon: (applesmc) Add generic support for MacBook Pro 6

This patch adds generic support for the MacBook Pro 6 family
based on the 6,2 model.

[rydberg@euromail.se: patch cleanup]
Signed-off-by: Bernhard Froemel <froemel@vmars.tuwien.ac.at>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
/drivers/hwmon/applesmc.c
4e4a99d32721800c061191027f18f780dcbd9e0b 27-May-2010 Henrik Rydberg <rydberg@euromail.se> hwmon: (applesmc) Add support for MacBook Pro 5,3 and 5,4

The MacBookPro 5,3 model has two fans, whereas the 5,4 model has
only one. This patch adds explicit support for the 5,3 and 5,4 models.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
/drivers/hwmon/applesmc.c
0559a538899d48e7d730affb9df2abb13a7d9008 11-May-2010 Henrik Rydberg <rydberg@euromail.se> hwmon: (applesmc) Correct sysfs fan error handling

The current code will not remove the sysfs files for fan numbers three
and up. Also, upon exit, fans one and two are removed regardless of
their existence. This patch cleans up the sysfs error handling for
the fans.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
/drivers/hwmon/applesmc.c
e1741712e85cec8004c7eeeea81186618f78eff1 14-Apr-2010 Justin P. Mattock <justinmattock@gmail.com> hwmon: (applesmc) Add iMac9,1 and MacBookPro2,2 support

Add the iMac9,1 and the MacBookPro2,2 temperature sensors to hwmon
driver applesmc to fix kernel bug #14429:
https://bugzilla.kernel.org/show_bug.cgi?id=14429

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Acked-by: Nicolas Boichat <nicolas@boichat.ch>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
/drivers/hwmon/applesmc.c
471452104b8520337ae2fb48c4e61cd4896e025d 15-Dec-2009 Alexey Dobriyan <adobriyan@gmail.com> const: constify remaining dev_pm_ops

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
a976f150a6953da5ccbd40fa6dba3bd7d56f9f67 22-Sep-2009 Henrik Rydberg <rydberg@euromail.se> hwmon: applesmc: restore accelerometer and keyboard backlight on resume

On resume from suspend, the driver currently resets the logical state as
if it was brought up from halt. This patch uses the
dev_pm_ops.resume/restore methods to synchronize the hardware with the
memorized logical state, in effect bringing back the accelerometer and
backlight to the state prior to suspend. Works for both suspend to ram
and hibernation. The patch has zero effect on the running state.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
6055fae8aceee41471edfd1876e5617d16e028fe 15-Sep-2009 H Hartley Sweeten <hartleys@visionengravers.com> hwmon: Include <linux/io.h> instead of <asm/io.h>

Drivers should be including <linux/io.h> instead of <asm/io.h>.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Alistair John Strachan <alistair@devzero.co.uk>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Cc: Juerg Haefliger <juergh@gmail.com>
Cc: Frank Seidel <frank@f-seidel.de>
Acked-by: Jim Cromie <jim.cromie@gmail.com>
Cc: "Mark M. Hoffman" <mhoffman@lightlink.com>
Cc: Roger Lucas <vt8231@hiddenengine.co.uk>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
/drivers/hwmon/applesmc.c
fb9f88e1dc76f9feb39d39c40a5d61aad6df4388 29-Jan-2009 Bharath Ramesh <bramesh@vt.edu> hwmon: applesmc: add support for MacPro 3 temperature sensors

MacPro 3 have more temperature sensors than the previous MacPro's also the
sensor THTG has been removed. This patch add supports for the newer
temperature sensors in the MacPro3.

Signed-off-by: Bharath Ramesh <bramesh@vt.edu>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
c3d6362b8717759de7f2086f9665a4d96cacbc51 15-Jan-2009 Alex Murray <murray.alex@gmail.com> hwmon: applesmc: fix light sensor readings on newer MacBooks

The light sensors ALV0 and ALV1 on newer MacBooks (early 2008 and later)
changed to report 10 bytes instead the earlier 6, and the sensor encoding
subsequently changed. As a result, the reported light sensors readings
are much too low.

Via experiments leading up to this patch, it seems only the ALV0 is
reporting data, and the most useful value therein is a 10-bit big-endian
value at offset 6. This suggests that a new protocol was added as a
backward-compatible replacement on top of the old one.

This patch makes applesmc report the improved light sensor reading for the
new machines, on a scale in conformance with earlier ones.

Signed-off-by: Alex Murray <murray.alex@gmail.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
85e0e5ad1ef8cebd010bbd7047418a47ca9c5ead 06-Jan-2009 Henrik Rydberg <rydberg@euromail.se> hwmon: applesmc: Add support for MacBook Air 2

Add temperature sensor support for MacBook Air 2.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
dc924efb52ba9e4dffec5b15ae2242b894198139 01-Dec-2008 Henrik Rydberg <rydberg@bitmath.org> hwmon: applesmc: make applesmc load automatically on startup

make use of the new dmi device loading support to automatically load the
applesmc driver based on the dmi_match table.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
45a3a36b6333b9ddfb0c57602d959a8d05bc47e4 20-Nov-2008 Henrik Rydberg <rydberg@euromail.se> drivers/hwmon/applesmc.c: add generic MacPro support

In order to analyze the SMC of the newer MacPros, applesmc needs to
recognize the machine. This patch adds the missing generic dmi_match
entry for MacPro models.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
9ca791bbd464d7968db1530b433cc397a4c348c1 20-Nov-2008 Henrik Rydberg <rydberg@euromail.se> hwmon: applesmc: Add support for iMac 6

Add temperature sensor support for iMac 6.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Tested-by: Caleb Hyde <caleb.hyde@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
468cc0320ed083e26364d9febde2679d981ed6a6 12-Nov-2008 Henrik Rydberg <rydberg@euromail.se> hwmon: applesmc: add support for Macbook 4

This patch adds accelerometer and temperature sensor support for Macbook 4.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Cc: Nicolas Boichat <nicolas@boichat.ch
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
eefc488f96cdde6e152b45675b50bf380b95d99f 06-Nov-2008 Henrik Rydberg <rydberg@euromail.se> hwmon: applesmc: add support for iMac 8

Add temperature sensor support for iMac 8.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Tested-by: Klaus Doblmann <klaus.doblmann@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
a66603257bf88bbe2c9fd6a97ee5dc24de15d196 06-Nov-2008 Henrik Rydberg <rydberg@euromail.se> hwmon: applesmc: add support for Macbook Pro 5

Add accelerometer, backlight and temperature sensor support for the new
unibody Macbook Pro 5.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
181209a1d91756bfd83b1d6ce2008cea3ca225b6 06-Nov-2008 Henrik Rydberg <rydberg@euromail.se> hwmon: applesmc: add support for Macbook 5

Add accelerometer, backlight and temperature sensor support for the new
unibody Macbook 5.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Tested-by: David M. Lary <dmlary@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
6e3530fa241ae759313496f67295c9252691ed04 06-Nov-2008 Henrik Rydberg <rydberg@euromail.se> hwmon: applesmc: add support for iMac 5

Add temperature sensor support for iMac 5.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Tested-by: Ricky Campbell <johnrcampbell@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
8c9398d1e9766e3659e277acb2e8ca1c17684139 19-Oct-2008 Henrik Rydberg <rydberg@euromail.se> hwmon: applesmc: lighter wait mechanism, drastic improvement

The read fail ratio is sensitive to the delay between the first byte
written and the first byte read; apparently the sensors cannot be rushed.
Increasing the minimum wait time, without changing the total wait time,
improves the fail ratio from a 8% chance that any of the sensors fails in
one read, down to 0.4%, on a Macbook Air. On a Macbook Pro 3,1, the
effect is even more apparent. By reducing the number of status polls, the
ratio is further improved to below 0.1%. Finally, increasing the total
wait time brings the fail ratio down to virtually zero.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Tested-by: Bob McElrath <bob@mcelrath.org>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Cc: "Mark M. Hoffman" <mhoffman@lightlink.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
07e8dbd3ebbdedc71335049dd4b0d542cb038d7d 19-Oct-2008 Henrik Rydberg <rydberg@euromail.se> hwmon: applesmc: Add support for Macbook Pro 3

Add temperature sensor support for Macbook Pro 3.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Cc: Riki Oktarianto <rkoktarianto@gmail.com>
Cc: Mark M. Hoffman <mhoffman@lightlink.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
d7549905f157f217b888edb0f2055f5090eaf1d8 19-Oct-2008 Henrik Rydberg <rydberg@euromail.se> hwmon: applesmc: Add support for Macbook Pro 4

Adds temperature sensor support for the Macbook Pro 4.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Cc: Riki Oktarianto <rkoktarianto@gmail.com>
Cc: Mark M. Hoffman <mhoffman@lightlink.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
7b5e3cb28f52f42d8cf2b36771be580f33bbc7ae 19-Oct-2008 Andrew Morton <akpm@linux-foundation.org> drivers/hwmon/applesmc.c: remove unneeded casts

dmi_system_id.driver_data is already void*.

Cc: Henrik Rydberg <rydberg@euromail.se>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Cc: Riki Oktarianto <rkoktarianto@gmail.com>
Cc: Mark M. Hoffman <mhoffman@lightlink.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
f5274c972bac2d14c092a9c634e03f51785c7b76 19-Oct-2008 Henrik Rydberg <rydberg@euromail.se> hwmon: applesmc: add support for Macbook Air

This patch adds accelerometer, backlight and temperature sensor support
for the Macbook Air.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Cc: Riki Oktarianto <rkoktarianto@gmail.com>
Cc: Mark M. Hoffman <mhoffman@lightlink.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
8bd1a12a51871f0c870612d8220b1485d6aefc73 19-Oct-2008 Henrik Rydberg <rydberg@euromail.se> hwmon: applesmc: allow for variable ALV0 and ALV1 package length

On some recent Macbooks, the package length for the light sensors ALV0 and
ALV1 has changed from 6 to 10. This patch allows for a variable package
length encompassing both variants.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Cc: Riki Oktarianto <rkoktarianto@gmail.com>
Cc: Mark M. Hoffman <mhoffman@lightlink.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
02fcbd144d684167aa67b1d3ad68f18d265f2d08 19-Oct-2008 Henrik Rydberg <rydberg@euromail.se> hwmon: applesmc: prolong status wait

The time to wait for a status change while reading or writing to the SMC
ports is a balance between read reliability and system performance. The
current setting yields rougly three errors in a thousand when
simultaneously reading three different temperature values on a Macbook
Air. This patch increases the setting to a value yielding roughly one
error in ten thousand, with no noticable system performance degradation.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Cc: Riki Oktarianto <rkoktarianto@gmail.com>
Cc: Mark M. Hoffman <mhoffman@lightlink.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
84d2d7f2ee98dc9bd799790c89b5eb8280af2d37 19-Oct-2008 Henrik Rydberg <rydberg@euromail.se> hwmon: applesmc: fix the 'wait status failed: c != 8' problem

On many Macbooks since mid 2007, the Pro, C2D and Air models, applesmc
fails to read some or all SMC ports. This problem has various effects,
such as flooded logfiles, malfunctioning temperature sensors,
accelerometers failing to initialize, and difficulties getting backlight
functionality to work properly.

The root of the problem seems to be the command protocol. The current
code sends out a command byte, then repeatedly polls for an ack before
continuing to send or recieve data. From experiments leading to this
patch, it seems the command protocol never quite worked or changed so that
one now sends a command byte, waits a little bit, polls for an ack, and if
it fails, repeats the whole thing by sending the command byte again.

This patch implements a send_command function according to the new
interpretation of the protocol, and should work also for earlier models.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Cc: Riki Oktarianto <rkoktarianto@gmail.com>
Cc: Mark M. Hoffman <mhoffman@lightlink.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
05224091af06177c0ce7c1fae1f498455b47a6be 19-Oct-2008 Henrik Rydberg <rydberg@euromail.se> hwmon: applesmc: specified number of bytes to read should match actual

At one single place in the code, the specified number of bytes to read and
the actual number of bytes read differ by one. This one-liner patch fixes
that inconsistency.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Cc: Riki Oktarianto <rkoktarianto@gmail.com>
Cc: Mark M. Hoffman <mhoffman@lightlink.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
f91a79fe86a0becdf2506c189cdde154e82c787c 15-Aug-2008 Guilherme M. Schroeder <guilherme.m.schroeder@gmail.com> applesmc: add support for Macbook

Add support for Macbook v3 (sensors and accelerometer).

Signed-off-by: Nicolas Boichat <nicolas@boichat.ch>
Cc: "Mark M. Hoffman" <mhoffman@lightlink.com>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
9f86f28df14e06b12908d6475ee2462f0555bf34 15-Aug-2008 Roberto De Ioris <roberto@unbit.it> applesmc: support for Intel iMac

This adds support for fans and temperature sensors on intel iMac.

Tested on iMac 24" 2.8ghz (iMac8,1), it supports the following sensors:

cpu A
ambient
gpu
gpu diode
gpu heatsink
hd bay 1
memory controller
optical drive
power

Signed-off-by: Roberto De Ioris <roberto@unbit.it>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Mark M. Hoffman <mhoffman@lightlink.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
cd19ba1391f93bc3741d298667c074d2d3fcc9fd 05-Feb-2008 Riki Oktarianto <rkoktarianto@gmail.com> hwmon: (applesmc) sensors set for MacBook2

On my mid-2007 MacBook2, reading Ts0P sensor always failed with this message:
applesmc: wait status failed: 5 != 50.

So I assume that there's no such Ts0p sensor in this model (please confirm,
anyone). If there's the case, then we need a new set of sensors defined for
MacBook2.

Signed-off-by: Riki Oktarianto <rkoktarianto@gmail.com>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
/drivers/hwmon/applesmc.c
6c152beefbf90579d21afc4f7e075b1f801f9a75 31-Oct-2007 Richard Purdie <rpurdie@rpsys.net> leds: Standardise LED naming scheme

As discussed on LKML some notion of 'function' is needed in
LED naming. This patch adds this to the documentation and
standardises existing LED drivers.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
/drivers/hwmon/applesmc.c
8de577095d65e8a51135793bf48c7be6c6c5bc77 16-Oct-2007 René Rebe <rene@exactcode.de> hwmon: (applesmc) Add support for Mac Pro 2 x Quad-Core

At least the 2x Quad-Core Apple Mac Pro appears to have some over-heat
protection which suddenly powers off the whole box under load. This adds
support for the fans and temerature sensors in the Mac Pro - later some
"windwarm" a-like code should probably monitor the values. For now
manually tweaking the fans prevents the sudden shutdown for me.

cd /sys/devices/platform/applesmc.768
for x in fan{1,2,3,4}; do
echo 1 > ${x}_manual
echo 1285 > ${x}_output
done

Two sensors are 0, while four are 129 °C, those might be removed again,
later.

Signed-off-by: René Rebe <rene@exactcode.de>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
/drivers/hwmon/applesmc.c
7b19ada2ed3c1eccb9fe94d74b05e1428224663d 19-Oct-2007 Jiri Slaby <jirislaby@gmail.com> get rid of input BIT* duplicate defines

get rid of input BIT* duplicate defines

use newly global defined macros for input layer. Also remove includes of
input.h from non-input sources only for BIT macro definiton. Define the
macro temporarily in local manner, all those local definitons will be
removed further in this patchset (to not break bisecting).
BIT macro will be globally defined (1<<x)

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: <dtor@mail.ru>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Cc: <lenb@kernel.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Cc: <perex@suse.cz>
Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: <vernux@us.ibm.com>
Cc: <malattia@linux.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
f2e1d89f9b349b3cd914b7c6ec6368632f4ad048 15-Oct-2007 Linus Torvalds <torvalds@woody.linux-foundation.org> Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (40 commits)
Input: use full RCU API
Input: remove tsdev interface
Input: add support for Blackfin BF54x Keypad controller
Input: appletouch - another fix for idle reset logic
HWMON: hdaps - switch to using input-polldev
Input: add support for SEGA Dreamcast keyboard
Input: omap-keyboard - don't pretend we support changing keymap
Input: lifebook - fix X and Y axis range
Input: usbtouchscreen - add support for GeneralTouch devices
Input: fix open count handling in input interfaces
Input: keyboard - add CapsShift lock
Input: adbhid - produce all CapsLock key events
Input: ALPS - add signature for ThinkPad R61
Input: jornada720_kbd - send MSC_SCAN events
Input: add support for the HP Jornada 7xx (710/720/728) touchscreen
Input: add support for HP Jornada 7xx onboard keyboard
Input: add support for HP Jornada onboard keyboard (HP6XX)
Input: ucb1400_ts - use schedule_timeout_uninterruptible
Input: xpad - fix dependancy on LEDS class
Input: auto-select INPUT for MAC_EMUMOUSEBTN option
...

Resolved conflicts manually in drivers/hwmon/applesmc.c: converting from
a class device to a device and converting to use input-polldev created a
few apparently trivial clashes..
4fa435018d740cb83d74c92306aa1f796da91ddd 14-Oct-2007 Linus Torvalds <torvalds@woody.linux-foundation.org> Merge branch 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6

* 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6: (53 commits)
hwmon: (vt8231) fix sparse warning
hwmon: (sis5595) fix sparse warning
hwmon: (w83627hf) don't assume bank 0
hwmon: (w83627hf) Fix setting fan min right after driver load
hwmon: (w83627hf) De-macro sysfs callback functions
hwmon: Add new combined driver for FSC chips
hwmon: (ibmpex) Release IPMI user if hwmon registration fails
hwmon: (dme1737) Add sch311x support
hwmon: (dme1737) group functions logically
hwmon: (dme1737) cleanups
hwmon: IBM power meter driver
hwmon: (coretemp) Add support for Celeron 4xx
hwmon: (lm87) Disable VID when it should be
hwmon: (w83781d) Add individual alarm and beep files
hwmon: VRM is not read from registers
MAINTAINERS: update hwmon subsystem git trees
hwmon: Fix the code examples in documentation
hwmon: update sysfs interface document - error handling
hwmon: (thmc50) Fix a debug message
hwmon: (thmc50) Don't create temp3 if not enabled
...
b981d8b3f5e008ff10d993be633ad00564fc22cd 13-Oct-2007 Dmitry Torokhov <dmitry.torokhov@gmail.com> Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6

Conflicts:

drivers/macintosh/adbhid.c
1beeffe43311f64df8dd0ab08ff6b1858c58363f 20-Aug-2007 Tony Jones <tonyj@suse.de> hwmon: Convert from class_device to device

Convert from class_device to device for hwmon_device_register/unregister

Signed-off-by: Tony Jones <tonyj@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
/drivers/hwmon/applesmc.c
1855256c497ecfefc730df6032243f26855ce52c 03-Oct-2007 Jeff Garzik <jeff@garzik.org> drivers/firmware: const-ify DMI API and internals

Three main sets of changes:

1) dmi_get_system_info() return value should have been marked const,
since callers should not be changing that data.

2) const-ify DMI internals, since DMI firmware tables should,
whenever possible, be marked const to ensure we never ever write to
that data area.

3) const-ify DMI API, to enable marking tables const where possible
in low-level drivers.

And if we're really lucky, this might enable some additional
optimizations on the part of the compiler.

The bulk of the changes are #2 and #3, which are interrelated. #1 could
have been a separate patch, but it was so small compared to the others,
it was easier to roll it into this changeset.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
/drivers/hwmon/applesmc.c
d5cf2b99dac2e3ff17c7a80fcc71e538b38a3c75 26-Sep-2007 Dmitry Torokhov <dmitry.torokhov@gmail.com> HWMON: applesmc - convert to use input-polldev

Switch to using input-polldev skeleton instead of implementing polling loop by
itself. This also fixes problem with trylock on a mutex in atomic context.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
/drivers/hwmon/applesmc.c
1bed24b9785f7f5255c120f194e98343b998f6ce 09-Jul-2007 Martin Szulecki <mactel@sukimashita.com> hwmon: (applesmc) add temperature sensors set for Macbook

Signed-off-by: Nicolas Boichat <nicolas@boichat.ch>
Acked-by: Jean Delvare <khali@linux-fr.org>
Cc: Martin Szulecki <mactel@sukimashita.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
/drivers/hwmon/applesmc.c
6996abf0962bb86b6285987a4698f6d275ff531f 27-May-2007 Nicolas Boichat <nicolas@boichat.ch> hwmon/applesmc: Handle name file creation error and deletion

The previous patch was incomplete.

Signed-off-by: Nicolas Boichat <nicolas@boichat.ch>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
/drivers/hwmon/applesmc.c
fa74419bb7b51af4bbb66116d14cc92f0b5aff25 23-May-2007 Nicolas Boichat <nicolas@boichat.ch> applesmc - sensors patch missing from 2.6.22-rc2

Add name file needed by lm_sensors user-space applications in applesmc
sysfs tree.

Cc: Soeren Sonnenburg <kernel@nn7.de>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
c5ddb547e899993be56dc7d0bf72bfd7a8d4ae1e 10-May-2007 Dmitry Torokhov <dtor@insightbb.com> drivers/hwmon: switch to using input_dev->dev.parent

In preparation for struct class_device -> struct device input core
conversion, switch to using input_dev->dev.parent when specifying device
position in sysfs tree.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
da4e8ca376a1b3dca470eba14dcec321a6a27b8b 09-May-2007 Jean Delvare <khali@linux-fr.org> applesmc: Use standard sysfs names for labels

We have a standard suffix to associate a designation string to a sensor:
_label. Use it instead of _position so that libsensors will catch it.
(This isn't implemented yet, but should be soon.)

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
ddfbf2afd538b38139267f71a185eb9434465440 09-May-2007 Jean Delvare <khali@linux-fr.org> applesmc: Use the address as platform device ID

Let the applesmc device export its address to userspace. libsensors needs
this to recognize the device and give it a unique ID.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c
6f2fad748ccced5b9313efce2a2c7ae4c04ef564 08-May-2007 Nicolas Boichat <nicolas@boichat.ch> Apple SMC driver (hardware monitoring and control)

This driver provides support for the Apple System Management Controller, which
provides an accelerometer (Apple Sudden Motion Sensor), light sensors,
temperature sensors, keyboard backlight control and fan control. Only
Intel-based Apple's computers are supported (MacBook Pro, MacBook, MacMini).

[bunk@stusta.de: make drivers/hwmon/applesmc.c:backlight_work stati]
[khali@linux-fr.org: fix temperature attribute file names]
Signed-off-by: Nicolas Boichat <nicolas@boichat.ch>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/hwmon/applesmc.c