GitHub/mt8127/android_kernel_alcatel_ttab.git
16 years agoUSB: ftdi-elan: Always pass usb_bulk_msg() a timeout in milliseconds.
Sarah Sharp [Mon, 29 Sep 2008 17:58:35 +0000 (10:58 -0700)]
USB: ftdi-elan: Always pass usb_bulk_msg() a timeout in milliseconds.

The kernel doc for usb_bulk_msg() says the timeout for a bulk message should be
specified in milliseconds.  The ftdi-elan driver converts milliseconds to
jiffies before passing the timeout to usb_bulk_msg().  This is mostly harmless,
since it will just lead to very long timeouts, but was obviously not the intent
of the original author.

Signed-off-by: Sarah Sharp <sarah.a.sharp@intel.com>
Acked-by: Tony Olech <tony.olech@elandigitalsystems.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: isp1760: Use an IS_ERR test rather than a NULL test
Julien Brunel [Wed, 24 Sep 2008 16:00:36 +0000 (18:00 +0200)]
USB: isp1760: Use an IS_ERR test rather than a NULL test

In case of error, the function isp1760_register returns an ERR
pointer, but never returns a NULL pointer. So after a call to this
function, a NULL test should be replaced by an IS_ERR test. Moreover,
we have noticed that:
(1) the result of isp1760_register is assigned through the function
pci_set_drvdata without an error test,
(2) if the call to isp1760_register fails, the current function
(isp1761_pci_probe) returns 0, and if it succeeds, it returns -ENOMEM,
which seems odd.

Thus, we suggest to move the test before the call to pci_set_drvdata
to correct (1), and to turn it into a non IS_ERR test to correct (2).

The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@bad_null_test@
expression x,E;
statement S1, S2;
@@
x =  isp1760_register(...)
... when != x = E
* if (x == NULL)
S1 else S2
// </smpl>

Signed-off-by: Julien Brunel <brunel@diku.dk>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: improve ehci_watchdog's side effect in CPU power management
Yi Yang [Thu, 25 Sep 2008 09:25:44 +0000 (17:25 +0800)]
USB: improve ehci_watchdog's side effect in CPU power management

ehci_watchdog will wake up CPU very frequently so that CPU
stays at C3 very short, average residence time is about 50
ms on Aspire One, but we expect it should be about 1 second
or more, so this kind of periodic timer is very bad for power
saving.

We can't remove this timer because of some bad USB controller
chipset, but at least we should reduce its side effect to as
possible as low.

This patch can make CPU stay at C3 longer, average residence time
is about twice as long as original.

Please consider to apply it, thanks

Signed-off-by: Yi Yang <yi.y.yang@intel.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: UHCI: improve scheduling of interrupt URBs
Alan Stern [Thu, 25 Sep 2008 20:59:57 +0000 (16:59 -0400)]
USB: UHCI: improve scheduling of interrupt URBs

This patch (as1140) adds a little intelligence to the interrupt-URB
scheduler in uhci-hcd.  Right now the scheduler is stupid; every URB
having the same period is assigned to the same slot.  Thus a large
group of period-N URBs can fill their slot and cause -ENOSPC errors
even when all the lower-period slots are empty.

With the patch, if an URB doesn't fit in its assigned slot then the
scheduler will try using lower-period slots.  This will provide
greater flexibility.  As an example, the driver will be able to handle
more than just three or four mice, which the current driver cannot.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: ti_usb_3410_5052: removed duplicated include
Huang Weiyi [Thu, 25 Sep 2008 05:11:28 +0000 (13:11 +0800)]
USB: ti_usb_3410_5052: removed duplicated include

Removed duplicated #include <linux/firmware.h> in
drivers/usb/serial/ti_usb_3410_5052.c.

Signed-off-by: Huang Weiyi <hwy@cn.fujitsu.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb: vstusb.c : new driver for spectrometers used by Vernier Software & Technology...
Stephen Ware [Tue, 30 Sep 2008 18:39:38 +0000 (11:39 -0700)]
usb: vstusb.c : new driver for spectrometers used by Vernier Software & Technology, Inc.

This patch adds the vstusb driver to the drivers/usb/misc directory.
This driver provides support for Vernier Software & Technology
spectrometers, all made by Ocean Optics. The driver provides both IOCTL
and read()/write() methods for sending raw data to spectrometers across
the bulk channel. Each method allows for a configured timeout.

From: Stephen Ware <stephen.ware@eqware.net>
Signed-off-by: Dennis O'Brien <dennis.obrien@eqware.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb gadget: cdc ethernet notification bugfix
David Brownell [Sun, 7 Sep 2008 04:33:49 +0000 (21:33 -0700)]
usb gadget: cdc ethernet notification bugfix

Bugfix for the new CDC Ethernet code:  as part of activating the
network interface's USB link, make sure its link management code
knows whether the interface is open or not.

Without this fix, the link won't work right when it's brought up
before the link is active ... because the initial notification it
sends will have the wrong link state (down, not up).  Makes it
hard to bridge these links (on the host side), among other things.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: stable <stable@kernel.org> [2.6.27]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: omap_udc: sync with OMAP tree
Tony Lindgren [Thu, 4 Sep 2008 23:25:14 +0000 (16:25 -0700)]
USB: omap_udc: sync with OMAP tree

Sync up USB parts of the omap_udc support in mainline with the OMAP tree.
This patch addresses some OMAP2 differences ... there's another, with
respect to the double-buffering issue with PIO-IN in omap_ep_setup()
(which is now out of sync with the comments), but it's not clear right
now how to address that.

From: Tony Lindgren <tony@atomide.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: ohci-omap: handle other omap15xx chips
Tony Lindgren [Thu, 4 Sep 2008 23:29:55 +0000 (16:29 -0700)]
USB: ohci-omap: handle other omap15xx chips

Sync up USB parts of the ohci-omap support in mainline with the OMAP tree.
This patch supports another first generation OMAP1 part: not just the
OMAP 1510 (and its catalog version, the OMAP 5910), but also OMAP 310.

From: Tony Lindgren <tony@atomide.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb: musb: remove dead code from procfs
Felipe Balbi [Thu, 11 Sep 2008 08:53:25 +0000 (11:53 +0300)]
usb: musb: remove dead code from procfs

