From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 823051E7C18 for ; Tue, 3 Feb 2026 23:48:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770162534; cv=none; b=XdmFW7KvdbxqiKHrd9FnmtiztcTPNQ7KdOh9ktWwPOQCXo2Zc6DIixeuiZELMvrVk6krfZpwqlbC0+sSPSx5wB3qHuhVopndX51sHvAuDCFBKW2vyWlsY1cLpZk085Rx5n43lBhAGR6PJYxOL8ENLgN4zy37R/tWJZ1/1h29z5I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770162534; c=relaxed/simple; bh=RoZBQLHQMfIYDSSaIRlnJlYv1lsg3TJFD7TrOnGjqko=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nvilOvJkG7VGX4R3NK+5gu8ckmUWGe+rqwrPv/Uk5FwRr2jnMyQxQIcyPEiIpkharP03wFilosUp4dJ0I0DR1tRp6uHW18Lv+QA0NAyr0fk3S7+/l3aeKowVPqoTsDXPsEQtzm2SkdFXSvBJsD68McOzMSSbxMQayuqjsi1ojN8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Nc3CY3uU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Nc3CY3uU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F4C9C116D0; Tue, 3 Feb 2026 23:48:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770162534; bh=RoZBQLHQMfIYDSSaIRlnJlYv1lsg3TJFD7TrOnGjqko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nc3CY3uUH7AafReTpBskntwG+PCCV71PC15vKuo4KI6lZwZNZ4LpEcTGH7xNL4DkC KYneCfFCqIO7aNHY8RMdv6Edd8dX+KVe136pUKznsHjWFY5Ccb45VmU07QRHIZ1FLH r7TefAeGlj9RarXLsVgd4KpUB6N8+aV8jRVhkTAKpHfQA/jiMDi83J/81k9fJuaALZ 4QeYjYcIDZdu5IOb6WlOS7JasrQNtkt4pO880F112Yw9+91XYUjM4/A8nWnD3tBoWm bFUWr0njlqtMgqnKCOdV4ZiiN9EZZvCIlNa2CQYmUF6xmEPvDv4WZFXOH2nR1dM614 cIwjpt3pSMlHw== From: Sasha Levin To: stable@vger.kernel.org Cc: Bartosz Golaszewski , Abel Vesa , Konrad Dybcio , Abel Vesa , Linus Walleij , Sasha Levin Subject: [PATCH 6.1.y] pinctrl: lpass-lpi: implement .get_direction() for the GPIO driver Date: Tue, 3 Feb 2026 18:48:50 -0500 Message-ID: <20260203234850.1453977-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2026020346-busily-dreaded-eb2c@gregkh> References: <2026020346-busily-dreaded-eb2c@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Bartosz Golaszewski [ Upstream commit 4f0d22ec60cee420125f4055af76caa0f373a3fe ] GPIO controller driver should typically implement the .get_direction() callback as GPIOLIB internals may try to use it to determine the state of a pin. Add it for the LPASS LPI driver. Reported-by: Abel Vesa Cc: stable@vger.kernel.org Fixes: 6e261d1090d6 ("pinctrl: qcom: Add sm8250 lpass lpi pinctrl driver") Signed-off-by: Bartosz Golaszewski Reviewed-by: Konrad Dybcio Tested-by: Konrad Dybcio # X1E CRD Tested-by: Abel Vesa Signed-off-by: Linus Walleij [ PIN_CONFIG_LEVEL => PIN_CONFIG_OUTPUT ] Signed-off-by: Sasha Levin --- drivers/pinctrl/qcom/pinctrl-lpass-lpi.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c index 35f46ca4cf9fc..c90bc60b3386c 100644 --- a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c +++ b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c @@ -248,6 +248,22 @@ static const struct pinconf_ops lpi_gpio_pinconf_ops = { .pin_config_group_set = lpi_config_set, }; +static int lpi_gpio_get_direction(struct gpio_chip *chip, unsigned int pin) +{ + unsigned long config = pinconf_to_config_packed(PIN_CONFIG_OUTPUT, 0); + struct lpi_pinctrl *state = gpiochip_get_data(chip); + unsigned long arg; + int ret; + + ret = lpi_config_get(state->ctrl, pin, &config); + if (ret) + return ret; + + arg = pinconf_to_config_argument(config); + + return arg ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN; +} + static int lpi_gpio_direction_input(struct gpio_chip *chip, unsigned int pin) { struct lpi_pinctrl *state = gpiochip_get_data(chip); @@ -346,6 +362,7 @@ static void lpi_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) #endif static const struct gpio_chip lpi_gpio_template = { + .get_direction = lpi_gpio_get_direction, .direction_input = lpi_gpio_direction_input, .direction_output = lpi_gpio_direction_output, .get = lpi_gpio_get, -- 2.51.0