From 0a1182796f6475b8cb2ff1781dad873a744b3197 Mon Sep 17 00:00:00 2001 From: Daniel Hillenbrand Date: Sat, 21 Jul 2012 23:04:45 +0200 Subject: samsung opensource update3 --- drivers/input/keyboard/cypress/cypress-touchkey.c | 33 ++++++++++++++++++----- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'drivers/input/keyboard/cypress/cypress-touchkey.c') diff --git a/drivers/input/keyboard/cypress/cypress-touchkey.c b/drivers/input/keyboard/cypress/cypress-touchkey.c index dde89e4120f..72a3422746d 100644 --- a/drivers/input/keyboard/cypress/cypress-touchkey.c +++ b/drivers/input/keyboard/cypress/cypress-touchkey.c @@ -590,6 +590,13 @@ static int touchkey_firmware_update(struct touchkey_i2c *tkey_i2c) return TK_UPDATE_FAIL; } + ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 3); + if (ret < 0) { + printk(KERN_DEBUG + "[TouchKey] i2c read fail. do not excute firm update.\n"); + } + tkey_i2c->firmware_ver = data[1]; + tkey_i2c->module_ver = data[2]; printk(KERN_DEBUG "[TouchKey] firm ver = %d, module ver = %d\n", tkey_i2c->firmware_ver, tkey_i2c->module_ver); } else { @@ -640,6 +647,7 @@ static int touchkey_firmware_update(struct touchkey_i2c *tkey_i2c) if (retry <= 0) { tkey_i2c->pdata->power_on(0); tkey_i2c->update_status = TK_UPDATE_FAIL; + ret = TK_UPDATE_FAIL; } } else { if (tkey_i2c->firmware_ver >= 0x0A) { @@ -1739,6 +1747,16 @@ static int i2c_touchkey_probe(struct i2c_client *client, } } + ret = touchkey_i2c_check(tkey_i2c); + if (ret < 0) { + printk(KERN_DEBUG + "[TouchKey] i2c read fail. do not excute firm update.\n"); + + input_unregister_device(input_dev); + touchkey_probe = false; + return -EBUSY; + } + ret = request_threaded_irq(tkey_i2c->irq, NULL, touchkey_interrupt, IRQF_DISABLED | IRQF_TRIGGER_FALLING | @@ -1751,13 +1769,6 @@ static int i2c_touchkey_probe(struct i2c_client *client, return -EBUSY; } -#ifdef CONFIG_HAS_EARLYSUSPEND - tkey_i2c->early_suspend.suspend = - (void *)sec_touchkey_early_suspend; - tkey_i2c->early_suspend.resume = - (void *)sec_touchkey_late_resume; - register_early_suspend(&tkey_i2c->early_suspend); -#endif tkey_i2c->pdata->led_power_on(1); @@ -1772,6 +1783,14 @@ static int i2c_touchkey_probe(struct i2c_client *client, } #endif +#ifdef CONFIG_HAS_EARLYSUSPEND + tkey_i2c->early_suspend.suspend = + (void *)sec_touchkey_early_suspend; + tkey_i2c->early_suspend.resume = + (void *)sec_touchkey_late_resume; + register_early_suspend(&tkey_i2c->early_suspend); +#endif + #if defined(TK_HAS_AUTOCAL) touchkey_autocalibration(tkey_i2c); #endif -- cgit v1.2.3