* [PATCH 1/3] tm6000: add send and recv function
@ 2010-02-21 20:10 stefan.ringel
2010-02-21 20:10 ` [PATCH 2/3] tm6000: bugfix reading problems with demodulator zl10353 stefan.ringel
2010-02-22 15:16 ` [PATCH 1/3] tm6000: add send and recv function Mauro Carvalho Chehab
0 siblings, 2 replies; 9+ messages in thread
From: stefan.ringel @ 2010-02-21 20:10 UTC (permalink / raw)
To: linux-media; +Cc: mchehab, dheitmueller, Stefan Ringel
From: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
---
drivers/staging/tm6000/tm6000-i2c.c | 48 +++++++++++++++++++++++++---------
1 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c
index 656cd19..b563129 100644
--- a/drivers/staging/tm6000/tm6000-i2c.c
+++ b/drivers/staging/tm6000/tm6000-i2c.c
@@ -44,6 +44,32 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
printk(KERN_DEBUG "%s at %s: " fmt, \
dev->name, __FUNCTION__ , ##args); } while (0)
+int tm6000_i2c_send_regs(struct tm6000_core *dev, unsigned char addr, __u8 reg, char *buf, int len)
+{
+ return tm6000_read_write_usb(dev, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+ REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len);
+}
+
+/* read from a 8bit register */
+int tm6000_i2c_recv_regs(struct tm6000_core *dev, unsigned char addr, __u8 reg, char *buf, int len)
+{
+ int rc;
+
+ rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_VENDOR_TYPE | USB_RECIP_DEVICE,
+ REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len);
+
+ return rc;
+}
+
+/* read from a 16bit register
+ * for example xc2028, xc3028 or xc3028L
+ */
+int tm6000_i2c_recv_regs16(struct tm6000_core *dev, unsigned char addr, __u16 reg, char *buf, int len)
+{
+ return tm6000_read_write_usb(dev, USB_DIR_IN | USB_VENDOR_TYPE | USB_RECIP_DEVICE,
+ REQ_14_SET_GET_I2C_WR2_RDN, addr, reg, buf, len);
+}
+
static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
struct i2c_msg msgs[], int num)
{
@@ -78,13 +104,14 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
i2c_dprintk(2, "; joined to read %s len=%d:",
i == num - 2 ? "stop" : "nonstop",
msgs[i + 1].len);
- rc = tm6000_read_write_usb (dev,
- USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- msgs[i].len == 1 ? REQ_16_SET_GET_I2C_WR1_RDN
- : REQ_14_SET_GET_I2C_WR2_RDN,
- addr | msgs[i].buf[0] << 8,
- msgs[i].len == 1 ? 0 : msgs[i].buf[1],
+ if (msgs{i].len == 1) {
+ rc = tm6000_i2c_recv_regs(dev, addr, msgs[i].buf[0],
msgs[i + 1].buf, msgs[i + 1].len);
+ } else {
+ rc = tm6000_i2c_recv_regs(dev, addr, msgs[i].buf[0] << 8 | msgs[i].buf[1],
+ msgs[i + 1].buf, msgs[i + 1].len);
+ }
+
i++;
if (addr == dev->tuner_addr) {
@@ -99,10 +126,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
if (i2c_debug >= 2)
for (byte = 0; byte < msgs[i].len; byte++)
printk(" %02x", msgs[i].buf[byte]);
- rc = tm6000_read_write_usb(dev,
- USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- REQ_16_SET_GET_I2C_WR1_RDN,
- addr | msgs[i].buf[0] << 8, 0,
+ rc = tm6000_i2c_send_regs(dev, addr, msgs[i].buf[0],
msgs[i].buf + 1, msgs[i].len - 1);
if (addr == dev->tuner_addr) {
@@ -134,9 +158,7 @@ static int tm6000_i2c_eeprom(struct tm6000_core *dev,
bytes[16] = '\0';
for (i = 0; i < len; ) {
*p = i;
- rc = tm6000_read_write_usb (dev,
- USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- REQ_16_SET_GET_I2C_WR1_RDN, 0xa0 | i<<8, 0, p, 1);
+ rc = tm6000_i2c_revc_regs(dev, 0xa0, i, p, 1);
if (rc < 1) {
if (p == eedata)
goto noeeprom;
--
1.6.6.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] tm6000: bugfix reading problems with demodulator zl10353
2010-02-21 20:10 [PATCH 1/3] tm6000: add send and recv function stefan.ringel
@ 2010-02-21 20:10 ` stefan.ringel
2010-02-21 20:10 ` [PATCH 3/3] tm6000: bugfix i2c addr stefan.ringel
2010-02-22 15:18 ` [PATCH 2/3] tm6000: bugfix reading problems with demodulator zl10353 Mauro Carvalho Chehab
2010-02-22 15:16 ` [PATCH 1/3] tm6000: add send and recv function Mauro Carvalho Chehab
1 sibling, 2 replies; 9+ messages in thread
From: stefan.ringel @ 2010-02-21 20:10 UTC (permalink / raw)
To: linux-media; +Cc: mchehab, dheitmueller, Stefan Ringel
From: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
---
drivers/staging/tm6000/tm6000-i2c.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c
index b563129..6ae02b8 100644
--- a/drivers/staging/tm6000/tm6000-i2c.c
+++ b/drivers/staging/tm6000/tm6000-i2c.c
@@ -54,9 +54,20 @@ int tm6000_i2c_send_regs(struct tm6000_core *dev, unsigned char addr, __u8 reg,
int tm6000_i2c_recv_regs(struct tm6000_core *dev, unsigned char addr, __u8 reg, char *buf, int len)
{
int rc;
+ u8 b[2];
+ if ((dev->caps.has_zl10353) && (dev->demod_addr << 1 == addr) && (reg % 2 == 0)) {
+ reg -= 1;
+ len += 1;
+
+ rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_VENDOR_TYPE | USB_RECIP_DEVICE,
+ REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, b, len);
+
+ *buf = b[1];
+ } else {
rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_VENDOR_TYPE | USB_RECIP_DEVICE,
REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len);
+ }
return rc;
}
--
1.6.6.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] tm6000: bugfix i2c addr
2010-02-21 20:10 ` [PATCH 2/3] tm6000: bugfix reading problems with demodulator zl10353 stefan.ringel
@ 2010-02-21 20:10 ` stefan.ringel
2010-02-22 15:18 ` [PATCH 2/3] tm6000: bugfix reading problems with demodulator zl10353 Mauro Carvalho Chehab
1 sibling, 0 replies; 9+ messages in thread
From: stefan.ringel @ 2010-02-21 20:10 UTC (permalink / raw)
To: linux-media; +Cc: mchehab, dheitmueller, Stefan Ringel
From: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
---
drivers/staging/tm6000/tm6000-i2c.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c
index 6ae02b8..029cf74 100644
--- a/drivers/staging/tm6000/tm6000-i2c.c
+++ b/drivers/staging/tm6000/tm6000-i2c.c
@@ -125,7 +125,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
i++;
- if (addr == dev->tuner_addr) {
+ if (addr == dev->tuner_addr << 1) {
tm6000_set_reg(dev, 0x32, 0,0);
tm6000_set_reg(dev, 0x33, 0,0);
}
@@ -140,7 +140,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
rc = tm6000_i2c_send_regs(dev, addr, msgs[i].buf[0],
msgs[i].buf + 1, msgs[i].len - 1);
- if (addr == dev->tuner_addr) {
+ if (addr == dev->tuner_addr << 1) {
tm6000_set_reg(dev, 0x32, 0,0);
tm6000_set_reg(dev, 0x33, 0,0);
}
--
1.6.6.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] tm6000: add send and recv function
2010-02-21 20:10 [PATCH 1/3] tm6000: add send and recv function stefan.ringel
2010-02-21 20:10 ` [PATCH 2/3] tm6000: bugfix reading problems with demodulator zl10353 stefan.ringel
@ 2010-02-22 15:16 ` Mauro Carvalho Chehab
2010-02-22 15:46 ` Stefan Ringel
1 sibling, 1 reply; 9+ messages in thread
From: Mauro Carvalho Chehab @ 2010-02-22 15:16 UTC (permalink / raw)
To: stefan.ringel; +Cc: linux-media, dheitmueller
stefan.ringel@arcor.de wrote:
> From: Stefan Ringel <stefan.ringel@arcor.de>
drivers/staging/tm6000/tm6000-i2c.c: In function ‘tm6000_i2c_recv_regs’:
drivers/staging/tm6000/tm6000-i2c.c:58: error: ‘USB_VENDOR_TYPE’ undeclared (first use in this function)
drivers/staging/tm6000/tm6000-i2c.c:58: error: (Each undeclared identifier is reported only once
drivers/staging/tm6000/tm6000-i2c.c:58: error: for each function it appears in.)
drivers/staging/tm6000/tm6000-i2c.c: In function ‘tm6000_i2c_recv_regs16’:
drivers/staging/tm6000/tm6000-i2c.c:69: error: ‘USB_VENDOR_TYPE’ undeclared (first use in this function)
drivers/staging/tm6000/tm6000-i2c.c: In function ‘tm6000_i2c_xfer’:
drivers/staging/tm6000/tm6000-i2c.c:107: error: expected ‘)’ before ‘{’ token
drivers/staging/tm6000/tm6000-i2c.c: In function ‘tm6000_i2c_eeprom’:
drivers/staging/tm6000/tm6000-i2c.c:161: error: implicit declaration of function ‘tm6000_i2c_revc_regs’
Each patch shouldn't break compilation, or it would call git bisect troubles.
>
> Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
> ---
> drivers/staging/tm6000/tm6000-i2c.c | 48 +++++++++++++++++++++++++---------
> 1 files changed, 35 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c
> index 656cd19..b563129 100644
> --- a/drivers/staging/tm6000/tm6000-i2c.c
> +++ b/drivers/staging/tm6000/tm6000-i2c.c
> @@ -44,6 +44,32 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
> printk(KERN_DEBUG "%s at %s: " fmt, \
> dev->name, __FUNCTION__ , ##args); } while (0)
>
> +int tm6000_i2c_send_regs(struct tm6000_core *dev, unsigned char addr, __u8 reg, char *buf, int len)
> +{
> + return tm6000_read_write_usb(dev, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
> + REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len);
> +}
> +
> +/* read from a 8bit register */
> +int tm6000_i2c_recv_regs(struct tm6000_core *dev, unsigned char addr, __u8 reg, char *buf, int len)
> +{
> + int rc;
> +
> + rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_VENDOR_TYPE | USB_RECIP_DEVICE,
> + REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len);
> +
> + return rc;
> +}
> +
> +/* read from a 16bit register
> + * for example xc2028, xc3028 or xc3028L
> + */
> +int tm6000_i2c_recv_regs16(struct tm6000_core *dev, unsigned char addr, __u16 reg, char *buf, int len)
> +{
> + return tm6000_read_write_usb(dev, USB_DIR_IN | USB_VENDOR_TYPE | USB_RECIP_DEVICE,
> + REQ_14_SET_GET_I2C_WR2_RDN, addr, reg, buf, len);
> +}
> +
> static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
> struct i2c_msg msgs[], int num)
> {
> @@ -78,13 +104,14 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
> i2c_dprintk(2, "; joined to read %s len=%d:",
> i == num - 2 ? "stop" : "nonstop",
> msgs[i + 1].len);
> - rc = tm6000_read_write_usb (dev,
> - USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
> - msgs[i].len == 1 ? REQ_16_SET_GET_I2C_WR1_RDN
> - : REQ_14_SET_GET_I2C_WR2_RDN,
> - addr | msgs[i].buf[0] << 8,
> - msgs[i].len == 1 ? 0 : msgs[i].buf[1],
> + if (msgs{i].len == 1) {
> + rc = tm6000_i2c_recv_regs(dev, addr, msgs[i].buf[0],
> msgs[i + 1].buf, msgs[i + 1].len);
> + } else {
> + rc = tm6000_i2c_recv_regs(dev, addr, msgs[i].buf[0] << 8 | msgs[i].buf[1],
> + msgs[i + 1].buf, msgs[i + 1].len);
> + }
> +
> i++;
>
> if (addr == dev->tuner_addr) {
> @@ -99,10 +126,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
> if (i2c_debug >= 2)
> for (byte = 0; byte < msgs[i].len; byte++)
> printk(" %02x", msgs[i].buf[byte]);
> - rc = tm6000_read_write_usb(dev,
> - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
> - REQ_16_SET_GET_I2C_WR1_RDN,
> - addr | msgs[i].buf[0] << 8, 0,
> + rc = tm6000_i2c_send_regs(dev, addr, msgs[i].buf[0],
> msgs[i].buf + 1, msgs[i].len - 1);
>
> if (addr == dev->tuner_addr) {
> @@ -134,9 +158,7 @@ static int tm6000_i2c_eeprom(struct tm6000_core *dev,
> bytes[16] = '\0';
> for (i = 0; i < len; ) {
> *p = i;
> - rc = tm6000_read_write_usb (dev,
> - USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
> - REQ_16_SET_GET_I2C_WR1_RDN, 0xa0 | i<<8, 0, p, 1);
> + rc = tm6000_i2c_revc_regs(dev, 0xa0, i, p, 1);
> if (rc < 1) {
> if (p == eedata)
> goto noeeprom;
--
Cheers,
Mauro
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] tm6000: bugfix reading problems with demodulator zl10353
2010-02-21 20:10 ` [PATCH 2/3] tm6000: bugfix reading problems with demodulator zl10353 stefan.ringel
2010-02-21 20:10 ` [PATCH 3/3] tm6000: bugfix i2c addr stefan.ringel
@ 2010-02-22 15:18 ` Mauro Carvalho Chehab
1 sibling, 0 replies; 9+ messages in thread
From: Mauro Carvalho Chehab @ 2010-02-22 15:18 UTC (permalink / raw)
To: stefan.ringel; +Cc: linux-media, dheitmueller
stefan.ringel@arcor.de wrote:
> From: Stefan Ringel <stefan.ringel@arcor.de>
This patch depends on the previous one, so I can't apply it as-is.
Ah, please provide a better description for your patches. None of the patches you
submitted so far contains a single line but the subject. please read README.patches.
>
> Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
> ---
> drivers/staging/tm6000/tm6000-i2c.c | 11 +++++++++++
> 1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c
> index b563129..6ae02b8 100644
> --- a/drivers/staging/tm6000/tm6000-i2c.c
> +++ b/drivers/staging/tm6000/tm6000-i2c.c
> @@ -54,9 +54,20 @@ int tm6000_i2c_send_regs(struct tm6000_core *dev, unsigned char addr, __u8 reg,
> int tm6000_i2c_recv_regs(struct tm6000_core *dev, unsigned char addr, __u8 reg, char *buf, int len)
> {
> int rc;
> + u8 b[2];
>
> + if ((dev->caps.has_zl10353) && (dev->demod_addr << 1 == addr) && (reg % 2 == 0)) {
> + reg -= 1;
> + len += 1;
> +
> + rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_VENDOR_TYPE | USB_RECIP_DEVICE,
> + REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, b, len);
> +
> + *buf = b[1];
> + } else {
> rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_VENDOR_TYPE | USB_RECIP_DEVICE,
> REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len);
> + }
>
> return rc;
> }
--
Cheers,
Mauro
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] tm6000: add send and recv function
2010-02-22 15:16 ` [PATCH 1/3] tm6000: add send and recv function Mauro Carvalho Chehab
@ 2010-02-22 15:46 ` Stefan Ringel
0 siblings, 0 replies; 9+ messages in thread
From: Stefan Ringel @ 2010-02-22 15:46 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: linux-media, dheitmueller
Am 22.02.2010 16:16, schrieb Mauro Carvalho Chehab:
> stefan.ringel@arcor.de wrote:
>
>> From: Stefan Ringel <stefan.ringel@arcor.de>
>>
>
> drivers/staging/tm6000/tm6000-i2c.c: In function ‘tm6000_i2c_recv_regs’:
> drivers/staging/tm6000/tm6000-i2c.c:58: error: ‘USB_VENDOR_TYPE’ undeclared (first use in this function)
> drivers/staging/tm6000/tm6000-i2c.c:58: error: (Each undeclared identifier is reported only once
> drivers/staging/tm6000/tm6000-i2c.c:58: error: for each function it appears in.)
> drivers/staging/tm6000/tm6000-i2c.c: In function ‘tm6000_i2c_recv_regs16’:
> drivers/staging/tm6000/tm6000-i2c.c:69: error: ‘USB_VENDOR_TYPE’ undeclared (first use in this function)
> drivers/staging/tm6000/tm6000-i2c.c: In function ‘tm6000_i2c_xfer’:
> drivers/staging/tm6000/tm6000-i2c.c:107: error: expected ‘)’ before ‘{’ token
> drivers/staging/tm6000/tm6000-i2c.c: In function ‘tm6000_i2c_eeprom’:
> drivers/staging/tm6000/tm6000-i2c.c:161: error: implicit declaration of function ‘tm6000_i2c_revc_regs’
>
> Each patch shouldn't break compilation, or it would call git bisect troubles.
>
>
>
>> Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
>> ---
>> drivers/staging/tm6000/tm6000-i2c.c | 48 +++++++++++++++++++++++++---------
>> 1 files changed, 35 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c
>> index 656cd19..b563129 100644
>> --- a/drivers/staging/tm6000/tm6000-i2c.c
>> +++ b/drivers/staging/tm6000/tm6000-i2c.c
>> @@ -44,6 +44,32 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
>> printk(KERN_DEBUG "%s at %s: " fmt, \
>> dev->name, __FUNCTION__ , ##args); } while (0)
>>
>> +int tm6000_i2c_send_regs(struct tm6000_core *dev, unsigned char addr, __u8 reg, char *buf, int len)
>> +{
>> + return tm6000_read_write_usb(dev, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
>> + REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len);
>> +}
>> +
>> +/* read from a 8bit register */
>> +int tm6000_i2c_recv_regs(struct tm6000_core *dev, unsigned char addr, __u8 reg, char *buf, int len)
>> +{
>> + int rc;
>> +
>> + rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_VENDOR_TYPE | USB_RECIP_DEVICE,
>> + REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len);
>> +
>> + return rc;
>> +}
>> +
>> +/* read from a 16bit register
>> + * for example xc2028, xc3028 or xc3028L
>> + */
>> +int tm6000_i2c_recv_regs16(struct tm6000_core *dev, unsigned char addr, __u16 reg, char *buf, int len)
>> +{
>> + return tm6000_read_write_usb(dev, USB_DIR_IN | USB_VENDOR_TYPE | USB_RECIP_DEVICE,
>> + REQ_14_SET_GET_I2C_WR2_RDN, addr, reg, buf, len);
>> +}
>> +
>> static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
>> struct i2c_msg msgs[], int num)
>> {
>> @@ -78,13 +104,14 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
>> i2c_dprintk(2, "; joined to read %s len=%d:",
>> i == num - 2 ? "stop" : "nonstop",
>> msgs[i + 1].len);
>> - rc = tm6000_read_write_usb (dev,
>> - USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
>> - msgs[i].len == 1 ? REQ_16_SET_GET_I2C_WR1_RDN
>> - : REQ_14_SET_GET_I2C_WR2_RDN,
>> - addr | msgs[i].buf[0] << 8,
>> - msgs[i].len == 1 ? 0 : msgs[i].buf[1],
>> + if (msgs{i].len == 1) {
>> + rc = tm6000_i2c_recv_regs(dev, addr, msgs[i].buf[0],
>> msgs[i + 1].buf, msgs[i + 1].len);
>> + } else {
>> + rc = tm6000_i2c_recv_regs(dev, addr, msgs[i].buf[0] << 8 | msgs[i].buf[1],
>> + msgs[i + 1].buf, msgs[i + 1].len);
>> + }
>> +
>> i++;
>>
>> if (addr == dev->tuner_addr) {
>> @@ -99,10 +126,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
>> if (i2c_debug >= 2)
>> for (byte = 0; byte < msgs[i].len; byte++)
>> printk(" %02x", msgs[i].buf[byte]);
>> - rc = tm6000_read_write_usb(dev,
>> - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
>> - REQ_16_SET_GET_I2C_WR1_RDN,
>> - addr | msgs[i].buf[0] << 8, 0,
>> + rc = tm6000_i2c_send_regs(dev, addr, msgs[i].buf[0],
>> msgs[i].buf + 1, msgs[i].len - 1);
>>
>> if (addr == dev->tuner_addr) {
>> @@ -134,9 +158,7 @@ static int tm6000_i2c_eeprom(struct tm6000_core *dev,
>> bytes[16] = '\0';
>> for (i = 0; i < len; ) {
>> *p = i;
>> - rc = tm6000_read_write_usb (dev,
>> - USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
>> - REQ_16_SET_GET_I2C_WR1_RDN, 0xa0 | i<<8, 0, p, 1);
>> + rc = tm6000_i2c_revc_regs(dev, 0xa0, i, p, 1);
>> if (rc < 1) {
>> if (p == eedata)
>> goto noeeprom;
>>
Sorry, I mistaken. I resend the correct once.
--
Stefan Ringel <stefan.ringel@arcor.de>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] tm6000: add send and recv function
@ 2010-02-22 17:35 stefan.ringel
0 siblings, 0 replies; 9+ messages in thread
From: stefan.ringel @ 2010-02-22 17:35 UTC (permalink / raw)
To: linux-media; +Cc: mchehab, dheitmueller, Stefan Ringel
From: Stefan Ringel <stefan.ringel@arcor.de>
add separately send and receive function
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
---
drivers/staging/tm6000/tm6000-i2c.c | 51 +++++++++++++++++++++++++---------
1 files changed, 37 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c
index 656cd19..2de92f3 100644
--- a/drivers/staging/tm6000/tm6000-i2c.c
+++ b/drivers/staging/tm6000/tm6000-i2c.c
@@ -44,6 +44,32 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
printk(KERN_DEBUG "%s at %s: " fmt, \
dev->name, __FUNCTION__ , ##args); } while (0)
+int tm6000_i2c_send_regs(struct tm6000_core *dev, unsigned char addr, __u8 reg, char *buf, int len)
+{
+ return tm6000_read_write_usb(dev, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+ REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len);
+}
+
+/* read from a 8bit register */
+int tm6000_i2c_recv_regs(struct tm6000_core *dev, unsigned char addr, __u8 reg, char *buf, int len)
+{
+ int rc;
+
+ rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+ REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len);
+
+ return rc;
+}
+
+/* read from a 16bit register
+ * for example xc2028, xc3028 or xc3028L
+ */
+int tm6000_i2c_recv_regs16(struct tm6000_core *dev, unsigned char addr, __u16 reg, char *buf, int len)
+{
+ return tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+ REQ_14_SET_GET_I2C_WR2_RDN, addr, reg, buf, len);
+}
+
static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
struct i2c_msg msgs[], int num)
{
@@ -78,13 +104,15 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
i2c_dprintk(2, "; joined to read %s len=%d:",
i == num - 2 ? "stop" : "nonstop",
msgs[i + 1].len);
- rc = tm6000_read_write_usb (dev,
- USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- msgs[i].len == 1 ? REQ_16_SET_GET_I2C_WR1_RDN
- : REQ_14_SET_GET_I2C_WR2_RDN,
- addr | msgs[i].buf[0] << 8,
- msgs[i].len == 1 ? 0 : msgs[i].buf[1],
- msgs[i + 1].buf, msgs[i + 1].len);
+
+ if (msgs[i].len == 1) {
+ rc = tm6000_i2c_recv_regs(dev, addr, msgs[i].buf[0],
+ msgs[i + 1].buf, msgs[i + 1].len);
+ } else {
+ rc = tm6000_i2c_recv_regs16(dev, addr, msgs[i].buf[0] << 8 | msgs[i].buf[1],
+ msgs[i + 1].buf, msgs[i + 1].len);
+ }
+
i++;
if (addr == dev->tuner_addr) {
@@ -99,10 +127,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
if (i2c_debug >= 2)
for (byte = 0; byte < msgs[i].len; byte++)
printk(" %02x", msgs[i].buf[byte]);
- rc = tm6000_read_write_usb(dev,
- USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- REQ_16_SET_GET_I2C_WR1_RDN,
- addr | msgs[i].buf[0] << 8, 0,
+ rc = tm6000_i2c_send_regs(dev, addr, msgs[i].buf[0],
msgs[i].buf + 1, msgs[i].len - 1);
if (addr == dev->tuner_addr) {
@@ -134,9 +159,7 @@ static int tm6000_i2c_eeprom(struct tm6000_core *dev,
bytes[16] = '\0';
for (i = 0; i < len; ) {
*p = i;
- rc = tm6000_read_write_usb (dev,
- USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- REQ_16_SET_GET_I2C_WR1_RDN, 0xa0 | i<<8, 0, p, 1);
+ rc = tm6000_i2c_recv_regs(dev, 0xa0, i, p, 1);
if (rc < 1) {
if (p == eedata)
goto noeeprom;
--
1.6.6.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] tm6000: add send and recv function
2010-02-22 16:21 stefan.ringel
@ 2010-02-22 17:08 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 9+ messages in thread
From: Mauro Carvalho Chehab @ 2010-02-22 17:08 UTC (permalink / raw)
To: stefan.ringel; +Cc: linux-media, dheitmueller
stefan.ringel@arcor.de wrote:
> From: Stefan Ringel <stefan.ringel@arcor.de>
>
> add separately send and receive function
Still broken:
drivers/staging/tm6000/tm6000-i2c.c: In function ‘tm6000_i2c_xfer’:
drivers/staging/tm6000/tm6000-i2c.c:107: error: expected ‘)’ before ‘{’ token
drivers/staging/tm6000/tm6000-i2c.c: In function ‘tm6000_i2c_eeprom’:
drivers/staging/tm6000/tm6000-i2c.c:161: error: implicit declaration of function ‘tm6000_i2c_revc_regs’
>
> Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
> ---
> drivers/staging/tm6000/tm6000-i2c.c | 48 +++++++++++++++++++++++++---------
> 1 files changed, 35 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c
> index 656cd19..2222b39 100644
> --- a/drivers/staging/tm6000/tm6000-i2c.c
> +++ b/drivers/staging/tm6000/tm6000-i2c.c
> @@ -44,6 +44,32 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
> printk(KERN_DEBUG "%s at %s: " fmt, \
> dev->name, __FUNCTION__ , ##args); } while (0)
>
> +int tm6000_i2c_send_regs(struct tm6000_core *dev, unsigned char addr, __u8 reg, char *buf, int len)
> +{
> + return tm6000_read_write_usb(dev, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
> + REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len);
> +}
> +
> +/* read from a 8bit register */
> +int tm6000_i2c_recv_regs(struct tm6000_core *dev, unsigned char addr, __u8 reg, char *buf, int len)
> +{
> + int rc;
> +
> + rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
> + REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len);
> +
> + return rc;
> +}
> +
> +/* read from a 16bit register
> + * for example xc2028, xc3028 or xc3028L
> + */
> +int tm6000_i2c_recv_regs16(struct tm6000_core *dev, unsigned char addr, __u16 reg, char *buf, int len)
> +{
> + return tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
> + REQ_14_SET_GET_I2C_WR2_RDN, addr, reg, buf, len);
> +}
> +
> static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
> struct i2c_msg msgs[], int num)
> {
> @@ -78,13 +104,14 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
> i2c_dprintk(2, "; joined to read %s len=%d:",
> i == num - 2 ? "stop" : "nonstop",
> msgs[i + 1].len);
> - rc = tm6000_read_write_usb (dev,
> - USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
> - msgs[i].len == 1 ? REQ_16_SET_GET_I2C_WR1_RDN
> - : REQ_14_SET_GET_I2C_WR2_RDN,
> - addr | msgs[i].buf[0] << 8,
> - msgs[i].len == 1 ? 0 : msgs[i].buf[1],
> + if (msgs{i].len == 1) {
> + rc = tm6000_i2c_recv_regs(dev, addr, msgs[i].buf[0],
> msgs[i + 1].buf, msgs[i + 1].len);
> + } else {
> + rc = tm6000_i2c_recv_regs(dev, addr, msgs[i].buf[0] << 8 | msgs[i].buf[1],
> + msgs[i + 1].buf, msgs[i + 1].len);
> + }
> +
> i++;
>
> if (addr == dev->tuner_addr) {
> @@ -99,10 +126,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
> if (i2c_debug >= 2)
> for (byte = 0; byte < msgs[i].len; byte++)
> printk(" %02x", msgs[i].buf[byte]);
> - rc = tm6000_read_write_usb(dev,
> - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
> - REQ_16_SET_GET_I2C_WR1_RDN,
> - addr | msgs[i].buf[0] << 8, 0,
> + rc = tm6000_i2c_send_regs(dev, addr, msgs[i].buf[0],
> msgs[i].buf + 1, msgs[i].len - 1);
>
> if (addr == dev->tuner_addr) {
> @@ -134,9 +158,7 @@ static int tm6000_i2c_eeprom(struct tm6000_core *dev,
> bytes[16] = '\0';
> for (i = 0; i < len; ) {
> *p = i;
> - rc = tm6000_read_write_usb (dev,
> - USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
> - REQ_16_SET_GET_I2C_WR1_RDN, 0xa0 | i<<8, 0, p, 1);
> + rc = tm6000_i2c_revc_regs(dev, 0xa0, i, p, 1);
> if (rc < 1) {
> if (p == eedata)
> goto noeeprom;
--
Cheers,
Mauro
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] tm6000: add send and recv function
@ 2010-02-22 16:21 stefan.ringel
2010-02-22 17:08 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 9+ messages in thread
From: stefan.ringel @ 2010-02-22 16:21 UTC (permalink / raw)
To: linux-media; +Cc: mchehab, dheitmueller, Stefan Ringel
From: Stefan Ringel <stefan.ringel@arcor.de>
add separately send and receive function
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
---
drivers/staging/tm6000/tm6000-i2c.c | 48 +++++++++++++++++++++++++---------
1 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c
index 656cd19..2222b39 100644
--- a/drivers/staging/tm6000/tm6000-i2c.c
+++ b/drivers/staging/tm6000/tm6000-i2c.c
@@ -44,6 +44,32 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
printk(KERN_DEBUG "%s at %s: " fmt, \
dev->name, __FUNCTION__ , ##args); } while (0)
+int tm6000_i2c_send_regs(struct tm6000_core *dev, unsigned char addr, __u8 reg, char *buf, int len)
+{
+ return tm6000_read_write_usb(dev, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+ REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len);
+}
+
+/* read from a 8bit register */
+int tm6000_i2c_recv_regs(struct tm6000_core *dev, unsigned char addr, __u8 reg, char *buf, int len)
+{
+ int rc;
+
+ rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+ REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len);
+
+ return rc;
+}
+
+/* read from a 16bit register
+ * for example xc2028, xc3028 or xc3028L
+ */
+int tm6000_i2c_recv_regs16(struct tm6000_core *dev, unsigned char addr, __u16 reg, char *buf, int len)
+{
+ return tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+ REQ_14_SET_GET_I2C_WR2_RDN, addr, reg, buf, len);
+}
+
static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
struct i2c_msg msgs[], int num)
{
@@ -78,13 +104,14 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
i2c_dprintk(2, "; joined to read %s len=%d:",
i == num - 2 ? "stop" : "nonstop",
msgs[i + 1].len);
- rc = tm6000_read_write_usb (dev,
- USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- msgs[i].len == 1 ? REQ_16_SET_GET_I2C_WR1_RDN
- : REQ_14_SET_GET_I2C_WR2_RDN,
- addr | msgs[i].buf[0] << 8,
- msgs[i].len == 1 ? 0 : msgs[i].buf[1],
+ if (msgs{i].len == 1) {
+ rc = tm6000_i2c_recv_regs(dev, addr, msgs[i].buf[0],
msgs[i + 1].buf, msgs[i + 1].len);
+ } else {
+ rc = tm6000_i2c_recv_regs(dev, addr, msgs[i].buf[0] << 8 | msgs[i].buf[1],
+ msgs[i + 1].buf, msgs[i + 1].len);
+ }
+
i++;
if (addr == dev->tuner_addr) {
@@ -99,10 +126,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap,
if (i2c_debug >= 2)
for (byte = 0; byte < msgs[i].len; byte++)
printk(" %02x", msgs[i].buf[byte]);
- rc = tm6000_read_write_usb(dev,
- USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- REQ_16_SET_GET_I2C_WR1_RDN,
- addr | msgs[i].buf[0] << 8, 0,
+ rc = tm6000_i2c_send_regs(dev, addr, msgs[i].buf[0],
msgs[i].buf + 1, msgs[i].len - 1);
if (addr == dev->tuner_addr) {
@@ -134,9 +158,7 @@ static int tm6000_i2c_eeprom(struct tm6000_core *dev,
bytes[16] = '\0';
for (i = 0; i < len; ) {
*p = i;
- rc = tm6000_read_write_usb (dev,
- USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- REQ_16_SET_GET_I2C_WR1_RDN, 0xa0 | i<<8, 0, p, 1);
+ rc = tm6000_i2c_revc_regs(dev, 0xa0, i, p, 1);
if (rc < 1) {
if (p == eedata)
goto noeeprom;
--
1.6.6.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-02-22 17:35 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-21 20:10 [PATCH 1/3] tm6000: add send and recv function stefan.ringel
2010-02-21 20:10 ` [PATCH 2/3] tm6000: bugfix reading problems with demodulator zl10353 stefan.ringel
2010-02-21 20:10 ` [PATCH 3/3] tm6000: bugfix i2c addr stefan.ringel
2010-02-22 15:18 ` [PATCH 2/3] tm6000: bugfix reading problems with demodulator zl10353 Mauro Carvalho Chehab
2010-02-22 15:16 ` [PATCH 1/3] tm6000: add send and recv function Mauro Carvalho Chehab
2010-02-22 15:46 ` Stefan Ringel
2010-02-22 16:21 stefan.ringel
2010-02-22 17:08 ` Mauro Carvalho Chehab
2010-02-22 17:35 stefan.ringel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.