From patchwork Sun Aug 28 17:34:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 9302875 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 CC8936077C for ; Sun, 28 Aug 2016 17:43:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C542C287CE for ; Sun, 28 Aug 2016 17:43:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9FDD2881A; Sun, 28 Aug 2016 17:43:46 +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 5811C287CE for ; Sun, 28 Aug 2016 17:43:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755674AbcH1Rnb (ORCPT ); Sun, 28 Aug 2016 13:43:31 -0400 Received: from gagarine.paulk.fr ([109.190.93.129]:61152 "EHLO gagarine.paulk.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755716AbcH1Rm0 (ORCPT ); Sun, 28 Aug 2016 13:42:26 -0400 Received: by gagarine.paulk.fr (Postfix, from userid 65534) id 807FE2038A; Sun, 28 Aug 2016 19:34:58 +0200 (CEST) Received: from localhost.localdomain (collins [192.168.1.129]) by gagarine.paulk.fr (Postfix) with ESMTP id 4383C202EA; Sun, 28 Aug 2016 19:34:53 +0200 (CEST) From: Paul Kocialkowski To: linux-kernel@vger.kernel.org Cc: linux-tegra@vger.kernel.org, Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse , linux-pm@vger.kernel.org, Paul Kocialkowski Subject: [PATCH 1/2] power: bq24735-charger: Request status GPIO with initial input setup Date: Sun, 28 Aug 2016 19:34:45 +0200 Message-Id: <20160828173446.32728-1-contact@paulk.fr> X-Mailer: git-send-email 2.9.3 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This requests the status GPIO with initial input setup. it is required to read the GPIO status at probe time and thus correctly avoid sending i2c messages when AC is not plugged. When requesting the GPIO without initial input setup, it always reads 0 which causes probe to fail as it assumes the charger is connected, sends i2c messages and fails. Signed-off-by: Paul Kocialkowski --- drivers/power/bq24735-charger.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/power/bq24735-charger.c b/drivers/power/bq24735-charger.c index fa454c1..361a047 100644 --- a/drivers/power/bq24735-charger.c +++ b/drivers/power/bq24735-charger.c @@ -393,9 +393,9 @@ static int bq24735_charger_probe(struct i2c_client *client, i2c_set_clientdata(client, charger); if (gpio_is_valid(charger->pdata->status_gpio)) { - ret = devm_gpio_request(&client->dev, - charger->pdata->status_gpio, - name); + ret = devm_gpio_request_one(&client->dev, + charger->pdata->status_gpio, + GPIOF_IN, name); if (ret) { dev_err(&client->dev, "Failed GPIO request for GPIO %d: %d\n",