When removing the procfs file, I forgot to remove some
code that created and removed that file. Here's a patch
to fix it. Ideally this patch will be melded into the patch
removing the procfs file, don't know if it's possible still.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb: musb: general cleanup to musbhsdma.c
Felipe Balbi [Thu, 11 Sep 2008 08:53:24 +0000 (11:53 +0300)]
usb: musb: general cleanup to musbhsdma.c

Basically getting rid of CaMeLcAsE, but also adding
missing lines and spaces.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb: musb_hdrc build fixes
David Brownell [Thu, 11 Sep 2008 08:53:23 +0000 (11:53 +0300)]
usb: musb_hdrc build fixes

Minor musb_hdrc updates:

  - so it'll build on DaVinci, given relevant platform updates;
      * remove support for an un-shipped OTG prototype
      * rely on gpiolib framework conversion for the I2C GPIOs
      * the <asm/arch/hdrc_cnf.h> mechanism has been removed

  - catch comments up to the recent removal of the per-SOC header
    with the silicon configuration data;

  - and remove two inappropriate "inline" declarations which
    just bloat host side code.

There are still some more <asm/arch/XYZ.h> ==> <mach/XYZ.h>
changes needed in this driver, catching up to the relocation
of most of the include/asm-arm/arch-* contents.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Cc: stable <stable@kernel.org> [2.6.27]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb: musb: do not mess up count number and CSR0 register value
Bryan Wu [Thu, 11 Sep 2008 08:53:22 +0000 (11:53 +0300)]
usb: musb: do not mess up count number and CSR0 register value

Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoOMAP:MUSB: Corrects urb unlink function path
Ajay Kumar Gupta [Thu, 11 Sep 2008 08:53:21 +0000 (11:53 +0300)]
OMAP:MUSB: Corrects urb unlink function path

Fixes kernel panic while ISO IN transfer is aborted.Replaced
usb_hcd_unlink_urb_from_ep() from musb_giveback() to __musb_giveback()
to make sure urb is unlinked before giveback when __musb_giveback() is
called from musb_urb_dequeue().

Acquired musb->lock() before usb_hcd_unlink_urb_from_ep() within in
enqueue path.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoOMAP:MUSB: Fixes the TT programming.
Ajay Kumar Gupta [Thu, 11 Sep 2008 08:53:20 +0000 (11:53 +0300)]
OMAP:MUSB: Fixes the TT programming.

Fixes enumeration failures when a USB device attached to a LS hub is
connected to OMAP EVM via HS hub. This is fixed by correctly
programming hub address register in enqueue path.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agomusb: io: only define read/write stubs if they're not defined yet
Felipe Balbi [Thu, 11 Sep 2008 08:53:19 +0000 (11:53 +0300)]
musb: io: only define read/write stubs if they're not defined yet

For those archs which don't provide read/write friends we
provide our own implementation so musb driver won't break
compilation.

This is temporary fix until a better solution comes from
upstream. Idealy, <linux/io.h> would provide those calls
if the architecture did not provide them yet. In that case
being possible to remove all those stubs from musb_io.h

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Fix s3c2410_udc usb speed handling
Yauhen Kharuzhy [Fri, 12 Sep 2008 16:02:23 +0000 (09:02 -0700)]
USB: Fix s3c2410_udc usb speed handling

The new composite framework revealed a weakness in the
s3c2410_udc driver gadget register function. Instead of
checking if speed asked for was USB_LOW_SPEED upon
usb_gadget_register() to deny service, it checked only
for USB_FULL_SPEED, thus denying service to usb high
speed capable gadgets (like g_ether).

Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb gadget: USB_GADGET_VBUS_DRAW Kconfig option
David Brownell [Fri, 12 Sep 2008 16:39:06 +0000 (09:39 -0700)]
usb gadget: USB_GADGET_VBUS_DRAW Kconfig option

Offer a "how much VBUS power to request" configuration option
for USB gadgets that aren't using board-specific customization
of their gadget or (composite) configuration drivers.

Also remove a couple pointless "depends on USB_GADGET" bits
from the Kconfig text; booleans inside an "if USB_GADGET" will
already have that dependency.

Based on a patch from Justin Clacherty.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Justin Clacherty <justin@redfish-group.com>
Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoMUSB: Add sanity check for maximum number of endpoints
Kevin Hilman [Mon, 15 Sep 2008 10:09:31 +0000 (12:09 +0200)]
MUSB: Add sanity check for maximum number of endpoints

There is no check if platform code passes in more endpoints (num_eps)
than the maximum number of enpoints (MUSB_C_NUM_EPS.)  The result is
that allocate_instance() happily writes past the end of 'struct musb'
corrupting memory.

This patch adds a BUG() if the platform code requests more than the max.

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Acked-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb: remove code associated with !CONFIG_PPC_MERGE
Kumar Gala [Mon, 22 Sep 2008 22:00:07 +0000 (15:00 -0700)]
usb: remove code associated with !CONFIG_PPC_MERGE

Now that arch/ppc is gone we don't need CONFIG_PPC_MERGE anymore remove
the dead code associated with !CONFIG_PPC_MERGE.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousbmon: fix tiny race exposed by the fastboot patches
Arjan van de Ven [Mon, 22 Sep 2008 22:00:10 +0000 (15:00 -0700)]
usbmon: fix tiny race exposed by the fastboot patches

usbmon registers the notifier chain, takes the bus lock and then goes to
scan the existing devices for hooking up.

Unfortunately, if usb_mon gets initialized while USB bus discovery is
going on, it's possible that usbmon gets a notifier on one cpu (which runs
without USB locks), and the scan is going on and also finds the new bus,
resulting in a double sysfs registration, which then produces a WARNING.

Pete Zaitcev did the bug diagnostics on this one

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: change hub initialization sleeps to delayed_work
Alan Stern [Mon, 22 Sep 2008 18:44:26 +0000 (14:44 -0400)]
USB: change hub initialization sleeps to delayed_work

This patch (as1137) changes the hub_activate() routine, replacing the
power-power-up and debounce delays with delayed_work calls.  The idea
is that on systems where the USB stack is compiled into the kernel
rather than built as modules, these delays will no longer block the
boot thread.  At least 100 ms is saved for each root hub, which can
add up to a significant savings in total boot time.

