Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp651448ybz; Wed, 15 Apr 2020 15:59:45 -0700 (PDT) X-Google-Smtp-Source: APiQypK0FxG5bqJkjHbgjPlwfi4prln0DUf2sPdBpvkD1V6+J8NsyHnWI1hAzBZ1eI3i6VWVF+eh X-Received: by 2002:a50:de44:: with SMTP id a4mr27824077edl.56.1586991585657; Wed, 15 Apr 2020 15:59:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586991585; cv=none; d=google.com; s=arc-20160816; b=MaaeCPANj8Rfo43Bb1MIB1JOTHOLoIL6eXvS9fSEij4zAiDu/iiGmwORzaCtk9CTL7 oHf2Nk+GtLDwomim3mOeyRnApzcjliEF5d4NEwsEIaRNYmur6CmjLHDkjCaRtXKziurn 8LNUJ5ePo+W1ZfN3xALQhqAxGIKKODM2qV5ZVhxe6sPheZgNy1uR5h18dkB3mdfVvKjH jG5Kn/dbAEKUPAZP0G0+PtUCDsekmk/4gwbW1/PCRibwJ9xwcgeLcNSi/s0RTcPVm7jv nGFYfh9wLPmD45+wd/MIzPDhihVXlpKlSRLUxyXlqQ4tOuBS2aihm1WVU9q5kTdjaElM GaiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=GbGdUHCJ4bUoinaanEHZGPM2IWEohSovSXtISnti05A=; b=kFAh9mXqCpy3N9LtanJD4mucf32Uqg6I4iEUIDM9gk2FHKY0u+SDi5GdTZbPaa5G5p XJRu+ZeZx5koi/CB9UM3tCGxHT7tS8lXMfoVmoDxQVWc7rP+JYxnHHtnN6Y41K/MATsU XOrzXvp8huTmGnGi8tLnHWJhVnAYkI7t0sz4dAUyqaoSnRB05V91Nn2YwXC5EAk3vpUJ KUHyUa3a7SNNcXA+GUAMUwBAMZxCGgUqfGv5Wa97gHvYpUbqjbX/B7uotAm+A5y3dDrG 6TFBhaIhdbXK0zJtfNasQCASYCqDqInm/M1/w6KB0w5XaJJv6UDO9Qory9SKr7Tcg4FK djJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=bPsgUpYo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cf5si7372902ejb.171.2020.04.15.15.59.22; Wed, 15 Apr 2020 15:59:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=bPsgUpYo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2896930AbgDOLYY (ORCPT + 99 others); Wed, 15 Apr 2020 07:24:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2896920AbgDOLX4 (ORCPT ); Wed, 15 Apr 2020 07:23:56 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F030C061A0E for ; Wed, 15 Apr 2020 04:23:47 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id x66so16692636qkd.9 for ; Wed, 15 Apr 2020 04:23:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=GbGdUHCJ4bUoinaanEHZGPM2IWEohSovSXtISnti05A=; b=bPsgUpYoL9M6N2VPErmUCcpzn5u1MHE4amLphyBztAlEDYEc2BUT5APnZolsOpqgQo UElW/h+9W6/OQYq78v+wkrwkTScU3VFsegxOrjrBSro+NUqEKIL9G+6pWDHSz8WSnPnE obvD/n2FGftlzjcsOuPEV8TTSJVUDp3JG5nvbPN/zHFL8oQiNIhug82+p5i0veVBTiIv 52CYBawo5jbUJ8flFm+S6jB67a+hbEkBGGVG4hHAXYz0iGiKxtS+DkXCSSfFS2jSW37G DFojNU+UxX7TUk7szfPJBPAo6ijrC8QtQ0Z4PVPTkamQE2hqyBCYfxdWDSePkTzzJ7xh pzHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=GbGdUHCJ4bUoinaanEHZGPM2IWEohSovSXtISnti05A=; b=sgEesx7stljAKt4OESViOGSCboNcqgy+pr9sIMvcgzeVulEfYVCaDkrmfpJjeK2x+i U+lq9jA74z+0o9iT4rm+LbujXzgtI0RwndQajZNUkzw2G9WzWsmVXqxZrGwkL7AcLzYJ qQcXH6K93BzA5ap48EwxgqJtRD8XIfkKqA5BshxcqV6TiTzlWQ9vCMN5n6CZzTj60krS 4zrNffDl8I/evmSlEOr250VTZrcwzXyL+vpH1IQyrpFZq3T+zvZmRf4fThAvkbqrYbN3 1G58CXtGWpADMGlz/oDlkN7oHF5kgDGOGGM0xpuTICLI5TdfxTZOVSm9oyrDEEGGaF6g 8i4A== X-Gm-Message-State: AGi0PuapqBukgu//pQe3RzbpQQc61/sF0/8vpNwfFReGPwll3jX02IrZ sm2omXqPFl40E8ObqEQXF0Cpodoj5YTWijZLvZ0nuQ== X-Received: by 2002:a05:620a:1289:: with SMTP id w9mr10377990qki.263.1586949826538; Wed, 15 Apr 2020 04:23:46 -0700 (PDT) MIME-Version: 1.0 References: <20200412013352.674506-1-aford173@gmail.com> In-Reply-To: <20200412013352.674506-1-aford173@gmail.com> From: Bartosz Golaszewski Date: Wed, 15 Apr 2020 13:23:35 +0200 Message-ID: Subject: Re: [PATCH 1/2] gpiolib: of: Improve gpiolib-of support pull up/down on expanders To: Adam Ford Cc: linux-gpio , aford@beaconembedded.com, Linus Walleij , Thomas Petazzoni , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org niedz., 12 kwi 2020 o 03:34 Adam Ford napisa=C5=82(a): > > When using GPIO expanders attached to I2C ports, their set_config functio= n > needs to be passed a config setting which contains options to enable pull > up or pull down bias feature. In order to set this config properly, > the gpio parser needs to handle GPIO_PULL_UP and GPIO_PULL_DOWN. > > This patch enables the flags corresponding to GPIO_PULL_UP and > GPIO_PULL_DOWN. > > Signed-off-by: Adam Ford > > diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c > index c6d30f73df07..bf17afb1f66d 100644 > --- a/drivers/gpio/gpiolib-of.c > +++ b/drivers/gpio/gpiolib-of.c > @@ -344,6 +344,12 @@ struct gpio_desc *gpiod_get_from_of_node(struct devi= ce_node *node, > if (transitory) > lflags |=3D GPIO_TRANSITORY; > > + if (flags & OF_GPIO_PULL_UP) > + lflags |=3D GPIO_PULL_UP; > + > + if (flags & OF_GPIO_PULL_DOWN) > + lflags |=3D GPIO_PULL_DOWN; > + > ret =3D gpiod_configure_flags(desc, propname, lflags, dflags); > if (ret < 0) { > gpiod_put(desc); > @@ -585,6 +591,10 @@ static struct gpio_desc *of_parse_own_gpio(struct de= vice_node *np, > *lflags |=3D GPIO_ACTIVE_LOW; > if (xlate_flags & OF_GPIO_TRANSITORY) > *lflags |=3D GPIO_TRANSITORY; > + if (xlate_flags & OF_GPIO_PULL_UP) > + *lflags |=3D GPIO_PULL_UP; > + if (xlate_flags & OF_GPIO_PULL_DOWN) > + *lflags |=3D GPIO_PULL_DOWN; > > if (of_property_read_bool(np, "input")) > *dflags |=3D GPIOD_IN; > -- > 2.25.1 > Patch applied, thanks! Bart