Commit graph

220551 commits

Author SHA1 Message Date
Jean Delvare
49c7347a44 hwmon: (w83795) Drop REST_VLT_BEGIN/END
Get rid of REST_VLT_BEGIN and REST_VLT_END, they don't make the code
more readable.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:48 +02:00
Jean Delvare
7eb8d508b5 hwmon: (w83795) Fix parity checks
x % 1 is obviously wrong, as it always evaluates to 0. You want
x % 2, or x & 1, for parity checking.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:47 +02:00
Jean Delvare
a654b9d4e7 hwmon: (w83795) Get rid of VRLSB_SHIFT
VRLSB_SHIFT is a non-sense, the actual shift depends on the sensor
type (fans need 4, other sensors need 6). Get rid of it to prevent
any confusion. Also get rid of the useless masking, the meaningful
bits are always the MSb so there's nothing to mask out after
shifting.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:47 +02:00
Jean Delvare
c1a792a6ee hwmon: (w83795) Avoid reading the same register twice
Shorten driver load time by avoiding duplicate register access during
initialization. This saves 112 ms on modprobe on my test system.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:47 +02:00
Jean Delvare
02728ffef9 hwmon: (w83795) Rework beep_enable implementation
Handle beep_enable just like all other beep bits. It doesn't need
anything special, so let's avoid redundant code. This also saves a
duplicate register read at initialization time.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:47 +02:00
Jean Delvare
54891a3c13 hwmon: (w83795) Report PECI agent Tbase values
On systems with PECI, report PECI agent Tbase temperature values.
This is informative only.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:47 +02:00
Jean Delvare
dd127f5ccd hwmon: (w83795) Properly handle negative temperatures
The temperature registers hold regular 2's complement values, no need
to add any arithmetics.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:47 +02:00
Jean Delvare
a0ce402fb0 hwmon: (w83795) Rename temperature limit attributes
Follow the standard for temperature limit attribute naming, so that
libsensors will pick the values.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:47 +02:00
Jean Delvare
01879a855f hwmon: (w83795) Fix PWM duty cycle frequency attributes
The PWM duty cycle frequenty attributes are improperly named
(fanN_div instead of pwmN_div) and contain raw values instead of
actual frequencies. Rename them and fix their contents.

Also improve the logic when the user asks for a new frequency, to
always pick the closest supported frequency. The algorithm could
certainly be optimized, but the operation is infrequent enough that
I don't think it's worth the effort.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:47 +02:00
Jean Delvare
0e256018b0 hwmon: (w83795) Add support for dynamic in0-2 limits
The W83795G can be configured to set the in0, in1 and/or in2 voltage
limits dynamically based on VID input pins. Switch the respective
sysfs attributes to read-only.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:46 +02:00
Jean Delvare
6c82b2f3fb hwmon: (w83795) Fix LSB reading of fan speeds
Misplaced parentheses caused the wrong register value to be read,
resulting in random LSB for fan speed values and limits.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:46 +02:00
Jean Delvare
71caf46fbf hwmon: (w83795) Clean up probe function
* The data structure is zalloc'd, so no need to set individual fields
  to 0 explicitly.
* Refactor the handling of pins that can be used for either
  temperature or voltage monitoring.