Arjan van de Ven was very pleased to see that this shaved 700 ms off
his computer's boot time.  Since his total boot time is on the order
of two seconds, the improvement is considerable.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: ehci-dbg: fix reading less content of periodic file
Ming Lei [Thu, 18 Sep 2008 15:06:38 +0000 (23:06 +0800)]
USB: ehci-dbg: fix reading less content of periodic file

This patch fix 2 problems about reading periodic file:

1. The "..." after a interrupt qh is missed because buffer pointer is
   not moved.

2. After setting p.ptr as NULL, its next qh or itd will be omited and
   can't be stored in debug buffer.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: ehci-dbg: increase debug buffer size for periodic file
Ming Lei [Thu, 18 Sep 2008 15:06:21 +0000 (23:06 +0800)]
USB: ehci-dbg: increase debug buffer size for periodic file

This patch is based on the following ideas:

1. Some usb devices (such as usb video class) have endpoints of high
   interval attribute, so reading "periodic" file need more debug buffer
   to accommodate the qh or itd schedule information.  For example, 4KB
   buffer is not enough for a single interrupt qh of 2ms period.

2. print a %p need 16 byte buffer on 64-bits arch, but 8 byte on 32-bits
   arch. Add a extra bonus for 64-bits arch.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb: gadget: workaround storage command size issues
Felipe Balbi [Thu, 18 Sep 2008 23:00:02 +0000 (02:00 +0300)]
usb: gadget: workaround storage command size issues

Try to workaround issues with bad SCSI implementations
by ignoring the command size error.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: g_printer: fix handling zero-length packet
SangSu Park [Mon, 22 Sep 2008 22:41:15 +0000 (15:41 -0700)]
USB: g_printer: fix handling zero-length packet

g_printer doesn't have to check whether the data size is a multiple of
MaxPacketSize, because device controller driver already make that check.

Signed-off-by: SangSu Park<sangsu@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: David Brownell <david-b@pacbell.net>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Fix spelling in usb/serial.h
Geoff Levand [Sat, 20 Sep 2008 21:41:47 +0000 (14:41 -0700)]
USB: Fix spelling in usb/serial.h

Fixes a minor typo in the comments for usb_set_serial_data.

Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Fix doc for usb_autopm_enable
Geoff Levand [Sat, 20 Sep 2008 21:41:47 +0000 (14:41 -0700)]
USB: Fix doc for usb_autopm_enable

Correct errors in the descriptions for usb_autopm_enable
and usb_autopm_disable in the USB PM doc.

Signed-off-by: Geoff Levand <geoff@infradead.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB Serial: Sierra: debug message fix
Kevin Lloyd [Wed, 17 Sep 2008 04:05:24 +0000 (21:05 -0700)]
USB Serial: Sierra: debug message fix

This patch moves dbg calls to dev_dbg where possible. It also fixes some
issues with a previous submission aiming to do the same thing.

Signed-off-by: Kevin Lloyd <klloyd@sierrawireless.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: RESET_RESUME needs to block autosuspend when remote wakeup is needed
Oliver Neukum [Mon, 15 Sep 2008 15:29:28 +0000 (17:29 +0200)]
USB: RESET_RESUME needs to block autosuspend when remote wakeup is needed

Reset upon resumption will wipe the input buffer and is therefore
a reason to not suspend if remote wakeup is requested because
the driver needs that data.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: ftdi_sio: fix 'product' parameter description
Paulius Zaleckas [Wed, 10 Sep 2008 14:18:46 +0000 (17:18 +0300)]
USB: ftdi_sio: fix 'product' parameter description

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb core: fix USB_OTG_BLACKLIST_HUB typo
Peter Korsgaard [Mon, 8 Sep 2008 08:14:47 +0000 (10:14 +0200)]
usb core: fix USB_OTG_BLACKLIST_HUB typo

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Documentation/usb/anchors.txt #2
Oliver Neukum [Tue, 2 Sep 2008 12:16:11 +0000 (14:16 +0200)]
USB: Documentation/usb/anchors.txt #2

This adds Documentation for the extensions of the anchor API.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoOHCI: Allow broken controllers to auto-stop
Alan Stern [Wed, 3 Sep 2008 20:38:32 +0000 (16:38 -0400)]
OHCI: Allow broken controllers to auto-stop

This patch (as1134) attempts to improve the way we handle OHCI
controllers with broken Root Hub Status Change interrupt support.  In
these controllers the RHSC interrupt bit essentially never turns off,
making RHSC interrupts useless -- they have to remain permanently
disabled.

Such controllers should still be allowed to turn off their root hubs
when no devices are attached.  Polling for new connections can
continue while the root hub is suspended.  The patch implements this
feature.  (It won't have much effect unless CONFIG_PM is enabled and
CONFIG_USB_SUSPEND is disabled, but since the overhead is very small
we may as well do it.)

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb-storage: report underflow with no sense data
Alan Stern [Tue, 2 Sep 2008 14:12:11 +0000 (10:12 -0400)]
usb-storage: report underflow with no sense data

This patch (as1118) addresses a problem with certain USB mass-storage
devices.  These devices sometimes return less data than asked for and
then provide no sense data to explain the problem.  Currently
usb-storage leaves it up to the SCSI layer to decide how this should
be handled, and the SCSI layer interprets the lack of sense data to
mean that nothing went wrong.  But if we got less data than required
then something definitely _did_ go wrong, and we should say so.

The patch tells the SCSI layer to retry the command when this sort of
thing happens.  Retrying may not solve the underlying problem, but
it's better than believing that data was transferred when it wasn't.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb: add Freescale QE/CPM USB peripheral controller driver
Li Yang [Tue, 2 Sep 2008 11:58:10 +0000 (19:58 +0800)]
usb: add Freescale QE/CPM USB peripheral controller driver

Some of Freescale SoC chips have a QE or CPM co-processor which
supports full speed USB.  The driver adds device mode support
of both QE and CPM USB controller to Linux USB gadget.  The
driver is tested with MPC8360 and MPC8272, and should work with
other models having QE/CPM given minor tweaks.

Signed-off-by: Xie Xiaobo <X.Xie@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: drivers/usb/misc: Use an IS_ERR test rather than a NULL test
Julien Brunel [Mon, 1 Sep 2008 08:57:27 +0000 (10:57 +0200)]
USB: drivers/usb/misc: Use an IS_ERR test rather than a NULL test

