History log of /drivers/media/video/cx231xx/cx231xx-cards.c
Revision Date Author Comments
266e8ae37daa04fb3d89759305659f4e0acbc126 04-Mar-2012 Jesper Juhl <jj@chaosbits.net> [media] media, cx231xx: Fix double free on close

In cx231xx_v4l2_close() there are two calls to
cx231xx_release_resources(dev) followed by kfree(dev). That is a
problem since cx231xx_release_resources() already kfree()'s its
argument, so we end up doing a double free.

Easily resolved by just removing the redundant kfree() calls after the
calls to cx231xx_release_resources().

I also changed the 'dev = NULL' assignments (which are rather
pointless since 'dev' is about to go out of scope), to 'fh->dev = NULL'
since it looks to me that that is what was actually intended.
And I removed the 'dev = NULL' assignment at the end of
cx231xx_release_resources() since it is pointless.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
6c2cc5b575ed09d81507ec86cc5cfad022d9236b 13-Jan-2012 Dan Carpenter <dan.carpenter@oracle.com> [media] cx231xx: dereferencing NULL after allocation failure

"dev" is NULL here so we should use "nr" instead of "dev->devno".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
15cb6af8ac1ee1291f98bae51cd46c6719e90c0f 07-Jan-2012 Thomas Petazzoni <thomas.petazzoni@free-electrons.com> [media] cx231xx: simplify argument passing to cx231xx_init_dev()

The 'struct cx231xx *' pointer was passed by reference to the
cx231xx_init_dev() function, for no reason. Instead, just pass it by
value, which is much more logical and simple.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
990862a2f024296f27460306393de8f0cdab8997 10-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] cx231xx: fix device disconnect checks

The driver were using DEV_MISCONFIGURED on some places, and
DEV_DISCONNECTED on others. In a matter of fact, DEV_MISCONFIGURED
were set only during the usb disconnect callback, with
was confusing.

Also, the alsa driver never checks if the device is present,
before doing some dangerous things.

Remove DEV_MISCONFIGURED, replacing it by DEV_DISCONNECTED.

Also, fixes the other usecases for DEV_DISCONNECTED.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
db702a7af6c85d94ff32b6110b3646180f93f086 10-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] cx231xx: cx231xx_devused is racy

cx231xx_devused is racy. Re-implement it in a proper way,
to remove the risk of mangling it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
7528cd273e14020117e6cdb6cc307f223e97c5ed 10-Jan-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] cx231xx: Fix unregister logic

There are several weirdness at the unregister logic.

First of all, IR has a poll thread. This thread needs to be
removed, as it uses some resources associated to the main driver.
So, the driver needs to explicitly unregister the I2C client for
ir-kbd-i2c.

If, for some reason, the driver needs to wait for a close()
to happen, not all memories will be freed, because the free
logic were in the wrong place.

Also, v4l2_device_unregister() seems to be called too early,
as devices are still using it.

Finally, even with the device disconnected, there is one
USB function call that will still try to talk with it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
c53a8e951b9cb5689a510ef31c85fb9b1ff78f11 07-Jan-2012 Thomas Petazzoni <thomas.petazzoni@free-electrons.com> [media] cx231xx: remove useless 'lif' variable in cx231xx_usb_probe()

Now that we set the intfdata on the right interface, the 'lif'
variable is useless.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
a116a05cb4c2d057b3e15ef3bd0f3d657cb6ef99 07-Jan-2012 Thomas Petazzoni <thomas.petazzoni@free-electrons.com> [media] cx231xx: fix crash after load/unload/load of module

The following sequence of commands was triggering a kernel crash in
cdev_get():

modprobe cx231xx
rmmod cx231xx
modprobe cx231xx
v4l2grab -n 1

The problem was that cx231xx_usb_disconnect() was not doing anything
because the test:

if (!dev->udev)
return;

was reached (i.e, dev->udev was NULL).

This is due to the fact that the 'dev' pointer placed as intfdata into
the usb_interface structure had the wrong value, because
cx231xx_probe() was doing the usb_set_intfdata() on the wrong
usb_interface structure. For some reason, cx231xx_probe() was doing
the following:

static int cx231xx_usb_probe(struct usb_interface *interface,
const struct usb_device_id *id)
{
struct usb_interface *lif = NULL;
[...]
/* store the current interface */
lif = interface;
[...]
/* store the interface 0 back */
lif = udev->actconfig->interface[0];
[...]
usb_set_intfdata(lif, dev);
[...]
retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev);
[...]
}

So, the usb_set_intfdata() was done on udev->actconfig->interface[0]
and not on the 'interface' passed as argument to the ->probe() and
->disconnect() hooks. Later on, v4l2_device_register() was
initializing the intfdata of the correct usb_interface structure as a
pointer to the v4l2_device structure.

Upon unregistration, the ->disconnect() hook was getting the intfdata
of the usb_interface passed as argument... and casted it to a 'struct
cx231xx *' while it was in fact a 'struct v4l2_device *'.

The correct fix seems to just be to set the intfdata on the proper
interface from the beginning. Now, loading/unloading/reloading the
driver allows to use the device properly.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
ecb3b2b35db49778b6d89e3ffd0c400776c20735 18-Nov-2011 Greg Kroah-Hartman <gregkh@suse.de> USB: convert drivers/media/* to use module_usb_driver()

This converts the drivers in drivers/media/* to use the
module_usb_driver() macro which makes the code smaller and a bit
simpler.

Added bonus is that it removes some unneeded kernel log messages about
drivers loading and/or unloading.

Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Luca Risolia <luca.risolia@studio.unibo.it>
Cc: Jean-Francois Moine <moinejf@free.fr>
Cc: Frank Zago <frank@zago.net>
Cc: Olivier Lorin <o.lorin@laposte.net>
Cc: Erik Andren <erik.andren@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Brian Johnson <brijohn@gmail.com>
Cc: Leandro Costantino <lcostantino@gmail.com>
Cc: Antoine Jacquet <royale@zerezo.com>
Cc: Jarod Wilson <jarod@redhat.com>
Cc: Florian Mickler <florian@mickler.org>
Cc: Antti Palosaari <crope@iki.fi>
Cc: Michael Krufky <mkrufky@kernellabs.com>
Cc: "David Härdeman" <david@hardeman.nu>
Cc: Florent Audebert <florent.audebert@anevia.com>
Cc: Sam Doshi <sam@metal-fish.co.uk>
Cc: Manu Abraham <manu@linuxtv.org>
Cc: Olivier Grenie <olivier.grenie@dibcom.fr>
Cc: Patrick Boettcher <patrick.boettcher@dibcom.fr>
Cc: "Igor M. Liplianin" <liplianin@me.by>
Cc: Derek Kelly <user.vdr@gmail.com>
Cc: Malcolm Priestley <tvboxspy@gmail.com>
Cc: Steven Toth <stoth@kernellabs.com>
Cc: "André Weidemann" <Andre.Weidemann@web.de>
Cc: Martin Wilks <m.wilks@technisat.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Jose Alberto Reguero <jareguero@telefonica.net>
Cc: David Henningsson <david.henningsson@canonical.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Joe Perches <joe@perches.com>
Cc: Jesper Juhl <jj@chaosbits.net>
Cc: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Anssi Hannula <anssi.hannula@iki.fi>
Cc: Rafi Rubin <rafi@seas.upenn.edu>
Cc: Dan Carpenter <error27@gmail.com>
Cc: Paul Bender <pebender@gmail.com>
Cc: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: "Márcio A Alves" <froooozen@gmail.com>
Cc: Julia Lawall <julia@diku.dk>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Chris Rankin <rankincj@yahoo.com>
Cc: Lee Jones <lee.jones@canonical.com>
Cc: Andy Walls <awalls@md.metrocast.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Dean Anderson <linux-dev@sensoray.com>
Cc: Pete Eberlein <pete@sensoray.com>
Cc: Arvydas Sidorenko <asido4@gmail.com>
Cc: Andrea Anacleto <andreaanacleto@libero.it>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
992299e84a4891275ea5924e30b66ce39a701e5e 24-Jul-2011 Devin Heitmueller <dheitmueller@kernellabs.com> [media] Fix regression introduced which broke the Hauppauge USBLive 2

The following patch addresses the regression introduced in the cx231xx
driver which stopped the Hauppauge USBLive2 from working.

Confirmed working by both myself and the user who reported the issue
on the KernelLabs blog (Robert DeLuca).

At some point during refactoring of the cx231xx driver, the USBLive 2 device
became broken. This patch results in the device working again.

Thanks to Robert DeLuca for sponsoring this work.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: Robert DeLuca <robertdeluca@me.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
ef60e8f5d58752879cc69d9746133f2416ac206a 04-Jul-2011 Julia Lawall <julia@diku.dk> [media] drivers/media/video/cx231xx/cx231xx-cards.c: add missing kfree

Clear the cx231xx_devused variable and free dev in the error handling code,
as done in the error handling code nearby.

The semantic match that finds this problem is as follows:

// <smpl>
@r@
identifier x;
@@

kfree(x)

@@
identifier r.x;
expression E1!=0,E2,E3,E4;
statement S;
@@

(
if (<+...x...+>) S
|
if (...) { ... when != kfree(x)
when != if (...) { ... kfree(x); ... }
when != x = E3
* return E1;
}
... when != x = E2
if (...) { ... when != x = E4
kfree(x); ... return ...; }
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
de8ae0d516379ef0e0608415a3979ecdd2462c2e 08-Jun-2011 Peter Moon <pomoon@gmail.com> [media] cx231xx: Add support for Hauppauge WinTV USB2-FM

This patch adds support for the "Hauppauge WinTV USB2-FM" Analog TV Stick.
It includes support for both the PAL and NTSC variants of the device.

Signed-off-by: Peter Moon <pomoon@gmail.com>
Reviewed-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2a7b6a404b4c6a9184b60b89607d5f883c43fa62 17-May-2011 Igor Novgorodov <igor@novg.net> [media] cx231xx: Add support for Iconbit U100

This patch adds support for the "Iconbit Analog Stick U100 FM".
Only composite & s-video inputs, no tuner support now.

Signed-off-by: Igor Novgorodov <igor@novg.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
eeaaf817c7202b71a6e1aab87ebd538d1b5e5a42 12-Apr-2011 Márcio Alves <froooozen@gmail.com> [media] cx231xx: add support for Kworld

[mchehab@redhat.com: avoided board renumberation, removed an unused #define
and re-used the existing mb86a20s dvb attach code]
Signed-off-by: Márcio A Alves <froooozen@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
f72cfd859b0e436d9f680790cb665ad1390187ae 25-Jan-2011 Peter Huewe <PeterHuewe@gmx.de> [media] video/cx231xx: Fix sparse warning: Using plain integer as NULL pointer

This patch fixes the warning "Using plain integer as NULL pointer",
generated by sparse, by replacing the offending 0s with NULL.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Reviewed-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
4e105039da20f57958a2f538048a0f1bfb576b8b 01-Feb-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [media] cx231xx: Add support for PV Xcapture USB

Adds support for Pixelviex Xcapture USB grabber device.
This device has one composite and one s-video entry
only, plus a button.

For now, the button is not supported.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2f86138706d3b5c85a69e72ca2959717372386dd 01-Feb-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [media] cx231xx: Use parameters to describe some board variants

Instead of per-model tests all over the code, use some parameters
at the board entries to describe the model variants for:
- devices with 417 MPEG encoder;
- devices that use external AV;
- devices where vbi VANC endpoint doesn't work;
- devices with xc5000 that require different IF
initialization (and probably will cover also
xc3028).
- devices with xceive tuner that require a reset
during init.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
8bb84227d1ba41d6c1ec9350a4424ece5fe00e33 30-Jan-2011 Mauro Carvalho Chehab <mchehab@redhat.com> [media] cx231xx: Simplify interface checking logic at probe

Just a cleanup patch. Removes one indent level by moving
the return -ENODEV to happen before the device register
logic, if the interface is not the audio/video (int 1).

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
788e5d4dc825ffc2eb863272d9a57fb93490dd92 17-Dec-2010 Mauro Carvalho Chehab <mchehab@redhat.com> [media] cx231xx: Fix IR keymap for Pixelview SBTVD Hybrid

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
5ae094cea1b4f3715ee6ea4f49d0b36d564f90e7 18-Nov-2010 Dan Carpenter <error27@gmail.com> [media] cx231xx: stray unlock on error path

The lock isn't held here and doesn't need to be unlocked. The code has
been like this since the driver was merged.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
29e3ec19d5c88d534ced219d3962d67243e4d310 17-Nov-2010 Mauro Carvalho Chehab <mchehab@redhat.com> [media] cx231xx: Properly name rc_map name

rc_map is confusing, as it may be understood as another thing. Properly
rename the field to indicate its usage.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
1bc25f7d6c0f353d3c73252048fe03a3d8f0e6b8 23-Oct-2010 Mauro Carvalho Chehab <mchehab@redhat.com> [media] cx231xx: Add IR support for Pixelview Hybrid SBTVD

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9ab66912e0cd671fbea1b99e8a37d11b14d50baf 23-Oct-2010 Mauro Carvalho Chehab <mchehab@redhat.com> [media] cx231xx: Add a driver for I2C-based IR

Although cx231xx has a very good IR support, already supported by
mceusb driver, some designs decided to add a separate I2C
microcontroller chip in order to handle IR.

Due to that, add a glue to ir-kbd-i2c is needed, in order to support
those devices.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
55fa288deca4b17e539ba49a9b0d0ed474afa6f8 29-Sep-2010 Mauro Carvalho Chehab <mchehab@redhat.com> [media] cx231xx: use callback to set agc on PixelView

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
ede676c72d0b18f1c15300f7874370e771489a1c 28-Sep-2010 Mauro Carvalho Chehab <mchehab@redhat.com> [media] add digital support for PV SBTVD hybrid

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9417bc6dd9de85944501f8f4ce8dd0e64135ca82 27-Sep-2010 Mauro Carvalho Chehab <mchehab@redhat.com> [media] Add analog support for Pixelvied Hybrid SBTVD

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
707bcf326bd50c875d82bd2e7c31dcfb92b7e813 24-Dec-2010 Tejun Heo <tj@kernel.org> media/video: explicitly flush request_module work

Video drivers request submodules using a work during probe and calls
flush_scheduled_work() on exit to make sure the work is complete
before being unloaded. This patch makes these drivers flush the work
directly instead of using flush_scheduled_work().

While at it, relocate request_submodules() call in saa7134_initdev()
right right before successful return as in other drivers to avoid
failing after the work is scheduled and returning failure without the
work still active.

This is in preparation for the deprecation of flush_scheduled_work().

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
9a1f8b34aa539000da17a06235e4bec254d0bfb5 24-Sep-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] v4l: Remove module_name argument to the v4l2_i2c_new_subdev* functions

The argument isn't used anymore by the functions, remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
1532a07042289d420f040f3bd4370cc106860003 24-Sep-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] v4l: Remove hardcoded module names passed to v4l2_i2c_new_subdev*

With the v4l2_i2c_new_subdev* functions now supporting loading modules
based on modaliases, replace the hardcoded module name passed to those
functions by NULL.

All corresponding I2C modules have been checked, and all of them include
a module aliases table with names corresponding to what the drivers
modified here use.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
44ed8950f8529ad58becc2de2f14a49ad32393ad 19-Oct-2010 Mauro Carvalho Chehab <mchehab@redhat.com> [media] cx231xx: Remove IR support from the driver

Polaris design uses MCE support. Instead of reinventing the wheel,
just let mceusb handle the remote controller.

Acked-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Sri Devi <Srinivasa.Deevi@conexant.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
10e4ebb6d5fcc60e0b78b228c2683cb6ee4543ba 19-Oct-2010 Mauro Carvalho Chehab <mchehab@redhat.com> [media] cx231xx: Only register USB interface 1

Interface 0 is used by IR. The current driver starts initializing
on it, finishing on interface 6. Change the logic to only handle
interface 1. This allows another driver (mceusb) to take care of
the IR interface.

Reviewed-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Sri Devi <Srinivasa.Deevi@conexant.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
78bb6df6f2dd390a3480249187a055c385c0618a 27-Sep-2010 Mauro Carvalho Chehab <mchehab@redhat.com> [media] cx231xx: Only change gpio direction when needed

Acked-by: Sri Deevi <Srinivasa.Deevi@conexant.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
1a4aa920d0b49af2c0d9bbedb3bb75be4e174218 27-Sep-2010 Mauro Carvalho Chehab <mchehab@redhat.com> [media] cx231xx: properly use the right tuner i2c address

The driver has a field to indicate what bus is used by tuner and
by demod. However, this field were never used. On Pixelview,
it uses I2C 2 for tuner, instead of I2C 1.

drivers/media/video/cx231xx/cx231xx-cards.c

Acked-by: Sri Deevi <Srinivasa.Deevi@conexant.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
b522591a4580b54430873784e1b956646d7970d9 19-Aug-2010 Devin Heitmueller <dheitmueller@hauppauge.com> [media] cx231xx: remove i2c ir stubs

Nobody is ever going to implement an i2c based IR controller on a bridge that
has an onboard universal IR receiver. This stuff was all copied from em28xx,
which has old enough versions of the chip that some didn't have onboard IR.

Remove the stubs related to i2c based IR (keeping the cx231xx-input code).

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2b43db320eba4d5ceba5804c38afa21e65f83016 18-Aug-2010 Devin Heitmueller <dheitmueller@hauppauge.com> [media] cx231xx: move printk() line related to 417 initialization

Move a printk() message which refers to enabling the cx23417 so that it only
shows up on a board that has the cx23417.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9f51259f4acfffc71dd8f2f2c1472f7caedbdfae 18-Aug-2010 Devin Heitmueller <dheitmueller@hauppauge.com> [media] cx231xx: fixup video grabber board profile

The video grabber reference design (Veyron) does not have a tuner input, so
do not have it defined in the board profile.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
888062188cfbed50bbe14f7e180cdc70336dfc4c 18-Aug-2010 Devin Heitmueller <dheitmueller@hauppauge.com> [media] cx231xx: make output mode configurable via the board profile

Extend the board profile structure to allow configuration of the output mode.
Right now they are all doing VIP 1.1 format, but we have a board that needs
ITU656 format (which hasn't been checked in yet).

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
4270c3cac41e248ee339d18e01251989b74a30f1 31-Jul-2010 Devin Heitmueller <dheitmueller@hauppauge.com> [media] cx231xx: Add initial support for Hauppauge USB-Live2

Add initial support for the Hauppauge USBLive 2 (2040:c200). Note that I
had to copy a bunch of the case statements used for the Conexant video grabber
reference design (which also doesn't have a tuner). This will likely need to
be refactored out into the board profile.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
435b4f7897b7e2f233c313e65ac82bd1d3599c43 09-Jul-2010 Devin Heitmueller <dheitmueller@hauppauge.com> [media] cx231xx: make video scaler work properly

Move the responsibility for setting up the horizontal and vertical scalers
entirely to the cx25840 driver. The cx231xx-avcore was actually programming
garbage into the HSCALE_CTRL and VSCALE_CTRL registers (because of differences
in how the em28xx driver worked, which the cx231xx driver was derived from).

The net effect is that the scaler now works properly (tested with both PAL
and NTSC under mplayer and tvtime).

This patch also gets rid of cx25840 errors showing up in dmesg which say
"720x480 is not a valid size" (since we now properly setup the size of the
active video area).

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
e3e0aaaafae24658f3d8683c65bc6793adbdfeb8 08-Jul-2010 Devin Heitmueller <dheitmueller@hauppauge.com> [media] cx231xx: remove board specific initialization

There is no need for a switch statement here. Use the contents of the board
profile to dictate the tuner driver and i2c address. Eventually if a board
ever comes around which has a different i2c bus than #1, well that should be a
field in the board profile as well.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
d78148fba47c7c79f3d14db1abe29172b45ab9c8 06-Jul-2010 Devin Heitmueller <dheitmueller@hauppauge.com> [media] cx231xx: add USB ID Hauppauge model 111301

Add a USB ID for model 111301.

Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
1a50fddefd17ec1359d08cd23c77da42fabbb4a7 06-Jul-2010 Michael Krufky <mkrufky@kernellabs.com> [media] cx231xx: add support for Hauppauge EXETER

Add support for various Hauppauge EXETER designs.

Note by DJH: fixed a few minor 'make checkpatch' warnings before commit.

Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
64fbf44455260684fa5bfdd3121af3d0ef0b48dd 06-Jul-2010 Palash Bandyopadhyay <palash.bandyopadhyay@conexant.com> [media] cx231xx: Added support for Carraera, Shelby, RDx_253S and VIDEO_GRABBER

Added support for new cx231xx boards - Carraera, Shelby, RDx_253S and
VIDEO_GRABBER.

[mchehab@redhat.com: Fix a merge conflict with BKL removal patches]
Signed-off-by: Palash Bandyopadhyay <palash.bandyopadhyay@conexant.com>
Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
c10469c637602c2385e2993d8c730cc44fd47d23 11-Sep-2010 Mauro Carvalho Chehab <mchehab@redhat.com> V4L/DVB: cx231xx: Avoid an OOPS when card is unknown (card=0)

As reported by: Carlos Americo Domiciano <c_domiciano@yahoo.com.br>:

[ 220.033500] cx231xx v4l2 driver loaded.
[ 220.033571] cx231xx #0: New device Conexant Corporation Polaris AV Capturb @ 480 Mbps (1554:5010) with 6 interfaces
[ 220.033577] cx231xx #0: registering interface 0
[ 220.033591] cx231xx #0: registering interface 1
[ 220.033654] cx231xx #0: registering interface 6
[ 220.033910] cx231xx #0: Identified as Unknown CX231xx video grabber (card=0)
[ 220.033946] BUG: unable to handle kernel NULL pointer dereference at (null)
[ 220.033955] IP: [<ffffffffa0d3c8bd>] cx231xx_pre_card_setup+0x5d/0xb0 [cx231xx]

Thanks-to: Carlos Americo Domiciano <c_domiciano@yahoo.com.br>
Cc: stable@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
3bfb317f97cfddbbec67bbe8e35ad38af3507397 03-Sep-2010 Mauro Carvalho Chehab <mchehab@redhat.com> V4L/DVB: Don't identify PV SBTVD Hybrid as a DibCom device

As reported by Carlos, Prolink Pixelview SBTVD Hybrid is based on
Conexant cx231xx + Fujitsu 86A20S demodulator. However, both shares
the same USB ID. So, we need to use USB bcdDevice, in order to
properly discover what's the board.

We know for sure that bcd 0x100 is used for a dib0700 device, while
bcd 0x4001 is used for a cx23102 device. This patch reserves two ranges,
the first one from 0x0000-0x3f00 for dib0700, and the second from
0x4000-0x4fff for cx231xx devices.

This may need fixes in the future, as we get access to other devices.

Thanks-to: Carlos Americo Domiciano <c_domiciano@yahoo.com.br>
Cc: stable@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
7ee0a28829e245648091040d4ba30feea5fa5ed5 13-Dec-2009 Márton Németh <nm127@freemail.hu> V4L/DVB (13687): cx231xx: use NULL when pointer is needed

The gpio field in the cx231xx_board.input structure is a pointer. Eliminate the
following sparse warnings (see "make C=1"):
* cx231xx-cards.c:72:13: warning: Using plain integer as NULL pointer
* cx231xx-cards.c:77:13: warning: Using plain integer as NULL pointer
* cx231xx-cards.c:84:13: warning: Using plain integer as NULL pointer
* cx231xx-cards.c:111:13: warning: Using plain integer as NULL pointer
* cx231xx-cards.c:116:13: warning: Using plain integer as NULL pointer
* cx231xx-cards.c:123:13: warning: Using plain integer as NULL pointer
* cx231xx-cards.c:151:13: warning: Using plain integer as NULL pointer
* cx231xx-cards.c:156:13: warning: Using plain integer as NULL pointer
* cx231xx-cards.c:163:13: warning: Using plain integer as NULL pointer

Signed-off-by: Márton Németh <nm127@freemail.hu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
38c7c036036c6260606a2a833aaad3794ca22499 27-Nov-2009 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB (13550): v4l: Use the new video_device_node_name function

Fix all device drivers to use the new video_device_node_name function.

This also strips kernel log messages from the "/dev/" prefix, has the device
node location is a userspace policy decision unknown to the kernel.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
53dacb15705901e14b03dcba27e40364fedd9d09 10-Aug-2009 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (12540): v4l: simplify v4l2_i2c_new_subdev and friends

Rewrite v4l2_i2c_new_subdev as a simplified version of v4l2_i2c_new_subdev_cfg
and remove v4l2_i2c_new_probed_subdev and v4l2_i2c_new_probed_subdev_addr.

This simplifies this API substantially.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
4d7a2d6721a6380d4ffc26d81d2c8232fd0d2dfc 13-May-2009 Jean Delvare <khali@linux-fr.org> V4L/DVB (11845): ir-kbd-i2c: Use initialization data

For specific boards, pass initialization data to ir-kbd-i2c instead
of modifying the settings after the device is initialized. This is
more efficient and easier to read.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
c668f32dca105d876e51862a003a302fa61e4ae4 13-May-2009 Jean Delvare <khali@linux-fr.org> V4L/DVB (11844): ir-kbd-i2c: Switch to the new-style device binding model

Let card drivers probe for IR receiver devices and instantiate them if
found. Ultimately it would be better if we could stop probing
completely, but I suspect this won't be possible for all card types.

There's certainly room for cleanups. For example, some drivers are
sharing I2C adapter IDs, so they also had to share the list of I2C
addresses being probed for an IR receiver. Now that each driver
explicitly says which addresses should be probed, maybe some addresses
can be dropped from some drivers.

Also, the special cases in saa7134-i2c should probably be handled on a
per-board basis. This would be more efficient and less risky than always
probing extra addresses on all boards. I'll give it a try later.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
5325b4272a53b43f55b82cc369c310c2fcacdca1 02-Apr-2009 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (11380): v4l2-subdev: change s_routing prototype

It is no longer needed to use a struct pointer as argument, since v4l2_subdev
doesn't require that ioctl-like approach anymore. Instead just pass the input,
output and config (new!) arguments directly.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
e6574f2fbecdb8af807169d345c10131ae060a88 01-Apr-2009 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (11373): v4l2-common: add explicit v4l2_device pointer as first arg to new_(probed)_subdev

The functions v4l2_i2c_new_subdev and v4l2_i2c_new_probed_subdev relied on
i2c_get_adapdata to return the v4l2_device. However, this is not always
possible on embedded platforms. So modify the API to pass the v4l2_device
pointer explicitly.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
cc26b076cf8b1040ccc514302ef9a24042272ec3 30-Mar-2009 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (11369): v4l2-subdev: add load_fw and use that instead of abusing core->init.

The init callback was used in several places to load firmware. Make a separate
load_fw callback for that. This makes the code a lot more understandable.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
6e7f7b37e719746da67ecfc54a264783d473ca05 01-Apr-2009 Janne Grunau <j@jannau.net> V4L/DVB (11353): cx231xx: remove explicitly set v4l2_device.name

Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
7231748af687819fa1699c80e64ed6b47a4a3ff0 01-Apr-2009 Janne Grunau <j@jannau.net> V4L/DVB (11352): cx231xx: use usb_interface.dev for v4l2_device_register

Signed-off-by: Janne Grunau <j@jannau.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
4be1ad36683b23355f059c3386f97a4427d1a56a 22-Mar-2009 Mauro Carvalho Chehab <mchehab@redhat.com> V4L/DVB (11134): cx231xx: dmesg cleanup

Remove some printk's that were needed only during development phase. Also,
cleans the printed messages to produce a nicer result.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
90960744a1ea83b70ace7983c80173220c9451c3 22-Mar-2009 Mauro Carvalho Chehab <mchehab@redhat.com> V4L/DVB (11132): cx231xx: usb probe cleanups

Simplifies the usb probe logic, cleaning the printed messages during the probing
phase.

Cc: Srinivasa Deevi <srinivasa.deevi@conexant.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
b905de30e300b959ea89c3af9d436e7f73e9e628 22-Mar-2009 Mauro Carvalho Chehab <mchehab@redhat.com> V4L/DVB (11131): cx231xx: avoid trying to access unfilled dev struct

cx231xxinfo needs dev->name. However, this is not declared on the time the
check for the max number of supported devices is done.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
b1196126b016d0f28a99c16b27c403d0ecac501a 21-Mar-2009 Sri Deevi <Srinivasa.Deevi@conexant.com> V4L/DVB (11128): cx231xx: convert the calls to subdev format

This patch converts cx231xx to the new v4l2 dev/subdev, doing:
- Conversion of i2c calls to subdev calls;
- all subdev calls to call_all();
- Corrected the header file order in cx231xx.h;
- Added tuner frequency setting.

Signed-off-by: Srinivasa Deevi <srinivasa.deevi@conexant.com>
Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
ed559edf35bdefb91c7eba5ea3dfd1e939aaa782 13-Mar-2009 Sri Deevi <Srinivasa.Deevi@conexant.com> V4L/DVB (11038): Fix the issue with audio module & correction of Names

The audio module requested in driver differs with module
created by Makefile. Makefile is corrected to create the same module name
required by driver. Also, corrected the strings that shows wrong name.

Signed-off-by: Srinivasa Deevi <srinivasa.deevi@conexant.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
d73abcff75cd3b1b5c910df454ac332beb29eed1 12-Mar-2009 Hans Verkuil <hverkuil@xs4all.nl> V4L/DVB (10982): cx231xx: fix compile warning

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
6e4f574ba43511ac1cb860027275e08529c5a28f 11-Mar-2009 Sri Deevi <srinivasa.deevi@conexant.com> V4L/DVB (10958): cx231xx: some additional CodingStyle and minor fixes

changed the pcb-config.c/h to pcb-cfg.c/h for short names.

Signed-off-by: Srinivasa Deevi <srinivasa.deevi@conexant.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
b9255176453086b2531c5559350bd5c92b771cc5 04-Mar-2009 Sri Deevi <Srinivasa.Deevi@conexant.com> V4L/DVB (10957): cx231xx: Fix CodingStyle

Fixes several CodingStyle issues on the driver.

Signed-off-by: Srinivasa Deevi <srinivasa.deevi@conexant.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
818fdf341369110ff91296843797a9431a3d9b31 13-Mar-2009 Mauro Carvalho Chehab <mchehab@redhat.com> V4L/DVB (10957a): cx231xx: Fix compilation breakage

Only cx231xx-video needs linux/version.h, due to KERNEL_VERSION macro,
that is used by V4L2 API.

This patch moves the KERNEL_VERSION to its proper place and starts with
0,0,1.

There are still much more to be fixed on later patches

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
84b5dbf39ed2f51224841bbbf08439158d69d427 03-Mar-2009 Mauro Carvalho Chehab <mchehab@redhat.com> V4L/DVB (10955): cx231xx: CodingStyle automatic fixes with Lindent

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
e0d3bafd02586cfde286c320f56906fd9fa8d256 03-Mar-2009 Sri Deevi <Srinivasa.Deevi@conexant.com> V4L/DVB (10954): Add cx231xx USB driver

Signed-off-by: Srinivasa Deevi <srinivasa.deevi@conexant.com>
[mchehab@redhat.com: Remove the Kconfig changes, to avoid git breakages]
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>