Commit 4945b8a5 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb

* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (28 commits)
  V4L/DVB (5010): Cx88: Fix leadtek_eeprom tagging
  V4L/DVB (5012): Usbvision fix: It was using "&&" instead "&"
  V4L/DVB (5001): Add two required headers on kernel 2.6.20-rc1
  V4L/DVB (5014): Allyesconfig build fixes on some non x86 arch
  V4L/DVB (4997): Bttv: delete duplicated ioremap()
  V4L/DVB (4996): Msp3400: fix kthread_run error check
  V4L/DVB (4995): Vivi: fix kthread_run() error check
  V4L/DVB (4994): Vivi: fix use after free in list_for_each()
  V4L/DVB (4992): Fix typo in saa7134-dvb.c
  V4L/DVB (4991): Cafe_ccic.c: fix NULL dereference
  V4L/DVB (4990): Cpia2/cpia2_usb.c: fix error-path leak
  V4L/DVB (4988): Cx2341x audio_properties is an u16, not u8
  V4L/DVB (4984): LOG_STATUS should show the real temporal filter value.
  V4L/DVB (4983): Force temporal filter to 0 when scaling to prevent ghosting.
  V4L/DVB (4982): Fix broken audio mode handling for line-in in msp3400.
  V4L/DVB (4980): Fixes bug 7267: PAL/60 is not working
  V4L/DVB (4979): Fixes compilation when CONFIG_V4L1_COMPAT is not selected
  V4L/DVB (4973): Dvb-core: fix printk type warning
  V4L/DVB (4972): Dvb-core: fix bug in CRC-32 checking on 64-bit systems
  V4L/DVB (4970): Usbvision memory fixes
  ...
