From patchwork Mon May 30 12:16:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1668 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:54:10 -0000 Delivered-To: patches@linaro.org Received: by 10.52.110.9 with SMTP id hw9cs235359vdb; Mon, 30 May 2011 05:19:53 -0700 (PDT) Received: by 10.213.27.204 with SMTP id j12mr853809ebc.48.1306757992483; Mon, 30 May 2011 05:19:52 -0700 (PDT) Received: from eu1sys200aog116.obsmtp.com (eu1sys200aog116.obsmtp.com [207.126.144.141]) by mx.google.com with SMTP id z15si6820063eej.72.2011.05.30.05.19.48 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 May 2011 05:19:52 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.141 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.141; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.141 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob116.postini.com ([207.126.147.11]) with SMTP ID DSNKTeOLZBkOecKGyw9ntBuvfxFNTiIU9oSt@postini.com; Mon, 30 May 2011 12:19:51 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id D80A0B3; Mon, 30 May 2011 12:16:56 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 9918994D; Mon, 30 May 2011 12:16:55 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id CA955A8083; Mon, 30 May 2011 14:16:49 +0200 (CEST) Received: from localhost.localdomain (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.3.83.0; Mon, 30 May 2011 14:16:54 +0200 From: Linus Walleij To: , Cc: Lee Jones , Naveen Kumar Gaddipati Subject: [PATCH] staging: synaptics: Implement error handling for rmi4 touch regulator Date: Mon, 30 May 2011 14:16:50 +0200 Message-ID: <1306757810-5291-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.3.2 MIME-Version: 1.0 From: Naveen Kumar Gaddipati Implement the error handling for regulator in synaptics rmi4 touch screen Signed-off-by: Naveen Kumar Gaddipati --- Somehow this patch has been lost and is pending in my local tree, so resending. The slowness of the "big" Synaptics driver to emerge gives me ideas about moving this to drivers/input :-P --- drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c | 43 +++++++++++------------- drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h | 2 - 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c index 3e68d58..36f4cb7 100644 --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c +++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c @@ -926,17 +926,19 @@ static int __devinit synaptics_rmi4_probe goto err_input; } - if (platformdata->regulator_en) { - rmi4_data->regulator = regulator_get(&client->dev, "vdd"); - if (IS_ERR(rmi4_data->regulator)) { - dev_err(&client->dev, "%s:get regulator failed\n", - __func__); - retval = PTR_ERR(rmi4_data->regulator); - goto err_regulator; - } - regulator_enable(rmi4_data->regulator); + rmi4_data->regulator = regulator_get(&client->dev, "vdd"); + if (IS_ERR(rmi4_data->regulator)) { + dev_err(&client->dev, "%s:get regulator failed\n", + __func__); + retval = PTR_ERR(rmi4_data->regulator); + goto err_get_regulator; + } + retval = regulator_enable(rmi4_data->regulator); + if (retval < 0) { + dev_err(&client->dev, "%s:regulator enable failed\n", + __func__); + goto err_regulator_enable; } - init_waitqueue_head(&rmi4_data->wait); /* * Copy i2c_client pointer into RTID's i2c_client pointer for @@ -1011,11 +1013,10 @@ static int __devinit synaptics_rmi4_probe err_free_irq: free_irq(platformdata->irq_number, rmi4_data); err_query_dev: - if (platformdata->regulator_en) { - regulator_disable(rmi4_data->regulator); - regulator_put(rmi4_data->regulator); - } -err_regulator: + regulator_disable(rmi4_data->regulator); +err_regulator_enable: + regulator_put(rmi4_data->regulator); +err_get_regulator: input_free_device(rmi4_data->input_dev); rmi4_data->input_dev = NULL; err_input: @@ -1039,10 +1040,8 @@ static int __devexit synaptics_rmi4_remove(struct i2c_client *client) wake_up(&rmi4_data->wait); free_irq(pdata->irq_number, rmi4_data); input_unregister_device(rmi4_data->input_dev); - if (pdata->regulator_en) { - regulator_disable(rmi4_data->regulator); - regulator_put(rmi4_data->regulator); - } + regulator_disable(rmi4_data->regulator); + regulator_put(rmi4_data->regulator); kfree(rmi4_data); return 0; @@ -1080,8 +1079,7 @@ static int synaptics_rmi4_suspend(struct device *dev) if (retval < 0) return retval; - if (pdata->regulator_en) - regulator_disable(rmi4_data->regulator); + regulator_disable(rmi4_data->regulator); return 0; } @@ -1099,8 +1097,7 @@ static int synaptics_rmi4_resume(struct device *dev) struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev); const struct synaptics_rmi4_platform_data *pdata = rmi4_data->board; - if (pdata->regulator_en) - regulator_enable(rmi4_data->regulator); + regulator_enable(rmi4_data->regulator); enable_irq(pdata->irq_number); rmi4_data->touch_stopped = false; diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h index 3686a2f..384436e 100644 --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h +++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h @@ -34,7 +34,6 @@ * @irq_type: irq type * @x flip: x flip flag * @y flip: y flip flag - * @regulator_en: regulator enable flag * * This structure gives platform data for rmi4. */ @@ -43,7 +42,6 @@ struct synaptics_rmi4_platform_data { int irq_type; bool x_flip; bool y_flip; - bool regulator_en; }; #endif