The patch number 9752 was added via Mauro Carvalho Chehab <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.
Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel
If anyone has any objections, please let us know by sending a message to:
[EMAIL PROTECTED]
------
From: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
Remove duplicated fields on em28xx_board and em28xx structs
Several fields are duplicated on both structs. Let's just copy em28xx_board
instead.
A later cleanup could just copy the fields that are changed, in order to keep
em28xx_board
const.
Priority: normal
Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
linux/drivers/media/video/em28xx/em28xx-cards.c | 48 ++++++----------
linux/drivers/media/video/em28xx/em28xx-core.c | 8 +-
linux/drivers/media/video/em28xx/em28xx-dvb.c | 4 -
linux/drivers/media/video/em28xx/em28xx-i2c.c | 6 +-
linux/drivers/media/video/em28xx/em28xx-input.c | 4 -
linux/drivers/media/video/em28xx/em28xx-video.c | 18 +++---
linux/drivers/media/video/em28xx/em28xx.h | 21 ++-----
7 files changed, 45 insertions(+), 64 deletions(-)
diff -r d49151680bc5 -r 2600e739d39d
linux/drivers/media/video/em28xx/em28xx-cards.c
--- a/linux/drivers/media/video/em28xx/em28xx-cards.c Tue Nov 25 10:10:25
2008 -0200
+++ b/linux/drivers/media/video/em28xx/em28xx-cards.c Tue Nov 25 10:39:50
2008 -0200
@@ -1267,19 +1267,9 @@ int em28xx_tuner_callback(void *ptr, int
}
EXPORT_SYMBOL_GPL(em28xx_tuner_callback);
-static void em28xx_set_model(struct em28xx *dev)
+static void inline em28xx_set_model(struct em28xx *dev)
{
- dev->is_em2800 = em28xx_boards[dev->model].is_em2800;
- dev->has_msp34xx = em28xx_boards[dev->model].has_msp34xx;
- dev->tda9887_conf = em28xx_boards[dev->model].tda9887_conf;
- dev->decoder = em28xx_boards[dev->model].decoder;
- dev->xclk = em28xx_boards[dev->model].xclk;
- dev->i2c_speed = em28xx_boards[dev->model].i2c_speed;
- dev->max_range_640_480 = em28xx_boards[dev->model].max_range_640_480;
- dev->has_dvb = em28xx_boards[dev->model].has_dvb;
- dev->has_snapshot_button =
em28xx_boards[dev->model].has_snapshot_button;
- dev->ir_codes = em28xx_boards[dev->model].ir_codes;
- dev->valid = em28xx_boards[dev->model].valid;
+ memcpy(&dev->board, &em28xx_boards[dev->model], sizeof(dev->board));
}
/* Since em28xx_pre_card_setup() requires a proper dev->model,
@@ -1336,16 +1326,16 @@ void em28xx_pre_card_setup(struct em28xx
/* Those are the default values for the majority of boards
Use those values if not specified otherwise at boards entry
*/
- if (!dev->xclk)
- dev->xclk = EM28XX_XCLK_IR_RC5_MODE |
- EM28XX_XCLK_FREQUENCY_12MHZ;
-
- if (!dev->i2c_speed)
- dev->i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
- EM28XX_I2C_FREQ_100_KHZ;
-
- em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->xclk & 0x7f);
- em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev->i2c_speed);
+ if (!dev->board.xclk)
+ dev->board.xclk = EM28XX_XCLK_IR_RC5_MODE |
+ EM28XX_XCLK_FREQUENCY_12MHZ;
+
+ if (!dev->board.i2c_speed)
+ dev->board.i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
+ EM28XX_I2C_FREQ_100_KHZ;
+
+ em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk & 0x7f);
+ em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, dev->board.i2c_speed);
msleep(50);
/* request some modules */
@@ -1699,7 +1689,7 @@ void em28xx_card_setup(struct em28xx *de
if (tv.audio_processor == V4L2_IDENT_MSPX4XX) {
dev->i2s_speed = 2048000;
- dev->has_msp34xx = 1;
+ dev->board.has_msp34xx = 1;
}
#ifdef CONFIG_MODULES
if (tv.has_ir)
@@ -1732,10 +1722,10 @@ void em28xx_card_setup(struct em28xx *de
break;
}
- if (dev->has_snapshot_button)
+ if (dev->board.has_snapshot_button)
em28xx_register_snapshot_button(dev);
- if (dev->valid == EM28XX_BOARD_NOT_VALIDATED) {
+ if (dev->board.valid == EM28XX_BOARD_NOT_VALIDATED) {
em28xx_errdev("\n\n");
em28xx_errdev("The support for this board weren't "
"valid yet.\n");
@@ -1750,13 +1740,13 @@ void em28xx_card_setup(struct em28xx *de
#ifdef CONFIG_MODULES
/* request some modules */
- if (dev->has_msp34xx)
+ if (dev->board.has_msp34xx)
request_module("msp3400");
- if (dev->decoder == EM28XX_SAA7113 || dev->decoder == EM28XX_SAA7114)
+ if (dev->board.decoder == EM28XX_SAA7113 || dev->board.decoder ==
EM28XX_SAA7114)
request_module("saa7115");
- if (dev->decoder == EM28XX_TVP5150)
+ if (dev->board.decoder == EM28XX_TVP5150)
request_module("tvp5150");
- if (dev->tuner_type != TUNER_ABSENT)
+ if (dev->board.tuner_type != TUNER_ABSENT)
request_module("tuner");
#endif
diff -r d49151680bc5 -r 2600e739d39d
linux/drivers/media/video/em28xx/em28xx-core.c
--- a/linux/drivers/media/video/em28xx/em28xx-core.c Tue Nov 25 10:10:25
2008 -0200
+++ b/linux/drivers/media/video/em28xx/em28xx-core.c Tue Nov 25 10:39:50
2008 -0200
@@ -349,7 +349,7 @@ static int em28xx_set_audio_source(struc
int ret;
u8 input;
- if (dev->is_em2800) {
+ if (dev->board.is_em2800) {
if (dev->ctl_ainput == EM28XX_AMUX_VIDEO)
input = EM2800_AUDIO_SRC_TUNER;
else
@@ -360,7 +360,7 @@ static int em28xx_set_audio_source(struc
return ret;
}
- if (dev->has_msp34xx)
+ if (dev->board.has_msp34xx)
input = EM28XX_AUDIO_SRC_TUNER;
else {
switch (dev->ctl_ainput) {
@@ -417,7 +417,7 @@ int em28xx_audio_analog_set(struct em28x
}
}
- xclk = dev->xclk & 0x7f;
+ xclk = dev->board.xclk & 0x7f;
if (!dev->mute)
xclk |= 0x80;
@@ -658,7 +658,7 @@ static int em28xx_scaler_set(struct em28
{
u8 mode;
/* the em2800 scaler only supports scaling down to 50% */
- if (dev->is_em2800)
+ if (dev->board.is_em2800)
mode = (v ? 0x20 : 0x00) | (h ? 0x10 : 0x00);
else {
u8 buf[2];
diff -r d49151680bc5 -r 2600e739d39d
linux/drivers/media/video/em28xx/em28xx-dvb.c
--- a/linux/drivers/media/video/em28xx/em28xx-dvb.c Tue Nov 25 10:10:25
2008 -0200
+++ b/linux/drivers/media/video/em28xx/em28xx-dvb.c Tue Nov 25 10:39:50
2008 -0200
@@ -394,7 +394,7 @@ static int dvb_init(struct em28xx *dev)
int result = 0;
struct em28xx_dvb *dvb;
- if (!dev->has_dvb) {
+ if (!dev->board.has_dvb) {
/* This device does not support the extension */
return 0;
}
@@ -480,7 +480,7 @@ out_free:
static int dvb_fini(struct em28xx *dev)
{
- if (!dev->has_dvb) {
+ if (!dev->board.has_dvb) {
/* This device does not support the extension */
return 0;
}
diff -r d49151680bc5 -r 2600e739d39d
linux/drivers/media/video/em28xx/em28xx-i2c.c
--- a/linux/drivers/media/video/em28xx/em28xx-i2c.c Tue Nov 25 10:10:25
2008 -0200
+++ b/linux/drivers/media/video/em28xx/em28xx-i2c.c Tue Nov 25 10:39:50
2008 -0200
@@ -250,7 +250,7 @@ static int em28xx_i2c_xfer(struct i2c_ad
(msgs[i].flags & I2C_M_RD) ? "read" : "write",
i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len);
if (!msgs[i].len) { /* no len: check only for device presence */
- if (dev->is_em2800)
+ if (dev->board.is_em2800)
rc = em2800_i2c_check_for_device(dev, addr);
else
rc = em28xx_i2c_check_for_device(dev, addr);
@@ -261,7 +261,7 @@ static int em28xx_i2c_xfer(struct i2c_ad
} else if (msgs[i].flags & I2C_M_RD) {
/* read bytes */
- if (dev->is_em2800)
+ if (dev->board.is_em2800)
rc = em2800_i2c_recv_bytes(dev, addr,
msgs[i].buf,
msgs[i].len);
@@ -279,7 +279,7 @@ static int em28xx_i2c_xfer(struct i2c_ad
for (byte = 0; byte < msgs[i].len; byte++)
printk(" %02x", msgs[i].buf[byte]);
}
- if (dev->is_em2800)
+ if (dev->board.is_em2800)
rc = em2800_i2c_send_bytes(dev, addr,
msgs[i].buf,
msgs[i].len);
diff -r d49151680bc5 -r 2600e739d39d
linux/drivers/media/video/em28xx/em28xx-input.c
--- a/linux/drivers/media/video/em28xx/em28xx-input.c Tue Nov 25 10:10:25
2008 -0200
+++ b/linux/drivers/media/video/em28xx/em28xx-input.c Tue Nov 25 10:39:50
2008 -0200
@@ -345,7 +345,7 @@ int em28xx_ir_init(struct em28xx *dev)
u8 ir_config;
int err = -ENOMEM;
- if (dev->ir_codes == NULL) {
+ if (dev->board.ir_codes == NULL) {
/* No remote control support */
return 0;
}
@@ -384,7 +384,7 @@ int em28xx_ir_init(struct em28xx *dev)
usb_make_path(dev->udev, ir->phys, sizeof(ir->phys));
strlcat(ir->phys, "/input0", sizeof(ir->phys));
- ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER, dev->ir_codes);
+ ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER, dev->board.ir_codes);
input_dev->name = ir->name;
input_dev->phys = ir->phys;
input_dev->id.bustype = BUS_USB;
diff -r d49151680bc5 -r 2600e739d39d
linux/drivers/media/video/em28xx/em28xx-video.c
--- a/linux/drivers/media/video/em28xx/em28xx-video.c Tue Nov 25 10:10:25
2008 -0200
+++ b/linux/drivers/media/video/em28xx/em28xx-video.c Tue Nov 25 10:39:50
2008 -0200
@@ -521,7 +521,7 @@ static int em28xx_config(struct em28xx *
int retval;
/* Sets I2C speed to 100 KHz */
- if (!dev->is_em2800) {
+ if (!dev->board.is_em2800) {
retval = em28xx_write_regs_req(dev, 0x00, 0x06, "\x40", 1);
if (retval < 0) {
em28xx_errdev("%s: em28xx_write_regs_req failed! retval
[%d]\n",
@@ -578,7 +578,7 @@ static void video_mux(struct em28xx *dev
em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route);
- if (dev->has_msp34xx) {
+ if (dev->board.has_msp34xx) {
if (dev->i2s_speed) {
em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ,
&dev->i2s_speed);
@@ -752,7 +752,7 @@ static int vidioc_try_fmt_vid_cap(struct
mutex_lock(&dev->lock);
- if (dev->is_em2800) {
+ if (dev->board.is_em2800) {
/* the em2800 can only scale down to 50% */
if (height % (maxh / 2))
height = maxh;
@@ -1009,7 +1009,7 @@ static int vidioc_queryctrl(struct file
qc->id = id;
- if (!dev->has_msp34xx) {
+ if (!dev->board.has_msp34xx) {
for (i = 0; i < ARRAY_SIZE(em28xx_qctrl); i++) {
if (qc->id && qc->id == em28xx_qctrl[i].id) {
memcpy(qc, &(em28xx_qctrl[i]), sizeof(*qc));
@@ -1039,7 +1039,7 @@ static int vidioc_g_ctrl(struct file *fi
return rc;
mutex_lock(&dev->lock);
- if (!dev->has_msp34xx)
+ if (!dev->board.has_msp34xx)
rc = em28xx_get_ctrl(dev, ctrl);
else
rc = -EINVAL;
@@ -1067,7 +1067,7 @@ static int vidioc_s_ctrl(struct file *fi
mutex_lock(&dev->lock);
- if (dev->has_msp34xx)
+ if (dev->board.has_msp34xx)
em28xx_i2c_call_clients(dev, VIDIOC_S_CTRL, ctrl);
else {
rc = 1;
@@ -2103,7 +2103,7 @@ static int em28xx_init_dev(struct em28xx
dev->em28xx_read_reg_req_len = em28xx_read_reg_req_len;
dev->em28xx_write_regs_req = em28xx_write_regs_req;
dev->em28xx_read_reg_req = em28xx_read_reg_req;
- dev->is_em2800 = em28xx_boards[dev->model].is_em2800;
+ dev->board.is_em2800 = em28xx_boards[dev->model].is_em2800;
em28xx_pre_card_setup(dev);
@@ -2163,7 +2163,7 @@ static int em28xx_init_dev(struct em28xx
video_set_drvdata(dev->vbi_dev, dev);
#endif
- if (dev->has_msp34xx) {
+ if (dev->board.has_msp34xx) {
/* Send a reset to other chips via gpio */
errCode = em28xx_write_regs_req(dev, 0x00, 0x08, "\xf7", 1);
if (errCode < 0) {
@@ -2227,7 +2227,7 @@ static void request_module_async(struct
else if (dev->has_alsa_audio)
request_module("em28xx-alsa");
- if (dev->has_dvb)
+ if (dev->board.has_dvb)
request_module("em28xx-dvb");
}
diff -r d49151680bc5 -r 2600e739d39d linux/drivers/media/video/em28xx/em28xx.h
--- a/linux/drivers/media/video/em28xx/em28xx.h Tue Nov 25 10:10:25 2008 -0200
+++ b/linux/drivers/media/video/em28xx/em28xx.h Tue Nov 25 10:39:50 2008 -0200
@@ -329,6 +329,7 @@ struct em28xx_reg_seq {
struct em28xx_board {
char *name;
+ int vchannels;
int tuner_type;
int tuner_addr;
@@ -425,18 +426,12 @@ struct em28xx {
int model; /* index in the device_data struct */
int devno; /* marks the number of this device */
enum em28xx_chip_id chip_id;
- unsigned int is_em2800:1;
- unsigned int has_msp34xx:1;
- unsigned int has_tda9887:1;
+
+ struct em28xx_board board;
+
unsigned int stream_on:1; /* Locks streams */
unsigned int has_audio_class:1;
unsigned int has_alsa_audio:1;
- unsigned int max_range_640_480:1;
- unsigned int has_dvb:1;
- unsigned int has_snapshot_button:1;
- unsigned int valid:1; /* report for validated boards */
-
- unsigned char xclk, i2c_speed;
struct em28xx_IR *ir;
@@ -453,7 +448,6 @@ struct em28xx {
u32 i2s_speed; /* I2S speed for audio digital stream */
- enum em28xx_decoder decoder;
struct em28xx_audio_mode audio_mode;
int tuner_type; /* type of the tuner */
@@ -536,9 +530,6 @@ struct em28xx {
/* Caches GPO and GPIO registers */
unsigned char reg_gpo, reg_gpio;
- /* Infrared remote control support */
- IR_KEYTAB_TYPE *ir_codes;
-
/* Snapshot button */
char snapshot_button_path[30]; /* path of the input dev */
struct input_dev *sbutton_input_dev;
@@ -712,7 +703,7 @@ static inline int em28xx_gamma_set(struc
/*FIXME: maxw should be dependent of alt mode */
static inline unsigned int norm_maxw(struct em28xx *dev)
{
- if (dev->max_range_640_480)
+ if (dev->board.max_range_640_480)
return 640;
else
return 720;
@@ -720,7 +711,7 @@ static inline unsigned int norm_maxw(str
static inline unsigned int norm_maxh(struct em28xx *dev)
{
- if (dev->max_range_640_480)
+ if (dev->board.max_range_640_480)
return 480;
else
return (dev->norm & V4L2_STD_625_50) ? 576 : 480;
---
Patch is available at:
http://linuxtv.org/hg/v4l-dvb/rev/2600e739d39d506439a0ab2b639ac62353f0f885
_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits