From 656c7bf8cbdc426d5744e4a39b8e92dc1d1d6c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=B6=9B?= Date: Wed, 5 Jan 2011 20:30:13 +0800 Subject: [PATCH 1/3] rtc: hym8563: fix initialize --- arch/arm/mach-rk29/board-rk29sdk.c | 2 +- drivers/rtc/rtc-HYM8563.c | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-rk29/board-rk29sdk.c b/arch/arm/mach-rk29/board-rk29sdk.c index f4f484771b39..344270dd8912 100755 --- a/arch/arm/mach-rk29/board-rk29sdk.c +++ b/arch/arm/mach-rk29/board-rk29sdk.c @@ -516,7 +516,7 @@ static struct i2c_board_info __initdata board_i2c0_devices[] = { .type = "rtc_hym8563", .addr = 0x51, .flags = 0, - ///.irq = RK2818_PIN_PA4, + .irq = RK29_PIN0_PA1, }, #endif #if defined (CONFIG_GS_MMA8452) diff --git a/drivers/rtc/rtc-HYM8563.c b/drivers/rtc/rtc-HYM8563.c index ab2500de8b31..1604836aff4b 100644 --- a/drivers/rtc/rtc-HYM8563.c +++ b/drivers/rtc/rtc-HYM8563.c @@ -108,6 +108,7 @@ static int hym8563_read_datetime(struct i2c_client *client, struct rtc_time *tm) if(tm->tm_year < 0) tm->tm_year = 0; tm->tm_isdst = 0; + DBG("%s [%d]tm_wday=%d \n",__FUNCTION__,__LINE__,tm->tm_wday); DBG("%s [%d]tm_sec=%d \n",__FUNCTION__,__LINE__,tm->tm_sec); DBG("%s [%d]tm_min=%d \n",__FUNCTION__,__LINE__,tm->tm_min); DBG("%s [%d]tm_hour=%d \n",__FUNCTION__,__LINE__,tm->tm_hour); @@ -128,6 +129,7 @@ static int hym8563_set_time(struct i2c_client *client, struct rtc_time *tm) u8 mon_day,i; u8 ret = 0; + DBG("%s [%d]tm_wday=%d \n",__FUNCTION__,__LINE__,tm->tm_wday); DBG("%s [%d]tm_sec=%d \n",__FUNCTION__,__LINE__,tm->tm_sec); DBG("%s [%d]tm_min=%d \n",__FUNCTION__,__LINE__,tm->tm_min); DBG("%s [%d]tm_hour=%d \n",__FUNCTION__,__LINE__,tm->tm_hour); @@ -324,13 +326,13 @@ static int __devinit hym8563_probe(struct i2c_client *client,const struct i2c_d struct hym8563 *hym8563; struct rtc_device *rtc = NULL; struct rtc_time tm_read, tm = { - .tm_wday = 4, - .tm_year = 109, - .tm_mon = 9, - .tm_mday = 1, - .tm_hour = 12, - .tm_min = 10, - .tm_sec = 58 + .tm_wday = 6, + .tm_year = 111, + .tm_mon = 0, + .tm_mday = 1, + .tm_hour = 12, + .tm_min = 0, + .tm_sec = 0, }; if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) @@ -352,7 +354,7 @@ static int __devinit hym8563_probe(struct i2c_client *client,const struct i2c_d hym8563_init_device(client); hym8563_read_datetime(client, &tm_read); //read time from hym8563 - if(((tm_read.tm_year < 70) | (tm_read.tm_year > 137 )) | (tm_read.tm_mon == -1)) //if the hym8563 haven't initialized + if(((tm_read.tm_year < 70) | (tm_read.tm_year > 137 )) | (tm_read.tm_mon == -1) | (rtc_valid_tm(&tm_read) != 0)) //if the hym8563 haven't initialized { hym8563_set_time(client, &tm); //initialize the hym8563 } @@ -366,7 +368,7 @@ static int __devinit hym8563_probe(struct i2c_client *client,const struct i2c_d hym8563->irq_num = gpio_to_irq(client->irq); gpio_pull_updown(client->irq,GPIOPullUp); - if(request_irq(hym8563->irq_num, hym8563_wakeup_irq,IRQF_TRIGGER_FALLING,NULL,hym8563) <0) + if (request_irq(hym8563->irq_num, hym8563_wakeup_irq, IRQF_TRIGGER_FALLING, client->dev.driver->name, hym8563) < 0) { printk("unable to request rtc irq\n"); goto exit; From 298510f0bd91f80669d9c5d4e358aed18269f453 Mon Sep 17 00:00:00 2001 From: ddl Date: Mon, 3 Jan 2011 22:25:40 +0800 Subject: [PATCH 2/3] camera:ov5642 read register after write for dc vsync error --- drivers/media/video/ov5642.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/ov5642.c b/drivers/media/video/ov5642.c index 8b7319700a03..657bfc7aa315 100755 --- a/drivers/media/video/ov5642.c +++ b/drivers/media/video/ov5642.c @@ -2254,7 +2254,7 @@ static struct reginfo sensor_sxga[] = /* 800X600 SVGA*/ static struct reginfo sensor_svga[] = { -#if 0 +#if 1 {0x3000,0xf8}, {0x3001,0x48}, {0x3002,0x5c}, @@ -3240,9 +3240,10 @@ static int sensor_read(struct i2c_client *client, u16 reg, u8 *val) /* write a array of registers */ static int sensor_write_array(struct i2c_client *client, struct reginfo *regarray) { - int err, cnt; + int err = 0, cnt; int i = 0; struct sensor *sensor = to_sensor(client); + char val00; cnt = 0; while (regarray[i].reg != 0) @@ -3267,7 +3268,13 @@ static int sensor_write_array(struct i2c_client *client, struct reginfo *regarra err = -EPERM; goto sensor_af_init_end; } + } else { + sensor_read(client, regarray[i].reg, &val00); + if (val00 != regarray[i].val) + SENSOR_TR("%s Reg:0x%x write(0x%x, 0x%x) fail\n",SENSOR_NAME_STRING(), regarray[i].reg, regarray[i].val, val00); + } + i++; } @@ -3821,8 +3828,11 @@ static int sensor_deactivate(struct v4l2_subdev *sd) { struct i2c_client *client = sd->priv; struct sensor *sensor = to_sensor(client); + int ret; - SENSOR_DG("\n%s..%s enter \n",SENSOR_NAME_STRING(),__FUNCTION__); + ret = sensor_write(client, 0x3008, 0x80); + SENSOR_DG("\n%s..%s enter, reset ret:0x%x \n",SENSOR_NAME_STRING(),__FUNCTION__,ret); + msleep(5); /* ddl@rock-chips.com : all sensor output pin must change to input for other sensor */ sensor_write(client, 0x3017, 0x00); // FREX,VSYNC,HREF,PCLK,D9-D6 From 1b557e787e04eba644b6dd3e17efb09bbc99e7e5 Mon Sep 17 00:00:00 2001 From: ddl Date: Mon, 3 Jan 2011 22:30:26 +0800 Subject: [PATCH 3/3] camera:ov2659 change rasing update data,vip capture data in falling --- drivers/media/video/ov2659.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/ov2659.c b/drivers/media/video/ov2659.c index bf39146dc687..2edfa5a076c1 100755 --- a/drivers/media/video/ov2659.c +++ b/drivers/media/video/ov2659.c @@ -76,7 +76,7 @@ o* Driver for MT9M001 CMOS Image Sensor from Micron #define SENSOR_TR(format, ...) #endif -#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING |\ +#define SENSOR_BUS_PARAM (SOCAM_MASTER | SOCAM_PCLK_SAMPLE_FALLING|\ SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_LOW |\ SOCAM_DATA_ACTIVE_HIGH | SOCAM_DATAWIDTH_8 |SOCAM_MCLK_24MHZ) @@ -143,6 +143,7 @@ static struct reginfo sensor_init_data[] = {0x3a14, 0x02}, {0x3a15, 0x28}, + {0x4708,0x00}, {0x3623, 0x00}, {0x3634, 0x76}, @@ -1325,6 +1326,7 @@ static int sensor_write_array(struct i2c_client *client, struct reginfo *regarra { int err, cnt; int i = 0; + char val00; cnt = 0; while (regarray[i].reg != 0) @@ -1340,6 +1342,10 @@ static int sensor_write_array(struct i2c_client *client, struct reginfo *regarra SENSOR_TR("%s..write array failed!!!\n", SENSOR_NAME_STRING()); return -EPERM; } + } else { + sensor_read(client, regarray[i].reg, &val00); + if (val00 != regarray[i].val) + SENSOR_TR("%s Reg:0x%x write(0x%x, 0x%x) fail\n",SENSOR_NAME_STRING(), regarray[i].reg, regarray[i].val, val00); } i++; } @@ -1358,7 +1364,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val) SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__); /* soft reset */ - ret = sensor_write(client, 0x3012, 0x80); + ret = sensor_write(client, 0x0103, 0x01); if (ret != 0) { SENSOR_TR("%s soft reset sensor failed\n",SENSOR_NAME_STRING()); @@ -1465,9 +1471,12 @@ static int sensor_deactivate(struct v4l2_subdev *sd) { struct i2c_client *client = sd->priv; u8 reg_val; + int ret; - SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__); + ret = sensor_write(client, 0x0103, 0x01); + SENSOR_DG("\n%s..%s enter, reset ret:0x%x \n",SENSOR_NAME_STRING(),__FUNCTION__,ret); + msleep(5); /* ddl@rock-chips.com : all sensor output pin must change to input for other sensor */ sensor_read(client,0x3000,®_val); sensor_write(client, 0x3000, reg_val&0xfc); @@ -2399,7 +2408,7 @@ static int sensor_video_probe(struct soc_camera_device *icd, return -ENODEV; /* soft reset */ - ret = sensor_write(client, 0x3012, 0x80); + ret = sensor_write(client, 0x0103, 0x01); if (ret != 0) { SENSOR_TR("soft reset %s failed\n",SENSOR_NAME_STRING());