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 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/string.h>
#include <linux/jiffies.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 )
{ &utype, sizeof utype },
{ 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) {
/* Set D-bit for CRC32 verification,
* 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 )
*((u8 *)priv->ule_skb->tail - 2) << 8 |
*((u8 *)priv->ule_skb->tail - 1);
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);
#ifdef ULE_DEBUG
......
......@@ -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);
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 &&
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;
*state = REMOTE_KEY_PRESSED;
if (st->old_toggle == toggle) {
......
......@@ -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_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);
dib3000mc_write_word(state, 0, reg | (1 << 8));
......
......@@ -668,7 +668,7 @@ config VIDEO_M32R_AR_M64278
config VIDEO_CAFE_CCIC
tristate "Marvell 88ALP01 (Cafe) CMOS Camera Controller support"
depends on I2C && VIDEO_V4L2
depends on PCI && I2C && VIDEO_V4L2
select VIDEO_OV7670
---help---
This is a video4linux2 driver for the Marvell 88ALP01 integrated
......
......@@ -4050,8 +4050,8 @@ static int __devinit bttv_probe(struct pci_dev *dev,
(unsigned long long)pci_resource_start(dev,0));
schedule();
btv->bt848_mmio=ioremap(pci_resource_start(dev,0), 0x1000);
if (NULL == ioremap(pci_resource_start(dev,0), 0x1000)) {
btv->bt848_mmio = ioremap(pci_resource_start(dev, 0), 0x1000);
if (NULL == btv->bt848_mmio) {
printk("bttv%d: ioremap() failed\n", btv->c.nr);
result = -EIO;
goto fail1;
......
......@@ -2166,7 +2166,7 @@ static void cafe_pci_remove(struct pci_dev *pdev)
struct cafe_camera *cam = cafe_find_by_pdev(pdev);
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;
}
mutex_lock(&cam->s_mutex);
......
......@@ -640,6 +640,10 @@ static int submit_urbs(struct camera_data *cam)
cam->sbuf[i].data =
kmalloc(FRAMES_PER_DESC * FRAME_SIZE_PER_DESC, GFP_KERNEL);
if (!cam->sbuf[i].data) {
while (--i >= 0) {
kfree(cam->sbuf[i].data);
cam->sbuf[i].data = NULL;
}
return -ENOMEM;
}
}
......
......@@ -742,7 +742,6 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
if (old == NULL || old->width != new->width || old->height != new->height ||
old->video_encoding != new->video_encoding) {
int is_scaling;
u16 w = new->width;
u16 h = new->height;
......@@ -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);
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
filter is that it works well with full resolution capturing, but
not when the capture window is scaled (the filter introduces
a ghosting effect). So if the capture window changed, and there is
no updated filter value, then the filter is set depending on whether
the new window is full resolution or not.
a ghosting effect). So if the capture window is scaled, then
force the filter to 0.
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. */
is_scaling = new->width != 720 || new->height != (new->is_50hz ? 576 : 480);
if (old && old->video_temporal_filter == temporal) {
temporal = is_scaling ? 0 : 8;
}
temporal = 0;
}
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)
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 temporal = p->video_temporal_filter;
/* Stream */
printk(KERN_INFO "%s: Stream: %s\n",
......@@ -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_CHROMA_SPATIAL_FILTER_TYPE),
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",
prefix,
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",
prefix,
cx2341x_menu_item(p, V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE),
......
......@@ -128,7 +128,14 @@ void cx25840_vbi_setup(struct i2c_client *client)
uv_lpf=1;
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;
vblank656=24;
burst=0x61;
......
......@@ -1632,7 +1632,7 @@ const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
/* ----------------------------------------------------------------------- */
/* 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
* any others.
......
......@@ -633,12 +633,12 @@ int cx88_reset(struct cx88_core *core)
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)
{
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)
......@@ -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 const unsigned int ntsc = 28636360;
static const unsigned int pal = 35468950;
static const unsigned int palm = 28604892;
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
/* SECAM have also different sub carrier for chroma,
but step_db and step_dr, at cx88_set_tvnorm already handles that.
return (norm->id & V4L2_STD_625_50) ? pal : ntsc;
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)
{
/* Should always be Line Draw Time / (4*FSC) */
if (norm->id & V4L2_STD_PAL_M)
return 909;
unsigned int fsc4=norm_fsc8(norm)/2;
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)
......@@ -692,7 +701,7 @@ int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int heig
value &= 0x3fe;
cx_write(MO_HDELAY_EVEN, 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;
cx_write(MO_HSCALE_EVEN, value);
......
......@@ -91,7 +91,7 @@ struct cx88_tvnorm {
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,
if (dev->has_msp34xx) {
/* Send a reset to other chips via gpio */
em28xx_write_regs_req(dev, 0x00, 0x08, "\xf7", 1);
udelay(2500);
msleep(3);
em28xx_write_regs_req(dev, 0x00, 0x08, "\xff", 1);
udelay(2500);
msleep(3);
}
video_mux(dev, 0);
......
......@@ -923,7 +923,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
struct video_picture *p = arg;
if (p->depth != 16)
return -EINVAL;
if (p->palette != VIDEO_PALETTE_YUV422)
if (p->palette != VIDEO_PALETTE_YUV422 && p->palette != VIDEO_PALETTE_YUYV)
return -EINVAL;
mutex_lock(&meye.lock);
sonypi_camera_command(SONYPI_COMMAND_SETCAMERABRIGHTNESS,
......@@ -978,7 +978,7 @@ static int meye_do_ioctl(struct inode *inode, struct file *file,
if (vm->frame >= gbuffers || vm->frame < 0)
return -EINVAL;
if (vm->format != VIDEO_PALETTE_YUV422)
if (vm->format != VIDEO_PALETTE_YUV422 && vm->format != VIDEO_PALETTE_YUYV)
return -EINVAL;
if (vm->height * vm->width * 2 > gbufsize)
return -EINVAL;
......
......@@ -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)
extern_input = 0;
}
if (extern_input)
state->mode = MSP_MODE_EXTERN;
else
state->mode = MSP_MODE_AM_DETECT;
state->mode = extern_input ? MSP_MODE_EXTERN : MSP_MODE_AM_DETECT;
state->rxsubchans = V4L2_TUNER_SUB_STEREO;
msp_set_scart(client, sc_in, 0);
msp_set_scart(client, sc1_out, 1);
msp_set_scart(client, sc2_out, 2);
......@@ -951,7 +949,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
if (thread_func) {
state->kthread = kthread_run(thread_func, client, "msp34xx");
if (state->kthread == NULL)
if (IS_ERR(state->kthread))
v4l_warn(client, "kernel_thread() failed\n");
msp_wake_thread(client);
}
......
......@@ -483,7 +483,6 @@ int msp3400c_thread(void *data)
/* no carrier scan, just unmute */
v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n");
state->scan_in_progress = 0;
state->rxsubchans = V4L2_TUNER_SUB_STEREO;
msp_set_audio(client);
continue;
}
......@@ -851,12 +850,15 @@ static void msp34xxg_set_source(struct i2c_client *client, u16 reg, int in)
source = 1; /* stereo or A|B */
matrix = 0x20;
break;
case V4L2_TUNER_MODE_STEREO:
case V4L2_TUNER_MODE_LANG1:
default:
source = 3; /* stereo or A */
matrix = 0x00;
break;
case V4L2_TUNER_MODE_STEREO:
default:
source = 3; /* stereo or A */
matrix = 0x20;
break;
}
if (in == MSP_DSP_IN_TUNER)
......@@ -1030,6 +1032,9 @@ static int msp34xxg_detect_stereo(struct i2c_client *client)
int is_stereo = status & 0x40;
int oldrx = state->rxsubchans;
if (state->mode == MSP_MODE_EXTERN)
return 0;
state->rxsubchans = 0;
if (is_stereo)
state->rxsubchans = V4L2_TUNER_SUB_STEREO;
......
......@@ -50,9 +50,9 @@ static unsigned int antenna_pwr = 0;
module_param(antenna_pwr, int, 0444);
MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)");
static int use_frontent = 0;
module_param(use_frontent, int, 0644);
MODULE_PARM_DESC(use_frontent,"for cards with multiple frontends (0: terrestrial, 1: satellite)");
static int use_frontend = 0;
module_param(use_frontend, int, 0644);
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)
......@@ -1303,7 +1303,7 @@ static int dvb_init(struct saa7134_dev *dev)
}
break;
case SAA7134_BOARD_FLYDVB_TRIO:
if(! use_frontent) { //terrestrial
if(! use_frontend) { //terrestrial
dev->dvb.frontend = dvb_attach(tda10046_attach,
&lifeview_trio_config,
&dev->i2c_adap);
......
......@@ -267,6 +267,10 @@ static int tuner_fixup_std(struct tuner *t)
{
if ((t->std & V4L2_STD_PAL) == V4L2_STD_PAL) {
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 'g':
......
......@@ -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, 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"},
{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 */
};
......@@ -148,7 +148,6 @@ struct usb_device_id usbvision_table [] = {
{ 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, 0x0419) }, /* Pinnacle PCTV Bungee USB (PAL) FM */
{ USB_DEVICE(0x2400, 0x4200) }, /* Hauppauge WinTv-USB2 Model 42012 */
{ } /* Terminating entry */
......
......@@ -118,7 +118,7 @@ static int usbvision_measure_bandwidth (struct usb_usbvision *usbvision);
* 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;
unsigned long adr;
......@@ -181,7 +181,7 @@ static void usbvision_hexdump(const unsigned char *data, int len)
/********************************
* 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;
if (len < 0) {
......@@ -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 */
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;
if (free <= 0) {
......@@ -211,7 +211,8 @@ int scratch_free(struct usb_usbvision *usbvision)
/* 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;
......@@ -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 */
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);
......@@ -248,7 +249,8 @@ void scratch_mark_header(struct usb_usbvision *usbvision)
}
/* 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;
if (*ptr + len < scratch_buf_size) {
......@@ -274,7 +276,8 @@ int scratch_get_extra(struct usb_usbvision *usbvision, unsigned char *data, int
/* 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;
......@@ -283,7 +286,7 @@ void scratch_set_extra_ptr(struct usb_usbvision *usbvision, int *ptr, int len)
/*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;
......@@ -292,7 +295,8 @@ void scratch_inc_extra_ptr(int *ptr, int len)
/* 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;
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)
/* 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;
......@@ -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 */
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;
......@@ -356,7 +361,7 @@ void scratch_rm_old(struct usb_usbvision *usbvision, int len)
/*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");
......@@ -369,7 +374,7 @@ void scratch_reset(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);
if(usbvision->scratch == NULL) {
err("%s: unable to allocate %d bytes for scratch",
......@@ -399,8 +404,8 @@ void usbvision_scratch_free(struct usb_usbvision *usbvision)
* 1: Draw a colored grid
*
*/
void usbvision_testpattern(struct usb_usbvision *usbvision, int fullframe,
int pmode)
static void usbvision_testpattern(struct usb_usbvision *usbvision,
int fullframe, int pmode)
{
static const char proc[] = "usbvision_testpattern";
struct usbvision_frame *frame;
......@@ -480,7 +485,7 @@ void usbvision_testpattern(struct usb_usbvision *usbvision, int fullframe,
int usbvision_decompress_alloc(struct usb_usbvision *usbvision)
{
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) {
err("%s: unable to allocate %d for compr. frame buffer", __FUNCTION__, IFB_size);
return -ENOMEM;
......@@ -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_RES2);
usbvision_write_reg(usbvision, USBVISION_PWR_REG,
USBVISION_SSPND_EN | USBVISION_PWR_VID);
errCode = usbvision_write_reg(usbvision, USBVISION_PWR_REG,
......@@ -2305,7 +2311,7 @@ int usbvision_restart_isoc(struct usb_usbvision *usbvision)
usbvision->Vin_Reg2_Preset)) < 0) return ret;
/* 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;
}
......@@ -2346,40 +2352,6 @@ int usbvision_setup(struct usb_usbvision *usbvision,int format)
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()
*
......@@ -2388,6 +2360,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
{
struct usb_device *dev = usbvision->dev;
int bufIdx, errCode, regValue;
const int sb_size = USBVISION_URB_FRAMES * USBVISION_MAX_ISOC_PACKET_SIZE;
if (!USBVISION_IS_OPERATIONAL(usbvision))
return -EFAULT;
......@@ -2423,6 +2396,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
return -ENOMEM;
}
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->context = usbvision;
urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp);
......@@ -2464,6 +2438,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
void usbvision_stop_isoc(struct usb_usbvision *usbvision)
{
int bufIdx, errCode, regValue;
const int sb_size = USBVISION_URB_FRAMES * USBVISION_MAX_ISOC_PACKET_SIZE;
if ((usbvision->streaming == Stream_Off) || (usbvision->dev == NULL))
return;
......@@ -2471,6 +2446,12 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision)
/* Unschedule all of the iso td's */
for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) {
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);
usbvision->sbuf[bufIdx].urb = NULL;
}
......
......@@ -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,
unsigned char addr, int retries)
{
struct i2c_algo_usb_data *adap = i2c_adap->algo_data;
void *data;
int i, ret = -1;
char buf[4];
......@@ -69,10 +68,10 @@ static inline int try_write_address(struct i2c_adapter *i2c_adap,
ret = (usbvision_i2c_write(data, addr, buf, 1));
if (ret == 1)
break; /* success! */
udelay(5 /*adap->udelay */ );
udelay(5);
if (i == retries) /* no success */
break;
udelay(adap->udelay);
udelay(10);
}
if (i) {
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,
static inline int try_read_address(struct i2c_adapter *i2c_adap,
unsigned char addr, int retries)
{
struct i2c_algo_usb_data *adap = i2c_adap->algo_data;
void *data;
int i, ret = -1;
char buf[4];
......@@ -94,10 +92,10 @@ static inline int try_read_address(struct i2c_adapter *i2c_adap,
ret = (usbvision_i2c_read(data, addr, buf, 1));
if (ret == 1)
break; /* success! */
udelay(5 /*adap->udelay */ );
udelay(5);
if (i == retries) /* no success */
break;
udelay(adap->udelay);
udelay(10);
}
if (i) {
PDEBUG(DBG_ALGO,"Needed %d retries for address %#2x", i, addr);
......@@ -213,7 +211,7 @@ static struct i2c_algorithm i2c_usb_algo = {
/*
* 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_ALGO, "ALGO debugging is enabled [i2c]");
......@@ -248,15 +246,12 @@ int usbvision_i2c_usb_del_bus(struct i2c_adapter *adap)
/* usbvision specific I2C functions */
/* ----------------------------------------------------------------------- */
static struct i2c_adapter i2c_adap_template;
static struct i2c_algo_usb_data i2c_algo_template;
static struct i2c_client i2c_client_template;
int usbvision_init_i2c(struct usb_usbvision *usbvision)
{
memcpy(&usbvision->i2c_adap, &i2c_adap_template,
sizeof(struct i2c_adapter));
memcpy(&usbvision->i2c_algo, &i2c_algo_template,
sizeof(struct i2c_algo_usb_data));
memcpy(&usbvision->i2c_client, &i2c_client_template,
sizeof(struct i2c_client));
......@@ -266,9 +261,7 @@ int usbvision_init_i2c(struct usb_usbvision *usbvision)
i2c_set_adapdata(&usbvision->i2c_adap, 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;
if (usbvision_write_reg(usbvision, USBVISION_SER_MODE, USBVISION_IIC_LRNACK) < 0) {
......@@ -297,7 +290,6 @@ int usbvision_init_i2c(struct usb_usbvision *usbvision)
void call_i2c_clients(struct usb_usbvision *usbvision, unsigned int cmd,
void *arg)
{
BUG_ON(NULL == usbvision->i2c_adap.algo_data);
i2c_clients_command(&usbvision->i2c_adap, cmd, arg);
}
......@@ -327,6 +319,9 @@ static int attach_inform(struct i2c_client *client)
case 0x4a:
PDEBUG(DBG_I2C,"attach_inform: saa7113 detected.");
break;
case 0x48:
PDEBUG(DBG_I2C,"attach_inform: saa7111 detected.");
break;
case 0xa0:
PDEBUG(DBG_I2C,"attach_inform: eeprom detected.");
break;
......@@ -531,21 +526,10 @@ static int usbvision_i2c_read(void *data, unsigned char addr, char *buf,
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 = {
.owner = THIS_MODULE,
.name = "usbvision",
.id = I2C_HW_B_BT848, /* FIXME */
.algo = NULL,
.algo_data = NULL,
.client_register = attach_inform,
.client_unregister = detach_inform,
#ifdef I2C_ADAP_CLASS_TV_ANALOG
......@@ -559,9 +543,6 @@ static struct i2c_client i2c_client_template = {
.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.
* ---------------------------------------------------------------------------
......
......@@ -219,18 +219,6 @@ enum {
((udevice)->last_error == 0) && \
(!(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
/* ----------------------------------------------------------------- */
......@@ -383,7 +371,6 @@ struct usb_usbvision {
/* i2c Declaration Section*/
struct i2c_adapter i2c_adap;
struct i2c_algo_usb_data i2c_algo;
struct i2c_client i2c_client;
struct urb *ctrlUrb;
......@@ -489,19 +476,8 @@ struct usb_usbvision {
/* i2c-algo-usb declaration */
/* --------------------------------------------------------------- */
int usbvision_i2c_usb_add_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 */
......@@ -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);
/* defined in usbvision-core.c */
void *usbvision_rvmalloc(unsigned long size);
void usbvision_rvfree(void *mem, unsigned long size);
int usbvision_read_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);
void usbvision_frames_free(struct usb_usbvision *usbvision);
int usbvision_scratch_alloc(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);
void usbvision_decompress_free(struct usb_usbvision *usbvision);
......
......@@ -535,9 +535,9 @@ static int vivi_start_thread(struct vivi_dmaqueue *dma_q)
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");
return -EINVAL;
return PTR_ERR(dma_q->kthread);
}
dprintk(1,"returning from %s\n",__FUNCTION__);
return 0;
......@@ -1363,7 +1363,9 @@ static void __exit vivi_exit(void)
struct vivi_dev *h;
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);
kfree (h);
}
......
......@@ -789,7 +789,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file,
case VIDIOCSPICT:
{
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;
cam->brightness = vpic->brightness >> 8;
......
......@@ -1827,8 +1827,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win)
int err = 0;
/* Work around to avoid FP arithmetics */
#define __SC(x) ((x) << 10)
#define __UNSC(x) ((x) >> 10)
#define SC(x) ((x) << 10)
#define UNSC(x) ((x) >> 10)
/* Make sure we are using a supported resolution */
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)
goto error;
/* Scaling factors */
fw = __SC(win.width) / cam->maxwidth;
fh = __SC(win.height) / cam->maxheight;
fw = SC(win.width) / cam->maxwidth;
fh = SC(win.height) / cam->maxheight;
/* Set up the width and height values used by the chip */
if ((win.width > cam->maxwidth) || (win.height > cam->maxheight)) {
cam->vpp_flag |= VPP_UPSCALE;
/* Calculate largest w,h mantaining the same w/h ratio */
w = (fw >= fh) ? cam->maxwidth : __SC(win.width)/fh;
h = (fw >= fh) ? __SC(win.height)/fw : cam->maxheight;
w = (fw >= fh) ? cam->maxwidth : SC(win.width)/fh;
h = (fw >= fh) ? SC(win.height)/fw : cam->maxheight;
if (w < cam->minwidth) /* just in case */
w = cam->minwidth;
if (h < cam->minheight) /* just in case */
......@@ -1861,8 +1861,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win)
/* Calculate cropped area manteining the right w/h ratio */
if (cam->largeview && !(cam->vpp_flag & VPP_UPSCALE)) {
cw = (fw >= fh) ? cam->maxwidth : __SC(win.width)/fh;
ch = (fw >= fh) ? __SC(win.height)/fw : cam->maxheight;
cw = (fw >= fh) ? cam->maxwidth : SC(win.width)/fh;
ch = (fw >= fh) ? SC(win.height)/fw : cam->maxheight;
} else {
cw = w;
ch = h;
......@@ -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 */
if ( (cam->largeview && !(cam->vpp_flag & VPP_UPSCALE))
|| (cam->vpp_flag & VPP_UPSCALE) ) {
ax = __SC(win.x)/fw;
ay = __SC(win.y)/fh;
ax = SC(win.x)/fw;
ay = SC(win.y)/fh;
} else {
ax = win.x;
ay = win.y;
......@@ -1917,8 +1917,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win)
/* Adjust win.x, win.y */
if ( (cam->largeview && !(cam->vpp_flag & VPP_UPSCALE))
|| (cam->vpp_flag & VPP_UPSCALE) ) {
win.x = __UNSC(ax*fw);
win.y = __UNSC(ay*fh);
win.x = UNSC(ax*fw);
win.y = UNSC(ay*fh);
} else {
win.x = ax;
win.y = ay;
......
......@@ -429,7 +429,7 @@ zr36057_set_vfe (struct zoran *zr,
reg |= (HorDcm << ZR36057_VFESPFR_HorDcm);
reg |= (VerDcm << ZR36057_VFESPFR_VerDcm);
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;
/* RJ: I don't know, why the following has to be the opposite
* of the corresponding ZR36060 setting, but only this way
......@@ -441,6 +441,7 @@ zr36057_set_vfe (struct zoran *zr,
reg |= ZR36057_VFESPFR_TopField;
switch (format->palette) {
case VIDEO_PALETTE_YUYV:
case VIDEO_PALETTE_YUV422:
reg |= ZR36057_VFESPFR_YUV422;
break;
......
......@@ -49,7 +49,7 @@ struct cx2341x_mpeg_params {
enum v4l2_mpeg_audio_mode_extension audio_mode_extension;
enum v4l2_mpeg_audio_emphasis audio_emphasis;
enum v4l2_mpeg_audio_crc audio_crc;
u8 audio_properties;
u16 audio_properties;
/* video */
enum v4l2_mpeg_video_encoding video_encoding;
......
......@@ -24,6 +24,7 @@
#define _IR_COMMON
#include <linux/input.h>
#include <linux/workqueue.h>
#define IR_TYPE_RC5 1
#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