From 0d990ed0f33d050c66e053e2cec6862d0a14a45c Mon Sep 17 00:00:00 2001 From: root Date: Sat, 4 Sep 2010 23:14:42 +0800 Subject: [PATCH] commit code adapte raho board --- drivers/fpga/spi_gpio.c | 9 ++++-- drivers/input/gsensor/mma7660.c | 1 + drivers/input/misc/capella_cm3602.c | 8 ++--- drivers/input/touchscreen/ctp_it7250.c | 42 +++++++++++++++++--------- drivers/rtc/rtc-s35392a.c | 18 +++++++---- 5 files changed, 51 insertions(+), 27 deletions(-) diff --git a/drivers/fpga/spi_gpio.c b/drivers/fpga/spi_gpio.c index c4f03da14244..bf3df3938cee 100755 --- a/drivers/fpga/spi_gpio.c +++ b/drivers/fpga/spi_gpio.c @@ -669,7 +669,10 @@ int spi_gpio_init_first(void) spi_gpio_set_pinlevel(SPI_GPIO_P2_15, SPI_GPIO_HIGH); //TOUCH_SCREEN_RST output// spi_gpio_set_pindirection(SPI_GPIO_P2_15, SPI_GPIO_OUT); - spi_gpio_set_pindirection(SPI_GPIO_P4_06, SPI_GPIO_IN); //CHARGER_INT_END input + //spi_gpio_set_pindirection(SPI_GPIO_P4_06, SPI_GPIO_IN); //CHARGER_INT_END input + spi_gpio_set_pindirection(SPI_GPIO_P4_06, SPI_GPIO_OUT); //CHARGER_INT_END output + spi_gpio_set_pinlevel(SPI_GPIO_P4_06, SPI_GPIO_LOW); //CM3605_PWD low + spi_gpio_set_pinlevel(SPI_GPIO_P4_07, SPI_GPIO_LOW); //CM3605_PWD output spi_gpio_set_pindirection(SPI_GPIO_P4_07, SPI_GPIO_OUT); spi_gpio_set_pinlevel(SPI_GPIO_P4_08, SPI_GPIO_LOW); //CM3605_PS_SHUTDOWN @@ -877,10 +880,10 @@ static int _spi_gpio_irq_set_type(unsigned int irq, unsigned int type) } switch(type) { - case IRQF_TRIGGER_FALLING: + case GPIOEdgelFalling: int_type = SPI_GPIO_EDGE_FALLING; break; - case IRQF_TRIGGER_RISING: + case GPIOEdgelRising: int_type = SPI_GPIO_EDGE_RISING; break; default: diff --git a/drivers/input/gsensor/mma7660.c b/drivers/input/gsensor/mma7660.c index eb2cfb00db3e..a0c26b0f686d 100755 --- a/drivers/input/gsensor/mma7660.c +++ b/drivers/input/gsensor/mma7660.c @@ -530,6 +530,7 @@ static int mma7660_probe(struct i2c_client *client, const struct i2c_device_id input_set_abs_params(mma7660->input_dev, ABS_Z, -1500, 1500, 0, 0); mma7660->input_dev->name = "compass"; + mma7660->input_dev->dev.parent = &client->dev; err = input_register_device(mma7660->input_dev); if (err < 0) { diff --git a/drivers/input/misc/capella_cm3602.c b/drivers/input/misc/capella_cm3602.c index 1788ba7de1f7..d34effaabc43 100755 --- a/drivers/input/misc/capella_cm3602.c +++ b/drivers/input/misc/capella_cm3602.c @@ -67,7 +67,7 @@ static int capella_cm3602_report(struct capella_cm3602_data *data) static irqreturn_t capella_cm3602_irq_handler(int irq, void *data) { struct capella_cm3602_data *ip = data; - printk("---capella_cm3602_irq_handler----\n"); + //printk("---capella_cm3602_irq_handler----\n"); //int val = capella_cm3602_report(ip); input_report_abs(ip->input_dev, ABS_DISTANCE, 0); input_sync(ip->input_dev); @@ -119,13 +119,13 @@ void cm3602_work_handler(struct work_struct *work) struct capella_cm3602_data *pdata = container_of(work, struct capella_cm3602_data, cm3602_work); int val = gpio_get_value(pdata->pdata->irq_pin); - printk("-------------------cm3602_work_handler,pinlevel:%d----------------\n",val); + //printk("-------------------cm3602_work_handler,pinlevel:%d----------------\n",val); if (val == 1) { time_enable = false; input_report_abs(pdata->input_dev, ABS_DISTANCE, val); input_sync(pdata->input_dev); - printk("input_report_abs=%d\n",val); + //printk("input_report_abs=%d\n",val); } } @@ -138,7 +138,7 @@ static void cm3602_timer(unsigned long data) add_timer(&ip->cm3602_timer); if(time_enable) { - printk("------------------cm3602_timer,%d------------\n",time_enable); + //printk("------------------cm3602_timer,%d------------\n",time_enable); queue_work(ip->cm3602_workqueue, &ip->cm3602_work); } diff --git a/drivers/input/touchscreen/ctp_it7250.c b/drivers/input/touchscreen/ctp_it7250.c index 8f78ca76d33d..26706afcfd4b 100755 --- a/drivers/input/touchscreen/ctp_it7250.c +++ b/drivers/input/touchscreen/ctp_it7250.c @@ -34,6 +34,8 @@ struct Ctp_it7250_data { struct i2c_client *client; struct delayed_work delaywork; int irq; /* Our chip IRQ */ + u32 temp_x; + u32 temp_y; }; static struct i2c_client *Ctp_it7250_client; @@ -190,7 +192,7 @@ static int Ctp_it7250_touch_open(struct input_dev *idev) static void Ctp_it7250_touch_close(struct input_dev *idev) { -return 0; +return ; } static irqreturn_t Ctp_it7250_touch_irq(int irq, void *dev_id) @@ -200,7 +202,7 @@ static irqreturn_t Ctp_it7250_touch_irq(int irq, void *dev_id) //rk28printk("%s++++ %d \r\n",__FUNCTION__,__LINE__); disable_irq_nosync(irq); //rk28printk("%s++++ %d irq=%d\r\n",__FUNCTION__,__LINE__,irq); - schedule_delayed_work(&Ctp_it7250->delaywork,usecs_to_jiffies(5)); + schedule_delayed_work(&Ctp_it7250->delaywork,msecs_to_jiffies(10)); return IRQ_HANDLED; @@ -223,7 +225,7 @@ static int ts_input_init(struct i2c_client *client) rk28printk("+++++++ %s+++++++\n", __FUNCTION__); Ctp_it7250->input_dev->name = "CTS_Ctp_it7250"; Ctp_it7250->input_dev->phys = "CTS_Ctp_it7250/input1"; - + Ctp_it7250->input_dev->dev.parent = &client->dev; //no need to open & close it,it will do it automaticlly;noted by robert Ctp_it7250->input_dev->open = Ctp_it7250_touch_open; Ctp_it7250->input_dev->close = Ctp_it7250_touch_close; @@ -257,6 +259,7 @@ for (i = 0; i < ARRAY_SIZE(panel_key_info); i++) } +#if 0 static void CTS_configure_pin(struct i2c_client *client) { //add reset pin;but we not used it ;robert @@ -270,6 +273,8 @@ static void CTS_configure_pin(struct i2c_client *client) spi_gpio_set_pinlevel(SPI_GPIO_P2_15, SPI_GPIO_HIGH); mdelay(5); } +#endif + static int Ctp_it7250_init_irq(struct i2c_client *client) { @@ -284,7 +289,7 @@ static int Ctp_it7250_init_irq(struct i2c_client *client) } ret = gpio_request(client->irq, "Ctp_it7250_int"); if (ret) { - rk28printk( "failed to request Ctp_it7250_init_irq GPIO%d\n",client->irq); + rk28printk( "failed to request Ctp_it7250_init_irq GPIO%d\n",gpio_to_irq(client->irq)); return ret; } #if 1 @@ -295,6 +300,7 @@ ret = gpio_direction_input(client->irq); } gpio_pull_updown(client->irq,GPIOPullUp); #endif + rk28printk("%s gpio_to_irq(%d) is %d\n",__FUNCTION__,client->irq,gpio_to_irq(client->irq)); Ctp_it7250->irq = gpio_to_irq(client->irq); #endif @@ -304,7 +310,7 @@ ret = gpio_direction_input(client->irq); rk28printk(KERN_ERR "Ctp_it7250_init_irq: request irq failed,ret is %d\n",ret); return ret; } - + return true; } @@ -348,10 +354,10 @@ int i; ucQuery = QUERY_BUSY; } }while(ucQuery & QUERY_BUSY); - pucData[5]== 0 ; - pucData[6] == 0 ; - pucData[7] == 0 ; - pucData[8] == 0; + pucData[5]= 0 ; + pucData[6]= 0 ; + pucData[7]= 0 ; + pucData[8]= 0; // Read Command Response if(!ReadCommandResponseBuffer(client, pucData, ucReadLength)) { @@ -580,7 +586,7 @@ rk28printk("%s ReadCommandResponseBuffer EDN\r\n",__FUNCTION__); { * pucStep = pucData[6]; } - rk28printk("%s x res=%d y res=%d \r\n",__FUNCTION__,*pwXResolution,* pwYResolution); + rk28printk("%s x res=%d y res=%d !\r\n",__FUNCTION__,*pwXResolution,* pwYResolution); return true; } @@ -721,10 +727,12 @@ if (!GetFirmwareInformation (client)) #endif return true; +#if 0 resetagin: if (!CaptouchReset(client)) rk28printk("CaptouchReset success \r\n"); mdelay(100); + #endif // if (!CaptouchMode(client, 0x00)) // rk28printk("CaptouchMode success \r\n"); } @@ -798,7 +806,7 @@ gpucPointBuffer[i * 4 + 4]; // Return value: // return gesture ID // ******************************************************************************************* -int CaptouchGetGesture() +int CaptouchGetGesture(void) { return (int)gpucPointBuffer[1]; } @@ -850,12 +858,18 @@ static void Ctp_it7250_delaywork_func(struct work_struct *work) else if(dwTouchEvent <=MAX_FINGER_NUM) //CTP_MAX_FINGER_NUMBER) { //SynchroSystemEvent(SYSTEM_TOUCH_EVENT_FINGER_ASSERT); - + if ((abs(Ctp_it7250->temp_x -gpdwSampleX[0])>10) ||( abs(Ctp_it7250->temp_y-gpdwSampleY[0])>10)) + { input_report_abs(Ctp_it7250->input_dev, ABS_X, gpdwSampleX[0]);// & 0xfff input_report_abs(Ctp_it7250->input_dev, ABS_Y, gpdwSampleY[0]); //& 0xfff input_report_key(Ctp_it7250->input_dev,BTN_TOUCH, 1); input_sync(Ctp_it7250->input_dev); rk28printk("x=%d y=%d \r\n",gpdwSampleX[0],gpdwSampleY[0]); + Ctp_it7250->temp_x=gpdwSampleX[0]; + Ctp_it7250->temp_y=gpdwSampleY[0]; + } + else + rk28printk("the same \r\n"); } else { @@ -942,8 +956,8 @@ static void Ctp_it7250_delaywork_func(struct work_struct *work) static int Ctp_it7250_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct Ctp_it7250_data *Ctp_it7250; - u16 TempReg=0x0; - u16 val=0x0; +// u16 TempReg=0x0; +// u16 val=0x0; Ctp_it7250_client = client; rk28printk("+++++++ %s+++++++\n", __FUNCTION__); diff --git a/drivers/rtc/rtc-s35392a.c b/drivers/rtc/rtc-s35392a.c index 05ceb9d8b556..ba06f22f585f 100755 --- a/drivers/rtc/rtc-s35392a.c +++ b/drivers/rtc/rtc-s35392a.c @@ -22,7 +22,6 @@ #include #include "rtc-s35392a.h" -#define RTC_S35392A_INT RK2818_PIN_PE2 // #define RTC_RATE 100 * 1000 #define S35392_TEST 0 @@ -578,12 +577,17 @@ static int s35392a_reset(struct s35392a *s35392a) if (s35392a_get_reg(s35392a, S35392A_CMD_STATUS1, buf, sizeof(buf)) < 0) return -EIO; - if (!(buf[0] & (S35392A_FLAG_POC | S35392A_FLAG_BLD))) + if (!(buf[0] & (S35392A_FLAG_POC | S35392A_FLAG_BLD))) { + buf[0] = 0x00; + s35392a_set_reg(s35392a, S35392A_CMD_STATUS2, buf, 1); + s35392a_set_reg(s35392a, S35392A_CMD_INT2, buf, 1); return 0; + } buf[0] |= (S35392A_FLAG_RESET | S35392A_FLAG_24H); buf[0] &= 0xf0; s35392a_set_reg(s35392a, S35392A_CMD_STATUS1, buf, sizeof(buf)); + //s35392a_set_init_time( s35392a); return 0; } @@ -823,16 +827,18 @@ static int s35392a_probe(struct i2c_client *client, goto exit_dummy; } - if(err = gpio_request(RTC_S35392A_INT, "rtc gpio")) + if(err = gpio_request(client->irq, "rtc gpio")) { dev_err(&client->dev, "gpio request fail\n"); - gpio_free(RTC_S35392A_INT); + gpio_free(client->irq); goto exit_dummy; } - gpio_pull_updown(RTC_S35392A_INT,GPIOPullDown); + gpio_pull_updown(client->irq,GPIOPullDown); + + client->irq = gpio_to_irq(client->irq); - if(err = request_irq(gpio_to_irq(RTC_S35392A_INT),s35392a_wakeup_irq,IRQF_TRIGGER_HIGH,NULL,s35392a) <0) + if(err = request_irq(client->irq, s35392a_wakeup_irq,IRQF_TRIGGER_HIGH,NULL,s35392a) <0) { printk("unable to request rtc irq\n"); goto exit_dummy; -- 2.34.1