Commit Graph

105789 Commits

Author SHA1 Message Date
Janusz Krzysztofik cc587ece12 drivers/leds/ledtrig-gpio.c: make output match input, tighten input checking
Replicate changes made to drivers/leds/ledtrig-backlight.c.

Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-01-20 17:02:06 -08:00
David Rientjes 6a108a14fa kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT
The meaning of CONFIG_EMBEDDED has long since been obsoleted; the option
is used to configure any non-standard kernel with a much larger scope than
only small devices.

This patch renames the option to CONFIG_EXPERT in init/Kconfig and fixes
references to the option throughout the kernel.  A new CONFIG_EMBEDDED
option is added that automatically selects CONFIG_EXPERT when enabled and
can be used in the future to isolate options that should only be
considered for embedded systems (RISC architectures, SLOB, etc).

Calling the option "EXPERT" more accurately represents its intention: only
expert users who understand the impact of the configuration changes they
are making should enable it.

Reviewed-by: Ingo Molnar <mingo@elte.hu>
Acked-by: David Woodhouse <david.woodhouse@intel.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Cc: Greg KH <gregkh@suse.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Robin Holt <holt@sgi.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-01-20 17:02:05 -08:00
Roopa Prabhu 4dce2396b3 enic: Bug Fix: Dont reset ENIC_SET_APPLIED flag on port profile disassociate
enic_get_vf_port returns port profile operation status only if ENIC_SET_APPLIED
flag is set. A recent rework of enic_set_port_profile added code to reset this
flag on disassociate. As a result of which a client calling enic_get_vf_port
to get the status of port profile disassociate will always get a return value
of ENODATA. This patch renames ENIC_SET_APPLIED to more appropriate
ENIC_PORT_REQUEST_APPLIED and reverts back the recent change so that the
flag is set both at associate and disassociate of a port profile.

Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: David Wang <dwang2@cisco.com>
Signed-off-by: Christian Benvenuti <benve@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-01-20 16:59:34 -08:00
françois romieu 2ffa007eaa via-velocity: fix the WOL bug on 1000M full duplex forced mode.
The VIA velocity card can't be waken up by WOL tool on 1000M full
duplex forced mode. This patch fixes the bug.

Signed-off-by: David Lv <DavidLv@viatech.com.cn>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-01-20 16:59:33 -08:00
françois romieu ccd5c8ef24 atl1e: remove private #define.
Either unused or duplicates from mii.h.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Jay Cliburn <jcliburn@gmail.com>
Cc: Chris Snook <chris.snook@gmail.com>
Cc: Jie Yang <jie.yang@atheros.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-01-20 16:50:05 -08:00
françois romieu 34aac66cc2 atl1c: remove private #define.
Either unused or duplicates from mii.h.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Jay Cliburn <jcliburn@gmail.com>
Cc: Chris Snook <chris.snook@gmail.com>
Cc: Jie Yang <jie.yang@atheros.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-01-20 16:50:05 -08:00
Neil Horman b30532515f bonding: Ensure that we unshare skbs prior to calling pskb_may_pull
Recently reported oops:

