Skip to content

Commit

Permalink
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/mchehab/linux-2.6

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (25 commits)
  em28xx: remove backward compat macro added on a previous fix
  V4L/DVB (9748): em28xx: fix compile warning
  V4L/DVB (9743): em28xx: fix oops audio
  V4L/DVB (9742): em28xx-alsa: implement another locking schema
  V4L/DVB (9732): sms1xxx: use new firmware for Hauppauge WinTV MiniStick
  V4L/DVB (9691): gspca: Move the video device to a separate area.
  V4L/DVB (9690): gspca: Lock the subdrivers via module_get/put.
  V4L/DVB (9689): gspca: Memory leak when disconnect while streaming.
  V4L/DVB (9668): em28xx: fix a race condition with hald
  V4L/DVB (9664): af9015: don't reconnect device in USB-bus
  V4L/DVB (9647): em28xx: void having two concurrent control URB's
  V4L/DVB (9646): em28xx: avoid allocating/dealocating memory on every control urb
  V4L/DVB (9645): em28xx: Avoid memory leaks if registration fails
  V4L/DVB (9639): Make dib0700 remote control support work with firmware v1.20
  V4L/DVB (9635): v4l: s2255drv fix firmware test on big-endian
  V4L/DVB (9634): Make sure the i2c gate is open before powering down tuner
  V4L/DVB (9632): make em28xx aux audio input work
  V4L/DVB (9631): Make s2api work for ATSC support
  V4L/DVB (9627): em28xx: Avoid i2c register error for boards without eeprom
  V4L/DVB (9608): Fix section mismatch warning for dm1105 during make
  ...
  • Loading branch information
torvalds committed Dec 2, 2008
2 parents 9c84ba4 + a693b0c commit 0d81514
Show file tree
Hide file tree
Showing 26 changed files with 410 additions and 149 deletions.
2 changes: 1 addition & 1 deletion drivers/media/dvb/dm1105/dm1105.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ static void dm1105dvb_dma_unmap(struct dm1105dvb *dm1105dvb)
pci_free_consistent(dm1105dvb->pdev, 6*DM1105_DMA_BYTES, dm1105dvb->ts_buf, dm1105dvb->dma_addr);
}

