From patchwork Fri Jan 13 10:35:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 9515005 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A6CAE601E5 for ; Fri, 13 Jan 2017 10:36:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E79B285E5 for ; Fri, 13 Jan 2017 10:36:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92A2628607; Fri, 13 Jan 2017 10:36:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A161285E5 for ; Fri, 13 Jan 2017 10:36:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751390AbdAMKgD (ORCPT ); Fri, 13 Jan 2017 05:36:03 -0500 Received: from lelnx193.ext.ti.com ([198.47.27.77]:34356 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751356AbdAMKgC (ORCPT ); Fri, 13 Jan 2017 05:36:02 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v0DAZuR2008427; Fri, 13 Jan 2017 04:35:56 -0600 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v0DAZu6R026245; Fri, 13 Jan 2017 04:35:56 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Fri, 13 Jan 2017 04:35:55 -0600 Received: from jadmar.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v0DAZpd1004480; Fri, 13 Jan 2017 04:35:53 -0600 From: Jyri Sarha To: , , CC: , , , , Jyri Sarha Subject: [PATCH v2 1/5] fbdev: ssd1307fb: Start to use gpiod API for reset gpio Date: Fri, 13 Jan 2017 12:35:45 +0200 Message-ID: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Start to use gpiod API for reset gpio. Signed-off-by: Jyri Sarha --- drivers/video/fbdev/ssd1307fb.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index 2925d5c..8ffaaee 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -73,7 +73,7 @@ struct ssd1307fb_par { u32 prechargep2; struct pwm_device *pwm; u32 pwm_period; - int reset; + struct gpio_desc *reset; u32 seg_remap; u32 vcomh; u32 width; @@ -561,10 +561,11 @@ static int ssd1307fb_probe(struct i2c_client *client, par->device_info = of_device_get_match_data(&client->dev); - par->reset = of_get_named_gpio(client->dev.of_node, - "reset-gpios", 0); - if (!gpio_is_valid(par->reset)) { - ret = -EINVAL; + par->reset = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(par->reset)) { + dev_err(&client->dev, "failed to get reset gpio: %ld\n", + PTR_ERR(par->reset)); + ret = PTR_ERR(par->reset); goto fb_alloc_error; } @@ -642,22 +643,12 @@ static int ssd1307fb_probe(struct i2c_client *client, fb_deferred_io_init(info); - ret = devm_gpio_request_one(&client->dev, par->reset, - GPIOF_OUT_INIT_HIGH, - "oled-reset"); - if (ret) { - dev_err(&client->dev, - "failed to request gpio %d: %d\n", - par->reset, ret); - goto reset_oled_error; - } - i2c_set_clientdata(client, info); /* Reset the screen */ - gpio_set_value(par->reset, 0); + gpiod_set_value(par->reset, 0); udelay(4); - gpio_set_value(par->reset, 1); + gpiod_set_value(par->reset, 1); udelay(4); ret = ssd1307fb_init(par);