In case of error, the function backlight_device_register returns an
ERR pointer, but never returns a NULL pointer. So a NULL test that may
come after a call to this function should be strengthened by an IS_ERR
test.

The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@match_bad_null_test@
expression x, E;
statement S1,S2;
@@
x = backlight_device_register(...)
... when != x = E
* if (x != NULL)
S1 else S2
// </smpl>

Signed-off-by: Julien Brunel <brunel@diku.dk>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: remove unused #include <version.h>
Huang Weiyi [Sat, 23 Aug 2008 05:56:30 +0000 (13:56 +0800)]
USB: remove unused #include <version.h>

The driver(s) below do not use LINUX_VERSION_CODE nor KERNEL_VERSION.
  drivers/usb/gadget/pxa27x_udc.c

This patch removes the said #include <version.h>.

Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb gadget: defer obex enumeration
David Brownell [Tue, 19 Aug 2008 00:45:25 +0000 (17:45 -0700)]
usb gadget: defer obex enumeration

Some USB peripheral controller drivers support software control
over the data pullup.  Use those controls to prevent the OBEX
function from enumerating until the userspace server has opened
the /dev/ttyGS* node it will use to implement protocol chitchat
with the USB host.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb gadget: cdc obex glue
Felipe Balbi [Tue, 19 Aug 2008 00:39:30 +0000 (17:39 -0700)]
usb gadget: cdc obex glue

The following patch introduces a new f_obex.c function driver.
It allows userspace obex servers to use usb as transport layer
for their messages.

[ dbrownell@users.sourceforge.net: various fixes and cleanups ]

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb gadget: function activation/deactivation
David Brownell [Tue, 19 Aug 2008 00:38:22 +0000 (17:38 -0700)]
usb gadget: function activation/deactivation

Add a new mechanism to the composite gadget framework, letting
functions deactivate (and reactivate) themselves.  Think of it
as a refcounted wrapper for the software pullup control.

A key example of why to use this mechanism involves functions that
require a userspace daemon.  Those functions shuld use this new
mechanism to prevent the gadget from enumerating until those daemons
are activated.  Without this mechanism, hosts would see devices that
malfunction until the relevant daemons start.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: gadget: net2280: implement set_wedge
Alan Stern [Thu, 14 Aug 2008 19:49:11 +0000 (15:49 -0400)]
USB: gadget: net2280: implement set_wedge

This patch (as1132) implements the set_wedge() method for net2280.
This method is necessary for strict USBCV compliance in
g_file_storage.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: gadget: dummy_hcd: implement set_wedge
Alan Stern [Thu, 14 Aug 2008 19:48:30 +0000 (15:48 -0400)]
USB: gadget: dummy_hcd: implement set_wedge

This patch (as1131) implements the set_wedge() method for dummy_hcd.
This method is necessary for strict USBCV compliance in
g_file_storage.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb: gadget Kconfig cleanup
David Brownell [Fri, 15 Aug 2008 00:04:48 +0000 (17:04 -0700)]
usb: gadget Kconfig cleanup

This reorders the list of USB peripheral controller drivers so it's
more common for the initial (default) value to be relevant:  put the
SOC integrated silicon up front, discrete stuff last.  Alphabetize.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Let some USB host controllers get IRQ flags from resource
Marc Zyngier [Mon, 18 Aug 2008 11:08:42 +0000 (13:08 +0200)]
USB: Let some USB host controllers get IRQ flags from resource

[This version fixes a thinko in the r8a66597 driver]

This patch let a few discrete USB host controllers drivers (isp116x-hcd,
r8a66597-hcd and sl811-hcd) obtain IRQ flags from their IORESOURCE_IRQ
resource if configured as such, much like it's been done for the smc91x
driver.

It spares people writing support for specific boards the burden to
configure the interrupt controller independantly, and keeps all IRQ
related information in a single resource.

HCD that are integrally part of a SoC have been left aside, as there
is probably no "wiring" options...

Tested on an Xscale PXA-255 based platform with isp116x-hcd.

Signed-off-by: Marc Zyngier <marc.zyngier@altran.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoub: remove sg_stat
Pete Zaitcev [Mon, 4 Aug 2008 23:15:40 +0000 (17:15 -0600)]
ub: remove sg_stat

Remove forgotten code related to sg_stat[].

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: extend poisoning to anchors
Oliver Neukum [Tue, 29 Jul 2008 14:18:47 +0000 (16:18 +0200)]
USB: extend poisoning to anchors

this extends the poisoning concept to anchors. This way poisoning
will work with fire and forget drivers.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: kill URBs permanently
Oliver Neukum [Tue, 29 Jul 2008 13:26:15 +0000 (15:26 +0200)]
USB: kill URBs permanently

looking at usb_kill_urb() it seems to me that it is unnecessarily lenient.
In the use case of disconnect() you never want to use the URB again
(for the same device) But leaving urb->reject elevated will make it easier
to avoid races between read/write and disconnect.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agodrivers/usb/class/usblp.c: adjust error handling code
Julia Lawall [Wed, 16 Jul 2008 16:00:42 +0000 (18:00 +0200)]
drivers/usb/class/usblp.c: adjust error handling code

In this code, it is possible to tell statically whether usblp will be NULL
in the error handling code.

Oliver Neukum suggested to make a goto to the final return rather than
return directly.

The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
identifier f,err,l,l1;
type T;
expression x,E;
statement S;
@@

x = NULL
... when != goto l1;
* x = f(...)
... when != x
err = E;
goto l;
...
* if (x != NULL)
  S
return err;
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: add USB test and measurement class driver
Greg Kroah-Hartman [Tue, 26 Aug 2008 23:22:06 +0000 (16:22 -0700)]
USB: add USB test and measurement class driver

This driver was originaly written by Stefan Kopp, but massively
reworked by Greg for submission.

Thanks to Felipe Balbi <me@felipebalbi.com> for lots of work in cleaning
up this driver.

Thanks to Oliver Neukum <oliver@neukum.org> for reviewing previous
versions and pointing out problems.