static void __devinit dm1105dvb_enable_irqs(struct dm1105dvb *dm1105dvb)
static void dm1105dvb_enable_irqs(struct dm1105dvb *dm1105dvb)
{
outb(INTMAK_ALLMASK, dm_io_mem(DM1105_INTMAK));
outb(1, dm_io_mem(DM1105_CR));
Expand Down
5 changes: 4 additions & 1 deletion drivers/media/dvb/dvb-core/dvb_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,8 @@ static int dvb_frontend_thread(void *data)
if (fe->ops.set_voltage)
fe->ops.set_voltage(fe, SEC_VOLTAGE_OFF);
if (fe->ops.tuner_ops.sleep) {
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
fe->ops.tuner_ops.sleep(fe);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0);
Expand Down Expand Up @@ -934,7 +936,8 @@ void dtv_property_dump(struct dtv_property *tvp)
int is_legacy_delivery_system(fe_delivery_system_t s)
{
if((s == SYS_UNDEFINED) || (s == SYS_DVBC_ANNEX_AC) ||
(s == SYS_DVBC_ANNEX_B) || (s == SYS_DVBT) || (s == SYS_DVBS))
(s == SYS_DVBC_ANNEX_B) || (s == SYS_DVBT) || (s == SYS_DVBS) ||
(s == SYS_ATSC))
return 1;

return 0;
Expand Down
8 changes: 2 additions & 6 deletions drivers/media/dvb/dvb-usb/af9015.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,12 +681,6 @@ static int af9015_download_firmware(struct usb_device *udev,
goto error;
}

/* firmware is running, reconnect device in the usb bus */
req.cmd = RECONNECT_USB;
ret = af9015_rw_udev(udev, &req);
if (ret)
err("reconnect failed: %d", ret);

error:
return ret;
}
Expand Down Expand Up @@ -1208,6 +1202,7 @@ static struct dvb_usb_device_properties af9015_properties[] = {
.usb_ctrl = DEVICE_SPECIFIC,
.download_firmware = af9015_download_firmware,
.firmware = "dvb-usb-af9015.fw",
.no_reconnect = 1,

.size_of_priv = sizeof(struct af9015_state), \

Expand Down Expand Up @@ -1306,6 +1301,7 @@ static struct dvb_usb_device_properties af9015_properties[] = {
.usb_ctrl = DEVICE_SPECIFIC,
.download_firmware = af9015_download_firmware,
.firmware = "dvb-usb-af9015.fw",
.no_reconnect = 1,

.size_of_priv = sizeof(struct af9015_state), \

Expand Down
5 changes: 4 additions & 1 deletion drivers/media/dvb/dvb-usb/dib0700.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extern int dvb_usb_dib0700_debug;

#define REQUEST_I2C_READ 0x2
#define REQUEST_I2C_WRITE 0x3
#define REQUEST_POLL_RC 0x4
#define REQUEST_POLL_RC 0x4 /* deprecated in firmware v1.20 */
#define REQUEST_JUMPRAM 0x8
#define REQUEST_SET_CLOCK 0xB
#define REQUEST_SET_GPIO 0xC
Expand All @@ -40,11 +40,14 @@ struct dib0700_state {
u16 mt2060_if1[2];
u8 rc_toggle;
u8 rc_counter;
u8 rc_func_version;
u8 is_dib7000pc;
u8 fw_use_new_i2c_api;
u8 disable_streaming_master_mode;
};

extern int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion,
u32 *romversion, u32 *ramversion, u32 *fwtype);
extern int dib0700_set_gpio(struct dvb_usb_device *, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val);
extern int dib0700_ctrl_clock(struct dvb_usb_device *d, u32 clk_MHz, u8 clock_out_gp3);
extern int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen);
Expand Down
16 changes: 16 additions & 0 deletions drivers/media/dvb/dvb-usb/dib0700_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@ MODULE_PARM_DESC(dvb_usb_dib0700_ir_proto, "set ir protocol (0=NEC, 1=RC5 (defau

DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);


int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion,
u32 *romversion, u32 *ramversion, u32 *fwtype)
{
u8 b[16];
int ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0),
REQUEST_GET_VERSION,
USB_TYPE_VENDOR | USB_DIR_IN, 0, 0,
b, sizeof(b), USB_CTRL_GET_TIMEOUT);
*hwversion = (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3];
*romversion = (b[4] << 24) | (b[5] << 16) | (b[6] << 8) | b[7];
*ramversion = (b[8] << 24) | (b[9] << 16) | (b[10] << 8) | b[11];
*fwtype = (b[12] << 24) | (b[13] << 16) | (b[14] << 8) | b[15];
return ret;
}

/* expecting rx buffer: request data[0] data[1] ... data[2] */
static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen)
{
Expand Down
139 changes: 138 additions & 1 deletion drivers/media/dvb/dvb-usb/dib0700_devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ static struct mt2060_config bristol_mt2060_config[2] = {
}
};


static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
.band_caps = BAND_VHF | BAND_UHF,
.setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
Expand Down Expand Up @@ -451,8 +452,13 @@ static u8 rc_request[] = { REQUEST_POLL_RC, 0 };

/* Number of keypresses to ignore before start repeating */
#define RC_REPEAT_DELAY 2
#define RC_REPEAT_DELAY_V1_20 5

static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)


/* Used by firmware versions < 1.20 (deprecated) */
static int dib0700_rc_query_legacy(struct dvb_usb_device *d, u32 *event,
int *state)
{
u8 key[4];
int i;
Expand Down Expand Up @@ -529,6 +535,137 @@ static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
return 0;
}

/* This is the structure of the RC response packet starting in firmware 1.20 */
struct dib0700_rc_response {
u8 report_id;
u8 data_state;
u8 system_msb;
u8 system_lsb;
u8 data;
u8 not_data;
};

/* This supports the new IR response format for firmware v1.20 */
static int dib0700_rc_query_v1_20(struct dvb_usb_device *d, u32 *event,
int *state)
{
struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
struct dib0700_state *st = d->priv;
struct dib0700_rc_response poll_reply;
u8 buf[6];
int i;
int status;
int actlen;
int found = 0;

/* Set initial results in case we exit the function early */
*event = 0;
*state = REMOTE_NO_KEY_PRESSED;

/* Firmware v1.20 provides RC data via bulk endpoint 1 */
status = usb_bulk_msg(d->udev, usb_rcvbulkpipe(d->udev, 1), buf,
sizeof(buf), &actlen, 50);
if (status < 0) {
/* No data available (meaning no key press) */
return 0;
}

if (actlen != sizeof(buf)) {
/* We didn't get back the 6 byte message we expected */
err("Unexpected RC response size [%d]", actlen);
return -1;
}

poll_reply.report_id = buf[0];
poll_reply.data_state = buf[1];
poll_reply.system_msb = buf[2];
poll_reply.system_lsb = buf[3];
poll_reply.data = buf[4];
poll_reply.not_data = buf[5];

/*
info("rid=%02x ds=%02x sm=%02x sl=%02x d=%02x nd=%02x\n",
poll_reply.report_id, poll_reply.data_state,
poll_reply.system_msb, poll_reply.system_lsb,
poll_reply.data, poll_reply.not_data);
*/

if ((poll_reply.data + poll_reply.not_data) != 0xff) {
/* Key failed integrity check */
err("key failed integrity check: %02x %02x %02x %02x",
poll_reply.system_msb, poll_reply.system_lsb,
poll_reply.data, poll_reply.not_data);
return -1;
}

/* Find the key in the map */
for (i = 0; i < d->props.rc_key_map_size; i++) {
if (keymap[i].custom == poll_reply.system_lsb &&
keymap[i].data == poll_reply.data) {
*event = keymap[i].event;
found = 1;
break;
}
}

if (found == 0) {
err("Unknown remote controller key: %02x %02x %02x %02x",
poll_reply.system_msb, poll_reply.system_lsb,
poll_reply.data, poll_reply.not_data);
d->last_event = 0;
return 0;
}

if (poll_reply.data_state == 1) {
/* New key hit */
st->rc_counter = 0;
*event = keymap[i].event;
*state = REMOTE_KEY_PRESSED;
d->last_event = keymap[i].event;
} else if (poll_reply.data_state == 2) {
/* Key repeated */
st->rc_counter++;

/* prevents unwanted double hits */
if (st->rc_counter > RC_REPEAT_DELAY_V1_20) {
*event = d->last_event;
*state = REMOTE_KEY_PRESSED;
st->rc_counter = RC_REPEAT_DELAY_V1_20;
}
} else {
err("Unknown data state [%d]", poll_reply.data_state);
}

return 0;
}

static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
{
struct dib0700_state *st = d->priv;

/* Because some people may have improperly named firmware files,
let's figure out whether to use the new firmware call or the legacy
call based on the firmware version embedded in the file */
if (st->rc_func_version == 0) {
u32 hwver, romver, ramver, fwtype;
int ret = dib0700_get_version(d, &hwver, &romver, &ramver,
&fwtype);
if (ret < 0) {
err("Could not determine version info");
return -1;
}
if (ramver < 0x10200)
st->rc_func_version = 1;
else
st->rc_func_version = 2;
}

if (st->rc_func_version == 2)
return dib0700_rc_query_v1_20(d, event, state);
else
return dib0700_rc_query_legacy(d, event, state);
}

static struct dvb_usb_rc_key dib0700_rc_keys[] = {
/* Key codes for the tiny Pinnacle remote*/
{ 0x07, 0x00, KEY_MUTE },
Expand Down
19 changes: 14 additions & 5 deletions drivers/media/dvb/dvb-usb/usb-urb.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,21 @@ stream->buf_list[stream->buf_num], (long long)stream->dma_addr[stream->buf_num])

static int usb_bulk_urb_init(struct usb_data_stream *stream)
{
int i;
int i, j;

if ((i = usb_allocate_stream_buffers(stream,stream->props.count,
stream->props.u.bulk.buffersize)) < 0)
return i;

/* allocate the URBs */
for (i = 0; i < stream->props.count; i++) {
if ((stream->urb_list[i] = usb_alloc_urb(0,GFP_ATOMIC)) == NULL)
stream->urb_list[i] = usb_alloc_urb(0, GFP_ATOMIC);
if (!stream->urb_list[i]) {
deb_mem("not enough memory for urb_alloc_urb!.\n");
for (j = 0; j < i; j++)
usb_free_urb(stream->urb_list[i]);
return -ENOMEM;

}
usb_fill_bulk_urb( stream->urb_list[i], stream->udev,
usb_rcvbulkpipe(stream->udev,stream->props.endpoint),
stream->buf_list[i],
Expand All @@ -170,9 +174,14 @@ static int usb_isoc_urb_init(struct usb_data_stream *stream)
for (i = 0; i < stream->props.count; i++) {
struct urb *urb;
int frame_offset = 0;
if ((stream->urb_list[i] =
usb_alloc_urb(stream->props.u.isoc.framesperurb,GFP_ATOMIC)) == NULL)

stream->urb_list[i] = usb_alloc_urb(stream->props.u.isoc.framesperurb, GFP_ATOMIC);
if (!stream->urb_list[i]) {
deb_mem("not enough memory for urb_alloc_urb!\n");
for (j = 0; j < i; j++)
usb_free_urb(stream->urb_list[i]);
return -ENOMEM;
}

urb = stream->urb_list[i];

Expand Down
2 changes: 1 addition & 1 deletion drivers/media/dvb/siano/sms-cards.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static struct sms_board sms_boards[] = {
[SMS1XXX_BOARD_HAUPPAUGE_WINDHAM] = {
.name = "Hauppauge WinTV MiniStick",
.type = SMS_NOVA_B0,
.fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-01.fw",
.fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw",
},
};

Expand Down
15 changes: 14 additions & 1 deletion drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,12 @@ static int ttusb_alloc_iso_urbs(struct ttusb *ttusb)
ISO_BUF_COUNT,
&ttusb->iso_dma_handle);

if (!ttusb->iso_buffer) {
dprintk("%s: pci_alloc_consistent - not enough memory\n",
__func__);
return -ENOMEM;
}

memset(ttusb->iso_buffer, 0,
ISO_FRAME_SIZE * FRAMES_PER_ISO_BUF * ISO_BUF_COUNT);

Expand Down Expand Up @@ -1659,7 +1665,14 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i

ttusb_setup_interfaces(ttusb);

ttusb_alloc_iso_urbs(ttusb);
result = ttusb_alloc_iso_urbs(ttusb);
if (result < 0) {
dprintk("%s: ttusb_alloc_iso_urbs - failed\n", __func__);
mutex_unlock(&ttusb->semi2c);
kfree(ttusb);
return result;
}

if (ttusb_init_controller(ttusb))
printk("ttusb_init_controller: error\n");

Expand Down
7 changes: 7 additions & 0 deletions drivers/media/dvb/ttusb-dec/ttusb_dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,12 @@ static int ttusb_dec_alloc_iso_urbs(struct ttusb_dec *dec)
ISO_BUF_COUNT),
&dec->iso_dma_handle);

if (!dec->iso_buffer) {
dprintk("%s: pci_alloc_consistent - not enough memory\n",
__func__);
return -ENOMEM;
}

memset(dec->iso_buffer, 0,
ISO_FRAME_SIZE * (FRAMES_PER_ISO_BUF * ISO_BUF_COUNT));

Expand Down Expand Up @@ -1254,6 +1260,7 @@ static int ttusb_dec_init_usb(struct ttusb_dec *dec)
dec->irq_buffer = usb_buffer_alloc(dec->udev,IRQ_PACKET_SIZE,
GFP_ATOMIC, &dec->irq_dma_handle);
if(!dec->irq_buffer) {
usb_free_urb(dec->irq_urb);
return -ENOMEM;
}
usb_fill_int_urb(dec->irq_urb, dec->udev,dec->irq_pipe,
Expand Down
Loading

0 comments on commit 0d81514

Please sign in to comment.