public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Antti Palosaari <crope@iki.fi>
To: David Howells <dhowells@redhat.com>,
	Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: linux-media@vger.kernel.org, Jarkko Korpi <jarkko_korpi@hotmail.com>
Subject: Re: I2C transfer logs for Antti's DS3103 driver and DVBSky's DS3103 driver
Date: Fri, 15 Nov 2013 01:48:17 +0200	[thread overview]
Message-ID: <52856141.5010502@iki.fi> (raw)
In-Reply-To: <20271.1384472102@warthog.procyon.org.uk>

[-- Attachment #1: Type: text/plain, Size: 2822 bytes --]

Hello
You have to identify situation where it does not work, optimally single 
known channel. Then switch to working driver and tune that same channel 
and take sniffs. Then generate code from sniffs, copy paste that to 
non-working driver until it starts working. Then it is quite trivial to 
find out by error and trial tests & binary search where the problematic 
register is.

Here is some tips.
http://blog.palosaari.fi/2013/07/generating-rtl2832u-driver-code.html

Hacking script I used is attached, just for the example.

regards
Antti



On 15.11.2013 01:35, David Howells wrote:
>
> Here are four logs from doing:
>
> 	scandvb -a1 ./e.1
>
> where the contents of file e.1 are:
>
> 	S 11919000 V 27500000 3/4
>
> which is probing a region on the Eutelsat-9A satellite broadcast.
>
> I inserted:
>
> 	diff -uNr linux-3.11.7-300.dvbsky_4.fc20.x86_64/drivers/i2c/i2c-core.c i2c-monitor/drivers/i2c/i2c-core.c
> 	--- i2c-monitor/drivers/i2c/i2c-core.c	2013-09-02 21:46:10.000000000 +0100
> 	+++ linux-3.11.7-300.dvbsky_4.fc20.x86_64/drivers/i2c/i2c-core.c	2013-11-14 22:11:08.757282401 +0000
> 	@@ -1491,6 +1491,16 @@
> 		unsigned long orig_jiffies;
> 		int ret, try;
>
> 	+	for (ret = 0; ret < num; ret++) {
> 	+		if (msgs[ret].flags & I2C_M_RD)
> 	+			pr_notice("I2C %s: RD %02x %u\n",
> 	+				  adap->name, msgs[ret].addr, msgs[ret].len);
> 	+		else
> 	+			pr_notice("I2C %s: WR %02x %u [%*phN]\n",
> 	+				  adap->name, msgs[ret].addr, msgs[ret].len,
> 	+				  msgs[ret].len, msgs[ret].buf);
> 	+	}
> 	+
> 		/* Retry automatically on arbitration loss */
> 		orig_jiffies = jiffies;
> 		for (ret = 0, try = 0; try <= adap->retries; try++) {
>
> into the kernel to generate these logs.
>
> The four logs are:
>
>   (1) DVBSky's megapatch: I2C traffic generated by cx23885 module initialisation
>       and probing.
>
>   (2) DVBSky's megapatch: I2C traffic generated by the aforementioned scandvb
>       command.
>
>   (3) Antti's drivers plus my S952 glue: I2C traffic generated by cx23885
>       module initialisation and probing.
>
>   (4) Antti's drivers plus my S952 glue: I2C traffic generated by the
>       aforementioned scandvb command.
>
> The scandvb command with the DVBSky megapatch gave:
>
> 	dumping lists (25 services)
> 	Italy Service:11919:v:0:27500:2003:3003:3
> 	Karusel int:11919:v:0:27500:2004:3004:4
> 	SVT WORLD:11919:v:0:27500:2008:3008:8
> 	...
>
> and was very consistent.
>
> Antti's patch gave:
>
> 	dumping lists (22 services)
> 	[0001]:11919:v:0:27500:0:0:1
> 	[0003]:11919:v:0:27500:0:0:3
> 	[000d]:11919:v:0:27500:0:0:13
> 	...
>
> and sometimes:
>
> 	dumping lists (0 services)
>
> and once:
>
> 	dumping lists (32 services)
> 	[f714]:11919:v:0:27500:0:0:63252
> 	[e38b]:11919:v:0:27500:0:0:58251
> 	[b7ba]:11919:v:0:27500:0:0:47034
> 	...
>
> David
>


-- 
http://palosaari.fi/

[-- Attachment #2: em28xx_m88ds3103.py --]
[-- Type: text/x-python, Size: 1095 bytes --]

#!/usr/bin/env python
# Copyright (C) 2013 Antti Palosaari <crope@iki.fi>
# Usage: 

import os
import sys
import re
import struct
import string

fread = file(sys.argv[1], 'r' )

def get_hex_string(ele, start, length):
    string = '"'
    for i in range(length):
        string = string + '\\x' + ele[start + i]
    string = string + '"'
    return string

for line in fread:
    line = line.strip();
    ele = re.split(' ', line)

    print '// ' + line

#025099:  OUT: 000000 ms 009725 ms 40 02 00 00 c0 00 02 00 >>>  00 03
#025522:  OUT: 000000 ms 024417 ms 40 02 00 00 d0 00 02 00 >>>  03 11

    if (len(ele) > 17 and ele[15] == '>>>' and ele[8] == '02'):
        length = int(ele[13], 16) - 1
        if (ele[11] == 'c0'):
            print 'ret = m88ts2022_wr_regs(priv, 0x' + ele[17] + ', ' + \
            get_hex_string(ele, 18, length) + ', ' + str(length) + '); // generated'
        elif (ele[11] == 'd0'):
            print 'ret = m88ds3103_wr_regs(priv, 0x' + ele[17] + ', ' + \
            get_hex_string(ele, 18, length) + ', ' + str(length) + '); // generated'

fread.close()


  reply	other threads:[~2013-11-14 23:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14 23:35 I2C transfer logs for Antti's DS3103 driver and DVBSky's DS3103 driver David Howells
2013-11-14 23:48 ` Antti Palosaari [this message]
2013-11-15  2:15 ` David Howells
2013-11-15 11:33 ` David Howells
2013-11-15 13:06   ` Antti Palosaari
2013-11-15 13:32     ` David Howells
2013-11-15 13:36       ` Devin Heitmueller
2013-11-15 13:54       ` Antti Palosaari
2013-11-15 14:17         ` David Howells
2013-11-15 13:56       ` David Howells
2013-11-15 13:59         ` Antti Palosaari
2013-11-15 14:25           ` David Howells
2013-11-15 14:01         ` David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52856141.5010502@iki.fi \
    --to=crope@iki.fi \
    --cc=dhowells@redhat.com \
    --cc=jarkko_korpi@hotmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox