From nobody Mon Apr 6 09:12:33 2026 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8CC5131195A for ; Sat, 21 Mar 2026 10:13:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774088009; cv=none; b=KU5yXiULRD0lbu6/Sg5pDRNlrICMiESnKEuXRQh9hyNfrcBzmdHgJ+LAeIqRX81f/b5rWg4p7kPxyU7DIbxfKKTHK1bBOoxgRJq64cmE8KCDPd5P9JPu0o01ov0tSE92G/iONP9sPUAwzIfqZq3xvR4cpgfaVpPcKW97QILyx+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774088009; c=relaxed/simple; bh=blBgOkHUL9k48ZZpbciZVcEdUpyrvvGFO5J2mFS0q94=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BxKGCnEzU6ClHMyxRDgzKNyw6nUxkwtb1+zacK4PYibGLdEIZQ49jumNUeGdOM3u31NDuY97IcqwRmbTBORxOoznnM0U6yTZYtWywoDQYnVl2v9ybLAGvuc7Bjdp/RJdROuyJ7BTYRRJlmHrlQOZ3g6oeQ8LeY7oPNUY8PA0PN4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=mDddJuj5; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mDddJuj5" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-48702d51cd0so9460545e9.2 for ; Sat, 21 Mar 2026 03:13:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1774088006; x=1774692806; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=z23TFsp1titUKTemBieWM6vBHqTe1wrTtIq9tf05puI=; b=mDddJuj5Rqjnk+4PiSRcwtD93OY7+LFUy9+kkV6Y6Lny6MzUS6F1JEVuUrHsXIPm+S Xx85M4iacozyYagQz7j3SQDrTYm0a43AUc1Qs4flkHIhaJv5VLXJi6ciSdfdjrHcTKeK Akixu0BPS5NEAnP2bfHk3ctVPR8xT2RiLPIz7pDAbadNmRsX4JwE0hXENbc9gf21lE1N 2mmTKzyOFpGAv0w2DI1UGW3vJ+b8i6PgX0V5TMz+KvaHNGqdwARBv87PUHeB098EGOfu 4ajv/y5Ff0KdKhoMc1WXr6YzB0mvpdmIQaPnwlCL4nus2hbSokSGHc+Jzluk29A7ZCgi J2BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774088006; x=1774692806; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z23TFsp1titUKTemBieWM6vBHqTe1wrTtIq9tf05puI=; b=JbgqGjOUcZ1LMTSqLhoGothoE5cpMTgyFxOanLhiE2bDQAUxwBwRXWhwpn+pYIu/nX B1xIuNEVSG1vk6tlPWGxrXjhcylLDTYZ6kcG1itE7WLjbM5QCI5VsIE8hBi07dGx1FFn wdWXCsVodntLTt11oatfyVcnQJzxq40fy63xEyQU2N4TF2zdbbdZKfAUmHJ9VSatgiql agK4IfLGp+FTNPcblJqTDAmmzjVSJUFID2itHK4MRLSmVp7Xxr8OCbNl3L4YvoaK7onG I6qJ2AP/cDhIvftE2/Jj/2VuV14c9HQ8f8BfNLwn8APWAXVS1+bh/fmnrXdSUsMPtPpQ r5rw== X-Forwarded-Encrypted: i=1; AJvYcCXAcLo13N7IqyVteK6CLM5w1CD5/tEftLgZO7JPpCodrW4ih3ePoIdGZpEJfSfeEMDnMcdDCYPkL3jdxok=@vger.kernel.org X-Gm-Message-State: AOJu0YxZEUsjjgfVNpDK5g6Cj9EGpEygSJDOfWSpTSGWv4H5YTHk46aQ Ld+nI2thZHv8DSuqSX0YybQpN1qFGINDTvQ5/fB7BDDqXgdb8xqJhqYgjmH+PllNzUh1rdbdKW7 aGWxq X-Gm-Gg: ATEYQzyFcKnWo3arksBffaCO8e2zUQuT5T63YxJzgt0cWuiG6PkZBdopEmIs2HKenqS Guy9WlZoIHwCGIAbIqS1V6K5pEp4TOkL+irvyvsQ3r2E69tYkbD+7V80DHZq56TrzMmAKtxJNld Dxkn7RgQD+32GJF3oYNxkMBWcuHlQQLduBHArLgO750cgqkf2u0oYYnd494xHHTmUcbFUy373Vm TdCa878p50GBu9u8QGXUHeAdeEuifQ5+HnIXeGK5uEbLYDE+LqhRphvGzFYjYwgt3AY5uCXwwpU DCglLPDvswus44f1QxfT0hW4YfS/F38qj0m3r1rQ38cqIwHuJQ2NKcuSpiMHD9vCL3zt2zMfzT1 V7IzTUzqjoQu/WwxqzoX+pVv+Uh5Fvf8nTY574HxqgYPCrwdZVbcnbBKtBcain04cbmNcJgzsak OspVEdQ5VBcxmp7S1gdPKH1OuH48gI X-Received: by 2002:a05:600c:4fc9:b0:485:2ce2:4c8a with SMTP id 5b1f17b1804b1-486fede737dmr87229225e9.1.1774088005338; Sat, 21 Mar 2026 03:13:25 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48705135631sm31669695e9.15.2026.03.21.03.13.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Mar 2026 03:13:24 -0700 (PDT) Date: Sat, 21 Mar 2026 13:13:22 +0300 From: Dan Carpenter To: Linus Walleij , AKASHI Takahiro Cc: Bartosz Golaszewski , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , arm-scmi@vger.kernel.org, Vincent Guittot , Khaled Ali Ahmed , Michal Simek Subject: [PATCH v5 1/7] pinctrl: introduce pinctrl_gpio_get_config() Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: AKASHI Takahiro This is a counterpart of pinctrl_gpio_set_config(), which will be used to implement the ->get() interface in a GPIO driver for SCMI. Signed-off-by: AKASHI Takahiro Signed-off-by: Dan Carpenter Reviewed-by: Linus Walleij Reviewed-by: Andy Shevchenko --- v5: No change v4: Fix kernel-doc (Andy). Add r-b tags v3: Forward port drivers/pinctrl/core.c | 31 +++++++++++++++++++++++++++++++ include/linux/pinctrl/consumer.h | 9 +++++++++ 2 files changed, 40 insertions(+) diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 2edc9bdad183..c471f3fbd035 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -30,6 +30,7 @@ #include #include #include +#include #include =20 #include "core.h" @@ -938,6 +939,36 @@ int pinctrl_gpio_set_config(struct gpio_chip *gc, unsi= gned int offset, } EXPORT_SYMBOL_GPL(pinctrl_gpio_set_config); =20 +/** + * pinctrl_gpio_get_config() - Get the config for a given GPIO pin + * @gc: GPIO chip structure from the GPIO subsystem + * @offset: hardware offset of the GPIO relative to the controller + * @config: the configuration to query. On success it holds the result + * Return: 0 on success, negative errno otherwise + */ +int pinctrl_gpio_get_config(struct gpio_chip *gc, unsigned int offset, uns= igned long *config) +{ + struct pinctrl_gpio_range *range; + struct pinctrl_dev *pctldev; + int ret, pin; + + ret =3D pinctrl_get_device_gpio_range(gc, offset, &pctldev, &range); + if (ret) + return ret; + + mutex_lock(&pctldev->mutex); + pin =3D gpio_to_pin(range, gc, offset); + ret =3D pin_config_get_for_pin(pctldev, pin, config); + mutex_unlock(&pctldev->mutex); + + if (ret) + return ret; + + *config =3D pinconf_to_config_argument(*config); + return 0; +} +EXPORT_SYMBOL_GPL(pinctrl_gpio_get_config); + static struct pinctrl_state *find_state(struct pinctrl *p, const char *name) { diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consu= mer.h index 63ce16191eb9..11b8f0b8da0c 100644 --- a/include/linux/pinctrl/consumer.h +++ b/include/linux/pinctrl/consumer.h @@ -35,6 +35,8 @@ int pinctrl_gpio_direction_output(struct gpio_chip *gc, unsigned int offset); int pinctrl_gpio_set_config(struct gpio_chip *gc, unsigned int offset, unsigned long config); +int pinctrl_gpio_get_config(struct gpio_chip *gc, unsigned int offset, + unsigned long *config); =20 struct pinctrl * __must_check pinctrl_get(struct device *dev); void pinctrl_put(struct pinctrl *p); @@ -101,6 +103,13 @@ pinctrl_gpio_direction_output(struct gpio_chip *gc, un= signed int offset) return 0; } =20 +static inline int +pinctrl_gpio_get_config(struct gpio_chip *gc, unsigned int offset, + unsigned long *config) +{ + return 0; +} + static inline int pinctrl_gpio_set_config(struct gpio_chip *gc, unsigned int offset, unsigned long config) --=20 2.51.0