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: 663406 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3sMhwQ42jfz9s9c for ; Mon, 29 Aug 2016 03:43:50 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755731AbcH1Rnb (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) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on gagarine.paulk.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 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-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org 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",