From 0edb250c0acd0c25eba88e96fe6a19aefc1e2f8a Mon Sep 17 00:00:00 2001 From: wdc Date: Sat, 12 Jul 2014 14:38:33 +0800 Subject: [PATCH] 3036: fix rtc-HYM8563 without irq pin --- drivers/rtc/rtc-HYM8563.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/rtc/rtc-HYM8563.c b/drivers/rtc/rtc-HYM8563.c index ea05d7d66991..d30da29f39ee 100755 --- a/drivers/rtc/rtc-HYM8563.c +++ b/drivers/rtc/rtc-HYM8563.c @@ -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); -- 2.34.1