summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx25840
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx25840')
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c49
-rw-r--r--drivers/media/video/cx25840/cx25840.h7
2 files changed, 31 insertions, 25 deletions
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index aea3f03..3b09f46 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -333,24 +333,30 @@ static int set_input(struct i2c_client *client, enum cx25840_input input)
static int set_v4lstd(struct i2c_client *client, v4l2_std_id std)
{
- u8 fmt;
-
- switch (std) {
- /* zero is autodetect */
- case 0: fmt = 0x0; break;
- /* default ntsc to ntsc-m */
- case V4L2_STD_NTSC:
- case V4L2_STD_NTSC_M: fmt = 0x1; break;
- case V4L2_STD_NTSC_M_JP: fmt = 0x2; break;
- case V4L2_STD_NTSC_443: fmt = 0x3; break;
- case V4L2_STD_PAL: fmt = 0x4; break;
- case V4L2_STD_PAL_M: fmt = 0x5; break;
- case V4L2_STD_PAL_N: fmt = 0x6; break;
- case V4L2_STD_PAL_Nc: fmt = 0x7; break;
- case V4L2_STD_PAL_60: fmt = 0x8; break;
- case V4L2_STD_SECAM: fmt = 0xc; break;
- default:
- return -ERANGE;
+ u8 fmt=0; /* zero is autodetect */
+
+ /* First tests should be against specific std */
+ if (std & V4L2_STD_NTSC_M_JP) {
+ fmt=0x2;
+ } else if (std & V4L2_STD_NTSC_443) {
+ fmt=0x3;
+ } else if (std & V4L2_STD_PAL_M) {
+ fmt=0x5;
+ } else if (std & V4L2_STD_PAL_N) {
+ fmt=0x6;
+ } else if (std & V4L2_STD_PAL_Nc) {
+ fmt=0x7;
+ } else if (std & V4L2_STD_PAL_60) {
+ fmt=0x8;
+ } else {
+ /* Then, test against generic ones */
+ if (std & V4L2_STD_NTSC) {
+ fmt=0x1;
+ } else if (std & V4L2_STD_PAL) {
+ fmt=0x4;
+ } else if (std & V4L2_STD_SECAM) {
+ fmt=0xc;
+ }
}
cx25840_and_or(client, 0x400, ~0xf, fmt);
@@ -767,7 +773,6 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address,
client->addr = address;
client->adapter = adapter;
client->driver = &i2c_driver_cx25840;
- client->flags = I2C_CLIENT_ALLOW_USE;
snprintf(client->name, sizeof(client->name) - 1, "cx25840");
cx25840_dbg("detecting cx25840 client on address 0x%x\n", address << 1);
@@ -838,15 +843,15 @@ static int cx25840_detach_client(struct i2c_client *client)
/* ----------------------------------------------------------------------- */
static struct i2c_driver i2c_driver_cx25840 = {
- .name = "cx25840",
+ .driver = {
+ .name = "cx25840",
+ },
.id = I2C_DRIVERID_CX25840,
- .flags = I2C_DF_NOTIFY,
.attach_adapter = cx25840_attach_adapter,
.detach_client = cx25840_detach_client,
.command = cx25840_command,
- .owner = THIS_MODULE,
};
diff --git a/drivers/media/video/cx25840/cx25840.h b/drivers/media/video/cx25840/cx25840.h
index 4932ed1..40aa59f 100644
--- a/drivers/media/video/cx25840/cx25840.h
+++ b/drivers/media/video/cx25840/cx25840.h
@@ -27,15 +27,16 @@
extern int cx25840_debug;
#define cx25840_dbg(fmt, arg...) do { if (cx25840_debug) \
- printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \
+ printk(KERN_INFO "%s debug %d-%04x: " fmt, \
+ client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define cx25840_err(fmt, arg...) do { \
- printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \
+ printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define cx25840_info(fmt, arg...) do { \
- printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \
+ printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define CX25840_CID_CARDTYPE (V4L2_CID_PRIVATE_BASE+0)
OpenPOWER on IntegriCloud