* Misc other clean-ups.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:46 +02:00
Jean Delvare
6f9dfd85f7 hwmon: (w83795) Fix in17-in20 gain factor
Gain bit set means 1x gain and cleared means 8x gain, not the other
way around.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:46 +02:00
Jean Delvare
80646b9586 hwmon: (w83795) Only start monitoring if needed
This saves an SMBus write if monitoring was already enabled.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:46 +02:00
Jean Delvare
86ef4d2fd5 hwmon: (w83795) Add const markers
Attribute structures can be made const. Same for the I2C address
list.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:46 +02:00
Jean Delvare
b2cc528e58 hwmon: (w83795) Only create fan[1-8]_target files when needed
Only create fan[1-8]_target files when the fan in question can be
controlled (PWM output is present.) Also name these files according
to the standard.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:46 +02:00
Jean Delvare
b5f6a90a0b hwmon: (w83795) Move PWM attributes to a dedidated array
Use a dedicated 2D array for PWM attributes. This way, PWM attributes
are handled the same way as other attributes, this is more consistent.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:46 +02:00
Jean Delvare
87df0dad3e hwmon: (w83795) Use 2D arrays for many device attributes
Use 2D arrays for in, fan, temp and dts device attributes. Using
linear arrays is too risky as we have to skip some groups depending
on the device model and configuration. Adding or removing an
attribute would let the driver build silently but then it would crash
at runtime. With 2D arrays, the consistency checking happens at build
time, which is much safer.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:45 +02:00
Jean Delvare
6f3dcde9c6 hwmon: (w83795) Merge w83795_create_files and w83795_remove_files
Functions w83795_create_files and w83795_remove_files iterate over
the same set of files, just calling a different function. Merge them
into a single function which takes the action as a parameter. This
saves code, and also ensure that file creation and deletion are in
sync.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:45 +02:00
Jean Delvare
892514a637 hwmon: (w83795) Move file creation to a separate function too
Function w83795_probe() is way too big, move file creation to a separate
function to make it more readable.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:45 +02:00
Jean Delvare
2fa09878ba hwmon: (w83795) Move files removal to a separate function
Sysfs files must be removed on device removal but also when device
registration fails. Move the code to a separate function to avoid
code redundancy.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:45 +02:00
Jean Delvare
2be381de0f hwmon: (w83795) Improve detection routine
Check for additional identification registers. Improve debugging
messages on failed detection.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:45 +02:00
Jean Delvare
b2469f422f hwmon: (w83795) Refactor bank selection
Move the bank selection code to a separate function, to avoid
duplicating it in read and write functions. Improve error reporting
on register access error.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:45 +02:00
Jean Delvare
093d1a4794 hwmon: (w83795) Drop duplicate enum
Enum chips and chip_types are redundant, get rid of the former. Fix
the detection code to properly identify the chip variant and name the
client accordingly.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:45 +02:00
Jean Delvare
315bacfdbe hwmon: (w83795) Misc cleanups
* Improve driver description.
* Drop unused macro.
* Drop unreachable code.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:45 +02:00
Wei Song
792d376b4f hwmon: New driver for the W83795G/ADG monitoring chips
There is still much work needed, but I wanted to give Wei the credit
he deserves. I've merged some of my own fixes already, to make
gcc and checkpatch happy. Individual fixes and improvements from me
will follow.

[JD: Fix build errors]
[JD: Coding style cleanups]
[JD: Get rid of forward declarations]
[JD: Drop VID support]
[JD: Drop fault output control feature]
[JD: Use lowercase for inline function names]
[JD: Use strict variants of the strtol/ul functions]
[JD: Shorten the read and write function names]

Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:44 +02:00
Maurus Cuelenaere
62991f7ab3 hwmon: (s3c-hwmon) Depend on S3C_ADC
This way we don't need to modify Kconfig every time a new SoC comes along to
make this driver support it. Also fix some typos while I'm at it.

Signed-off-by: Maurus Cuelenaere <mcuelenaere@gmail.com>
Reviewed-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:44 +02:00
Thomas Gleixner
9c627e3be3 hwmon: (s3c-hwmon) Use a real mutex
The semaphore which protects the ADC is semantically a mutex. Use a
real mutex.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:44 +02:00
Shubhrajyoti D
caaa0f36c3 hwmon: (lm75) Trivial changes to pacify the checkpatch
Some trivial changes to pacify the checkpatch.

Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:44 +02:00
Shubhrajyoti D
e3cd9528af hwmon: (lm75) Make the writing to sysfs more robust
Currently we get the checkpatch warning
consider using strict_strtol in preference to simple_strtol.
Also we should not allow any partially numeric values.

Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:44 +02:00
Jean Delvare
c4f99a2b8f hwmon: (lm90) Add support for the W83L771W/G
I was wondering if that chip ever existed publicly... Apparently yes,
so add support for it.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
2010-10-28 20:31:44 +02:00
Guenter Roeck
0c01b644f7 hwmon: (lm90) Add support for update_interval sysfs attribute
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:44 +02:00
Guenter Roeck
1179324c41 hwmon: (lm90) Introduce capability flag to indicate broken ALERT functionality
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:44 +02:00
Guenter Roeck
4667bcb8d8 hwmon: (lm90) Introduce chip parameter structure
Instead of using switch/case and if statements in probe, define chip specific
functionality in a parameter structure array.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:43 +02:00
Guenter Roeck
15b66ab690 hwmon: (lm90) Rearrange code to no longer require forward declarations
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:43 +02:00
Guenter Roeck
06e1c0a216 hwmon: (lm90) Add support for max6695 and max6696
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:43 +02:00
Guenter Roeck
6948708dd0 hwmon: (lm90) Add support for extra features of max6659
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:43 +02:00
Guenter Roeck
13c84951a3 hwmon: (lm90) Add explicit support for max6659
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:43 +02:00
Guenter Roeck
96512861c3 hwmon: (lm90) Simplify set_temp11 register calculations
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:43 +02:00
Guenter Roeck
b6fc1bacc7 hwmon: (lm90) Introduce function to delete sysfs files
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:43 +02:00
Guenter Roeck
88073bb1ba hwmon: (lm90) Introduce device feature bits
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:43 +02:00
Guenter Roeck
11e578129a hwmon: (lm90) Fix checkpatch errors
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:42 +02:00
Guenter Roeck
28e7438faa hwmon: Add tempX_emergency attribute to sysfs ABI
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:42 +02:00
Andreas Herrmann
628b4504cf hwmon: (k8temp) Remove superfluous CPU family check
The family check in k8temp is not required because the driver is
already bound to a northbridge device only used with K8 CPUs.

Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-10-28 20:31:42 +02:00
Eric Dumazet
800416f799 numa: fix slab_node(MPOL_BIND)
When a node contains only HighMem memory, slab_node(MPOL_BIND)
dereferences a NULL pointer.

[ This code seems to go back all the way to commit 19770b3260: "mm:
  filter based on a nodemask as well as a gfp_mask".  Which was back in
  April 2008, and it got merged into 2.6.26.  - Linus ]

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Christoph Lameter <cl@linux.com>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-10-28 10:04:30 -07:00
Greg Kroah-Hartman
5af634789c Staging: brcm80211: fix usage of roundup in structures
Now that the roundup macro is sane, it can't be used in structure
definitions, or the build breaks..  For now, create a "broken_roundup()"
macro to get everything building again, but in the end, fixing these
structures to use a proper size value is the correct thing to do.

Cc: Brett Rudley <brudley@broadcom.com>
Cc: Henry Ptasinski <henryp@broadcom.com>
Cc: Nohee Ko <noheek@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-10-28 09:55:53 -07:00
Greg Kroah-Hartman
eebfc6055a Staging: bcm: fix up network device reference counting
The way network devices are reference counted does not include poking
around in the reference count itself.  This breaks when the reference
count is changed to be a different type.  Fix the driver to do the
proper function calls instead.

Cc: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-10-28 09:54:23 -07:00
Greg Kroah-Hartman
bceadddd92 Staging: keucr: fix up US_ macro change
The usb tree renamed the USB storage defines to make more sense, so this
driver needs the changes as well so that things will compile properly.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-10-28 09:53:38 -07:00
Greg Kroah-Hartman
e4c5bf8e3d Merge 'staging-next' to Linus's tree
This merges the staging-next tree to Linus's tree and resolves
some conflicts that were present due to changes in other trees that were
affected by files here.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-10-28 09:44:56 -07:00
Linus Torvalds
0851668fdd Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (505 commits)
  [media] af9015: Fix max I2C message size when used with tda18271
  [media] IR: initialize ir_raw_event in few more drivers
  [media] Guard a divide in v4l1 compat layer
  [media] imon: fix nomouse modprobe option
  [media] imon: remove redundant change_protocol call
  [media] imon: fix my egregious brown paper bag w/rdev/idev split
  [media] cafe_ccic: Configure ov7670 correctly
  [media] ov7670: allow configuration of image size, clock speed, and I/O method
  [media] af9015: support for DigitalNow TinyTwin v3 [1f4d:9016]
  [media] af9015: map DigitalNow TinyTwin v2 remote
  [media] DigitalNow TinyTwin remote controller
  [media] af9015: RC fixes and improvements
  videodev2.h.xml: Update to reflect the latest changes at videodev2.h
  [media] v4l: document new Bayer and monochrome pixel formats
  [media] DocBook/v4l: Add missing formats used on gspca cpia1 and sn9c2028
  [media] firedtv: add parameter to fake ca_system_ids in CA_INFO
  [media] tm6000: fix a macro coding style issue
  tm6000: Remove some ugly debug code
  [media] Nova-S-Plus audio line input
  [media] [RFC,1/1] V4L2: Use new CAP bits in existing RDS capable drivers
  ...
2010-10-28 09:35:11 -07:00