3036: fix rtc-HYM8563 without irq pin
authorwdc <wdc@rock-chips.com>
Sat, 12 Jul 2014 06:38:33 +0000 (14:38 +0800)
committerwdc <wdc@rock-chips.com>
Sat, 12 Jul 2014 06:40:43 +0000 (14:40 +0800)
drivers/rtc/rtc-HYM8563.c

index ea05d7d66991c4f81dfdc03beaddd67590b150bc..d30da29f39ee006db0e45ddeb61bbb9cc412130b 100755 (executable)
@@ -569,6 +569,7 @@ static int  hym8563_probe(struct i2c_client *client, const struct i2c_device_id
        gClient = client;       
        hym8563->client = client;
        hym8563->alarm.enabled = 0;
+       client->irq = 0;
        mutex_init(&hym8563->mutex);
        wake_lock_init(&hym8563->wake_lock, WAKE_LOCK_SUSPEND, "rtc_hym8563");
        i2c_set_clientdata(client, hym8563);
@@ -591,15 +592,17 @@ static int  hym8563_probe(struct i2c_client *client, const struct i2c_device_id
        }       
        
        client->irq = of_get_named_gpio_flags(np, "irq_gpio", 0,(enum of_gpio_flags *)&irq_flags);
-       
-       hym8563->irq = gpio_to_irq(client->irq);
-       result = devm_request_threaded_irq(&client->dev, hym8563->irq, NULL, hym8563_wakeup_irq, irq_flags | IRQF_ONESHOT, client->dev.driver->name,hym8563 );
-       if (result) {
-               printk(KERN_ERR "%s:fail to request irq = %d, ret = 0x%x\n",__func__, hym8563->irq, result);           
-               goto exit;             
-       }
-       enable_irq_wake(hym8563->irq);
-       device_init_wakeup(&client->dev, 1);    
+        if(client->irq < 0)
+        {
+               hym8563->irq = gpio_to_irq(client->irq);
+               result = devm_request_threaded_irq(&client->dev, hym8563->irq, NULL, hym8563_wakeup_irq, irq_flags | IRQF_ONESHOT, client->dev.driver->name,hym8563 );
+               if (result) {
+                       printk(KERN_ERR "%s:fail to request irq = %d, ret = 0x%x\n",__func__, hym8563->irq, result);
+                       goto exit;
+               }
+               enable_irq_wake(hym8563->irq);
+               device_init_wakeup(&client->dev, 1);
+        }
        rtc = devm_rtc_device_register(&client->dev,
                        client->name,
                                &hym8563_rtc_ops, THIS_MODULE);