Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp874193ybz; Fri, 17 Apr 2020 11:35:50 -0700 (PDT) X-Google-Smtp-Source: APiQypLQHgMJQo3nBfhXuINZZcq3aj/h7iijq6YAIDbx5d0M4vOtZ6houizFaNEgQu+BH1qwTrbg X-Received: by 2002:a05:6402:17c4:: with SMTP id s4mr4477630edy.348.1587148550706; Fri, 17 Apr 2020 11:35:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587148550; cv=none; d=google.com; s=arc-20160816; b=H7JhZE+3+/V/au4xQUNwpeO+wKW+oHcute2eM5d5RUoO2VwDPMjt/b2wPZj8LoHZ3t 9OtAFJe+T9ee45vtQpj5xstDl5JRX772z0iAEh8KUpxg/gw+o+M6QqT3YihlkshpzTES JreZboIRfLY0GYM7iVbKsMI2Yvmn4gcAdLqGLBaMVJUTmIKAyVdwFkHUL8dV8cKu0qbF OzFhIWen/7Z1nkHUYYmDtsWJPdJxNcxIlQuHjEFkegkKlFQeI9geMJSbUSq/VS2XhDRx m+eANH/veqsFL1XsnI3XdXjD0yxiZysKeaPNJJJmuq4DR8mGC8xxNPSLrg8a+THHfbqS nk5Q== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Bc/4pRlxC+D2ONP1rH1iDduXk9QWuQPhI7TtU7wZt5A=; b=crtE79eLgEapTsLZGVcUXzyENrAqZYJjyDYMltWAUFuW2SDD7r8iaTqp8QRjLzEgFH p5M3Z8desEMF/+8hKPMrCfr547AJtboAJhyy/F9EIN5lJJRDxW/tTzgczRTvBTOpE7eQ f3qKJ5ap8Lrk3bEzPt3z7qRJ6OZbZQt65Z+39m1R0YRP0Pn35KIVaMaxIBhkgzyrYeeH qie26q7R5yGIhhgNbM1kOzk+Ij8MW0aS4i6regASuPvzv2gznQP0sFfcfPaJ1Ejflbba /8R1QVZCXNxqYWNi8FC0Wh2MMn9BxgvUPoPIZUh8dwyYaLSNmXS7W1RG7eThFrXNSAoH oyxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=XGX0WSH5; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j22si47359ejm.490.2020.04.17.11.35.15; Fri, 17 Apr 2020 11:35:50 -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=@googlemail.com header.s=20161025 header.b=XGX0WSH5; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728650AbgDQSeJ (ORCPT + 99 others); Fri, 17 Apr 2020 14:34:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728158AbgDQSeH (ORCPT ); Fri, 17 Apr 2020 14:34:07 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F15BC061A0F; Fri, 17 Apr 2020 11:34:06 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id u13so4190744wrp.3; Fri, 17 Apr 2020 11:34:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Bc/4pRlxC+D2ONP1rH1iDduXk9QWuQPhI7TtU7wZt5A=; b=XGX0WSH5u91Vm9+oAwQwPXioSYI72fUAscUYc1Ykbw8DGjTGQQm37imIPumogvw6Bv C0H7R7Hme4YRD655b+hVV5mYfW5qHWenUYbbJFHaTRAWtWksydEuJWzWsD0UU/jIVihB gmxbjYR0Ky7EOt9UAcvcuGmzlcLTZ8OvkJO2a6r8GXf+G1gdaumQIhGPaQm0kvfwdOog 4XvsHGH5arT0hEEUZdg+MxYbyzquI0BxQWftDmB0y6OVYJAjbt2iPSlEZqZLso+9pyUS /O2nVDMxL5mjwqm1F62ucvLGLbZPtCd1wIXVq3SeKiRH90ChR3eypjiKngKoXUSCHMjN EJ5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Bc/4pRlxC+D2ONP1rH1iDduXk9QWuQPhI7TtU7wZt5A=; b=eJMq5IB/YJ2MoMe+6IIqhGlmAedv+UZzwmKAnPPqI6fkDn3Xg6RY0IIlF7eLZxL+Qd kpm+UYmACIUJNOMVahKZ90wNQk1ZV6ph7YR2f/VjQoFEcelLgusTefdXWfb8Ug7eD3ud VSud9meDBhNX19Ya5bndWKSaK4SmZEk+bZjohykpMPeDDDMWNG0kUZLWaIN4Xr+3DywY xnG1k2dFdQNXGnn0RQzZVieuHloF6yy5n/w4JqwgDh3Nn1mJkkPqcx/4TpDYesp1a5t1 xP19i7TrAVBXI/cujhm1Nn8ovpTcp0UWFLsqOjVJeqGIH74i28gsrmBXxDeb//hk2fjg HJ2Q== X-Gm-Message-State: AGi0PubIyZPuZjDpApy10EDhr6jqxu7aC2w8OMWHZt0XVFwn56vZ+LAZ py8vGpURRpZa8FJ7o3n4P0E= X-Received: by 2002:a5d:49c3:: with SMTP id t3mr4986564wrs.94.1587148444923; Fri, 17 Apr 2020 11:34:04 -0700 (PDT) Received: from localhost.localdomain (p200300F137142E00428D5CFFFEB99DB8.dip0.t-ipconnect.de. [2003:f1:3714:2e00:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id o7sm3074994wmh.46.2020.04.17.11.34.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Apr 2020 11:34:04 -0700 (PDT) From: Martin Blumenstingl To: linus.walleij@linaro.org, linux-gpio@vger.kernel.org, linux-amlogic@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jbrunet@baylibre.com, khilman@baylibre.com, Martin Blumenstingl Subject: [PATCH RESEND v2 1/2] pinctrl: meson: implement the gpio_chip get_direction callback Date: Fri, 17 Apr 2020 20:33:48 +0200 Message-Id: <20200417183349.1283092-2-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200417183349.1283092-1-martin.blumenstingl@googlemail.com> References: <20200417183349.1283092-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Implement the get_direction callback so we read the direction from the actual GPIO controller register. This is recommended by the gpio_chip kernel doc. Signed-off-by: Martin Blumenstingl --- drivers/pinctrl/meson/pinctrl-meson.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c index bbc919bef2bf..291f3078e7c7 100644 --- a/drivers/pinctrl/meson/pinctrl-meson.c +++ b/drivers/pinctrl/meson/pinctrl-meson.c @@ -549,6 +549,18 @@ static const struct pinconf_ops meson_pinconf_ops = { .is_generic = true, }; +static int meson_gpio_get_direction(struct gpio_chip *chip, unsigned gpio) +{ + struct meson_pinctrl *pc = gpiochip_get_data(chip); + int ret; + + ret = meson_pinconf_get_output(pc, gpio); + if (ret < 0) + return ret; + + return ret ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN; +} + static int meson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) { return meson_pinconf_set_output(gpiochip_get_data(chip), gpio, false); @@ -591,6 +603,7 @@ static int meson_gpiolib_register(struct meson_pinctrl *pc) pc->chip.parent = pc->dev; pc->chip.request = gpiochip_generic_request; pc->chip.free = gpiochip_generic_free; + pc->chip.get_direction = meson_gpio_get_direction; pc->chip.direction_input = meson_gpio_direction_input; pc->chip.direction_output = meson_gpio_direction_output; pc->chip.get = meson_gpio_get; -- 2.26.1