diff options
author | Michael Hunold <devnull@localhost> | 2002-12-30 21:10:58 +0000 |
---|---|---|
committer | Michael Hunold <devnull@localhost> | 2002-12-30 21:10:58 +0000 |
commit | d425bfb33eedb26e9878187a4f8506db80cee364 (patch) | |
tree | d85c70f34dcb9829043d9b22248a9b2693a1a361 /linux/drivers/media/video/mxb.c | |
parent | 4ac441dd0b30a80cdcf026cc2952cc547bf5dbad (diff) | |
download | mediapointer-dvb-s2-d425bfb33eedb26e9878187a4f8506db80cee364.tar.gz mediapointer-dvb-s2-d425bfb33eedb26e9878187a4f8506db80cee364.tar.bz2 |
Next chunk of big splitup / cleanup:
(tested on 2.4.18 and 2.5.53 -- the budget driver is
untested, Holger will test it the next week)
saa7146:
- completely separated the saa7146 driver into a core-driver (saa7146.o) and
a video/vbi part (saa7146_vv.o). this allows you to build the budget driver
without av7110 and videodev bloat (see below)
The following thinks have been approved by Holger Waechtler:
av7110 (now ttpci):
- for 2.5.x: removed the av7110 directory and put everything into ttpci.
- removed all budget card support from this driver
- compile and build fixes for the saa7146 changes
ttpci-budget (new):
- for 2.5.x: created a new ttpci-budget directory, added a new driver for
the budget cards
mxb:
- compile and build fixes for the saa7146 changes
Changed the build and compile files for both 2.5.x and build-2.4 of course...
Diffstat (limited to 'linux/drivers/media/video/mxb.c')
-rw-r--r-- | linux/drivers/media/video/mxb.c | 87 |
1 files changed, 45 insertions, 42 deletions
diff --git a/linux/drivers/media/video/mxb.c b/linux/drivers/media/video/mxb.c index ce8a4d9b4..2c25aa644 100644 --- a/linux/drivers/media/video/mxb.c +++ b/linux/drivers/media/video/mxb.c @@ -18,7 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <saa7146.h> +#include <saa7146_vv.h> #include "mxb.h" #include "tea6415c.h" @@ -176,6 +176,31 @@ struct mxb int cur_mute; /* current mute status */ }; +static int mxb_vbi_bypass(struct saa7146_dev* dev) +{ + struct mxb* mxb = (struct mxb*)dev->ext_priv; + s32 byte = 0x0; + int result = 0; + + DEB_EE(("dev:%p\n",dev)); + + /* switch bypass in saa7111a, this should be done in the + saa7111a driver of course... */ + if ( -1 == (result = i2c_smbus_read_byte_data(mxb->saa7111a, SAA711X_OUTPUT_CONTROL_3))) { + DEB_D(("could not read from saa7111a.\n")); + return -EFAULT; + } + byte = result; + byte &= 0xf0; + byte |= 0x0a; + + if ( 0 != (result = i2c_smbus_write_byte_data(mxb->saa7111a, SAA711X_OUTPUT_CONTROL_3, byte))) { + DEB_D(("could not write to saa7111a.\n")); + return -EFAULT; + } + return 0; +} + /* this function gets called very early in the registration process of the extension. it has been reported that some devices need to enable the i2c-bus explicitly for example -- this can be done here. please @@ -357,6 +382,8 @@ static int mxb_init_done(struct saa7146_dev* dev) // i = VIDEO_MODE_PAL; // mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_NORM, &i); + mxb_vbi_bypass(dev); + /* select a tuner type */ i = 5; mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE, &i); @@ -451,7 +478,7 @@ static int mxb_attach(struct saa7146_dev* dev) /* checking for i2c-devices can be omitted here, because we already did this in "mxb_vl42_probe" */ - saa7146_video_uops.init(dev); + saa7146_vv_init(dev); if( 0 != saa7146_register_device(&mxb->video_dev, dev, "mxb", VFL_TYPE_GRABBER)) { ERR(("cannot register capture v4l2 device. skipping.\n")); return -1; @@ -459,10 +486,8 @@ static int mxb_attach(struct saa7146_dev* dev) /* initialization stuff (vbi) (only for revision > 0 and for extensions which want it)*/ if( 0 != MXB_BOARD_CAN_DO_VBI(dev)) { - saa7146_vbi_uops.init(dev); if( 0 != saa7146_register_device(&mxb->vbi_dev, dev, "mxb", VFL_TYPE_VBI)) { ERR(("cannot register vbi v4l2 device. skipping.\n")); - return -1; } } @@ -494,6 +519,7 @@ static int mxb_detach(struct saa7146_dev* dev) if( 0 != MXB_BOARD_CAN_DO_VBI(dev)) { saa7146_unregister_device(&mxb->vbi_dev,dev); } + saa7146_vv_release(dev); mxb_num--; @@ -503,31 +529,6 @@ static int mxb_detach(struct saa7146_dev* dev) return 0; } -static int mxb_vbi_bypass(struct saa7146_dev* dev) -{ - struct mxb* mxb = (struct mxb*)dev->ext_priv; - s32 byte = 0x0; - int result = 0; - - DEB_EE(("dev:%p\n",dev)); - - /* switch bypass in saa7111a, this should be done in the - saa7111a driver of course... */ - if ( -1 == (result = i2c_smbus_read_byte_data(mxb->saa7111a, SAA711X_OUTPUT_CONTROL_3))) { - DEB_D(("could not read from saa7111a.\n")); - return -EFAULT; - } - byte = result; - byte &= 0xf0; - byte |= 0x0a; - - if ( 0 != (result = i2c_smbus_write_byte_data(mxb->saa7111a, SAA711X_OUTPUT_CONTROL_3, byte))) { - DEB_D(("could not write to saa7111a.\n")); - return -EFAULT; - } - return 0; -} - /* hack: this should go into saa711x */ static int saa7111_set_gpio(struct saa7146_dev *dev, int bl) { @@ -561,7 +562,8 @@ static int saa7111_set_gpio(struct saa7146_dev *dev, int bl) static int mxb_ioctl(struct saa7146_dev *dev, unsigned int cmd, void *arg) { struct mxb* mxb = (struct mxb*)dev->ext_priv; - + struct saa7146_vv *vv = dev->vv_data; + switch(cmd) { case VIDIOC_ENUMINPUT: { @@ -909,7 +911,7 @@ static int mxb_ioctl(struct saa7146_dev *dev, unsigned int cmd, void *arg) /* hack: changing the frequency should invalidate the vbi-counter (=> alevt) */ spin_lock(&dev->slock); - dev->vbi_fieldcount = 0; + vv->vbi_fieldcount = 0; spin_unlock(&dev->slock); return 0; @@ -1017,33 +1019,34 @@ static struct saa7146_sub_info sub_data[] = { }; static -struct saa7146_extension extension = { - .name = MXB_IDENTIFIER, +struct saa7146_ext_vv vv_data = { .inputs = MXB_INPUTS, .audios = MXB_AUDIOS, .capabilities = V4L2_CAP_TUNER | V4L2_CAP_VBI_CAPTURE, - .flags = 0, - + .stds = &standard[0], + .num_stds = sizeof(standard)/sizeof(struct saa7146_standard), + .std_callback = &std_callback, + .ioctls = &ioctls[0], + .ioctl = mxb_ioctl, +}; + +static +struct saa7146_extension extension = { + .name = MXB_IDENTIFIER, .devices = &sub_data[0], .module = THIS_MODULE, + .ext_vv_data = &vv_data, #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51) .inc_use = mxb_inc_use, .dec_use = mxb_dec_use, #endif - .stds = &standard[0], - .num_stds = sizeof(standard)/sizeof(struct saa7146_standard), - .std_callback = &std_callback, - - .ioctls = &ioctls[0], - .preinit = mxb_preinit, .probe = mxb_probe, .attach = mxb_attach, .detach = mxb_detach, - .ioctl = mxb_ioctl, .irq_mask = 0, .irq_func = NULL, |