kernel BUG at net/core/skbuff.c:813!
invalid opcode: 0000 [#1] SMP
last sysfs file: /sys/devices/virtual/net/bond0/broadcast
CPU 8
Modules linked in: sit tunnel4 cpufreq_ondemand acpi_cpufreq freq_table bonding
ipv6 dm_mirror dm_region_hash dm_log cdc_ether usbnet mii serio_raw i2c_i801
i2c_core iTCO_wdt iTCO_vendor_support shpchp ioatdma i7core_edac edac_core bnx2
ixgbe dca mdio sg ext4 mbcache jbd2 sd_mod crc_t10dif mptsas mptscsih mptbase
scsi_transport_sas dm_mod [last unloaded: microcode]

Modules linked in: sit tunnel4 cpufreq_ondemand acpi_cpufreq freq_table bonding
ipv6 dm_mirror dm_region_hash dm_log cdc_ether usbnet mii serio_raw i2c_i801
i2c_core iTCO_wdt iTCO_vendor_support shpchp ioatdma i7core_edac edac_core bnx2
ixgbe dca mdio sg ext4 mbcache jbd2 sd_mod crc_t10dif mptsas mptscsih mptbase
scsi_transport_sas dm_mod [last unloaded: microcode]
Pid: 0, comm: swapper Not tainted 2.6.32-71.el6.x86_64 #1 BladeCenter HS22
-[7870AC1]-
RIP: 0010:[<ffffffff81405b16>]  [<ffffffff81405b16>]
pskb_expand_head+0x36/0x1e0
RSP: 0018:ffff880028303b70  EFLAGS: 00010202
RAX: 0000000000000002 RBX: ffff880c6458ec80 RCX: 0000000000000020
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880c6458ec80
RBP: ffff880028303bc0 R08: ffffffff818a6180 R09: ffff880c6458ed64
R10: ffff880c622b36c0 R11: 0000000000000400 R12: 0000000000000000
R13: 0000000000000180 R14: ffff880c622b3000 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffff880028300000(0000) knlGS:0000000000000000
CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
CR2: 00000038653452a4 CR3: 0000000001001000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process swapper (pid: 0, threadinfo ffff8806649c2000, task ffff880c64f16ab0)
Stack:
 ffff880028303bc0 ffffffff8104fff9 000000000000001c 0000000100000000
<0> ffff880000047d80 ffff880c6458ec80 000000000000001c ffff880c6223da00
<0> ffff880c622b3000 0000000000000000 ffff880028303c10 ffffffff81407f7a
Call Trace:
<IRQ>
 [<ffffffff8104fff9>] ? __wake_up_common+0x59/0x90
 [<ffffffff81407f7a>] __pskb_pull_tail+0x2aa/0x360
 [<ffffffffa0244530>] bond_arp_rcv+0x2c0/0x2e0 [bonding]
 [<ffffffff814a0857>] ? packet_rcv+0x377/0x440
 [<ffffffff8140f21b>] netif_receive_skb+0x2db/0x670
 [<ffffffff8140f788>] napi_skb_finish+0x58/0x70
 [<ffffffff8140fc89>] napi_gro_receive+0x39/0x50
 [<ffffffffa01286eb>] ixgbe_clean_rx_irq+0x35b/0x900 [ixgbe]
 [<ffffffffa01290f6>] ixgbe_clean_rxtx_many+0x136/0x240 [ixgbe]
 [<ffffffff8140fe53>] net_rx_action+0x103/0x210
 [<ffffffff81073bd7>] __do_softirq+0xb7/0x1e0
 [<ffffffff810d8740>] ? handle_IRQ_event+0x60/0x170
 [<ffffffff810142cc>] call_softirq+0x1c/0x30
 [<ffffffff81015f35>] do_softirq+0x65/0xa0
 [<ffffffff810739d5>] irq_exit+0x85/0x90
 [<ffffffff814cf915>] do_IRQ+0x75/0xf0
 [<ffffffff81013ad3>] ret_from_intr+0x0/0x11
 <EOI>
 [<ffffffff8101bc01>] ? mwait_idle+0x71/0xd0
 [<ffffffff814cd80a>] ? atomic_notifier_call_chain+0x1a/0x20
 [<ffffffff81011e96>] cpu_idle+0xb6/0x110
 [<ffffffff814c17c8>] start_secondary+0x1fc/0x23f

Resulted from bonding driver registering packet handlers via dev_add_pack and
then trying to call pskb_may_pull. If another packet handler (like for AF_PACKET
sockets) gets called first, the delivered skb will have a user count > 1, which
causes pskb_may_pull to BUG halt when it does its skb_shared check.  Fix this by
calling skb_share_check prior to the may_pull call sites in the bonding driver
to clone the skb when needed.  Tested by myself and the reported successfully.

Signed-off-by: Neil Horman
CC: Andy Gospodarek <andy@greyhouse.net>
CC: Jay Vosburgh <fubar@us.ibm.com>
CC: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-01-20 16:45:56 -08:00
Dimitris Michailidis 6a3c869a60 cxgb4: fix reported state of interfaces without link
Currently tools like ip and ifconfig report incorrect state for cxgb4
interfaces that are up but do not have link and do so until first link
establishment.  This is because the initial netif_carrier_off call is
before register_netdev and it needs to be after to be fully effective.
Fix this by moving netif_carrier_off into .ndo_open.

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-01-20 16:45:55 -08:00
Linus Torvalds fc887b15d9 Merge branch 'tty-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
* 'tty-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6:
  tty: update MAINTAINERS file due to driver movement
  tty: move drivers/serial/ to drivers/tty/serial/
  tty: move hvc drivers to drivers/tty/hvc/
2011-01-20 16:39:23 -08:00
Linus Torvalds 67290f41b2 Merge branch 'xen/xenbus' of git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen
* 'xen/xenbus' of git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen:
  xenbus: Fix memory leak on release
  xenbus: avoid zero returns from read()
  xenbus: add missing wakeup in concurrent read/write
  xenbus: allow any xenbus command over /proc/xen/xenbus
  xenfs/xenbus: report partial reads/writes correctly
2011-01-20 16:37:28 -08:00
Linus Torvalds e55fdbd741 Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus
* git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus:
  virtio: remove virtio-pci root device
  LGUEST_GUEST: fix unmet direct dependencies (VIRTUALIZATION && VIRTIO)
  lguest: compile fixes
  lguest: Use this_cpu_ops
  lguest: document --rng in example Launcher
  lguest: example launcher to use guard pages, drop PROT_EXEC, fix limit logic
  lguest: --username and --chroot options
2011-01-20 16:31:20 -08:00
Linus Torvalds e589501cb9 Merge branch 'acpica' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'acpica' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6:
  ACPICA: Update version to 20110112
  ACPICA: Update all ACPICA copyrights and signons to 2011
  ACPICA: Fix issues/fault with automatic "serialized" method support
  ACPICA: Debugger: Lock namespace for duration of a namespace dump
  ACPICA: Fix namespace race condition
  ACPICA: Fix memory leak in acpi_ev_asynch_execute_gpe_method().
2011-01-20 16:28:34 -08:00
Linus Torvalds d7b9935a34 i915: Fix i915 suspend delay
During system suspend, the "wait for ring buffer to empty" loop would
always time out after three seconds, because the faster cached ring
buffer head read would always return zero.  Force the slow-and-careful
PIO read on all but the first iterations of the loop to fix it.

This also removes the unused (and useless) 'actual_head' variable that
tried to approximate doing this, but did it incorrectly.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Dave Airlie <airlied@linux.ie>
Cc: DRI mailing list <dri-devel@lists.freedesktop.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-01-20 16:18:25 -08:00
Stefan Richter 324719978d firewire: net: is not experimental anymore
thanks to Clemens' and Maxim's fixes to firewire-ohci and -net in the
last two kernel releases.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2011-01-21 00:36:00 +01:00
Maxim Levitsky 74a1450499 firewire: net: invalidate ARP entries of removed nodes
This makes it possible to resume communication with a node that dropped
off the bus for a brief period.  Otherwise communication will only be
possible after ARP cache entry timeouts.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (rebased)
2011-01-21 00:36:00 +01:00
Stefan Richter 6044565af4 firewire: core: fix unstable I/O with Canon camcorder
Regression since commit 1038953674, "firewire: core: check for 1394a
compliant IRM, fix inaccessibility of Sony camcorder":

The camcorder Canon MV5i generates lots of bus resets when asynchronous
requests are sent to it (e.g. Config ROM read requests or FCP Command
write requests) if the camcorder is not root node.  This causes drop-
outs in videos or makes the camcorder entirely inaccessible.
https://bugzilla.redhat.com/show_bug.cgi?id=633260

Fix this by allowing any Canon device, even if it is a pre-1394a IRM
like MV5i are, to remain root node (if it is at least Cycle Master
capable).  With the FireWire controller cards that I tested, MV5i always
becomes root node when plugged in and left to its own devices.

Reported-by: Ralf Lange
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: <stable@kernel.org> # 2.6.32.y and newer
2011-01-21 00:27:46 +01:00
Linus Torvalds b23fffd778 ACPI / Battery: remove battery refresh on resume
This partially reverts commit da8aeb92d4
("ACPI / Battery: Update information on info notification and resume"),
which causes a hang on resume on at least some machines.

This bug was bisected on an ASUS EeePC 901, which hangs at resume time
if we do that "acpi_battery_refresh(battery)" in the battery resume
function.

Rafael suspects we'll still need to refresh the sysfs files upon resume,
but that that can be done from a PM notifier (that will run after
thawing user space).

Bisected-and-tested-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Len Brown <len.brown@intel.com>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-01-20 13:14:10 -08:00
Milton Miller 8b3bb3ecf1 virtio: remove virtio-pci root device
We sometimes need to map between the virtio device and
the given pci device. One such use is OS installer that
gets the boot pci device from BIOS and needs to
find the relevant block device. Since it can't,
installation fails.

Instead of creating a top-level devices/virtio-pci
directory, create each device under the corresponding
pci device node.  Symlinks to all virtio-pci
devices can be found under the pci driver link in
bus/pci/drivers/virtio-pci/devices, and all virtio
devices under drivers/bus/virtio/devices.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
Tested-by: "Daniel P. Berrange" <berrange@redhat.com>
Cc: stable@kernel.org
2011-01-20 21:37:30 +10:30
Rusty Russell ced05dd741 lguest: compile fixes
arch/x86/lguest/boot.c: In function ‘lguest_init_IRQ’:
arch/x86/lguest/boot.c:824: error: macro "__this_cpu_write" requires 2 arguments, but only 1 given
arch/x86/lguest/boot.c:824: error: ‘__this_cpu_write’ undeclared (first use in this function)
arch/x86/lguest/boot.c:824: error: (Each undeclared identifier is reported only once
arch/x86/lguest/boot.c:824: error: for each function it appears in.)

drivers/lguest/x86/core.c: In function ‘copy_in_guest_info’:
drivers/lguest/x86/core.c:94: error: lvalue required as left operand of assignment

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-01-20 21:37:29 +10:30
Christoph Lameter c9f2954964 lguest: Use this_cpu_ops
Use this_cpu_ops in a couple of places in lguest.

Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-01-20 21:37:29 +10:30
Jon Mason 6997e61891 vxge: update driver version
Update vxge driver version to 2.5.2

Signed-off-by: Jon Mason <jon.mason@exar.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-01-19 23:18:14 -08:00
Jon Mason 16fded7da2 vxge: MSIX one shot mode
To reduce the possibility of losing an interrupt in the handler due to a
race between an interrupt processing and disable/enable of interrupts,
enable MSIX one shot.

Also, add support for adaptive interrupt coalesing

Signed-off-by: Jon Mason <jon.mason@exar.com>
Signed-off-by: Masroor Vettuparambil <masroor.vettuparambil@exar.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-01-19 23:18:14 -08:00
Jon Mason 1d15f81cda vxge: correct eprom version detection
The firmware PXE EPROM version detection is failing due to passing the
wrong parameter into firmware query function.  Also, the version
printing function has an extraneous newline.

Signed-off-by: Jon Mason <jon.mason@exar.com>
Signed-off-by: Sivakumar Subramani <sivakumar.subramani@exar.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-01-19 23:18:13 -08:00
Jon Mason 6cca200362 vxge: cleanup probe error paths
Reorder the commands to be in the inverse order of their allocations
(instead of the random order they appear to be in), propagate return
code on errors from pci_request_region and register_netdev, reduce the
config_dev_cnt and total_dev_cnt counters on remove, and return the
correct error code for vdev->vpaths kzalloc failures.  Also, prevent
leaking of vdev->vpaths memory and netdev in vxge_probe error path due
to freeing for these not occurring in vxge_device_unregister.

Signed-off-by: Jon Mason <jon.mason@exar.com>
Signed-off-by: Sivakumar Subramani <sivakumar.subramani@exar.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-01-19 23:18:13 -08:00
Linus Torvalds 1268afe676 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (41 commits)
  sctp: user perfect name for Delayed SACK Timer option
  net: fix can_checksum_protocol() arguments swap
  Revert "netlink: test for all flags of the NLM_F_DUMP composite"
  gianfar: Fix misleading indentation in startup_gfar()
  net/irda/sh_irda: return to RX mode when TX error
  net offloading: Do not mask out NETIF_F_HW_VLAN_TX for vlan.
  USB CDC NCM: tx_fixup() race condition fix
  ns83820: Avoid bad pointer deref in ns83820_init_one().
  ipv6: Silence privacy extensions initialization
  bnx2x: Update bnx2x version to 1.62.00-4
  bnx2x: Fix AER setting for BCM57712
  bnx2x: Fix BCM84823 LED behavior
  bnx2x: Mark full duplex on some external PHYs
  bnx2x: Fix BCM8073/BCM8727 microcode loading
  bnx2x: LED fix for BCM8727 over BCM57712
  bnx2x: Common init will be executed only once after POR
  bnx2x: Swap BCM8073 PHY polarity if required
  iwlwifi: fix valid chain reading from EEPROM
  ath5k: fix locking in tx_complete_poll_work
  ath9k_hw: do PA offset calibration only on longcal interval
  ...
2011-01-19 20:25:45 -08:00
Jarod Wilson 88914bdf8c [media] staging/lirc: fix mem leaks and ptr err usage
When the lirc drivers were converted over to using memdup_user, I
mistakenly also removed corresponding calls to kfree. Add those back. I
also screwed up on the allocation error check in lirc_serial, using if
(PTR_ERR()) instead of if (IS_ERR()), which broke transmit.

Reported-by: Jiri Fojtasek <jiri.fojtasek@hlohovec.net>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 12:52:22 -02:00
Jarod Wilson 559d162e1e [media] hdpvr: reduce latency of i2c read/write w/recycled buffer
The current hdpvr code kmalloc's a new buffer for every i2c read and
write. Rather than do that, lets allocate a buffer in the driver's
device struct and just use that every time.

The size I've chosen for the buffer is the maximum size I could
ascertain might be used by either ir-kbd-i2c or lirc_zilog, plus a bit
of padding (lirc_zilog may use up to 100 bytes on tx, rounded that up
to 128).

Note that this might also remedy user reports of very sluggish behavior
of IR receive with hdpvr hardware.

v2: make sure (len <= (dev->i2c_buf)) [Jean Delvare]

Reported-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 12:52:21 -02:00
Jarod Wilson 324b04ba5d [media] hdpvr: enable IR part
A number of things going on here, but the end result is that the IR part
on the hdpvr gets enabled, and can be used with ir-kbd-i2c and/or
lirc_zilog.

First up, there are some conditional build fixes that come into play
whether i2c is built-in or modular. Second, we're swapping out
i2c_new_probed_device() for i2c_new_device(), as in my testing, probing
always fails, but we *know* that all hdpvr devices have a z8 chip at
0x70 and 0x71. Third, we're poking at an i2c address directly without a
client, and writing some magic bits to actually turn on this IR part
(this could use some improvement in the future). Fourth, some of the
i2c_adapter storage has been reworked, as the existing implementation
used to lead to an oops following i2c changes c. 2.6.31.

Earlier editions of this patch have been floating around the 'net for a
while, including being patched into Fedora kernels, and they *do* work.
This specific version isn't yet tested, beyond loading ir-kbd-i2c and
confirming that it does bind to the RX address of the hdpvr.

[mchehab@redhat.com: I2C_CLASS_TV_ANALOG is not defined. Fix compilation bug]
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 12:52:20 -02:00
Jarod Wilson 706c57d802 [media] rc/mceusb: timeout should be in ns, not us
Fixes an egregious bug in mceusb driver, where the receiver was being
put into idle mode far sooner than it should have, thanks to storing a
timeout value that in us where it should be ns. Basically, the receiver
kept going into idle mode before a trailing space had been fully
received, which was causing problems for some protocols, most notably
manifesting as lirc userspace never receiving a trailing space for any
rc5 signals.

Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 12:52:19 -02:00
Hans Verkuil 672dcd5477 [media] v4l2-device: fix 'use-after-freed' oops
Fix a bug in v4l2_device_unregister where the sd pointer can be dereferenced
after it was freed.

Normally the i2c adapter is removed before this function is called. Removing
the adapter will also unregister all subdevs on that adapter, so generally
v4l2_device_unregister has nothing to do. However, in the case of a platform
i2c bus that bus is generally not freed.

In that case, after freeing the i2c subdevice the code will fall into the
second block when it tests if the subdev is a SPI device. But by that time
the subdev is already freed and the kernel oopses.

The fix is trivial: continue with the loop after freeing the i2c or spi
subdevice.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Reported-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:52:14 -02:00
Hans Verkuil 46b633779b [media] v4l2-dev: don't memset video_device.dev
Zeroing video_device.dev causes a memory leak if video_set_drvdata
was called before video_register_device was called. video_set_drvdata
calls dev_set_drvdata which allocates video_device.dev.p.

memsetting this will prevent freeing of that memory.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:52:13 -02:00
Hans Verkuil 6ce3ced4f7 [media] zoran: use video_device_alloc instead of kmalloc
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:52:12 -02:00
Hans Verkuil bd5ba3ba2e [media] w9966: zero device state after a detach
After a detach zero the whole device state to ensure a clean slate
on the next attach.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:52:11 -02:00
Laurent Pinchart eac9aa005a [media] v4l: Fix a use-before-set in the control framework
v4l2_queryctrl sets the step value based on the control type. That would
be fine if it used the control type stored in the V4L2 kernel control
object, not the one stored in the userspace ioctl structure that has
just been memset to 0. Fix this.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:52:10 -02:00
Hans Verkuil 829fb2dcb5 [media] v4l2-ctrls: queryctrl shouldn't attempt to replace V4L2_CID_PRIVATE_BASE IDs
When queryctrl is called with a V4L2_CID_PRIVATE_BASE control ID, then
currently it is replaced by the real internal ID. This is not according to
the spec so keep the V4L2_CID_PRIVATE_BASE ID in this case.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:46:15 -02:00
Hans Verkuil c959acfddb [media] v4l2-ctrls: fix missing 'read-only' check
VIDIOC_S_CTRL did not check against read-only controls. Even worse, for
controls of type CTRL_CLASS it would cause a kernel oops since those controls
do not have a s_ctrl op.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:46:14 -02:00
Andy Walls 4999e27a62 [media] pvrusb2: Provide more information about IR units to lirc_zilog and ir-kbd-i2c
When registering an IR Rx device with the I2C subsystem, provide more detailed
information about the IR device and default remote configuration for the IR
driver modules.

Also explicitly register any IR Tx device with the I2C subsystem.

Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Acked-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:46:13 -02:00
Andy Walls c69a4af6f0 [media] ir-kbd-i2c: Add back defaults setting for Zilog Z8's at addr 0x71
This reverts a portion of commit

	44243fc2ef

A commit for which I errantly recommended that defaults for I2C address
0x71 not be set by ir-kbd-i2c.c

The pvrusb2 and bttv drivers currently rely on ir-kbd-i2c setting
defaults for that address.  Until I can get those bridge drivers fixed
to properly send IR_i2c_init_data for boards with Zilog Z8 chips,
just add back the default settings for I2C address 0x71.

Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:46:12 -02:00
Andy Walls 1f1bfaa0a2 [media] lirc_zilog: Update TODO.lirc_zilog
Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:46:11 -02:00
Andy Walls c2790c7192 [media] lirc_zilog: Add Andy Walls to copyright notice and authors list
Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:46:10 -02:00
Andy Walls 6830661ead [media] lirc_zilog: Remove useless struct i2c_driver.command function
The ir_command() function is a do-nothing stub; remove it.

Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:46:09 -02:00
Andy Walls 8090232a23 [media] lirc_zilog: Remove unneeded tests for existence of the IR Tx function
The driver is now structured so that it must handle an IR Tx unit
for a Z8 IR chip, or it refuses to handle that Z8 IR chip.  This
allows us to assume that ir->tx != NULL in a few places in the driver,
and also allows us to always report Tx is available to userspace.
Get rid of unneeded tests for ir->tx == NULL and always report that
Tx is available.

Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:46:08 -02:00
Andy Walls b757730b02 [media] lirc_zilog: Update IR Rx polling kthread start/stop and some printks
The IR Rx polling thread was originally a kernel_thread long ago,
and had only been minimally converted to a kthread.  This patch
finishes that conversion by

- cleaning up all the unneeded completions

- destroying the kthread properly by calling kthread_stop()

- changing lirc_thread() to test kthread_should_stop() just before
	every point where it may sleep

- reorganizing the lirc_thread() function so it uses fewer lines

- modifying the name of the kthread from "lirc_zilog" to
	"zilog-rx-i2c-N", so ps will show which kthread polls
	which Zilog Z8 IR unit.

Also some minor tweaks were made to logging emitted by the
ir_probe() function.

Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:46:07 -02:00
Andy Walls a68a9b73fb [media] lirc_zilog: Extensive rework of ir_probe()/ir_remove()
This patch is an extensive rework of the ir_probe() and ir_remove() functions.

It removes all the double binding and allocation problems on module load.

It removes almost all the memory leaks on module exit and on device
instantiation failure. Proper destruction of the Rx polling kthread still
needs investigation and more work, but it is no worse than it already was.

This rework also had side effects that include:

- encapsulation of the ir_devices[] array
- serialization of access to the ir_devices[] array
- semantic change of the module parameter "disable_rx" to "tx_only"

If tx_only is true, the module does not claim the i2c_client for the IR Rx
function, and only claims and handles the i2c_client for the IR Tx function.
This is a first step in providing the option of letting ir-kbd-i2c.c handle
IR Rx function, while lirc_zilog handles the IR Tx function.

Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:46:06 -02:00
Andy Walls e9b351f64f [media] lirc_zilog: Don't make private copies of i2c clients
Don't make private copies of the i2c clients provided by the I2C
subsystem, don't change the client address field, and don't probe
the client addresses - the bridge driver already did that.  This
moves us to the proper I2C and binding model.

Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:46:05 -02:00
Andy Walls 06da95a3ec [media] lirc_zilog: Split struct IR into structs IR, IR_tx, and IR_rx
This change is a mostly mechanical break of the main struct IR
data structure into common, Rx, and Tx structures.  There were some
small logical changes required as well, such as eliminating "is_hdpvr",
to accomplish this.

This change is an intiial step in reworking lirc_zilog to decouple the
Rx and Tx handling as much as possible to fit with the new I2C
binding model.  This change actually makes lirc_zilog a little more
broken than it already was - memory deallocation in particular got worse.
However, this change makes the remaining problems easier to see and address.

Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:46:04 -02:00
Andy Walls 02fcaaa3a5 [media] lirc_zilog: Remove disable_tx module parameter
The only reason to use the lirc_zilog module is for IR Tx, so remove
the possibility of disabling IR Tx.  If the user needs only IR Rx,
then the ir-kbd-i2c module works just fine, and doesn't require a
"firmware" image.

Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:46:03 -02:00
Andy Walls 86e52428ee [media] lirc_zilog: Reword debug message in ir_probe()
Jean Delvare <khali@linux-fr.org> suggested this better
format for debug output in ir_probe().

Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:46:02 -02:00
Stefan Richter 22f37712f2 [media] firedtv: fix remote control with newer Xorg evdev
After a recent update of xf86-input-evdev and xorg-server, I noticed
that X11 applications did not receive keypresses from the FireDTV
infrared remote control anymore.  Instead, the Xorg log featured lots of

    "FireDTV remote control: dropping event due to full queue!"

exclamations.  The Linux console did not have an issue with the
FireDTV's RC though.

The fix is to insert EV_SYN events after the key-down/-up events.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:59 -02:00
Dmitri Belimov 3c61be446a [media] tm6000: rework init code
Rework device init part. Move common code part to a function.
Usefull for register multiple devices like video, radio, vbi etc.

Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:58 -02:00
Geert Uytterhoeven 2400982a2e [media] radio-aimslab.c needs #include <linux/delay.h>
Commit e3c9221519 ("[media] radio-aimslab.c: Fix
gcc 4.5+ bug") removed the include, but introduced new callers of msleep():

| drivers/media/radio/radio-aimslab.c: In function ‘rt_decvol’:
| drivers/media/radio/radio-aimslab.c:76: error: implicit declaration of function ‘msleep’

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:57 -02:00
Randy Dunlap 2dbd61b465 [media] ir-raw: fix sparse non-ANSI function warning
Fix sparse warning for non-ANSI function declaration:

drivers/media/rc/ir-raw.c:247:30: warning: non-ANSI function declaration of function 'ir_raw_get_allowed_protocols'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc:	Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:56 -02:00
Christian Gmeiner b7eccc46a1 [media] adv7175: support s_power
This patch adds s_power support to adv7175 driver. Power-down is done
by power-down all four DACs.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:55 -02:00
Dan Carpenter cb26a24ee9 [media] [v3,media] av7110: check for negative array offset
info->num comes from the user.  It's type int.  If the user passes
in a negative value that would cause memory corruption.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:54 -02:00
Jarod Wilson 76f1ef427c [media] rc/imon: default to key mode instead of mouse mode
My initial thinking was that we should default to mouse mode, so people
could use the mouse function to click on something on a login screen,
but a lot of systems where a remote is useful automatically log in a
user and launch a media center application, some of which hide the
mouse, which can be confusing to users if they punch buttons on the
remote and don't see any feedback. Plus, first and foremost, its a
remote, so lets default to being a remote, and only toggle into mouse
mode when the user explicitly asks for it. As a nice side-effect, this
actually simplifies some of the code a fair bit...

Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:53 -02:00
Jarod Wilson 5aad724280 [media] rc: fix up and genericize some time unit conversions
The ene_ir driver was using a private define of MS_TO_NS, which is meant
to be microseconds to nanoseconds. The mceusb driver copied it,
intending to use is a milliseconds to microseconds. Lets move the
defines to a common location, expand and standardize them a touch, so
that we now have:

  MS_TO_NS - milliseconds to nanoseconds
  MS_TO_US - milliseconds to microseconds
  US_TO_NS - microseconds to nanoseconds

Reported-by: David Härdeman <david@hardeman.nu>
CC: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:52 -02:00
Jarod Wilson 9ad77eb57b [media] rc/imon: need to submit urb before ffdc type check
Otherwise, we have a null receive buffer, and the logic all falls down,
goes boom, all ffdc devs wind up as imon IR w/VFD. Oops.

Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:51 -02:00
Kyle McMartin 2e4c55626a [media] rc/ene_ir: fix oops on module load
dev->rdev is accessed in ene_setup_hw_settings, so it needs to be wired
up before then.

[Jarod Wilson]: Also fix a possible improper resource freeing bug while
we're looking at possible probe issues here.

Signed-off-by: Kyle McMartin <kmcmartin@redhat.com>
CC: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:50 -02:00
Jarod Wilson 7d2edfc23e [media] rc/imon: fix ffdc device detection oops
There's a nasty bug that slipped in when the rc device interface was
altered, only affecting the older 0xffdc imon devices. We were trying
to access ictx->rdev->allowed_protos before ictx->rdev had been set.

There's also an issue with call ordering that meant the correct
keymap wasn't getting loaded for MCE IR type 0xffdc devices.

Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:49 -02:00
Thadeu Lima de Souza Cascardo e95342f168 [media] DVB: cx231xx drivers does not use dummy frontend anymore
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:48 -02:00
Matti Aaltonen 34b8fc8e68 [media] V4L2: WL1273 FM Radio: Replace ioctl with unlocked_ioctl
Use unlocked_ioctl in v4l2_file_operations. The locking is
already in place.

Signed-off-by: Matti J. Aaltonen <matti.j.aaltonen@nokia.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:47 -02:00
Tejun Heo a3bc5e3304 [media] v4l/cx18: update workqueue usage
With cmwq, there's no reason to use separate out_work_queue.  Drop it
and use system_wq instead.  The in_work_queue needs to be ordered so
can't use one of the system wqs; however, as it isn't used to reclaim
memory, allocate the workqueue with alloc_ordered_workqueue() without
WQ_MEM_RECLAIM.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andy Walls <awalls@md.metrocast.net>
Acked-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:46 -02:00
Jesper Juhl fd01ad9894 [media] media, tlg2300: Fix memory leak in alloc_bulk_urbs_generic()
Hi,

While reading
drivers/media/video/tlg2300/pd-video.c::alloc_bulk_urbs_generic() I
noticed that

 - We don't free the memory allocated to 'urb' if the call to
   usb_alloc_coherent() fails.
 - If the 'num' argument to the function is ever <= 0 we'll return an
   uninitialized variable 'i' to the caller.

The following patch addresses both of the above by a) calling
usb_free_urb() when usb_alloc_coherent() fails and by explicitly
initializing 'i' to zero.
I also moved the variables 'mem' and 'urb' inside the for loop. This does
not actually make any difference, it just seemed more correct to me to let
variables exist only in the innermost scope they are used.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Acked-by: Huang Shijie <shijie8@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:45 -02:00
Jesper Juhl 36fd97884d [media] frontends/ix2505v: Remember to free allocated memory in failure path
We may leak the storage allocated to 'state' in
drivers/media/dvb/frontends/ix2505v.c::ix2505v_attach() on error, as
it is too early to be able to call ix2505v_release().

This patch makes sure we free the allocated memory in the failure case.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:44 -02:00
Jean-François Moine a63d601803 [media] gspca - sonixj: Add LED (illuminator) control to the webcam 0c45:614a
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:43 -02:00
Jean-François Moine 3afef85bfe [media] gspca - sonixj: Infrared bug fix and enhancement
The infrared was set by sensor write instead of bridge GPIO.
It is now settable by the standard control ILLUMINATOR_1.
A module parameter permits to set the right GPIO bit according
to the StarCam model.

Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:42 -02:00
Jean-François Moine 14b67c2969 [media] gspca - ov534: Propagate errors to higher level
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:41 -02:00
Jean-François Moine ddffa49e25 [media] gspca - ov534: Clearer debug messages
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:39 -02:00
Jean-François Moine fc63de88e0 [media] gspca - ov519: Cleanup source and add a comment
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:38 -02:00
Jean-François Moine ded5e903b7 [media] gspca: Remove useless instructions
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:37 -02:00
Jean-François Moine 95c967c167 [media] gspca: Remove __devinit, __devinitconst and __devinitdata
__devinit* must not be used in USB drivers.

Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:35 -02:00
Jean-François Moine 0beb6714e7 [media] gspca: Version change
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:33 -02:00
Hans Verkuil 2a863793be [media] v4l2-ctrls: v4l2_ctrl_handler_setup must set is_new to 1
Renamed has_new to is_new.

Drivers can use the is_new field to determine if a new value was specified
for a control. The v4l2_ctrl_handler_setup() must always set this to 1 since
the setup has to force a full update of all controls.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:32 -02:00
Hans Verkuil 45f6f84af3 [media] v4l2-subdev: add (un)register internal ops
Some subdevs need to call into the board code after they are registered
and have a valid struct v4l2_device pointer. The s_config op was abused
for this, but now that it is removed we need a cleaner way of solving this.

So this patch adds a struct with internal ops that the v4l2 core can call.

Currently only two ops exist: register and unregister. Subdevs can implement
these to call the board code and pass it the v4l2_device pointer, which the
board code can then use to get access to the struct that embeds the
v4l2_device.

It is expected that in the future open and close ops will also be added.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:31 -02:00
Hans Verkuil 3c7c9370fb [media] v4l2-subdev: remove core.s_config and v4l2_i2c_new_subdev_cfg()
The core.s_config op was meant for legacy drivers that needed to work with old
pre-2.6.26 kernels. This is no longer relevant. Unfortunately, this op was
incorrectly called from several drivers.

Replace those occurences with proper i2c_board_info structs and call
v4l2_i2c_new_subdev_board.

After these changes v4l2_i2c_new_subdev_cfg() was no longer used, so remove
that function as well.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:30 -02:00
Mauro Carvalho Chehab ecb71d262b [media] saa7134: Kworld SBTVD: make both analog and digital to work
There are some weird bugs at tda8290/tda18271 initialization, as it
insits do do analog initialization during DVB frontend attach:

DVB: registering new adapter (saa7133[0])
DVB: registering adapter 0 frontend 0 (Fujitsu mb86A20s)...
mb86a20s: mb86a20s_initfe
tda18271_write_regs: [2-0060|M] ERROR: idx = 0x5, len = 1, i2c_transfer returned: -5
tda18271_init: [2-0060|M] error -5 on line 830
tda18271_tune: [2-0060|M] error -5 on line 908
tda18271_write_regs
tda18271_write_regs: [2-0060|M] ERROR: idx = 0x5, len = 1, i2c_transfer returned: -5
tda18271c2_rf_tracking_filters_correction: [2-0060|M] error -5 on line 265
tda18271_write_regs
tda18271_write_regs: [2-0060|M] ERROR: idx = 0x25, len = 1, i2c_transfer returned: -5
tda18271_channel_configuration: [2-0060|M] error -5 on line 119
tda18271_set_analog_params: [2-0060|M] error -5 on line 1045
tda18271_set_analog_params: [2-0060|M] error -5 on line 1045
tda829x 2-004b: tda8295 not locked, no signal?
tda829x 2-004b: tda8295_i2c_bridge: disable i2c gate
tda829x 2-004b: tda8295 not locked, no signal?
tda829x 2-004b: tda8295_i2c_bridge: disable i2c gate
mb86a20s_i2c_writereg: writereg error (rc == -5, reg == 0x29, data == 0x33)
mb86a20s: Init failed. Will try again later

The problem is that mb86a20s is only visible if the analog part is disabled.

However, due to a trick at mb86a20s, it will later initialize properly:

mb86a20s: mb86a20s_initfe: Initialization succeded.

This is hacky and ugly. However, I coldn't find any easy way to fix it.
A proper fix would be to have a resource locking schema, used by both
V4L and DVB parts that would block access to analog registers while
digital registers are in use, but this will probably put tda829x into
a dead lock.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:28 -02:00
Mauro Carvalho Chehab 6a58bc0f50 [media] saa7134: Fix digital mode on Kworld SBTVD
This patch fixes digital mode on Kworld SBTVD. Unfortunately, it disables
analog mode.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:27 -02:00
Mauro Carvalho Chehab 6183040680 [media] saa7134: Fix analog mode for Kworld SBTVD
There were some issues at tda8290 that were preventing this device
to work. Now that those fixes were fixed, we can enable analog
mode.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:26 -02:00
Mauro Carvalho Chehab c736a5f28e [media] mb86a20s: Be sure that device is initialized before starting DVB
Due to a hard to track bug between tda829x/tda18271/saa7134, tda829x
wants to go to analog mode during DVB initialization, causing some
I2C errors.

The analog failure doesn't cause any harm, as the device were already
properly initialized in analog mode. However, the failure at the digital
mode causes the frontend mb86a20s to not initialize. Fortunately, at
least on my tests, it was possible to detect that the device is a
mb86a20s before the failure.

What happens is that tda8290 is a very bad boy: during DVB setup, it
keeps insisting to call tda18271 analog_set_params, that calls
tune_agc code. The tune_agc code calls saa7134 driver, changing the
value of GPIO 27, switching from digital to analog mode and disabling
the access to mb86a20s, as, on Kworld SBTVD, the same GPIO used
to switch the hardware AGC mode seems to be used to enable the I2C
switch that allows access to the frontend (mb86a20s).

So, a call to analog_set_params ultimately disables the access to
the frontend, and causes a failure at the init frontend logic.

This patch is a workaround for this issue: it simply checks if the
frontend init had any failure. If so, it will init the frontend when
some DTV application will try to set DVB mode.

Even being a hack for Kworld SBTVD to work, and assumning that we could
teach tda8290 to be a good boy, this is actually an improvement at the
frontend driver, as it will be more reliable to initialization failures.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:25 -02:00
Mauro Carvalho Chehab 7570800c9d [media] mb86a20s: Fix i2c read/write error messages
A script replaced err var to rc. Howerver, this script gambled
"error" string, changing it to "rcor". Revert that bad change.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:24 -02:00
Mauro Carvalho Chehab 9d700a0696 [media] tda8290: Turn tda829x on before touching at the I2C gate
On Kworld SBTVD, tda8295-c1 starts in power off mode. It needs
to be powered, otherwise, the I2C gate control command won't work.

Cc: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:23 -02:00
Mauro Carvalho Chehab 47ab285a96 [media] tda8290: Fix a bug if no tuner is detected
If tda8290 is detected, but no tuner is found, the driver will do bad
things:

tuner 2-0060: chip found @ 0xc0 (saa7133[0])
tda829x 2-0060: could not clearly identify tuner address, defaulting to 60
tda829x 2-0060: tuner access failed!
BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
IP: [<ffffffffa048c267>] set_audio+0x47/0x170 [tda8290]
PGD 1187b0067 PUD 11771e067 PMD 0
Oops: 0002 [#1] SMP
last sysfs file: /sys/module/i2c_core/initstate
CPU 0
Modules linked in: tda8290(U) tea5767(U) tuner(U) ir_lirc_codec(U) lirc_dev(U) ir_sony_decoder(U) ir_jvc_decoder(U) ir_rc6_decoder(U) ir_rc5_decoder(U) saa7134(+)(U) v4l2_common(U) ir_nec_decoder(U) videodev(U) v4l2_compat_ioctl32(U) rc_core(U) videobuf_dma_sg(U) videobuf_core(U) tveeprom(U) ebtable_nat ebtables xt_CHECKSUM iptable_mangle ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack ipt_REJECT bridge stp llc autofs4 sunrpc cpufreq_ondemand acpi_cpufreq freq_table xt_physdev iptable_filter ip_tables ip6t_REJECT ip6table_filter ip6_tables ipv6 dm_mirror dm_region_hash dm_log parport kvm_intel kvm uinput floppy tpm_infineon wmi sg serio_raw iTCO_wdt iTCO_vendor_support tg3 snd_hda_codec_realtek snd_hda_intel snd_hda_codec snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore snd_page_alloc i7core_edac edac_core nouveau
Modules linked in: tda8290(U) tea5767(U) tuner(U) ir_lirc_codec(U) lirc_dev(U) ir_sony_decoder(U) ir_jvc_decoder(U) ir_rc6_decoder(U) ir_rc5_decoder(U) saa7134(+)(U) v4l2_common(U) ir_nec_decoder(U) videodev(U) v4l2_compat_ioctl32(U) rc_core(U) videobuf_dma_sg(U) videobuf_core(U) tveeprom(U) ebtable_nat ebtables xt_CHECKSUM iptable_mangle ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack ipt_REJECT bridge stp llc autofs4 sunrpc cpufreq_ondemand acpi_cpufreq freq_table xt_physdev iptable_filter ip_tables ip6t_REJECT ip6table_filter ip6_tables ipv6 dm_mirror dm_region_hash dm_log parport kvm_intel kvm uinput floppy tpm_infineon wmi sg serio_raw iTCO_wdt iTCO_vendor_support tg3 snd_hda_codec_realtek snd_hda_intel snd_hda_codec snd_hwdep snd_seq snd_seq_device snd_pcm snd_timer snd soundcore snd_page_alloc i7core_edac edac_core nouveau ttm drm_kms_helper drm i2c_algo_bit video output i2c_core ext3 jbd mbcache firewire_ohci firewire_core crc_itu_t sr_mod cdrom sd_mod crc_t10dif ahci dm_mod [last unloaded: microcode]
Pid: 9497, comm: modprobe Not tainted 2.6.32-72.el6.x86_64 #1 HP Z400 Workstation
RIP: 0010:[<ffffffffa048c267>]  [<ffffffffa048c267>] set_audio+0x47/0x170 [tda8290]
RSP: 0018:ffff88010ba01b28  EFLAGS: 00010206
RAX: 00000000000000ff RBX: ffff880119522800 RCX: 0000000000000002
RDX: 0000000000003be0 RSI: ffff88010ba01bb8 RDI: 0000000000000000
RBP: ffff88010ba01b28 R08: 0000000000000002 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffff88010ba01bb8 R14: 0000000000001900 R15: 0000000000001900
FS:  00007f4b96b3d700(0000) GS:ffff880028200000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000020 CR3: 000000011866c000 CR4: 00000000000026f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process modprobe (pid: 9497, threadinfo ffff88010ba00000, task ffff880100708a70)
Stack:
 ffff88010ba01b98 ffffffffa048c95b ffff88010ba01b78 0000000000000060
<0> 0000000000000000 0000000e00000000 000000000000001d ffffffffa03ec838
<0> ffff88010abac240 ffff880119522800 ffff880119522800 ffff880119522bc0
Call Trace:
 [<ffffffffa048c95b>] tda8295_set_params+0x3b/0x210 [tda8290]
 [<ffffffffa03ec838>] ? v4l2_i2c_new_subdev_cfg+0x88/0xc0 [v4l2_common]
 [<ffffffffa0484418>] set_freq+0x128/0x2f0 [tuner]
 [<ffffffffa0486464>] tuner_s_std+0xc4/0x740 [tuner]
 [<ffffffffa04b9ae6>] saa7134_set_tvnorm_hw+0x2d6/0x3d0 [saa7134]
 [<ffffffffa04ba455>] set_tvnorm+0xd5/0x100 [saa7134]
 [<ffffffffa04bc9fd>] saa7134_video_init2+0x1d/0x50 [saa7134]
 [<ffffffffa04bf57e>] saa7134_initdev+0x6e1/0xb1d [saa7134]
 [<ffffffff8125afea>] ? kobject_get+0x1a/0x30
 [<ffffffff812765f7>] local_pci_probe+0x17/0x20
 [<ffffffff812777e1>] pci_device_probe+0x101/0x120
 [<ffffffff8132ec72>] ? driver_sysfs_add+0x62/0x90
 [<ffffffff8132ee10>] driver_probe_device+0xa0/0x2a0
 [<ffffffff8132f0bb>] __driver_attach+0xab/0xb0
 [<ffffffff8132f010>] ? __driver_attach+0x0/0xb0
 [<ffffffff8132e074>] bus_for_each_dev+0x64/0x90
 [<ffffffff8132ebae>] driver_attach+0x1e/0x20
 [<ffffffff8132e4b0>] bus_add_driver+0x200/0x300
 [<ffffffff8132f3e6>] driver_register+0x76/0x140
 [<ffffffff814c7c43>] ? printk+0x41/0x46
 [<ffffffff81277a46>] __pci_register_driver+0x56/0xd0
 [<ffffffffa04de000>] ? saa7134_init+0x0/0x4f [saa7134]
 [<ffffffffa04de04d>] saa7134_init+0x4d/0x4f [saa7134]
 [<ffffffff8100a04c>] do_one_initcall+0x3c/0x1d0
 [<ffffffff810af5ef>] sys_init_module+0xdf/0x250
 [<ffffffff81013172>] system_call_fastpath+0x16/0x1b
Code: 20 01 49 c7 c0 c9 ec 48 a0 83 7e 04 01 74 2d 8b 0d 3f 2f 00 00 85 c9 0f 85 d7 00 00 00 c9 c3 0f 1f 44 00 00 a9 03 00 01 00 74 61 <c6> 47 20 02 83 7e 04 01 49 c7 c0 cc ec 48 a0 75 d3 0f b6 47 22
RIP  [<ffffffffa048c267>] set_audio+0x47/0x170 [tda8290]
 RSP <ffff88010ba01b28>
CR2: 0000000000000020

This happens because some I2C callbacks actually depend on having the
driver entirely initialized. To avoid this OOPS, just clean the I2C
callbacks, as if no device were detected.

Cc: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:22 -02:00
Mauro Carvalho Chehab 567aba0b79 [media] tda8290: Make all read operations atomic
Read operations should be preceeded by a write operation. However,
nothing prevents that an I2C operation could happen between the two
transactions.

To avoid that problem, use an unique I2C transfer for both parts of
the I2C transaction.

Cc: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:20 -02:00
Mauro Carvalho Chehab 5a85025f7d [media] em28xx: Fix IR support for WinTV USB2
Due to a lack of a break inside the switch, it were getting the
wrong keytable and get_key function.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:19 -02:00
Mauro Carvalho Chehab e6bcb2f324 [media] ir-kbd-i2c: Make IR debug messages more useful
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:18 -02:00
Mauro Carvalho Chehab 59aa346009 [media] dib0700: Fix IR keycode handling
Fixes Fedora 14 bug: https://bugzilla.redhat.com/show_bug.cgi?id=667157

There are a few bugs at the code that generates the scancode at dib0700:
	- RC keycode is wrong (it outputs a 24 bits keycode);
	- NEC extended outputs a keycode that have endiannes issues;
	- keycode tables for NEC extended remotes need to be updated.

The last issue need to be done as we get reports, as we don't have
the complete NEC-extended keycodes at the dibcom table.

This patch fixes the first two issues.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:17 -02:00
Mauro Carvalho Chehab 312d63e4b0 [media] rc-dib0700-nec: Fix keytable for Pixelview SBTVD
dib0700 now outputs NEC extended keycodes. Fix the keytable to reflect that.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:16 -02:00
Tobias Lorenz 186a21cb77 [media] radio-si470x: Always report support for RDS
The si470x i2c and usb driver support the RDS, so this ifdef statement
doesn't need more.

[mchehab@redhat.com: Fix a conflict on it]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Acked-by: Tobias Lorenz <tobias.lorenz@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:15 -02:00
Tobias Lorenz 131ddd1a30 [media] radio-si470x: de-emphasis should be set if requested by module parameter
instead of always setting de-emphasis.

Reported-by: Tobias Lorenz <tobias.lorenz@gmx.net>
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Acked-by: Tobias Lorenz <tobias.lorenz@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:14 -02:00
Hans Verkuil a1198ccf9c [media] v4l2-ioctl: fix incorrect error code if VIDIOC_DBG_G/S_REGISTER are unsupported
The ioctls VIDIOC_DBG_S_REGISTER and VIDIOC_DBG_G_REGISTER should return -EINVAL
if the driver didn't implement them. Currently they return -EPERM if called as
non-root user. However, this check should only be done if the driver actually
implemented these ioctls. Otherwise, just return -EINVAL as we do with all
unimplemented ioctls.

This bug make the v4l2-compliance test suite fail.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:13 -02:00
Hans de Goede 4c77590225 [media] gspca_sonixb: Fix mirrored image with ov7630
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:12 -02:00
Hans de Goede e48d38f7f1 [media] gspca_sonixj: Add one more commented out usb-id
While going through windows inf file I found more usb-id, add a comment
with this id for future reference.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:11 -02:00
Hans de Goede e530a5e3cf [media] gspca_sonixj: Probe sensor type independent of bridge type
Looking at the windows inf file, for usb ids with a sensor type where probing
is needed to determine the type (for example ov7630 or soi768), this is
needed for all bridge variants with a usb id indicating this sensor type.

So do the probing to determine the actual sensor type for types where the
usb-id info is not 100% deterministic, independent of the bridge type.

If you look through the list of currently active usb ids in sonixj, this
effectively only changes the code path for 0c45:60fe (sn9c105 + ov7630) and
0c45:612e (sn9c110 + ov7630), which according to the inf file can have a
soi768 instead of a ov7630 just like the sn9c120 + ov7630 models where we
already probe for a soi7630.

The main reason for this code change is to keep the code paths as bridge
variant independent as possible, so that we don't need a lot of special
per bridge cases, as we enable more usb-ids in the future.

This change makes the 0c45:60fe code path identical to the successfully
tested 0c45:613e, so also make sonixj the default driver for 0c45:60fe.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:10 -02:00
Hans de Goede 4944e27d85 [media] gspca_sonixj: Enable more usb ids when sn9c102 gets compiled too
Both we and the windows driver make no sensor specific differences
(with some exceptions) for different sonixj bridge types. Thus if a
sn9c105 bridge has been successfully tested with a sensor, the same
sensor can be successfully used with a sn9c120 bridge too.

Using this knowledge we can move over most usb-ids too the sonixj
driver when both are compiled.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:08 -02:00
Hans de Goede 69ffd25457 [media] gspca_sonixb: Add usb ids for known sn9c103 cameras
Now that our bridge code is unified for sn9c101/102 and sn9c103 models,
the sn9c103 models should simply work, given that the only difference
in the sn9c103 is audio support and a gamma correction table.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:07 -02:00
Hans de Goede 4e17cd2eac [media] gspca_sonixb: TAS5130C brightness control really is a gain control
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:07 -02:00
Hans de Goede 0d0d7ef71e [media] gspca_sonixb: Fix TAS5110D sensor gain control
Also fix the issue of the image being mirrored.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:06 -02:00
Hans de Goede f913c001cd [media] gspca_sonixb: Adjust autoexposure window for vga cams so that it is centered
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:05 -02:00
Hans de Goede 0a76cb8cef [media] gspca_sonixb: Refactor to unify bridge handling
Refactor the code to unify how the sn9c101/102 and the sn9c103 bridge
are handled. Also move code which is the same for all sensors from
the per sensor init register settings to a central place.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:03 -02:00
Hans de Goede a24f0c5c47 [media] sn9c102: Remove not supported and non existing usb ids
The sn9c102 driver claims a number of usb-ids which are for cameras
with sensor types which it does not support. Also it claims a number
of usb-ids which do not exist at all (not present in the windows
drivers .inf files, not known by google).

This patch also fixes the conflict with the gspca_sonixj driver for the
0c45:60c0 and 0c45:60fb usb ids.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:02 -02:00