提交 2a15ac7a 编写于 作者: D Dmitri Belimov 提交者: Mauro Carvalho Chehab

V4L/DVB: tm6000, reset I2C bus function

Add new function for reset I2C bus. Rework some code for use this function.
Signed-off-by: NBeholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 b9eb39d8
...@@ -363,13 +363,7 @@ int tm6000_tuner_callback(void *ptr, int component, int command, int arg) ...@@ -363,13 +363,7 @@ int tm6000_tuner_callback(void *ptr, int component, int command, int arg)
tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT,
0x02, arg); 0x02, arg);
msleep(10); msleep(10);
rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, rc = tm6000_i2c_reset(dev, 10);
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);
break; break;
case XC2028_TUNER_RESET: case XC2028_TUNER_RESET:
/* Reset codes during load firmware */ /* Reset codes during load firmware */
...@@ -423,14 +417,7 @@ int tm6000_tuner_callback(void *ptr, int component, int command, int arg) ...@@ -423,14 +417,7 @@ int tm6000_tuner_callback(void *ptr, int component, int command, int arg)
break; break;
case 2: case 2:
rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, rc = tm6000_i2c_reset(dev, 100);
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);
break; break;
} }
} }
......
...@@ -153,6 +153,22 @@ int tm6000_get_reg32 (struct tm6000_core *dev, u8 req, u16 value, u16 index) ...@@ -153,6 +153,22 @@ int tm6000_get_reg32 (struct tm6000_core *dev, u8 req, u16 value, u16 index)
return buf[3] | buf[2] << 8 | buf[1] << 16 | buf[0] << 24; 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) void tm6000_set_fourcc_format(struct tm6000_core *dev)
{ {
if (dev->dev_type == TM6010) { if (dev->dev_type == TM6010) {
......
...@@ -246,6 +246,8 @@ int tm6000_get_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index); ...@@ -246,6 +246,8 @@ int tm6000_get_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index);
int tm6000_get_reg16(struct tm6000_core *dev, u8 req, u16 value, u16 index); 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_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_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 (struct tm6000_core *dev);
int tm6000_init_analog_mode (struct tm6000_core *dev); int tm6000_init_analog_mode (struct tm6000_core *dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册