Cc: Stefan Kopp <stefan_kopp@agilent.com>
Cc: Marcel Janssen <korgull@home.nl>
Cc: Felipe Balbi <me@felipebalbi.com>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Added driver for a Delcom USB 7-segment LED Display
Harrison Metzger [Thu, 14 Aug 2008 16:29:32 +0000 (11:29 -0500)]
USB: Added driver for a Delcom USB 7-segment LED Display

Added basic support for a Delcom USB 7-segment LED Display

Signed-off by: Harrison Metzger <harrisonmetz@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Add Oceanic product ID to ftdi_sio
Vladimir Vukicevic [Sat, 4 Oct 2008 00:08:43 +0000 (17:08 -0700)]
USB: Add Oceanic product ID to ftdi_sio

Add Oceanic PID to ftdi_sio driver

Oceanic dive computers (such as the VT3 --
http://www.oceanicworldwide.com/p_computers_vt3.html) all use an onboard
FTDI serial converter, with the FTDI vid and a  PID of 0xf460.  The
attached patch adds that pid to ftdi_sio; driver  connects to my VT3
after that.

Signed-off-by: Vladimir Vukicevic <vladimir@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: option.c remove duplicate device ids now supported in hso.c
Denis Joseph Barrow [Tue, 30 Sep 2008 14:49:22 +0000 (16:49 +0200)]
USB: option.c remove duplicate device ids now supported in hso.c

Remove duplicate device ids which are now supported by drivers/usb/net/hso.c

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: option: add Ericsson F3507g and Dell 5530
Dan Williams [Wed, 24 Sep 2008 15:49:19 +0000 (11:49 -0400)]
USB: option: add Ericsson F3507g and Dell 5530

Add a few more mobile broadband cards.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
Linus Torvalds [Fri, 17 Oct 2008 16:50:12 +0000 (09:50 -0700)]
Merge git://git./linux/kernel/git/gregkh/staging-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (25 commits)
  staging: at76_usb wireless driver
  Staging: workaround build system bug
  Staging: Lindent sxg.c
  Staging: SLICOSS: Call pci_release_regions at driver exit
  Staging: SLICOSS: Fix remaining type names
  Staging: SLICOSS: Fix warnings due to static usage
  Staging: SLICOSS: lots of checkpatch fixes
  Staging: go7007 v4l fixes
  Staging: Fix gcc warnings in sxg
  Staging: add echo cancelation module
  Staging: add wlan-ng prism2 usb driver
  Staging: add w35und wifi driver
  Staging: USB/IP: add host driver
  Staging: USB/IP: add client driver
  Staging: USB/IP: add common functions needed
  Staging: add the go7007 video driver
  Staging: add me4000 pci data collection driver
  Staging: add me4000 firmware files
  Staging: add sxg network driver
  Staging: add Alacritech slicoss network driver
  ...

Fixed up conflicts due to taint flags changes and MAINTAINERS cleanup in
MAINTAINERS, include/linux/kernel.h and kernel/panic.c.

16 years agoMerge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
Linus Torvalds [Fri, 17 Oct 2008 16:33:39 +0000 (09:33 -0700)]
Merge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6

* 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6: (47 commits)
  hwmon: (adm1026) Prevent log spamming
  hwmon: (adm1026) Fix debug messages
  hwmon: (adm1029) Use mask for fan_div value
  hwmon: (adt7470) Add documentation
  hwmon: (ibmaem) Automatically load on IBM systems via DMI
  hwmon: (ibmpex) Automatically load on IBM systems via DMI
  hwmon: (w83781d) Use new style driver binding
  hwmon: (w83781d) Stop abusing struct i2c_client for ISA devices
  hwmon: (w83781d) Make ISA interface depend on CONFIG_ISA
  hwmon: (w83781d) Additional information about AS99127F PWM
  hwmon: (w83781d) Detect alias chips
  hwmon: (w83781d) Refactor beep enable handling
  hwmon: Drop dead links to old National Semiconductor chip datasheets
  hwmon: (w83791d) add support for thermal cruise mode
  hwmon: (w83791d) add pwm_enable support
  hwmon: (w83791d) add manual PWM support
  hwmon: (w83791d) fan 4/5 pins can also be used for gpio
  hwmon: (max1619) Use inline functions instead of macros
  hwmon: (it87) Fix thermal sensor type values
  hwmon: (lm78) Convert to a new-style i2c driver
  ...

16 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
Linus Torvalds [Fri, 17 Oct 2008 16:30:35 +0000 (09:30 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/tiwai/sound-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: Fix debugfs_create_dir's error checking method for sound/soc/
  ALSA: ASoC: Convert playpaq_wm8510 to bulk route registration API
  ALSA: kernel docs: fix sound/core/ kernel-doc
  ALSA: Handle NULL jacks in snd_jack_report()
  ALSA: hda - Fix PCM type of Nvidia HDMI devices

16 years agoMerge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
Linus Torvalds [Fri, 17 Oct 2008 16:29:55 +0000 (09:29 -0700)]
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
  block: remove __generic_unplug_device() from exports
  block: move q->unplug_work initialization
  blktrace: pass zfcp driver data
  blktrace: add support for driver data
  block: fix current kernel-doc warnings
  block: only call ->request_fn when the queue is not stopped
  block: simplify string handling in elv_iosched_store()
  block: fix kernel-doc for blk_alloc_devt()
  block: fix nr_phys_segments miscalculation bug
  block: add partition attribute for partition number
  block: add BIG FAT WARNING to CONFIG_DEBUG_BLOCK_EXT_DEVT
  softirq: Add support for triggering softirq work on softirqs.

16 years agoMerge branch 'for-linus' of git://www.jni.nu/cris
Linus Torvalds [Fri, 17 Oct 2008 16:09:48 +0000 (09:09 -0700)]
Merge branch 'for-linus' of git://www.jni.nu/cris

* 'for-linus' of git://www.jni.nu/cris:
  CRIS: proper defconfig setup
  [CRIS] Rename boot-linkscripts and fix the path to them.

16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
Linus Torvalds [Fri, 17 Oct 2008 16:00:23 +0000 (09:00 -0700)]
Merge git://git./linux/kernel/git/jejb/scsi-misc-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (39 commits)
  [SCSI] sd: fix compile failure with CONFIG_BLK_DEV_INTEGRITY=n
  libiscsi: fix locking in iscsi_eh_device_reset
  libiscsi: check reason why we are stopping iscsi session to determine error value
  [SCSI] iscsi_tcp: return a descriptive error value during connection errors
  [SCSI] libiscsi: rename host reset to target reset
  [SCSI] iscsi class: fix endpoint id handling
  [SCSI] libiscsi: Support drivers initiating session removal
  [SCSI] libiscsi: fix data corruption when target has to resend data-in packets
  [SCSI] sd: Switch kernel printing level for DIF messages
  [SCSI] sd: Correctly handle all combinations of DIF and DIX
  [SCSI] sd: Always print actual protection_type
  [SCSI] sd: Issue correct protection operation
  [SCSI] scsi_error: fix target reset handling
  [SCSI] lpfc 8.2.8 v2 : Add statistical reporting control and additional fc vendor events
  [SCSI] lpfc 8.2.8 v2 : Add sysfs control of target queue depth handling
  [SCSI] lpfc 8.2.8 v2 : Revert target busy in favor of transport disrupted
  [SCSI] scsi_dh_alua: remove REQ_NOMERGE
  [SCSI] lpfc 8.2.8 : update driver version to 8.2.8
  [SCSI] lpfc 8.2.8 : Add MSI-X support
  [SCSI] lpfc 8.2.8 : Update driver to use new Host byte error code DID_TRANSPORT_DISRUPTED
  ...

16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Linus Torvalds [Fri, 17 Oct 2008 15:58:52 +0000 (08:58 -0700)]
Merge git://git./linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
  net: Remove CONFIG_KMOD from net/ (towards removing CONFIG_KMOD entirely)
  ipv4: Add a missing rcu_assign_pointer() in routing cache.
  [netdrvr] ibmtr: PCMCIA IBMTR is ok on 64bit
  xen-netfront: Avoid unaligned accesses to IP header
  lmc: copy_*_user under spinlock
  [netdrvr] myri10ge, ixgbe: remove broken select INTEL_IOATDMA

16 years agohwmon: (adm1026) Prevent log spamming
Jean Delvare [Fri, 17 Oct 2008 15:51:20 +0000 (17:51 +0200)]
hwmon: (adm1026) Prevent log spamming

When debugging is enabled, the adm1026 driver currently logs the
message "Setting VID from GPIO11-15" 108 times each time you run
"sensors". Once should be enough.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Philip Pokorny <ppokorny@penguincomputing.com>
16 years agohwmon: (adm1026) Fix debug messages
Jean Delvare [Fri, 17 Oct 2008 15:51:20 +0000 (17:51 +0200)]
hwmon: (adm1026) Fix debug messages

* Add missing new-line to one debug message.
* Remove leading colon from 3 debug messages.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Philip Pokorny <ppokorny@penguincomputing.com>
16 years agohwmon: (adm1029) Use mask for fan_div value
Corentin Labbe [Fri, 17 Oct 2008 15:51:20 +0000 (17:51 +0200)]
hwmon: (adm1029) Use mask for fan_div value

This is my patch for testing correct values of fan div in adm1029 and
prevent a division by 0 for some (unlikely) register values.

Signed-off-by: Corentin Labbe <corentin.labbe@geomatys.fr>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (adt7470) Add documentation
Darrick J. Wong [Fri, 17 Oct 2008 15:51:20 +0000 (17:51 +0200)]
hwmon: (adt7470) Add documentation

Add at least the bare minimum of documentation for this chip.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (ibmaem) Automatically load on IBM systems via DMI
Darrick J. Wong [Fri, 17 Oct 2008 15:51:19 +0000 (17:51 +0200)]
hwmon: (ibmaem) Automatically load on IBM systems via DMI

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (ibmpex) Automatically load on IBM systems via DMI
Darrick J. Wong [Fri, 17 Oct 2008 15:51:19 +0000 (17:51 +0200)]
hwmon: (ibmpex) Automatically load on IBM systems via DMI

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (w83781d) Use new style driver binding
Wolfgang Grandegger [Fri, 17 Oct 2008 15:51:19 +0000 (17:51 +0200)]
hwmon: (w83781d) Use new style driver binding

This patch modifies the w83781d driver to use new style driver binding.
Substantial code modifications are required to deal with the new
interface, especially legacy device detection.

[JD: largely edited to make the patch smaller and to get the driver
to work again on ISA devices.]

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (w83781d) Stop abusing struct i2c_client for ISA devices
Jean Delvare [Fri, 17 Oct 2008 15:51:19 +0000 (17:51 +0200)]
hwmon: (w83781d) Stop abusing struct i2c_client for ISA devices

Upcoming changes to the I2C part of the w83781d driver will cause ISA
devices to no longer have a struct i2c_client at hand. So, we must
stop (ab)using it now.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Wolfgang Grandegger <wg@grandegger.com>
16 years agohwmon: (w83781d) Make ISA interface depend on CONFIG_ISA
Wolfgang Grandegger [Fri, 17 Oct 2008 15:51:18 +0000 (17:51 +0200)]
hwmon: (w83781d) Make ISA interface depend on CONFIG_ISA

Probing the ISA bus on systems without ISA bus may hang the system.
This patch makes the ISA bus related code depend on the kernel
configuration parameter CONFIG_ISA. It moves ISA bus related code
into one #ifdef CONFIG_ISA ... #endif block and adds some helper
function.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (w83781d) Additional information about AS99127F PWM
Jean Delvare [Fri, 17 Oct 2008 15:51:18 +0000 (17:51 +0200)]
hwmon: (w83781d) Additional information about AS99127F PWM

This information was provided in lm-sensors ticket #2350:
http://www.lm-sensors.org/ticket/2350

This is IMHO still not enough to be able to safely implement fan
control support for the AS99127F, but this is valuable information so
I am adding it to the documentation.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (w83781d) Detect alias chips
Jean Delvare [Fri, 17 Oct 2008 15:51:18 +0000 (17:51 +0200)]
hwmon: (w83781d) Detect alias chips

The W83781D and W83782D can be accessed either on the I2C bus or the
ISA bus. We must not access the same chip through both interfaces. So
far we were relying on the user passing the correct ignore parameter
to skip the registration of the I2C interface as suggested by
sensors-detect, but this is fragile: the user may load the w83781d
driver without running sensors-detect, and the i2c bus numbers are
not stable across reboots and hardware changes.

So, better detect alias chips in the driver directly, and skip any
I2C chip which is obviously an alias of the ISA chip. This is done
by comparing the value of 26 selected registers.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Wolfgang Grandegger <wg@grandegger.com>
16 years agohwmon: (w83781d) Refactor beep enable handling
Jean Delvare [Fri, 17 Oct 2008 15:51:18 +0000 (17:51 +0200)]
hwmon: (w83781d) Refactor beep enable handling

We can handle the beep enable bit as any other beep mask bit for
slightly smaller code.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Wolfgang Grandegger <wg@grandegger.com>
16 years agohwmon: Drop dead links to old National Semiconductor chip datasheets
Jean Delvare [Fri, 17 Oct 2008 15:51:17 +0000 (17:51 +0200)]
hwmon: Drop dead links to old National Semiconductor chip datasheets

Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (w83791d) add support for thermal cruise mode
Marc Hulsman [Fri, 17 Oct 2008 15:51:17 +0000 (17:51 +0200)]
hwmon: (w83791d) add support for thermal cruise mode

Add support to set target temperature and tolerance for thermal
cruise mode.

Signed-off-by: Marc Hulsman <m.hulsman@tudelft.nl>
Acked-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (w83791d) add pwm_enable support
Marc Hulsman [Fri, 17 Oct 2008 15:51:17 +0000 (17:51 +0200)]
hwmon: (w83791d) add pwm_enable support

Add support for pwm_enable.

Signed-off-by: Marc Hulsman <m.hulsman@tudelft.nl>
Acked-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (w83791d) add manual PWM support
Marc Hulsman [Fri, 17 Oct 2008 15:51:17 +0000 (17:51 +0200)]
hwmon: (w83791d) add manual PWM support

Add PWM manual control.

Signed-off-by: Marc Hulsman <m.hulsman@tudelft.nl>
Acked-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (w83791d) fan 4/5 pins can also be used for gpio
Marc Hulsman [Fri, 17 Oct 2008 15:51:16 +0000 (17:51 +0200)]
hwmon: (w83791d) fan 4/5 pins can also be used for gpio

Pins fan/pwm 4-5 can be in use as GPIO. If that is the case, do not
create their sysfs-interface.

Signed-off-by: Marc Hulsman <m.hulsman@tudelft.nl>
Acked-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (max1619) Use inline functions instead of macros
Andrew Morton [Fri, 17 Oct 2008 15:51:16 +0000 (17:51 +0200)]
hwmon: (max1619) Use inline functions instead of macros

Macros evaluating their arguments more than once are evil.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (it87) Fix thermal sensor type values
Jean Delvare [Fri, 17 Oct 2008 15:51:16 +0000 (17:51 +0200)]
hwmon: (it87) Fix thermal sensor type values

The it87 driver doesn't follow the standard sensor type values as
documented in Documentation/hwmon/sysfs-interface. It uses value 2 for
thermistors instead of value 4. This causes "sensors" to tell the user
that the chip is setup for a transistor while it is actually setup for
a thermistor.

Using value 4 for thermistors solves the problem. For compatibility
reasons, we still accept value 2 but emit a warning message so that
users update their configuration files.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Hans de Goede <hdegoede@redhat.com>
16 years agohwmon: (lm78) Convert to a new-style i2c driver
Jean Delvare [Fri, 17 Oct 2008 15:51:16 +0000 (17:51 +0200)]
hwmon: (lm78) Convert to a new-style i2c driver

The new-style lm78 driver implements the optional detect() callback
to cover the use cases of the legacy driver.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (lm78) Stop abusing struct i2c_client for ISA devices
Jean Delvare [Fri, 17 Oct 2008 15:51:15 +0000 (17:51 +0200)]
hwmon: (lm78) Stop abusing struct i2c_client for ISA devices

Upcoming changes to the I2C part of the lm78 driver will cause ISA
devices to no longer have a struct i2c_client at hand. So, we must
stop (ab)using it now.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (lm78) Prevent misdetection of Winbond chips
Jean Delvare [Fri, 17 Oct 2008 15:51:15 +0000 (17:51 +0200)]
hwmon: (lm78) Prevent misdetection of Winbond chips

The LM78 detection is relatively weak, and sometimes recent Winbond
chips can be misdetected as an LM78. We have had repeated reports of
this happening. We have an explicit check against this for the ISA
access, do the same for I2C access now.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (lm78) Detect alias chips
Jean Delvare [Fri, 17 Oct 2008 15:51:15 +0000 (17:51 +0200)]
hwmon: (lm78) Detect alias chips

The LM78 and LM79 can be accessed either on the I2C bus or the ISA
bus. We must not access the same chip through both interfaces. So far
we were relying on the user passing the correct ignore parameter to
skip the registration of the I2C interface as suggested by
sensors-detect, but this is fragile: the user may load the lm78
driver without running sensors-detect, and the i2c bus numbers are
not stable across reboots and hardware changes.

So, better detect alias chips in the driver directly, and skip any
I2C chip which is obviously an alias of the ISA chip. This is done
by comparing the value of 26 selected registers.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (lm78) Fix I/O resource conflict with PNP
Jean Delvare [Fri, 17 Oct 2008 15:51:15 +0000 (17:51 +0200)]
hwmon: (lm78) Fix I/O resource conflict with PNP

Only request I/O ports 0x295-0x296 instead of the full I/O address
range. This solves a conflict with PNP resources on a few motherboards.

Also request the I/O ports in two parts (4 low ports, 4 high ports)
during device detection, otherwise the PNP resource make the request
(and thus the detection) fail.

This is the exact same fix that was applied to driver w83781d in
March 2008 to address the same problem:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2961cb22ef02850d90e7a12c28a14d74e327df8d

Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (lm85) Better label names
Jean Delvare [Fri, 17 Oct 2008 15:51:14 +0000 (17:51 +0200)]
hwmon: (lm85) Better label names

Label names ERROR1 and ERROR3 aren't exactly explicit. Change them for
better names that indicate what we are up to.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Herbert Poetzl <herbert@13thfloor.at>
16 years agohwmon: (lm85) Simplify RANGE_TO_REG
Jean Delvare [Fri, 17 Oct 2008 15:51:14 +0000 (17:51 +0200)]
hwmon: (lm85) Simplify RANGE_TO_REG

Function RANGE_TO_REG can easily be simplified. Credits go to Herbert
Poetzl for indirectly suggesting this to me. I tested that the new
implementation returns the same result as the original implementation
for all input values.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Herbert Poetzl <herbert@13thfloor.at>
16 years agohwmon: (lm85) Convert to a new-style i2c driver
Jean Delvare [Fri, 17 Oct 2008 15:51:14 +0000 (17:51 +0200)]
hwmon: (lm85) Convert to a new-style i2c driver

The new-style lm85 driver implements the optional detect() callback
to cover the use cases of the legacy driver.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Herbert Poetzl <herbert@13thfloor.at>
16 years agohwmon: (lm85) Support different PWM frequency tables
Jean Delvare [Fri, 17 Oct 2008 15:51:14 +0000 (17:51 +0200)]
hwmon: (lm85) Support different PWM frequency tables

The Analog Devices and SMSC devices supported by the lm85 driver do
not have the same PWM frequency table as the National Semiconductor
devices. Add support for per-device frequency tables.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Herbert Poetzl <herbert@13thfloor.at>
16 years agohwmon: (lm85) Select the closest PWM frequency
Jean Delvare [Fri, 17 Oct 2008 15:51:13 +0000 (17:51 +0200)]
hwmon: (lm85) Select the closest PWM frequency

The LM85 and compatible chips only support 8 arbitrary PWM frequencies.
The algorithm to pick one of them based on the user input is not
optimum. Improve it to always pick the closest supported frequency.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Herbert Poetzl <herbert@13thfloor.at>
16 years agohwmon: (lm85) Implement the standard PWM frequency interface
Jean Delvare [Fri, 17 Oct 2008 15:51:13 +0000 (17:51 +0200)]
hwmon: (lm85) Implement the standard PWM frequency interface

Implement the standard PWM frequency interface: pwm[1-*]_freq in
units of 1 Hz, instead of the non-standard pwm[1-*]_auto_pwm_freq
in units of 0.1 Hz. The old naming was not only non-standard, it was
also confusing, because it suggested that the frequency value only
applied in automatic fan speed mode, which isn't true.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Herbert Poetzl <herbert@13thfloor.at>
16 years agohwmon: (lm85) Rework the device detection
Jean Delvare [Fri, 17 Oct 2008 15:51:13 +0000 (17:51 +0200)]
hwmon: (lm85) Rework the device detection

Rework the device detection to make it clearer and faster in the
general case (when a known device is found.)

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Herbert Poetzl <herbert@13thfloor.at>
16 years agohwmon: (ams) Simplify IRQ handling routine
Dmitry Torokhov [Fri, 17 Oct 2008 15:51:13 +0000 (17:51 +0200)]
hwmon: (ams) Simplify IRQ handling routine

Simplify the IRQ handling routine of ams driver.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (ams) Fix locking issues
Dmitry Torokhov [Fri, 17 Oct 2008 15:51:12 +0000 (17:51 +0200)]
hwmon: (ams) Fix locking issues

Use a separate mutex to serialize input device creation/removal,
otheriwse we deadlock if we try to remove input device while it is
being polled. Also do not take ams_info.lock when it is not needed.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (ams) Fix permissions on 'joystick' module parameter
Dmitry Torokhov [Fri, 17 Oct 2008 15:51:12 +0000 (17:51 +0200)]
hwmon: (ams) Fix permissions on 'joystick' module parameter

We should not allow writes to the 'joystick' module parameters since
writing there will not trigger creation of the input device. Disable
writes since we provide alternative way of enabling input device via
AMS device's sysfs attribute.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (ams) Convert to a new-style i2c driver
Jean Delvare [Fri, 17 Oct 2008 15:51:12 +0000 (17:51 +0200)]
hwmon: (ams) Convert to a new-style i2c driver

The legacy i2c binding model is phasing out, so the ams driver needs
to be converted to a new-style i2c driver. Here is a naive approach of
this conversion. Basically it is moving the i2c device creation from
the ams driver to the i2c-powermac driver. This should work, but I
suspect we could come up with something cleaner by declaring the i2c
device as part of the platform setup. This could be done later by
someone more familiar with openfirmware-based platforms than I am
myself.

One nice thing brought by this conversion is that the ams driver
should be loaded automatically on systems where is is needed (at
least when the I2C interface to the chip is used) providing
coldplug-aware user-space environment.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Stelian Pop <stelian@popies.net>
Cc: Michael Hanselmann <linux-kernel@hansmi.ch>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
16 years agohwmon: (lm87) Add support for configuration through platform_data
Ben Hutchings [Fri, 17 Oct 2008 15:51:12 +0000 (17:51 +0200)]
hwmon: (lm87) Add support for configuration through platform_data

The lm87 driver normally assumes that firmware configured the chip
correctly.  Since this is not always the case, alllow platform code to
set the channel register value via platform_data.  All other
configuration registers can be changed after driver initialisation.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (lm87) Restore original configuration register on removal
Ben Hutchings [Fri, 17 Oct 2008 15:51:11 +0000 (17:51 +0200)]
hwmon: (lm87) Restore original configuration register on removal

This means that if we have to start the monitor when probed, we also
stop it on removal.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (lm87) Fix masking of config register in lm87_init_client()
Ben Hutchings [Fri, 17 Oct 2008 15:51:11 +0000 (17:51 +0200)]
hwmon: (lm87) Fix masking of config register in lm87_init_client()

lm87_init_client() conditionally sets the Start bit and clears the
INT#_Clear bit in the Config 1 register.  The condition should be that
either of these bits needs changing, but currently it checks the
(self-clearing) Initialization bit instead of INT#_Clear.

Fix the condition and also ensure we never set the Initialization bit.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
16 years agohwmon: (lm90) Don't spam the kernel log
Jean Delvare [Fri, 17 Oct 2008 15:51:11 +0000 (17:51 +0200)]
hwmon: (lm90) Don't spam the kernel log

Degrade the "Unsupported chip" message from info to debug level.
There's nothing wrong with this, so no need to bother the user.
Also make the message slightly more descriptive.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Martyn Welch <martyn.welch@gefanuc.com>