From: Dmitri Belimov <d.belimov@gmail.com>
To: Linux Media Mailing List <linux-media@vger.kernel.org>,
Stefan Ringel <stefan.ringel@arcor.de>,
Mauro Carvalho Chehab <mchehab@redhat.com>,
Bee Hock Goh <beehock@gmail.com>
Subject: [PATCH] tm6000, reset I2C bus function
Date: Tue, 18 May 2010 17:23:29 +1000 [thread overview]
Message-ID: <20100518172329.6d9b520a@glory.loctelecom.ru> (raw)
[-- Attachment #1: Type: text/plain, Size: 2479 bytes --]
Hi
Add new function for reset I2C bus. Rework some code for use this function.
diff -r 8f5129efe974 linux/drivers/staging/tm6000/tm6000-cards.c
--- a/linux/drivers/staging/tm6000/tm6000-cards.c Sun May 16 18:48:01 2010 -0300
+++ b/linux/drivers/staging/tm6000/tm6000-cards.c Tue May 18 11:14:55 2010 +1000
@@ -378,13 +378,7 @@
tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT,
0x02, arg);
msleep(10);
- rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
- TM6000_GPIO_CLK, 0);
- if (rc < 0)
- return rc;
- msleep(10);
- rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
- TM6000_GPIO_CLK, 1);
+ rc = tm6000_i2c_reset(dev, 10);
break;
case XC2028_TUNER_RESET:
/* Reset codes during load firmware */
@@ -438,14 +432,7 @@
break;
case 2:
- rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
- TM6000_GPIO_CLK, 0);
- if (rc < 0)
- return rc;
- msleep(100);
- rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
- TM6000_GPIO_CLK, 1);
- msleep(100);
+ rc = tm6000_i2c_reset(dev, 100);
break;
}
}
diff -r 8f5129efe974 linux/drivers/staging/tm6000/tm6000-core.c
--- a/linux/drivers/staging/tm6000/tm6000-core.c Sun May 16 18:48:01 2010 -0300
+++ b/linux/drivers/staging/tm6000/tm6000-core.c Tue May 18 11:14:55 2010 +1000
@@ -156,6 +156,22 @@
return rc;
return buf[3] | buf[2] << 8 | buf[1] << 16 | buf[0] << 24;
+}
+
+int tm6000_i2c_reset(struct tm6000_core *dev, u16 tsleep)
+{
+ int rc;
+
+ rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_CLK, 0);
+ if (rc < 0)
+ return rc;
+
+ msleep(tsleep);
+
+ rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_CLK, 1);
+ msleep(tsleep);
+
+ return rc;
}
void tm6000_set_fourcc_format(struct tm6000_core *dev)
diff -r 8f5129efe974 linux/drivers/staging/tm6000/tm6000.h
--- a/linux/drivers/staging/tm6000/tm6000.h Sun May 16 18:48:01 2010 -0300
+++ b/linux/drivers/staging/tm6000/tm6000.h Tue May 18 11:14:55 2010 +1000
@@ -241,6 +241,8 @@
int tm6000_get_reg16(struct tm6000_core *dev, u8 req, u16 value, u16 index);
int tm6000_get_reg32(struct tm6000_core *dev, u8 req, u16 value, u16 index);
int tm6000_set_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index);
+int tm6000_i2c_reset(struct tm6000_core *dev, u16 tsleep);
+
int tm6000_init (struct tm6000_core *dev);
int tm6000_init_analog_mode (struct tm6000_core *dev);
Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>
With my best regards, Dmitry.
[-- Attachment #2: i2c_rst.patch --]
[-- Type: text/x-patch, Size: 2366 bytes --]
diff -r 8f5129efe974 linux/drivers/staging/tm6000/tm6000-cards.c
--- a/linux/drivers/staging/tm6000/tm6000-cards.c Sun May 16 18:48:01 2010 -0300
+++ b/linux/drivers/staging/tm6000/tm6000-cards.c Tue May 18 11:14:55 2010 +1000
@@ -378,13 +378,7 @@
tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT,
0x02, arg);
msleep(10);
- rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
- TM6000_GPIO_CLK, 0);
- if (rc < 0)
- return rc;
- msleep(10);
- rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
- TM6000_GPIO_CLK, 1);
+ rc = tm6000_i2c_reset(dev, 10);
break;
case XC2028_TUNER_RESET:
/* Reset codes during load firmware */
@@ -438,14 +432,7 @@
break;
case 2:
- rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
- TM6000_GPIO_CLK, 0);
- if (rc < 0)
- return rc;
- msleep(100);
- rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
- TM6000_GPIO_CLK, 1);
- msleep(100);
+ rc = tm6000_i2c_reset(dev, 100);
break;
}
}
diff -r 8f5129efe974 linux/drivers/staging/tm6000/tm6000-core.c
--- a/linux/drivers/staging/tm6000/tm6000-core.c Sun May 16 18:48:01 2010 -0300
+++ b/linux/drivers/staging/tm6000/tm6000-core.c Tue May 18 11:14:55 2010 +1000
@@ -156,6 +156,22 @@
return rc;
return buf[3] | buf[2] << 8 | buf[1] << 16 | buf[0] << 24;
+}
+
+int tm6000_i2c_reset(struct tm6000_core *dev, u16 tsleep)
+{
+ int rc;
+
+ rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_CLK, 0);
+ if (rc < 0)
+ return rc;
+
+ msleep(tsleep);
+
+ rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_CLK, 1);
+ msleep(tsleep);
+
+ return rc;
}
void tm6000_set_fourcc_format(struct tm6000_core *dev)
diff -r 8f5129efe974 linux/drivers/staging/tm6000/tm6000.h
--- a/linux/drivers/staging/tm6000/tm6000.h Sun May 16 18:48:01 2010 -0300
+++ b/linux/drivers/staging/tm6000/tm6000.h Tue May 18 11:14:55 2010 +1000
@@ -241,6 +241,8 @@
int tm6000_get_reg16(struct tm6000_core *dev, u8 req, u16 value, u16 index);
int tm6000_get_reg32(struct tm6000_core *dev, u8 req, u16 value, u16 index);
int tm6000_set_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index);
+int tm6000_i2c_reset(struct tm6000_core *dev, u16 tsleep);
+
int tm6000_init (struct tm6000_core *dev);
int tm6000_init_analog_mode (struct tm6000_core *dev);
Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>
next reply other threads:[~2010-05-18 7:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-18 7:23 Dmitri Belimov [this message]
2010-05-26 4:52 ` tm6000, alsa Dmitri Belimov
2010-05-27 21:33 ` Mauro Carvalho Chehab
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=20100518172329.6d9b520a@glory.loctelecom.ru \
--to=d.belimov@gmail.com \
--cc=beehock@gmail.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@redhat.com \
--cc=stefan.ringel@arcor.de \
/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 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.