Stephen Hemminger [Mon, 1 Nov 2010 17:34:35 +0000 (13:34 -0400)]
beceem: statistics and transmit queue changes
Use standard network statistics variables and routines.
Transmit counters are per queue, and skb mapping is already in
skb and does not need to be recomputed. Move SearchVcId to only
place it is used.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 16:28:39 +0000 (12:28 -0400)]
beceem: do classification even if device is offline
Since classification and queue control are separate, allow
classification even if device is down now; this avoids races
on startup/shutdown.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 16:27:20 +0000 (12:27 -0400)]
beceem: off by one on queue index
The driver allocates 18 queues (0..16) are for traffic, and 17
is a bit bucket.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 16:24:00 +0000 (12:24 -0400)]
beceem: make local functions static
Use namespace tool from kernel scripts to identify dead code and
functions that should be static.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 16:21:32 +0000 (12:21 -0400)]
beceem: remove unused code to dump header
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 16:20:09 +0000 (12:20 -0400)]
beceem: transmit code cleanup
Eliminate global variable in transmit path
The Leader can be on the stack, and get rid of unnecessary timeval.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 15:58:01 +0000 (11:58 -0400)]
beceem: allow multicast/broadcast
Even though wimax isn't really a broadcast medium, pretend it is.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 16:18:36 +0000 (12:18 -0400)]
beceem: debug message format changes
Add more debug messages and make them similar to other drivers
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 15:39:05 +0000 (11:39 -0400)]
beceem: use get_seconds for elapsed time
get_seconds is lower overhead and fine if all driver wants to do
is keep track of seconds.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 16:14:01 +0000 (12:14 -0400)]
beceem: module initialization
Get rid of boot messages and put in correct place.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 16:12:31 +0000 (12:12 -0400)]
beceem: add network device message level control
Provide standard interface to control verbosity of debug messages
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 15:14:29 +0000 (11:14 -0400)]
beceem: change format of debug message
Statistic point is now u32 (like it has to be).
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 15:12:56 +0000 (11:12 -0400)]
beceem: clean up adapter structure
Remove dead fields, change fields that only have true/false to boolean;
and rearrange to save space.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 14:17:54 +0000 (10:17 -0400)]
beceem: create class on module installation
First step to supporting multiple devices, create device class
when module is initialized.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 14:16:29 +0000 (10:16 -0400)]
beceem: convert to kernel coding style
Change indentation etc, to conform to acceptable kernel style
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 14:07:20 +0000 (10:07 -0400)]
beceem: remove useless debug function entry messages
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 14:05:34 +0000 (10:05 -0400)]
beceem: remove problematic debug print messages
Not worth bothering to change printf format of messages which
are basically noise.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 14:03:29 +0000 (10:03 -0400)]
beceem: remove unnecessary usb class
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 13:26:47 +0000 (09:26 -0400)]
beceem: fix character device ioctl
Sparse caught several places where ioctl interface was incorrectly using user
memory. Fix all the ioctl cases for casting and __user annotation.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 12:42:44 +0000 (08:42 -0400)]
beceem: fix printf format strings
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 04:04:52 +0000 (00:04 -0400)]
beceem: reserve one queue for bit-bucket
This preserves the semantics of the original driver (unclassified packets
are dropped), but does it in a clean way; and fixes crash when packet
is sent to offline device.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 04:03:03 +0000 (00:03 -0400)]
beceem: remove dead code
Remove commented out with '#if 0'
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 03:55:21 +0000 (23:55 -0400)]
beceem: support multiple queues
Current kernels have multi-queue support which can be used by
this device. This has the advantage that a single type of traffic
will not block other types.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 03:52:36 +0000 (23:52 -0400)]
beceem: get rid of unnecessary inline usage
Many routines were tagged with inline_ but GCC does a better
job of deciding this.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 03:47:35 +0000 (23:47 -0400)]
beceem: fold unregister_netdevice into AdapterFree
The function unregister_netdevice only called unregister_netdev.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 13:53:58 +0000 (09:53 -0400)]
beceem: remove ARP spoofing
Linux support NOARP flag, so the whole Arp spoofing routines
are not needed.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 03:43:55 +0000 (23:43 -0400)]
beceem: print better message on bad ioctl
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 13:52:14 +0000 (09:52 -0400)]
beceem: remove indirection to Adapter structure
Allocate Adapter structure as part of network device.
Signed-off-by: Stephen Hemminber <shemminger@vyatta.com>
Stephen Hemminger [Sat, 30 Oct 2010 04:39:54 +0000 (21:39 -0700)]
beceem: Add proper carrier and link management
Start with carrier off.
Don't track up/down status in driver private flag.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Sat, 30 Oct 2010 00:15:06 +0000 (17:15 -0700)]
beceem: reduce transmit queue len
Reduce transmit queue length to avoid excess buffering
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Sat, 30 Oct 2010 00:13:52 +0000 (17:13 -0700)]
beceem: remove dead code
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Sat, 30 Oct 2010 00:12:37 +0000 (17:12 -0700)]
beceem: add ethtool support
This adds basic ethtool support to get driver info and settings
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 13:49:30 +0000 (09:49 -0400)]
beceem: make transmit thread interruptible
Kernel complains loudly if thread does long uninterruptible sleep.
Also, dont wake up every 10ms even if no data present (wastes power).
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Sat, 30 Oct 2010 00:02:39 +0000 (17:02 -0700)]
beceem: name threads with device name
This is the convention used by Intel Wimax
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Mon, 1 Nov 2010 13:35:21 +0000 (09:35 -0400)]
beceem: remove OS wrapper library
Use native kernel functions for kmalloc/kfree directly
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Sat, 30 Oct 2010 04:26:06 +0000 (21:26 -0700)]
beceem: use kernel print_hex_dump function
No longer need special hex dump routine
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Fri, 29 Oct 2010 23:44:07 +0000 (16:44 -0700)]
beceem: cleanup network device setup
Change how network device is setup:
* set pointer to device object so sysfs has eth0/device symlink
* set network device type
* eliminate all the compatiablity with older kernels.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Fri, 29 Oct 2010 15:22:10 +0000 (08:22 -0700)]
beceem: get rid of OS dependent data structure
The only part of this structure still used was the network
device stats, and in recent kernel these are available in
network device itself.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Fri, 29 Oct 2010 15:20:11 +0000 (08:20 -0700)]
beceem: eliminate dead code
Get rid of empty header file and unused declarations
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Fri, 29 Oct 2010 15:18:27 +0000 (08:18 -0700)]
beceem: eliminate network registered state variable
Just use presence of pointer
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Fri, 29 Oct 2010 15:14:16 +0000 (08:14 -0700)]
beceem: remove bogus network device notifier
Network device should not be messing with refcounts directly.
See Documentation/networking/netdevices.txt
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Fri, 29 Oct 2010 15:11:12 +0000 (08:11 -0700)]
beceem: cleanup debug level infrastructure
Add module parameter to control debug level and do code cleanup
The whole debug stuff should eventually be removed.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Fri, 29 Oct 2010 15:04:18 +0000 (08:04 -0700)]
beceem: eliminate unused USB stubs
USB layer does not require these reset function stubs
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Fri, 29 Oct 2010 15:02:08 +0000 (08:02 -0700)]
beceem: remove version ifdef's
Remove code to support older kernel API's
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Fri, 29 Oct 2010 14:51:47 +0000 (07:51 -0700)]
beceem: remove ifdef's
There were a lot of ifdef's for driver options which have no
configuration options. Choose the current value and remove the
ifdef.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Stephen Hemminger [Fri, 29 Oct 2010 14:44:45 +0000 (07:44 -0700)]
beceem: add module information
Add description and version information to the driver.
Make USB device table exported as alias so device will be
autoloaded. Get rid of useless noise message on boot.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Linus Torvalds [Thu, 28 Oct 2010 19:25:42 +0000 (12:25 -0700)]
Merge branch 'x86-platform-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip
* 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86: Move olpc to platform
x86: Move uv to platform
x86: Move mrst to platform
x86: Move scx200 to platform
x86: Move visws to platform
x86: Move efi to platform
x86: Move sfi to platform
x86: Add platform directory
Linus Torvalds [Thu, 28 Oct 2010 19:17:00 +0000 (12:17 -0700)]
Merge branch 'hwmon-for-linus' of git://git./linux/kernel/git/jdelvare/staging
* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: (68 commits)
hwmon: (it87) Add support for the IT8721F/IT8758E
hwmon: (it87) Move conversion functions
hwmon: Remove many EXPERIMENTAL flags
hwmon: (lm85) Add support for ADT7468 high-frequency PWM mode
hwmon: (lm85) Document the ADT7468 as supported
hwmon: (lm85) Fix ADT7468 frequency table
hwmon: I2C addresses are constant
Move ams driver to macintosh
hwmon: (pcf8591) Don't attempt to detect devices
hwmon: (pcf8591) Register as a hwmon device
hwmon: (w83795) Use standard attributes for chassis intrusion
hwmon: (w83795) Exclude fan control feature by default
hwmon: (w83795) Add myself as co-author and maintainer
hwmon: (w83795) More style cleanups
hwmon: (w83795) Fix LSB reading of voltage limits
hwmon: (w83795) Use dev_get_drvdata() where possible
hwmon: (w83795) Delay reading pwm config registers
hwmon: (w83795) Delay reading limit registers
hwmon: (w83795) Move register reads to dedicated functions
hwmon: (w83795) Pack similar register reads
...
Linus Torvalds [Thu, 28 Oct 2010 19:13:00 +0000 (12:13 -0700)]
Merge git://git./linux/kernel/git/gregkh/staging-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (841 commits)
Staging: brcm80211: fix usage of roundup in structures
Staging: bcm: fix up network device reference counting
Staging: keucr: fix up US_ macro change
staging: brcm80211: brcmfmac: Removed codeversion from firmware filenames.
staging: brcm80211: Remove unnecessary header files.
staging: brcm80211: Remove unnecessary includes from bcmutils.c
staging: brcm80211: Removed unnecessary pktsetprio() function.
Staging: brcm80211: remove typedefs.h
Staging: brcm80211: remove uintptr typedef usage
Staging: hv: remove struct vmbus_channel_interface
Staging: hv: remove Open from struct vmbus_channel_interface
Staging: hv: storvsc: call vmbus_open directly
Staging: hv: netvsc: call vmbus_open directly
Staging: hv: channel: export vmbus_open to modules
Staging: hv: remove Close from struct vmbus_channel_interface
Staging: hv: netvsc: call vmbus_close directly
Staging: hv: storvsc: call vmbus_close directly
Staging: hv: channel: export vmbus_close to modules
Staging: hv: remove SendPacket from struct vmbus_channel_interface
Staging: hv: storvsc: call vmbus_sendpacket directly
...
Fix up conflicts in
drivers/staging/cx25821/cx25821-audio-upstream.c
drivers/staging/cx25821/cx25821-audio.h
due to warring whitespace cleanups (neither of which were all that great)
Linus Torvalds [Thu, 28 Oct 2010 19:06:51 +0000 (12:06 -0700)]
Merge git://git./linux/kernel/git/lethal/sh-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (32 commits)
sh: intc: switch irq_desc iteration to new active IRQ iterator.
sh: fix up cpu hotplug IRQ migration for irq_data changes.
sh: oprofile: Make sure the backtrace op is available for timer-fallback.
sh64: oprofile: Fix up kernel stack pointer size mismatch.
sh: oprofile: Fix up and extend op_name_from_perf_id().
sh: lockless get_user_pages_fast()
sh64: _PAGE_SPECIAL support.
sound: sh: ctrl_in/outX to __raw_read/writeX conversion.
sh: disable deprecated genirq support.
sh: update show_interrupts() for irq_data chip lookup.
sh: intc: irq_data conversion.
sh64: irq_data conversion.
sh64: update for IRQ flag handling naming changes.
rtc: rtc-rs5c313: ctrl_in/outX to __raw_read/writeX conversion.
sh: mach-se: irq_data conversion.
input: hp680_ts_input: ctrl_in/outX to __raw_read/writeX conversion.
input: jornada680_kbd: ctrl_in/outX to __raw_read/writeX conversion.
sh: hd64461: irq_data conversion.
sh: mach-x3proto: irq_data conversion.
sh: mach-systemh: irq_data conversion.
...
Linus Torvalds [Thu, 28 Oct 2010 18:59:52 +0000 (11:59 -0700)]
Merge branch 'linux-next' of git://git./linux/kernel/git/jbarnes/pci-2.6
* 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (27 commits)
x86: allocate space within a region top-down
x86: update iomem_resource end based on CPU physical address capabilities
x86/PCI: allocate space from the end of a region, not the beginning
PCI: allocate bus resources from the top down
resources: support allocating space within a region from the top down
resources: handle overflow when aligning start of available area
resources: ensure callback doesn't allocate outside available space
resources: factor out resource_clip() to simplify find_resource()
resources: add a default alignf to simplify find_resource()
x86/PCI: MMCONFIG: fix region end calculation
PCI: Add support for polling PME state on suspended legacy PCI devices
PCI: Export some PCI PM functionality
PCI: fix message typo
PCI: log vendor/device ID always
PCI: update Intel chipset names and defines
PCI: use new ccflags variable in Makefile
PCI: add PCI_MSIX_TABLE/PBA defines
PCI: add PCI vendor id for STmicroelectronics
x86/PCI: irq and pci_ids patch for Intel Patsburg DeviceIDs
PCI: OLPC: Only enable PCI configuration type override on XO-1
...
Jean Delvare [Thu, 28 Oct 2010 18:31:51 +0000 (20:31 +0200)]
hwmon: (it87) Add support for the IT8721F/IT8758E
Add support for the IT8721F/IT8758E. These new chips differ from the
older IT87xxF chips in the following ways:
* ADC LSB is 12 mV instead of 16 mV.
* PWM values are 8-bit instead of 7-bit.
There are other minor changes we don't have to care about in the
driver.
Another change is that we will handle internal voltage scaling in the
driver instead of delegating the work to user-space.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Jean Delvare [Thu, 28 Oct 2010 18:31:51 +0000 (20:31 +0200)]
hwmon: (it87) Move conversion functions
Move conversion functions until after structure defintions. This is
needed for future changes which make use of the structures in the
conversion funtcions.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Jean Delvare [Thu, 28 Oct 2010 18:31:50 +0000 (20:31 +0200)]
hwmon: Remove many EXPERIMENTAL flags
Remove the dependency on EXPERIMENTAL for all drivers which are in
the kernel tree for a long time, are known to work properly and for
which we have documentation.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Corentin Labbe <corentin.labbe@geomatys.fr>
Cc: Riku Voipio <riku.voipio@iki.fi>
Cc: Juerg Haefliger <juergh@gmail.com>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Jean Delvare [Thu, 28 Oct 2010 18:31:50 +0000 (20:31 +0200)]
hwmon: (lm85) Add support for ADT7468 high-frequency PWM mode
The ADT7468 supports a high-frequency PWM output mode where all PWM
outputs are driven by a 22.5 kHz clock. Add support for this mode, and
document it, as it may surprise the user that setting one PWM output
frequency also affects the other PWM outputs.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Jean Delvare [Thu, 28 Oct 2010 18:31:50 +0000 (20:31 +0200)]
hwmon: (lm85) Document the ADT7468 as supported
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Jean Delvare [Thu, 28 Oct 2010 18:31:50 +0000 (20:31 +0200)]
hwmon: (lm85) Fix ADT7468 frequency table
The ADT7468 uses the same frequency table as the ADT7463.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: stable@kernel.org
Cc: Darrick J. Wong <djwong@us.ibm.com>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Jean Delvare [Thu, 28 Oct 2010 18:31:50 +0000 (20:31 +0200)]
hwmon: I2C addresses are constant
We can mark normal_i2c const. Almost all drivers do that already, so
fix the 3 remaining ones before they are used as (bad) examples for
new drivers.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: George Joseph <george.joseph@fairview5.com>
Reviewed-by: Guenter Roeck <guenter.roeck@ericsson.com>
Jean Delvare [Thu, 28 Oct 2010 18:31:50 +0000 (20:31 +0200)]
Move ams driver to macintosh
The ams driver isn't a hardware monitoring driver, so it shouldn't
live under driver/hwmon. drivers/macintosh seems much more
appropriate, as the driver is only useful on PowerBooks and iBooks.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: Stelian Pop <stelian@popies.net>
Cc: Michael Hanselmann <linux-kernel@hansmi.ch>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Jean Delvare [Thu, 28 Oct 2010 18:31:50 +0000 (20:31 +0200)]
hwmon: (pcf8591) Don't attempt to detect devices
The PCF8591 can't be detected, don't even try. There are plenty of
other means to instantiate i2c devices these days.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Reviewed-by: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Jean Delvare [Thu, 28 Oct 2010 18:31:49 +0000 (20:31 +0200)]
hwmon: (pcf8591) Register as a hwmon device
Register PCF8591 devices as hwmon devices. There's little point in
implementing the standard sysfs interface if we don't register it in
a way libsensors will pick it.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Reviewed-by: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Jean Delvare [Thu, 28 Oct 2010 18:31:49 +0000 (20:31 +0200)]
hwmon: (w83795) Use standard attributes for chassis intrusion
Follow the standard attribute naming for the chassis intrusion
feature. I couldn't test the beeping (my board apparently doesn't do
that) but the alarm works fine.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Jean Delvare [Thu, 28 Oct 2010 18:31:49 +0000 (20:31 +0200)]
hwmon: (w83795) Exclude fan control feature by default
The fan control feature of the w83795 driver is insufficiently
reviewed and tested for public consumption at this time, so make it
optional and disabled by default. We will change the default when
review and testing is deemed sufficient. Ultimately the option will
go away.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Jean Delvare [Thu, 28 Oct 2010 18:31:49 +0000 (20:31 +0200)]
hwmon: (w83795) Add myself as co-author and maintainer
I've made so many changes to the w83795 driver that it's only fair to
list myself as a co-author. I'll also maintain the driver for some
time. There's more work needed on the driver for sure.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Jean Delvare [Thu, 28 Oct 2010 18:31:49 +0000 (20:31 +0200)]
hwmon: (w83795) More style cleanups
Cleanups suggested by Guenter Roeck, falling into 4 categories:
* Swapping test orders, because if (var == CONSTANT) is much easier to
read than if (CONSTANT == var).
* Simplifying comparisons with 0.
* Dropping unneeded masks.
* Dropping unneeded parentheses and curly braces.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Jean Delvare [Thu, 28 Oct 2010 18:31:49 +0000 (20:31 +0200)]
hwmon: (w83795) Fix LSB reading of voltage limits
Wrong index caused the wrong register value to be read, resulting in
random LSB for voltage limits.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Jean Delvare [Thu, 28 Oct 2010 18:31:49 +0000 (20:31 +0200)]
hwmon: (w83795) Use dev_get_drvdata() where possible
When we don't need the client pointer, calling dev_get_drvdata() is
more efficient that calling to_i2c_client() and then
i2c_get_clientdata().
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Jean Delvare [Thu, 28 Oct 2010 18:31:48 +0000 (20:31 +0200)]
hwmon: (w83795) Delay reading pwm config registers
Wait until we need the pwm config register values, instead of
pre-reading them. This saves over 1 second on modprobe on my test
system.
Obviously this time is added when first accessing pwm config
attributes, however not everybody will use them, so it seems unfair
to slow down driver loading (and thus boot) for an optional feature.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Jean Delvare [Thu, 28 Oct 2010 18:31:48 +0000 (20:31 +0200)]
hwmon: (w83795) Delay reading limit registers
Wait until we need the limit register values, instead of pre-reading
them. This saves 544 ms on modprobe on my test system. Obviously this
time is added when first running "sensors" or any other monitoring
application, but I think it is better than slowing down the boot.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Jean Delvare [Thu, 28 Oct 2010 18:31:48 +0000 (20:31 +0200)]
hwmon: (w83795) Move register reads to dedicated functions
Move initial register reads out of probe, to dedicated functions.
This makes the code clearer, and will be needed if we want to delay
calling these functions until they are needed, or want to call them
periodically.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Jean Delvare [Thu, 28 Oct 2010 18:31:48 +0000 (20:31 +0200)]
hwmon: (w83795) Pack similar register reads
Pack similar register reads using for loops.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Jean Delvare [Thu, 28 Oct 2010 18:31:48 +0000 (20:31 +0200)]
hwmon: (w83795) Make W83795_REG_PWM more efficient
Cascaded conditionals are inefficient. Reorder the fields so that
PWM register addresses can be computed more efficiently.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Jean Delvare [Thu, 28 Oct 2010 18:31:48 +0000 (20:31 +0200)]
hwmon: (w83795) Don't pre-read values we'll update later
There is no point in reading registers during initialization if we
will refresh the values in the update function later. This is only
slowing down the driver loading with no benefit, stop doing it.
This change saves 480 ms on driver load on my test system.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Jean Delvare [Thu, 28 Oct 2010 18:31:48 +0000 (20:31 +0200)]
hwmon: (w83795) Simplify temperature sensor type handling
All 3 temperature sensor type sysfs functions (show_temp_mode,
store_temp_mode and show_dts_mode) can be simplified. We don't
create these files when the correponding input isn't in temperature
monitoring mode, so there is no point in handling that case.
Likewise, we don't allow changing inputs from temperature to voltage,
so the code handling this case is dead and can be removed.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Jean Delvare [Thu, 28 Oct 2010 18:31:48 +0000 (20:31 +0200)]
hwmon: (w83795) Drop _NUM constants
Consistently use ARRAY_SIZE() to control for loops.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Jean Delvare [Thu, 28 Oct 2010 18:31:48 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:47 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:47 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:47 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:47 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:47 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:47 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:47 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:47 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:46 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:46 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:46 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:46 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:46 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:46 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:46 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:46 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:45 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:45 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:45 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:45 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:45 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:45 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:45 +0000 (20:31 +0200)]
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>
Jean Delvare [Thu, 28 Oct 2010 18:31:45 +0000 (20:31 +0200)]
hwmon: (w83795) Misc cleanups
* Improve driver description.
* Drop unused macro.
* Drop unreachable code.
Signed-off-by: Jean Delvare <khali@linux-fr.org>