Commit bb4afaab authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] zoran: more cleanups

From: Ronald Bultje <rbultje@ronald.bitfreak.net>

This patch adds some newlines between variable declarations and function
bodies. This was done on request by Francois Romieu.
parent d9a800f7
...@@ -104,6 +104,7 @@ adv7170_write (struct i2c_client *client, ...@@ -104,6 +104,7 @@ adv7170_write (struct i2c_client *client,
u8 value) u8 value)
{ {
struct adv7170 *encoder = i2c_get_clientdata(client); struct adv7170 *encoder = i2c_get_clientdata(client);
encoder->reg[reg] = value; encoder->reg[reg] = value;
return i2c_smbus_write_byte_data(client, reg, value); return i2c_smbus_write_byte_data(client, reg, value);
} }
...@@ -130,6 +131,7 @@ adv7170_write_block (struct i2c_client *client, ...@@ -130,6 +131,7 @@ adv7170_write_block (struct i2c_client *client,
struct adv7170 *encoder = i2c_get_clientdata(client); struct adv7170 *encoder = i2c_get_clientdata(client);
struct i2c_msg msg; struct i2c_msg msg;
u8 block_data[32]; u8 block_data[32];
msg.addr = client->addr; msg.addr = client->addr;
msg.flags = client->flags; msg.flags = client->flags;
while (len >= 2) { while (len >= 2) {
...@@ -143,16 +145,16 @@ adv7170_write_block (struct i2c_client *client, ...@@ -143,16 +145,16 @@ adv7170_write_block (struct i2c_client *client,
data += 2; data += 2;
} while (len >= 2 && data[0] == reg && } while (len >= 2 && data[0] == reg &&
msg.len < 32); msg.len < 32);
if ((ret = if ((ret = i2c_transfer(client->adapter,
i2c_transfer(client->adapter, &msg, 1)) < 0) &msg, 1)) < 0)
break; break;
} }
} else { } else {
/* do some slow I2C emulation kind of thing */ /* do some slow I2C emulation kind of thing */
while (len >= 2) { while (len >= 2) {
reg = *data++; reg = *data++;
if ((ret = if ((ret = adv7170_write(client, reg,
adv7170_write(client, reg, *data++)) < 0) *data++)) < 0)
break; break;
len -= 2; len -= 2;
} }
......
...@@ -100,6 +100,7 @@ adv7175_write (struct i2c_client *client, ...@@ -100,6 +100,7 @@ adv7175_write (struct i2c_client *client,
u8 value) u8 value)
{ {
struct adv7175 *encoder = i2c_get_clientdata(client); struct adv7175 *encoder = i2c_get_clientdata(client);
encoder->reg[reg] = value; encoder->reg[reg] = value;
return i2c_smbus_write_byte_data(client, reg, value); return i2c_smbus_write_byte_data(client, reg, value);
} }
...@@ -126,6 +127,7 @@ adv7175_write_block (struct i2c_client *client, ...@@ -126,6 +127,7 @@ adv7175_write_block (struct i2c_client *client,
struct adv7175 *encoder = i2c_get_clientdata(client); struct adv7175 *encoder = i2c_get_clientdata(client);
struct i2c_msg msg; struct i2c_msg msg;
u8 block_data[32]; u8 block_data[32];
msg.addr = client->addr; msg.addr = client->addr;
msg.flags = client->flags; msg.flags = client->flags;
while (len >= 2) { while (len >= 2) {
...@@ -139,16 +141,16 @@ adv7175_write_block (struct i2c_client *client, ...@@ -139,16 +141,16 @@ adv7175_write_block (struct i2c_client *client,
data += 2; data += 2;
} while (len >= 2 && data[0] == reg && } while (len >= 2 && data[0] == reg &&
msg.len < 32); msg.len < 32);
if ((ret = if ((ret = i2c_transfer(client->adapter,
i2c_transfer(client->adapter, &msg, 1)) < 0) &msg, 1)) < 0)
break; break;
} }
} else { } else {
/* do some slow I2C emulation kind of thing */ /* do some slow I2C emulation kind of thing */
while (len >= 2) { while (len >= 2) {
reg = *data++; reg = *data++;
if ((ret = if ((ret = adv7175_write(client, reg,
adv7175_write(client, reg, *data++)) < 0) *data++)) < 0)
break; break;
len -= 2; len -= 2;
} }
...@@ -163,6 +165,7 @@ dump (struct i2c_client *client) ...@@ -163,6 +165,7 @@ dump (struct i2c_client *client)
{ {
struct adv7175 *encoder = i2c_get_clientdata(client); struct adv7175 *encoder = i2c_get_clientdata(client);
int i, j; int i, j;
printk(KERN_INFO "%s: registry dump\n", I2C_NAME(client)); printk(KERN_INFO "%s: registry dump\n", I2C_NAME(client));
for (i = 0; i < 182 / 8; i++) { for (i = 0; i < 182 / 8; i++) {
printk("%s: 0x%02x -", I2C_NAME(client), i * 8); printk("%s: 0x%02x -", I2C_NAME(client), i * 8);
......
...@@ -113,6 +113,7 @@ bt819_write (struct i2c_client *client, ...@@ -113,6 +113,7 @@ bt819_write (struct i2c_client *client,
u8 value) u8 value)
{ {
struct bt819 *decoder = i2c_get_clientdata(client); struct bt819 *decoder = i2c_get_clientdata(client);
decoder->reg[reg] = value; decoder->reg[reg] = value;
return i2c_smbus_write_byte_data(client, reg, value); return i2c_smbus_write_byte_data(client, reg, value);
} }
...@@ -124,6 +125,7 @@ bt819_setbit (struct i2c_client *client, ...@@ -124,6 +125,7 @@ bt819_setbit (struct i2c_client *client,
u8 value) u8 value)
{ {
struct bt819 *decoder = i2c_get_clientdata(client); struct bt819 *decoder = i2c_get_clientdata(client);
return bt819_write(client, reg, return bt819_write(client, reg,
(decoder-> (decoder->
reg[reg] & ~(1 << bit)) | reg[reg] & ~(1 << bit)) |
...@@ -145,6 +147,7 @@ bt819_write_block (struct i2c_client *client, ...@@ -145,6 +147,7 @@ bt819_write_block (struct i2c_client *client,
struct bt819 *decoder = i2c_get_clientdata(client); struct bt819 *decoder = i2c_get_clientdata(client);
struct i2c_msg msg; struct i2c_msg msg;
u8 block_data[32]; u8 block_data[32];
msg.addr = client->addr; msg.addr = client->addr;
msg.flags = client->flags; msg.flags = client->flags;
while (len >= 2) { while (len >= 2) {
...@@ -158,8 +161,8 @@ bt819_write_block (struct i2c_client *client, ...@@ -158,8 +161,8 @@ bt819_write_block (struct i2c_client *client,
data += 2; data += 2;
} while (len >= 2 && data[0] == reg && } while (len >= 2 && data[0] == reg &&
msg.len < 32); msg.len < 32);
if ((ret = if ((ret = i2c_transfer(client->adapter,
i2c_transfer(client->adapter, &msg, 1)) < 0) &msg, 1)) < 0)
break; break;
} }
} else { } else {
......
...@@ -98,6 +98,7 @@ bt856_write (struct i2c_client *client, ...@@ -98,6 +98,7 @@ bt856_write (struct i2c_client *client,
u8 value) u8 value)
{ {
struct bt856 *encoder = i2c_get_clientdata(client); struct bt856 *encoder = i2c_get_clientdata(client);
encoder->reg[reg - REG_OFFSET] = value; encoder->reg[reg - REG_OFFSET] = value;
return i2c_smbus_write_byte_data(client, reg, value); return i2c_smbus_write_byte_data(client, reg, value);
} }
...@@ -109,6 +110,7 @@ bt856_setbit (struct i2c_client *client, ...@@ -109,6 +110,7 @@ bt856_setbit (struct i2c_client *client,
u8 value) u8 value)
{ {
struct bt856 *encoder = i2c_get_clientdata(client); struct bt856 *encoder = i2c_get_clientdata(client);
return bt856_write(client, reg, return bt856_write(client, reg,
(encoder-> (encoder->
reg[reg - REG_OFFSET] & ~(1 << bit)) | reg[reg - REG_OFFSET] & ~(1 << bit)) |
...@@ -120,6 +122,7 @@ bt856_dump (struct i2c_client *client) ...@@ -120,6 +122,7 @@ bt856_dump (struct i2c_client *client)
{ {
int i; int i;
struct bt856 *encoder = i2c_get_clientdata(client); struct bt856 *encoder = i2c_get_clientdata(client);
printk(KERN_INFO "%s: register dump:", I2C_NAME(client)); printk(KERN_INFO "%s: register dump:", I2C_NAME(client));
for (i = 0xd6; i <= 0xde; i += 2) for (i = 0xd6; i <= 0xde; i += 2)
printk(" %02x", encoder->reg[i - REG_OFFSET]); printk(" %02x", encoder->reg[i - REG_OFFSET]);
......
...@@ -86,6 +86,7 @@ saa7110_write (struct i2c_client *client, ...@@ -86,6 +86,7 @@ saa7110_write (struct i2c_client *client,
u8 value) u8 value)
{ {
struct saa7110 *decoder = i2c_get_clientdata(client); struct saa7110 *decoder = i2c_get_clientdata(client);
decoder->reg[reg] = value; decoder->reg[reg] = value;
return i2c_smbus_write_byte_data(client, reg, value); return i2c_smbus_write_byte_data(client, reg, value);
} }
...@@ -97,6 +98,7 @@ saa7110_write_block (struct i2c_client *client, ...@@ -97,6 +98,7 @@ saa7110_write_block (struct i2c_client *client,
{ {
int ret = -1; int ret = -1;
u8 reg = *data++; u8 reg = *data++;
len--; len--;
/* the saa7110 has an autoincrement function, use it if /* the saa7110 has an autoincrement function, use it if
...@@ -105,6 +107,7 @@ saa7110_write_block (struct i2c_client *client, ...@@ -105,6 +107,7 @@ saa7110_write_block (struct i2c_client *client,
struct saa7110 *decoder = i2c_get_clientdata(client); struct saa7110 *decoder = i2c_get_clientdata(client);
struct i2c_msg msg; struct i2c_msg msg;
u8 block_data[54]; u8 block_data[54];
msg.len = 0; msg.len = 0;
msg.buf = (char *) block_data; msg.buf = (char *) block_data;
msg.addr = client->addr; msg.addr = client->addr;
...@@ -119,8 +122,8 @@ saa7110_write_block (struct i2c_client *client, ...@@ -119,8 +122,8 @@ saa7110_write_block (struct i2c_client *client,
} }
} else { } else {
while (len-- >= 1) { while (len-- >= 1) {
if ((ret = if ((ret = saa7110_write(client, reg++,
saa7110_write(client, reg++, *data++)) < 0) *data++)) < 0)
break; break;
} }
} }
...@@ -279,6 +282,7 @@ saa7110_command (struct i2c_client *client, ...@@ -279,6 +282,7 @@ saa7110_command (struct i2c_client *client,
case DECODER_GET_CAPABILITIES: case DECODER_GET_CAPABILITIES:
{ {
struct video_decoder_capability *dc = arg; struct video_decoder_capability *dc = arg;
dc->flags = dc->flags =
VIDEO_DECODER_PAL | VIDEO_DECODER_NTSC | VIDEO_DECODER_PAL | VIDEO_DECODER_NTSC |
VIDEO_DECODER_SECAM | VIDEO_DECODER_AUTO; VIDEO_DECODER_SECAM | VIDEO_DECODER_AUTO;
......
...@@ -93,6 +93,7 @@ saa7111_write (struct i2c_client *client, ...@@ -93,6 +93,7 @@ saa7111_write (struct i2c_client *client,
u8 value) u8 value)
{ {
struct saa7111 *decoder = i2c_get_clientdata(client); struct saa7111 *decoder = i2c_get_clientdata(client);
decoder->reg[reg] = value; decoder->reg[reg] = value;
return i2c_smbus_write_byte_data(client, reg, value); return i2c_smbus_write_byte_data(client, reg, value);
} }
...@@ -112,6 +113,7 @@ saa7111_write_block (struct i2c_client *client, ...@@ -112,6 +113,7 @@ saa7111_write_block (struct i2c_client *client,
struct saa7111 *decoder = i2c_get_clientdata(client); struct saa7111 *decoder = i2c_get_clientdata(client);
struct i2c_msg msg; struct i2c_msg msg;
u8 block_data[32]; u8 block_data[32];
msg.addr = client->addr; msg.addr = client->addr;
msg.flags = client->flags; msg.flags = client->flags;
while (len >= 2) { while (len >= 2) {
...@@ -125,16 +127,16 @@ saa7111_write_block (struct i2c_client *client, ...@@ -125,16 +127,16 @@ saa7111_write_block (struct i2c_client *client,
data += 2; data += 2;
} while (len >= 2 && data[0] == reg && } while (len >= 2 && data[0] == reg &&
msg.len < 32); msg.len < 32);
if ((ret = if ((ret = i2c_transfer(client->adapter,
i2c_transfer(client->adapter, &msg, 1)) < 0) &msg, 1)) < 0)
break; break;
} }
} else { } else {
/* do some slow I2C emulation kind of thing */ /* do some slow I2C emulation kind of thing */
while (len >= 2) { while (len >= 2) {
reg = *data++; reg = *data++;
if ((ret = if ((ret = saa7111_write(client, reg,
saa7111_write(client, reg, *data++)) < 0) *data++)) < 0)
break; break;
len -= 2; len -= 2;
} }
......
...@@ -144,6 +144,7 @@ saa7114_write (struct i2c_client *client, ...@@ -144,6 +144,7 @@ saa7114_write (struct i2c_client *client,
u8 value) u8 value)
{ {
/*struct saa7114 *decoder = i2c_get_clientdata(client);*/ /*struct saa7114 *decoder = i2c_get_clientdata(client);*/
/*decoder->reg[reg] = value;*/ /*decoder->reg[reg] = value;*/
return i2c_smbus_write_byte_data(client, reg, value); return i2c_smbus_write_byte_data(client, reg, value);
} }
...@@ -163,6 +164,7 @@ saa7114_write_block (struct i2c_client *client, ...@@ -163,6 +164,7 @@ saa7114_write_block (struct i2c_client *client,
/*struct saa7114 *decoder = i2c_get_clientdata(client);*/ /*struct saa7114 *decoder = i2c_get_clientdata(client);*/
struct i2c_msg msg; struct i2c_msg msg;
u8 block_data[32]; u8 block_data[32];
msg.addr = client->addr; msg.addr = client->addr;
msg.flags = client->flags; msg.flags = client->flags;
while (len >= 2) { while (len >= 2) {
...@@ -176,16 +178,16 @@ saa7114_write_block (struct i2c_client *client, ...@@ -176,16 +178,16 @@ saa7114_write_block (struct i2c_client *client,
data += 2; data += 2;
} while (len >= 2 && data[0] == reg && } while (len >= 2 && data[0] == reg &&
msg.len < 32); msg.len < 32);
if ((ret = if ((ret = i2c_transfer(client->adapter,
i2c_transfer(client->adapter, &msg, 1)) < 0) &msg, 1)) < 0)
break; break;
} }
} else { } else {
/* do some slow I2C emulation kind of thing */ /* do some slow I2C emulation kind of thing */
while (len >= 2) { while (len >= 2) {
reg = *data++; reg = *data++;
if ((ret = if ((ret = saa7114_write(client, reg,
saa7114_write(client, reg, *data++)) < 0) *data++)) < 0)
break; break;
len -= 2; len -= 2;
} }
......
...@@ -98,6 +98,7 @@ saa7185_write (struct i2c_client *client, ...@@ -98,6 +98,7 @@ saa7185_write (struct i2c_client *client,
u8 value) u8 value)
{ {
struct saa7185 *encoder = i2c_get_clientdata(client); struct saa7185 *encoder = i2c_get_clientdata(client);
dprintk(1, KERN_DEBUG "SAA7185: %02x set to %02x\n", reg, value); dprintk(1, KERN_DEBUG "SAA7185: %02x set to %02x\n", reg, value);
encoder->reg[reg] = value; encoder->reg[reg] = value;
return i2c_smbus_write_byte_data(client, reg, value); return i2c_smbus_write_byte_data(client, reg, value);
...@@ -118,6 +119,7 @@ saa7185_write_block (struct i2c_client *client, ...@@ -118,6 +119,7 @@ saa7185_write_block (struct i2c_client *client,
struct saa7185 *encoder = i2c_get_clientdata(client); struct saa7185 *encoder = i2c_get_clientdata(client);
struct i2c_msg msg; struct i2c_msg msg;
u8 block_data[32]; u8 block_data[32];
msg.addr = client->addr; msg.addr = client->addr;
msg.flags = client->flags; msg.flags = client->flags;
while (len >= 2) { while (len >= 2) {
...@@ -131,16 +133,16 @@ saa7185_write_block (struct i2c_client *client, ...@@ -131,16 +133,16 @@ saa7185_write_block (struct i2c_client *client,
data += 2; data += 2;
} while (len >= 2 && data[0] == reg && } while (len >= 2 && data[0] == reg &&
msg.len < 32); msg.len < 32);
if ((ret = if ((ret = i2c_transfer(client->adapter,
i2c_transfer(client->adapter, &msg, 1)) < 0) &msg, 1)) < 0)
break; break;
} }
} else { } else {
/* do some slow I2C emulation kind of thing */ /* do some slow I2C emulation kind of thing */
while (len >= 2) { while (len >= 2) {
reg = *data++; reg = *data++;
if ((ret = if ((ret = saa7185_write(client, reg,
saa7185_write(client, reg, *data++)) < 0) *data++)) < 0)
break; break;
len -= 2; len -= 2;
} }
......
...@@ -76,6 +76,7 @@ vpx3220_write (struct i2c_client *client, ...@@ -76,6 +76,7 @@ vpx3220_write (struct i2c_client *client,
u8 value) u8 value)
{ {
struct vpx3220 *decoder = i2c_get_clientdata(client); struct vpx3220 *decoder = i2c_get_clientdata(client);
decoder->reg[reg] = value; decoder->reg[reg] = value;
return i2c_smbus_write_byte_data(client, reg, value); return i2c_smbus_write_byte_data(client, reg, value);
} }
...@@ -294,6 +295,7 @@ vpx3220_dump_i2c (struct i2c_client *client) ...@@ -294,6 +295,7 @@ vpx3220_dump_i2c (struct i2c_client *client)
{ {
int len = sizeof(init_common); int len = sizeof(init_common);
const unsigned char *data = init_common; const unsigned char *data = init_common;
while (len > 1) { while (len > 1) {
dprintk(1, dprintk(1,
KERN_DEBUG "vpx3216b i2c reg 0x%02x data 0x%02x\n", KERN_DEBUG "vpx3216b i2c reg 0x%02x data 0x%02x\n",
......
...@@ -624,6 +624,7 @@ static int ...@@ -624,6 +624,7 @@ static int
zoran_i2c_getsda (void *data) zoran_i2c_getsda (void *data)
{ {
struct zoran *zr = (struct zoran *) data; struct zoran *zr = (struct zoran *) data;
return (btread(ZR36057_I2CBR) >> 1) & 1; return (btread(ZR36057_I2CBR) >> 1) & 1;
} }
...@@ -631,6 +632,7 @@ static int ...@@ -631,6 +632,7 @@ static int
zoran_i2c_getscl (void *data) zoran_i2c_getscl (void *data)
{ {
struct zoran *zr = (struct zoran *) data; struct zoran *zr = (struct zoran *) data;
return btread(ZR36057_I2CBR) & 1; return btread(ZR36057_I2CBR) & 1;
} }
...@@ -639,6 +641,7 @@ zoran_i2c_setsda (void *data, ...@@ -639,6 +641,7 @@ zoran_i2c_setsda (void *data,
int state) int state)
{ {
struct zoran *zr = (struct zoran *) data; struct zoran *zr = (struct zoran *) data;
if (state) if (state)
zr->i2cbr |= 2; zr->i2cbr |= 2;
else else
...@@ -651,6 +654,7 @@ zoran_i2c_setscl (void *data, ...@@ -651,6 +654,7 @@ zoran_i2c_setscl (void *data,
int state) int state)
{ {
struct zoran *zr = (struct zoran *) data; struct zoran *zr = (struct zoran *) data;
if (state) if (state)
zr->i2cbr |= 1; zr->i2cbr |= 1;
else else
...@@ -767,6 +771,7 @@ zoran_check_jpg_settings (struct zoran *zr, ...@@ -767,6 +771,7 @@ zoran_check_jpg_settings (struct zoran *zr,
struct zoran_jpg_settings *settings) struct zoran_jpg_settings *settings)
{ {
int err = 0, err0 = 0; int err = 0, err0 = 0;
dprintk(4, dprintk(4,
KERN_DEBUG KERN_DEBUG
"%s: check_jpg_settings() - dec: %d, Hdcm: %d, Vdcm: %d, Tdcm: %d\n", "%s: check_jpg_settings() - dec: %d, Hdcm: %d, Vdcm: %d, Tdcm: %d\n",
...@@ -1223,6 +1228,7 @@ find_zr36057 (void) ...@@ -1223,6 +1228,7 @@ find_zr36057 (void)
} else { } else {
int i; int i;
unsigned short ss_vendor, ss_device; unsigned short ss_vendor, ss_device;
ss_vendor = zr->pci_dev->subsystem_vendor; ss_vendor = zr->pci_dev->subsystem_vendor;
ss_device = zr->pci_dev->subsystem_device; ss_device = zr->pci_dev->subsystem_device;
dprintk(1, dprintk(1,
...@@ -1483,6 +1489,7 @@ static int __init ...@@ -1483,6 +1489,7 @@ static int __init
init_dc10_cards (void) init_dc10_cards (void)
{ {
int i; int i;
memset(zoran, 0, sizeof(zoran)); memset(zoran, 0, sizeof(zoran));
printk(KERN_INFO "Zoran MJPEG board driver version %d.%d.%d\n", printk(KERN_INFO "Zoran MJPEG board driver version %d.%d.%d\n",
MAJOR_VERSION, MINOR_VERSION, RELEASE_VERSION); MAJOR_VERSION, MINOR_VERSION, RELEASE_VERSION);
...@@ -1539,6 +1546,7 @@ init_dc10_cards (void) ...@@ -1539,6 +1546,7 @@ init_dc10_cards (void)
/* take care of Natoma chipset and a revision 1 zr36057 */ /* take care of Natoma chipset and a revision 1 zr36057 */
for (i = 0; i < zoran_num; i++) { for (i = 0; i < zoran_num; i++) {
struct zoran *zr = &zoran[i]; struct zoran *zr = &zoran[i];
if (pci_pci_problems & PCIPCI_NATOMA && zr->revision <= 1) { if (pci_pci_problems & PCIPCI_NATOMA && zr->revision <= 1) {
zr->jpg_buffers.need_contiguous = 1; zr->jpg_buffers.need_contiguous = 1;
dprintk(1, dprintk(1,
...@@ -1562,6 +1570,7 @@ static void __exit ...@@ -1562,6 +1570,7 @@ static void __exit
unload_dc10_cards (void) unload_dc10_cards (void)
{ {
int i; int i;
for (i = 0; i < zoran_num; i++) for (i = 0; i < zoran_num; i++)
zoran_release(&zoran[i]); zoran_release(&zoran[i]);
} }
......
...@@ -190,6 +190,7 @@ static inline unsigned long ...@@ -190,6 +190,7 @@ static inline unsigned long
get_time (void) get_time (void)
{ {
struct timeval tv; struct timeval tv;
do_gettimeofday(&tv); do_gettimeofday(&tv);
return (1000000 * tv.tv_sec + tv.tv_usec); return (1000000 * tv.tv_sec + tv.tv_usec);
} }
...@@ -868,8 +869,8 @@ zr36057_set_jpg (struct zoran *zr, ...@@ -868,8 +869,8 @@ zr36057_set_jpg (struct zoran *zr,
void void
print_interrupts (struct zoran *zr) print_interrupts (struct zoran *zr)
{ {
int res, noerr; int res, noerr = 0;
noerr = 0;
printk(KERN_INFO "%s: interrupts received:", ZR_DEVNAME(zr)); printk(KERN_INFO "%s: interrupts received:", ZR_DEVNAME(zr));
if ((res = zr->field_counter) < -1 || res > 1) { if ((res = zr->field_counter) < -1 || res > 1) {
printk(" FD:%d", res); printk(" FD:%d", res);
...@@ -931,6 +932,7 @@ static u32 ...@@ -931,6 +932,7 @@ static u32
count_reset_interrupt (struct zoran *zr) count_reset_interrupt (struct zoran *zr)
{ {
u32 isr; u32 isr;
if ((isr = btread(ZR36057_ISR) & 0x78000000)) { if ((isr = btread(ZR36057_ISR) & 0x78000000)) {
if (isr & ZR36057_ISR_GIRQ1) { if (isr & ZR36057_ISR_GIRQ1) {
btwrite(ZR36057_ISR_GIRQ1, ZR36057_ISR); btwrite(ZR36057_ISR_GIRQ1, ZR36057_ISR);
...@@ -961,6 +963,7 @@ void ...@@ -961,6 +963,7 @@ void
jpeg_start (struct zoran *zr) jpeg_start (struct zoran *zr)
{ {
int reg; int reg;
zr->frame_num = 0; zr->frame_num = 0;
/* deassert P_reset, disable code transfer, deassert Active */ /* deassert P_reset, disable code transfer, deassert Active */
...@@ -1625,10 +1628,11 @@ void ...@@ -1625,10 +1628,11 @@ void
zoran_set_pci_master (struct zoran *zr, zoran_set_pci_master (struct zoran *zr,
int set_master) int set_master)
{ {
u16 command;
if (set_master) { if (set_master) {
pci_set_master(zr->pci_dev); pci_set_master(zr->pci_dev);
} else { } else {
u16 command;
pci_read_config_word(zr->pci_dev, PCI_COMMAND, &command); pci_read_config_word(zr->pci_dev, PCI_COMMAND, &command);
command &= ~PCI_COMMAND_MASTER; command &= ~PCI_COMMAND_MASTER;
pci_write_config_word(zr->pci_dev, PCI_COMMAND, command); pci_write_config_word(zr->pci_dev, PCI_COMMAND, command);
...@@ -1639,6 +1643,7 @@ void ...@@ -1639,6 +1643,7 @@ void
zoran_init_hardware (struct zoran *zr) zoran_init_hardware (struct zoran *zr)
{ {
int j, zero = 0; int j, zero = 0;
/* Enable bus-mastering */ /* Enable bus-mastering */
zoran_set_pci_master(zr, 1); zoran_set_pci_master(zr, 1);
...@@ -1700,6 +1705,7 @@ void ...@@ -1700,6 +1705,7 @@ void
zr36057_init_vfe (struct zoran *zr) zr36057_init_vfe (struct zoran *zr)
{ {
u32 reg; u32 reg;
reg = btread(ZR36057_VFESPFR); reg = btread(ZR36057_VFESPFR);
reg |= ZR36057_VFESPFR_LittleEndian; reg |= ZR36057_VFESPFR_LittleEndian;
reg &= ~ZR36057_VFESPFR_VCLKPol; reg &= ~ZR36057_VFESPFR_VCLKPol;
...@@ -1730,6 +1736,7 @@ decoder_command (struct zoran *zr, ...@@ -1730,6 +1736,7 @@ decoder_command (struct zoran *zr,
if (zr->card.type == LML33 && if (zr->card.type == LML33 &&
(cmd == DECODER_SET_NORM || DECODER_SET_INPUT)) { (cmd == DECODER_SET_NORM || DECODER_SET_INPUT)) {
int res; int res;
// Bt819 needs to reset its FIFO buffer using #FRST pin and // Bt819 needs to reset its FIFO buffer using #FRST pin and
// LML33 card uses GPIO(7) for that. // LML33 card uses GPIO(7) for that.
GPIO(zr, 7, 0); GPIO(zr, 7, 0);
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/vmalloc.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/i2c.h> #include <linux/i2c.h>
...@@ -370,6 +371,7 @@ v4l_fbuffer_alloc (struct file *file) ...@@ -370,6 +371,7 @@ v4l_fbuffer_alloc (struct file *file)
int n = int n =
(fh->v4l_buffers.buffer_size + PAGE_SIZE - (fh->v4l_buffers.buffer_size + PAGE_SIZE -
1) / PAGE_SIZE; 1) / PAGE_SIZE;
mem = mem =
(unsigned char *) bigphysarea_alloc_pages(n, 0, (unsigned char *) bigphysarea_alloc_pages(n, 0,
GFP_KERNEL); GFP_KERNEL);
...@@ -412,6 +414,7 @@ v4l_fbuffer_alloc (struct file *file) ...@@ -412,6 +414,7 @@ v4l_fbuffer_alloc (struct file *file)
int size = int size =
fh->v4l_buffers.num_buffers * fh->v4l_buffers.num_buffers *
fh->v4l_buffers.buffer_size; fh->v4l_buffers.buffer_size;
pmem = get_high_mem(size); pmem = get_high_mem(size);
if (pmem == 0) { if (pmem == 0) {
dprintk(1, dprintk(1,
...@@ -847,9 +850,10 @@ v4l_grab (struct file *file, ...@@ -847,9 +850,10 @@ v4l_grab (struct file *file,
if (res) if (res)
return res; return res;
} }
if ((res = if ((res = zoran_v4l_set_format(file,
zoran_v4l_set_format(file, mp->width, mp->height, mp->width,
&zoran_formats[i]))) mp->height,
&zoran_formats[i])))
return res; return res;
zr->v4l_settings = fh->v4l_settings; zr->v4l_settings = fh->v4l_settings;
...@@ -2032,6 +2036,7 @@ zoran_do_ioctl (struct inode *inode, ...@@ -2032,6 +2036,7 @@ zoran_do_ioctl (struct inode *inode,
case VIDIOCGCAP: case VIDIOCGCAP:
{ {
struct video_capability *vcap = arg; struct video_capability *vcap = arg;
dprintk(3, KERN_DEBUG "%s: VIDIOCGCAP\n", ZR_DEVNAME(zr)); dprintk(3, KERN_DEBUG "%s: VIDIOCGCAP\n", ZR_DEVNAME(zr));
memset(vcap, 0, sizeof(struct video_capability)); memset(vcap, 0, sizeof(struct video_capability));
...@@ -2154,6 +2159,7 @@ zoran_do_ioctl (struct inode *inode, ...@@ -2154,6 +2159,7 @@ zoran_do_ioctl (struct inode *inode,
for (i = 0; i < zoran_num_formats; i++) { for (i = 0; i < zoran_num_formats; i++) {
const struct zoran_format *fmt = &zoran_formats[i]; const struct zoran_format *fmt = &zoran_formats[i];
if (fmt->palette != -1 && if (fmt->palette != -1 &&
fmt->flags & ZORAN_FORMAT_OVERLAY && fmt->flags & ZORAN_FORMAT_OVERLAY &&
fmt->palette == vpict->palette && fmt->palette == vpict->palette &&
...@@ -2203,7 +2209,9 @@ zoran_do_ioctl (struct inode *inode, ...@@ -2203,7 +2209,9 @@ zoran_do_ioctl (struct inode *inode,
case VIDIOCGWIN: case VIDIOCGWIN:
{ {
struct video_window *vwin = arg; struct video_window *vwin = arg;
dprintk(3, KERN_DEBUG "%s: VIDIOCGWIN\n", ZR_DEVNAME(zr)); dprintk(3, KERN_DEBUG "%s: VIDIOCGWIN\n", ZR_DEVNAME(zr));
memset(vwin, 0, sizeof(struct video_window)); memset(vwin, 0, sizeof(struct video_window));
down(&zr->resource_lock); down(&zr->resource_lock);
vwin->x = fh->overlay_settings.x; vwin->x = fh->overlay_settings.x;
...@@ -2241,7 +2249,9 @@ zoran_do_ioctl (struct inode *inode, ...@@ -2241,7 +2249,9 @@ zoran_do_ioctl (struct inode *inode,
case VIDIOCGFBUF: case VIDIOCGFBUF:
{ {
struct video_buffer *vbuf = arg; struct video_buffer *vbuf = arg;
dprintk(3, KERN_DEBUG "%s: VIDIOCGFBUF\n", ZR_DEVNAME(zr)); dprintk(3, KERN_DEBUG "%s: VIDIOCGFBUF\n", ZR_DEVNAME(zr));
down(&zr->resource_lock); down(&zr->resource_lock);
*vbuf = zr->buffer; *vbuf = zr->buffer;
up(&zr->resource_lock); up(&zr->resource_lock);
...@@ -2285,8 +2295,10 @@ zoran_do_ioctl (struct inode *inode, ...@@ -2285,8 +2295,10 @@ zoran_do_ioctl (struct inode *inode,
case VIDIOCSYNC: case VIDIOCSYNC:
{ {
int *frame = arg, res; int *frame = arg, res;
dprintk(3, KERN_DEBUG "%s: VIDIOCSYNC - frame=%d\n", dprintk(3, KERN_DEBUG "%s: VIDIOCSYNC - frame=%d\n",
ZR_DEVNAME(zr), *frame); ZR_DEVNAME(zr), *frame);
down(&zr->resource_lock); down(&zr->resource_lock);
res = v4l_sync(file, *frame); res = v4l_sync(file, *frame);
up(&zr->resource_lock); up(&zr->resource_lock);
...@@ -2300,11 +2312,13 @@ zoran_do_ioctl (struct inode *inode, ...@@ -2300,11 +2312,13 @@ zoran_do_ioctl (struct inode *inode,
{ {
struct video_mmap *vmap = arg; struct video_mmap *vmap = arg;
int res; int res;
dprintk(3, dprintk(3,
KERN_DEBUG KERN_DEBUG
"%s: VIDIOCMCAPTURE - frame=%d, geom=%dx%d, fmt=%d\n", "%s: VIDIOCMCAPTURE - frame=%d, geom=%dx%d, fmt=%d\n",
ZR_DEVNAME(zr), vmap->frame, vmap->width, vmap->height, ZR_DEVNAME(zr), vmap->frame, vmap->width, vmap->height,
vmap->format); vmap->format);
down(&zr->resource_lock); down(&zr->resource_lock);
res = v4l_grab(file, vmap); res = v4l_grab(file, vmap);
up(&zr->resource_lock); up(&zr->resource_lock);
...@@ -2358,6 +2372,7 @@ zoran_do_ioctl (struct inode *inode, ...@@ -2358,6 +2372,7 @@ zoran_do_ioctl (struct inode *inode,
struct video_unit *vunit = arg; struct video_unit *vunit = arg;
dprintk(3, KERN_DEBUG "%s: VIDIOCGUNIT\n", ZR_DEVNAME(zr)); dprintk(3, KERN_DEBUG "%s: VIDIOCGUNIT\n", ZR_DEVNAME(zr));
vunit->video = zr->video_dev->minor; vunit->video = zr->video_dev->minor;
vunit->vbi = VIDEO_NO_UNIT; vunit->vbi = VIDEO_NO_UNIT;
vunit->radio = VIDEO_NO_UNIT; vunit->radio = VIDEO_NO_UNIT;
...@@ -2393,6 +2408,7 @@ zoran_do_ioctl (struct inode *inode, ...@@ -2393,6 +2408,7 @@ zoran_do_ioctl (struct inode *inode,
case BUZIOC_G_PARAMS: case BUZIOC_G_PARAMS:
{ {
struct zoran_params *bparams = arg; struct zoran_params *bparams = arg;
dprintk(3, KERN_DEBUG "%s: BUZIOC_G_PARAMS\n", ZR_DEVNAME(zr)); dprintk(3, KERN_DEBUG "%s: BUZIOC_G_PARAMS\n", ZR_DEVNAME(zr));
memset(bparams, 0, sizeof(struct zoran_params)); memset(bparams, 0, sizeof(struct zoran_params));
...@@ -2686,6 +2702,7 @@ zoran_do_ioctl (struct inode *inode, ...@@ -2686,6 +2702,7 @@ zoran_do_ioctl (struct inode *inode,
struct v4l2_fmtdesc *fmt = arg; struct v4l2_fmtdesc *fmt = arg;
int index = fmt->index, num = -1, i, flag = 0, type = int index = fmt->index, num = -1, i, flag = 0, type =
fmt->type; fmt->type;
dprintk(3, KERN_DEBUG "%s: VIDIOC_ENUM_FMT - index=%d\n", dprintk(3, KERN_DEBUG "%s: VIDIOC_ENUM_FMT - index=%d\n",
ZR_DEVNAME(zr), fmt->index); ZR_DEVNAME(zr), fmt->index);
...@@ -3530,6 +3547,7 @@ zoran_do_ioctl (struct inode *inode, ...@@ -3530,6 +3547,7 @@ zoran_do_ioctl (struct inode *inode,
case VIDIOC_QUERYCTRL: case VIDIOC_QUERYCTRL:
{ {
struct v4l2_queryctrl *ctrl = arg; struct v4l2_queryctrl *ctrl = arg;
dprintk(3, KERN_DEBUG "%s: VIDIOC_QUERYCTRL - id=%d\n", dprintk(3, KERN_DEBUG "%s: VIDIOC_QUERYCTRL - id=%d\n",
ZR_DEVNAME(zr), ctrl->id); ZR_DEVNAME(zr), ctrl->id);
...@@ -3571,6 +3589,7 @@ zoran_do_ioctl (struct inode *inode, ...@@ -3571,6 +3589,7 @@ zoran_do_ioctl (struct inode *inode,
case VIDIOC_G_CTRL: case VIDIOC_G_CTRL:
{ {
struct v4l2_control *ctrl = arg; struct v4l2_control *ctrl = arg;
dprintk(3, KERN_DEBUG "%s: VIDIOC_G_CTRL - id=%d\n", dprintk(3, KERN_DEBUG "%s: VIDIOC_G_CTRL - id=%d\n",
ZR_DEVNAME(zr), ctrl->id); ZR_DEVNAME(zr), ctrl->id);
...@@ -3652,6 +3671,7 @@ zoran_do_ioctl (struct inode *inode, ...@@ -3652,6 +3671,7 @@ zoran_do_ioctl (struct inode *inode,
case VIDIOC_ENUMSTD: case VIDIOC_ENUMSTD:
{ {
struct v4l2_standard *std = arg; struct v4l2_standard *std = arg;
dprintk(3, KERN_DEBUG "%s: VIDIOC_ENUMSTD - index=%d\n", dprintk(3, KERN_DEBUG "%s: VIDIOC_ENUMSTD - index=%d\n",
ZR_DEVNAME(zr), std->index); ZR_DEVNAME(zr), std->index);
...@@ -3707,6 +3727,7 @@ zoran_do_ioctl (struct inode *inode, ...@@ -3707,6 +3727,7 @@ zoran_do_ioctl (struct inode *inode,
{ {
v4l2_std_id *std = arg; v4l2_std_id *std = arg;
int norm; int norm;
dprintk(3, KERN_DEBUG "%s: VIDIOC_G_STD\n", ZR_DEVNAME(zr)); dprintk(3, KERN_DEBUG "%s: VIDIOC_G_STD\n", ZR_DEVNAME(zr));
down(&zr->resource_lock); down(&zr->resource_lock);
...@@ -3804,6 +3825,7 @@ zoran_do_ioctl (struct inode *inode, ...@@ -3804,6 +3825,7 @@ zoran_do_ioctl (struct inode *inode,
case VIDIOC_G_INPUT: case VIDIOC_G_INPUT:
{ {
int *input = arg; int *input = arg;
dprintk(3, KERN_DEBUG "%s: VIDIOC_G_INPUT\n", ZR_DEVNAME(zr)); dprintk(3, KERN_DEBUG "%s: VIDIOC_G_INPUT\n", ZR_DEVNAME(zr));
down(&zr->resource_lock); down(&zr->resource_lock);
...@@ -3817,6 +3839,7 @@ zoran_do_ioctl (struct inode *inode, ...@@ -3817,6 +3839,7 @@ zoran_do_ioctl (struct inode *inode,
case VIDIOC_S_INPUT: case VIDIOC_S_INPUT:
{ {
int *input = arg, res = 0; int *input = arg, res = 0;
dprintk(3, KERN_DEBUG "%s: VIDIOC_S_INPUT - input=%d\n", dprintk(3, KERN_DEBUG "%s: VIDIOC_S_INPUT - input=%d\n",
ZR_DEVNAME(zr), *input); ZR_DEVNAME(zr), *input);
...@@ -3835,6 +3858,7 @@ zoran_do_ioctl (struct inode *inode, ...@@ -3835,6 +3858,7 @@ zoran_do_ioctl (struct inode *inode,
case VIDIOC_ENUMOUTPUT: case VIDIOC_ENUMOUTPUT:
{ {
struct v4l2_output *outp = arg; struct v4l2_output *outp = arg;
dprintk(3, KERN_DEBUG "%s: VIDIOC_ENUMOUTPUT - index=%d\n", dprintk(3, KERN_DEBUG "%s: VIDIOC_ENUMOUTPUT - index=%d\n",
ZR_DEVNAME(zr), outp->index); ZR_DEVNAME(zr), outp->index);
...@@ -4005,7 +4029,9 @@ zoran_do_ioctl (struct inode *inode, ...@@ -4005,7 +4029,9 @@ zoran_do_ioctl (struct inode *inode,
case VIDIOC_G_JPEGCOMP: case VIDIOC_G_JPEGCOMP:
{ {
struct v4l2_jpegcompression *params = arg; struct v4l2_jpegcompression *params = arg;
dprintk(3, KERN_DEBUG "%s: VIDIOC_G_JPEGCOMP\n", ZR_DEVNAME(zr));
dprintk(3, KERN_DEBUG "%s: VIDIOC_G_JPEGCOMP\n",
ZR_DEVNAME(zr));
memset(params, 0, sizeof(*params)); memset(params, 0, sizeof(*params));
...@@ -4175,6 +4201,7 @@ zoran_do_ioctl (struct inode *inode, ...@@ -4175,6 +4201,7 @@ zoran_do_ioctl (struct inode *inode,
} else if (fmt->type == } else if (fmt->type ==
V4L2_BUF_TYPE_VIDEO_CAPTURE) { V4L2_BUF_TYPE_VIDEO_CAPTURE) {
int i; int i;
for (i = 0; i < zoran_num_formats; i++) for (i = 0; i < zoran_num_formats; i++)
if (zoran_formats[i].fourcc == if (zoran_formats[i].fourcc ==
fmt->fmt.pix.pixelformat) fmt->fmt.pix.pixelformat)
...@@ -4321,6 +4348,7 @@ static void ...@@ -4321,6 +4348,7 @@ static void
zoran_vm_open (struct vm_area_struct *vma) zoran_vm_open (struct vm_area_struct *vma)
{ {
struct zoran_mapping *map = vma->vm_private_data; struct zoran_mapping *map = vma->vm_private_data;
map->count++; map->count++;
} }
......
...@@ -248,6 +248,7 @@ zoran_proc_init (struct zoran *zr) ...@@ -248,6 +248,7 @@ zoran_proc_init (struct zoran *zr)
{ {
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
char name[8]; char name[8];
snprintf(name, 7, "zoran%d", zr->id); snprintf(name, 7, "zoran%d", zr->id);
if ((zr->zoran_proc = create_proc_entry(name, 0, 0))) { if ((zr->zoran_proc = create_proc_entry(name, 0, 0))) {
zr->zoran_proc->read_proc = zoran_read_proc; zr->zoran_proc->read_proc = zoran_read_proc;
...@@ -272,6 +273,7 @@ zoran_proc_cleanup (struct zoran *zr) ...@@ -272,6 +273,7 @@ zoran_proc_cleanup (struct zoran *zr)
{ {
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
char name[8]; char name[8];
snprintf(name, 7, "zoran%d", zr->id); snprintf(name, 7, "zoran%d", zr->id);
if (zr->zoran_proc) { if (zr->zoran_proc) {
remove_proc_entry(name, 0); remove_proc_entry(name, 0);
......
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