From patchwork Sun Dec 12 22:40:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Merlijn Wajer X-Patchwork-Id: 523439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D8D2C433F5 for ; Sun, 12 Dec 2021 23:03:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230128AbhLLXDx (ORCPT ); Sun, 12 Dec 2021 18:03:53 -0500 Received: from mail.wizzup.org ([95.217.97.174]:44030 "EHLO wizzup.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230237AbhLLXDx (ORCPT ); Sun, 12 Dec 2021 18:03:53 -0500 X-Greylist: delayed 1753 seconds by postgrey-1.27 at vger.kernel.org; Sun, 12 Dec 2021 18:03:53 EST DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=wizzup.org; s=mail; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=HjeuObHTxT5SBm5noxlsZ0/REB/4irXmfOfjaJve7Wg=; b=VQ7jL4+uH6pIGb9SPySu3HP1eT fsX2I1R5z6YlAJqgPr5+sLvvtMYDvz8mA6EeehfWlUd0ljB10mPTu2IEWh4mi/JDRPbilYu1vRdet bTe2MItfSKb8Wt3tf5QpmtEcH3WnsAB4WLrw2GJmw/lfefWSNwb4/+CDNuk57GFScuWFRrONBg1cy LooAFXH/AyAvnNyfwsb1gn676yW/r5LO4/iqbz+C4X1ZK6Stpd6ZXFgmugVNzs5xfP/LWQsa7SBIO wQPGcb+HauQX7zEEe0OOEqw8y3P3jRIdLT8Ci6Uqh9cjLPomyiKYkePe9Pl2m3sDduxshtTnVvwyG 33ZcrYIA==; Received: from [45.83.235.159] (helo=gentoo-x13.fritz.box) by wizzup.org with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mwXQS-0001do-Kw; Sun, 12 Dec 2021 22:34:36 +0000 From: Merlijn Wajer To: merlijn@wizzup.org Cc: Ivaylo Dimitrov , Dev Null , Tony Lindgren , Sebastian Reichel , Pavel Machek , Doug Zobel , Jacek Anaszewski , Dan Murphy , Linus Walleij , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] leds: lp55xx: initialise output direction from dts Date: Sun, 12 Dec 2021 23:40:07 +0100 Message-Id: <20211212224007.10293-3-merlijn@wizzup.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211212224007.10293-1-merlijn@wizzup.org> References: <20211212224007.10293-1-merlijn@wizzup.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Commit a5d3d1adc95f ("leds: lp55xx: Initialize enable GPIO direction to output") attempts to fix this, but the fix did not work since at least for the Nokia N900 the value needs to be set to HIGH, per the device tree. So rather than hardcoding the value to a potentially invalid value for some devices, let's set direction in lp55xx_init_device. Fixes: a5d3d1adc95f ("leds: lp55xx: Initialize enable GPIO direction to output") Fixes: 92a81562e695 ("leds: lp55xx: Add multicolor framework support to lp55xx") Fixes: ac219bf3c9bd ("leds: lp55xx: Convert to use GPIO descriptors") Signed-off-by: Merlijn Wajer Reviewed-by: Linus Walleij --- drivers/leds/leds-lp55xx-common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c index d1657c46ee2f..9fdfc1b9a1a0 100644 --- a/drivers/leds/leds-lp55xx-common.c +++ b/drivers/leds/leds-lp55xx-common.c @@ -439,6 +439,8 @@ int lp55xx_init_device(struct lp55xx_chip *chip) return -EINVAL; if (pdata->enable_gpiod) { + gpiod_direction_output(pdata->enable_gpiod, 0); + gpiod_set_consumer_name(pdata->enable_gpiod, "LP55xx enable"); gpiod_set_value(pdata->enable_gpiod, 0); usleep_range(1000, 2000); /* Keep enable down at least 1ms */ @@ -694,7 +696,7 @@ struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev, of_property_read_u8(np, "clock-mode", &pdata->clock_mode); pdata->enable_gpiod = devm_gpiod_get_optional(dev, "enable", - GPIOD_OUT_LOW); + GPIOD_ASIS); if (IS_ERR(pdata->enable_gpiod)) return ERR_CAST(pdata->enable_gpiod);