From patchwork Tue Jun 7 13:51:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 9161381 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 55DAB60467 for ; Tue, 7 Jun 2016 13:51:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4641322A2A for ; Tue, 7 Jun 2016 13:51:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B381269A3; Tue, 7 Jun 2016 13:51:49 +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 C04C62656B for ; Tue, 7 Jun 2016 13:51:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932375AbcFGNvd (ORCPT ); Tue, 7 Jun 2016 09:51:33 -0400 Received: from arroyo.ext.ti.com ([198.47.19.12]:48548 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932700AbcFGNvb (ORCPT ); Tue, 7 Jun 2016 09:51:31 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id u57DpPcF032227; Tue, 7 Jun 2016 08:51:25 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u57DpOhJ007797; Tue, 7 Jun 2016 08:51:25 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.294.0; Tue, 7 Jun 2016 08:51:25 -0500 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 u57DpKV8022457; Tue, 7 Jun 2016 08:51:23 -0500 From: Jyri Sarha To: , CC: , , , , Jyri Sarha Subject: [PATCH 1/3] fbdev: ssd1307fb: Start to use gpiod API for reset gpio Date: Tue, 7 Jun 2016 16:51:12 +0300 Message-ID: <160209d5bdcfc9d0821922e96eb1d0850f6a03a8.1465303439.git.jsarha@ti.com> 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 a9c45c8..b27912c 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; @@ -562,10 +562,11 @@ static int ssd1307fb_probe(struct i2c_client *client, par->device_info = (struct ssd1307fb_deviceinfo *)of_match_device( ssd1307fb_of_match, &client->dev)->data; - 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; } @@ -643,22 +644,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);