Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 91EE54582EC; Tue, 21 Jul 2026 20:58:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784667500; cv=none; b=GPj5ACStc0l3lkZfvQRpFSnvVd3Ou3azELKCz0oiqxt5hqR6fIBwUB7kHja7nwShqQRuWDB1I/uDUFwjp+xmUDUrw8IPcnHwaxbOm5tsUSYaNyu9R/aTjR5ggfWkStGYhrvl1ainv4NnETacrDdcqglZEtC/v2F8ghgHAGn4lv0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784667500; c=relaxed/simple; bh=oK+g7nHQCujNRIrxmeUI7fbAcdA88Bery77reQeNtjo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rJbu+UFLvm9sIYDkoUzx+MxAJwOJXho9tW77hHgDNB0O84sdvjtmih7E3prWTFiGLwllwjvGDDSRh1eUEvgvTw5bijq8Tmnw9tacADXiJLEaw3sUyxny7RY3PKsE17a54xLJGfaIGvSyZJm4aisR7iKRYPXgZS/qWT15NxaxshQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=SKZ0ddg0; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="SKZ0ddg0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97C8D1F00A3D; Tue, 21 Jul 2026 20:58:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784667485; bh=XjbE5f0mhai6Ovusv7Yw28sZSwgOgLyFU0pP/gZUt3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SKZ0ddg0e0pch3dbPTdqZOX1HmTMswhY5LeEOSjwXEp/Ipnguv1AhlbkDX80Wua1Y drEkI9uhwH07u6DH+nXOIdx4r5QsqY2OAaJP36XJlzDd07T9+BaTit8OQ2BDfV+FAm jk4LAlBGNFdHHjQPw09xrYabl49v97WiBUAfMahY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Linus Walleij , Andreas Kemnade , Bartosz Golaszewski Subject: [PATCH 6.6 1079/1266] gpios: palmas: add .get_direction() op Date: Tue, 21 Jul 2026 17:25:16 +0200 Message-ID: <20260721152505.958800468@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152441.786066624@linuxfoundation.org> References: <20260721152441.786066624@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andreas Kemnade commit db4a79713ed8e252d5e4edf6eaaa80948b6855a2 upstream. Accessing debug/gpio is quite noisy without a get_direction() implementation. To calm that down add an implementation. Fixes: 3d50a2785271 ("gpio: palmas: Add support for Palmas GPIO") Cc: stable@vger.kernel.org Reviewed-by: Linus Walleij Signed-off-by: Andreas Kemnade Link: https://patch.msgid.link/20260704-palmas-getdirection-v2-1-2fd85fee3832@kemnade.info Signed-off-by: Bartosz Golaszewski Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-palmas.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) --- a/drivers/gpio/gpio-palmas.c +++ b/drivers/gpio/gpio-palmas.c @@ -117,6 +117,24 @@ static int palmas_gpio_input(struct gpio return ret; } +static int palmas_gpio_get_direction(struct gpio_chip *gc, unsigned int offset) +{ + struct palmas_gpio *pg = gpiochip_get_data(gc); + struct palmas *palmas = pg->palmas; + unsigned int val; + unsigned int reg; + int ret; + int gpio16 = (offset/8); + + offset %= 8; + reg = (gpio16) ? PALMAS_GPIO_DATA_DIR2 : PALMAS_GPIO_DATA_DIR; + ret = palmas_read(palmas, PALMAS_GPIO_BASE, reg, &val); + if (ret) + return ret; + + return (val & BIT(offset)) ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN; +} + static int palmas_gpio_to_irq(struct gpio_chip *gc, unsigned offset) { struct palmas_gpio *pg = gpiochip_get_data(gc); @@ -165,6 +183,7 @@ static int palmas_gpio_probe(struct plat palmas_gpio->gpio_chip.can_sleep = true; palmas_gpio->gpio_chip.direction_input = palmas_gpio_input; palmas_gpio->gpio_chip.direction_output = palmas_gpio_output; + palmas_gpio->gpio_chip.get_direction = palmas_gpio_get_direction; palmas_gpio->gpio_chip.to_irq = palmas_gpio_to_irq; palmas_gpio->gpio_chip.set = palmas_gpio_set; palmas_gpio->gpio_chip.get = palmas_gpio_get;