summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-04-17 18:37:53 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-17 18:37:53 -0300
commite50f58c7fa5d1681e75dbfe820f70d4703130464 (patch)
treed4837a637f49b1763e5a806ceb48162d6c3310aa /linux/drivers/media
parent6029d122aef16cc161df58a184ccef1be33ff399 (diff)
downloadmediapointer-dvb-s2-e50f58c7fa5d1681e75dbfe820f70d4703130464.tar.gz
mediapointer-dvb-s2-e50f58c7fa5d1681e75dbfe820f70d4703130464.tar.bz2
em28xx: share the same xc3028 setup for analog and digital modes
From: Mauro Carvalho Chehab <mchehab@infradead.org> Thanks to Devin Heitmueller <devin.heitmueller@gmail.com> and Aidan Thornton" <makosoft@googlemail.com> for pointing some errors with the previous scenario. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/video/em28xx/em28xx-cards.c24
-rw-r--r--linux/drivers/media/video/em28xx/em28xx-dvb.c17
-rw-r--r--linux/drivers/media/video/em28xx/em28xx.h2
3 files changed, 29 insertions, 14 deletions
diff --git a/linux/drivers/media/video/em28xx/em28xx-cards.c b/linux/drivers/media/video/em28xx/em28xx-cards.c
index dfb693913..46b7ae4eb 100644
--- a/linux/drivers/media/video/em28xx/em28xx-cards.c
+++ b/linux/drivers/media/video/em28xx/em28xx-cards.c
@@ -37,7 +37,6 @@
#include <media/v4l2-common.h>
#include "em28xx.h"
-#include "tuner-xc2028.h"
static int tuner = -1;
module_param(tuner, int, 0444);
@@ -554,10 +553,25 @@ void em28xx_pre_card_setup(struct em28xx *dev)
};
}
+void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
+{
+ memset(ctl, 0, sizeof(*ctl));
+
+ ctl->fname = XC2028_DEFAULT_FIRMWARE;
+ ctl->max_len = 64;
+ ctl->mts = em28xx_boards[dev->model].mts_firmware;
+
+ switch (dev->model) {
+ /* Add card-specific parameters for xc3028 here */
+ default:
+ ctl->demod = XC3028_FE_OREN538;
+ }
+}
+EXPORT_SYMBOL_GPL(em28xx_setup_xc3028);
+
static void em28xx_config_tuner(struct em28xx *dev)
{
struct v4l2_priv_tun_config xc2028_cfg;
- struct xc2028_ctrl ctl;
struct tuner_setup tun_setup;
struct v4l2_frequency f;
@@ -572,11 +586,9 @@ static void em28xx_config_tuner(struct em28xx *dev)
em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup);
if (dev->tuner_type == TUNER_XC2028) {
- memset(&ctl, 0, sizeof(ctl));
+ struct xc2028_ctrl ctl;
- ctl.fname = XC2028_DEFAULT_FIRMWARE;
- ctl.max_len = 64;
- ctl.mts = em28xx_boards[dev->model].mts_firmware;
+ em28xx_setup_xc3028(dev, &ctl);
xc2028_cfg.tuner = TUNER_XC2028;
xc2028_cfg.priv = &ctl;
diff --git a/linux/drivers/media/video/em28xx/em28xx-dvb.c b/linux/drivers/media/video/em28xx/em28xx-dvb.c
index 0372dc07c..cdebd5bd4 100644
--- a/linux/drivers/media/video/em28xx/em28xx-dvb.c
+++ b/linux/drivers/media/video/em28xx/em28xx-dvb.c
@@ -21,8 +21,6 @@
#include <media/videobuf-vmalloc.h>
#include "lgdt330x.h"
-#include "tuner-xc2028.h"
-#include "tuner-xc2028-types.h"
MODULE_DESCRIPTION("driver for em28xx based DVB cards");
MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>");
@@ -70,12 +68,15 @@ static int attach_xc3028(u8 addr, struct em28xx *dev)
{
struct dvb_frontend *fe;
struct xc2028_ctrl ctl;
- struct xc2028_config cfg = {
- .i2c_adap = &dev->i2c_adap,
- .i2c_addr = addr,
- .ctrl = &ctl,
- .callback = em28xx_tuner_callback,
- };
+ struct xc2028_config cfg;
+
+ memset (&cfg, 0, sizeof(cfg));
+ cfg.i2c_adap = &dev->i2c_adap;
+ cfg.i2c_addr = addr;
+ cfg.ctrl = &ctl;
+ cfg.callback = em28xx_tuner_callback;
+
+ em28xx_setup_xc3028(dev, &ctl);
if (!dev->dvb.frontend) {
printk(KERN_ERR "%s/2: dvb frontend not attached. "
diff --git a/linux/drivers/media/video/em28xx/em28xx.h b/linux/drivers/media/video/em28xx/em28xx.h
index d9034dd2f..b198a8182 100644
--- a/linux/drivers/media/video/em28xx/em28xx.h
+++ b/linux/drivers/media/video/em28xx/em28xx.h
@@ -37,6 +37,7 @@
#if defined(CONFIG_VIDEO_EM28XX_DVB) || defined(CONFIG_VIDEO_EM28XX_DVB_MODULE)
#include <media/videobuf-dvb.h>
#endif
+#include "tuner-xc2028.h"
/* Boards supported by driver */
#define EM2800_BOARD_UNKNOWN 0
@@ -477,6 +478,7 @@ extern struct usb_device_id em28xx_id_table[];
extern const unsigned int em28xx_bcount;
void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir);
int em28xx_tuner_callback(void *ptr, int command, int arg);
+void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl);
/* Provided by em28xx-input.c */
/* TODO: Check if the standard get_key handlers on ir-common can be used */