[PATCH v2 2/2] media: lmedm04: Move interrupt buffer to priv buffer.
Interrupt is always present throughout life time of driver and there is no dma element move this buffer to private area of driver. Signed-off-by: Malcolm Priestley --- v2 removed the need for DMA transfer flags as per Sean drivers/media/usb/dvb-usb-v2/lmedm04.c | 28 +- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index cba782261a6f..602013cf3e69 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -134,7 +134,7 @@ struct lme2510_state { u8 stream_on; u8 pid_size; u8 pid_off; - void *buffer; + u8 int_buffer[128]; struct urb *lme_urb; u8 usb_buffer[64]; /* Frontend original calls */ @@ -388,20 +388,14 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) if (lme_int->lme_urb == NULL) return -ENOMEM; - lme_int->buffer = usb_alloc_coherent(d->udev, 128, GFP_ATOMIC, - _int->lme_urb->transfer_dma); - - if (lme_int->buffer == NULL) - return -ENOMEM; - usb_fill_int_urb(lme_int->lme_urb, - d->udev, - usb_rcvintpipe(d->udev, 0xa), - lme_int->buffer, - 128, - lme2510_int_response, - adap, - 8); +d->udev, +usb_rcvintpipe(d->udev, 0xa), +lme_int->int_buffer, +sizeof(lme_int->int_buffer), +lme2510_int_response, +adap, +8); /* Quirk of pipe reporting PIPE_BULK but behaves as interrupt */ ep = usb_pipe_endpoint(d->udev, lme_int->lme_urb->pipe); @@ -409,8 +403,6 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) if (usb_endpoint_type(>desc) == USB_ENDPOINT_XFER_BULK) lme_int->lme_urb->pipe = usb_rcvbulkpipe(d->udev, 0xa), - lme_int->lme_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - usb_submit_urb(lme_int->lme_urb, GFP_ATOMIC); info("INT Interrupt Service Started"); @@ -1225,10 +1217,8 @@ static void lme2510_exit(struct dvb_usb_device *d) lme2510_kill_urb(>stream); } - if (st->lme_urb != NULL) { + if (st->lme_urb) { usb_kill_urb(st->lme_urb); - usb_free_coherent(d->udev, 128, st->buffer, - st->lme_urb->transfer_dma); usb_free_urb(st->lme_urb); info("Interrupt Service Stopped"); } -- 2.19.1
[PATCH v2 1/2] media: lmedm04: Add missing usb_free_urb to free interrupt urb.
The interrupt urb is killed but never freed add the function Signed-off-by: Malcolm Priestley --- v2 avoiding stale pointer in usb_free_coherent as per sean drivers/media/usb/dvb-usb-v2/lmedm04.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index e9b149a26ce5..cba782261a6f 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -1229,6 +1229,7 @@ static void lme2510_exit(struct dvb_usb_device *d) usb_kill_urb(st->lme_urb); usb_free_coherent(d->udev, 128, st->buffer, st->lme_urb->transfer_dma); + usb_free_urb(st->lme_urb); info("Interrupt Service Stopped"); } } -- 2.19.1
[PATCH 1/4] media: lmedm04: Add missing usb_free_urb to free, interrupt urb
The interrupt urb is killed but never freed add the function Cc: sta...@vger.kernel.org Signed-off-by: Malcolm Priestley --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index f109c04f05ae..8b405e131439 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -1264,6 +1264,7 @@ static void *lme2510_exit_int(struct dvb_usb_device *d) if (st->lme_urb != NULL) { usb_kill_urb(st->lme_urb); + usb_free_urb(st->lme_urb); usb_free_coherent(d->udev, 128, st->buffer, st->lme_urb->transfer_dma); info("Interrupt Service Stopped"); -- 2.19.1
[PATCH 2/4] media: lmedm04: Move usb buffer to lme2510_state.
lme2510_state exists for the entire duration of driver. Move usb_buffer to lme2510_state removing the need for lme2510_exit_int for removing the buffer. Signed-off-by: Malcolm Priestley --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 35 +++--- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 8b405e131439..8fb53b83c914 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -136,7 +136,7 @@ struct lme2510_state { u8 pid_off; void *buffer; struct urb *lme_urb; - void *usb_buffer; + u8 usb_buffer[64]; /* Frontend original calls */ int (*fe_read_status)(struct dvb_frontend *, enum fe_status *); int (*fe_read_signal_strength)(struct dvb_frontend *, u16 *); @@ -169,18 +169,9 @@ static int lme2510_usb_talk(struct dvb_usb_device *d, u8 *wbuf, int wlen, u8 *rbuf, int rlen) { struct lme2510_state *st = d->priv; - u8 *buff; + u8 *buff = st->usb_buffer; int ret = 0; - if (st->usb_buffer == NULL) { - st->usb_buffer = kmalloc(64, GFP_KERNEL); - if (st->usb_buffer == NULL) { - info("MEM Error no memory"); - return -ENOMEM; - } - } - buff = st->usb_buffer; - ret = mutex_lock_interruptible(>usb_mutex); if (ret < 0) @@ -1245,23 +1236,15 @@ static int lme2510_get_rc_config(struct dvb_usb_device *d, return 0; } -static void *lme2510_exit_int(struct dvb_usb_device *d) +static void lme2510_exit(struct dvb_usb_device *d) { struct lme2510_state *st = d->priv; struct dvb_usb_adapter *adap = >adapter[0]; - void *buffer = NULL; if (adap != NULL) { lme2510_kill_urb(>stream); } - if (st->usb_buffer != NULL) { - st->i2c_talk_onoff = 1; - st->signal_level = 0; - st->signal_sn = 0; - buffer = st->usb_buffer; - } - if (st->lme_urb != NULL) { usb_kill_urb(st->lme_urb); usb_free_urb(st->lme_urb); @@ -1269,18 +1252,6 @@ static void *lme2510_exit_int(struct dvb_usb_device *d) st->lme_urb->transfer_dma); info("Interrupt Service Stopped"); } - - return buffer; -} - -static void lme2510_exit(struct dvb_usb_device *d) -{ - void *usb_buffer; - - if (d != NULL) { - usb_buffer = lme2510_exit_int(d); - kfree(usb_buffer); - } } static struct dvb_usb_device_properties lme2510_props = { -- 2.19.1
[PATCH 3/4] media: lmedm04: Move interrupt buffer to priv buffer.
Interrupt is always present throught life time of there is no dma element move this buffer to private area of driver. Signed-off-by: Malcolm Priestley --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 26 +- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 8fb53b83c914..7b1aaed259db 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -134,7 +134,7 @@ struct lme2510_state { u8 stream_on; u8 pid_size; u8 pid_off; - void *buffer; + u8 int_buffer[128]; struct urb *lme_urb; u8 usb_buffer[64]; /* Frontend original calls */ @@ -408,20 +408,14 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) if (lme_int->lme_urb == NULL) return -ENOMEM; - lme_int->buffer = usb_alloc_coherent(d->udev, 128, GFP_ATOMIC, - _int->lme_urb->transfer_dma); - - if (lme_int->buffer == NULL) - return -ENOMEM; - usb_fill_int_urb(lme_int->lme_urb, - d->udev, - usb_rcvintpipe(d->udev, 0xa), - lme_int->buffer, - 128, - lme2510_int_response, - adap, - 8); +d->udev, +usb_rcvintpipe(d->udev, 0xa), +lme_int->int_buffer, +sizeof(lme_int->int_buffer), +lme2510_int_response, +adap, +8); /* Quirk of pipe reporting PIPE_BULK but behaves as interrupt */ ep = usb_pipe_endpoint(d->udev, lme_int->lme_urb->pipe); @@ -1245,11 +1239,9 @@ static void lme2510_exit(struct dvb_usb_device *d) lme2510_kill_urb(>stream); } - if (st->lme_urb != NULL) { + if (st->lme_urb) { usb_kill_urb(st->lme_urb); usb_free_urb(st->lme_urb); - usb_free_coherent(d->udev, 128, st->buffer, - st->lme_urb->transfer_dma); info("Interrupt Service Stopped"); } } -- 2.19.1
[PATCH 4/4] media: lmedm04: use dvb_usbv2_generic_rw_locked
Use dvb-usb-v2 generic usb function for bulk transfers and simplify logic. Signed-off-by: Malcolm Priestley --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 42 -- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 7b1aaed259db..8ca0cc67541f 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -147,50 +147,30 @@ struct lme2510_state { u8 dvb_usb_lme2510_firmware; }; -static int lme2510_bulk_write(struct usb_device *dev, - u8 *snd, int len, u8 pipe) -{ - int actual_l; - - return usb_bulk_msg(dev, usb_sndbulkpipe(dev, pipe), - snd, len, _l, 100); -} - -static int lme2510_bulk_read(struct usb_device *dev, - u8 *rev, int len, u8 pipe) -{ - int actual_l; - - return usb_bulk_msg(dev, usb_rcvbulkpipe(dev, pipe), - rev, len, _l, 200); -} - static int lme2510_usb_talk(struct dvb_usb_device *d, - u8 *wbuf, int wlen, u8 *rbuf, int rlen) + u8 *wbuf, int wlen, u8 *rbuf, int rlen) { struct lme2510_state *st = d->priv; - u8 *buff = st->usb_buffer; int ret = 0; - ret = mutex_lock_interruptible(>usb_mutex); + if (max(wlen, rlen) > sizeof(st->usb_buffer)) + return -EINVAL; + ret = mutex_lock_interruptible(>usb_mutex); if (ret < 0) return -EAGAIN; - /* the read/write capped at 64 */ - memcpy(buff, wbuf, (wlen < 64) ? wlen : 64); + memcpy(st->usb_buffer, wbuf, wlen); - ret |= lme2510_bulk_write(d->udev, buff, wlen , 0x01); + ret = dvb_usbv2_generic_rw_locked(d, st->usb_buffer, wlen, + st->usb_buffer, rlen); - ret |= lme2510_bulk_read(d->udev, buff, (rlen < 64) ? - rlen : 64 , 0x01); - - if (rlen > 0) - memcpy(rbuf, buff, rlen); + if (rlen) + memcpy(rbuf, st->usb_buffer, rlen); mutex_unlock(>usb_mutex); - return (ret < 0) ? -ENODEV : 0; + return ret; } static int lme2510_stream_restart(struct dvb_usb_device *d) @@ -1252,6 +1232,8 @@ static struct dvb_usb_device_properties lme2510_props = { .bInterfaceNumber = 0, .adapter_nr = adapter_nr, .size_of_priv = sizeof(struct lme2510_state), + .generic_bulk_ctrl_endpoint = 0x01, + .generic_bulk_ctrl_endpoint_response = 0x01, .download_firmware = lme2510_download_firmware, -- 2.19.1
[PATCH v3] [bug/urgent] dvb-usb-v2: Fix incorrect use of transfer_flags URB_FREE_BUFFER
In commit 1a0c10ed7b media: dvb-usb-v2: stop using coherent memory for URBs incorrectly adds URB_FREE_BUFFER after every urb transfer. It cannot use this flag because it reconfigures the URBs accordingly to suit connected devices. In doing a call to usb_free_urb is made and invertedly frees the buffers. The stream buffer should remain constant while driver is up. Signed-off-by: Malcolm Priestley CC: sta...@vger.kernel.org # v4.18+ --- v3 change commit message to the actual cause drivers/media/usb/dvb-usb-v2/usb_urb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/usb_urb.c b/drivers/media/usb/dvb-usb-v2/usb_urb.c index 024c751eb165..2ad2ddeaff51 100644 --- a/drivers/media/usb/dvb-usb-v2/usb_urb.c +++ b/drivers/media/usb/dvb-usb-v2/usb_urb.c @@ -155,7 +155,6 @@ static int usb_urb_alloc_bulk_urbs(struct usb_data_stream *stream) stream->props.u.bulk.buffersize, usb_urb_complete, stream); - stream->urb_list[i]->transfer_flags = URB_FREE_BUFFER; stream->urbs_initialized++; } return 0; @@ -186,7 +185,7 @@ static int usb_urb_alloc_isoc_urbs(struct usb_data_stream *stream) urb->complete = usb_urb_complete; urb->pipe = usb_rcvisocpipe(stream->udev, stream->props.endpoint); - urb->transfer_flags = URB_ISO_ASAP | URB_FREE_BUFFER; + urb->transfer_flags = URB_ISO_ASAP; urb->interval = stream->props.u.isoc.interval; urb->number_of_packets = stream->props.u.isoc.framesperurb; urb->transfer_buffer_length = stream->props.u.isoc.framesize * @@ -210,7 +209,7 @@ static int usb_free_stream_buffers(struct usb_data_stream *stream) if (stream->state & USB_STATE_URB_BUF) { while (stream->buf_num) { stream->buf_num--; - stream->buf_list[stream->buf_num] = NULL; + kfree(stream->buf_list[stream->buf_num]); } } -- 2.19.1
[PATCH v2] [bug/urgent] dvb-usb-v2: Fix incorrect use of transfer_flags URB_FREE_BUFFER
In commit 1a0c10ed7b media: dvb-usb-v2: stop using coherent memory for URBs incorrectly adds URB_FREE_BUFFER after every urb transfer resulting in no buffers and eventually deadlock. The stream buffer should remain constant while in use by user and kfree() on their departure. Signed-off-by: Malcolm Priestley CC: sta...@vger.kernel.org # v4.18+ --- drivers/media/usb/dvb-usb-v2/usb_urb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/usb_urb.c b/drivers/media/usb/dvb-usb-v2/usb_urb.c index 024c751eb165..2ad2ddeaff51 100644 --- a/drivers/media/usb/dvb-usb-v2/usb_urb.c +++ b/drivers/media/usb/dvb-usb-v2/usb_urb.c @@ -155,7 +155,6 @@ static int usb_urb_alloc_bulk_urbs(struct usb_data_stream *stream) stream->props.u.bulk.buffersize, usb_urb_complete, stream); - stream->urb_list[i]->transfer_flags = URB_FREE_BUFFER; stream->urbs_initialized++; } return 0; @@ -186,7 +185,7 @@ static int usb_urb_alloc_isoc_urbs(struct usb_data_stream *stream) urb->complete = usb_urb_complete; urb->pipe = usb_rcvisocpipe(stream->udev, stream->props.endpoint); - urb->transfer_flags = URB_ISO_ASAP | URB_FREE_BUFFER; + urb->transfer_flags = URB_ISO_ASAP; urb->interval = stream->props.u.isoc.interval; urb->number_of_packets = stream->props.u.isoc.framesperurb; urb->transfer_buffer_length = stream->props.u.isoc.framesize * @@ -210,7 +209,7 @@ static int usb_free_stream_buffers(struct usb_data_stream *stream) if (stream->state & USB_STATE_URB_BUF) { while (stream->buf_num) { stream->buf_num--; - stream->buf_list[stream->buf_num] = NULL; + kfree(stream->buf_list[stream->buf_num]); } } -- 2.19.1
Re: [PATCH] [bug/urgent] dvb-usb-v2: Fix incorrect use of transfer_flags URB_FREE_BUFFER
On 23/10/2018 22:26, Malcolm Priestley wrote: > In commit 1a0c10ed7b media: dvb-usb-v2: stop using coherent memory for URBs > incorrectly adds URB_FREE_BUFFER after every urb transfer resulting in > no buffers and eventually deadlock. > > The stream buffer should remain in constant while in use by user and kfree() > on their departure. > > Signed-off-by: Malcolm Priestley > CC: sta...@vger.kernel.org # v4.18+ > --- > drivers/media/usb/dvb-usb-v2/usb_urb.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/usb/dvb-usb-v2/usb_urb.c > b/drivers/media/usb/dvb-usb-v2/usb_urb.c > index 024c751eb165..2ad2ddeaff51 100644 > --- a/drivers/media/usb/dvb-usb-v2/usb_urb.c > +++ b/drivers/media/usb/dvb-usb-v2/usb_urb.c > @@ -155,7 +155,6 @@ static int usb_urb_alloc_bulk_urbs(struct usb_data_stream > *stream) Re sending email line wrap corruption
[PATCH] [bug/urgent] dvb-usb-v2: Fix incorrect use of transfer_flags URB_FREE_BUFFER
In commit 1a0c10ed7b media: dvb-usb-v2: stop using coherent memory for URBs incorrectly adds URB_FREE_BUFFER after every urb transfer resulting in no buffers and eventually deadlock. The stream buffer should remain in constant while in use by user and kfree() on their departure. Signed-off-by: Malcolm Priestley CC: sta...@vger.kernel.org # v4.18+ --- drivers/media/usb/dvb-usb-v2/usb_urb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/usb_urb.c b/drivers/media/usb/dvb-usb-v2/usb_urb.c index 024c751eb165..2ad2ddeaff51 100644 --- a/drivers/media/usb/dvb-usb-v2/usb_urb.c +++ b/drivers/media/usb/dvb-usb-v2/usb_urb.c @@ -155,7 +155,6 @@ static int usb_urb_alloc_bulk_urbs(struct usb_data_stream *stream) stream->props.u.bulk.buffersize, usb_urb_complete, stream); - stream->urb_list[i]->transfer_flags = URB_FREE_BUFFER; stream->urbs_initialized++; } return 0; @@ -186,7 +185,7 @@ static int usb_urb_alloc_isoc_urbs(struct usb_data_stream *stream) urb->complete = usb_urb_complete; urb->pipe = usb_rcvisocpipe(stream->udev, stream->props.endpoint); - urb->transfer_flags = URB_ISO_ASAP | URB_FREE_BUFFER; + urb->transfer_flags = URB_ISO_ASAP; urb->interval = stream->props.u.isoc.interval; urb->number_of_packets = stream->props.u.isoc.framesperurb; urb->transfer_buffer_length = stream->props.u.isoc.framesize * @@ -210,7 +209,7 @@ static int usb_free_stream_buffers(struct usb_data_stream *stream) if (stream->state & USB_STATE_URB_BUF) { while (stream->buf_num) { stream->buf_num--; - stream->buf_list[stream->buf_num] = NULL; + kfree(stream->buf_list[stream->buf_num]); } } -- 2.19.1
[PATCH 1/2] media: dvb-usb-v2: lmedm04: Improve logic checking of warm start.
Warm start has no check as whether a genuine device has connected and proceeds to next execution path. Check device should read 0x47 at offset of 2 on USB descriptor read and it is the amount requested of 6 bytes. Fix for kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access as Reported-by: Andrey Konovalov <andreyk...@google.com> Signed-off-by: Malcolm Priestley <tvbox...@gmail.com> --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 26 ++ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 5e320fa4a795..992f2011a6ba 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -494,18 +494,23 @@ static int lme2510_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, static int lme2510_return_status(struct dvb_usb_device *d) { - int ret = 0; + int ret; u8 *data; - data = kzalloc(10, GFP_KERNEL); + data = kzalloc(6, GFP_KERNEL); if (!data) return -ENOMEM; - ret |= usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), - 0x06, 0x80, 0x0302, 0x00, data, 0x0006, 200); - info("Firmware Status: %x (%x)", ret , data[2]); + ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), + 0x06, 0x80, 0x0302, 0x00, + data, 0x6, 200); + if (ret != 6) + ret = -EINVAL; + else + ret = data[2]; + + info("Firmware Status: %6ph", data); - ret = (ret < 0) ? -ENODEV : data[2]; kfree(data); return ret; } @@ -1189,6 +1194,7 @@ static int lme2510_get_adapter_count(struct dvb_usb_device *d) static int lme2510_identify_state(struct dvb_usb_device *d, const char **name) { struct lme2510_state *st = d->priv; + int status; usb_reset_configuration(d->udev); @@ -1197,12 +1203,16 @@ static int lme2510_identify_state(struct dvb_usb_device *d, const char **name) st->dvb_usb_lme2510_firmware = dvb_usb_lme2510_firmware; - if (lme2510_return_status(d) == 0x44) { + status = lme2510_return_status(d); + if (status == 0x44) { *name = lme_firmware_switch(d, 0); return COLD; } - return 0; + if (status != 0x47) + return -EINVAL; + + return WARM; } static int lme2510_get_stream_config(struct dvb_frontend *fe, u8 *ts_type, -- 2.14.1
[PATCH 2/2] media: dvb-usb-v2: lmedm04: move ts2020 attach to dm04_lme2510_tuner
When the tuner was split from m88rs2000 the attach function is in wrong place. Move to dm04_lme2510_tuner to trap errors on failure and removing a call to lme_coldreset. Prevents driver starting up without any tuner connected. Fixes to trap for ts2020 fail. LME2510(C): FE Found M88RS2000 ts2020: probe of 0-0060 failed with error -11 ... LME2510(C): TUN Found RS2000 tuner kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access general protection fault: [#1] PREEMPT SMP KASAN Reported-by: Andrey Konovalov <andreyk...@google.com> Signed-off-by: Malcolm Priestley <tvbox...@gmail.com> --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 992f2011a6ba..be26c029546b 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -1076,8 +1076,6 @@ static int dm04_lme2510_frontend_attach(struct dvb_usb_adapter *adap) if (adap->fe[0]) { info("FE Found M88RS2000"); - dvb_attach(ts2020_attach, adap->fe[0], _config, - >i2c_adap); st->i2c_tuner_gate_w = 5; st->i2c_tuner_gate_r = 5; st->i2c_tuner_addr = 0x60; @@ -1143,17 +1141,18 @@ static int dm04_lme2510_tuner(struct dvb_usb_adapter *adap) ret = st->tuner_config; break; case TUNER_RS2000: - ret = st->tuner_config; + if (dvb_attach(ts2020_attach, adap->fe[0], + _config, >i2c_adap)) + ret = st->tuner_config; break; default: break; } - if (ret) + if (ret) { info("TUN Found %s tuner", tun_msg[ret]); - else { - info("TUN No tuner found --- resetting device"); - lme_coldreset(d); + } else { + info("TUN No tuner found"); return -ENODEV; } -- 2.14.1
Re: usb/media/lmedm04: GPF in lme2510_int_read/usb_pipe_endpoint
On 25/09/17 13:39, Andrey Konovalov wrote: Hi! I've got the following report while fuzzing the kernel with syzkaller. On commit e19b205be43d11bff638cad4487008c48d21c103 (4.14-rc2). usb 1-1: new full-speed USB device number 2 using dummy_hcd gadgetfs: connected gadgetfs: disconnected gadgetfs: connected usb 1-1: config 63 interface 0 altsetting 32 endpoint 0x7 has invalid maxpacket 476, setting to 64 usb 1-1: config 63 interface 0 altsetting 32 has an invalid endpoint with address 0x0, skipping usb 1-1: config 63 interface 0 altsetting 32 has an invalid endpoint with address 0xE7, skipping usb 1-1: config 63 interface 0 altsetting 32 has an invalid endpoint with address 0x7F, skipping usb 1-1: config 63 interface 0 has no altsetting 0 usb 1-1: New USB device found, idVendor=3344, idProduct=22f0 usb 1-1: New USB device strings: Mfr=255, Product=0, SerialNumber=8 usb 1-1: Manufacturer: a usb 1-1: SerialNumber: a gadgetfs: configuration #63 gadgetfs: configuration #63 usb 1-1: selecting invalid altsetting 1 LME2510(C): Firmware Status: 4 (61) usb 1-1: dvb_usb_v2: found a 'DM04_LME2510C_DVB-S RS2000' in warm state usb 1-1: dvb_usb_v2: will use the device's hardware PID filter (table count: 15) dvbdev: DVB: registering new adapter (DM04_LME2510C_DVB-S RS2000) usb 1-1: media controller created dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered. LME2510(C): FE Found M88RS2000 ts2020: probe of 0-0060 failed with error -11 usb 1-1: DVB: registering adapter 0 frontend 0 (DM04_LME2510C_DVB-S RS2000 RS2000)... dvbdev: dvb_create_media_entity: media entity 'DM04_LME2510C_DVB-S RS2000 RS2000' registered. LME2510(C): TUN Found RS2000 tuner kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access general protection fault: [#1] PREEMPT SMP KASAN Neither it it null or user memory and it is always present regardless of tuner state when _real_ hardware is connected.
Re: [PATCH RFC 1/2] app: kaffeine: Fix missing PCR on live streams.
On 09/07/17 12:14, Mauro Carvalho Chehab wrote: Hi Malcolm, Em Sun, 9 Jul 2017 10:43:50 +0100 Malcolm Priestley <tvbox...@gmail.com> escreveu: The ISO/IEC standard 13818-1 or ITU-T Rec. H.222.0 standard allow transport vendors to place PCR (Program Clock Reference) on a different PID. If the PCR is unset the value is 0x1fff, most vendors appear to set it the same as video pid in which case it need not be set. The PCR PID is at an offset of 8 in pmtSection structure. Thanks for the patches! Patches look good, except for two things: - we use camelCase at Kaffeine. So, the new field should be pcrPid ;) Ok, Wasn't sure - you didn't use dvbsi.xml. The way we usually update dvbsi.h and part of dvbsi.cpp is to add a field at dvbsi.xml and then run: $ tools/update_dvbsi.sh Oh I see. Kaffeine should be built with the optional BUILD_TOOLS feature, in order for it to build the tool that parses dvbsi.xml. Anyway, I applied your patchset and added a few pathes afterwards adjusting it. Thanks How do you turn off debug the spam from epg is horrendous. Regards Malcolm
[PATCH RFC 1/2] app: kaffeine: Fix missing PCR on live streams.
The ISO/IEC standard 13818-1 or ITU-T Rec. H.222.0 standard allow transport vendors to place PCR (Program Clock Reference) on a different PID. If the PCR is unset the value is 0x1fff, most vendors appear to set it the same as video pid in which case it need not be set. The PCR PID is at an offset of 8 in pmtSection structure. Signed-off-by: Malcolm Priestley <tvbox...@gmail.com> --- src/dvb/dvbliveview.cpp | 8 src/dvb/dvbsi.h | 5 + 2 files changed, 13 insertions(+) diff --git a/src/dvb/dvbliveview.cpp b/src/dvb/dvbliveview.cpp index cfad892..3e92fa6 100644 --- a/src/dvb/dvbliveview.cpp +++ b/src/dvb/dvbliveview.cpp @@ -518,6 +518,7 @@ void DvbLiveView::updatePids(bool forcePatPmtUpdate) DvbPmtSection pmtSection(internal->pmtSectionData); DvbPmtParser pmtParser(pmtSection); QSet newPids; + int pcr_pid = pmtSection.pcr_pid(); bool updatePatPmt = forcePatPmtUpdate; bool isTimeShifting = internal->timeShiftFile.isOpen(); @@ -543,6 +544,13 @@ void DvbLiveView::updatePids(bool forcePatPmtUpdate) newPids.insert(pmtParser.teletextPid); } + /* check PCR PID is set */ + if (pcr_pid != 0x1fff) { + /* Check not already in list */ + if (!newPids.contains(pcr_pid)) + newPids.insert(pcr_pid); + } + for (int i = 0; i < pids.size(); ++i) { int pid = pids.at(i); diff --git a/src/dvb/dvbsi.h b/src/dvb/dvbsi.h index 4d27252..9b4bbe0 100644 --- a/src/dvb/dvbsi.h +++ b/src/dvb/dvbsi.h @@ -1098,6 +1098,11 @@ public: return (at(3) << 8) | at(4); } + int pcr_pid() const + { + return ((at(8) & 0x1f) << 8) | at(9); + } + DvbDescriptor descriptors() const { return DvbDescriptor(getData() + 12, descriptorsLength); -- 2.13.2
[PATCH RFC 2/2] app: kaffeine: Fix missing PCR on stream recordings.
The ISO/IEC standard 13818-1 or ITU-T Rec. H.222.0 standard allow transport vendors to place PCR (Program Clock Reference) on a different PID. This patch adds it recording to file. Signed-off-by: Malcolm Priestley <tvbox...@gmail.com> --- src/dvb/dvbrecording.cpp | 8 1 file changed, 8 insertions(+) diff --git a/src/dvb/dvbrecording.cpp b/src/dvb/dvbrecording.cpp index ecb4777..12a57dc 100644 --- a/src/dvb/dvbrecording.cpp +++ b/src/dvb/dvbrecording.cpp @@ -961,6 +961,7 @@ void DvbRecordingFile::pmtSectionChanged(const QByteArray _) pmtSectionData = pmtSectionData_; DvbPmtSection pmtSection(pmtSectionData); DvbPmtParser pmtParser(pmtSection); + int pcr_pid = pmtSection.pcr_pid(); QSet newPids; if (pmtParser.videoPid != -1) { @@ -979,6 +980,13 @@ void DvbRecordingFile::pmtSectionChanged(const QByteArray _) newPids.insert(pmtParser.teletextPid); } + /* check PCR PID is set */ + if (pcr_pid != 0x1fff) { + /* Check not already in list */ + if (!newPids.contains(pcr_pid)) + newPids.insert(pcr_pid); + } + for (int i = 0; i < pids.size(); ++i) { int pid = pids.at(i); -- 2.13.2
Re: Kaffeine with VLC backend.
On 08/07/17 20:09, Mauro Carvalho Chehab wrote: Em Sat, 8 Jul 2017 18:13:14 +0100 Malcolm Priestley <tvbox...@gmail.com> escreveu: On 08/07/17 08:17, Malcolm Priestley wrote: Hi Mauro Have you encountered a strange bug with Kaffeine with VLC backend. Certain channels will not play correctly, the recordings will also not play in VLC. However, they will play fine with xine player. Only some channels are affected of those provided by SKY such as 12207 V on Astra 28.2. These channels will play fine with Kaffeine with xine backend they also play with VLC's dvb-s interface. Any ideas what could be wrong with the TS format? I am wondering if SKY are inserting something into the format. Just a follow up it appears that the PCR is missing from the stream which is transmitted on a different PID. In the case of the above channel manually adding PID 8190 the backend plays normally. You're likely using an old version of Kaffeine. See this BZ: I was already using the latest git tree. https://bugs.kde.org/show_bug.cgi?id=376805 No it hasn't fixed it the PCR is still missing from the stream. Somehow, PCR PID needs to be added to the PID filter. Unless there is a way VLC can ignore it like xine does?
Re: Kaffeine with VLC backend.
On 08/07/17 08:17, Malcolm Priestley wrote: Hi Mauro Have you encountered a strange bug with Kaffeine with VLC backend. Certain channels will not play correctly, the recordings will also not play in VLC. However, they will play fine with xine player. Only some channels are affected of those provided by SKY such as 12207 V on Astra 28.2. These channels will play fine with Kaffeine with xine backend they also play with VLC's dvb-s interface. Any ideas what could be wrong with the TS format? I am wondering if SKY are inserting something into the format. Just a follow up it appears that the PCR is missing from the stream which is transmitted on a different PID. In the case of the above channel manually adding PID 8190 the backend plays normally.
Kaffeine with VLC backend.
Hi Mauro Have you encountered a strange bug with Kaffeine with VLC backend. Certain channels will not play correctly, the recordings will also not play in VLC. However, they will play fine with xine player. Only some channels are affected of those provided by SKY such as 12207 V on Astra 28.2. These channels will play fine with Kaffeine with xine backend they also play with VLC's dvb-s interface. Any ideas what could be wrong with the TS format? I am wondering if SKY are inserting something into the format. Regards Malcolm
Re: [media-dvb-usb-v2] question about value overwrite
Hi On 18/05/17 20:09, Gustavo A. R. Silva wrote: Hello everybody, While looking into Coverity ID 1226934 I ran into the following piece of code at drivers/media/usb/dvb-usb-v2/lmedm04.c:205 205static int lme2510_stream_restart(struct dvb_usb_device *d) 206{ 207struct lme2510_state *st = d->priv; 208u8 all_pids[] = LME_ALL_PIDS; 209u8 stream_on[] = LME_ST_ON_W; 210int ret; 211u8 rbuff[1]; 212if (st->pid_off) 213ret = lme2510_usb_talk(d, all_pids, sizeof(all_pids), 214rbuff, sizeof(rbuff)); 215/*Restart Stream Command*/ 216ret = lme2510_usb_talk(d, stream_on, sizeof(stream_on), 217rbuff, sizeof(rbuff)); 218return ret; 219} It is a mistake it should have been ORed ad in |= as lme2510_usb_talk only returns three states. So if an error is in the running it will be returned to user. The first of your patches is better and more or less the same, the second would break driver, restart is not an else condition. Regards Malcolm
Re: [PATCH 0004/1529] Fix typo
On 21/05/16 12:36, Andrea Gelmini wrote: Signed-off-by: Andrea Gelmini--- Documentation/DocBook/media/v4l/lirc_device_interface.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/v4l/lirc_device_interface.xml b/Documentation/DocBook/media/v4l/lirc_device_interface.xml index 34cada2..725b221 100644 --- a/Documentation/DocBook/media/v4l/lirc_device_interface.xml +++ b/Documentation/DocBook/media/v4l/lirc_device_interface.xml @@ -114,7 +114,7 @@ on working with the default settings initially. Some receiver have maximum resolution which is defined by internal sample rate or data format limitations. E.g. it's common that signals can only be reported in 50 microsecond steps. This integer value is used by - lircd to automatically adjust the aeps tolerance value in the lircd + lircd to automatically adjust the steps tolerance value in the lircd config file. This is not a typo auditory evoked potentials (AEPs) Regards Malcolm -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] media: dvb-core: Don't force CAN_INVERSION_AUTO in oneshot mode.
On 31/08/15 18:03, Johann Klammer wrote: Why not just remove the line? info->caps |= FE_CAN_INVERSION_AUTO; The capabilities call interacting with the oneshot setting is rather weird and maybe unexpected. No, because in normal mode it can do auto inversion. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] media: dvb-core: Don't force CAN_INVERSION_AUTO in oneshot mode.
Hi Devin On 31/08/15 19:07, Devin Heitmueller wrote: Hi Malcolm, The capabilities call interacting with the oneshot setting is rather weird and maybe unexpected. No, because in normal mode it can do auto inversion. ... If the goal was for the software-emulated auto inversion to be transparent to userland, perhaps it makes more sense for the oneshot mode to toggle the inversion if needed. The oneshot mode would continue to disable zigzag and the stats monitoring. I realize that this is a bit messy since it won't really be "oneshot", but I don't know what else can be done without breaking the ABI. I did think flagging INVERSION_AUTO to INVERSION_OFF on frontends not supporting inversion in oneshot mode. But it's still messy, as INVERSION_AUTO is need for emulation to work. Regards Malcolm -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] media: dvb-core: Don't force CAN_INVERSION_AUTO in oneshot mode.
When in FE_TUNE_MODE_ONESHOT the frontend must report the actual capabilities so user can take appropriate action. With frontends that can't do auto inversion this is done by dvb-core automatically so CAN_INVERSION_AUTO is valid. However, when in FE_TUNE_MODE_ONESHOT this is not true. So only set FE_CAN_INVERSION_AUTO in modes other than FE_TUNE_MODE_ONESHOT Signed-off-by: Malcolm Priestley <tvbox...@gmail.com> Cc: <sta...@vger.kernel.org> --- drivers/media/dvb-core/dvb_frontend.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index c38ef1a..e2a3833 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -2313,9 +2313,9 @@ static int dvb_frontend_ioctl_legacy(struct file *file, dev_dbg(fe->dvb->device, "%s: current delivery system on cache: %d, V3 type: %d\n", __func__, c->delivery_system, fe->ops.info.type); - /* Force the CAN_INVERSION_AUTO bit on. If the frontend doesn't -* do it, it is done for it. */ - info->caps |= FE_CAN_INVERSION_AUTO; + /* Set CAN_INVERSION_AUTO bit on in other than oneshot mode */ + if (!(fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT)) + info->caps |= FE_CAN_INVERSION_AUTO; err = 0; break; } -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [BUG] STV0299 has bogus CAN_INVERSION_AUTO flag
On 24/08/15 16:19, Johann Klammer wrote: from gdb dump: [...] info = { name = ST STV0299 DVB-S, '\000' repeats 111 times, type = FE_QPSK, frequency_min = 95, frequency_max = 215, frequency_stepsize = 125, frequency_tolerance = 0, symbol_rate_min = 100, symbol_rate_max = 4500, symbol_rate_tolerance = 500, notifier_delay = 0, caps = (FE_CAN_INVERSION_AUTO | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | FE_CAN_QPSK)}, [...] when tuning: [...] Hi .. [331020.207352] stv0299 does not support auto-inversion [331020.507480] stv0299 does not support auto-inversion [331020.807610] stv0299 does not support auto-inversion [331021.107747] stv0299 does not support auto-inversion [...] (but how the heck should I know?) I am using the stv0299 with no problems at all, the code hasn't changed much in years. I am using linux 4.2-rc6 You shouldn't be getting that message as dvb core does the auto inversion for the driver. I looked through the code and can't find any fault. Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [BUG] STV0299 has bogus CAN_INVERSION_AUTO flag
On 30/08/15 16:07, Johann Klammer wrote: On 08/30/2015 11:53 AM, Malcolm Priestley wrote: On 24/08/15 16:19, Johann Klammer wrote: from gdb dump: [...] info = { name = ST STV0299 DVB-S, '\000' repeats 111 times, type = FE_QPSK, frequency_min = 95, frequency_max = 215, frequency_stepsize = 125, frequency_tolerance = 0, symbol_rate_min = 100, symbol_rate_max = 4500, symbol_rate_tolerance = 500, notifier_delay = 0, caps = (FE_CAN_INVERSION_AUTO | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | FE_CAN_QPSK)}, [...] when tuning: [...] Hi .. [331020.207352] stv0299 does not support auto-inversion [331020.507480] stv0299 does not support auto-inversion [331020.807610] stv0299 does not support auto-inversion [331021.107747] stv0299 does not support auto-inversion [...] (but how the heck should I know?) I am using the stv0299 with no problems at all, the code hasn't changed much in years. I am using linux 4.2-rc6 boot/vmlinuz-4.1.0-1-586 Something must have changed. I updated kernel and got those messages. I did not get then before. The vmlinuz.old points to: boot/vmlinuz-3.14.15 vmlinuz points to: boot/vmlinuz-4.1.0-1-586 (debian testing binary .deb) You shouldn't be getting that message as dvb core does the auto inversion for the driver. It may have been exposed by trying oneshot tuning mode... not sure... Yes, it is with setting oneshot. Looks like the FE_CAN_INVERSION_AUTO flag is only bogus in FE_TUNE_MODE_ONESHOT mode. Obversely don't set INVERSION_AUTO bearing in mind when you do it manually you have to tune first with it off and if that fails again with it on. Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [media] lmedm04: implement dvb v5 statistics
Indroduce function lme2510_update_stats to update statistics directly from usb interrupt. Provide signal and snr wrap rounds for dvb v3 functions. Block and post bit are not available. When i2c_talk_onoff is on no statistics are available, with possible future hand over to the relevant frontend/tuner. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 104 - 1 file changed, 77 insertions(+), 27 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index f1983f2..1717102 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -257,6 +257,65 @@ static int lme2510_enable_pid(struct dvb_usb_device *d, u8 index, u16 pid_out) return ret; } +static void lme2510_update_stats(struct dvb_usb_adapter *adap) +{ + struct lme2510_state *st = adap_to_priv(adap); + struct dvb_frontend *fe = adap-fe[0]; + struct dtv_frontend_properties *c; + u64 s_tmp = 0, c_tmp = 0; + + if (!fe) + return; + + c = fe-dtv_property_cache; + + c-block_count.len = 1; + c-block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c-block_error.len = 1; + c-block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c-post_bit_count.len = 1; + c-post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c-post_bit_error.len = 1; + c-post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + + if (st-i2c_talk_onoff) { + c-strength.len = 1; + c-strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c-cnr.len = 1; + c-cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + return; + } + + switch (st-tuner_config) { + case TUNER_LG: + s_tmp = 0xff - st-signal_level; + s_tmp |= s_tmp 8; + + c_tmp = 0xff - st-signal_sn; + c_tmp |= c_tmp 8; + break; + /* fall through */ + case TUNER_S7395: + case TUNER_S0194: + s_tmp = 0x - (((st-signal_level * 2) 8) * 5 / 4); + + c_tmp = (u16)((0xff - st-signal_sn - 0xa1) * 3) 8; + break; + case TUNER_RS2000: + s_tmp = (u16)((u32)st-signal_level * 0x / 0xff); + + c_tmp = (u16)((u32)st-signal_sn * 0x / 0x7f); + } + + c-strength.len = 1; + c-strength.stat[0].scale = FE_SCALE_RELATIVE; + c-strength.stat[0].uvalue = s_tmp; + + c-cnr.len = 1; + c-cnr.stat[0].scale = FE_SCALE_RELATIVE; + c-cnr.stat[0].uvalue = c_tmp; +} + static void lme2510_int_response(struct urb *lme_urb) { struct dvb_usb_adapter *adap = lme_urb-context; @@ -337,6 +396,8 @@ static void lme2510_int_response(struct urb *lme_urb) if (!signal_lock) st-lock_status = ~FE_HAS_LOCK; + lme2510_update_stats(adap); + debug_data_snipet(5, INT Remote data snipet in, ibuf); break; case 0xcc: @@ -872,56 +933,45 @@ static int dm04_read_status(struct dvb_frontend *fe, fe_status_t *status) *status = st-lock_status; - if (!(*status FE_HAS_LOCK)) + if (!(*status FE_HAS_LOCK)) { + struct dvb_usb_adapter *adap = fe_to_adap(fe); + st-i2c_talk_onoff = 1; + lme2510_update_stats(adap); + } + return ret; } static int dm04_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { + struct dtv_frontend_properties *c = fe-dtv_property_cache; struct lme2510_state *st = fe_to_priv(fe); if (st-fe_read_signal_strength !st-stream_on) return st-fe_read_signal_strength(fe, strength); - switch (st-tuner_config) { - case TUNER_LG: - *strength = 0xff - st-signal_level; - *strength |= *strength 8; - break; - /* fall through */ - case TUNER_S7395: - case TUNER_S0194: - *strength = 0x - (((st-signal_level * 2) 8) * 5 / 4); - break; - case TUNER_RS2000: - *strength = (u16)((u32)st-signal_level * 0x / 0xff); - } + if (c-strength.stat[0].scale == FE_SCALE_RELATIVE) + *strength = c-strength.stat[0].uvalue; + else + *strength = 0; return 0; } static int dm04_read_snr(struct dvb_frontend *fe, u16 *snr) { + struct dtv_frontend_properties *c = fe-dtv_property_cache; struct lme2510_state *st = fe_to_priv(fe); if (st-fe_read_snr !st-stream_on) return st-fe_read_snr(fe, snr); - switch (st-tuner_config) { - case TUNER_LG: - *snr = 0xff - st-signal_sn; - *snr |= *snr 8; - break
Re: [PATCH] [media] lmedm04: implement dvb v5 statistics
On 08/06/15 21:06, Malcolm Priestley wrote: Indroduce function lme2510_update_stats to update statistics directly from usb interrupt. Provide signal and snr wrap rounds for dvb v3 functions. Block and post bit are not available. When i2c_talk_onoff is on no statistics are available, with possible future hand over to the relevant frontend/tuner. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 104 - 1 file changed, 77 insertions(+), 27 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index f1983f2..1717102 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -257,6 +257,65 @@ static int lme2510_enable_pid(struct dvb_usb_device *d, u8 index, u16 pid_out) return ret; } +static void lme2510_update_stats(struct dvb_usb_adapter *adap) +{ + struct lme2510_state *st = adap_to_priv(adap); + struct dvb_frontend *fe = adap-fe[0]; + struct dtv_frontend_properties *c; + u64 s_tmp = 0, c_tmp = 0; + + if (!fe) + return; + + c = fe-dtv_property_cache; + + c-block_count.len = 1; + c-block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c-block_error.len = 1; + c-block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c-post_bit_count.len = 1; + c-post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c-post_bit_error.len = 1; + c-post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + + if (st-i2c_talk_onoff) { + c-strength.len = 1; + c-strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c-cnr.len = 1; + c-cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + return; + } + + switch (st-tuner_config) { + case TUNER_LG: + s_tmp = 0xff - st-signal_level; + s_tmp |= s_tmp 8; + + c_tmp = 0xff - st-signal_sn; + c_tmp |= c_tmp 8; + break; + /* fall through */ + case TUNER_S7395: + case TUNER_S0194: + s_tmp = 0x - (((st-signal_level * 2) 8) * 5 / 4); + + c_tmp = (u16)((0xff - st-signal_sn - 0xa1) * 3) 8; + break; + case TUNER_RS2000: + s_tmp = (u16)((u32)st-signal_level * 0x / 0xff); + + c_tmp = (u16)((u32)st-signal_sn * 0x / 0x7f); + } I have notice a couple of mistakes with variable sizes. Will repost -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2][media] lmedm04: implement dvb v5 statistics
Indroduce function lme2510_update_stats to update statistics directly from usb interrupt. Provide signal and snr wrap rounds for dvb v3 functions. Block and post bit are not available. When i2c_talk_onoff is on no statistics are available, with possible future hand over to the relevant frontend/tuner. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- v2 Correct variable size casts drivers/media/usb/dvb-usb-v2/lmedm04.c | 104 - 1 file changed, 77 insertions(+), 27 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index f1983f2..726c59e 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -257,6 +257,65 @@ static int lme2510_enable_pid(struct dvb_usb_device *d, u8 index, u16 pid_out) return ret; } +static void lme2510_update_stats(struct dvb_usb_adapter *adap) +{ + struct lme2510_state *st = adap_to_priv(adap); + struct dvb_frontend *fe = adap-fe[0]; + struct dtv_frontend_properties *c; + u64 s_tmp = 0, c_tmp = 0; + + if (!fe) + return; + + c = fe-dtv_property_cache; + + c-block_count.len = 1; + c-block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c-block_error.len = 1; + c-block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c-post_bit_count.len = 1; + c-post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c-post_bit_error.len = 1; + c-post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + + if (st-i2c_talk_onoff) { + c-strength.len = 1; + c-strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c-cnr.len = 1; + c-cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + return; + } + + switch (st-tuner_config) { + case TUNER_LG: + s_tmp = 0xff - st-signal_level; + s_tmp |= s_tmp 8; + + c_tmp = 0xff - st-signal_sn; + c_tmp |= c_tmp 8; + break; + /* fall through */ + case TUNER_S7395: + case TUNER_S0194: + s_tmp = 0x - (((st-signal_level * 2) 8) * 5 / 4); + + c_tmp = ((0xff - st-signal_sn - 0xa1) * 3) 8; + break; + case TUNER_RS2000: + s_tmp = st-signal_level * 0x / 0xff; + + c_tmp = st-signal_sn * 0x / 0x7f; + } + + c-strength.len = 1; + c-strength.stat[0].scale = FE_SCALE_RELATIVE; + c-strength.stat[0].uvalue = s_tmp; + + c-cnr.len = 1; + c-cnr.stat[0].scale = FE_SCALE_RELATIVE; + c-cnr.stat[0].uvalue = c_tmp; +} + static void lme2510_int_response(struct urb *lme_urb) { struct dvb_usb_adapter *adap = lme_urb-context; @@ -337,6 +396,8 @@ static void lme2510_int_response(struct urb *lme_urb) if (!signal_lock) st-lock_status = ~FE_HAS_LOCK; + lme2510_update_stats(adap); + debug_data_snipet(5, INT Remote data snipet in, ibuf); break; case 0xcc: @@ -872,56 +933,45 @@ static int dm04_read_status(struct dvb_frontend *fe, fe_status_t *status) *status = st-lock_status; - if (!(*status FE_HAS_LOCK)) + if (!(*status FE_HAS_LOCK)) { + struct dvb_usb_adapter *adap = fe_to_adap(fe); + st-i2c_talk_onoff = 1; + lme2510_update_stats(adap); + } + return ret; } static int dm04_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { + struct dtv_frontend_properties *c = fe-dtv_property_cache; struct lme2510_state *st = fe_to_priv(fe); if (st-fe_read_signal_strength !st-stream_on) return st-fe_read_signal_strength(fe, strength); - switch (st-tuner_config) { - case TUNER_LG: - *strength = 0xff - st-signal_level; - *strength |= *strength 8; - break; - /* fall through */ - case TUNER_S7395: - case TUNER_S0194: - *strength = 0x - (((st-signal_level * 2) 8) * 5 / 4); - break; - case TUNER_RS2000: - *strength = (u16)((u32)st-signal_level * 0x / 0xff); - } + if (c-strength.stat[0].scale == FE_SCALE_RELATIVE) + *strength = (u16)c-strength.stat[0].uvalue; + else + *strength = 0; return 0; } static int dm04_read_snr(struct dvb_frontend *fe, u16 *snr) { + struct dtv_frontend_properties *c = fe-dtv_property_cache; struct lme2510_state *st = fe_to_priv(fe); if (st-fe_read_snr !st-stream_on) return st-fe_read_snr(fe, snr); - switch (st-tuner_config) { - case TUNER_LG: - *snr = 0xff - st-signal_sn; - *snr |= *snr 8
[PATCH] [media] lmedm04: Enable dont_poll for TS2020 tuner.
Following a change made to TS2020 tuner in patches ts2020: Provide DVBv5 API signal strength ts2020: Allow stats polling to be suppressed Polling on the driver must be suppressed because the demuxer is stopped by I2C messages. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 5de6f7c..f1983f2 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -799,6 +799,7 @@ static struct m88rs2000_config m88rs2000_config = { static struct ts2020_config ts2020_config = { .tuner_address = 0x60, .clk_out_div = 7, + .dont_poll = true }; static int dm04_lme2510_set_voltage(struct dvb_frontend *fe, -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] ts2020: Provide DVBv5 API signal strength
On 03/06/15 11:17, David Howells wrote: Malcolm Priestley tvbox...@gmail.com wrote: Yes, also, the workqueue appears not to be initialized when using the dvb attached method. I'm not sure what you're referring to. It's initialised in ts2020_probe() just after the ts2020_priv struct is allocated - the only place it is allocated. ts2020_probe() isn't touched by devices not converted to I2C binding. -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] ts2020: Provide DVBv5 API signal strength
On 03/06/15 12:13, Antti Palosaari wrote: On 05/28/2015 11:07 PM, Malcolm Priestley wrote: On 28/05/15 11:08, David Howells wrote: Malcolm Priestley tvbox...@gmail.com wrote: Statistics polling can not be done by lmedm04 driver's implementation of M88RS2000/TS2020 because I2C messages stop the devices demuxer. I did make tests (using that same lme2510 + rs2000 device) and didn't saw the issue TS was lost. Could test and and tell me how to reproduce it? Signal strength returned was quite boring though, about same value all the time, but it is different issue... Hi Antti The workqueue is not working because ts2020_probe() isn't called. I am thinking that other drivers that still use dvb_attach may be broken. It will become an issue when the driver is converted to I2C binding. Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] ts2020: Provide DVBv5 API signal strength
On 03/06/15 17:43, Antti Palosaari wrote: On 06/03/2015 07:37 PM, David Howells wrote: Malcolm Priestley tvbox...@gmail.com wrote: Yes, also, the workqueue appears not to be initialized when using the dvb attached method. I'm not sure what you're referring to. It's initialised in ts2020_probe() just after the ts2020_priv struct is allocated - the only place it is allocated. ts2020_probe() isn't touched by devices not converted to I2C binding. Hmmm... Doesn't that expose a larger problem? The only place the ts2020_priv struct is allocated is in ts2020_probe() within ts2020.c and the struct definition is private to that file and so it can't be allocated from outside. So if you don't pass through ts2020_probe(), fe-tuner_priv will remain NULL and the driver will crash. Malcolm misses some pending patches where attach() is wrapped to I2C model probe(). http://git.linuxtv.org/cgit.cgi/anttip/media_tree.git/log/?h=ts2020 Hmmm... Yes, I am indeed missing those patches. I will test. -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] ts2020: Provide DVBv5 API signal strength
On 03/06/15 17:37, David Howells wrote: Malcolm Priestley tvbox...@gmail.com wrote: Yes, also, the workqueue appears not to be initialized when using the dvb attached method. I'm not sure what you're referring to. It's initialised in ts2020_probe() just after the ts2020_priv struct is allocated - the only place it is allocated. ts2020_probe() isn't touched by devices not converted to I2C binding. Hmmm... Doesn't that expose a larger problem? The only place the ts2020_priv struct is allocated is in ts2020_probe() within ts2020.c and the struct definition is private to that file and so it can't be allocated from outside. So if you don't pass through ts2020_probe(), fe-tuner_priv will remain NULL and the driver will crash. No, it is also allocated in ts2020_attach. -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ts2020: Allow stats polling to be suppressed
On 03/06/15 12:35, David Howells wrote: Statistics polling can not be done by lmedm04 driver's implementation of M88RS2000/TS2020 because I2C messages stop the device's demuxer, so allow polling for statistics to be suppressed in the ts2020 driver by setting dont_poll in the ts2020_config struct. Hi David As expected the lmedm04 driver needs this patch along with another patch to enable it for the driver which I will post shortly. Otherwise everything is working fine on Antti's ts2020 branch Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] ts2020: Provide DVBv5 API signal strength
On 28/05/15 11:08, David Howells wrote: Malcolm Priestley tvbox...@gmail.com wrote: Statistics polling can not be done by lmedm04 driver's implementation of M88RS2000/TS2020 because I2C messages stop the devices demuxer. So any polling must be a config option for this driver. Ummm... I presume a runtime config option is okay. Yes, also, the workqueue appears not to be initialized when using the dvb attached method. Also, does that mean that the lmedm04 driver can't be made compatible with the DVBv5 API? No, the driver will have to implement its own version. It doesn't need a polling thread it simply gets it directly from its interrupt urb buffer. Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] ts2020: Provide DVBv5 API signal strength
On 26/05/15 16:04, David Howells wrote: Provide a DVBv5 API signal strength. This is in units of 0.001 dBm rather than a percentage. From Antti Palosaari's testing with a signal generator, it appears that the gain calculated according to Montage's specification if negated is a reasonable representation of the signal strength of the generator. To this end: (1) Polled statistic gathering needed to be implemented in the TS2020 driver. This is done in the ts2020_stat_work() function. (2) The calculated gain is placed as the signal strength in the dtv_property_cache associated with the front end with the scale set to FE_SCALE_DECIBEL. (3) The DVBv3 format signal strength then needed to be calculated from the signal strength stored in the dtv_property_cache rather than accessing the value when ts2020_read_signal_strength() is called. Signed-off-by: David Howells dhowe...@redhat.com --- drivers/media/dvb-frontends/ts2020.c | 62 +- 1 file changed, 53 insertions(+), 9 deletions(-) diff --git a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c index 277e1cf..80ae039 100644 --- a/drivers/media/dvb-frontends/ts2020.c +++ b/drivers/media/dvb-frontends/ts2020.c @@ -32,10 +32,11 @@ struct ts2020_priv { struct regmap_config regmap_config; struct regmap *regmap; struct dvb_frontend *fe; + struct delayed_work stat_work; int (*get_agc_pwm)(struct dvb_frontend *fe, u8 *_agc_pwm); /* i2c details */ - int i2c_address; struct i2c_adapter *i2c; + int i2c_address; u8 clk_out:2; u8 clk_out_div:5; u32 frequency_div; /* LO output divider switch frequency */ @@ -65,6 +66,7 @@ static int ts2020_release(struct dvb_frontend *fe) static int ts2020_sleep(struct dvb_frontend *fe) { struct ts2020_priv *priv = fe-tuner_priv; + int ret; u8 u8tmp; if (priv-tuner == TS2020_M88TS2020) @@ -72,11 +74,18 @@ static int ts2020_sleep(struct dvb_frontend *fe) else u8tmp = 0x00; - return regmap_write(priv-regmap, u8tmp, 0x00); + ret = regmap_write(priv-regmap, u8tmp, 0x00); + if (ret 0) + return ret; + + /* stop statistics polling */ + cancel_delayed_work_sync(priv-stat_work); + return 0; } static int ts2020_init(struct dvb_frontend *fe) { + struct dtv_frontend_properties *c = fe-dtv_property_cache; struct ts2020_priv *priv = fe-tuner_priv; int i; u8 u8tmp; @@ -138,6 +147,13 @@ static int ts2020_init(struct dvb_frontend *fe) reg_vals[i].val); } + /* Initialise v5 stats here */ + c-strength.len = 1; + c-strength.stat[0].scale = FE_SCALE_DECIBEL; + c-strength.stat[0].uvalue = 0; + + /* Start statistics polling */ + schedule_delayed_work(priv-stat_work, 0); return 0; } Hi David Statistics polling can not be done by lmedm04 driver's implementation of M88RS2000/TS2020 because I2C messages stop the devices demuxer. So any polling must be a config option for this driver. Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/5] lmedm04: add read snr, signal strength and ber call backs
On 03/02/15 19:19, Mauro Carvalho Chehab wrote: Em Fri, 2 Jan 2015 13:56:31 + Malcolm Priestley tvbox...@gmail.com escreveu: This allows calling the original functions providing the streaming is off. Malcolm, I'm applying this patch series, as the driver has already some support for the legacy DVBv3 stats, but please port it to use DVBv5. Hi Mauro, I am not sure what you mean by this? Are there any examples? Regards Malcolm Thanks, Mauro Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 24 1 file changed, 24 insertions(+) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index a9c7fd0..5de6f7c 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -145,6 +145,10 @@ struct lme2510_state { void *usb_buffer; /* Frontend original calls */ int (*fe_read_status)(struct dvb_frontend *, fe_status_t *); + int (*fe_read_signal_strength)(struct dvb_frontend *, u16 *); + int (*fe_read_snr)(struct dvb_frontend *, u16 *); + int (*fe_read_ber)(struct dvb_frontend *, u32 *); + int (*fe_read_ucblocks)(struct dvb_frontend *, u32 *); int (*fe_set_voltage)(struct dvb_frontend *, fe_sec_voltage_t); u8 dvb_usb_lme2510_firmware; }; @@ -877,6 +881,9 @@ static int dm04_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { struct lme2510_state *st = fe_to_priv(fe); + if (st-fe_read_signal_strength !st-stream_on) + return st-fe_read_signal_strength(fe, strength); + switch (st-tuner_config) { case TUNER_LG: *strength = 0xff - st-signal_level; @@ -898,6 +905,9 @@ static int dm04_read_snr(struct dvb_frontend *fe, u16 *snr) { struct lme2510_state *st = fe_to_priv(fe); + if (st-fe_read_snr !st-stream_on) + return st-fe_read_snr(fe, snr); + switch (st-tuner_config) { case TUNER_LG: *snr = 0xff - st-signal_sn; @@ -917,6 +927,11 @@ static int dm04_read_snr(struct dvb_frontend *fe, u16 *snr) static int dm04_read_ber(struct dvb_frontend *fe, u32 *ber) { + struct lme2510_state *st = fe_to_priv(fe); + + if (st-fe_read_ber !st-stream_on) + return st-fe_read_ber(fe, ber); + *ber = 0; return 0; @@ -924,6 +939,11 @@ static int dm04_read_ber(struct dvb_frontend *fe, u32 *ber) static int dm04_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) { + struct lme2510_state *st = fe_to_priv(fe); + + if (st-fe_read_ucblocks !st-stream_on) + return st-fe_read_ucblocks(fe, ucblocks); + *ucblocks = 0; return 0; @@ -1036,6 +1056,10 @@ static int dm04_lme2510_frontend_attach(struct dvb_usb_adapter *adap) } st-fe_read_status = adap-fe[0]-ops.read_status; + st-fe_read_signal_strength = adap-fe[0]-ops.read_signal_strength; + st-fe_read_snr = adap-fe[0]-ops.read_snr; + st-fe_read_ber = adap-fe[0]-ops.read_ber; + st-fe_read_ucblocks = adap-fe[0]-ops.read_ucblocks; adap-fe[0]-ops.read_status = dm04_read_status; adap-fe[0]-ops.read_signal_strength = dm04_read_signal_strength; -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/5] lmedm04: add read snr, signal strength and ber call backs
On 03/02/15 19:44, Mauro Carvalho Chehab wrote: Em Tue, 03 Feb 2015 19:31:16 + Malcolm Priestley tvbox...@gmail.com escreveu: On 03/02/15 19:19, Mauro Carvalho Chehab wrote: Em Fri, 2 Jan 2015 13:56:31 + Malcolm Priestley tvbox...@gmail.com escreveu: This allows calling the original functions providing the streaming is off. Malcolm, I'm applying this patch series, as the driver has already some support for the legacy DVBv3 stats, but please port it to use DVBv5. Hi Mauro, I am not sure what you mean by this? The DVB API version 3 has some issues with stats. The main one is that they don't provide any glue to userspace about what scale they use. Due to that, we've added a new API at DVB. We're gradually adding support for that on the already existing drivers. Are there any examples? Yes. You can see, for example: Thanks Malcolm $ git lg drivers/media/dvb-frontends/ |grep stats 906aaf5a195b [media] dvb:tc90522: fix stats report 1d0ceae4a19d [media] af9033: wrap DVBv3 UCB to DVBv5 UCB stats 041ad449683b [media] dib7000p: Add DVBv5 stats support d591590e1b5b [media] drx-j: enable DVBv5 stats 6983257813dc [media] drx-j: properly handle bit counts on stats 03fdfbfd3b59 [media] drx-j: Prepare to use DVBv5 stats 704f01bbc7e4 [media] dib8000: be sure that stats are available before reading them 7a9d85d5559f [media] dib8000: Fix UCB measure with DVBv5 stats 6ef06e78c74c [media] dib8000: add DVBv5 stats 8f3741e02831 [media] drxk: Add pre/post BER and PER/UCB stats 8b8e444a2711 [media] mb86a20s: Don't reset strength with the other stats 15b1c5a068e7 [media] mb86a20s: provide CNR stats before FE_HAS_SYNC -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/5] lmedm04: add read snr, signal strength and ber call backs
On 03/02/15 19:31, Malcolm Priestley wrote: On 03/02/15 19:19, Mauro Carvalho Chehab wrote: Em Fri, 2 Jan 2015 13:56:31 + Malcolm Priestley tvbox...@gmail.com escreveu: This allows calling the original functions providing the streaming is off. Malcolm, I'm applying this patch series, as the driver has already some support for the legacy DVBv3 stats, but please port it to use DVBv5. Hi Mauro, I am not sure what you mean by this? Are there any examples? Sorry, Yes I see how, will do. Regards Malcolm Thanks, Mauro Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 24 1 file changed, 24 insertions(+) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index a9c7fd0..5de6f7c 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -145,6 +145,10 @@ struct lme2510_state { void *usb_buffer; /* Frontend original calls */ int (*fe_read_status)(struct dvb_frontend *, fe_status_t *); +int (*fe_read_signal_strength)(struct dvb_frontend *, u16 *); +int (*fe_read_snr)(struct dvb_frontend *, u16 *); +int (*fe_read_ber)(struct dvb_frontend *, u32 *); +int (*fe_read_ucblocks)(struct dvb_frontend *, u32 *); int (*fe_set_voltage)(struct dvb_frontend *, fe_sec_voltage_t); u8 dvb_usb_lme2510_firmware; }; @@ -877,6 +881,9 @@ static int dm04_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { struct lme2510_state *st = fe_to_priv(fe); +if (st-fe_read_signal_strength !st-stream_on) +return st-fe_read_signal_strength(fe, strength); + switch (st-tuner_config) { case TUNER_LG: *strength = 0xff - st-signal_level; @@ -898,6 +905,9 @@ static int dm04_read_snr(struct dvb_frontend *fe, u16 *snr) { struct lme2510_state *st = fe_to_priv(fe); +if (st-fe_read_snr !st-stream_on) +return st-fe_read_snr(fe, snr); + switch (st-tuner_config) { case TUNER_LG: *snr = 0xff - st-signal_sn; @@ -917,6 +927,11 @@ static int dm04_read_snr(struct dvb_frontend *fe, u16 *snr) static int dm04_read_ber(struct dvb_frontend *fe, u32 *ber) { +struct lme2510_state *st = fe_to_priv(fe); + +if (st-fe_read_ber !st-stream_on) +return st-fe_read_ber(fe, ber); + *ber = 0; return 0; @@ -924,6 +939,11 @@ static int dm04_read_ber(struct dvb_frontend *fe, u32 *ber) static int dm04_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) { +struct lme2510_state *st = fe_to_priv(fe); + +if (st-fe_read_ucblocks !st-stream_on) +return st-fe_read_ucblocks(fe, ucblocks); + *ucblocks = 0; return 0; @@ -1036,6 +1056,10 @@ static int dm04_lme2510_frontend_attach(struct dvb_usb_adapter *adap) } st-fe_read_status = adap-fe[0]-ops.read_status; +st-fe_read_signal_strength = adap-fe[0]-ops.read_signal_strength; +st-fe_read_snr = adap-fe[0]-ops.read_snr; +st-fe_read_ber = adap-fe[0]-ops.read_ber; +st-fe_read_ucblocks = adap-fe[0]-ops.read_ucblocks; adap-fe[0]-ops.read_status = dm04_read_status; adap-fe[0]-ops.read_signal_strength = dm04_read_signal_strength; -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/5] lmedm04: Create frontend call back for read status.
Create dm04_read_status to check lock through either interrupt values or directly by the call back. When the device is not streaming the frontends original call back is used. When streaming has started it turns off I2C messaging by setting st-i2c_talk_onoff to zero. I2C can only be turn on again by one of the other allowed frontend calls. All old code is removed from lme2510_msg and this function only needs to set st-i2c_talk_onoff to 1. The lock status is saved and when the frondend is locked is maintained by lme2510_int_response who will now just kill the lock. The call back for rs2000 tuner is nologer required. All frontend types have been tested. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 205 ++--- 1 file changed, 60 insertions(+), 145 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 55d7690..a9c7fd0 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -126,9 +126,9 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); struct lme2510_state { unsigned long int_urb_due; + fe_status_t lock_status; u8 id; u8 tuner_config; - u8 signal_lock; u8 signal_level; u8 signal_sn; u8 time_key; @@ -143,6 +143,8 @@ struct lme2510_state { void *buffer; struct urb *lme_urb; void *usb_buffer; + /* Frontend original calls */ + int (*fe_read_status)(struct dvb_frontend *, fe_status_t *); int (*fe_set_voltage)(struct dvb_frontend *, fe_sec_voltage_t); u8 dvb_usb_lme2510_firmware; }; @@ -258,6 +260,7 @@ static void lme2510_int_response(struct urb *lme_urb) static u8 *ibuf, *rbuf; int i = 0, offset; u32 key; + u8 signal_lock = 0; switch (lme_urb-status) { case 0: @@ -298,8 +301,7 @@ static void lme2510_int_response(struct urb *lme_urb) case 0xbb: switch (st-tuner_config) { case TUNER_LG: - if (ibuf[2] 0) - st-signal_lock = ibuf[2]; + signal_lock = ibuf[2] BIT(5); st-signal_level = ibuf[4]; st-signal_sn = ibuf[3]; st-time_key = ibuf[7]; @@ -308,29 +310,29 @@ static void lme2510_int_response(struct urb *lme_urb) case TUNER_S0194: /* Tweak for earlier firmware*/ if (ibuf[1] == 0x03) { - if (ibuf[2] 1) - st-signal_lock = ibuf[2]; + signal_lock = ibuf[2] BIT(4); st-signal_level = ibuf[3]; st-signal_sn = ibuf[4]; } else { st-signal_level = ibuf[4]; st-signal_sn = ibuf[5]; - st-signal_lock = - (st-signal_lock 0xf7) + - ((ibuf[2] 0x01) 0x03); } break; case TUNER_RS2000: - if (ibuf[2] 0x1) - st-signal_lock = 0xff; - else - st-signal_lock = 0x00; + signal_lock = ibuf[2] 0xee; st-signal_level = ibuf[5]; st-signal_sn = ibuf[4]; st-time_key = ibuf[7]; default: break; } + + /* Interrupt will also throw just BIT 0 as lock */ + signal_lock |= ibuf[2] BIT(0); + + if (!signal_lock) + st-lock_status = ~FE_HAS_LOCK; + debug_data_snipet(5, INT Remote data snipet in, ibuf); break; case 0xcc: @@ -457,124 +459,13 @@ static int lme2510_return_status(struct dvb_usb_device *d) static int lme2510_msg(struct dvb_usb_device *d, u8 *wbuf, int wlen, u8 *rbuf, int rlen) { - int ret = 0; struct lme2510_state *st = d-priv; - if (st-i2c_talk_onoff == 1) { - - ret = lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen); - - switch (st-tuner_config) { - case TUNER_LG: - if (wbuf[2] == 0x1c) { - if (wbuf[3] == 0x0e
[PATCH 3/5] lmedm04: create frontend callbacks for signal/snr/ber/ucblocks
Create call backs dm04_read_signal_strength, dm04_read_snr and move dm04_read_ber and dm04_read_ucblocks for all frontends Removing the I2C filtering from lme2510_msg and the old rs2000 callbacks. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 93 -- 1 file changed, 33 insertions(+), 60 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 15db9f6..55d7690 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -515,21 +515,6 @@ static int lme2510_msg(struct dvb_usb_device *d, rbuf[0] = 0x55; rbuf[1] = st-signal_lock; break; - case 0x43: - rbuf[0] = 0x55; - rbuf[1] = st-signal_level; - break; - case 0x1c: - rbuf[0] = 0x55; - rbuf[1] = st-signal_sn; - break; - case 0x15: - case 0x16: - case 0x17: - case 0x18: - rbuf[0] = 0x55; - rbuf[1] = 0x00; - break; default: lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen); st-i2c_talk_onoff = 1; @@ -538,25 +523,10 @@ static int lme2510_msg(struct dvb_usb_device *d, break; case TUNER_S7395: switch (wbuf[3]) { - case 0x10: - rbuf[0] = 0x55; - rbuf[1] = (st-signal_level 0x80) - ? 0 : (st-signal_level * 2); - break; - case 0x2d: - rbuf[0] = 0x55; - rbuf[1] = st-signal_sn; - break; case 0x24: rbuf[0] = 0x55; rbuf[1] = st-signal_lock; break; - case 0x2e: - case 0x26: - case 0x27: - rbuf[0] = 0x55; - rbuf[1] = 0x00; - break; default: lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen); st-i2c_talk_onoff = 1; @@ -565,26 +535,10 @@ static int lme2510_msg(struct dvb_usb_device *d, break; case TUNER_S0194: switch (wbuf[3]) { - case 0x18: - rbuf[0] = 0x55; - rbuf[1] = (st-signal_level 0x80) - ? 0 : (st-signal_level * 2); - break; - case 0x24: - rbuf[0] = 0x55; - rbuf[1] = st-signal_sn; - break; case 0x1b: rbuf[0] = 0x55; rbuf[1] = st-signal_lock; break; - case 0x19: - case 0x25: - case 0x1e: - case 0x1d: - rbuf[0] = 0x55; - rbuf[1] = 0x00; - break; default: lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen); st-i2c_talk_onoff = 1; @@ -1006,21 +960,44 @@ static int dm04_lme2510_set_voltage(struct dvb_frontend *fe, return (ret 0) ? -ENODEV : 0; } -static int dm04_rs2000_read_signal_strength(struct dvb_frontend *fe, - u16 *strength) +static int dm04_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { struct lme2510_state *st = fe_to_priv(fe); - *strength = (u16)((u32)st-signal_level * 0x / 0xff); + switch (st-tuner_config) { + case TUNER_LG: + *strength = 0xff - st-signal_level; + *strength |= *strength 8; + break; + /* fall through */ + case TUNER_S7395: + case TUNER_S0194: + *strength = 0x - (((st-signal_level * 2) 8) * 5 / 4); + break; + case TUNER_RS2000: + *strength = (u16)((u32)st-signal_level * 0x / 0xff); + } return 0; } -static int
[PATCH 5/5] lmedm04: add read snr, signal strength and ber call backs
This allows calling the original functions providing the streaming is off. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 24 1 file changed, 24 insertions(+) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index a9c7fd0..5de6f7c 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -145,6 +145,10 @@ struct lme2510_state { void *usb_buffer; /* Frontend original calls */ int (*fe_read_status)(struct dvb_frontend *, fe_status_t *); + int (*fe_read_signal_strength)(struct dvb_frontend *, u16 *); + int (*fe_read_snr)(struct dvb_frontend *, u16 *); + int (*fe_read_ber)(struct dvb_frontend *, u32 *); + int (*fe_read_ucblocks)(struct dvb_frontend *, u32 *); int (*fe_set_voltage)(struct dvb_frontend *, fe_sec_voltage_t); u8 dvb_usb_lme2510_firmware; }; @@ -877,6 +881,9 @@ static int dm04_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { struct lme2510_state *st = fe_to_priv(fe); + if (st-fe_read_signal_strength !st-stream_on) + return st-fe_read_signal_strength(fe, strength); + switch (st-tuner_config) { case TUNER_LG: *strength = 0xff - st-signal_level; @@ -898,6 +905,9 @@ static int dm04_read_snr(struct dvb_frontend *fe, u16 *snr) { struct lme2510_state *st = fe_to_priv(fe); + if (st-fe_read_snr !st-stream_on) + return st-fe_read_snr(fe, snr); + switch (st-tuner_config) { case TUNER_LG: *snr = 0xff - st-signal_sn; @@ -917,6 +927,11 @@ static int dm04_read_snr(struct dvb_frontend *fe, u16 *snr) static int dm04_read_ber(struct dvb_frontend *fe, u32 *ber) { + struct lme2510_state *st = fe_to_priv(fe); + + if (st-fe_read_ber !st-stream_on) + return st-fe_read_ber(fe, ber); + *ber = 0; return 0; @@ -924,6 +939,11 @@ static int dm04_read_ber(struct dvb_frontend *fe, u32 *ber) static int dm04_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) { + struct lme2510_state *st = fe_to_priv(fe); + + if (st-fe_read_ucblocks !st-stream_on) + return st-fe_read_ucblocks(fe, ucblocks); + *ucblocks = 0; return 0; @@ -1036,6 +1056,10 @@ static int dm04_lme2510_frontend_attach(struct dvb_usb_adapter *adap) } st-fe_read_status = adap-fe[0]-ops.read_status; + st-fe_read_signal_strength = adap-fe[0]-ops.read_signal_strength; + st-fe_read_snr = adap-fe[0]-ops.read_snr; + st-fe_read_ber = adap-fe[0]-ops.read_ber; + st-fe_read_ucblocks = adap-fe[0]-ops.read_ucblocks; adap-fe[0]-ops.read_status = dm04_read_status; adap-fe[0]-ops.read_signal_strength = dm04_read_signal_strength; -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/5] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb
A quirk of some older firmwares that report endpoint pipe type as PIPE_BULK but the endpoint otheriwse functions as interrupt. Check if usb_endpoint_type is USB_ENDPOINT_XFER_BULK and set as usb_rcvbulkpipe. Signed-off-by: Malcolm Priestley tvbox...@gmail.com Cc: sta...@vger.kernel.org --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index f1edb29..15db9f6 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -354,6 +354,7 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) { struct dvb_usb_device *d = adap_to_d(adap); struct lme2510_state *lme_int = adap_to_priv(adap); + struct usb_host_endpoint *ep; lme_int-lme_urb = usb_alloc_urb(0, GFP_ATOMIC); @@ -375,6 +376,12 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) adap, 8); + /* Quirk of pipe reporting PIPE_BULK but behaves as interrupt */ + ep = usb_pipe_endpoint(d-udev, lme_int-lme_urb-pipe); + + if (usb_endpoint_type(ep-desc) == USB_ENDPOINT_XFER_BULK) + lme_int-lme_urb-pipe = usb_rcvbulkpipe(d-udev, 0xa), + lme_int-lme_urb-transfer_flags |= URB_NO_TRANSFER_DMA_MAP; usb_submit_urb(lme_int-lme_urb, GFP_ATOMIC); -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/5] lmedm04: Increase Interupt due time to 200 msec.
Ocassionally the device fails to report back an interrupt urb status which results in false no lock trigger on the RS2000 demodulator. Increase time from 60 msecs to 200 msecs. Signed-off-by: Malcolm Priestley tvbox...@gmail.com Cc: sta...@vger.kernel.org # v3.17+ --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 994de53..f1edb29 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -344,9 +344,10 @@ static void lme2510_int_response(struct urb *lme_urb) usb_submit_urb(lme_urb, GFP_ATOMIC); - /* interrupt urb is due every 48 msecs while streaming -* add 12msecs for system lag */ - st-int_urb_due = jiffies + msecs_to_jiffies(60); + /* Interrupt urb is due every 48 msecs while streaming the buffer +* stores up to 4 periods if missed. Allow 200 msec for next interrupt. +*/ + st-int_urb_due = jiffies + msecs_to_jiffies(200); } static int lme2510_int_read(struct dvb_usb_adapter *adap) -- 2.1.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] [media] lmed04: add missing breaks
On 25/11/14 11:19, Mauro Carvalho Chehab wrote: drivers/media/usb/dvb-usb-v2/lmedm04.c:828 lme_firmware_switch() warn: missing break? reassigning 'st-dvb_usb_lme2510_firmware' drivers/media/usb/dvb-usb-v2/lmedm04.c:849 lme_firmware_switch() warn: missing break? reassigning 'st-dvb_usb_lme2510_firmware' Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 9f2c5459b73a..99587418f4f0 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -826,6 +826,7 @@ static const char *lme_firmware_switch(struct dvb_usb_device *d, int cold) break; } st-dvb_usb_lme2510_firmware = TUNER_LG; + break; case TUNER_LG: fw_lme = fw_lg; ret = request_firmware(fw, fw_lme, udev-dev); @@ -847,6 +848,7 @@ static const char *lme_firmware_switch(struct dvb_usb_device *d, int cold) break; } st-dvb_usb_lme2510_firmware = TUNER_LG; + break; case TUNER_LG: fw_lme = fw_c_lg; ret = request_firmware(fw, fw_lme, udev-dev); The break is not missing it's three lines above. All these switches are fall through until it finds firmware the user has. The switch comes into play when the firmware needs to changed. Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] [media] lmed04: add missing breaks
On 25/11/14 18:00, Mauro Carvalho Chehab wrote: Em Tue, 25 Nov 2014 17:10:00 + Malcolm Priestley malcolmpriest...@gmail.com escreveu: On 25/11/14 11:19, Mauro Carvalho Chehab wrote: drivers/media/usb/dvb-usb-v2/lmedm04.c:828 lme_firmware_switch() warn: missing break? reassigning 'st-dvb_usb_lme2510_firmware' drivers/media/usb/dvb-usb-v2/lmedm04.c:849 lme_firmware_switch() warn: missing break? reassigning 'st-dvb_usb_lme2510_firmware' Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 9f2c5459b73a..99587418f4f0 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -826,6 +826,7 @@ static const char *lme_firmware_switch(struct dvb_usb_device *d, int cold) break; } st-dvb_usb_lme2510_firmware = TUNER_LG; + break; case TUNER_LG: fw_lme = fw_lg; ret = request_firmware(fw, fw_lme, udev-dev); @@ -847,6 +848,7 @@ static const char *lme_firmware_switch(struct dvb_usb_device *d, int cold) break; } st-dvb_usb_lme2510_firmware = TUNER_LG; + break; case TUNER_LG: fw_lme = fw_c_lg; ret = request_firmware(fw, fw_lme, udev-dev); The break is not missing it's three lines above. All these switches are fall through until it finds firmware the user has. The switch comes into play when the firmware needs to changed. Oh! Well, I was so sure that the patch was right that I merged it already. My bad. Anyway, smatch complains if dvb_usb_lme2510_firmware is rewritten, and that bothers people that use static analyzers. So, IMO, the best is to rework the code in order to: - document that the breaks should not be used there; - remove smatch warning. What do you think about the following patch? Fine Acked-by: Malcolm Priestley tvbox...@gmail.com -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: em28xx: Hauppauge HVR 900 on 3.18.0-rc3
On 06/11/14 06:51, Michal B wrote: Hi, analog TV on Hauppauge HVR 900 [2040:6500] - audio works correctly but video stops after few samples, audio continues after video stop, H Michal Yep, pretty much the same for all 3.18 and rc3 One of my systems freezes the other no video. All the drivers appear to be doing the same. 3.17.2 is fine. It appears to be a video overlay problem, only start to panic if at rc6 Regards Malcolm tested: mplayer tv:// -tv norm=PAL-BG:freq=687.5:input=0:device=/dev/video0:alsa:amode=1:adevice=hw.2,0:audiorate=48000:forceaudio:immediatemode=0 -hardframedrop -ao alsa -vo x11 mplayer output: MPlayer svn r34540 (Debian), built with gcc-4.7 (C) 2000-2012 MPlayer Team mplayer: could not connect to socket mplayer: No such file or directory Failed to open LIRC support. You will not be able to use your remote control. Playing tv://. TV file format detected. Selected driver: v4l2 name: Video 4 Linux 2 input author: Martin Olschewski olschew...@zpr.uni-koeln.de comment: first try, more to come ;-) Selected device: Hauppauge WinTV HVR 900 Tuner cap: Tuner rxs: Capabilities: video capture VBI capture device tuner audio read/write streaming supported norms: 0 = NTSC; 1 = NTSC-M; 2 = NTSC-M-JP; 3 = NTSC-M-KR; 4 = NTSC-443; 5 = PAL; 6 = PAL-BG; 7 = PAL-H; 8 = PAL-I; 9 = PAL-DK; 10 = PAL-M; 11 = PAL-N; 12 = PAL-Nc; 13 = PAL-60; 14 = SECAM; 15 = SECAM-B; 16 = SECAM-G; 17 = SECAM-H; 18 = SECAM-DK; 19 = SECAM-L; 20 = SECAM-Lc; inputs: 0 = Television; 1 = Composite1; 2 = S-Video; Current input: 0 Current format: YUYV v4l2: current audio mode is : STEREO v4l2: ioctl set format failed: Invalid argument v4l2: ioctl set format failed: Invalid argument v4l2: ioctl set format failed: Invalid argument == Opening video decoder: [raw] RAW Uncompressed Video Could not find matching colorspace - retrying with -vf scale... Opening video filter: [scale] Movie-Aspect is undefined - no prescaling applied. [swscaler @ 0x13c7d40] BICUBIC scaler, from yuyv422 to bgra using MMX2 VO: [x11] 720x576 = 720x576 BGRA Selected video codec: [rawyuy2] vfm: raw (RAW YUY2) == == Opening audio decoder: [pcm] Uncompressed PCM audio decoder AUDIO: 48000 Hz, 2 ch, s16le, 1536.0 kbit/100.00% (ratio: 192000-192000) Selected audio codec: [pcm] afm: pcm (Uncompressed PCM) == AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample) Starting playback... A: 3.1 V: 1.6 A-V: 1.447 ct: 0.165 92/ 92 0% 8% 28.8% 50 0 Your system is too SLOW to play this! Possible reasons, problems, workarounds: - Most common: broken/buggy _audio_ driver - Try -ao sdl or use the OSS emulation of ALSA. - Experiment with different values for -autosync, 30 is a good start. - Slow video output - Try a different -vo driver (-vo help for a list) or try -framedrop! - Slow CPU - Don't try to play a big DVD/DivX on a slow CPU! Try some of the lavdopts, e.g. -vfm ffmpeg -lavdopts lowres=1:fast:skiploopfilter=all. - Broken file - Try various combinations of -nobps -ni -forceidx -mc 0. - Slow media (NFS/SMB mounts, DVD, VCD etc) - Try -cache 8192. - Are you using -cache to play a non-interleaved AVI file? - Try -nocache. Read DOCS/HTML/en/video.html for tuning/speedup tips. If none of this helps you, read DOCS/HTML/en/bugreports.html. A: 11.7 V: 5.1 A-V: 6.636 ct: 0.250 308/308 0% 2% 12.9% 266 0 v4l2: 310 frames successfully processed, 0 frames dropped. kernel output: [ 427.441405] usb 3-13.5.5: new high-speed USB device number 9 using xhci_hcd [ 427.534116] usb 3-13.5.5: New USB device found, idVendor=2040, idProduct=6500 [ 427.534126] usb 3-13.5.5: New USB device strings: Mfr=0, Product=1, SerialNumber=2 [ 427.534131] usb 3-13.5.5: Product: WinTV HVR-900 [ 427.534136] usb 3-13.5.5: SerialNumber: 4026875858 [ 427.586621] media: Linux media interface: v0.10 [ 427.625926] Linux video capture interface: v2.00 [ 427.669943] em28xx: New device WinTV HVR-900 @ 480 Mbps (2040:6500, interface 0, class 0) [ 427.669945] em28xx: Video interface 0 found: isoc [ 427.669946] em28xx: DVB interface 0 found: isoc [ 427.669973] em28xx: chip ID is em2882/3 [ 427.838493] em2882/3 #0: EEPROM ID = 1a eb 67 95, EEPROM hash = 0x43a734dd [ 427.838499] em2882/3 #0: EEPROM info: [ 427.838503] em2882/3 #0: AC97 audio (5 sample rates) [ 427.838506] em2882/3 #0: 500mA max power [ 427.838510] em2882/3 #0: Table at offset 0x24, strings=0x1e82, 0x186a, 0x [ 427.838515] em2882/3 #0: Identified as Hauppauge WinTV HVR 900 (card=10) [ 427.840708] tveeprom 7-0050:
Re: [PATCH v2 1/5] dvb-core: add a new tuner ops to dvb_frontend for APIv5
On 07/09/14 00:38, Antti Palosaari wrote: On 09/07/2014 01:37 AM, Mauro Carvalho Chehab wrote: Em Sat, 06 Sep 2014 22:37:21 +0100 Malcolm Priestley tvbox...@gmail.com escreveu: On 06/09/14 17:24, Malcolm Priestley wrote: On 06/09/14 03:51, Mauro Carvalho Chehab wrote: Em Sat, 06 Sep 2014 05:09:55 +0300 Antti Palosaari cr...@iki.fi escreveu: Moro! On 08/29/2014 01:45 PM, Akihiro TSUKADA wrote: moikka, Start polling thread, which polls once per 2 sec or so, which reads RSSI and writes value to struct dtv_frontend_properties. That it is, in my understanding. Same for all those DVBv5 stats. Mauro knows better as he designed that functionality. I understand that RSSI property should be set directly in the tuner driver, but I'm afraid that creating a kthread just for updating RSSI would be overkill and complicate matters. Would you give me an advice? Mauro Now I know that as I implement it. I added kthread and it works correctly, just I though it is aimed to work. In my case signal strength is reported by demod, not tuner, because there is some logic in firmware to calculate it. Here is patches you would like to look as a example: af9033: implement DVBv5 statistic for signal strength https://patchwork.linuxtv.org/patch/25748/ Actually, you don't need to add a separate kthread to collect the stats. The DVB frontend core already has a thread that calls the frontend status on every 3 seconds (the time can actually be different, depending on the value for fepriv-delay. So, if the device doesn't have any issues on getting stats on this period, it could just hook the DVBv5 stats logic at ops.read_status(). Hmm, fepriv-delay missed that one, 3 seconds is far too long for lmedm04. The only way change this is by using algo DVBFE_ALGO_HW using the frontend ops tune. As most frontends are using dvb_frontend_swzigzag it could be implemented by patching the frontend ops tune code at the lock return in this function or in dvb_frontend_swzigzag_update_delay. Well, if a different value is needed, it shouldn't be hard to add a way to customize it, letting the demod to specify it, in the same way as fe-ops.info.frequency_stepsize (and other similar demot properties) are passed through the core. DVBFE_ALGO_SW, which is used normally, polls read_status rather rapidly. For statics problem is that it is too rapid, not that it is too slow. If you want re-use that as a timer for statistics, you could simply make own ratelimit very easily using kernel jiffies. The default starts off at 50msec and gradually rises to around 950msec. There is another way to set fepriv-delay that is in ops-get_tune_settings dvb_frontend_tune_settings-min_delay_ms. The delay increases by around 900msec on top of the value set there. In the case of lmedm04/m88rs2000 that why I am seeing 3 sec. Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/5] dvb-core: add a new tuner ops to dvb_frontend for APIv5
On 06/09/14 03:51, Mauro Carvalho Chehab wrote: Em Sat, 06 Sep 2014 05:09:55 +0300 Antti Palosaari cr...@iki.fi escreveu: Moro! On 08/29/2014 01:45 PM, Akihiro TSUKADA wrote: moikka, Start polling thread, which polls once per 2 sec or so, which reads RSSI and writes value to struct dtv_frontend_properties. That it is, in my understanding. Same for all those DVBv5 stats. Mauro knows better as he designed that functionality. I understand that RSSI property should be set directly in the tuner driver, but I'm afraid that creating a kthread just for updating RSSI would be overkill and complicate matters. Would you give me an advice? Mauro Now I know that as I implement it. I added kthread and it works correctly, just I though it is aimed to work. In my case signal strength is reported by demod, not tuner, because there is some logic in firmware to calculate it. Here is patches you would like to look as a example: af9033: implement DVBv5 statistic for signal strength https://patchwork.linuxtv.org/patch/25748/ Actually, you don't need to add a separate kthread to collect the stats. The DVB frontend core already has a thread that calls the frontend status on every 3 seconds (the time can actually be different, depending on the value for fepriv-delay. So, if the device doesn't have any issues on getting stats on this period, it could just hook the DVBv5 stats logic at ops.read_status(). Hmm, fepriv-delay missed that one, 3 seconds is far too long for lmedm04. It would be good to hook stats on to this thread. Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/5] dvb-core: add a new tuner ops to dvb_frontend for APIv5
On 06/09/14 17:24, Malcolm Priestley wrote: On 06/09/14 03:51, Mauro Carvalho Chehab wrote: Em Sat, 06 Sep 2014 05:09:55 +0300 Antti Palosaari cr...@iki.fi escreveu: Moro! On 08/29/2014 01:45 PM, Akihiro TSUKADA wrote: moikka, Start polling thread, which polls once per 2 sec or so, which reads RSSI and writes value to struct dtv_frontend_properties. That it is, in my understanding. Same for all those DVBv5 stats. Mauro knows better as he designed that functionality. I understand that RSSI property should be set directly in the tuner driver, but I'm afraid that creating a kthread just for updating RSSI would be overkill and complicate matters. Would you give me an advice? Mauro Now I know that as I implement it. I added kthread and it works correctly, just I though it is aimed to work. In my case signal strength is reported by demod, not tuner, because there is some logic in firmware to calculate it. Here is patches you would like to look as a example: af9033: implement DVBv5 statistic for signal strength https://patchwork.linuxtv.org/patch/25748/ Actually, you don't need to add a separate kthread to collect the stats. The DVB frontend core already has a thread that calls the frontend status on every 3 seconds (the time can actually be different, depending on the value for fepriv-delay. So, if the device doesn't have any issues on getting stats on this period, it could just hook the DVBv5 stats logic at ops.read_status(). Hmm, fepriv-delay missed that one, 3 seconds is far too long for lmedm04. It would be good to hook stats on to this thread. optional that is. -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/5] dvb-core: add a new tuner ops to dvb_frontend for APIv5
On 06/09/14 17:24, Malcolm Priestley wrote: On 06/09/14 03:51, Mauro Carvalho Chehab wrote: Em Sat, 06 Sep 2014 05:09:55 +0300 Antti Palosaari cr...@iki.fi escreveu: Moro! On 08/29/2014 01:45 PM, Akihiro TSUKADA wrote: moikka, Start polling thread, which polls once per 2 sec or so, which reads RSSI and writes value to struct dtv_frontend_properties. That it is, in my understanding. Same for all those DVBv5 stats. Mauro knows better as he designed that functionality. I understand that RSSI property should be set directly in the tuner driver, but I'm afraid that creating a kthread just for updating RSSI would be overkill and complicate matters. Would you give me an advice? Mauro Now I know that as I implement it. I added kthread and it works correctly, just I though it is aimed to work. In my case signal strength is reported by demod, not tuner, because there is some logic in firmware to calculate it. Here is patches you would like to look as a example: af9033: implement DVBv5 statistic for signal strength https://patchwork.linuxtv.org/patch/25748/ Actually, you don't need to add a separate kthread to collect the stats. The DVB frontend core already has a thread that calls the frontend status on every 3 seconds (the time can actually be different, depending on the value for fepriv-delay. So, if the device doesn't have any issues on getting stats on this period, it could just hook the DVBv5 stats logic at ops.read_status(). Hmm, fepriv-delay missed that one, 3 seconds is far too long for lmedm04. The only way change this is by using algo DVBFE_ALGO_HW using the frontend ops tune. As most frontends are using dvb_frontend_swzigzag it could be implemented by patching the frontend ops tune code at the lock return in this function or in dvb_frontend_swzigzag_update_delay. Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] af9035: new IDs: add support for PCTV 78e and PCTV 79e
add the following IDs USB_PID_PCTV_78E (0x025a) for PCTV 78e USB_PID_PCTV_79E (0x0262) for PCTV 79e For these it9135 devices. Signed-off-by: Malcolm Priestley tvbox...@gmail.com Cc: Antti Palosaari cr...@iki.fi Cc: sta...@vger.kernel.org # v3.14+ --- drivers/media/dvb-core/dvb-usb-ids.h | 2 ++ drivers/media/usb/dvb-usb-v2/af9035.c | 4 2 files changed, 6 insertions(+) diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h index 5135a09..12ce19c 100644 --- a/drivers/media/dvb-core/dvb-usb-ids.h +++ b/drivers/media/dvb-core/dvb-usb-ids.h @@ -280,6 +280,8 @@ #define USB_PID_PCTV_400E 0x020f #define USB_PID_PCTV_450E 0x0222 #define USB_PID_PCTV_452E 0x021f +#define USB_PID_PCTV_78E 0x025a +#define USB_PID_PCTV_79E 0x0262 #define USB_PID_REALTEK_RTL2831U 0x2831 #define USB_PID_REALTEK_RTL2832U 0x2832 #define USB_PID_TECHNOTREND_CONNECT_S2_36000x3007 diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 75ec1c6..c82beac 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -1575,6 +1575,10 @@ static const struct usb_device_id af9035_id_table[] = { af9035_props, Leadtek WinFast DTV Dongle Dual, NULL) }, { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xf900, af9035_props, Hauppauge WinTV-MiniStick 2, NULL) }, + { DVB_USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_78E, + af9035_props, PCTV 78e, RC_MAP_IT913X_V1) }, + { DVB_USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_79E, + af9035_props, PCTV 79e, RC_MAP_IT913X_V2) }, { } }; MODULE_DEVICE_TABLE(usb, af9035_id_table); -- 2.0.1 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] lmedm04: rs2000 check if interrupt urb is over due
Change handling of signal_lock on rs2000. Use ibuf[2] to detect lock as there is a longer wait for lock to appear in ibuf[6]. Remove last_key and key_timeout and use jiffies plus 60ms to detect that streaming is still active. If the current jiffies is time_after the interrupt urb overdue and clear signal lock. This results in far faster recovery of lock and streaming. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 25 ++--- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index f674dc0..7d685bc 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -125,14 +125,13 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); #define TUNER_RS2000 0x4 struct lme2510_state { + unsigned long int_urb_due; u8 id; u8 tuner_config; u8 signal_lock; u8 signal_level; u8 signal_sn; u8 time_key; - u8 last_key; - u8 key_timeout; u8 i2c_talk_onoff; u8 i2c_gate; u8 i2c_tuner_gate_w; @@ -323,7 +322,7 @@ static void lme2510_int_response(struct urb *lme_urb) } break; case TUNER_RS2000: - if (ibuf[1] == 0x3 ibuf[6] == 0xff) + if (ibuf[2] 0x1) st-signal_lock = 0xff; else st-signal_lock = 0x00; @@ -343,7 +342,12 @@ static void lme2510_int_response(struct urb *lme_urb) break; } } + usb_submit_urb(lme_urb, GFP_ATOMIC); + + /* interrupt urb is due every 48 msecs while streaming +* add 12msecs for system lag */ + st-int_urb_due = jiffies + msecs_to_jiffies(60); } static int lme2510_int_read(struct dvb_usb_adapter *adap) @@ -584,14 +588,13 @@ static int lme2510_msg(struct dvb_usb_device *d, switch (wbuf[3]) { case 0x8c: rbuf[0] = 0x55; - rbuf[1] = 0xff; - if (st-last_key == st-time_key) { - st-key_timeout++; - if (st-key_timeout 5) - rbuf[1] = 0; - } else - st-key_timeout = 0; - st-last_key = st-time_key; + rbuf[1] = st-signal_lock; + + /* If int_urb_due overdue +* set rbuf[1] to 0 to clear lock */ + if (time_after(jiffies, st-int_urb_due)) + rbuf[1] = 0; + break; default: lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen); -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: lmedm04 NEC scancode question
On 28/03/14 00:38, David Härdeman wrote: Hi Malcolm, Hi David I'm trying to make sure that the extended NEC parsing is consistent across drivers and I have a question regarding drivers/media/usb/dvb-usb-v2/lmedm04.c In commit 616a4b83 you changed the scancode from something like this: ibuf[2] 24 | ibuf[3] 16 | ibuf[4] 8 | ibuf[5] into: if ((ibuf[4] + ibuf[5]) == 0xff) { key = ibuf[5]; key += (ibuf[3] 0) ? (ibuf[3] ^ 0xff) 8 : 0; key += (ibuf[2] ^ 0xff) 16; which can be written as: (ibuf[2] ^ 0xff) 16 | (ibuf[3] 0) ? (ibuf[3] ^ 0xff) 8 : 0 | ibuf[5] At the same time the keymap was changed from (one example from each type): 0xef12ba45 = KEY_0 0xff40ea15 = KEY_0 0xff00e31c = KEY_0 These original key maps need to restored for 32 bit. into: 0x10ed45 = KEY_0 (0x10ed = ~0xef12; 0x45 = ~0xba) 0xbf15 = KEY_0 (0xbf = 0x00bf = ~0xff40; 0x15 = ~0xea) 0x1c = KEY_0 (0x1c = 0x001c; this is a NEC16 coding?) Bits 8~23 are inverted on the key map because they are shifted 8. Bits 8~15 are removed from the scan code. I am assuming (given the ^ 0xff) that the hardware sends inverted bytes? And that the reason ibuf[5] does not need ^ 0xff is that it already is the inverted command (i.e. ibuf[5] == ~ibuf[4]). To put it differently: ibuf[2] = ~addr = not_addr; ibuf[3] = ~not_addr = addr; ibuf[4] = ~cmd = not_cmd; ibuf[5] = ~not_cmd = cmd; And the scancode can then be understood as: addr 16 | not_addr 8 | cmd Except for when addr = 0x00 in which case the scancode is simply NEC16: 0x00 8 | cmd Is my interpretation correct? No inverting. At the time of the patch I couldn't get the 32 bit code to work correctly on rc_core so it was assumed to be 24 bit. I have tested the patch series... Is there a patch missing? I get build error from ati_remote.c and imon.c error: too few arguments to function 'rc_g_keycode_from_table' Anyway, I removed the errors. Just needs the inverting removed and the original 32 bit key maps to work. Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] m88rs2000: fix sparse static warnings.
warnings m88rs2000.c:300:16: warning: symbol 'm88rs2000_setup' was not declared. Should it be static? m88rs2000.c:318:16: warning: symbol 'm88rs2000_shutdown' was not declared. Should it be static? m88rs2000.c:328:16: warning: symbol 'fe_reset' was not declared. Should it be static? m88rs2000.c:366:16: warning: symbol 'fe_trigger' was not declared. Should it be static? Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/dvb-frontends/m88rs2000.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c index 32cffca..d63bc9c 100644 --- a/drivers/media/dvb-frontends/m88rs2000.c +++ b/drivers/media/dvb-frontends/m88rs2000.c @@ -297,7 +297,7 @@ struct inittab { u8 val; }; -struct inittab m88rs2000_setup[] = { +static struct inittab m88rs2000_setup[] = { {DEMOD_WRITE, 0x9a, 0x30}, {DEMOD_WRITE, 0x00, 0x01}, {WRITE_DELAY, 0x19, 0x00}, @@ -315,7 +315,7 @@ struct inittab m88rs2000_setup[] = { {0xff, 0xaa, 0xff} }; -struct inittab m88rs2000_shutdown[] = { +static struct inittab m88rs2000_shutdown[] = { {DEMOD_WRITE, 0x9a, 0x30}, {DEMOD_WRITE, 0xb0, 0x00}, {DEMOD_WRITE, 0xf1, 0x89}, @@ -325,7 +325,7 @@ struct inittab m88rs2000_shutdown[] = { {0xff, 0xaa, 0xff} }; -struct inittab fe_reset[] = { +static struct inittab fe_reset[] = { {DEMOD_WRITE, 0x00, 0x01}, {DEMOD_WRITE, 0x20, 0x81}, {DEMOD_WRITE, 0x21, 0x80}, @@ -363,7 +363,7 @@ struct inittab fe_reset[] = { {0xff, 0xaa, 0xff} }; -struct inittab fe_trigger[] = { +static struct inittab fe_trigger[] = { {DEMOD_WRITE, 0x97, 0x04}, {DEMOD_WRITE, 0x99, 0x77}, {DEMOD_WRITE, 0x9b, 0x64}, -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/4] MAINTAINERS: Remove it913x* maintainers entries.
Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- MAINTAINERS | 16 1 file changed, 16 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index b2cf5cf..538b894 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4771,22 +4771,6 @@ F: Documentation/hwmon/it87 F: drivers/hwmon/it87.c IT913X MEDIA DRIVER -M: Malcolm Priestley tvbox...@gmail.com -L: linux-media@vger.kernel.org -W: http://linuxtv.org/ -Q: http://patchwork.linuxtv.org/project/linux-media/list/ -S: Maintained -F: drivers/media/usb/dvb-usb-v2/it913x* - -IT913X FE MEDIA DRIVER -M: Malcolm Priestley tvbox...@gmail.com -L: linux-media@vger.kernel.org -W: http://linuxtv.org/ -Q: http://patchwork.linuxtv.org/project/linux-media/list/ -S: Maintained -F: drivers/media/dvb-frontends/it913x-fe* - -IT913X MEDIA DRIVER M: Antti Palosaari cr...@iki.fi L: linux-media@vger.kernel.org W: http://linuxtv.org/ -- 1.9.rc1 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/4] get_dvb_firmware: it913x: Remove it9137 firmware files
Remove it9137 firmware files it9137.txt and it9137 get_dvb_firmware. dvb-usb-it9137-01.fw firmware is no longer in use. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- Documentation/dvb/get_dvb_firmware | 22 ++ Documentation/dvb/it9137.txt | 9 - 2 files changed, 2 insertions(+), 29 deletions(-) delete mode 100644 Documentation/dvb/it9137.txt diff --git a/Documentation/dvb/get_dvb_firmware b/Documentation/dvb/get_dvb_firmware index 5d5ee4c..d91b8be 100755 --- a/Documentation/dvb/get_dvb_firmware +++ b/Documentation/dvb/get_dvb_firmware @@ -28,8 +28,8 @@ use IO::Handle; opera1, cx231xx, cx18, cx23885, pvrusb2, mpc718, af9015, ngene, az6027, lme2510_lg, lme2510c_s7395, lme2510c_s7395_old, drxk, drxk_terratec_h5, - drxk_hauppauge_hvr930c, tda10071, it9135, it9137, - drxk_pctv, drxk_terratec_htc_stick, sms1xxx_hcw); + drxk_hauppauge_hvr930c, tda10071, it9135, drxk_pctv, + drxk_terratec_htc_stick, sms1xxx_hcw); # Check args syntax() if (scalar(@ARGV) != 1); @@ -727,24 +727,6 @@ sub it9135 { $fwfile1 $fwfile2 } -sub it9137 { -my $url = http://kworld.server261.com/kworld/CD/ITE_TiVme/V1.00/;; -my $zipfile = Driver_V10.323.1.0412.100412.zip; -my $hash = 79b597dc648698ed6820845c0c9d0d37; -my $tmpdir = tempdir(DIR = /tmp, CLEANUP = 0); -my $drvfile = Driver_V10.323.1.0412.100412/Data/x86/IT9135BDA.sys; -my $fwfile = dvb-usb-it9137-01.fw; - -checkstandard(); - -wgetfile($zipfile, $url . $zipfile); -verify($zipfile, $hash); -unzip($zipfile, $tmpdir); -extract($tmpdir/$drvfile, 69632, 5731, $fwfile); - -$fwfile -} - sub tda10071 { my $sourcefile = PCTV_460e_reference.zip; my $url = ftp://ftp.pctvsystems.com/TV/driver/PCTV%2070e%2080e%20100e%20320e%20330e%20800e/;; diff --git a/Documentation/dvb/it9137.txt b/Documentation/dvb/it9137.txt deleted file mode 100644 index 9e6726e..000 --- a/Documentation/dvb/it9137.txt +++ /dev/null @@ -1,9 +0,0 @@ -To extract firmware for Kworld UB499-2T (id 1b80:e409) you need to copy the -following file(s) to this directory. - -IT9135BDA.sys Dated Mon 22 Mar 2010 02:20:08 GMT - -extract using dd -dd if=IT9135BDA.sys ibs=1 skip=69632 count=5731 of=dvb-usb-it9137-01.fw - -copy to default firmware location. -- 1.9.rc1 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/4] it913x: dead code Remove driver.
Following moving ids to af9035. This driver is no longer in use. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/usb/dvb-usb-v2/Kconfig | 7 - drivers/media/usb/dvb-usb-v2/Makefile | 3 - drivers/media/usb/dvb-usb-v2/it913x.c | 809 -- 3 files changed, 819 deletions(-) delete mode 100644 drivers/media/usb/dvb-usb-v2/it913x.c diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig b/drivers/media/usb/dvb-usb-v2/Kconfig index 2059d0c..bfb7378 100644 --- a/drivers/media/usb/dvb-usb-v2/Kconfig +++ b/drivers/media/usb/dvb-usb-v2/Kconfig @@ -100,13 +100,6 @@ config DVB_USB_GL861 Say Y here to support the MSI Megasky 580 (55801) DVB-T USB2.0 receiver with USB ID 0db0:5581. -config DVB_USB_IT913X - tristate ITE IT913X DVB-T USB2.0 support - depends on DVB_USB_V2 - select DVB_IT913X_FE - help - Say Y here to support the ITE IT913X DVB-T USB2.0 - config DVB_USB_LME2510 tristate LME DM04/QQBOX DVB-S USB2.0 support depends on DVB_USB_V2 diff --git a/drivers/media/usb/dvb-usb-v2/Makefile b/drivers/media/usb/dvb-usb-v2/Makefile index 2c06714..bc38f03 100644 --- a/drivers/media/usb/dvb-usb-v2/Makefile +++ b/drivers/media/usb/dvb-usb-v2/Makefile @@ -22,9 +22,6 @@ obj-$(CONFIG_DVB_USB_CE6230) += dvb-usb-ce6230.o dvb-usb-ec168-objs := ec168.o obj-$(CONFIG_DVB_USB_EC168) += dvb-usb-ec168.o -dvb-usb-it913x-objs := it913x.o -obj-$(CONFIG_DVB_USB_IT913X) += dvb-usb-it913x.o - dvb-usb-lmedm04-objs := lmedm04.o obj-$(CONFIG_DVB_USB_LME2510) += dvb-usb-lmedm04.o diff --git a/drivers/media/usb/dvb-usb-v2/it913x.c b/drivers/media/usb/dvb-usb-v2/it913x.c deleted file mode 100644 index 39488f8..000 --- a/drivers/media/usb/dvb-usb-v2/it913x.c +++ /dev/null @@ -1,809 +0,0 @@ -/* - * DVB USB compliant linux driver for ITE IT9135 and IT9137 - * - * Copyright (C) 2011 Malcolm Priestley (tvbox...@gmail.com) - * IT9135 (C) ITE Tech Inc. - * IT9137 (C) ITE Tech Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License Version 2, as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * see Documentation/dvb/README.dvb-usb for more information - * see Documentation/dvb/it9137.txt for firmware information - * - */ -#define DVB_USB_LOG_PREFIX it913x - -#include linux/usb.h -#include linux/usb/input.h -#include media/rc-core.h - -#include dvb_usb.h -#include it913x-fe.h - -/* debug */ -static int dvb_usb_it913x_debug; -#define it_debug(var, level, args...) \ - do { if ((var level)) pr_debug(DVB_USB_LOG_PREFIX: args); \ -} while (0) -#define deb_info(level, args...) it_debug(dvb_usb_it913x_debug, level, args) -#define info(args...) pr_info(DVB_USB_LOG_PREFIX: args) - -module_param_named(debug, dvb_usb_it913x_debug, int, 0644); -MODULE_PARM_DESC(debug, set debugging level (1=info (or-able)).); - -static int dvb_usb_it913x_firmware; -module_param_named(firmware, dvb_usb_it913x_firmware, int, 0644); -MODULE_PARM_DESC(firmware, set firmware 0=auto \ - 1=IT9137 2=IT9135 V1 3=IT9135 V2); -#define FW_IT9137 dvb-usb-it9137-01.fw -#define FW_IT9135_V1 dvb-usb-it9135-01.fw -#define FW_IT9135_V2 dvb-usb-it9135-02.fw - -DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); - -struct it913x_state { - struct ite_config it913x_config; - u8 pid_filter_onoff; - bool proprietary_ir; - int cmd_counter; -}; - -static u16 check_sum(u8 *p, u8 len) -{ - u16 sum = 0; - u8 i = 1; - while (i len) - sum += (i++ 1) ? (*p++) 8 : *p++; - return ~sum; -} - -static int it913x_io(struct dvb_usb_device *d, u8 mode, u8 pro, - u8 cmd, u32 reg, u8 addr, u8 *data, u8 len) -{ - struct it913x_state *st = d-priv; - int ret = 0, i, buf_size = 1; - u8 *buff; - u8 rlen; - u16 chk_sum; - - buff = kzalloc(256, GFP_KERNEL); - if (!buff) { - info(USB Buffer Failed); - return -ENOMEM; - } - - buff[buf_size++] = pro; - buff[buf_size++] = cmd; - buff[buf_size++] = st-cmd_counter; - - switch (mode) { - case READ_LONG: - case WRITE_LONG: - buff[buf_size++] = len; - buff[buf_size++] = 2; - buff[buf_size++] = (reg 24); - buff[buf_size++] = (reg 16) 0xff; - buff[buf_size++] = (reg 8) 0xff; - buff[buf_size++] = reg 0xff; - break
Re: [PATCH 2/2] af9035: Add remaining it913x dual ids to af9035.
On Tue, 2014-02-11 at 19:42 +0200, Antti Palosaari wrote: Moikka Malcolm! Thanks for the patch serie. You removed all IDs from it913x driver. There is possibility to just remove / comment out: MODULE_DEVICE_TABLE(usb, it913x_id_table); which prevents loading that driver automatically, but leaves possibility to load it manually if user wants to fallback. I am fine either way you decide to do it, just a propose. Hi Antti I am going post a patches to remove it. The only reason why an user would want to fall back is the use dvb-usb-it9137-01.fw firmware with USB_VID_KWORLD_2. I left the USB_VID_KWORLD_2 ids in the driver. I haven't found any issues with dvb-usb-it9135-01.fw USB_VID_KWORLD_2 users could have trouble updating older kernels via media_build. Perhaps there should be a warning message in af9035 that users need to change firmware. Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] af9035: Add remaining it913x dual ids to af9035.
On Tue, 2014-02-11 at 22:41 +0200, Antti Palosaari wrote: On 11.02.2014 22:32, Malcolm Priestley wrote: On Tue, 2014-02-11 at 19:42 +0200, Antti Palosaari wrote: Moikka Malcolm! Thanks for the patch serie. You removed all IDs from it913x driver. There is possibility to just remove / comment out: MODULE_DEVICE_TABLE(usb, it913x_id_table); which prevents loading that driver automatically, but leaves possibility to load it manually if user wants to fallback. I am fine either way you decide to do it, just a propose. Hi Antti I am going post a patches to remove it. The only reason why an user would want to fall back is the use dvb-usb-it9137-01.fw firmware with USB_VID_KWORLD_2. I left the USB_VID_KWORLD_2 ids in the driver. I haven't found any issues with dvb-usb-it9135-01.fw USB_VID_KWORLD_2 users could have trouble updating older kernels via media_build. Perhaps there should be a warning message in af9035 that users need to change firmware. Is that KẂorld device dual model (I guess yes, because of it9137)? Is it version 1 (AX) or version 2 (BX) chip? Both apparently exist, but the firmware is the same. The main difference registers in the firmwares dvb-usb-it9137-01.fw --clk enable 0xd81a -- tuner_it91x_priv.h...set_it9137_template dvb-usb-it9135-01.fw --clk enable 0xcfff -- tuner_it91x_priv.h...set_it9135_template dvb-usb-it9135-02.fw --clk enable 0xcfff -- tuner_it91x_priv.h...set_it9135_template As far as It can tell all the latest firmwares are based on set_it9135_template. On the KWorld the second device is another it9137 and has an eeprom 24c02 fitted. So dropping the dvb-usb-it9137-01.fw firmware is fine. Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] af9035: Move it913x single devices to af9035
On Sat, 2014-02-08 at 16:11 +, Malcolm Priestley wrote: The generic v1 and v2 devices have been all tested. IDs tested USB_PID_ITETECH_IT9135 v1 v2 USB_PID_ITETECH_IT9135_9005 v1 USB_PID_ITETECH_IT9135_9006 v2 Current Issues There is no signal on USB_PID_ITETECH_IT9135 v2 No SNR reported all devices. All single devices tune and scan fine. All remotes tested okay. Dual device failed to register second adapter USB_PID_KWORLD_UB499_2T_T09 It is not clear what the problem is at the moment. Hi Antti I have found the problem here. state-eeprom_addr + EEPROM_2ND_DEMOD_ADDR contains no value So on 9135 devices register 0x4bfb and the I2C address (state-af9033_config[1].i2c_addr) need to be set to 0x3a. I have only manually changed these and both adapters work fine. Also, I can't find pick up for register 0xcfff although it appears to be on by default. I will try and do a patch later and the patch for remaining ids in it913x. Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] af9035: add default 0x9135 slave I2C address
On some devices the vendor has not set EEPROM_2ND_DEMOD_ADDR. Checks tmp is not zero after call to get EEPROM_2ND_DEMOD_ADDR and sets the default slave address of 0x3a on 0x9135 devices. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/usb/dvb-usb-v2/af9035.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 3825c2f..4f682ad 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -576,6 +576,10 @@ static int af9035_download_firmware(struct dvb_usb_device *d, goto err; if (state-chip_type == 0x9135) { + if (!tmp) + /* default 0x9135 slave I2C address */ + tmp = 0x3a; + ret = af9035_wr_reg(d, 0x004bfb, tmp); if (ret 0) goto err; @@ -684,6 +688,10 @@ static int af9035_read_config(struct dvb_usb_device *d) if (ret 0) goto err; + if (!tmp state-chip_type == 0x9135) + /* default 0x9135 slave I2C address */ + tmp = 0x3a; + state-af9033_config[1].i2c_addr = tmp; dev_dbg(d-udev-dev, %s: 2nd demod I2C addr=%02x\n, __func__, tmp); -- 1.9.rc1 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] af9035: Add remaining it913x dual ids to af9035.
As follow on to patch af9035: Move it913x single devices to af9035 and patch 1. SNR is reported as db/10 values. All dual ids are added to af9035 and it913x driver disabled. it913x/it913x-fe removal patches to follow. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/usb/dvb-usb-v2/af9035.c | 8 drivers/media/usb/dvb-usb-v2/it913x.c | 5 + 2 files changed, 13 insertions(+) diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 4f682ad..49e8360 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -1552,6 +1552,14 @@ static const struct usb_device_id af9035_id_table[] = { af9035_props, Avermedia A835B(4835), RC_MAP_IT913X_V2) }, { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_H335, af9035_props, Avermedia H335, RC_MAP_IT913X_V2) }, + { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_UB499_2T_T09, + af9035_props, Kworld UB499-2T T09, RC_MAP_IT913X_V1) }, + { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV22_IT9137, + af9035_props, Sveon STV22 Dual DVB-T HDTV, + RC_MAP_IT913X_V1) }, + { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_CTVDIGDUAL_V2, + af9035_props, Digital Dual TV Receiver CTVDIGDUAL_V2, + RC_MAP_IT913X_V1) }, /* XXX: that same ID [0ccd:0099] is used by af9015 driver too */ { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x0099, af9035_props, TerraTec Cinergy T Stick Dual RC (rev. 2), NULL) }, diff --git a/drivers/media/usb/dvb-usb-v2/it913x.c b/drivers/media/usb/dvb-usb-v2/it913x.c index 78bf8fd..39488f8 100644 --- a/drivers/media/usb/dvb-usb-v2/it913x.c +++ b/drivers/media/usb/dvb-usb-v2/it913x.c @@ -781,6 +781,8 @@ static const struct usb_device_id it913x_id_table[] = { {} /* Terminating entry */ }; +#if 0 + MODULE_DEVICE_TABLE(usb, it913x_id_table); static struct usb_driver it913x_driver = { @@ -792,8 +794,11 @@ static struct usb_driver it913x_driver = { .id_table = it913x_id_table, }; + module_usb_driver(it913x_driver); +#endif + MODULE_AUTHOR(Malcolm Priestley tvbox...@gmail.com); MODULE_DESCRIPTION(it913x USB 2 Driver); MODULE_VERSION(1.33); -- 1.9.rc1 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: video from USB DVB-T get damaged after some time
On Sat, 2014-02-08 at 15:43 +0100, kap...@mizera.cz wrote: Hello, unfortunately I do not understand development, patching, compiling things. I have try it but I need more help. I have done: git clone --depth=1 git://linuxtv.org/media_build.git cd media_build ./build it downloads and builds all. At begin of compiling I had stop it. Then I did manual change of ./media_build/linux/drivers/media/usb/dvb-usb-v2/af9035.c --- old part: { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00aa, af9035_props, TerraTec Cinergy T Stick (rev. 2), NULL) }, /* IT9135 devices */ #if 0 { DVB_USB_DEVICE(0x048d, 0x9135, af9035_props, IT9135 reference design, NULL) }, { DVB_USB_DEVICE(0x048d, 0x9006, af9035_props, IT9135 reference design, NULL) }, #endif /* XXX: that same ID [0ccd:0099] is used by af9015 driver too */ { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x0099, af9035_props, TerraTec Cinergy T Stick Dual RC (rev. 2), NULL) }, - new: { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00aa, af9035_props, TerraTec Cinergy T Stick (rev. 2), NULL) }, /* IT9135 devices */ { DVB_USB_DEVICE(0x048d, 0x9135, af9035_props, IT9135 reference design, NULL) }, /* XXX: that same ID [0ccd:0099] is used by af9015 driver too */ { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x0099, af9035_props, TerraTec Cinergy T Stick Dual RC (rev. 2), NULL) }, But now I do not know how to restart build process. Just make from media_build directory. I have try: cd /tmp/media_build/linux make It had compiled *. and *.ko files. you need to run /sbin/depmod -a and reboot it best to just run with su/sudo make install I have just tested all the single ids. I am about to send a patch to add all the single tuner ids to af9035 from it913x. I haven't found any problems. Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] af9035: Move it913x single devices to af9035
The generic v1 and v2 devices have been all tested. IDs tested USB_PID_ITETECH_IT9135 v1 v2 USB_PID_ITETECH_IT9135_9005 v1 USB_PID_ITETECH_IT9135_9006 v2 Current Issues There is no signal on USB_PID_ITETECH_IT9135 v2 No SNR reported all devices. All single devices tune and scan fine. All remotes tested okay. Dual device failed to register second adapter USB_PID_KWORLD_UB499_2T_T09 It is not clear what the problem is at the moment. So only single IDs are transferred in this patch. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/usb/dvb-usb-v2/af9035.c | 22 -- drivers/media/usb/dvb-usb-v2/it913x.c | 24 2 files changed, 16 insertions(+), 30 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 8ede8ea..3825c2f 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -1528,12 +1528,22 @@ static const struct usb_device_id af9035_id_table[] = { { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00aa, af9035_props, TerraTec Cinergy T Stick (rev. 2), NULL) }, /* IT9135 devices */ -#if 0 - { DVB_USB_DEVICE(0x048d, 0x9135, - af9035_props, IT9135 reference design, NULL) }, - { DVB_USB_DEVICE(0x048d, 0x9006, - af9035_props, IT9135 reference design, NULL) }, -#endif + { DVB_USB_DEVICE(USB_VID_ITETECH, USB_PID_ITETECH_IT9135, + af9035_props, ITE 9135 Generic, RC_MAP_IT913X_V1) }, + { DVB_USB_DEVICE(USB_VID_ITETECH, USB_PID_ITETECH_IT9135_9005, + af9035_props, ITE 9135(9005) Generic, RC_MAP_IT913X_V2) }, + { DVB_USB_DEVICE(USB_VID_ITETECH, USB_PID_ITETECH_IT9135_9006, + af9035_props, ITE 9135(9006) Generic, RC_MAP_IT913X_V1) }, + { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A835B_1835, + af9035_props, Avermedia A835B(1835), RC_MAP_IT913X_V2) }, + { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A835B_2835, + af9035_props, Avermedia A835B(2835), RC_MAP_IT913X_V2) }, + { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A835B_3835, + af9035_props, Avermedia A835B(3835), RC_MAP_IT913X_V2) }, + { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A835B_4835, + af9035_props, Avermedia A835B(4835), RC_MAP_IT913X_V2) }, + { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_H335, + af9035_props, Avermedia H335, RC_MAP_IT913X_V2) }, /* XXX: that same ID [0ccd:0099] is used by af9015 driver too */ { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x0099, af9035_props, TerraTec Cinergy T Stick Dual RC (rev. 2), NULL) }, diff --git a/drivers/media/usb/dvb-usb-v2/it913x.c b/drivers/media/usb/dvb-usb-v2/it913x.c index fe95a58..78bf8fd 100644 --- a/drivers/media/usb/dvb-usb-v2/it913x.c +++ b/drivers/media/usb/dvb-usb-v2/it913x.c @@ -772,36 +772,12 @@ static const struct usb_device_id it913x_id_table[] = { { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_UB499_2T_T09, it913x_properties, Kworld UB499-2T T09(IT9137), RC_MAP_IT913X_V1) }, - { DVB_USB_DEVICE(USB_VID_ITETECH, USB_PID_ITETECH_IT9135, - it913x_properties, ITE 9135 Generic, - RC_MAP_IT913X_V1) }, { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV22_IT9137, it913x_properties, Sveon STV22 Dual DVB-T HDTV(IT9137), RC_MAP_IT913X_V1) }, - { DVB_USB_DEVICE(USB_VID_ITETECH, USB_PID_ITETECH_IT9135_9005, - it913x_properties, ITE 9135(9005) Generic, - RC_MAP_IT913X_V2) }, - { DVB_USB_DEVICE(USB_VID_ITETECH, USB_PID_ITETECH_IT9135_9006, - it913x_properties, ITE 9135(9006) Generic, - RC_MAP_IT913X_V1) }, - { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A835B_1835, - it913x_properties, Avermedia A835B(1835), - RC_MAP_IT913X_V2) }, - { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A835B_2835, - it913x_properties, Avermedia A835B(2835), - RC_MAP_IT913X_V2) }, - { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A835B_3835, - it913x_properties, Avermedia A835B(3835), - RC_MAP_IT913X_V2) }, - { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A835B_4835, - it913x_properties, Avermedia A835B(4835), - RC_MAP_IT913X_V2) }, { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_CTVDIGDUAL_V2, it913x_properties, Digital Dual TV Receiver CTVDIGDUAL_V2, RC_MAP_IT913X_V1) }, - { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_H335, - it913x_properties, Avermedia H335, - RC_MAP_IT913X_V2
Re: video from USB DVB-T get damaged after some time
On Sat, 2014-02-08 at 19:35 +0100, kap...@mizera.cz wrote: Hello, I have compile it (I hope) the more right way now :-) The patch saved as aaa.patch in media_build/backports and added lines to media_build/backports/backports.txt: [3.2.0] add aaa.patch Now dmesg looks like: - [ 17.643287] usb 1-1.3: dvb_usb_af9035: prechip_version=83 chip_version=02 chip_type=9135 [ 17.643661] usb 1-1.3: dvb_usb_v2: found a 'ITE 9135 Generic' in cold state [ 17.652169] usb 1-1.3: dvb_usb_v2: downloading firmware from file 'dvb-usb-it9135-02.fw' [ 17.746382] usb 1-1.3: dvb_usb_af9035: firmware version=3.39.1.0 [ 17.746389] usb 1-1.3: dvb_usb_v2: found a 'ITE 9135 Generic' in warm state [ 17.747413] usb 1-1.3: dvb_usb_v2: will pass the complete MPEG2 transport stream to the software demuxer [ 17.747429] DVB: registering new adapter (ITE 9135 Generic) [ 17.805233] i2c i2c-16: af9033: firmware version: LINK=0.0.0.0 OFDM=3.9.1.0 [ 17.805238] usb 1-1.3: DVB: registering adapter 0 frontend 0 (Afatech AF9033 (DVB-T))... [ 17.821832] i2c i2c-16: tuner_it913x: ITE Tech IT913X successfully attached [ 17.858231] Registered IR keymap rc-it913x-v1 [ 17.858291] input: ITE 9135 Generic as /devices/pci:00/:00:1a.0/usb1/1-1/1-1.3/rc/rc0/input5 [ 17.858395] rc0: ITE 9135 Generic as /devices/pci:00/:00:1a.0/usb1/1-1/1-1.3/rc/rc0 [ 17.858398] usb 1-1.3: dvb_usb_v2: schedule remote query interval to 500 msecs [ 17.858401] usb 1-1.3: dvb_usb_v2: 'ITE 9135 Generic' successfully initialized and connected [ 17.858415] usbcore: registered new interface driver dvb_usb_af9035 -- First I have thing the problem is gone: It has run OK over 20 minutes (before it goes down mostly in 10 min on CH59). But - unfortunately after cca 25 min it has go down again :-( status 1f | signal | snr 0122 | ber | unc 014f | FE_HAS_LOCK status 1f | signal | snr 0122 | ber 830e | unc 014f | FE_HAS_LOCK status 1f | signal | snr 0122 | ber 0001061c | unc 014f | FE_HAS_LOCK status 1f | signal | snr 0122 | ber | unc 014f | FE_HAS_LOCK ... status 1f | signal | snr 0122 | ber 003dedb0 | unc 0002fd94 | FE_HAS_LOCK status 07 | signal | snr 0122 | ber 004c8030 | unc 0002fffd | status 1f | signal | snr 0118 | ber 006d50fd | unc 0003026d | FE_HAS_LOCK status 1f | signal | snr 0122 | ber 006cfc4e | unc 00030569 | FE_HAS_LOCK status 1f | signal | snr 0122 | ber 009d1eda | unc 00030832 | FE_HAS_LOCK status 1f | signal | snr 0122 | ber 008924b1 | unc 00030a5e | FE_HAS_LOCK status 1f | signal | snr 0122 | ber 00712074 | unc 00030d27 | FE_HAS_LOCK status 1f | signal | snr 0122 | ber 008d4d85 | unc 00030f55 | FE_HAS_LOCK That BER looks awful. If the antenna is good, it looks like local interference. Check the wifi adapter is not causing it. If possible put the TV adapter on a short 0.5m/1m USB extension cable away from the PC. Trouble is these devices do not have any shielding. I have heard problems of memory leak in Ubuntu 64 running low on memory check free memory after 30 mins. Regards Malcolm - So - maybe is it little better, but the problem persist. Any chance to solve it in dvb driver ? I have tested (with the old driver) - that it helps to CTRL+C the: tzap -r -c /etc/channels.conf Prima ZOOM And then run it again. (It was not necessary to switch to another freq. and back, as I wrote before). Unfortunately it damages for a while the recording (file.ts). Is there another way how to re-tune (re-zap) without break recording/viewing ? I could then re-tune e.g. every 5 minutes and it could solve the problem. Could not that be done in driver itself ? Thanks. --kapetr Dne 8.2.2014 16:08, Malcolm Priestley napsal(a): On Sat, 2014-02-08 at 15:43 +0100, kap...@mizera.cz wrote: Hello, unfortunately I do not understand development, patching, compiling things. I have try it but I need more help. I have done: git clone --depth=1 git://linuxtv.org/media_build.git cd media_build ./build it downloads and builds all. At begin of compiling I had stop it. Then I did manual change of ./media_build/linux/drivers/media/usb/dvb-usb-v2/af9035.c --- old part: { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x00aa, af9035_props, TerraTec Cinergy T Stick (rev. 2), NULL) }, /* IT9135 devices */ #if 0 { DVB_USB_DEVICE(0x048d, 0x9135, af9035_props, IT9135 reference design, NULL) }, { DVB_USB_DEVICE(0x048d, 0x9006, af9035_props, IT9135 reference design, NULL) }, #endif /* XXX: that same ID [0ccd:0099] is used by af9015 driver too */ { DVB_USB_DEVICE(USB_VID_TERRATEC, 0x0099
[PATCH 2/2] m88rs2000: add m88rs2000_get_tune_settings
Add min delay of 2000 ms on symbol rate more than 300 and delay of 3000ms less than this. This prevents crashing the frontend on continuous transponder scans. Otherwise other dvb_frontend_tune_settings are the same as default. This makes very little time difference to good channel scans, but slows down the set frontend where lock can never be achieved i.e. DVB-S2. Signed-off-by: Malcolm Priestley tvbox...@gmail.com Cc: sta...@vger.kernel.org # v3.9+ --- drivers/media/dvb-frontends/m88rs2000.c | 17 + 1 file changed, 17 insertions(+) diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c index ee2fec8..32cffca 100644 --- a/drivers/media/dvb-frontends/m88rs2000.c +++ b/drivers/media/dvb-frontends/m88rs2000.c @@ -715,6 +715,22 @@ static int m88rs2000_get_frontend(struct dvb_frontend *fe) return 0; } +static int m88rs2000_get_tune_settings(struct dvb_frontend *fe, + struct dvb_frontend_tune_settings *tune) +{ + struct dtv_frontend_properties *c = fe-dtv_property_cache; + + if (c-symbol_rate 300) + tune-min_delay_ms = 2000; + else + tune-min_delay_ms = 3000; + + tune-step_size = c-symbol_rate / 16000; + tune-max_drift = c-symbol_rate / 2000; + + return 0; +} + static int m88rs2000_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) { struct m88rs2000_state *state = fe-demodulator_priv; @@ -766,6 +782,7 @@ static struct dvb_frontend_ops m88rs2000_ops = { .set_frontend = m88rs2000_set_frontend, .get_frontend = m88rs2000_get_frontend, + .get_tune_settings = m88rs2000_get_tune_settings, }; struct dvb_frontend *m88rs2000_attach(const struct m88rs2000_config *config, -- 1.9.rc1 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] m88rs2000: add caps FE_CAN_INVERSION_AUTO
This frontend is always auto inversion. Signed-off-by: Malcolm Priestley tvbox...@gmail.com Cc: sta...@vger.kernel.org # v3.9+ --- drivers/media/dvb-frontends/m88rs2000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c index b235146..ee2fec8 100644 --- a/drivers/media/dvb-frontends/m88rs2000.c +++ b/drivers/media/dvb-frontends/m88rs2000.c @@ -746,7 +746,7 @@ static struct dvb_frontend_ops m88rs2000_ops = { .symbol_rate_tolerance = 500, /* ppm */ .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | - FE_CAN_QPSK | + FE_CAN_QPSK | FE_CAN_INVERSION_AUTO | FE_CAN_FEC_AUTO }, -- 1.9.rc1 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH TEST] ts2020.c : correct divider settings
On Fri, 2014-01-24 at 16:43 +0100, Joakim Hernberg wrote: On Wed, 22 Jan 2014 20:04:08 +0100 Joakim Hernberg j...@alchemy.lu wrote: I recently discovered a regression in the S471 driver. When trying to tune to 10818V on Astra 28E2, the system would tune to 11343V instead. After browsing the code it appears that a divider was changed when the tuning code was moved from ds3000.c to ts2020.c. Use 10818V daily BBC News no problems. I also use 11353v I decided to test this a bit more thoroughly. I scanned 28E2 with w_scan, compared the listings for 28E2 on King Of Sat with the resulting channels.conf, and came up with the following anomalies. I've also verified the non/existence of the transponders with my VU+ STB. Some anomalies are common to all tests: No channels found on 11307H (11307V is OK) No channels found on 11344H (11344V is OK) No channels found on 11390V (11389H is OK) Finds 2 channels on 11097V that aren't in KOS nor found on the STB Transponder on 12000H duplicate of 11992H With linux v3.8.1 (old tuning code in ds3000.c): No channels found on 11224V (11222H is OK) With linux v3.13.0 (new tuning code in ts2020.c): Shows the channels from 11344V as found on 10818V No channels found on 11224V (11222H is OK) Transponder on 12560H duplicate of 12545H Transponder on 12607H duplicate of 12603H Transponder on 12643H duplicate of 12633H With linux 3.13.0 (+ my proposed patch): Shows the channels from 11222H as found on 11224V No channels found on 11224V Yes I can tune this channel using current ts2020 kernel code. Transponder on 12524V duplicate of 12522V Transponder on 12560H duplicate of 12545H Transponder on 12607H duplicate of 12603H Transponder on 12643H duplicate of 12633H Problems here could be the carrier offset or error occurred during tuning. The carrier offset can be as much as +/- 30 MHz and accidentally slip onto the next channel carrier. The ds3000 does not return carrier offset adjusted frequency. Unless some one can directly spot what is wrong in the ts2020.c code, I guess the next step will be to sprinkle printk statements in the tuning code and try to tune to the problematic channels. Then try to see if I can figure out how the code that programs the pll oscilliator functions and if I can come up with better dividers for it. I am using the ts2020 with the m88r2000. It think the problem is in ds3000. Here is alternative ndiv code, it is based on vendors code. It uses the ndiv value not frequency to change the divider. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/dvb-frontends/ts2020.c | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c index 9aba044..9e051efb 100644 --- a/drivers/media/dvb-frontends/ts2020.c +++ b/drivers/media/dvb-frontends/ts2020.c @@ -186,22 +186,27 @@ static int ts2020_set_params(struct dvb_frontend *fe) struct ts2020_priv *priv = fe-tuner_priv; int ret; u32 frequency = c-frequency; - s32 offset_khz; + u32 offset_khz, ndiv_mul; u32 symbol_rate = (c-symbol_rate / 1000); u32 f3db, gdiv28; u16 value, ndiv, lpf_coeff; u8 lpf_mxdiv, mlpf_max, mlpf_min, nlpf; u8 lo = 0x01, div4 = 0x0; + ndiv = (u16)((frequency * 14 * 2 + TS2020_XTAL_FREQ / 2) + / TS2020_XTAL_FREQ); + /* Calculate frequency divider */ - if (frequency priv-frequency_div) { + if (ndiv 1100) { lo |= 0x10; div4 = 0x1; - ndiv = (frequency * 14 * 4) / TS2020_XTAL_FREQ; - } else - ndiv = (frequency * 14 * 2) / TS2020_XTAL_FREQ; - ndiv = ndiv + ndiv % 2; - ndiv = ndiv - 1024; + ndiv = (u16)((frequency * 14 * 4 + TS2020_XTAL_FREQ / 2) + / TS2020_XTAL_FREQ) - 1024; + ndiv_mul = ndiv + 1024; + } else { + ndiv -= 1024; + ndiv_mul = ndiv - ndiv % 2 + 1024; + } ret = ts2020_writereg(fe, 0x10, 0x80 | lo); @@ -272,9 +277,8 @@ static int ts2020_set_params(struct dvb_frontend *fe) ret |= ts2020_tuner_gate_ctrl(fe, 0x01); msleep(80); - /* calculate offset assuming 96000kHz*/ - offset_khz = (ndiv - ndiv % 2 + 1024) * TS2020_XTAL_FREQ - / (6 + 8) / (div4 + 1) / 2; + + offset_khz = ndiv_mul * TS2020_XTAL_FREQ / 14 / (div4 + 1) / 2; priv-frequency = offset_khz; -- 1.8.5.3 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] m88rs2000: correct read status lock value.
The correct lock values is when bits of the value 0xee are set. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/dvb-frontends/m88rs2000.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c index 02699c1..f9d04db 100644 --- a/drivers/media/dvb-frontends/m88rs2000.c +++ b/drivers/media/dvb-frontends/m88rs2000.c @@ -469,7 +469,7 @@ static int m88rs2000_read_status(struct dvb_frontend *fe, fe_status_t *status) *status = 0; - if ((reg 0x7) == 0x7) { + if ((reg 0xee) == 0xee) { *status = FE_HAS_CARRIER | FE_HAS_SIGNAL | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; if (state-config-set_ts_params) @@ -677,7 +677,7 @@ static int m88rs2000_set_frontend(struct dvb_frontend *fe) for (i = 0; i 25; i++) { reg = m88rs2000_readreg(state, 0x8c); - if ((reg 0x7) == 0x7) { + if ((reg 0xee) == 0xee) { status = FE_HAS_LOCK; break; } -- 1.8.5.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] m88rs2000: Correct m88rs2000_set_fec settings.
Register 0x70 is used to set fec, register 0x76 is used to get fec Register 0x76 is set to 0x8. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/dvb-frontends/m88rs2000.c | 37 + 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c index f9d04db..002b109 100644 --- a/drivers/media/dvb-frontends/m88rs2000.c +++ b/drivers/media/dvb-frontends/m88rs2000.c @@ -541,33 +541,38 @@ static int m88rs2000_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) static int m88rs2000_set_fec(struct m88rs2000_state *state, fe_code_rate_t fec) { - u16 fec_set; + u8 fec_set, reg; + int ret; + switch (fec) { - /* This is not confirmed kept for reference */ -/* case FEC_1_2: - fec_set = 0x88; + case FEC_1_2: + fec_set = 0x8; break; case FEC_2_3: - fec_set = 0x68; + fec_set = 0x10; break; case FEC_3_4: - fec_set = 0x48; + fec_set = 0x20; break; case FEC_5_6: - fec_set = 0x28; + fec_set = 0x40; break; case FEC_7_8: - fec_set = 0x18; - break; */ + fec_set = 0x80; + break; case FEC_AUTO: default: - fec_set = 0x08; + fec_set = 0x0; } - m88rs2000_writereg(state, 0x76, fec_set); - return 0; -} + reg = m88rs2000_readreg(state, 0x70); + reg = 0x7; + ret = m88rs2000_writereg(state, 0x70, reg | fec_set); + ret |= m88rs2000_writereg(state, 0x76, 0x8); + + return ret; +} static fe_code_rate_t m88rs2000_get_fec(struct m88rs2000_state *state) { @@ -650,12 +655,8 @@ static int m88rs2000_set_frontend(struct dvb_frontend *fe) if (ret 0) return -ENODEV; - /* Unknown */ - reg = m88rs2000_readreg(state, 0x70); - ret = m88rs2000_writereg(state, 0x70, reg); - /* Set FEC */ - ret |= m88rs2000_set_fec(state, c-fec_inner); + ret = m88rs2000_set_fec(state, c-fec_inner); ret |= m88rs2000_writereg(state, 0x85, 0x1); ret |= m88rs2000_writereg(state, 0x8a, 0xbf); ret |= m88rs2000_writereg(state, 0x8d, 0x1e); -- 1.8.5.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] m88rs2000: Correct m88rs2000_get_fec
Value of fec is achieved by the upper nibble bits 6,7 8. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/dvb-frontends/m88rs2000.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c index 002b109..b235146 100644 --- a/drivers/media/dvb-frontends/m88rs2000.c +++ b/drivers/media/dvb-frontends/m88rs2000.c @@ -581,18 +581,20 @@ static fe_code_rate_t m88rs2000_get_fec(struct m88rs2000_state *state) reg = m88rs2000_readreg(state, 0x76); m88rs2000_writereg(state, 0x9a, 0xb0); + reg = 0xf0; + reg = 5; + switch (reg) { - case 0x88: + case 0x4: return FEC_1_2; - case 0x68: + case 0x3: return FEC_2_3; - case 0x48: + case 0x2: return FEC_3_4; - case 0x28: + case 0x1: return FEC_5_6; - case 0x18: + case 0x0: return FEC_7_8; - case 0x08: default: break; } -- 1.8.5.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] m88rs2000: add m88rs2000_set_carrieroffset
Set the carrier offset correctly using the default mclk values. Add function m88rs2000_get_mclk to calculate the mclk value against crystal frequency which will later be used for other functions. Add function m88rs2000_set_carrieroffset to calculate and set the offset value. variable offset becomes a signed value. Register 0x86 is set the appropriate value according to remainder value of frequency % 192857 calculation as shown. Signed-off-by: Malcolm Priestley tvbox...@gmail.com Cc: sta...@vger.kernel.org # v3.9+ --- drivers/media/dvb-frontends/m88rs2000.c | 77 - drivers/media/dvb-frontends/m88rs2000.h | 2 + 2 files changed, 59 insertions(+), 20 deletions(-) diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c index 4da5272..8091653 100644 --- a/drivers/media/dvb-frontends/m88rs2000.c +++ b/drivers/media/dvb-frontends/m88rs2000.c @@ -110,6 +110,52 @@ static u8 m88rs2000_readreg(struct m88rs2000_state *state, u8 reg) return b1[0]; } +static u32 m88rs2000_get_mclk(struct dvb_frontend *fe) +{ + struct m88rs2000_state *state = fe-demodulator_priv; + u32 mclk; + u8 reg; + /* Must not be 0x00 or 0xff */ + reg = m88rs2000_readreg(state, 0x86); + if (!reg || reg == 0xff) + return 0; + + reg /= 2; + reg += 1; + + mclk = (u32)(reg * RS2000_FE_CRYSTAL_KHZ + 28 / 2) / 28; + + return mclk; +} + +static int m88rs2000_set_carrieroffset(struct dvb_frontend *fe, s16 offset) +{ + struct m88rs2000_state *state = fe-demodulator_priv; + u32 mclk; + s32 tmp; + u8 reg; + int ret; + + mclk = m88rs2000_get_mclk(fe); + if (!mclk) + return -EINVAL; + + tmp = (offset * 4096 + (s32)mclk / 2) / (s32)mclk; + if (tmp 0) + tmp += 4096; + + /* Carrier Offset */ + ret = m88rs2000_writereg(state, 0x9c, (u8)(tmp 4)); + + reg = m88rs2000_readreg(state, 0x9d); + reg = 0xf; + reg |= (u8)(tmp 0xf) 4; + + ret |= m88rs2000_writereg(state, 0x9d, reg); + + return ret; +} + static int m88rs2000_set_symbolrate(struct dvb_frontend *fe, u32 srate) { struct m88rs2000_state *state = fe-demodulator_priv; @@ -540,9 +586,8 @@ static int m88rs2000_set_frontend(struct dvb_frontend *fe) struct dtv_frontend_properties *c = fe-dtv_property_cache; fe_status_t status; int i, ret = 0; - s32 tmp; u32 tuner_freq; - u16 offset = 0; + s16 offset = 0; u8 reg; state-no_lock_count = 0; @@ -567,26 +612,18 @@ static int m88rs2000_set_frontend(struct dvb_frontend *fe) if (ret 0) return -ENODEV; - offset = tuner_freq - c-frequency; + offset = (s16)((s32)tuner_freq - c-frequency); - /* calculate offset assuming 96000kHz*/ - tmp = offset; - tmp *= 65536; - - tmp = (2 * tmp + 96000) / (2 * 96000); - if (tmp 0) - tmp += 65536; - - offset = tmp 0x; - - ret = m88rs2000_writereg(state, 0x9a, 0x30); - /* Unknown usually 0xc6 sometimes 0xc1 */ - reg = m88rs2000_readreg(state, 0x86); - ret |= m88rs2000_writereg(state, 0x86, reg); - /* Offset lower nibble always 0 */ - ret |= m88rs2000_writereg(state, 0x9c, (offset 8)); - ret |= m88rs2000_writereg(state, 0x9d, offset 0xf0); + /* default mclk value 96.4285 * 2 * 1000 = 192857 */ + if (((c-frequency % 192857) = (192857 - 3000)) || + (c-frequency % 192857) = 3000) + ret = m88rs2000_writereg(state, 0x86, 0xc2); + else + ret = m88rs2000_writereg(state, 0x86, 0xc6); + ret |= m88rs2000_set_carrieroffset(fe, offset); + if (ret 0) + return -ENODEV; /* Reset Demod */ ret = m88rs2000_tab_set(state, fe_reset); diff --git a/drivers/media/dvb-frontends/m88rs2000.h b/drivers/media/dvb-frontends/m88rs2000.h index 14ce31e..0a50ea9 100644 --- a/drivers/media/dvb-frontends/m88rs2000.h +++ b/drivers/media/dvb-frontends/m88rs2000.h @@ -53,6 +53,8 @@ static inline struct dvb_frontend *m88rs2000_attach( } #endif /* CONFIG_DVB_M88RS2000 */ +#define RS2000_FE_CRYSTAL_KHZ 27000 + enum { DEMOD_WRITE = 0x1, WRITE_DELAY = 0x10, -- 1.8.5.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] m88rs2000: set symbol rate accurately.
Current setting of symbol rate is not very actuate causing loss of lock. Covert temp to u64 and use mclk to calculate from big number. Calculate symbol rate by dividing symbol rate by 1000 times 1 24 and dividing sum by mclk. Add other symbol rate settings to function registers 0xa0-0xa3. In set_frontend add changes to register 0xf1 this must be done prior call to fe_reset. Register 0x00 doesn't need a second write of 0x1 Applied after patch m88rs2000: add m88rs2000_set_carrieroffset Signed-off-by: Malcolm Priestley tvbox...@gmail.com Cc: sta...@vger.kernel.org # v3.9+ --- drivers/media/dvb-frontends/m88rs2000.c | 42 - 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c index 8091653..02699c1 100644 --- a/drivers/media/dvb-frontends/m88rs2000.c +++ b/drivers/media/dvb-frontends/m88rs2000.c @@ -160,24 +160,44 @@ static int m88rs2000_set_symbolrate(struct dvb_frontend *fe, u32 srate) { struct m88rs2000_state *state = fe-demodulator_priv; int ret; - u32 temp; + u64 temp; + u32 mclk; u8 b[3]; if ((srate 100) || (srate 4500)) return -EINVAL; + mclk = m88rs2000_get_mclk(fe); + if (!mclk) + return -EINVAL; + temp = srate / 1000; - temp *= 11831; - temp /= 68; - temp -= 3; + temp *= 1 24; + + do_div(temp, mclk); b[0] = (u8) (temp 16) 0xff; b[1] = (u8) (temp 8) 0xff; b[2] = (u8) temp 0xff; + ret = m88rs2000_writereg(state, 0x93, b[2]); ret |= m88rs2000_writereg(state, 0x94, b[1]); ret |= m88rs2000_writereg(state, 0x95, b[0]); + if (srate 1000) + ret |= m88rs2000_writereg(state, 0xa0, 0x20); + else + ret |= m88rs2000_writereg(state, 0xa0, 0x60); + + ret |= m88rs2000_writereg(state, 0xa1, 0xe0); + + if (srate 1200) + ret |= m88rs2000_writereg(state, 0xa3, 0x20); + else if (srate 280) + ret |= m88rs2000_writereg(state, 0xa3, 0x98); + else + ret |= m88rs2000_writereg(state, 0xa3, 0x90); + deb_info(m88rs2000: m88rs2000_set_symbolrate\n); return ret; } @@ -307,8 +327,6 @@ struct inittab m88rs2000_shutdown[] = { struct inittab fe_reset[] = { {DEMOD_WRITE, 0x00, 0x01}, - {DEMOD_WRITE, 0xf1, 0xbf}, - {DEMOD_WRITE, 0x00, 0x01}, {DEMOD_WRITE, 0x20, 0x81}, {DEMOD_WRITE, 0x21, 0x80}, {DEMOD_WRITE, 0x10, 0x33}, @@ -351,9 +369,6 @@ struct inittab fe_trigger[] = { {DEMOD_WRITE, 0x9b, 0x64}, {DEMOD_WRITE, 0x9e, 0x00}, {DEMOD_WRITE, 0x9f, 0xf8}, - {DEMOD_WRITE, 0xa0, 0x20}, - {DEMOD_WRITE, 0xa1, 0xe0}, - {DEMOD_WRITE, 0xa3, 0x38}, {DEMOD_WRITE, 0x98, 0xff}, {DEMOD_WRITE, 0xc0, 0x0f}, {DEMOD_WRITE, 0x89, 0x01}, @@ -625,8 +640,13 @@ static int m88rs2000_set_frontend(struct dvb_frontend *fe) if (ret 0) return -ENODEV; - /* Reset Demod */ - ret = m88rs2000_tab_set(state, fe_reset); + /* Reset demod by symbol rate */ + if (c-symbol_rate 2750) + ret = m88rs2000_writereg(state, 0xf1, 0xa4); + else + ret = m88rs2000_writereg(state, 0xf1, 0xbf); + + ret |= m88rs2000_tab_set(state, fe_reset); if (ret 0) return -ENODEV; -- 1.8.5.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] it913x: Add support for Avermedia H335 id 0x0335
Signed-off-by: Malcolm Priestley tvbox...@gmail.com Cc: sta...@vger.kernel.org # v3.11+ --- drivers/media/dvb-core/dvb-usb-ids.h | 1 + drivers/media/usb/dvb-usb-v2/it913x.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h index 4a53454..8407178 100644 --- a/drivers/media/dvb-core/dvb-usb-ids.h +++ b/drivers/media/dvb-core/dvb-usb-ids.h @@ -239,6 +239,7 @@ #define USB_PID_AVERMEDIA_A835B_4835 0x4835 #define USB_PID_AVERMEDIA_1867 0x1867 #define USB_PID_AVERMEDIA_A867 0xa867 +#define USB_PID_AVERMEDIA_H335 0x0335 #define USB_PID_AVERMEDIA_TWINSTAR 0x0825 #define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006 #define USB_PID_TECHNOTREND_CONNECT_S2400_8KEEPROM 0x3009 diff --git a/drivers/media/usb/dvb-usb-v2/it913x.c b/drivers/media/usb/dvb-usb-v2/it913x.c index 1cb6899..fe95a58 100644 --- a/drivers/media/usb/dvb-usb-v2/it913x.c +++ b/drivers/media/usb/dvb-usb-v2/it913x.c @@ -799,6 +799,9 @@ static const struct usb_device_id it913x_id_table[] = { { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_CTVDIGDUAL_V2, it913x_properties, Digital Dual TV Receiver CTVDIGDUAL_V2, RC_MAP_IT913X_V1) }, + { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_H335, + it913x_properties, Avermedia H335, + RC_MAP_IT913X_V2) }, {} /* Terminating entry */ }; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: af9035 test needed!
On Thu, 2013-01-31 at 15:59 +0200, Antti Palosaari wrote: On 01/31/2013 03:04 PM, Andre Heider wrote: Hi, On Fri, Jan 11, 2013 at 7:38 PM, Antti Palosaari cr...@iki.fi wrote: Could you test that (tda18218 mxl5007t): http://git.linuxtv.org/anttip/media_tree.git/shortlog/refs/heads/it9135_tuner I got a 'TerraTec Cinergy T Stick Dual RC (rev. 2)', which is fixed by this series. Any chance to get this into 3.9 (I guess its too late for the USB VID/PID 'fix' for 3.8)? Thank you for the report! There was someone else who reported it working too. Do you want to your name as tester for the changelog? I just yesterday got that TerraTec device too and I am going to add dual tuner support. Also, for some reason IT9135 v2 devices are not working - only v1. That is one thing I should fix before merge that stuff. Hi Antti, I am going to acknowledge this development, so you are free to copy any code from the it913x and it913x-fe driver to get this working. My time is very limited at the moment, so I will try to do testing when possible. Once everything is stable enough the dvb-usb-it913x and it913x-fe modules can be removed. Acked-by: Malcolm Priestley tvbox...@gmail.com Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb id addition for Terratec Cinergy T Stick Dual rev. 2
On Mon, 2013-01-07 at 21:37 +0200, Antti Palosaari wrote: On 10/06/2012 06:40 PM, Mauro Carvalho Chehab wrote: Em Mon, 01 Oct 2012 14:21:34 +0300 Antti Palosaari cr...@iki.fi escreveu: On 10/01/2012 02:15 PM, Mauro Carvalho Chehab wrote: Em Sun, 30 Sep 2012 19:36:50 +0200 Damien Bally bir...@free.fr escreveu: Le 29/09/2012 19:33, Mauro Carvalho Chehab a écrit : It seems that the it931x variant has bcdDevice equal to 2.00, from Damien's email: idVendor 0x0ccd TerraTec Electronic GmbH idProduct 0x0099 bcdDevice2.00 iManufacturer 1 ITE Technologies, Inc. iProduct2 DVB-T TV Stick iSerial 0 If the af9015 variant uses another bcdDevice, the fix should be simple. Alas, according to http://www.linuxtv.org/wiki/index.php/TerraTec_Cinergy_T_USB_Dual_RC the af9015 variant appears to have the same bcdDevice. I join both lsusb outputs for comparison. Well, then the alternative is to let both drivers to handle this USB ID, and add a code there on each of them that will check if the device is the right one, perhaps by looking at iProduct string. If the driver doesn't recognize it, it should return -ENODEV at .probe() time. The USB core will call the second driver. It is the easiest solution, but there should be very careful. Those strings could change from device to device. I used earlier af9015 eeprom hash (those string as coming from the eeprom) to map TerraTec dual remote controller and git bug report quite soon as it didn't worked. After I looked the reason I found out they was changed some not meaningful value. Yeah, those strings can change, especially when vendors don't care enough to use a different USB ID/bcdDevice for different models. Yet, seems to be the cleaner approach, among the alternatives. Damien, care to test? http://git.linuxtv.org/anttip/media_tree.git/shortlog/refs/heads/it9135_tuner I split tuner out from IT9135 driver and due to that AF9035 driver supports IT9135 too (difference between AF9035 and IT9135 is integrated RF-tuner). I added iManufacturer based checks for both AF9015 and AF9035 drivers I can't see the point of adding this to the af9035/af9033 driver. It is going to turn into one enormous blob. The it913x is a stable driver and has it own entity moving forward. The only thing that needs to happen is the id is added to it913x driver and if it doesn't apply drop it. Nack. Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ts2020: call get_rf_strength from frontend
Restore ds3000.c read_signal_strength. Call tuner get_rf_strength from frontend read_signal_strength. We are able to do a NULL check and doesn't limit the tuner attach to the frontend attach area. At the moment the lmedm04 tuner attach is stuck in frontend attach area. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/dvb-frontends/ds3000.c| 10 ++ drivers/media/dvb-frontends/m88rs2000.c | 4 +++- drivers/media/dvb-frontends/ts2020.c| 1 - 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb-frontends/ds3000.c b/drivers/media/dvb-frontends/ds3000.c index d128f85..1e344b0 100644 --- a/drivers/media/dvb-frontends/ds3000.c +++ b/drivers/media/dvb-frontends/ds3000.c @@ -533,6 +533,15 @@ static int ds3000_read_ber(struct dvb_frontend *fe, u32* ber) return 0; } +static int ds3000_read_signal_strength(struct dvb_frontend *fe, + u16 *signal_strength) +{ + if (fe-ops.tuner_ops.get_rf_strength) + fe-ops.tuner_ops.get_rf_strength(fe, signal_strength); + + return 0; +} + /* calculate DS3000 snr value in dB */ static int ds3000_read_snr(struct dvb_frontend *fe, u16 *snr) { @@ -1102,6 +,7 @@ static struct dvb_frontend_ops ds3000_ops = { .i2c_gate_ctrl = ds3000_i2c_gate_ctrl, .read_status = ds3000_read_status, .read_ber = ds3000_read_ber, + .read_signal_strength = ds3000_read_signal_strength, .read_snr = ds3000_read_snr, .read_ucblocks = ds3000_read_ucblocks, .set_voltage = ds3000_set_voltage, diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c index 283c90f..4da5272 100644 --- a/drivers/media/dvb-frontends/m88rs2000.c +++ b/drivers/media/dvb-frontends/m88rs2000.c @@ -446,7 +446,9 @@ static int m88rs2000_read_ber(struct dvb_frontend *fe, u32 *ber) static int m88rs2000_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { - *strength = 0; + if (fe-ops.tuner_ops.get_rf_strength) + fe-ops.tuner_ops.get_rf_strength(fe, strength); + return 0; } diff --git a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c index f50e237..ad7ad85 100644 --- a/drivers/media/dvb-frontends/ts2020.c +++ b/drivers/media/dvb-frontends/ts2020.c @@ -363,7 +363,6 @@ struct dvb_frontend *ts2020_attach(struct dvb_frontend *fe, memcpy(fe-ops.tuner_ops, ts2020_tuner_ops, sizeof(struct dvb_tuner_ops)); - fe-ops.read_signal_strength = fe-ops.tuner_ops.get_rf_strength; return fe; } -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ts2020: call get_rf_strength from frontend
On Sun, 2013-01-06 at 15:37 +0200, Antti Palosaari wrote: On 01/06/2013 02:40 PM, Malcolm Priestley wrote: Restore ds3000.c read_signal_strength. Call tuner get_rf_strength from frontend read_signal_strength. We are able to do a NULL check and doesn't limit the tuner attach to the frontend attach area. At the moment the lmedm04 tuner attach is stuck in frontend attach area. I would like to nack that, as I see some problems: 1) it changes deviation against normal procedures 2) interface driver (usb/pci) should have full control to make decision 3) you shoot to our own leg easily in power management This patch does not do any operational changes, and is a proper way to call to another module with a run time NULL check. The same way as another tuner function from demodulator is called. * actually bug 3) already happened some drivers, like rtl28xxu. Tuner is behind demod and demod is put sleep = no access to tuner. FE callback is overridden (just like you are trying to do as default) which means user-space could still make queries = I/O errors. In such cases, the tuner init/sleep should also be called. Regards Malcolm Antti Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/dvb-frontends/ds3000.c| 10 ++ drivers/media/dvb-frontends/m88rs2000.c | 4 +++- drivers/media/dvb-frontends/ts2020.c| 1 - 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb-frontends/ds3000.c b/drivers/media/dvb-frontends/ds3000.c index d128f85..1e344b0 100644 --- a/drivers/media/dvb-frontends/ds3000.c +++ b/drivers/media/dvb-frontends/ds3000.c @@ -533,6 +533,15 @@ static int ds3000_read_ber(struct dvb_frontend *fe, u32* ber) return 0; } +static int ds3000_read_signal_strength(struct dvb_frontend *fe, + u16 *signal_strength) +{ + if (fe-ops.tuner_ops.get_rf_strength) + fe-ops.tuner_ops.get_rf_strength(fe, signal_strength); + + return 0; +} + /* calculate DS3000 snr value in dB */ static int ds3000_read_snr(struct dvb_frontend *fe, u16 *snr) { @@ -1102,6 +,7 @@ static struct dvb_frontend_ops ds3000_ops = { .i2c_gate_ctrl = ds3000_i2c_gate_ctrl, .read_status = ds3000_read_status, .read_ber = ds3000_read_ber, + .read_signal_strength = ds3000_read_signal_strength, .read_snr = ds3000_read_snr, .read_ucblocks = ds3000_read_ucblocks, .set_voltage = ds3000_set_voltage, diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c index 283c90f..4da5272 100644 --- a/drivers/media/dvb-frontends/m88rs2000.c +++ b/drivers/media/dvb-frontends/m88rs2000.c @@ -446,7 +446,9 @@ static int m88rs2000_read_ber(struct dvb_frontend *fe, u32 *ber) static int m88rs2000_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { - *strength = 0; + if (fe-ops.tuner_ops.get_rf_strength) + fe-ops.tuner_ops.get_rf_strength(fe, strength); + return 0; } diff --git a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c index f50e237..ad7ad85 100644 --- a/drivers/media/dvb-frontends/ts2020.c +++ b/drivers/media/dvb-frontends/ts2020.c @@ -363,7 +363,6 @@ struct dvb_frontend *ts2020_attach(struct dvb_frontend *fe, memcpy(fe-ops.tuner_ops, ts2020_tuner_ops, sizeof(struct dvb_tuner_ops)); - fe-ops.read_signal_strength = fe-ops.tuner_ops.get_rf_strength; return fe; } -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ts2020: call get_rf_strength from frontend
On Sun, 2013-01-06 at 20:45 +0200, Antti Palosaari wrote: On 01/06/2013 08:14 PM, Malcolm Priestley wrote: On Sun, 2013-01-06 at 15:37 +0200, Antti Palosaari wrote: On 01/06/2013 02:40 PM, Malcolm Priestley wrote: Restore ds3000.c read_signal_strength. Call tuner get_rf_strength from frontend read_signal_strength. We are able to do a NULL check and doesn't limit the tuner attach to the frontend attach area. At the moment the lmedm04 tuner attach is stuck in frontend attach area. I would like to nack that, as I see some problems: 1) it changes deviation against normal procedures 2) interface driver (usb/pci) should have full control to make decision 3) you shoot to our own leg easily in power management This patch does not do any operational changes, and is a proper way to call to another module with a run time NULL check. The same way as another tuner function from demodulator is called. uh, certainly I understand it does not change functionality in that case! I tried to point out it is logically insane and error proof. Ee should make this kind of direct calls between drivers as less as possible - just to make life easier in future. It could work for you, but for some other it could cause problems as hardware is designed differently. * actually bug 3) already happened some drivers, like rtl28xxu. Tuner is behind demod and demod is put sleep = no access to tuner. FE callback is overridden (just like you are trying to do as default) which means user-space could still make queries = I/O errors. In such cases, the tuner init/sleep should also be called. ??? I think you don't understand functionality at all! Please, I have been working with the I2C bus in the electronics field for the last 20 years. If you are really worried about the the tuner being a sleep. You add fe variable check this in it's own init/sleep and define the function something like this. static int fe_foo_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { struct fe_foo_state *state = fe-demodulator_priv; if (state-fe_inactive) { ... any extra commands to restore tuner power if (fe-ops.tuner_ops.init) fe-ops.tuner_ops.init(fe); } if (fe-ops.tuner_ops.get_rf_strength) fe-ops.tuner_ops.get_rf_strength(fe, strength); if (state-fe_inactive) { if (fe-ops.tuner_ops.sleep) fe-ops.tuner_ops.sleep(fe); ... any extra commands to remove tuner power } return 0; } However, I think this is unnecessary in the rs2000 and ds3000. Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ts2020.c: ts2020_set_params [BUG] point to fe-tuner_priv.
Fixes corruption of fe-demodulator_priv Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/dvb-frontends/ts2020.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c index 94e3fe2..f50e237 100644 --- a/drivers/media/dvb-frontends/ts2020.c +++ b/drivers/media/dvb-frontends/ts2020.c @@ -182,7 +182,7 @@ static int ts2020_set_tuner_rf(struct dvb_frontend *fe) static int ts2020_set_params(struct dvb_frontend *fe) { struct dtv_frontend_properties *c = fe-dtv_property_cache; - struct ts2020_priv *priv = fe-demodulator_priv; + struct ts2020_priv *priv = fe-tuner_priv; int ret; u32 frequency = c-frequency; s32 offset_khz; -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] lmedm04: correct I2C values to 7 bit addressing.
On Fri, 2012-12-28 at 22:04 -0200, Mauro Carvalho Chehab wrote: Em Sat, 29 Dec 2012 01:06:29 +0300 Igor M. Liplianin liplia...@me.by escreveu: On 27 декабрÑ_ 2012 19:33:38 Mauro Carvalho Chehab wrote: Hi Igor, Hi Mauro, Em Mon, 24 Dec 2012 11:23:56 +0300 Igor M. Liplianin liplia...@me.by escreveu: The following changes since commit 8b2aea7878f64814544d0527c659011949d52358: [media] em28xx: prefer bulk mode on webcams (2012-12-23 17:24:30 -0200) are available in the git repository at: git://git.linuxtv.org/liplianin/media_tree.git ts2020_v3.9 for you to fetch changes up to 2ff52e6f487c2ee841f3df9709d1b4e4416a1b15: ts2020: separate from m88rs2000 (2012-12-24 01:26:12 +0300) Applied, thanks. Hi all, The separation the lmedm04 fails on the ts2020 portion because the correct I2C addressing. So, it's time to correct the addressing in the remainder of lmedm04. Tested all tuners. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 29 +++-- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index b5e1f73..f30c58c 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -627,8 +627,8 @@ static int lme2510_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], gate = 5; for (i = 0; i num; i++) { - read_o = 1 (msg[i].flags I2C_M_RD); - read = i+1 num (msg[i+1].flags I2C_M_RD); + read_o = msg[i].flags I2C_M_RD; + read = i + 1 num msg[i + 1].flags I2C_M_RD; read |= read_o; gate = (msg[i].addr == st-i2c_tuner_addr) ? (read)? st-i2c_tuner_gate_r @@ -641,7 +641,8 @@ static int lme2510_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], else obuf[1] = msg[i].len + read + 1; - obuf[2] = msg[i].addr; + obuf[2] = msg[i].addr 1; + if (read) { if (read_o) len = 3; @@ -895,27 +896,27 @@ static int lme2510_kill_urb(struct usb_data_stream *stream) } static struct tda10086_config tda10086_config = { - .demod_address = 0x1c, + .demod_address = 0x0e, .invert = 0, .diseqc_tone = 1, .xtal_freq = TDA10086_XTAL_16M, }; static struct stv0288_config lme_config = { - .demod_address = 0xd0, + .demod_address = 0x68, .min_delay_ms = 15, .inittab = s7395_inittab, }; static struct ix2505v_config lme_tuner = { - .tuner_address = 0xc0, + .tuner_address = 0x60, .min_delay_ms = 100, .tuner_gain = 0x0, .tuner_chargepump = 0x3, }; static struct stv0299_config sharp_z0194_config = { - .demod_address = 0xd0, + .demod_address = 0x68, .inittab = sharp_z0194a_inittab, .mclk = 8800UL, .invert = 0, @@ -944,7 +945,7 @@ static int dm04_rs2000_set_ts_param(struct dvb_frontend *fe, } static struct m88rs2000_config m88rs2000_config = { - .demod_addr = 0xd0, + .demod_addr = 0x68, .set_ts_params = dm04_rs2000_set_ts_param, }; @@ -1054,7 +1055,7 @@ static int dm04_lme2510_frontend_attach(struct dvb_usb_adapter *adap) info(TUN Found Frontend TDA10086); st-i2c_tuner_gate_w = 4; st-i2c_tuner_gate_r = 4; - st-i2c_tuner_addr = 0xc0; + st-i2c_tuner_addr = 0x60; st-tuner_config = TUNER_LG; if (st-dvb_usb_lme2510_firmware != TUNER_LG) { st-dvb_usb_lme2510_firmware = TUNER_LG; @@ -1070,7 +1071,7 @@ static int dm04_lme2510_frontend_attach(struct dvb_usb_adapter *adap) info(FE Found Stv0299); st-i2c_tuner_gate_w = 4; st-i2c_tuner_gate_r = 5; - st-i2c_tuner_addr = 0xc0; + st-i2c_tuner_addr = 0x60; st-tuner_config = TUNER_S0194; if (st-dvb_usb_lme2510_firmware != TUNER_S0194) { st-dvb_usb_lme2510_firmware = TUNER_S0194; @@ -1087,7 +1088,7 @@ static int dm04_lme2510_frontend_attach(struct dvb_usb_adapter *adap) info(FE Found Stv0288); st-i2c_tuner_gate_w = 4; st-i2c_tuner_gate_r = 5; - st-i2c_tuner_addr = 0xc0; + st-i2c_tuner_addr = 0x60; st-tuner_config = TUNER_S7395; if (st-dvb_usb_lme2510_firmware != TUNER_S7395
Re: [PATCH RFC 08/11] it913x: remove unused define and increase module version
On Mon, 2012-12-10 at 02:45 +0200, Antti Palosaari wrote: Cc: Malcolm Priestley tvbox...@gmail.com Signed-off-by: Antti Palosaari cr...@iki.fi --- Acked-by: Malcolm Priestley tvbox...@gmail.com drivers/media/usb/dvb-usb-v2/it913x.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/it913x.c b/drivers/media/usb/dvb-usb-v2/it913x.c index 5dc352b..3d20e38 100644 --- a/drivers/media/usb/dvb-usb-v2/it913x.c +++ b/drivers/media/usb/dvb-usb-v2/it913x.c @@ -309,7 +309,6 @@ static struct i2c_algorithm it913x_i2c_algo = { /* Callbacks for DVB USB */ #if defined(CONFIG_RC_CORE) || defined(CONFIG_RC_CORE_MODULE) -#define IT913X_POLL 250 static int it913x_rc_query(struct dvb_usb_device *d) { u8 ibuf[4]; @@ -801,7 +800,7 @@ module_usb_driver(it913x_driver); MODULE_AUTHOR(Malcolm Priestley tvbox...@gmail.com); MODULE_DESCRIPTION(it913x USB 2 Driver); -MODULE_VERSION(1.32); +MODULE_VERSION(1.33); MODULE_LICENSE(GPL); MODULE_FIRMWARE(FW_IT9135_V1); MODULE_FIRMWARE(FW_IT9135_V2); -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: it913x driver with USB1.1
On 07/11/12 23:43, Antti Palosaari wrote: Malcolm, Have you newer tested it with USB1.1 port? Stream is totally broken. Hi Antti Hmm, yes it is a bit choppy on dvb-usb-v2. I will have a look at it. Regards Malcolm regards Antti -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] it913x: [BUG] fix correct endpoint size when pid filter on.
On Thu, 2012-11-08 at 22:18 +0200, Antti Palosaari wrote: On 11/08/2012 07:48 PM, Malcolm Priestley wrote: On 07/11/12 23:43, Antti Palosaari wrote: Malcolm, Have you newer tested it with USB1.1 port? Stream is totally broken. Hi Antti Hmm, yes it is a bit choppy on dvb-usb-v2. I will have a look at it. Fedora's stock 3.6.5-1.fc17.x86_64 is even more worse - no picture at all when using vlc. Clearly visible difference is pid filter count. dvb-usb says 5 filters whilst dvb-usb-v2 says 32 pid filters. dvb_usb_v2: will use the device's hardware PID filter (table count: 32) dvb-usb: will use the device's hardware PID filter (table count: 5). I kept the count as the hardware default with dvb-usb-v2, with 5, users can still run in to trouble with Video PIDs. I have traced it to an incorrect endpoint size when the PID filter is enabled. It also affected USB 2.0 with the filter on. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/usb/dvb-usb-v2/it913x.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/dvb-usb-v2/it913x.c b/drivers/media/usb/dvb-usb-v2/it913x.c index 695f910..29300e3 100644 --- a/drivers/media/usb/dvb-usb-v2/it913x.c +++ b/drivers/media/usb/dvb-usb-v2/it913x.c @@ -643,7 +643,8 @@ static int it913x_frontend_attach(struct dvb_usb_adapter *adap) struct it913x_state *st = d-priv; int ret = 0; u8 adap_addr = I2C_BASE_ADDR + (adap-id 5); - u16 ep_size = adap-stream.buf_size / 4; + u16 ep_size = (adap-pid_filtering) ? TS_BUFFER_SIZE_PID / 4 : + TS_BUFFER_SIZE_MAX / 4; u8 pkt_size = 0x80; if (d-udev-speed != USB_SPEED_HIGH) -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] add MAINTAINERS entry
Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- MAINTAINERS | 40 1 file changed, 40 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 28eeaec..ac738f5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4100,6 +4100,22 @@ S: Maintained F: Documentation/hwmon/it87 F: drivers/hwmon/it87.c +IT913X MEDIA DRIVER +M: Malcolm Priestley tvbox...@gmail.com +L: linux-media@vger.kernel.org +W: http://linuxtv.org/ +Q: http://patchwork.linuxtv.org/project/linux-media/list/ +S: Maintained +F: drivers/media/usb/dvb-usb-v2/it913x* + +IT913X FE MEDIA DRIVER +M: Malcolm Priestley tvbox...@gmail.com +L: linux-media@vger.kernel.org +W: http://linuxtv.org/ +Q: http://patchwork.linuxtv.org/project/linux-media/list/ +S: Maintained +F: drivers/media/dvb-frontends/it913x-fe* + IVTV VIDEO4LINUX DRIVER M: Andy Walls awa...@md.metrocast.net L: ivtv-de...@ivtvdriver.org (moderated for non-subscribers) @@ -4111,6 +4127,14 @@ F: Documentation/video4linux/*.ivtv F: drivers/media/pci/ivtv/ F: include/linux/ivtv* +IX2505V MEDIA DRIVER +M: Malcolm Priestley tvbox...@gmail.com +L: linux-media@vger.kernel.org +W: http://linuxtv.org/ +Q: http://patchwork.linuxtv.org/project/linux-media/list/ +S: Maintained +F: drivers/media/dvb-frontends/ix2505v* + JC42.4 TEMPERATURE SENSOR DRIVER M: Guenter Roeck li...@roeck-us.net L: lm-sens...@lm-sensors.org @@ -4555,6 +4579,14 @@ S: Maintained F: Documentation/hwmon/lm90 F: drivers/hwmon/lm90.c +LME2510 MEDIA DRIVER +M: Malcolm Priestley tvbox...@gmail.com +L: linux-media@vger.kernel.org +W: http://linuxtv.org/ +Q: http://patchwork.linuxtv.org/project/linux-media/list/ +S: Maintained +F: drivers/media/usb/dvb-usb-v2/lmedm04* + LOCKDEP AND LOCKSTAT M: Peter Zijlstra pet...@infradead.org M: Ingo Molnar mi...@redhat.com @@ -4645,6 +4677,14 @@ W: http://www.tazenda.demon.co.uk/phil/linux-hp S: Maintained F: arch/m68k/hp300/ +M88RS2000 MEDIA DRIVER +M: Malcolm Priestley tvbox...@gmail.com +L: linux-media@vger.kernel.org +W: http://linuxtv.org/ +Q: http://patchwork.linuxtv.org/project/linux-media/list/ +S: Maintained +F: drivers/media/dvb-frontends/m88rs2000* + MAC80211 M: Johannes Berg johan...@sipsolutions.net L: linux-wirel...@vger.kernel.org -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] it913x [BUG] Enable endpoint 3 on devices with HID interface.
On some USB controllers when endpoint 3 (used by HID) is not enabled this causes a USB reset. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/usb/dvb-usb-v2/it913x.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/dvb-usb-v2/it913x.c b/drivers/media/usb/dvb-usb-v2/it913x.c index 695f910..4498f60 100644 --- a/drivers/media/usb/dvb-usb-v2/it913x.c +++ b/drivers/media/usb/dvb-usb-v2/it913x.c @@ -659,13 +659,19 @@ static int it913x_frontend_attach(struct dvb_usb_adapter *adap) it913x_wr_reg(d, DEV_0_DMOD, MP2IF2_SW_RST, 0x1); it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x0f); it913x_wr_reg(d, DEV_0, EP0_TX_NAK, 0x1b); - it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x2f); + if (st-proprietary_ir == false) /* Enable endpoint 3 */ + it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x3f); + else + it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x2f); it913x_wr_reg(d, DEV_0, EP4_TX_LEN_LSB, ep_size 0xff); it913x_wr_reg(d, DEV_0, EP4_TX_LEN_MSB, ep_size 8); ret = it913x_wr_reg(d, DEV_0, EP4_MAX_PKT, pkt_size); } else if (adap-id == 1 adap-fe[0]) { - it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x6f); + if (st-proprietary_ir == false) + it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x7f); + else + it913x_wr_reg(d, DEV_0, EP0_TX_EN, 0x6f); it913x_wr_reg(d, DEV_0, EP5_TX_LEN_LSB, ep_size 0xff); it913x_wr_reg(d, DEV_0, EP5_TX_LEN_MSB, ep_size 8); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb id addition for Terratec Cinergy T Stick Dual rev. 2
On Fri, 2012-09-28 at 20:55 +0300, Antti Palosaari wrote: On 09/28/2012 07:34 PM, Damien Bally wrote: I will NACK that initially because that USB ID already used by AF9015 driver. You have to explain / study what happens when AF9015 driver claims that device same time. Hi Antti With the Cinergy stick alone, dvb_usb_af9015 is predictably loaded, but doesn't prevent dvb_usb_it913x from working nicely. If an afatech 9015 stick is connected, such as an AverTV Volar Black HD (A850), it will be recognized and doesn't affect the other device. *But* it runs into trouble if the two devices were connected at bootup, or if the Cinergy stick is inserted after the other one : I am not sure what you do here but let it be clear. There is same ID used by af9015 and it913x. Both drivers are loaded when that ID appears. What I understand *both* drivers, af9015 and it913x should detect if device is correct or not. If device is af9015 then it913x should reject it with -ENODEV most likely without a I/O. If device is it913x then af9015 should reject the device similarly. And you must find out how to do that. It is not acceptable both drivers starts doing I/O for same device same time. Hi All Which module is loaded first depends on the order in /lib/modules/$(uname -r)/modules.usbmap Its is likely that af9015 will be first, so the it913x will need to be loaded first by added it to /etc/modules. I recall a similar problem exists with the DiB3000M-B driver with its faulty IDs. A solution may be for Cinergy to have its own module with extern access to both dvb_usb_device_properties structures and dvb_usbv2_probe them twice. Regards Malcolm regards Antti --- [1.264018] usb 2-1: new high speed USB device using ehci_hcd and address 2 [1.382487] usb 2-1: New USB device found, idVendor=0ccd, idProduct=0099 [1.382490] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [1.382492] usb 2-1: Product: DVB-T TV Stick [1.382494] usb 2-1: Manufacturer: ITE Technologies, Inc. [1.385073] input: ITE Technologies, Inc. DVB-T TV Stick as /devices/pci:00/:00:1d.7/usb2/2-1/2-1:1.1/input/input1 [1.385147] generic-usb 0003:0CCD:0099.0001: input,hidraw0: USB HID v1.01 Keyboard [ITE Technologies, Inc. DVB-T TV Stick] on usb-:00:1d.7-1 input1 [5.045527] usbcore: registered new interface driver dvb_usb_it913x [5.147276] it913x: Chip Version=01 Chip Type=9135 [5.147524] it913x: Firmware Version 33684956 [5.148649] it913x: Remote HID mode NOT SUPPORTED [5.149024] it913x: Dual mode=3 Tuner Type=0 [5.149028] usb 2-1: dvb_usbv2: found a 'ITE 9135(9006) Generic' in warm state [5.149077] usb 2-1: dvb_usbv2: will pass the complete MPEG2 transport stream to the software demuxer [5.149307] DVB: registering new adapter (ITE 9135(9006) Generic) [5.174907] usb 1-4: dvb_usbv2: downloading firmware from file 'dvb-usb-af9015.fw' [5.241934] usb 1-4: dvb_usbv2: found a 'AverMedia AVerTV Volar Black HD (A850)' in warm state [5.614827] usb 1-4: dvb_usbv2: will pass the complete MPEG2 transport stream to the software demuxer [5.614866] DVB: registering new adapter (AverMedia AVerTV Volar Black HD (A850)) [5.710026] af9013: firmware version 4.95.0.0 [5.712151] DVB: registering adapter 1 frontend 0 (Afatech AF9013)... [5.813139] MXL5005S: Attached at address 0xc6 [5.818896] usb 1-4: dvb_usbv2: 'AverMedia AVerTV Volar Black HD (A850)' successfully initialized and connected [7.266161] usb 2-1: dvb_usbv2: 2nd usb_bulk_msg() failed=-110 [7.266247] it913x-fe: ADF table value:00 [9.267200] usb 2-1: dvb_usbv2: 2nd usb_bulk_msg() failed=-110 [ 11.267153] usb 2-1: dvb_usbv2: 2nd usb_bulk_msg() failed=-110 [ 13.267250] usb 2-1: dvb_usbv2: 2nd usb_bulk_msg() failed=-110 [ 15.267089] usb 2-1: dvb_usbv2: 2nd usb_bulk_msg() failed=-110 [ 17.267162] usb 2-1: dvb_usbv2: 2nd usb_bulk_msg() failed=-110 [ 19.267139] usb 2-1: dvb_usbv2: 2nd usb_bulk_msg() failed=-110 [ 19.267218] it913x-fe: Crystal Frequency :1200 Adc Frequency :2025 ADC X2: 01 [ 19.267296] usb 2-1: dvb_usbv2: 'ITE 9135(9006) Generic' error while loading driver (-19) [ 19.267472] usb 2-1: dvb_usbv2: 'ITE 9135(9006) Generic' successfully deinitialized and disconnected --- I'm unfortunately not able to rewrite the driver, but I'm willing to provide any information about the device to help its correct identification. Here is what lsusb yields : --- Bus 002 Device 003: ID 0ccd:0099 TerraTec Electronic GmbH Device Descriptor: bLength18 bDescriptorType 1
Re: ITE9135 on AMD SB700 - ehci_hcd bug
On Wed, 2012-09-12 at 08:32 +0200, Marx wrote: Hello I'm trying to use dual DVB-T tuner based on ITE9135 tuner. I use Debian kernel 3.5-trunk-686-pae. My motherboard is AsRock E350M1 (no USB3 ports). Tuner is detected ok, see log at the end of post. When I try to scan channels, bug happens: Sep 11 17:16:31 wuwek kernel: [ 209.291329] ehci_hcd :00:13.2: force halt; handshake f821a024 4000 - -110 Sep 11 17:16:31 wuwek kernel: [ 209.291401] ehci_hcd :00:13.2: HC died; cleaning up Sep 11 17:16:31 wuwek kernel: [ 209.291606] usb 2-3: USB disconnect, device number 2 Sep 11 17:16:41 wuwek kernel: [ 219.312848] dvb-usb: error while stopping stream. Sep 11 17:16:41 wuwek kernel: [ 219.320585] dvb-usb: ITE 9135(9006) Generic successfully deinitialized and disconnected. After trying many ways I've read about problems with ehci on SB700 based boards and switched off ehci via command sh -c 'echo -n :00:13.2 unbind' and now ehci bug doesn't happen. Of course I can see only one tuner and in slower USB mode (see log at the end). But now I can scan succesfully without any errors. Of course it isn't acceptable fix for my problem. Drivers for ITE9135 seems ok, but there is a problem with ehci_hcd on my motherboard. I would like to know what can I do to fix my problem. Hi Marx The only thing I can think of is the firmware for dual ite 9135(9006) chip version 1 may be different. Make sure you only scan on adapter 0 on ehci. If you want to send me privately a copy of the IT9135BDA.sys file from /WINDOWS/system32/drivers directory. I can extract and test that firmware against the devices I have and eliminate the Linux driver. Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
media_build duplicate module structures
Hi Updating older kernels with media_build does not remove the old file structure. Running /sbin/depmod will mean the new structure will have two modules of the same name causing module conflicts. The entire old structure needs to be removed first. rm -r /lib/modules/$(uname -r)/kernel/drivers/media Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] re: [media] lmedm04: fix build
On Mon, 2012-08-13 at 19:58 +0300, Dan Carpenter wrote: Hello Mauro Carvalho Chehab, The patch db6651a9ebb3: [media] lmedm04: fix build from Aug 12, 2012, leads to the following warning: drivers/media/dvb/dvb-usb-v2/lmedm04.c:769 lme2510_download_firmware() error: usb_control_msg() 'data' too small (128 vs 265) 737 data = kzalloc(128, GFP_KERNEL); ^^^ data is 128 bytes. Hi All Control isn't used, so remove it. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/dvb/dvb-usb-v2/lmedm04.c |4 1 file changed, 4 deletions(-) diff --git a/drivers/media/dvb/dvb-usb-v2/lmedm04.c b/drivers/media/dvb/dvb-usb-v2/lmedm04.c index c6bc1b8..c41d9d9 100644 --- a/drivers/media/dvb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/dvb/dvb-usb-v2/lmedm04.c @@ -766,10 +766,6 @@ static int lme2510_download_firmware(struct dvb_usb_device *d, } } - usb_control_msg(d-udev, usb_rcvctrlpipe(d-udev, 0), - 0x06, 0x80, 0x0200, 0x00, data, 0x0109, 1000); - - data[0] = 0x8a; len_in = 1; msleep(2000); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] it913x ver 1.32 driver moved to dvb-usb-v2
Functional changes PID filter is default to off and controlled from dvb-usb-v2 Driver now supports suspend and resume changes in dvb-usb-v2 USB bus repeater functions have been removed. Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/dvb/dvb-usb-v2/Kconfig |7 + drivers/media/dvb/dvb-usb-v2/Makefile |3 + drivers/media/dvb/dvb-usb-v2/it913x.c | 799 drivers/media/dvb/dvb-usb/Kconfig |7 - drivers/media/dvb/dvb-usb/Makefile|3 - drivers/media/dvb/dvb-usb/it913x.c| 931 - 6 files changed, 809 insertions(+), 941 deletions(-) create mode 100644 drivers/media/dvb/dvb-usb-v2/it913x.c delete mode 100644 drivers/media/dvb/dvb-usb/it913x.c diff --git a/drivers/media/dvb/dvb-usb-v2/Kconfig b/drivers/media/dvb/dvb-usb-v2/Kconfig index 14a635b..e4a1b4f 100644 --- a/drivers/media/dvb/dvb-usb-v2/Kconfig +++ b/drivers/media/dvb/dvb-usb-v2/Kconfig @@ -102,6 +102,13 @@ config DVB_USB_GL861 Say Y here to support the MSI Megasky 580 (55801) DVB-T USB2.0 receiver with USB ID 0db0:5581. +config DVB_USB_IT913X + tristate ITE IT913X DVB-T USB2.0 support + depends on DVB_USB_V2 + select DVB_IT913X_FE + help + Say Y here to support the ITE IT913X DVB-T USB2.0 + config DVB_USB_LME2510 tristate LME DM04/QQBOX DVB-S USB2.0 support depends on DVB_USB_V2 diff --git a/drivers/media/dvb/dvb-usb-v2/Makefile b/drivers/media/dvb/dvb-usb-v2/Makefile index 26659bc..3c3cc23 100644 --- a/drivers/media/dvb/dvb-usb-v2/Makefile +++ b/drivers/media/dvb/dvb-usb-v2/Makefile @@ -25,6 +25,9 @@ obj-$(CONFIG_DVB_USB_CE6230) += dvb-usb-ce6230.o dvb-usb-ec168-objs = ec168.o obj-$(CONFIG_DVB_USB_EC168) += dvb-usb-ec168.o +dvb-usb-it913x-objs = it913x.o +obj-$(CONFIG_DVB_USB_IT913X) += dvb-usb-it913x.o + dvb-usb-lmedm04-objs = lmedm04.o obj-$(CONFIG_DVB_USB_LME2510) += dvb-usb-lmedm04.o diff --git a/drivers/media/dvb/dvb-usb-v2/it913x.c b/drivers/media/dvb/dvb-usb-v2/it913x.c new file mode 100644 index 000..695f910 --- /dev/null +++ b/drivers/media/dvb/dvb-usb-v2/it913x.c @@ -0,0 +1,799 @@ +/* + * DVB USB compliant linux driver for ITE IT9135 and IT9137 + * + * Copyright (C) 2011 Malcolm Priestley (tvbox...@gmail.com) + * IT9135 (C) ITE Tech Inc. + * IT9137 (C) ITE Tech Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License Version 2, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + * see Documentation/dvb/README.dvb-usb for more information + * see Documentation/dvb/it9137.txt for firmware information + * + */ +#define DVB_USB_LOG_PREFIX it913x + +#include linux/usb.h +#include linux/usb/input.h +#include media/rc-core.h + +#include dvb_usb.h +#include it913x-fe.h + +/* debug */ +static int dvb_usb_it913x_debug; +#define it_debug(var, level, args...) \ + do { if ((var level)) pr_debug(DVB_USB_LOG_PREFIX: args); \ +} while (0) +#define deb_info(level, args...) it_debug(dvb_usb_it913x_debug, level, args) +#define info(args...) pr_info(DVB_USB_LOG_PREFIX: args) + +module_param_named(debug, dvb_usb_it913x_debug, int, 0644); +MODULE_PARM_DESC(debug, set debugging level (1=info (or-able)).); + +static int dvb_usb_it913x_firmware; +module_param_named(firmware, dvb_usb_it913x_firmware, int, 0644); +MODULE_PARM_DESC(firmware, set firmware 0=auto\ + 1=IT9137 2=IT9135 V1 3=IT9135 V2); +#define FW_IT9137 dvb-usb-it9137-01.fw +#define FW_IT9135_V1 dvb-usb-it9135-01.fw +#define FW_IT9135_V2 dvb-usb-it9135-02.fw + +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); + +struct it913x_state { + struct ite_config it913x_config; + u8 pid_filter_onoff; + bool proprietary_ir; + int cmd_counter; +}; + +static u16 check_sum(u8 *p, u8 len) +{ + u16 sum = 0; + u8 i = 1; + while (i len) + sum += (i++ 1) ? (*p++) 8 : *p++; + return ~sum; +} + +static int it913x_io(struct dvb_usb_device *d, u8 mode, u8 pro, + u8 cmd, u32 reg, u8 addr, u8 *data, u8 len) +{ + struct it913x_state *st = d-priv; + int ret = 0, i, buf_size = 1; + u8 *buff; + u8 rlen; + u16 chk_sum; + + buff = kzalloc(256, GFP_KERNEL); + if (!buff) { + info(USB Buffer Failed); + return -ENOMEM; + } + + buff[buf_size++] = pro; + buff[buf_size++] = cmd; + buff[buf_size++] = st-cmd_counter
[PATCH] lmedm04 2.06 conversion to dvb-usb-v2 version 2
Conversion of lmedm04 to dvb-usb-v2 Functional changes m88rs2000 tuner now uses all callbacks. TODO migrate other tuners to the callbacks. This patch is applied on top of [BUG] Re: dvb_usb_lmedm04 crash Kernel (rs2000) http://patchwork.linuxtv.org/patch/13584/ Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/dvb/dvb-usb-v2/Kconfig | 13 + drivers/media/dvb/dvb-usb-v2/Makefile |3 + .../media/dvb/{dvb-usb = dvb-usb-v2}/lmedm04.c| 588 +--- .../media/dvb/{dvb-usb = dvb-usb-v2}/lmedm04.h|0 drivers/media/dvb/dvb-usb/Kconfig | 13 - drivers/media/dvb/dvb-usb/Makefile |3 - 6 files changed, 291 insertions(+), 329 deletions(-) rename drivers/media/dvb/{dvb-usb = dvb-usb-v2}/lmedm04.c (69%) rename drivers/media/dvb/{dvb-usb = dvb-usb-v2}/lmedm04.h (100%) diff --git a/drivers/media/dvb/dvb-usb-v2/Kconfig b/drivers/media/dvb/dvb-usb-v2/Kconfig index e7ff148..14a635b 100644 --- a/drivers/media/dvb/dvb-usb-v2/Kconfig +++ b/drivers/media/dvb/dvb-usb-v2/Kconfig @@ -102,6 +102,19 @@ config DVB_USB_GL861 Say Y here to support the MSI Megasky 580 (55801) DVB-T USB2.0 receiver with USB ID 0db0:5581. +config DVB_USB_LME2510 + tristate LME DM04/QQBOX DVB-S USB2.0 support + depends on DVB_USB_V2 + select DVB_TDA10086 if !DVB_FE_CUSTOMISE + select DVB_TDA826X if !DVB_FE_CUSTOMISE + select DVB_STV0288 if !DVB_FE_CUSTOMISE + select DVB_IX2505V if !DVB_FE_CUSTOMISE + select DVB_STV0299 if !DVB_FE_CUSTOMISE + select DVB_PLL if !DVB_FE_CUSTOMISE + select DVB_M88RS2000 if !DVB_FE_CUSTOMISE + help + Say Y here to support the LME DM04/QQBOX DVB-S USB2.0 + config DVB_USB_MXL111SF tristate MxL111SF DTV USB2.0 support depends on DVB_USB_V2 diff --git a/drivers/media/dvb/dvb-usb-v2/Makefile b/drivers/media/dvb/dvb-usb-v2/Makefile index a784bf4..26659bc 100644 --- a/drivers/media/dvb/dvb-usb-v2/Makefile +++ b/drivers/media/dvb/dvb-usb-v2/Makefile @@ -25,6 +25,9 @@ obj-$(CONFIG_DVB_USB_CE6230) += dvb-usb-ce6230.o dvb-usb-ec168-objs = ec168.o obj-$(CONFIG_DVB_USB_EC168) += dvb-usb-ec168.o +dvb-usb-lmedm04-objs = lmedm04.o +obj-$(CONFIG_DVB_USB_LME2510) += dvb-usb-lmedm04.o + dvb-usb-gl861-objs = gl861.o obj-$(CONFIG_DVB_USB_GL861) += dvb-usb-gl861.o diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb-v2/lmedm04.c similarity index 69% rename from drivers/media/dvb/dvb-usb/lmedm04.c rename to drivers/media/dvb/dvb-usb-v2/lmedm04.c index 26ba5bc..c6bc1b8 100644 --- a/drivers/media/dvb/dvb-usb/lmedm04.c +++ b/drivers/media/dvb/dvb-usb-v2/lmedm04.c @@ -19,6 +19,8 @@ * * MVB0194 (LME2510C+SHARP0194) * + * LME2510C + M88RS2000 + * * For firmware see Documentation/dvb/lmedm04.txt * * I2C addresses: @@ -62,13 +64,14 @@ * LME2510: SHARP:BS2F7HZ0194(MV0194) cannot cold reset and share system * with other tuners. After a cold reset streaming will not start. * + * M88RS2000 suffers from loss of lock. */ #define DVB_USB_LOG_PREFIX LME2510(C) #include linux/usb.h #include linux/usb/input.h #include media/rc-core.h -#include dvb-usb.h +#include dvb_usb.h #include lmedm04.h #include tda826x.h #include tda10086.h @@ -80,24 +83,28 @@ #include m88rs2000.h +#define LME2510_C_S7395dvb-usb-lme2510c-s7395.fw; +#define LME2510_C_LG dvb-usb-lme2510c-lg.fw; +#define LME2510_C_S0194dvb-usb-lme2510c-s0194.fw; +#define LME2510_C_RS2000 dvb-usb-lme2510c-rs2000.fw; +#define LME2510_LG dvb-usb-lme2510-lg.fw; +#define LME2510_S0194 dvb-usb-lme2510-s0194.fw; /* debug */ static int dvb_usb_lme2510_debug; -#define l_dprintk(var, level, args...) do { \ +#define lme_debug(var, level, args...) do { \ if ((var = level)) \ - printk(KERN_DEBUG DVB_USB_LOG_PREFIX : args); \ + pr_debug(DVB_USB_LOG_PREFIX: args); \ } while (0) - -#define deb_info(level, args...) l_dprintk(dvb_usb_lme2510_debug, level, args) +#define deb_info(level, args...) lme_debug(dvb_usb_lme2510_debug, level, args) #define debug_data_snipet(level, name, p) \ deb_info(level, name (%02x%02x%02x%02x%02x%02x%02x%02x), \ *p, *(p+1), *(p+2), *(p+3), *(p+4), \ *(p+5), *(p+6), *(p+7)); - +#define info(args...) pr_info(DVB_USB_LOG_PREFIX: args) module_param_named(debug, dvb_usb_lme2510_debug, int, 0644); -MODULE_PARM_DESC(debug, set debugging level (1=info (or-able)). - DVB_USB_DEBUG_STATUS); +MODULE_PARM_DESC(debug, set debugging level (1=info (or-able)).); static int dvb_usb_lme2510_firmware; module_param_named(firmware, dvb_usb_lme2510_firmware, int, 0644); @@ -136,7 +143,8 @@ struct lme2510_state { void *buffer; struct urb *lme_urb; void *usb_buffer; - + int (*fe_set_voltage)(struct dvb_frontend *, fe_sec_voltage_t); + u8
Re: [PATCH] [BUG] Re: dvb_usb_lmedm04 crash Kernel (rs2000)
On Mon, 2012-08-06 at 21:46 +0300, Antti Palosaari wrote: On 08/03/2012 02:31 AM, Malcolm Priestley wrote: On Thu, 2012-08-02 at 23:54 +0300, Antti Palosaari wrote: Moi Malcolm, Any idea why this seems to crash Kernel just when device is plugged? Hi Antti Yes, there missing error handling when no firmware file found. It seems that this is more of a problem with udev-182+. However, so far udev-182 is only a problem on first ever plug. Regards Malcolm Aug 6 20:56:34 localhost kernel: [19094.248540] LME2510(C): Firmware Status: 6 (44) Aug 6 20:56:34 localhost kernel: [19094.251541] LME2510(C): FRM No Firmware Found - please install Aug 6 20:56:34 localhost kernel: [19094.251559] usbcore: registered new interface driver LME2510C_DVB-S It is good to print needed fw name. I found it from the documentation, Documentation/dvb/lmedm04.txt. Hi Antti, Yes, this is a good idea to print the firmware it finds and then selects. Could you drop me that firmware privately as I don't wish to install Windows drivers in order to extract it. It would be interesting to see if your firmware is newer, my two boxes are over a year old. I as sure the firmware has a bug. Regards Malcolm Tested-by: Antti Palosaari cr...@iki.fi Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/dvb/dvb-usb/lmedm04.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c index 25d1031..26ba5bc 100644 --- a/drivers/media/dvb/dvb-usb/lmedm04.c +++ b/drivers/media/dvb/dvb-usb/lmedm04.c @@ -878,6 +878,10 @@ static int lme_firmware_switch(struct usb_device *udev, int cold) fw_lme = fw_c_rs2000; ret = request_firmware(fw, fw_lme, udev-dev); dvb_usb_lme2510_firmware = TUNER_RS2000; + if (ret == 0) + break; + info(FRM No Firmware Found - please install); + cold_fw = 0; break; default: fw_lme = fw_c_s7395; regards Antti -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] lmedm04 v2.05 conversion to dvb-usb-v2
Conversion of lmedm04 to dvb-usb-v2 functional changes are that callbacks have been moved to fe_ioctl_override. This patch is applied on top of [BUG] Re: dvb_usb_lmedm04 crash Kernel (rs2000) http://patchwork.linuxtv.org/patch/13584/ Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/dvb/dvb-usb-v2/Kconfig | 13 + drivers/media/dvb/dvb-usb-v2/Makefile |3 + .../media/dvb/{dvb-usb = dvb-usb-v2}/lmedm04.c| 610 +--- .../media/dvb/{dvb-usb = dvb-usb-v2}/lmedm04.h|0 drivers/media/dvb/dvb-usb/Kconfig | 13 - drivers/media/dvb/dvb-usb/Makefile |3 - 6 files changed, 300 insertions(+), 342 deletions(-) rename drivers/media/dvb/{dvb-usb = dvb-usb-v2}/lmedm04.c (69%) rename drivers/media/dvb/{dvb-usb = dvb-usb-v2}/lmedm04.h (100%) diff --git a/drivers/media/dvb/dvb-usb-v2/Kconfig b/drivers/media/dvb/dvb-usb-v2/Kconfig index 81f0f1c..a28aaf2 100644 --- a/drivers/media/dvb/dvb-usb-v2/Kconfig +++ b/drivers/media/dvb/dvb-usb-v2/Kconfig @@ -101,6 +101,19 @@ config DVB_USB_GL861 Say Y here to support the MSI Megasky 580 (55801) DVB-T USB2.0 receiver with USB ID 0db0:5581. +config DVB_USB_LME2510 + tristate LME DM04/QQBOX DVB-S USB2.0 support + depends on DVB_USB_V2 + select DVB_TDA10086 if !DVB_FE_CUSTOMISE + select DVB_TDA826X if !DVB_FE_CUSTOMISE + select DVB_STV0288 if !DVB_FE_CUSTOMISE + select DVB_IX2505V if !DVB_FE_CUSTOMISE + select DVB_STV0299 if !DVB_FE_CUSTOMISE + select DVB_PLL if !DVB_FE_CUSTOMISE + select DVB_M88RS2000 if !DVB_FE_CUSTOMISE + help + Say Y here to support the LME DM04/QQBOX DVB-S USB2.0 + config DVB_USB_MXL111SF tristate MxL111SF DTV USB2.0 support depends on DVB_USB_V2 diff --git a/drivers/media/dvb/dvb-usb-v2/Makefile b/drivers/media/dvb/dvb-usb-v2/Makefile index a98319c..d61c9a5 100644 --- a/drivers/media/dvb/dvb-usb-v2/Makefile +++ b/drivers/media/dvb/dvb-usb-v2/Makefile @@ -21,6 +21,9 @@ obj-$(CONFIG_DVB_USB_CE6230) += dvb-usb-ce6230.o dvb-usb-ec168-objs = ec168.o obj-$(CONFIG_DVB_USB_EC168) += dvb-usb-ec168.o +dvb-usb-lmedm04-objs = lmedm04.o +obj-$(CONFIG_DVB_USB_LME2510) += dvb-usb-lmedm04.o + dvb-usb-gl861-objs = gl861.o obj-$(CONFIG_DVB_USB_GL861) += dvb-usb-gl861.o diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb-v2/lmedm04.c similarity index 69% rename from drivers/media/dvb/dvb-usb/lmedm04.c rename to drivers/media/dvb/dvb-usb-v2/lmedm04.c index 26ba5bc..ba0f90e 100644 --- a/drivers/media/dvb/dvb-usb/lmedm04.c +++ b/drivers/media/dvb/dvb-usb-v2/lmedm04.c @@ -19,6 +19,8 @@ * * MVB0194 (LME2510C+SHARP0194) * + * LME2510C + M88RS2000 + * * For firmware see Documentation/dvb/lmedm04.txt * * I2C addresses: @@ -62,13 +64,14 @@ * LME2510: SHARP:BS2F7HZ0194(MV0194) cannot cold reset and share system * with other tuners. After a cold reset streaming will not start. * + * M88RS2000 suffers from loss of lock. */ #define DVB_USB_LOG_PREFIX LME2510(C) #include linux/usb.h #include linux/usb/input.h #include media/rc-core.h -#include dvb-usb.h +#include dvb_usb.h #include lmedm04.h #include tda826x.h #include tda10086.h @@ -80,24 +83,29 @@ #include m88rs2000.h +#define LME2510_C_S7395dvb-usb-lme2510c-s7395.fw; +#define LME2510_C_LG dvb-usb-lme2510c-lg.fw; +#define LME2510_C_S0194dvb-usb-lme2510c-s0194.fw; +#define LME2510_C_RS2000 dvb-usb-lme2510c-rs2000.fw; +#define LME2510_LG dvb-usb-lme2510-lg.fw; +#define LME2510_S0194 dvb-usb-lme2510-s0194.fw; /* debug */ static int dvb_usb_lme2510_debug; -#define l_dprintk(var, level, args...) do { \ - if ((var = level)) \ - printk(KERN_DEBUG DVB_USB_LOG_PREFIX : args); \ +#define lme_debug(var, level, args...) do { \ + if (var = level) { \ + pr_debug(KERN_DEBUG DVB_USB_LOG_PREFIX: args); \ + } \ } while (0) - -#define deb_info(level, args...) l_dprintk(dvb_usb_lme2510_debug, level, args) +#define deb_info(level, args...) lme_debug(dvb_usb_lme2510_debug, level, args) #define debug_data_snipet(level, name, p) \ deb_info(level, name (%02x%02x%02x%02x%02x%02x%02x%02x), \ *p, *(p+1), *(p+2), *(p+3), *(p+4), \ *(p+5), *(p+6), *(p+7)); - +#define info(args...) pr_info(DVB_USB_LOG_PREFIX: args) module_param_named(debug, dvb_usb_lme2510_debug, int, 0644); -MODULE_PARM_DESC(debug, set debugging level (1=info (or-able)). - DVB_USB_DEBUG_STATUS); +MODULE_PARM_DESC(debug, set debugging level (1=info (or-able)).); static int dvb_usb_lme2510_firmware; module_param_named(firmware, dvb_usb_lme2510_firmware, int, 0644); @@ -136,7 +144,7 @@ struct lme2510_state { void *buffer; struct urb *lme_urb; void *usb_buffer; - + u8 dvb_usb_lme2510_firmware; }; static int lme2510_bulk_write
[PATCH] [BUG] Re: dvb_usb_lmedm04 crash Kernel (rs2000)
On Thu, 2012-08-02 at 23:54 +0300, Antti Palosaari wrote: Moi Malcolm, Any idea why this seems to crash Kernel just when device is plugged? Hi Antti Yes, there missing error handling when no firmware file found. It seems that this is more of a problem with udev-182+. However, so far udev-182 is only a problem on first ever plug. Regards Malcolm Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/dvb/dvb-usb/lmedm04.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c index 25d1031..26ba5bc 100644 --- a/drivers/media/dvb/dvb-usb/lmedm04.c +++ b/drivers/media/dvb/dvb-usb/lmedm04.c @@ -878,6 +878,10 @@ static int lme_firmware_switch(struct usb_device *udev, int cold) fw_lme = fw_c_rs2000; ret = request_firmware(fw, fw_lme, udev-dev); dvb_usb_lme2510_firmware = TUNER_RS2000; + if (ret == 0) + break; + info(FRM No Firmware Found - please install); + cold_fw = 0; break; default: fw_lme = fw_c_s7395; -- 1.7.9.5 [crope@localhost linux]$ uname -a Linux localhost.localdomain 3.4.6-2.fc17.x86_64 #1 SMP Thu Jul 19 22:54:16 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux [crope@localhost linux]$ modinfo dvb_usb_lmedm04 filename: /lib/modules/3.4.6-2.fc17.x86_64/kernel/drivers/media/dvb/dvb-usb/dvb-usb-lmedm04.ko license:GPL version:1.99 description:LME2510(C) DVB-S USB2.0 author: Malcolm Priestley tvbox...@gmail.com srcversion: 59949851F3132870B974EE7 alias: usb:v3344p22F0d*dc*dsc*dp*ic*isc*ip* alias: usb:v3344p1120d*dc*dsc*dp*ic*isc*ip* alias: usb:v3344p1122d*dc*dsc*dp*ic*isc*ip* depends:dvb-usb,dvb-core,rc-core intree: Y vermagic: 3.4.6-2.fc17.x86_64 SMP mod_unload parm: debug:set debugging level (1=info (or-able)). (debugging is not enabled) (int) parm: firmware:set default firmware 0=Sharp7395 1=LG (int) parm: pid:set default 0=default 1=off 2=on (int) parm: adapter_nr:DVB adapter numbers (array of short) [crope@localhost linux]$ Aug 2 23:46:19 localhost kernel: [ 211.527886] usb 1-2.2: new high-speed USB device number 7 using ehci_hcd Aug 2 23:46:19 localhost kernel: [ 211.601817] usb 1-2.2: config 1 interface 0 altsetting 1 bulk endpoint 0x81 has invalid maxpacket 64 Aug 2 23:46:19 localhost kernel: [ 211.601829] usb 1-2.2: config 1 interface 0 altsetting 1 bulk endpoint 0x1 has invalid maxpacket 64 Aug 2 23:46:19 localhost kernel: [ 211.601837] usb 1-2.2: config 1 interface 0 altsetting 1 bulk endpoint 0x2 has invalid maxpacket 64 Aug 2 23:46:19 localhost kernel: [ 211.601845] usb 1-2.2: config 1 interface 0 altsetting 1 bulk endpoint 0x8A has invalid maxpacket 64 Aug 2 23:46:19 localhost kernel: [ 211.602073] usb 1-2.2: New USB device found, idVendor=3344, idProduct=22f0 Aug 2 23:46:19 localhost kernel: [ 211.602083] usb 1-2.2: New USB device strings: Mfr=0, Product=0, SerialNumber=3 Aug 2 23:46:19 localhost kernel: [ 211.602093] usb 1-2.2: SerialNumber: 䥈児 Aug 2 23:46:19 localhost mtp-probe: checking bus 1, device 7: /sys/devices/pci:00/:00:12.2/usb1/1-2/1-2.2 Aug 2 23:46:19 localhost mtp-probe: bus: 1, device: 7 was not an MTP device Aug 2 23:46:19 localhost kernel: [ 211.628508] LME2510(C): Firmware Status: 6 (44) Aug 2 23:46:19 localhost kernel: [ 211.629545] LME2510(C): FRM Loading dvb-usb-lme2510c-rs2000.fw file Aug 2 23:46:19 localhost kernel: [ 211.629551] LME2510(C): FRM Starting Firmware Download Aug 2 23:46:19 localhost kernel: [ 211.629574] BUG: unable to handle kernel NULL pointer dereference at 0008 Aug 2 23:46:19 localhost kernel: [ 211.629739] IP: [a03ac116] lme_firmware_switch+0x526/0x800 [dvb_usb_lmedm04] Aug 2 23:46:19 localhost kernel: [ 211.629900] PGD 0 Aug 2 23:46:19 localhost kernel: [ 211.629947] Oops: [#1] SMP Aug 2 23:46:19 localhost kernel: [ 211.630019] CPU 3 Aug 2 23:46:19 localhost kernel: [ 211.630058] Modules linked in: dvb_usb_lmedm04(+) dvb_usb fuse tpm_bios rfcomm bnep ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack ip6table_filter ip6_tables snd_hda_codec_hdmi ppdev sp5100_tco snd_hda_codec_via btusb bluetooth i2c_piix4 8139too microcode 8139cp serio_raw snd_hda_intel edac_core edac_mce_amd k10temp snd_hda_codec snd_hwdep rfkill r8169 mii cx23885 altera_ci tda18271 altera_stapl cx2341x btcx_risc videobuf_dvb dvb_core snd_pcm snd_page_alloc snd_timer snd soundcore tveeprom videobuf_dma_sg videobuf_core v4l2_common videodev media rc_core shpchp parport_pc parport asus_atk0110 uinput xts gf128mul hid_logitech_dj ata_generic pata_acpi dm_crypt pata_atiixp wmi radeon i2c_algo_bit
Re: AVerMedia A373 PCIe MiniCard Dual DVB-T - ITE IT913x Tuners
On Sun, 2012-07-22 at 17:34 +0100, John Layt wrote: Hi, I have recently purchased an Acer Aspire Revo RL70 HTPC which comes with a built-in AVerMedia A373 MiniCard Dual DVB-T which uses two ITE T913x tuners. This card is currently unsupported in Linux and I have documented some details on the wiki at http://linuxtv.org/wiki/index.php/AVerMedia_A373_MiniCard_Dual_DVB-T . I have a photo that I can upload once approved, and I also have Windows 7 installed on the machine so can provide details from there if needed. If anyone is interested in adding support I'd be happy to help out where I can. Hi John It looks like the IT9137 is the Host Interface which is supported, the IT9133 is the slave. The only problem I can see is the slave many not work correctly as another IT9137 is used as slave on other models. I will do a little patch shortly to add the ID to the it913x driver. Regards Malcolm -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] it913x (test) - add support for AVerMedia A373
Initial test support for IT9137/IT9133 dual. This test patch uses IT9135 firmware sets just in case they are version 2 chips. dvb-usb-it9135-01.fw dvb-usb-it9135-02.fw Signed-off-by: Malcolm Priestley tvbox...@gmail.com --- drivers/media/dvb/dvb-usb/dvb-usb-ids.h |1 + drivers/media/dvb/dvb-usb/it913x.c |6 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index 26c4481..99ea83f 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -91,6 +91,7 @@ #define USB_PID_AVERMEDIA_DVBT_USB_WARM0x0002 #define USB_PID_AVERMEDIA_DVBT_USB2_COLD 0xa800 #define USB_PID_AVERMEDIA_DVBT_USB2_WARM 0xa801 +#define USB_PID_AVERMEDIA_DVBT_A3730xa373 #define USB_PID_COMPRO_DVBU2000_COLD 0xd000 #define USB_PID_COMPRO_DVBU2000_WARM 0xd001 #define USB_PID_COMPRO_DVBU2000_UNK_COLD 0x010c diff --git a/drivers/media/dvb/dvb-usb/it913x.c b/drivers/media/dvb/dvb-usb/it913x.c index 6244fe9..8d015a3 100644 --- a/drivers/media/dvb/dvb-usb/it913x.c +++ b/drivers/media/dvb/dvb-usb/it913x.c @@ -821,6 +821,7 @@ static struct usb_device_id it913x_table[] = { { USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV22_IT9137) }, { USB_DEVICE(USB_VID_ITETECH, USB_PID_ITETECH_IT9135_9005) }, { USB_DEVICE(USB_VID_ITETECH, USB_PID_ITETECH_IT9135_9006) }, + { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_A373) }, {} /* Terminating entry */ }; @@ -896,7 +897,7 @@ static struct dvb_usb_device_properties it913x_properties = { .rc_codes = RC_MAP_IT913X_V1, }, .i2c_algo = it913x_i2c_algo, - .num_device_descs = 5, + .num_device_descs = 6, .devices = { { Kworld UB499-2T T09(IT9137), { it913x_table[0], NULL }, @@ -913,6 +914,9 @@ static struct dvb_usb_device_properties it913x_properties = { { ITE 9135(9006) Generic, { it913x_table[4], NULL }, }, + { AVerMedia A373 MiniCard Dual DVB-T, + { it913x_table[5], NULL }, + }, } }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] [TEST] Regarding m88rs2000 i2c gate operation, SNR, BER and others
On Wed, 2012-05-09 at 04:54 -0700, Igor M. Liplianin wrote: Malcolm, I made SNR, BER, UCB and signal level code for m88rc2000, but my cards show them correctly only if I made changes in m88rs2000_tuner_read function. Analyzing USB logs I found that register 0x81 never set to 0x85 value. It is always set to 0x84 regardless of read or write operation to tuner. I was wondering is this my hardware specific? Can you test you cards with attached patch? Igor Hi Igor I have no problems with patch, please could you add your signoff I you and me have followed a typo error with m88rc2000 for m88rs2000 in the title. This patch and patch http://patchwork.linuxtv.org/patch/11235/ can go upstream Regards Malcolm differences between files attachment (snrber.patch) diff --git a/drivers/media/dvb/frontends/m88rs2000.c b/drivers/media/dvb/frontends/m88rs2000.c index f6d6e39..f5ece59 100644 --- a/drivers/media/dvb/frontends/m88rs2000.c +++ b/drivers/media/dvb/frontends/m88rs2000.c @@ -143,7 +143,7 @@ static u8 m88rs2000_demod_read(struct m88rs2000_state *state, u8 reg) static u8 m88rs2000_tuner_read(struct m88rs2000_state *state, u8 reg) { - m88rs2000_demod_write(state, 0x81, 0x85); + m88rs2000_demod_write(state, 0x81, 0x84); udelay(10); return m88rs2000_readreg(state, 0, reg); } @@ -492,33 +492,81 @@ static int m88rs2000_read_status(struct dvb_frontend *fe, fe_status_t *status) return 0; } -/* Extact code for these unknown but lmedm04 driver uses interupt callbacks */ - static int m88rs2000_read_ber(struct dvb_frontend *fe, u32 *ber) { - deb_info(m88rs2000_read_ber %d\n, *ber); - *ber = 0; + struct m88rs2000_state *state = fe-demodulator_priv; + u8 tmp0, tmp1; + + m88rs2000_demod_write(state, 0x9a, 0x30); + tmp0 = m88rs2000_demod_read(state, 0xd8); + if ((tmp0 0x10) != 0) { + m88rs2000_demod_write(state, 0x9a, 0xb0); + *ber = 0x; + return 0; + } + + *ber = (m88rs2000_demod_read(state, 0xd7) 8) | + m88rs2000_demod_read(state, 0xd6); + + tmp1 = m88rs2000_demod_read(state, 0xd9); + m88rs2000_demod_write(state, 0xd9, (tmp1 ~7) | 4); + /* needs twice */ + m88rs2000_demod_write(state, 0xd8, (tmp0 ~8) | 0x30); + m88rs2000_demod_write(state, 0xd8, (tmp0 ~8) | 0x30); + m88rs2000_demod_write(state, 0x9a, 0xb0); + return 0; } static int m88rs2000_read_signal_strength(struct dvb_frontend *fe, - u16 *strength) + u16 *signal_strength) { - *strength = 0; + struct m88rs2000_state *state = fe-demodulator_priv; + u8 rfg, bbg, gain, strength; + + rfg = m88rs2000_tuner_read(state, 0x3d) 0x1f; + bbg = m88rs2000_tuner_read(state, 0x21) 0x1f; + gain = rfg * 2 + bbg * 3; + + if (gain 80) + strength = 0; + else if (gain 65) + strength = 4 * (80 - gain); + else if (gain 50) + strength = 65 + 4 * (65 - gain) / 3; + else + strength = 85 + 2 * (50 - gain) / 3; + + *signal_strength = strength * 655; + + deb_info(%s: rfg, bbg / gain = %d, %d, %d\n, + __func__, rfg, bbg, gain); + return 0; } static int m88rs2000_read_snr(struct dvb_frontend *fe, u16 *snr) { - deb_info(m88rs2000_read_snr %d\n, *snr); - *snr = 0; + struct m88rs2000_state *state = fe-demodulator_priv; + + *snr = 512 * m88rs2000_demod_read(state, 0x65); + return 0; } static int m88rs2000_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) { - deb_info(m88rs2000_read_ber %d\n, *ucblocks); - *ucblocks = 0; + struct m88rs2000_state *state = fe-demodulator_priv; + u8 tmp; + + *ucblocks = (m88rs2000_demod_read(state, 0xd5) 8) | + m88rs2000_demod_read(state, 0xd4); + tmp = m88rs2000_demod_read(state, 0xd8); + m88rs2000_demod_write(state, 0xd8, tmp ~0x20); + /* needs two times */ + m88rs2000_demod_write(state, 0xd8, tmp | 0x20); + m88rs2000_demod_write(state, 0xd8, tmp | 0x20); + return 0; } -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html