From nobody Sun Feb 8 00:49:23 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 36E3A35B159 for ; Fri, 9 Jan 2026 13:00:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767963611; cv=none; b=g8s96PDxFz0rZACe365UsxryISYK19PHVJdNR9J7sQbAU3UP6g1svV1L1Ir0FH5zxSo5NRLAh1sY2WLeWkbS4H4NIs6oigu6MFgVdyqcvyjv2SPIYn2rRm+Ge6Sa3lwjlIAA3Ruv8QU05KkxXmp9VcCDjASzJY/78JHQHLP8Rv0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767963611; c=relaxed/simple; bh=AoYSof07LJuwx9YwgPOZwudYeFwPsQuiF7zswpVp0FU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=G0gSWPs16xrNMGtYMrv29CHf4vkDdZFQMS2Qz8ZKAA2Q2w78fi5WSWoITrz0C9OpBWo+5c366bpMjFbAiM0QAvqtafXUhA/IX/7KLBfZhvtj1a0Spe/l1HuJSgw49EY7qJLUg7TcBFNQWMZsq27d+lIKd/i6A/YHNPBkBs8SdpI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=ADQ/1r3W; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=LxLNi40R; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="ADQ/1r3W"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="LxLNi40R" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 609CUCuh3542137 for ; Fri, 9 Jan 2026 13:00:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=qcppdkim1; bh=bLWZSG5D+HfIsLR/ch5F8xvfZM+jPpbhjuS a5UqrWj4=; b=ADQ/1r3Wy2Ioa9FKJrzXmXvQwZ2jyJxQNpKxxr668DYrMHxVbxA HpVKOOZKwKqjeXxi8t2sGjGi+POwhWEaTFBTGPGBGgj3KSiRwtTVTefcgYmHmcnU 1lh23qXN1PS1erk8bw0uaFLBVnYeP7Sze0z2QBO/kExFp47bOj2nXNZqObaGDdqM JzowP/0a6Pj6wDEw0wDOOxXoKkLgV+t8CtsBIo3sfaaPiz25F1iSzuDVRcYeHQf3 VMsOlaEP3ayVlOW9yhBVQnypb9GNCN+XmmMg+NrKOK5dpCPZgLfrXALBvzhG1g3J /hplhw0nSgXaFNXukG4hOhNf10ak+fDdQyA== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bju6b1anx-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 09 Jan 2026 13:00:07 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8b2194e266aso1034439085a.3 for ; Fri, 09 Jan 2026 05:00:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1767963606; x=1768568406; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=bLWZSG5D+HfIsLR/ch5F8xvfZM+jPpbhjuSa5UqrWj4=; b=LxLNi40RnuRRbvKpAXnzXfIsS7aHHm42WcmrdYtQ15QQmytlRJ3/ty5BDqPSad2bmF dwKHlDgC/NDwR7ItESiYTlvE9QTHwk9OH8MNPv5yrLI4U3Z0IcseF4rTlVLZvTwUV86u PYhWMoP6LQCd7r2c0cxxwk9e1J3UXIkFwZGGRjh8bZ73+zmRiopuiIieto4BwaWXe7YP lfFmMZKyJ5/cD0TIZGtcMb2RD0HdZ1CaG0C7vHYuM+ufgWSU9nepDflSHwP5hacURpgP TLRp5WsiWYAQ774h7BmU0SduvgACqxuR7RYAqcRxrvwCMnXQd6felKsiJXGWxAsPAWmQ RTrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767963606; x=1768568406; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=bLWZSG5D+HfIsLR/ch5F8xvfZM+jPpbhjuSa5UqrWj4=; b=qNo3g+rdAtXlO2JZ0xSBBlAdDkHwk4hlsKp1FGV2qv1YNqz/dKZTSnDYMn9Xv3Uvvr +9+Xl54cGcRhHXNhVV0sCb/gYqMFKZZSU/BzratGZZr8QypK2qU/ofTEr4imEcgxQ3YQ 27tJMrhNvVhaPC1rud56M462OmsG57YpET2bUNxiS2tbWaAf/K9hSuaxdtVBHLReyFzK pCahva0rVJyLlIyck3h37LSDwbqTFS9H1OljSuK16vJc/eOeMOHFYSPBnOwaIFBS9h+6 PocEWbNhWbad1Ac2REi9In3twWN2d9E8V7dKYdrMpmbp8KOSBi3oxdBMhZpBA/u/oO59 2SPw== X-Gm-Message-State: AOJu0YylCTj2I3wJDILvkdRligGd467ibOboL1eskWaC4HOXpEHdWE29 JbR5UqinMQ3RR2zn9VmKBvlf2kkxzSbzU9ccJPIySJoAdF5b+i+PXsVm2oClvegC6N9QPhlxEYL qcXSKbdXGvcZ9Nc2a/9/DctOPFqdKGDLX7UlGPkgNcdinEOYmyCw5sRJHDYQx6uUCQZw= X-Gm-Gg: AY/fxX53btCBmqAbCGf6/sODBwMQPfkqUTGqO78fz1954mQ91LJoeJQnJZ0ZGuxHpdR t/PFhcP22skFBsROfzlFLtOivif72jdCPhDKsksdZ2Hc5BQhCOyN+493m43iJoVu9OmTQD4J2/G PulRtxTM8kiv9cYUmSiShjySPtO0WQ7/NcK/vDWs1iOTLA6evJ6tcq+MOXLFVVKqpHbPA8HFXVY nUXY7gCQkW5qHCr+94uNvGDmjCbuYfACxDAIlwftQjL4IRAKkfRVEUtk1Z+j+Xsy496DrEtLRH3 a4dTVzQ1/AKiubREGYX4PUJzKLXeazcjLLbeNfLWlQqRheISg253WU16TPf7QgXAYwUYkAhiyow Gbhmti9iBDmW834rH2FmNnGj2QWGqEWivHIwJcg== X-Received: by 2002:a05:620a:2a01:b0:89e:f83c:ee0c with SMTP id af79cd13be357-8c389417b88mr1357497585a.74.1767963606346; Fri, 09 Jan 2026 05:00:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIgmf8j2GJD7tbApvV03PhCPHsk82hYfoXl1s/ES3AXfg4W8Dx3sel1eqkLhSsZQNVn/M/TA== X-Received: by 2002:a05:620a:2a01:b0:89e:f83c:ee0c with SMTP id af79cd13be357-8c389417b88mr1357488285a.74.1767963605466; Fri, 09 Jan 2026 05:00:05 -0800 (PST) Received: from brgl-qcom.home ([2a01:cb1d:dc:7e00:4b2e:be6e:9187:bb3c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd0860f5sm22098938f8f.0.2026.01.09.05.00.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jan 2026 05:00:05 -0800 (PST) From: Bartosz Golaszewski To: Linus Walleij , Bartosz Golaszewski Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Bartosz Golaszewski , Michael Walle Subject: [PATCH] gpio: davinci: implement .get_direction() Date: Fri, 9 Jan 2026 14:00:03 +0100 Message-ID: <20260109130003.25429-1-bartosz.golaszewski@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTA5MDA5NSBTYWx0ZWRfXzBfEUl2f12Tg aQUSusfL2exzVWDjjZOrueaZkSRJwMnwU5G5YZvOxNh0al+S24EtIEzG+/2niCdlK7qdqrYz3Y4 GMcHMtjBwP6poa9OYkLeitE2TglVjj8xAKkxIyHJYZ6FJkue7k4/ZKqEbfxxt5zDE+7bwL8RoIJ Ry9J5TuOhp7bSBe5mI4fqgwXLVhPWP5e871jvSGzIxc6b+3xfKr6zaXV1hftF0hvZXhIaGN7W1W 5hF8tdkd/8caFaYs7xheSzKHvwww3+qdTEGJ92oxq6LNIeelqB1TyhKWhnY6MwMdKGUQT4cSl9N 5RQidsEKyCxn4xzGWsX3yAystZJyWgrk7/Qe4nr+BZDMZZVMZ+dZpd/vT1sFnGtXWRL0WDfGdFn /UEUuGQcVR9GG+88qC43Jxv5J4ES2OuqIyGZlcqwZRtF9rQoPLLlwpMQGNI29Cud/jmo5HxTFW0 loqWgGFI/ODcvLyRnPg== X-Proofpoint-ORIG-GUID: 7QKs8xvVaTjxyk07mHUg6gdvnzoPvsdu X-Authority-Analysis: v=2.4 cv=V+5wEOni c=1 sm=1 tr=0 ts=6960fbd7 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=xqWC_Br6kY4A:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=fk1lIlRQAAAA:8 a=5SRzsYhri5PzZX4v2xYA:9 a=bTQJ7kPSJx9SKPbeHEYW:22 a=U75ogvRika4pmaD_UPO0:22 X-Proofpoint-GUID: 7QKs8xvVaTjxyk07mHUg6gdvnzoPvsdu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2026-01-09_04,2026-01-08_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 suspectscore=0 malwarescore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2601090095 Content-Type: text/plain; charset="utf-8" It's strongly recommended for GPIO drivers to always implement the .get_direction() callback - even for fixed-direction controllers. GPIO core will even emit a warning if the callback is missing, when users try to read the direction of a pin. Implement .get_direction() for gpio-davinci. Reported-by: Michael Walle Closes: https://lore.kernel.org/all/DFJAFK3DTBOZ.3G2P3A5IH34GF@kernel.org/ Signed-off-by: Bartosz Golaszewski Reviewed-by: Linus Walleij --- drivers/gpio/gpio-davinci.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c index 538f27209ce7..4604cda9a32c 100644 --- a/drivers/gpio/gpio-davinci.c +++ b/drivers/gpio/gpio-davinci.c @@ -6,6 +6,7 @@ * Copyright (c) 2007, MontaVista Software, Inc. */ =20 +#include #include #include #include @@ -109,6 +110,22 @@ davinci_direction_out(struct gpio_chip *chip, unsigned= offset, int value) return __davinci_direction(chip, offset, true, value); } =20 +static int davinci_get_direction(struct gpio_chip *chip, unsigned offset) +{ + struct davinci_gpio_controller *d =3D gpiochip_get_data(chip); + struct davinci_gpio_regs __iomem *g; + u32 mask =3D __gpio_mask(offset), val; + int bank =3D offset / 32; + + g =3D d->regs[bank]; + + guard(spinlock_irqsave)(&d->lock); + + val =3D readl_relaxed(&g->dir); + + return (val & mask) ? GPIO_LINE_DIRECTION_IN : GPIO_LINE_DIRECTION_OUT; +} + /* * Read the pin's value (works even if it's set up as output); * returns zero/nonzero. @@ -203,6 +220,7 @@ static int davinci_gpio_probe(struct platform_device *p= dev) chips->chip.get =3D davinci_gpio_get; chips->chip.direction_output =3D davinci_direction_out; chips->chip.set =3D davinci_gpio_set; + chips->chip.get_direction =3D davinci_get_direction; =20 chips->chip.ngpio =3D ngpio; chips->chip.base =3D -1; --=20 2.47.3