parents 6c722e90 69f7e75a
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/jiffies.h>
#include <media/ir-common.h> #include <media/ir-common.h>
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
......
...@@ -605,7 +605,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) ...@@ -605,7 +605,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
{ &utype, sizeof utype }, { &utype, sizeof utype },
{ priv->ule_skb->data, priv->ule_skb->len - 4 } { priv->ule_skb->data, priv->ule_skb->len - 4 }
}; };
unsigned long ule_crc = ~0L, expected_crc; u32 ule_crc = ~0L, expected_crc;
if (priv->ule_dbit) { if (priv->ule_dbit) {
/* Set D-bit for CRC32 verification, /* Set D-bit for CRC32 verification,
* if it was set originally. */ * if it was set originally. */
...@@ -618,7 +618,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) ...@@ -618,7 +618,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
*((u8 *)priv->ule_skb->tail - 2) << 8 | *((u8 *)priv->ule_skb->tail - 2) << 8 |
*((u8 *)priv->ule_skb->tail - 1); *((u8 *)priv->ule_skb->tail - 1);
if (ule_crc != expected_crc) { if (ule_crc != expected_crc) {
printk(KERN_WARNING "%lu: CRC32 check FAILED: %#lx / %#lx, SNDU len %d type %#x, ts_remain %d, next 2: %x.\n", printk(KERN_WARNING "%lu: CRC32 check FAILED: %08x / %08x, SNDU len %d type %#x, ts_remain %d, next 2: %x.\n",
priv->ts_count, ule_crc, expected_crc, priv->ule_sndu_len, priv->ule_sndu_type, ts_remain, ts_remain > 2 ? *(unsigned short *)from_where : 0); priv->ts_count, ule_crc, expected_crc, priv->ule_sndu_len, priv->ule_sndu_type, ts_remain, ts_remain > 2 ? *(unsigned short *)from_where : 0);
#ifdef ULE_DEBUG #ifdef ULE_DEBUG
......
...@@ -90,9 +90,11 @@ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) ...@@ -90,9 +90,11 @@ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to c: %02x d: %02x toggle: %d\n",key[1],key[2],key[3],custom,data,toggle); deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to c: %02x d: %02x toggle: %d\n",key[1],key[2],key[3],custom,data,toggle);
for (i = 0; i < ARRAY_SIZE(haupp_rc_keys); i++) { for (i = 0; i < ARRAY_SIZE(haupp_rc_keys); i++) {
deb_rc("c: %x, d: %x\n",haupp_rc_keys[i].data,haupp_rc_keys[i].custom);
if (haupp_rc_keys[i].data == data && if (haupp_rc_keys[i].data == data &&
haupp_rc_keys[i].custom == custom) { haupp_rc_keys[i].custom == custom) {
deb_rc("c: %x, d: %x\n",haupp_rc_keys[i].data,haupp_rc_keys[i].custom);
*event = haupp_rc_keys[i].event; *event = haupp_rc_keys[i].event;
*state = REMOTE_KEY_PRESSED; *state = REMOTE_KEY_PRESSED;
if (st->old_toggle == toggle) { if (st->old_toggle == toggle) {
......
...@@ -515,7 +515,7 @@ static int dib3000mc_autosearch_start(struct dvb_frontend *demod, struct dibx000 ...@@ -515,7 +515,7 @@ static int dib3000mc_autosearch_start(struct dvb_frontend *demod, struct dibx000
fchan.vit_alpha = 1; fchan.vit_code_rate_hp = 2; fchan.vit_code_rate_lp = 2; fchan.vit_alpha = 1; fchan.vit_code_rate_hp = 2; fchan.vit_code_rate_lp = 2;
fchan.vit_hrch = 0; fchan.vit_select_hp = 1; fchan.vit_hrch = 0; fchan.vit_select_hp = 1;
dib3000mc_set_channel_cfg(state, &fchan, 7); dib3000mc_set_channel_cfg(state, &fchan, 11);
reg = dib3000mc_read_word(state, 0); reg = dib3000mc_read_word(state, 0);
dib3000mc_write_word(state, 0, reg | (1 << 8)); dib3000mc_write_word(state, 0, reg | (1 << 8));
......
...@@ -668,7 +668,7 @@ config VIDEO_M32R_AR_M64278 ...@@ -668,7 +668,7 @@ config VIDEO_M32R_AR_M64278
config VIDEO_CAFE_CCIC config VIDEO_CAFE_CCIC
tristate "Marvell 88ALP01 (Cafe) CMOS Camera Controller support" tristate "Marvell 88ALP01 (Cafe) CMOS Camera Controller support"
depends on I2C && VIDEO_V4L2 depends on PCI && I2C && VIDEO_V4L2
select VIDEO_OV7670 select VIDEO_OV7670
---help--- ---help---
This is a video4linux2 driver for the Marvell 88ALP01 integrated This is a video4linux2 driver for the Marvell 88ALP01 integrated
......
...@@ -4050,8 +4050,8 @@ static int __devinit bttv_probe(struct pci_dev *dev, ...@@ -4050,8 +4050,8 @@ static int __devinit bttv_probe(struct pci_dev *dev,
(unsigned long long)pci_resource_start(dev,0)); (unsigned long long)pci_resource_start(dev,0));
schedule(); schedule();
btv->bt848_mmio=ioremap(pci_resource_start(dev,0), 0x1000); btv->bt848_mmio = ioremap(pci_resource_start(dev, 0), 0x1000);
if (NULL == ioremap(pci_resource_start(dev,0), 0x1000)) { if (NULL == btv->bt848_mmio) {
printk("bttv%d: ioremap() failed\n", btv->c.nr); printk("bttv%d: ioremap() failed\n", btv->c.nr);
result = -EIO; result = -EIO;
goto fail1; goto fail1;
......
...@@ -2166,7 +2166,7 @@ static void cafe_pci_remove(struct pci_dev *pdev) ...@@ -2166,7 +2166,7 @@ static void cafe_pci_remove(struct pci_dev *pdev)
struct cafe_camera *cam = cafe_find_by_pdev(pdev); struct cafe_camera *cam = cafe_find_by_pdev(pdev);
if (cam == NULL) { if (cam == NULL) {
cam_warn(cam, "pci_remove on unknown pdev %p\n", pdev); printk(KERN_WARNING "pci_remove on unknown pdev %p\n", pdev);
return; return;
} }
mutex_lock(&cam->s_mutex); mutex_lock(&cam->s_mutex);
......
...@@ -640,6 +640,10 @@ static int submit_urbs(struct camera_data *cam) ...@@ -640,6 +640,10 @@ static int submit_urbs(struct camera_data *cam)
cam->sbuf[i].data = cam->sbuf[i].data =
kmalloc(FRAMES_PER_DESC * FRAME_SIZE_PER_DESC, GFP_KERNEL); kmalloc(FRAMES_PER_DESC * FRAME_SIZE_PER_DESC, GFP_KERNEL);
if (!cam->sbuf[i].data) { if (!cam->sbuf[i].data) {
while (--i >= 0) {
kfree(cam->sbuf[i].data);
cam->sbuf[i].data = NULL;
}
return -ENOMEM; return -ENOMEM;
} }
} }
......
...@@ -742,7 +742,6 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func, ...@@ -742,7 +742,6 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
if (old == NULL || old->width != new->width || old->height != new->height || if (old == NULL || old->width != new->width || old->height != new->height ||
old->video_encoding != new->video_encoding) { old->video_encoding != new->video_encoding) {
int is_scaling;
u16 w = new->width; u16 w = new->width;
u16 h = new->height; u16 h = new->height;
...@@ -752,20 +751,18 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func, ...@@ -752,20 +751,18 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
} }
err = cx2341x_api(priv, func, CX2341X_ENC_SET_FRAME_SIZE, 2, h, w); err = cx2341x_api(priv, func, CX2341X_ENC_SET_FRAME_SIZE, 2, h, w);
if (err) return err; if (err) return err;
}
if (new->width != 720 || new->height != (new->is_50hz ? 576 : 480)) {
/* Adjust temporal filter if necessary. The problem with the temporal /* Adjust temporal filter if necessary. The problem with the temporal
filter is that it works well with full resolution capturing, but filter is that it works well with full resolution capturing, but
not when the capture window is scaled (the filter introduces not when the capture window is scaled (the filter introduces
a ghosting effect). So if the capture window changed, and there is a ghosting effect). So if the capture window is scaled, then
no updated filter value, then the filter is set depending on whether force the filter to 0.
the new window is full resolution or not.
For full resolution a setting of 8 really improves the video For full resolution the filter really improves the video
quality, especially if the original video quality is suboptimal. */ quality, especially if the original video quality is suboptimal. */
is_scaling = new->width != 720 || new->height != (new->is_50hz ? 576 : 480); temporal = 0;
if (old && old->video_temporal_filter == temporal) {
temporal = is_scaling ? 0 : 8;
}
} }
if (old == NULL || old->stream_type != new->stream_type) { if (old == NULL || old->stream_type != new->stream_type) {
...@@ -866,6 +863,7 @@ static const char *cx2341x_menu_item(struct cx2341x_mpeg_params *p, u32 id) ...@@ -866,6 +863,7 @@ static const char *cx2341x_menu_item(struct cx2341x_mpeg_params *p, u32 id)
void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix) void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix)
{ {
int is_mpeg1 = p->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1; int is_mpeg1 = p->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1;
int temporal = p->video_temporal_filter;
/* Stream */ /* Stream */
printk(KERN_INFO "%s: Stream: %s\n", printk(KERN_INFO "%s: Stream: %s\n",
...@@ -922,10 +920,13 @@ void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix) ...@@ -922,10 +920,13 @@ void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix)
cx2341x_menu_item(p, V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE), cx2341x_menu_item(p, V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE),
cx2341x_menu_item(p, V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE), cx2341x_menu_item(p, V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE),
p->video_spatial_filter); p->video_spatial_filter);
if (p->width != 720 || p->height != (p->is_50hz ? 576 : 480)) {
temporal = 0;
}
printk(KERN_INFO "%s: Temporal Filter: %s, %d\n", printk(KERN_INFO "%s: Temporal Filter: %s, %d\n",
prefix, prefix,
cx2341x_menu_item(p, V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE), cx2341x_menu_item(p, V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE),
p->video_temporal_filter); temporal);
printk(KERN_INFO "%s: Median Filter: %s, Luma [%d, %d], Chroma [%d, %d]\n", printk(KERN_INFO "%s: Median Filter: %s, Luma [%d, %d], Chroma [%d, %d]\n",
prefix, prefix,
cx2341x_menu_item(p, V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE), cx2341x_menu_item(p, V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE),
......
...@@ -128,7 +128,14 @@ void cx25840_vbi_setup(struct i2c_client *client) ...@@ -128,7 +128,14 @@ void cx25840_vbi_setup(struct i2c_client *client)
uv_lpf=1; uv_lpf=1;
src_decimation=0x21f; src_decimation=0x21f;
if (std == V4L2_STD_PAL_M) { if (std == V4L2_STD_PAL_60) {
vblank=26;
vblank656=26;
burst=0x5b;
luma_lpf=2;
comb=0x20;
sc=0x0a8263;
} else if (std == V4L2_STD_PAL_M) {
vblank=20; vblank=20;
vblank656=24; vblank656=24;
burst=0x61; burst=0x61;
......
...@@ -1632,7 +1632,7 @@ const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); ...@@ -1632,7 +1632,7 @@ const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
/* some leadtek specific stuff */ /* some leadtek specific stuff */
static void __devinit leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data) static void leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data)
{ {
/* This is just for the "Winfast 2000XP Expert" board ATM; I don't have data on /* This is just for the "Winfast 2000XP Expert" board ATM; I don't have data on
* any others. * any others.
......
...@@ -633,12 +633,12 @@ int cx88_reset(struct cx88_core *core) ...@@ -633,12 +633,12 @@ int cx88_reset(struct cx88_core *core)
static unsigned int inline norm_swidth(struct cx88_tvnorm *norm) static unsigned int inline norm_swidth(struct cx88_tvnorm *norm)
{ {
return (norm->id & V4L2_STD_625_50) ? 922 : 754; return (norm->id & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 754 : 922;
} }
static unsigned int inline norm_hdelay(struct cx88_tvnorm *norm) static unsigned int inline norm_hdelay(struct cx88_tvnorm *norm)
{ {
return (norm->id & V4L2_STD_625_50) ? 186 : 135; return (norm->id & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 135 : 186;
} }
static unsigned int inline norm_vdelay(struct cx88_tvnorm *norm) static unsigned int inline norm_vdelay(struct cx88_tvnorm *norm)
...@@ -648,24 +648,33 @@ static unsigned int inline norm_vdelay(struct cx88_tvnorm *norm) ...@@ -648,24 +648,33 @@ static unsigned int inline norm_vdelay(struct cx88_tvnorm *norm)
static unsigned int inline norm_fsc8(struct cx88_tvnorm *norm) static unsigned int inline norm_fsc8(struct cx88_tvnorm *norm)
{ {
static const unsigned int ntsc = 28636360;
static const unsigned int pal = 35468950;
static const unsigned int palm = 28604892;
if (norm->id & V4L2_STD_PAL_M) if (norm->id & V4L2_STD_PAL_M)
return palm; return 28604892; // 3.575611 MHz
if (norm->id & (V4L2_STD_PAL_Nc))
return 28656448; // 3.582056 MHz
if (norm->id & V4L2_STD_NTSC) // All NTSC/M and variants
return 28636360; // 3.57954545 MHz +/- 10 Hz
return (norm->id & V4L2_STD_625_50) ? pal : ntsc; /* SECAM have also different sub carrier for chroma,
but step_db and step_dr, at cx88_set_tvnorm already handles that.
The same FSC applies to PAL/BGDKIH, PAL/60, NTSC/4.43 and PAL/N
*/
return 35468950; // 4.43361875 MHz +/- 5 Hz
} }
static unsigned int inline norm_htotal(struct cx88_tvnorm *norm) static unsigned int inline norm_htotal(struct cx88_tvnorm *norm)
{ {
/* Should always be Line Draw Time / (4*FSC) */
if (norm->id & V4L2_STD_PAL_M) unsigned int fsc4=norm_fsc8(norm)/2;
return 909;
return (norm->id & V4L2_STD_625_50) ? 1135 : 910; /* returns 4*FSC / vtotal / frames per seconds */
return (norm->id & V4L2_STD_625_50) ?
((fsc4+312)/625+12)/25 :
((fsc4+262)/525*1001+15000)/30000;
} }
static unsigned int inline norm_vbipack(struct cx88_tvnorm *norm) static unsigned int inline norm_vbipack(struct cx88_tvnorm *norm)
...@@ -692,7 +701,7 @@ int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int heig ...@@ -692,7 +701,7 @@ int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int heig
value &= 0x3fe; value &= 0x3fe;
cx_write(MO_HDELAY_EVEN, value); cx_write(MO_HDELAY_EVEN, value);
cx_write(MO_HDELAY_ODD, value); cx_write(MO_HDELAY_ODD, value);
dprintk(1,"set_scale: hdelay 0x%04x\n", value); dprintk(1,"set_scale: hdelay 0x%04x (width %d)\n", value,swidth);
value = (swidth * 4096 / width) - 4096; value = (swidth * 4096 / width) - 4096;
cx_write(MO_HSCALE_EVEN, value); cx_write(MO_HSCALE_EVEN, value);
......
...@@ -91,7 +91,7 @@ struct cx88_tvnorm { ...@@ -91,7 +91,7 @@ struct cx88_tvnorm {
static unsigned int inline norm_maxw(struct cx88_tvnorm *norm) static unsigned int inline norm_maxw(struct cx88_tvnorm *norm)
{ {
return (norm->id & V4L2_STD_625_50) ? 768 : 640; return (norm->id & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 720 : 768;
} }
......
...@@ -1674,9 +1674,9 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, ...@@ -1674,9 +1674,9 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
if (dev->has_msp34xx) { if (dev->has_msp34xx) {
/* Send a reset to other chips via gpio */ /* Send a reset to other chips via gpio */
em28xx_write_regs_req(dev, 0x00, 0x08, "\xf7", 1); em28xx_write_regs_req(dev, 0x00, 0x08, "\xf7", 1);
udelay(2500); msleep(3);
em28xx_write_regs_req(dev, 0x00, 0x08, "\xff", 1); em28xx_write_regs_req(dev, 0x00, 0x08, "\xff", 1);
udelay(2500); msleep(3);
} }
video_mux(dev, 0); video_mux(dev, 0);
......
...@@ -923,7 +923,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file, ...@@ -923,7 +923,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
struct video_picture *p = arg; struct video_picture *p = arg;
if (p->depth != 16) if (p->depth != 16)
return -EINVAL; return -EINVAL;
if (p->palette != VIDEO_PALETTE_YUV422) if (p->palette != VIDEO_PALETTE_YUV422 && p->palette != VIDEO_PALETTE_YUYV)
return -EINVAL; return -EINVAL;
mutex_lock(&meye.lock); mutex_lock(&meye.lock);
sonypi_camera_command(SONYPI_COMMAND_SETCAMERABRIGHTNESS, sonypi_camera_command(SONYPI_COMMAND_SETCAMERABRIGHTNESS,
...@@ -978,7 +978,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file, ...@@ -978,7 +978,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
if (vm->frame >= gbuffers || vm->frame < 0) if (vm->frame >= gbuffers || vm->frame < 0)
return -EINVAL; return -EINVAL;
if (vm->format != VIDEO_PALETTE_YUV422) if (vm->format != VIDEO_PALETTE_YUV422 && vm->format != VIDEO_PALETTE_YUYV)
return -EINVAL; return -EINVAL;
if (vm->height * vm->width * 2 > gbufsize) if (vm->height * vm->width * 2 > gbufsize)
return -EINVAL; return -EINVAL;
......
...@@ -633,10 +633,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -633,10 +633,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
if (((rt->input >> (4 + i * 4)) & 0xf) == 0) if (((rt->input >> (4 + i * 4)) & 0xf) == 0)
extern_input = 0; extern_input = 0;
} }
if (extern_input) state->mode = extern_input ? MSP_MODE_EXTERN : MSP_MODE_AM_DETECT;
state->mode = MSP_MODE_EXTERN; state->rxsubchans = V4L2_TUNER_SUB_STEREO;
else
state->mode = MSP_MODE_AM_DETECT;
msp_set_scart(client, sc_in, 0); msp_set_scart(client, sc_in, 0);
msp_set_scart(client, sc1_out, 1); msp_set_scart(client, sc1_out, 1);
msp_set_scart(client, sc2_out, 2); msp_set_scart(client, sc2_out, 2);
...@@ -951,7 +949,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) ...@@ -951,7 +949,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
if (thread_func) { if (thread_func) {
state->kthread = kthread_run(thread_func, client, "msp34xx"); state->kthread = kthread_run(thread_func, client, "msp34xx");
if (state->kthread == NULL) if (IS_ERR(state->kthread))
v4l_warn(client, "kernel_thread() failed\n"); v4l_warn(client, "kernel_thread() failed\n");
msp_wake_thread(client); msp_wake_thread(client);
} }
......
...@@ -483,7 +483,6 @@ int msp3400c_thread(void *data) ...@@ -483,7 +483,6 @@ int msp3400c_thread(void *data)
/* no carrier scan, just unmute */ /* no carrier scan, just unmute */
v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n"); v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n");
state->scan_in_progress = 0; state->scan_in_progress = 0;
state->rxsubchans = V4L2_TUNER_SUB_STEREO;
msp_set_audio(client); msp_set_audio(client);
continue; continue;
} }
...@@ -851,12 +850,15 @@ static void msp34xxg_set_source(struct i2c_client *client, u16 reg, int in) ...@@ -851,12 +850,15 @@ static void msp34xxg_set_source(struct i2c_client *client, u16 reg, int in)
source = 1; /* stereo or A|B */ source = 1; /* stereo or A|B */
matrix = 0x20; matrix = 0x20;
break; break;
case V4L2_TUNER_MODE_STEREO:
case V4L2_TUNER_MODE_LANG1: case V4L2_TUNER_MODE_LANG1:
default:
source = 3; /* stereo or A */ source = 3; /* stereo or A */
matrix = 0x00; matrix = 0x00;
break; break;
case V4L2_TUNER_MODE_STEREO:
default:
source = 3; /* stereo or A */
matrix = 0x20;
break;
} }
if (in == MSP_DSP_IN_TUNER) if (in == MSP_DSP_IN_TUNER)
...@@ -1030,6 +1032,9 @@ static int msp34xxg_detect_stereo(struct i2c_client *client) ...@@ -1030,6 +1032,9 @@ static int msp34xxg_detect_stereo(struct i2c_client *client)
int is_stereo = status & 0x40; int is_stereo = status & 0x40;
int oldrx = state->rxsubchans; int oldrx = state->rxsubchans;
if (state->mode == MSP_MODE_EXTERN)
return 0;
state->rxsubchans = 0; state->rxsubchans = 0;
if (is_stereo) if (is_stereo)
state->rxsubchans = V4L2_TUNER_SUB_STEREO; state->rxsubchans = V4L2_TUNER_SUB_STEREO;
......
...@@ -50,9 +50,9 @@ static unsigned int antenna_pwr = 0; ...@@ -50,9 +50,9 @@ static unsigned int antenna_pwr = 0;
module_param(antenna_pwr, int, 0444); module_param(antenna_pwr, int, 0444);
MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)"); MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)");
static int use_frontent = 0; static int use_frontend = 0;
module_param(use_frontent, int, 0644); module_param(use_frontend, int, 0644);
MODULE_PARM_DESC(use_frontent,"for cards with multiple frontends (0: terrestrial, 1: satellite)"); MODULE_PARM_DESC(use_frontend,"for cards with multiple frontends (0: terrestrial, 1: satellite)");
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on) static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on)
...@@ -1303,7 +1303,7 @@ static int dvb_init(struct saa7134_dev *dev) ...@@ -1303,7 +1303,7 @@ static int dvb_init(struct saa7134_dev *dev)
} }
break; break;
case SAA7134_BOARD_FLYDVB_TRIO: case SAA7134_BOARD_FLYDVB_TRIO:
if(! use_frontent) { //terrestrial if(! use_frontend) { //terrestrial
dev->dvb.frontend = dvb_attach(tda10046_attach, dev->dvb.frontend = dvb_attach(tda10046_attach,
&lifeview_trio_config, &lifeview_trio_config,
&dev->i2c_adap); &dev->i2c_adap);
......
...@@ -267,6 +267,10 @@ static int tuner_fixup_std(struct tuner *t) ...@@ -267,6 +267,10 @@ static int tuner_fixup_std(struct tuner *t)
{ {
if ((t->std & V4L2_STD_PAL) == V4L2_STD_PAL) { if ((t->std & V4L2_STD_PAL) == V4L2_STD_PAL) {
switch (pal[0]) { switch (pal[0]) {
case '6':
tuner_dbg ("insmod fixup: PAL => PAL-60\n");
t->std = V4L2_STD_PAL_60;
break;
case 'b': case 'b':
case 'B': case 'B':
case 'g': case 'g':
......
...@@ -39,8 +39,8 @@ struct usbvision_device_data_st usbvision_device_data[] = { ...@@ -39,8 +39,8 @@ struct usbvision_device_data_st usbvision_device_data[] = {
{0x0573, 0x0400, -1, CODEC_SAA7113, 4, V4L2_STD_NTSC, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "D-Link V100"}, {0x0573, 0x0400, -1, CODEC_SAA7113, 4, V4L2_STD_NTSC, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "D-Link V100"},
{0x0573, 0x2000, -1, CODEC_SAA7111, 2, V4L2_STD_NTSC, 1, 0, 1, 0, 0, -1, -1, -1, -1, -1, "X10 USB Camera"}, {0x0573, 0x2000, -1, CODEC_SAA7111, 2, V4L2_STD_NTSC, 1, 0, 1, 0, 0, -1, -1, -1, -1, -1, "X10 USB Camera"},
{0x0573, 0x2d00, -1, CODEC_SAA7111, 2, V4L2_STD_PAL, 1, 0, 1, 0, 0, -1, -1, -1, 3, 7, "Osprey 50"}, {0x0573, 0x2d00, -1, CODEC_SAA7111, 2, V4L2_STD_PAL, 1, 0, 1, 0, 0, -1, -1, -1, 3, 7, "Osprey 50"},
{0x0573, 0x2d01, -1, CODEC_SAA7113, 2, V4L2_STD_NTSC, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Hauppauge USB-Live Model 600"}, {0x0573, 0x2d01, -1, CODEC_SAA7113, 2, V4L2_STD_NTSC, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Hauppauge USB-Live Model 600"},
{0x0573, 0x2101, -1, CODEC_SAA7113, 2, V4L2_STD_PAL, 2, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Zoran Co. PMD (Nogatech) AV-grabber Manhattan"}, {0x0573, 0x2101, -1, CODEC_SAA7113, 2, V4L2_STD_PAL, 2, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Zoran Co. PMD (Nogatech) AV-grabber Manhattan"},
{0x0573, 0x4100, -1, CODEC_SAA7111, 3, V4L2_STD_NTSC, 1, 1, 1, 1, TUNER_PHILIPS_NTSC_M, -1, -1, -1, 20, -1, "Nogatech USB-TV (NTSC) FM"}, {0x0573, 0x4100, -1, CODEC_SAA7111, 3, V4L2_STD_NTSC, 1, 1, 1, 1, TUNER_PHILIPS_NTSC_M, -1, -1, -1, 20, -1, "Nogatech USB-TV (NTSC) FM"},
{0x0573, 0x4110, -1, CODEC_SAA7111, 3, V4L2_STD_NTSC, 1, 1, 1, 1, TUNER_PHILIPS_NTSC_M, -1, -1, -1, 20, -1, "PNY USB-TV (NTSC) FM"}, {0x0573, 0x4110, -1, CODEC_SAA7111, 3, V4L2_STD_NTSC, 1, 1, 1, 1, TUNER_PHILIPS_NTSC_M, -1, -1, -1, 20, -1, "PNY USB-TV (NTSC) FM"},
{0x0573, 0x4450, 0, CODEC_SAA7113, 3, V4L2_STD_PAL, 1, 1, 1, 1, TUNER_PHILIPS_PAL, -1, -1, 0, 3, 7, "PixelView PlayTv-USB PRO (PAL) FM"}, {0x0573, 0x4450, 0, CODEC_SAA7113, 3, V4L2_STD_PAL, 1, 1, 1, 1, TUNER_PHILIPS_PAL, -1, -1, 0, 3, 7, "PixelView PlayTv-USB PRO (PAL) FM"},
...@@ -71,10 +71,10 @@ struct usbvision_device_data_st usbvision_device_data[] = { ...@@ -71,10 +71,10 @@ struct usbvision_device_data_st usbvision_device_data[] = {
{0x0573, 0x4d37, 0, CODEC_SAA7113, 3, V4L2_STD_PAL, 1, 1, 1, 1, TUNER_PHILIPS_FM1216ME_MK3, -1, -1, 0, 3, 7, "Hauppauge WinTV USB device Model 40219 Rev E189"}, {0x0573, 0x4d37, 0, CODEC_SAA7113, 3, V4L2_STD_PAL, 1, 1, 1, 1, TUNER_PHILIPS_FM1216ME_MK3, -1, -1, 0, 3, 7, "Hauppauge WinTV USB device Model 40219 Rev E189"},
{0x0768, 0x0006, -1, CODEC_SAA7113, 3, V4L2_STD_NTSC, 1, 1, 1, 1, TUNER_PHILIPS_NTSC_M, -1, -1, 5, 5, -1, "Camtel Technology USB TV Genie Pro FM Model TVB330"}, {0x0768, 0x0006, -1, CODEC_SAA7113, 3, V4L2_STD_NTSC, 1, 1, 1, 1, TUNER_PHILIPS_NTSC_M, -1, -1, 5, 5, -1, "Camtel Technology USB TV Genie Pro FM Model TVB330"},
{0x07d0, 0x0001, -1, CODEC_SAA7113, 2, V4L2_STD_PAL, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Digital Video Creator I"}, {0x07d0, 0x0001, -1, CODEC_SAA7113, 2, V4L2_STD_PAL, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Digital Video Creator I"},
{0x07d0, 0x0002, -1, CODEC_SAA7111, 2, V4L2_STD_NTSC, 0, 0, 1, 0, 0, -1, -1, 82, 20, 7, "Global Village GV-007 (NTSC)"}, {0x07d0, 0x0002, -1, CODEC_SAA7111, 2, V4L2_STD_NTSC, 0, 0, 1, 0, 0, -1, -1, 82, 20, 7, "Global Village GV-007 (NTSC)"},
{0x07d0, 0x0003, 0, CODEC_SAA7113, 2, V4L2_STD_NTSC, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Dazzle Fusion Model DVC-50 Rev 1 (NTSC)"}, {0x07d0, 0x0003, 0, CODEC_SAA7113, 2, V4L2_STD_NTSC, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Dazzle Fusion Model DVC-50 Rev 1 (NTSC)"},
{0x07d0, 0x0004, 0, CODEC_SAA7113, 2, V4L2_STD_PAL, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Dazzle Fusion Model DVC-80 Rev 1 (PAL)"}, {0x07d0, 0x0004, 0, CODEC_SAA7113, 2, V4L2_STD_PAL, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Dazzle Fusion Model DVC-80 Rev 1 (PAL)"},
{0x07d0, 0x0005, 0, CODEC_SAA7113, 2, V4L2_STD_SECAM, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Dazzle Fusion Model DVC-90 Rev 1 (SECAM)"}, {0x07d0, 0x0005, 0, CODEC_SAA7113, 2, V4L2_STD_SECAM, 0, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Dazzle Fusion Model DVC-90 Rev 1 (SECAM)"},
{0x2304, 0x010d, -1, CODEC_SAA7111, 3, V4L2_STD_PAL, 1, 0, 0, 1, TUNER_TEMIC_4066FY5_PAL_I, -1, -1, -1, -1, -1, "Pinnacle Studio PCTV USB (PAL)"}, {0x2304, 0x010d, -1, CODEC_SAA7111, 3, V4L2_STD_PAL, 1, 0, 0, 1, TUNER_TEMIC_4066FY5_PAL_I, -1, -1, -1, -1, -1, "Pinnacle Studio PCTV USB (PAL)"},
{0x2304, 0x0109, -1, CODEC_SAA7111, 3, V4L2_STD_SECAM, 1, 0, 1, 1, TUNER_PHILIPS_SECAM, -1, -1, -1, -1, -1, "Pinnacle Studio PCTV USB (SECAM)"}, {0x2304, 0x0109, -1, CODEC_SAA7111, 3, V4L2_STD_SECAM, 1, 0, 1, 1, TUNER_PHILIPS_SECAM, -1, -1, -1, -1, -1, "Pinnacle Studio PCTV USB (SECAM)"},
{0x2304, 0x0110, -1, CODEC_SAA7111, 3, V4L2_STD_PAL, 1, 1, 1, 1, TUNER_PHILIPS_PAL, -1, -1,128, 23, -1, "Pinnacle Studio PCTV USB (PAL) FM"}, {0x2304, 0x0110, -1, CODEC_SAA7111, 3, V4L2_STD_PAL, 1, 1, 1, 1, TUNER_PHILIPS_PAL, -1, -1,128, 23, -1, "Pinnacle Studio PCTV USB (PAL) FM"},
...@@ -86,7 +86,7 @@ struct usbvision_device_data_st usbvision_device_data[] = { ...@@ -86,7 +86,7 @@ struct usbvision_device_data_st usbvision_device_data[] = {
{0x2304, 0x0300, -1, CODEC_SAA7113, 2, V4L2_STD_NTSC, 1, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Pinnacle Studio Linx Video input cable (NTSC)"}, {0x2304, 0x0300, -1, CODEC_SAA7113, 2, V4L2_STD_NTSC, 1, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Pinnacle Studio Linx Video input cable (NTSC)"},
{0x2304, 0x0301, -1, CODEC_SAA7113, 2, V4L2_STD_PAL, 1, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Pinnacle Studio Linx Video input cable (PAL)"}, {0x2304, 0x0301, -1, CODEC_SAA7113, 2, V4L2_STD_PAL, 1, 0, 1, 0, 0, -1, -1, 0, 3, 7, "Pinnacle Studio Linx Video input cable (PAL)"},
{0x2304, 0x0419, -1, CODEC_SAA7113, 3, V4L2_STD_PAL, 1, 1, 1, 1, TUNER_TEMIC_4009FR5_PAL, -1, -1, 0, 3, 7, "Pinnacle PCTV Bungee USB (PAL) FM"}, {0x2304, 0x0419, -1, CODEC_SAA7113, 3, V4L2_STD_PAL, 1, 1, 1, 1, TUNER_TEMIC_4009FR5_PAL, -1, -1, 0, 3, 7, "Pinnacle PCTV Bungee USB (PAL) FM"},
{0x2400, 0x4200, -1, CODEC_SAA7111, 3, VIDEO_MODE_NTSC, 1, 0, 1, 1, TUNER_PHILIPS_NTSC_M, -1, -1, -1, -1, -1, "Hauppauge WinTv-USB"}, {0x2400, 0x4200, -1, CODEC_SAA7111, 3, V4L2_STD_NTSC, 1, 0, 1, 1, TUNER_PHILIPS_NTSC_M, -1, -1, -1, -1, -1, "Hauppauge WinTv-USB"},
{} /* Terminating entry */ {} /* Terminating entry */
}; };
...@@ -148,7 +148,6 @@ struct usb_device_id usbvision_table [] = { ...@@ -148,7 +148,6 @@ struct usb_device_id usbvision_table [] = {
{ USB_DEVICE(0x2304, 0x0300) }, /* Pinnacle Studio Linx Video input cable (NTSC) */ { USB_DEVICE(0x2304, 0x0300) }, /* Pinnacle Studio Linx Video input cable (NTSC) */
{ USB_DEVICE(0x2304, 0x0301) }, /* Pinnacle Studio Linx Video input cable (PAL) */ { USB_DEVICE(0x2304, 0x0301) }, /* Pinnacle Studio Linx Video input cable (PAL) */
{ USB_DEVICE(0x2304, 0x0419) }, /* Pinnacle PCTV Bungee USB (PAL) FM */ { USB_DEVICE(0x2304, 0x0419) }, /* Pinnacle PCTV Bungee USB (PAL) FM */
{ USB_DEVICE(0x2400, 0x4200) }, /* Hauppauge WinTv-USB2 Model 42012 */ { USB_DEVICE(0x2400, 0x4200) }, /* Hauppauge WinTv-USB2 Model 42012 */
{ } /* Terminating entry */ { } /* Terminating entry */
......
...@@ -118,7 +118,7 @@ static int usbvision_measure_bandwidth (struct usb_usbvision *usbvision); ...@@ -118,7 +118,7 @@ static int usbvision_measure_bandwidth (struct usb_usbvision *usbvision);
* This is used when initializing the contents of the area. * This is used when initializing the contents of the area.
*/ */
void *usbvision_rvmalloc(unsigned long size) static void *usbvision_rvmalloc(unsigned long size)
{ {
void *mem; void *mem;
unsigned long adr; unsigned long adr;
...@@ -181,7 +181,7 @@ static void usbvision_hexdump(const unsigned char *data, int len) ...@@ -181,7 +181,7 @@ static void usbvision_hexdump(const unsigned char *data, int len)
/******************************** /********************************
* scratch ring buffer handling * scratch ring buffer handling
********************************/ ********************************/
int scratch_len(struct usb_usbvision *usbvision) /*This returns the amount of data actually in the buffer */ static int scratch_len(struct usb_usbvision *usbvision) /*This returns the amount of data actually in the buffer */
{ {
int len = usbvision->scratch_write_ptr - usbvision->scratch_read_ptr; int len = usbvision->scratch_write_ptr - usbvision->scratch_read_ptr;
if (len < 0) { if (len < 0) {
...@@ -194,7 +194,7 @@ int scratch_len(struct usb_usbvision *usbvision) /*This returns the amount of ...@@ -194,7 +194,7 @@ int scratch_len(struct usb_usbvision *usbvision) /*This returns the amount of
/* This returns the free space left in the buffer */ /* This returns the free space left in the buffer */
int scratch_free(struct usb_usbvision *usbvision) static int scratch_free(struct usb_usbvision *usbvision)
{ {
int free = usbvision->scratch_read_ptr - usbvision->scratch_write_ptr; int free = usbvision->scratch_read_ptr - usbvision->scratch_write_ptr;
if (free <= 0) { if (free <= 0) {
...@@ -211,7 +211,8 @@ int scratch_free(struct usb_usbvision *usbvision) ...@@ -211,7 +211,8 @@ int scratch_free(struct usb_usbvision *usbvision)
/* This puts data into the buffer */ /* This puts data into the buffer */
int scratch_put(struct usb_usbvision *usbvision, unsigned char *data, int len) static int scratch_put(struct usb_usbvision *usbvision, unsigned char *data,
int len)
{ {
int len_part; int len_part;
...@@ -237,7 +238,7 @@ int scratch_put(struct usb_usbvision *usbvision, unsigned char *data, int len) ...@@ -237,7 +238,7 @@ int scratch_put(struct usb_usbvision *usbvision, unsigned char *data, int len)
} }
/* This marks the write_ptr as position of new frame header */ /* This marks the write_ptr as position of new frame header */
void scratch_mark_header(struct usb_usbvision *usbvision) static void scratch_mark_header(struct usb_usbvision *usbvision)
{ {
PDEBUG(DBG_SCRATCH, "header at write_ptr=%d\n", usbvision->scratch_headermarker_write_ptr); PDEBUG(DBG_SCRATCH, "header at write_ptr=%d\n", usbvision->scratch_headermarker_write_ptr);
...@@ -248,7 +249,8 @@ void scratch_mark_header(struct usb_usbvision *usbvision) ...@@ -248,7 +249,8 @@ void scratch_mark_header(struct usb_usbvision *usbvision)
} }
/* This gets data from the buffer at the given "ptr" position */ /* This gets data from the buffer at the given "ptr" position */
int scratch_get_extra(struct usb_usbvision *usbvision, unsigned char *data, int *ptr, int len) static int scratch_get_extra(struct usb_usbvision *usbvision,
unsigned char *data, int *ptr, int len)
{ {
int len_part; int len_part;
if (*ptr + len < scratch_buf_size) { if (*ptr + len < scratch_buf_size) {
...@@ -274,7 +276,8 @@ int scratch_get_extra(struct usb_usbvision *usbvision, unsigned char *data, int ...@@ -274,7 +276,8 @@ int scratch_get_extra(struct usb_usbvision *usbvision, unsigned char *data, int
/* This sets the scratch extra read pointer */ /* This sets the scratch extra read pointer */
void scratch_set_extra_ptr(struct usb_usbvision *usbvision, int *ptr, int len) static void scratch_set_extra_ptr(struct usb_usbvision *usbvision, int *ptr,
int len)
{ {
*ptr = (usbvision->scratch_read_ptr + len)%scratch_buf_size; *ptr = (usbvision->scratch_read_ptr + len)%scratch_buf_size;
...@@ -283,7 +286,7 @@ void scratch_set_extra_ptr(struct usb_usbvision *usbvision, int *ptr, int len) ...@@ -283,7 +286,7 @@ void scratch_set_extra_ptr(struct usb_usbvision *usbvision, int *ptr, int len)
/*This increments the scratch extra read pointer */ /*This increments the scratch extra read pointer */
void scratch_inc_extra_ptr(int *ptr, int len) static void scratch_inc_extra_ptr(int *ptr, int len)
{ {
*ptr = (*ptr + len) % scratch_buf_size; *ptr = (*ptr + len) % scratch_buf_size;
...@@ -292,7 +295,8 @@ void scratch_inc_extra_ptr(int *ptr, int len) ...@@ -292,7 +295,8 @@ void scratch_inc_extra_ptr(int *ptr, int len)
/* This gets data from the buffer */ /* This gets data from the buffer */
int scratch_get(struct usb_usbvision *usbvision, unsigned char *data, int len) static int scratch_get(struct usb_usbvision *usbvision, unsigned char *data,
int len)
{ {
int len_part; int len_part;
if (usbvision->scratch_read_ptr + len < scratch_buf_size) { if (usbvision->scratch_read_ptr + len < scratch_buf_size) {
...@@ -318,7 +322,8 @@ int scratch_get(struct usb_usbvision *usbvision, unsigned char *data, int len) ...@@ -318,7 +322,8 @@ int scratch_get(struct usb_usbvision *usbvision, unsigned char *data, int len)
/* This sets read pointer to next header and returns it */ /* This sets read pointer to next header and returns it */
int scratch_get_header(struct usb_usbvision *usbvision,struct usbvision_frame_header *header) static int scratch_get_header(struct usb_usbvision *usbvision,
struct usbvision_frame_header *header)
{ {
int errCode = 0; int errCode = 0;
...@@ -346,7 +351,7 @@ int scratch_get_header(struct usb_usbvision *usbvision,struct usbvision_frame_he ...@@ -346,7 +351,7 @@ int scratch_get_header(struct usb_usbvision *usbvision,struct usbvision_frame_he
/*This removes len bytes of old data from the buffer */ /*This removes len bytes of old data from the buffer */
void scratch_rm_old(struct usb_usbvision *usbvision, int len) static void scratch_rm_old(struct usb_usbvision *usbvision, int len)
{ {
usbvision->scratch_read_ptr += len; usbvision->scratch_read_ptr += len;
...@@ -356,7 +361,7 @@ void scratch_rm_old(struct usb_usbvision *usbvision, int len) ...@@ -356,7 +361,7 @@ void scratch_rm_old(struct usb_usbvision *usbvision, int len)
/*This resets the buffer - kills all data in it too */ /*This resets the buffer - kills all data in it too */
void scratch_reset(struct usb_usbvision *usbvision) static void scratch_reset(struct usb_usbvision *usbvision)
{ {
PDEBUG(DBG_SCRATCH, "\n"); PDEBUG(DBG_SCRATCH, "\n");
...@@ -369,7 +374,7 @@ void scratch_reset(struct usb_usbvision *usbvision) ...@@ -369,7 +374,7 @@ void scratch_reset(struct usb_usbvision *usbvision)
int usbvision_scratch_alloc(struct usb_usbvision *usbvision) int usbvision_scratch_alloc(struct usb_usbvision *usbvision)
{ {
usbvision->scratch = vmalloc(scratch_buf_size); usbvision->scratch = vmalloc_32(scratch_buf_size);
scratch_reset(usbvision); scratch_reset(usbvision);
if(usbvision->scratch == NULL) { if(usbvision->scratch == NULL) {
err("%s: unable to allocate %d bytes for scratch", err("%s: unable to allocate %d bytes for scratch",
...@@ -399,8 +404,8 @@ void usbvision_scratch_free(struct usb_usbvision *usbvision) ...@@ -399,8 +404,8 @@ void usbvision_scratch_free(struct usb_usbvision *usbvision)
* 1: Draw a colored grid * 1: Draw a colored grid
* *
*/ */
void usbvision_testpattern(struct usb_usbvision *usbvision, int fullframe, static void usbvision_testpattern(struct usb_usbvision *usbvision,
int pmode) int fullframe, int pmode)
{ {
static const char proc[] = "usbvision_testpattern"; static const char proc[] = "usbvision_testpattern";
struct usbvision_frame *frame; struct usbvision_frame *frame;
...@@ -480,7 +485,7 @@ void usbvision_testpattern(struct usb_usbvision *usbvision, int fullframe, ...@@ -480,7 +485,7 @@ void usbvision_testpattern(struct usb_usbvision *usbvision, int fullframe,
int usbvision_decompress_alloc(struct usb_usbvision *usbvision) int usbvision_decompress_alloc(struct usb_usbvision *usbvision)
{ {
int IFB_size = MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT * 3 / 2; int IFB_size = MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT * 3 / 2;
usbvision->IntraFrameBuffer = vmalloc(IFB_size); usbvision->IntraFrameBuffer = vmalloc_32(IFB_size);
if (usbvision->IntraFrameBuffer == NULL) { if (usbvision->IntraFrameBuffer == NULL) {
err("%s: unable to allocate %d for compr. frame buffer", __FUNCTION__, IFB_size); err("%s: unable to allocate %d for compr. frame buffer", __FUNCTION__, IFB_size);
return -ENOMEM; return -ENOMEM;
...@@ -2199,6 +2204,7 @@ int usbvision_power_on(struct usb_usbvision *usbvision) ...@@ -2199,6 +2204,7 @@ int usbvision_power_on(struct usb_usbvision *usbvision)
usbvision_write_reg(usbvision, USBVISION_PWR_REG, USBVISION_SSPND_EN); usbvision_write_reg(usbvision, USBVISION_PWR_REG, USBVISION_SSPND_EN);
usbvision_write_reg(usbvision, USBVISION_PWR_REG, usbvision_write_reg(usbvision, USBVISION_PWR_REG,
USBVISION_SSPND_EN | USBVISION_RES2); USBVISION_SSPND_EN | USBVISION_RES2);
usbvision_write_reg(usbvision, USBVISION_PWR_REG, usbvision_write_reg(usbvision, USBVISION_PWR_REG,
USBVISION_SSPND_EN | USBVISION_PWR_VID); USBVISION_SSPND_EN | USBVISION_PWR_VID);
errCode = usbvision_write_reg(usbvision, USBVISION_PWR_REG, errCode = usbvision_write_reg(usbvision, USBVISION_PWR_REG,
...@@ -2305,7 +2311,7 @@ int usbvision_restart_isoc(struct usb_usbvision *usbvision) ...@@ -2305,7 +2311,7 @@ int usbvision_restart_isoc(struct usb_usbvision *usbvision)
usbvision->Vin_Reg2_Preset)) < 0) return ret; usbvision->Vin_Reg2_Preset)) < 0) return ret;
/* TODO: schedule timeout */ /* TODO: schedule timeout */
while ((usbvision_read_reg(usbvision, USBVISION_STATUS_REG) && 0x01) != 1); while ((usbvision_read_reg(usbvision, USBVISION_STATUS_REG) & 0x01) != 1);
return 0; return 0;
} }
...@@ -2346,40 +2352,6 @@ int usbvision_setup(struct usb_usbvision *usbvision,int format) ...@@ -2346,40 +2352,6 @@ int usbvision_setup(struct usb_usbvision *usbvision,int format)
return USBVISION_IS_OPERATIONAL(usbvision); return USBVISION_IS_OPERATIONAL(usbvision);
} }
int usbvision_sbuf_alloc(struct usb_usbvision *usbvision)
{
int i, errCode = 0;
const int sb_size = USBVISION_URB_FRAMES * USBVISION_MAX_ISOC_PACKET_SIZE;
/* Clean pointers so we know if we allocated something */
for (i = 0; i < USBVISION_NUMSBUF; i++)
usbvision->sbuf[i].data = NULL;
for (i = 0; i < USBVISION_NUMSBUF; i++) {
usbvision->sbuf[i].data = kzalloc(sb_size, GFP_KERNEL);
if (usbvision->sbuf[i].data == NULL) {
err("%s: unable to allocate %d bytes for sbuf", __FUNCTION__, sb_size);
errCode = -ENOMEM;
break;
}
}
return errCode;
}
void usbvision_sbuf_free(struct usb_usbvision *usbvision)
{
int i;
for (i = 0; i < USBVISION_NUMSBUF; i++) {
if (usbvision->sbuf[i].data != NULL) {
kfree(usbvision->sbuf[i].data);
usbvision->sbuf[i].data = NULL;
}
}
}
/* /*
* usbvision_init_isoc() * usbvision_init_isoc()
* *
...@@ -2388,6 +2360,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) ...@@ -2388,6 +2360,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
{ {
struct usb_device *dev = usbvision->dev; struct usb_device *dev = usbvision->dev;
int bufIdx, errCode, regValue; int bufIdx, errCode, regValue;
const int sb_size = USBVISION_URB_FRAMES * USBVISION_MAX_ISOC_PACKET_SIZE;
if (!USBVISION_IS_OPERATIONAL(usbvision)) if (!USBVISION_IS_OPERATIONAL(usbvision))
return -EFAULT; return -EFAULT;
...@@ -2423,6 +2396,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) ...@@ -2423,6 +2396,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
return -ENOMEM; return -ENOMEM;
} }
usbvision->sbuf[bufIdx].urb = urb; usbvision->sbuf[bufIdx].urb = urb;
usbvision->sbuf[bufIdx].data = usb_buffer_alloc(usbvision->dev, sb_size, GFP_KERNEL,&urb->transfer_dma);
urb->dev = dev; urb->dev = dev;
urb->context = usbvision; urb->context = usbvision;
urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp); urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp);
...@@ -2464,6 +2438,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) ...@@ -2464,6 +2438,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
void usbvision_stop_isoc(struct usb_usbvision *usbvision) void usbvision_stop_isoc(struct usb_usbvision *usbvision)
{ {
int bufIdx, errCode, regValue; int bufIdx, errCode, regValue;
const int sb_size = USBVISION_URB_FRAMES * USBVISION_MAX_ISOC_PACKET_SIZE;
if ((usbvision->streaming == Stream_Off) || (usbvision->dev == NULL)) if ((usbvision->streaming == Stream_Off) || (usbvision->dev == NULL))
return; return;
...@@ -2471,6 +2446,12 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision) ...@@ -2471,6 +2446,12 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision)
/* Unschedule all of the iso td's */ /* Unschedule all of the iso td's */
for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) {
usb_kill_urb(usbvision->sbuf[bufIdx].urb); usb_kill_urb(usbvision->sbuf[bufIdx].urb);
if (usbvision->sbuf[bufIdx].data){
usb_buffer_free(usbvision->dev,
sb_size,
usbvision->sbuf[bufIdx].data,
usbvision->sbuf[bufIdx].urb->transfer_dma);
}
usb_free_urb(usbvision->sbuf[bufIdx].urb); usb_free_urb(usbvision->sbuf[bufIdx].urb);
usbvision->sbuf[bufIdx].urb = NULL; usbvision->sbuf[bufIdx].urb = NULL;
} }
......
...@@ -58,7 +58,6 @@ static int usbvision_i2c_read(void *data, unsigned char addr, char *buf, ...@@ -58,7 +58,6 @@ static int usbvision_i2c_read(void *data, unsigned char addr, char *buf,
static inline int try_write_address(struct i2c_adapter *i2c_adap, static inline int try_write_address(struct i2c_adapter *i2c_adap,
unsigned char addr, int retries) unsigned char addr, int retries)
{ {
struct i2c_algo_usb_data *adap = i2c_adap->algo_data;
void *data; void *data;
int i, ret = -1; int i, ret = -1;
char buf[4]; char buf[4];
...@@ -69,10 +68,10 @@ static inline int try_write_address(struct i2c_adapter *i2c_adap, ...@@ -69,10 +68,10 @@ static inline int try_write_address(struct i2c_adapter *i2c_adap,
ret = (usbvision_i2c_write(data, addr, buf, 1)); ret = (usbvision_i2c_write(data, addr, buf, 1));
if (ret == 1) if (ret == 1)
break; /* success! */ break; /* success! */
udelay(5 /*adap->udelay */ ); udelay(5);
if (i == retries) /* no success */ if (i == retries) /* no success */
break; break;
udelay(adap->udelay); udelay(10);
} }
if (i) { if (i) {
PDEBUG(DBG_ALGO,"Needed %d retries for address %#2x", i, addr); PDEBUG(DBG_ALGO,"Needed %d retries for address %#2x", i, addr);
...@@ -84,7 +83,6 @@ static inline int try_write_address(struct i2c_adapter *i2c_adap, ...@@ -84,7 +83,6 @@ static inline int try_write_address(struct i2c_adapter *i2c_adap,
static inline int try_read_address(struct i2c_adapter *i2c_adap, static inline int try_read_address(struct i2c_adapter *i2c_adap,
unsigned char addr, int retries) unsigned char addr, int retries)
{ {
struct i2c_algo_usb_data *adap = i2c_adap->algo_data;
void *data; void *data;
int i, ret = -1; int i, ret = -1;
char buf[4]; char buf[4];
...@@ -94,10 +92,10 @@ static inline int try_read_address(struct i2c_adapter *i2c_adap, ...@@ -94,10 +92,10 @@ static inline int try_read_address(struct i2c_adapter *i2c_adap,
ret = (usbvision_i2c_read(data, addr, buf, 1)); ret = (usbvision_i2c_read(data, addr, buf, 1));
if (ret == 1) if (ret == 1)
break; /* success! */ break; /* success! */
udelay(5 /*adap->udelay */ ); udelay(5);
if (i == retries) /* no success */ if (i == retries) /* no success */
break; break;
udelay(adap->udelay); udelay(10);
} }
if (i) { if (i) {
PDEBUG(DBG_ALGO,"Needed %d retries for address %#2x", i, addr); PDEBUG(DBG_ALGO,"Needed %d retries for address %#2x", i, addr);
...@@ -213,7 +211,7 @@ static struct i2c_algorithm i2c_usb_algo = { ...@@ -213,7 +211,7 @@ static struct i2c_algorithm i2c_usb_algo = {
/* /*
* registering functions to load algorithms at runtime * registering functions to load algorithms at runtime
*/ */
int usbvision_i2c_usb_add_bus(struct i2c_adapter *adap) static int usbvision_i2c_usb_add_bus(struct i2c_adapter *adap)
{ {
PDEBUG(DBG_I2C, "I2C debugging is enabled [i2c]"); PDEBUG(DBG_I2C, "I2C debugging is enabled [i2c]");
PDEBUG(DBG_ALGO, "ALGO debugging is enabled [i2c]"); PDEBUG(DBG_ALGO, "ALGO debugging is enabled [i2c]");
...@@ -248,15 +246,12 @@ int usbvision_i2c_usb_del_bus(struct i2c_adapter *adap) ...@@ -248,15 +246,12 @@ int usbvision_i2c_usb_del_bus(struct i2c_adapter *adap)
/* usbvision specific I2C functions */ /* usbvision specific I2C functions */
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
static struct i2c_adapter i2c_adap_template; static struct i2c_adapter i2c_adap_template;
static struct i2c_algo_usb_data i2c_algo_template;
static struct i2c_client i2c_client_template; static struct i2c_client i2c_client_template;
int usbvision_init_i2c(struct usb_usbvision *usbvision) int usbvision_init_i2c(struct usb_usbvision *usbvision)
{ {
memcpy(&usbvision->i2c_adap, &i2c_adap_template, memcpy(&usbvision->i2c_adap, &i2c_adap_template,
sizeof(struct i2c_adapter)); sizeof(struct i2c_adapter));
memcpy(&usbvision->i2c_algo, &i2c_algo_template,
sizeof(struct i2c_algo_usb_data));
memcpy(&usbvision->i2c_client, &i2c_client_template, memcpy(&usbvision->i2c_client, &i2c_client_template,
sizeof(struct i2c_client)); sizeof(struct i2c_client));
...@@ -266,9 +261,7 @@ int usbvision_init_i2c(struct usb_usbvision *usbvision) ...@@ -266,9 +261,7 @@ int usbvision_init_i2c(struct usb_usbvision *usbvision)
i2c_set_adapdata(&usbvision->i2c_adap, usbvision); i2c_set_adapdata(&usbvision->i2c_adap, usbvision);
i2c_set_clientdata(&usbvision->i2c_client, usbvision); i2c_set_clientdata(&usbvision->i2c_client, usbvision);
i2c_set_algo_usb_data(&usbvision->i2c_algo, usbvision);
usbvision->i2c_adap.algo_data = &usbvision->i2c_algo;
usbvision->i2c_client.adapter = &usbvision->i2c_adap; usbvision->i2c_client.adapter = &usbvision->i2c_adap;
if (usbvision_write_reg(usbvision, USBVISION_SER_MODE, USBVISION_IIC_LRNACK) < 0) { if (usbvision_write_reg(usbvision, USBVISION_SER_MODE, USBVISION_IIC_LRNACK) < 0) {
...@@ -297,7 +290,6 @@ int usbvision_init_i2c(struct usb_usbvision *usbvision) ...@@ -297,7 +290,6 @@ int usbvision_init_i2c(struct usb_usbvision *usbvision)
void call_i2c_clients(struct usb_usbvision *usbvision, unsigned int cmd, void call_i2c_clients(struct usb_usbvision *usbvision, unsigned int cmd,
void *arg) void *arg)
{ {
BUG_ON(NULL == usbvision->i2c_adap.algo_data);
i2c_clients_command(&usbvision->i2c_adap, cmd, arg); i2c_clients_command(&usbvision->i2c_adap, cmd, arg);
} }
...@@ -327,6 +319,9 @@ static int attach_inform(struct i2c_client *client) ...@@ -327,6 +319,9 @@ static int attach_inform(struct i2c_client *client)
case 0x4a: case 0x4a:
PDEBUG(DBG_I2C,"attach_inform: saa7113 detected."); PDEBUG(DBG_I2C,"attach_inform: saa7113 detected.");
break; break;
case 0x48:
PDEBUG(DBG_I2C,"attach_inform: saa7111 detected.");
break;
case 0xa0: case 0xa0:
PDEBUG(DBG_I2C,"attach_inform: eeprom detected."); PDEBUG(DBG_I2C,"attach_inform: eeprom detected.");
break; break;
...@@ -531,21 +526,10 @@ static int usbvision_i2c_read(void *data, unsigned char addr, char *buf, ...@@ -531,21 +526,10 @@ static int usbvision_i2c_read(void *data, unsigned char addr, char *buf,
return rdcount; return rdcount;
} }
static struct i2c_algo_usb_data i2c_algo_template = {
.data = NULL,
.inb = usbvision_i2c_read,
.outb = usbvision_i2c_write,
.udelay = 10,
.mdelay = 10,
.timeout = 100,
};
static struct i2c_adapter i2c_adap_template = { static struct i2c_adapter i2c_adap_template = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "usbvision", .name = "usbvision",
.id = I2C_HW_B_BT848, /* FIXME */ .id = I2C_HW_B_BT848, /* FIXME */
.algo = NULL,
.algo_data = NULL,
.client_register = attach_inform, .client_register = attach_inform,
.client_unregister = detach_inform, .client_unregister = detach_inform,
#ifdef I2C_ADAP_CLASS_TV_ANALOG #ifdef I2C_ADAP_CLASS_TV_ANALOG
...@@ -559,9 +543,6 @@ static struct i2c_client i2c_client_template = { ...@@ -559,9 +543,6 @@ static struct i2c_client i2c_client_template = {
.name = "usbvision internal", .name = "usbvision internal",
}; };
EXPORT_SYMBOL(usbvision_i2c_usb_add_bus);
EXPORT_SYMBOL(usbvision_i2c_usb_del_bus);
/* /*
* Overrides for Emacs so that we follow Linus's tabbing style. * Overrides for Emacs so that we follow Linus's tabbing style.
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
......
...@@ -204,7 +204,7 @@ MODULE_ALIAS(DRIVER_ALIAS); ...@@ -204,7 +204,7 @@ MODULE_ALIAS(DRIVER_ALIAS);
static inline struct usb_usbvision *cd_to_usbvision(struct class_device *cd) static inline struct usb_usbvision *cd_to_usbvision(struct class_device *cd)
{ {
struct video_device *vdev = to_video_device(cd); struct video_device *vdev = container_of(cd, struct video_device, class_dev);
return video_get_drvdata(vdev); return video_get_drvdata(vdev);
} }
...@@ -214,81 +214,85 @@ static ssize_t show_version(struct class_device *cd, char *buf) ...@@ -214,81 +214,85 @@ static ssize_t show_version(struct class_device *cd, char *buf)
} }
static CLASS_DEVICE_ATTR(version, S_IRUGO, show_version, NULL); static CLASS_DEVICE_ATTR(version, S_IRUGO, show_version, NULL);
static ssize_t show_model(struct class_device *class_dev, char *buf) static ssize_t show_model(struct class_device *cd, char *buf)
{ {
struct video_device *vdev = to_video_device(class_dev); struct video_device *vdev = container_of(cd, struct video_device, class_dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct usb_usbvision *usbvision = video_get_drvdata(vdev);
return sprintf(buf, "%s\n", usbvision_device_data[usbvision->DevModel].ModelString); return sprintf(buf, "%s\n", usbvision_device_data[usbvision->DevModel].ModelString);
} }
static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL); static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL);
static ssize_t show_hue(struct class_device *class_dev, char *buf) static ssize_t show_hue(struct class_device *cd, char *buf)
{ {
struct video_device *vdev = to_video_device(class_dev); struct video_device *vdev = container_of(cd, struct video_device, class_dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct usb_usbvision *usbvision = video_get_drvdata(vdev);
struct v4l2_control ctrl; struct v4l2_control ctrl;
ctrl.id = V4L2_CID_HUE; ctrl.id = V4L2_CID_HUE;
ctrl.value = 0; ctrl.value = 0;
call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); if(usbvision->user)
call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl);
return sprintf(buf, "%d\n", ctrl.value >> 8); return sprintf(buf, "%d\n", ctrl.value >> 8);
} }
static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL);
static ssize_t show_contrast(struct class_device *class_dev, char *buf) static ssize_t show_contrast(struct class_device *cd, char *buf)
{ {
struct video_device *vdev = to_video_device(class_dev); struct video_device *vdev = container_of(cd, struct video_device, class_dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct usb_usbvision *usbvision = video_get_drvdata(vdev);
struct v4l2_control ctrl; struct v4l2_control ctrl;
ctrl.id = V4L2_CID_CONTRAST; ctrl.id = V4L2_CID_CONTRAST;
ctrl.value = 0; ctrl.value = 0;
call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); if(usbvision->user)
call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl);
return sprintf(buf, "%d\n", ctrl.value >> 8); return sprintf(buf, "%d\n", ctrl.value >> 8);
} }
static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL);
static ssize_t show_brightness(struct class_device *class_dev, char *buf) static ssize_t show_brightness(struct class_device *cd, char *buf)
{ {
struct video_device *vdev = to_video_device(class_dev); struct video_device *vdev = container_of(cd, struct video_device, class_dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct usb_usbvision *usbvision = video_get_drvdata(vdev);
struct v4l2_control ctrl; struct v4l2_control ctrl;
ctrl.id = V4L2_CID_BRIGHTNESS; ctrl.id = V4L2_CID_BRIGHTNESS;
ctrl.value = 0; ctrl.value = 0;
call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); if(usbvision->user)
call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl);
return sprintf(buf, "%d\n", ctrl.value >> 8); return sprintf(buf, "%d\n", ctrl.value >> 8);
} }
static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL);
static ssize_t show_saturation(struct class_device *class_dev, char *buf) static ssize_t show_saturation(struct class_device *cd, char *buf)
{ {
struct video_device *vdev = to_video_device(class_dev); struct video_device *vdev = container_of(cd, struct video_device, class_dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct usb_usbvision *usbvision = video_get_drvdata(vdev);
struct v4l2_control ctrl; struct v4l2_control ctrl;
ctrl.id = V4L2_CID_SATURATION; ctrl.id = V4L2_CID_SATURATION;
ctrl.value = 0; ctrl.value = 0;
call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl); if(usbvision->user)
call_i2c_clients(usbvision, VIDIOC_G_CTRL, &ctrl);
return sprintf(buf, "%d\n", ctrl.value >> 8); return sprintf(buf, "%d\n", ctrl.value >> 8);
} }
static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL);
static ssize_t show_streaming(struct class_device *class_dev, char *buf) static ssize_t show_streaming(struct class_device *cd, char *buf)
{ {
struct video_device *vdev = to_video_device(class_dev); struct video_device *vdev = container_of(cd, struct video_device, class_dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct usb_usbvision *usbvision = video_get_drvdata(vdev);
return sprintf(buf, "%s\n", YES_NO(usbvision->streaming==Stream_On?1:0)); return sprintf(buf, "%s\n", YES_NO(usbvision->streaming==Stream_On?1:0));
} }
static CLASS_DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL); static CLASS_DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL);
static ssize_t show_compression(struct class_device *class_dev, char *buf) static ssize_t show_compression(struct class_device *cd, char *buf)
{ {
struct video_device *vdev = to_video_device(class_dev); struct video_device *vdev = container_of(cd, struct video_device, class_dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct usb_usbvision *usbvision = video_get_drvdata(vdev);
return sprintf(buf, "%s\n", YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS)); return sprintf(buf, "%s\n", YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS));
} }
static CLASS_DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL); static CLASS_DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL);
static ssize_t show_device_bridge(struct class_device *class_dev, char *buf) static ssize_t show_device_bridge(struct class_device *cd, char *buf)
{ {
struct video_device *vdev = to_video_device(class_dev); struct video_device *vdev = container_of(cd, struct video_device, class_dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct usb_usbvision *usbvision = video_get_drvdata(vdev);
return sprintf(buf, "%d\n", usbvision->bridgeType); return sprintf(buf, "%d\n", usbvision->bridgeType);
} }
...@@ -297,31 +301,71 @@ static CLASS_DEVICE_ATTR(bridge, S_IRUGO, show_device_bridge, NULL); ...@@ -297,31 +301,71 @@ static CLASS_DEVICE_ATTR(bridge, S_IRUGO, show_device_bridge, NULL);
static void usbvision_create_sysfs(struct video_device *vdev) static void usbvision_create_sysfs(struct video_device *vdev)
{ {
int res; int res;
if (vdev) { if (!vdev)
res=video_device_create_file(vdev, &class_device_attr_version); return;
res=video_device_create_file(vdev, &class_device_attr_model); do {
res=video_device_create_file(vdev, &class_device_attr_hue); res=class_device_create_file(&vdev->class_dev,
res=video_device_create_file(vdev, &class_device_attr_contrast); &class_device_attr_version);
res=video_device_create_file(vdev, &class_device_attr_brightness); if (res<0)
res=video_device_create_file(vdev, &class_device_attr_saturation); break;
res=video_device_create_file(vdev, &class_device_attr_streaming); res=class_device_create_file(&vdev->class_dev,
res=video_device_create_file(vdev, &class_device_attr_compression); &class_device_attr_model);
res=video_device_create_file(vdev, &class_device_attr_bridge); if (res<0)
} break;
res=class_device_create_file(&vdev->class_dev,
&class_device_attr_hue);
if (res<0)
break;
res=class_device_create_file(&vdev->class_dev,
&class_device_attr_contrast);
if (res<0)
break;
res=class_device_create_file(&vdev->class_dev,
&class_device_attr_brightness);
if (res<0)
break;
res=class_device_create_file(&vdev->class_dev,
&class_device_attr_saturation);
if (res<0)
break;
res=class_device_create_file(&vdev->class_dev,
&class_device_attr_streaming);
if (res<0)
break;
res=class_device_create_file(&vdev->class_dev,
&class_device_attr_compression);
if (res<0)
break;
res=class_device_create_file(&vdev->class_dev,
&class_device_attr_bridge);
if (res>=0)
return;
} while (0);
err("%s error: %d\n", __FUNCTION__, res);
} }
static void usbvision_remove_sysfs(struct video_device *vdev) static void usbvision_remove_sysfs(struct video_device *vdev)
{ {
if (vdev) { if (vdev) {
video_device_remove_file(vdev, &class_device_attr_version); class_device_remove_file(&vdev->class_dev,
video_device_remove_file(vdev, &class_device_attr_model); &class_device_attr_version);
video_device_remove_file(vdev, &class_device_attr_hue); class_device_remove_file(&vdev->class_dev,
video_device_remove_file(vdev, &class_device_attr_contrast); &class_device_attr_model);
video_device_remove_file(vdev, &class_device_attr_brightness); class_device_remove_file(&vdev->class_dev,
video_device_remove_file(vdev, &class_device_attr_saturation); &class_device_attr_hue);
video_device_remove_file(vdev, &class_device_attr_streaming); class_device_remove_file(&vdev->class_dev,
video_device_remove_file(vdev, &class_device_attr_compression); &class_device_attr_contrast);
video_device_remove_file(vdev, &class_device_attr_bridge); class_device_remove_file(&vdev->class_dev,
&class_device_attr_brightness);
class_device_remove_file(&vdev->class_dev,
&class_device_attr_saturation);
class_device_remove_file(&vdev->class_dev,
&class_device_attr_streaming);
class_device_remove_file(&vdev->class_dev,
&class_device_attr_compression);
class_device_remove_file(&vdev->class_dev,
&class_device_attr_bridge);
} }
} }
...@@ -353,20 +397,15 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file) ...@@ -353,20 +397,15 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file)
if(!errCode) { if(!errCode) {
/* Allocate memory for the scratch ring buffer */ /* Allocate memory for the scratch ring buffer */
errCode = usbvision_scratch_alloc(usbvision); errCode = usbvision_scratch_alloc(usbvision);
if(!errCode) { if ((!errCode) && (isocMode==ISOC_MODE_COMPRESS)) {
/* Allocate memory for the USB S buffers */ /* Allocate intermediate decompression buffers only if needed */
errCode = usbvision_sbuf_alloc(usbvision); errCode = usbvision_decompress_alloc(usbvision);
if ((!errCode) && (usbvision->isocMode==ISOC_MODE_COMPRESS)) {
/* Allocate intermediate decompression buffers only if needed */
errCode = usbvision_decompress_alloc(usbvision);
}
} }
} }
if (errCode) { if (errCode) {
/* Deallocate all buffers if trouble */ /* Deallocate all buffers if trouble */
usbvision_frames_free(usbvision); usbvision_frames_free(usbvision);
usbvision_scratch_free(usbvision); usbvision_scratch_free(usbvision);
usbvision_sbuf_free(usbvision);
usbvision_decompress_free(usbvision); usbvision_decompress_free(usbvision);
} }
} }
...@@ -437,9 +476,8 @@ static int usbvision_v4l2_close(struct inode *inode, struct file *file) ...@@ -437,9 +476,8 @@ static int usbvision_v4l2_close(struct inode *inode, struct file *file)
usbvision_stop_isoc(usbvision); usbvision_stop_isoc(usbvision);
usbvision_decompress_free(usbvision); usbvision_decompress_free(usbvision);
usbvision_rvfree(usbvision->fbuf, usbvision->fbuf_size); usbvision_frames_free(usbvision);
usbvision_scratch_free(usbvision); usbvision_scratch_free(usbvision);
usbvision_sbuf_free(usbvision);
usbvision->user--; usbvision->user--;
...@@ -1884,7 +1922,7 @@ static struct usb_driver usbvision_driver = { ...@@ -1884,7 +1922,7 @@ static struct usb_driver usbvision_driver = {
* This procedure preprocesses CustomDevice parameter if any * This procedure preprocesses CustomDevice parameter if any
* *
*/ */
void customdevice_process(void) static void customdevice_process(void)
{ {
usbvision_device_data[0]=usbvision_device_data[1]; usbvision_device_data[0]=usbvision_device_data[1];
usbvision_table[0]=usbvision_table[1]; usbvision_table[0]=usbvision_table[1];
...@@ -1939,22 +1977,22 @@ void customdevice_process(void) ...@@ -1939,22 +1977,22 @@ void customdevice_process(void)
{ {
case 'P': case 'P':
PDEBUG(DBG_PROBE, "VideoNorm=PAL"); PDEBUG(DBG_PROBE, "VideoNorm=PAL");
usbvision_device_data[0].VideoNorm=VIDEO_MODE_PAL; usbvision_device_data[0].VideoNorm=V4L2_STD_PAL;
break; break;
case 'S': case 'S':
PDEBUG(DBG_PROBE, "VideoNorm=SECAM"); PDEBUG(DBG_PROBE, "VideoNorm=SECAM");
usbvision_device_data[0].VideoNorm=VIDEO_MODE_SECAM; usbvision_device_data[0].VideoNorm=V4L2_STD_SECAM;
break; break;
case 'N': case 'N':
PDEBUG(DBG_PROBE, "VideoNorm=NTSC"); PDEBUG(DBG_PROBE, "VideoNorm=NTSC");
usbvision_device_data[0].VideoNorm=VIDEO_MODE_NTSC; usbvision_device_data[0].VideoNorm=V4L2_STD_NTSC;
break; break;
default: default:
PDEBUG(DBG_PROBE, "VideoNorm=PAL (by default)"); PDEBUG(DBG_PROBE, "VideoNorm=PAL (by default)");
usbvision_device_data[0].VideoNorm=VIDEO_MODE_PAL; usbvision_device_data[0].VideoNorm=V4L2_STD_PAL;
break; break;
} }
goto2next(parse); goto2next(parse);
......
...@@ -219,18 +219,6 @@ enum { ...@@ -219,18 +219,6 @@ enum {
((udevice)->last_error == 0) && \ ((udevice)->last_error == 0) && \
(!(udevice)->remove_pending)) (!(udevice)->remove_pending))
/* I2C structures */
struct i2c_algo_usb_data {
void *data; /* private data for lowlevel routines */
int (*inb) (void *data, unsigned char addr, char *buf, short len);
int (*outb) (void *data, unsigned char addr, char *buf, short len);
/* local settings */
int udelay;
int mdelay;
int timeout;
};
#define I2C_USB_ADAP_MAX 16 #define I2C_USB_ADAP_MAX 16
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
...@@ -383,7 +371,6 @@ struct usb_usbvision { ...@@ -383,7 +371,6 @@ struct usb_usbvision {
/* i2c Declaration Section*/ /* i2c Declaration Section*/
struct i2c_adapter i2c_adap; struct i2c_adapter i2c_adap;
struct i2c_algo_usb_data i2c_algo;
struct i2c_client i2c_client; struct i2c_client i2c_client;
struct urb *ctrlUrb; struct urb *ctrlUrb;
...@@ -489,19 +476,8 @@ struct usb_usbvision { ...@@ -489,19 +476,8 @@ struct usb_usbvision {
/* i2c-algo-usb declaration */ /* i2c-algo-usb declaration */
/* --------------------------------------------------------------- */ /* --------------------------------------------------------------- */
int usbvision_i2c_usb_add_bus(struct i2c_adapter *);
int usbvision_i2c_usb_del_bus(struct i2c_adapter *); int usbvision_i2c_usb_del_bus(struct i2c_adapter *);
static inline void *i2c_get_algo_usb_data (struct i2c_algo_usb_data *dev)
{
return dev->data;
}
static inline void i2c_set_algo_usb_data (struct i2c_algo_usb_data *dev, void *data)
{
dev->data = data;
}
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
/* usbvision specific I2C functions */ /* usbvision specific I2C functions */
...@@ -510,7 +486,6 @@ int usbvision_init_i2c(struct usb_usbvision *usbvision); ...@@ -510,7 +486,6 @@ int usbvision_init_i2c(struct usb_usbvision *usbvision);
void call_i2c_clients(struct usb_usbvision *usbvision, unsigned int cmd,void *arg); void call_i2c_clients(struct usb_usbvision *usbvision, unsigned int cmd,void *arg);
/* defined in usbvision-core.c */ /* defined in usbvision-core.c */
void *usbvision_rvmalloc(unsigned long size);
void usbvision_rvfree(void *mem, unsigned long size); void usbvision_rvfree(void *mem, unsigned long size);
int usbvision_read_reg(struct usb_usbvision *usbvision, unsigned char reg); int usbvision_read_reg(struct usb_usbvision *usbvision, unsigned char reg);
int usbvision_write_reg(struct usb_usbvision *usbvision, unsigned char reg, int usbvision_write_reg(struct usb_usbvision *usbvision, unsigned char reg,
...@@ -520,8 +495,6 @@ int usbvision_frames_alloc(struct usb_usbvision *usbvision); ...@@ -520,8 +495,6 @@ int usbvision_frames_alloc(struct usb_usbvision *usbvision);
void usbvision_frames_free(struct usb_usbvision *usbvision); void usbvision_frames_free(struct usb_usbvision *usbvision);
int usbvision_scratch_alloc(struct usb_usbvision *usbvision); int usbvision_scratch_alloc(struct usb_usbvision *usbvision);
void usbvision_scratch_free(struct usb_usbvision *usbvision); void usbvision_scratch_free(struct usb_usbvision *usbvision);
int usbvision_sbuf_alloc(struct usb_usbvision *usbvision);
void usbvision_sbuf_free(struct usb_usbvision *usbvision);
int usbvision_decompress_alloc(struct usb_usbvision *usbvision); int usbvision_decompress_alloc(struct usb_usbvision *usbvision);
void usbvision_decompress_free(struct usb_usbvision *usbvision); void usbvision_decompress_free(struct usb_usbvision *usbvision);
......
...@@ -535,9 +535,9 @@ static int vivi_start_thread(struct vivi_dmaqueue *dma_q) ...@@ -535,9 +535,9 @@ static int vivi_start_thread(struct vivi_dmaqueue *dma_q)
dma_q->kthread = kthread_run(vivi_thread, dma_q, "vivi"); dma_q->kthread = kthread_run(vivi_thread, dma_q, "vivi");
if (dma_q->kthread == NULL) { if (IS_ERR(dma_q->kthread)) {
printk(KERN_ERR "vivi: kernel_thread() failed\n"); printk(KERN_ERR "vivi: kernel_thread() failed\n");
return -EINVAL; return PTR_ERR(dma_q->kthread);
} }
dprintk(1,"returning from %s\n",__FUNCTION__); dprintk(1,"returning from %s\n",__FUNCTION__);
return 0; return 0;
...@@ -1363,7 +1363,9 @@ static void __exit vivi_exit(void) ...@@ -1363,7 +1363,9 @@ static void __exit vivi_exit(void)
struct vivi_dev *h; struct vivi_dev *h;
struct list_head *list; struct list_head *list;
list_for_each(list,&vivi_devlist) { while (!list_empty(&vivi_devlist)) {
list = vivi_devlist.next;
list_del(list);
h = list_entry(list, struct vivi_dev, vivi_devlist); h = list_entry(list, struct vivi_dev, vivi_devlist);
kfree (h); kfree (h);
} }
......
...@@ -789,7 +789,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, ...@@ -789,7 +789,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file,
case VIDIOCSPICT: case VIDIOCSPICT:
{ {
struct video_picture *vpic = arg; struct video_picture *vpic = arg;
if (vpic->depth != 16 || vpic->palette != VIDEO_PALETTE_YUV422) if (vpic->depth != 16 || (vpic->palette != VIDEO_PALETTE_YUV422 && vpic->palette != VIDEO_PALETTE_YUYV))
return -EINVAL; return -EINVAL;
cam->brightness = vpic->brightness >> 8; cam->brightness = vpic->brightness >> 8;
......
...@@ -1827,8 +1827,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win) ...@@ -1827,8 +1827,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win)
int err = 0; int err = 0;
/* Work around to avoid FP arithmetics */ /* Work around to avoid FP arithmetics */
#define __SC(x) ((x) << 10) #define SC(x) ((x) << 10)
#define __UNSC(x) ((x) >> 10) #define UNSC(x) ((x) >> 10)
/* Make sure we are using a supported resolution */ /* Make sure we are using a supported resolution */
if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width, if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width,
...@@ -1836,15 +1836,15 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win) ...@@ -1836,15 +1836,15 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win)
goto error; goto error;
/* Scaling factors */ /* Scaling factors */
fw = __SC(win.width) / cam->maxwidth; fw = SC(win.width) / cam->maxwidth;
fh = __SC(win.height) / cam->maxheight; fh = SC(win.height) / cam->maxheight;
/* Set up the width and height values used by the chip */ /* Set up the width and height values used by the chip */
if ((win.width > cam->maxwidth) || (win.height > cam->maxheight)) { if ((win.width > cam->maxwidth) || (win.height > cam->maxheight)) {
cam->vpp_flag |= VPP_UPSCALE; cam->vpp_flag |= VPP_UPSCALE;
/* Calculate largest w,h mantaining the same w/h ratio */ /* Calculate largest w,h mantaining the same w/h ratio */
w = (fw >= fh) ? cam->maxwidth : __SC(win.width)/fh; w = (fw >= fh) ? cam->maxwidth : SC(win.width)/fh;
h = (fw >= fh) ? __SC(win.height)/fw : cam->maxheight; h = (fw >= fh) ? SC(win.height)/fw : cam->maxheight;
if (w < cam->minwidth) /* just in case */ if (w < cam->minwidth) /* just in case */
w = cam->minwidth; w = cam->minwidth;
if (h < cam->minheight) /* just in case */ if (h < cam->minheight) /* just in case */
...@@ -1861,8 +1861,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win) ...@@ -1861,8 +1861,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win)
/* Calculate cropped area manteining the right w/h ratio */ /* Calculate cropped area manteining the right w/h ratio */
if (cam->largeview && !(cam->vpp_flag & VPP_UPSCALE)) { if (cam->largeview && !(cam->vpp_flag & VPP_UPSCALE)) {
cw = (fw >= fh) ? cam->maxwidth : __SC(win.width)/fh; cw = (fw >= fh) ? cam->maxwidth : SC(win.width)/fh;
ch = (fw >= fh) ? __SC(win.height)/fw : cam->maxheight; ch = (fw >= fh) ? SC(win.height)/fw : cam->maxheight;
} else { } else {
cw = w; cw = w;
ch = h; ch = h;
...@@ -1901,8 +1901,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win) ...@@ -1901,8 +1901,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win)
/* We have to scale win.x and win.y offsets */ /* We have to scale win.x and win.y offsets */
if ( (cam->largeview && !(cam->vpp_flag & VPP_UPSCALE)) if ( (cam->largeview && !(cam->vpp_flag & VPP_UPSCALE))
|| (cam->vpp_flag & VPP_UPSCALE) ) { || (cam->vpp_flag & VPP_UPSCALE) ) {
ax = __SC(win.x)/fw; ax = SC(win.x)/fw;
ay = __SC(win.y)/fh; ay = SC(win.y)/fh;
} else { } else {
ax = win.x; ax = win.x;
ay = win.y; ay = win.y;
...@@ -1917,8 +1917,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win) ...@@ -1917,8 +1917,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win)
/* Adjust win.x, win.y */ /* Adjust win.x, win.y */
if ( (cam->largeview && !(cam->vpp_flag & VPP_UPSCALE)) if ( (cam->largeview && !(cam->vpp_flag & VPP_UPSCALE))
|| (cam->vpp_flag & VPP_UPSCALE) ) { || (cam->vpp_flag & VPP_UPSCALE) ) {
win.x = __UNSC(ax*fw); win.x = UNSC(ax*fw);
win.y = __UNSC(ay*fh); win.y = UNSC(ay*fh);
} else { } else {
win.x = ax; win.x = ax;
win.y = ay; win.y = ay;
......
...@@ -429,7 +429,7 @@ zr36057_set_vfe (struct zoran *zr, ...@@ -429,7 +429,7 @@ zr36057_set_vfe (struct zoran *zr,
reg |= (HorDcm << ZR36057_VFESPFR_HorDcm); reg |= (HorDcm << ZR36057_VFESPFR_HorDcm);
reg |= (VerDcm << ZR36057_VFESPFR_VerDcm); reg |= (VerDcm << ZR36057_VFESPFR_VerDcm);
reg |= (DispMode << ZR36057_VFESPFR_DispMode); reg |= (DispMode << ZR36057_VFESPFR_DispMode);
if (format->palette != VIDEO_PALETTE_YUV422) if (format->palette != VIDEO_PALETTE_YUV422 && format->palette != VIDEO_PALETTE_YUYV)
reg |= ZR36057_VFESPFR_LittleEndian; reg |= ZR36057_VFESPFR_LittleEndian;
/* RJ: I don't know, why the following has to be the opposite /* RJ: I don't know, why the following has to be the opposite
* of the corresponding ZR36060 setting, but only this way * of the corresponding ZR36060 setting, but only this way
...@@ -441,6 +441,7 @@ zr36057_set_vfe (struct zoran *zr, ...@@ -441,6 +441,7 @@ zr36057_set_vfe (struct zoran *zr,
reg |= ZR36057_VFESPFR_TopField; reg |= ZR36057_VFESPFR_TopField;
switch (format->palette) { switch (format->palette) {
case VIDEO_PALETTE_YUYV:
case VIDEO_PALETTE_YUV422: case VIDEO_PALETTE_YUV422:
reg |= ZR36057_VFESPFR_YUV422; reg |= ZR36057_VFESPFR_YUV422;
break; break;
......
...@@ -49,7 +49,7 @@ struct cx2341x_mpeg_params { ...@@ -49,7 +49,7 @@ struct cx2341x_mpeg_params {
enum v4l2_mpeg_audio_mode_extension audio_mode_extension; enum v4l2_mpeg_audio_mode_extension audio_mode_extension;
enum v4l2_mpeg_audio_emphasis audio_emphasis; enum v4l2_mpeg_audio_emphasis audio_emphasis;
enum v4l2_mpeg_audio_crc audio_crc; enum v4l2_mpeg_audio_crc audio_crc;
u8 audio_properties; u16 audio_properties;
/* video */ /* video */
enum v4l2_mpeg_video_encoding video_encoding; enum v4l2_mpeg_video_encoding video_encoding;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#define _IR_COMMON #define _IR_COMMON
#include <linux/input.h> #include <linux/input.h>
#include <linux/workqueue.h>
#define IR_TYPE_RC5 1 #define IR_TYPE_RC5 1
#define IR_TYPE_PD 2 /* Pulse distance encoded IR */ #define IR_TYPE_PD 2 /* Pulse distance encoded IR */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment