Message ID | 20240211101421.166779-1-warthog618@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-60693-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1859053dyd; Sun, 11 Feb 2024 02:15:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXQtI4NENJ7wxRgLxsatYRPPBcT1Fm8Z6C6sI5VnsDRZ1B3h9a4M82ZaS/JodUSzepkTMurreIshr9KktXxu+Tug3E8Kw== X-Google-Smtp-Source: AGHT+IGHQ+2L3dXWZfBx9RPQjZ57AdIhHikrV3jF+MSwSFOsnbEhLXMy9+zZDNDuNMqdhdz18ozR X-Received: by 2002:a17:906:6c89:b0:a3c:5766:58df with SMTP id s9-20020a1709066c8900b00a3c576658dfmr1138673ejr.6.1707646512195; Sun, 11 Feb 2024 02:15:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707646512; cv=pass; d=google.com; s=arc-20160816; b=MZuwX2/soDCa/1Hg4N2FCkt5gY5Wf4IRVxFCqAte6X3osgsdVgojR1aIpAe+68IbCg OqRpSMo423bCGsN9qK/VhZJj7n1Vv5Td7c58lMedFCisZZbXajXggDHgOj5gsM4RXn15 DTh9hqDhHsKHMf+qheAeBGQK2cyFgErQTFLpeSrce0Ss0W9w66EeyNDxg8j5IMAhUDb8 sF3TmujIygZFebjhWGG2DV4Gp6IOQri4HbtWMKTa/NJQQcWRKd8aZULICFG7Gam3vrJo bMkzdTg0fAJeWSEqgLiDbqOp/15Oe8dWYLrx1p8oUpi1INuRYLTp+bl30ggiHCbKs6RT namQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=Blc6hLuk1jJGYRb9CW+5BR8z1UC6d8gl1Uq+cUruLp8=; fh=I0eVxwT7kvcyqsotnnB0VItrYf2e2725xfVxqjzvQh4=; b=ugSBEjRbP6TXGowBYgd+FTGhKJ7UcwrnaXvKhV3T0D2SeoYnqg1DHZufwI23xDnBtG qEceRaS5sBiBLpAuC2wKSy5JU5tPwymbVji3afjD+sq04e7Bc8dWwxWGc6mTLDlcffOJ eBmBjgJTzhzWcLn8krWH6uFTHVBDFf7MRnJeuQwGudjywxqM5cC4JSJjDEDFmngvNySA gZS+DHlER+hSyQroNfX/RvdQZ9fp6fCX5d+PmddSZ2H2ajL1jYOxXNtWr3iMyEp54QL1 X5m46o/J5nTmS1ZUYkwxG4/uaFlr3Ar0N8zz3XyJRGyw7ILgrK27BbgtYy8XZvKlT0N7 eGbA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QV1O5a4E; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60693-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60693-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCU7XRC61mmShO4a5VnsaFyGG8tWiGIaca2IQOMpz8GfOTD5U21wKiIvSepdJvVMoD4bPOhrj+MID1TY3fPYmYcVKO/YVA== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a23-20020a1709066d5700b00a3c5f12d1c5si778845ejt.266.2024.02.11.02.15.12 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 02:15:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60693-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QV1O5a4E; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-60693-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60693-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CA0BF1F2295F for <ouuuleilei@gmail.com>; Sun, 11 Feb 2024 10:15:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B6915A108; Sun, 11 Feb 2024 10:14:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QV1O5a4E" Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (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 3D56459B40; Sun, 11 Feb 2024 10:14:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707646493; cv=none; b=a/+48eJ7OSdmvf8iYKadASmv6jzftN8n4n+LieMJF3y8trUh0gwWrfuqEUWblqqR1OT2lSdHCCWiq0xk00mppp/ZHqz9leJle9DPYLMWXk5JF6YooBZQlP1sgtB2rFmgDKvG6vp/Ah+UAFIjkFarJS+IKxVjgWPN6S2itBrl5iQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707646493; c=relaxed/simple; bh=5HxlEksVyEjp5vwu1YWeFpsI9Pu5L4mnVbXPjNxQXSI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=QHu89p+9oFFO8J4BdK6Wpcte9RwrithoxbHlJ0lXQYR9UexI05iFWAqIyTuMY/FSNENCuLeNoZx0RBjWHmmTq3qXMIajr2FLtpbgwi5qlpYB30UPUX0Xzh63ozmnHg9JlhkwmfzSOksB2EFTnH0WdvntvMjzx89NDsz4YqVwN6E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QV1O5a4E; arc=none smtp.client-ip=209.85.215.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-53fbf2c42bfso1766550a12.3; Sun, 11 Feb 2024 02:14:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707646491; x=1708251291; 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=Blc6hLuk1jJGYRb9CW+5BR8z1UC6d8gl1Uq+cUruLp8=; b=QV1O5a4Ee4SIW2+j2kVK5kliRGFZgJj7b8IG8qqsqp+zPZlaleGSqk2++vlsDcNbpF qVyYC4LE5kABA69JU0mxbBw+YPlVNOI7A3ufNq0E4m2SSAZlq4yU28YGkEKcSa0ktrR3 3qq8ZKX9XW2Mqpwp9ssHPGVlNMGxb86gnbwlGyPaCuSZtsr9OsQRgEtCqB2uJ9I0+JAO WRysEhP44/KCYop8K8eDH/le4GQuFSDf8J3Oe2dyLa8baFHxUE0MyaeVJK3VE8fTvms5 zvsZ1+XKiXv6LleeOgEjCJPDqsBCB+9L9u8zYk6d3+cubGB5OYgQ1fpyE/kjrMzrO3lm w9AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707646491; x=1708251291; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Blc6hLuk1jJGYRb9CW+5BR8z1UC6d8gl1Uq+cUruLp8=; b=nMGSNgLdzo0O5Iu8ZJl/3NDeq7y1STWDcA92qJgbM4oXnbC1mjuiuUcilYQ3zsYIiS lV4TbYAVFlTMHN1IHeM34g5whYhKFrpX8J3GZZ9x1CWVDLX61w5BDq4/3E0gRlDwTvhF l0mrH74wFOsvGbAp8klYb20PlzbzJ+vCjTLpH1NYvpI/OVe3IVN0gPzuYSKqBY1U/RHJ vxq52Pr4oi4dWsdBzpDCJNR7WZXVcI1Esa2GRN+BrQGWTBMcdiPYM1RXp68/+HNwYB9S DTjh5eYVFXGUst1s6+B2C3At3lP01iEgLmS93LY/po5qsHiJlzJghibhtPeUW+/aY2zw Hp9g== X-Forwarded-Encrypted: i=1; AJvYcCUlmE55MLUyYLnd+Bb335Qbsuqga9wrnEejHwEMKfhAifRGLs8uiTrTyN2BQN3hH9rPjFY0zaH+5ADmJfZuCBAKfW8gHRJdM0USLg== X-Gm-Message-State: AOJu0YwQrVPHI9Z16UcJwbnHg1OImC8F8Id+6IZAJARZUFvZ+MRNcIZf xJy7kHO/GlKy35M6snwfi1ANX8vGpVgBT4s6aIIPVl4o15uOD+OioYWlw1VE X-Received: by 2002:a05:6a21:9188:b0:19e:8b31:f1ae with SMTP id tp8-20020a056a21918800b0019e8b31f1aemr6804727pzb.29.1707646491257; Sun, 11 Feb 2024 02:14:51 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWCx+RIFOebjwfywA0OkLnpAhcJ1BFPAb+3VGchp0s+0NSim3fyKZKJFc1Lu7pxbyc87ffxWxRHPw+utCuqmQh41uKn1/o/siHifU9XMiAvmnEYVd6XsBhyiel4yjYMpyLXMA4V3i2t/xYMYOWmIIkj9Wqi/7KC5TljkqcF8+pmVOWzA0g= Received: from rigel.home.arpa ([220.235.35.85]) by smtp.gmail.com with ESMTPSA id y23-20020aa78557000000b006e09ec69d7dsm3184009pfn.98.2024.02.11.02.14.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 02:14:50 -0800 (PST) From: Kent Gibson <warthog618@gmail.com> To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, brgl@bgdev.pl, linus.walleij@linaro.org, andy@kernel.org Cc: Kent Gibson <warthog618@gmail.com> Subject: [PATCH] gpio: uapi: clarify default_values being logical Date: Sun, 11 Feb 2024 18:14:21 +0800 Message-Id: <20240211101421.166779-1-warthog618@gmail.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790597149283619801 X-GMAIL-MSGID: 1790597149283619801 |
Series |
gpio: uapi: clarify default_values being logical
|
|
Commit Message
Kent Gibson
Feb. 11, 2024, 10:14 a.m. UTC
The documentation for default_values mentions high/low which can be
confusing, particularly when the ACTIVE_LOW flag is set.
Replace high/low with active/inactive to clarify that the values are
logical not physical.
Similarly, clarify the interpretation of values in struct gpiohandle_data.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
---
include/uapi/linux/gpio.h | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
Comments
On Sun, Feb 11, 2024 at 12:14 PM Kent Gibson <warthog618@gmail.com> wrote: > > The documentation for default_values mentions high/low which can be > confusing, particularly when the ACTIVE_LOW flag is set. > > Replace high/low with active/inactive to clarify that the values are > logical not physical. > > Similarly, clarify the interpretation of values in struct gpiohandle_data. I'm not against this particular change, but I want the entire GPIO documentation to be aligned in the terminology aspect. Is this the case after this patch? I.o.w. have we replaced all leftovers?
On Sun, Feb 11, 2024 at 06:58:14PM +0200, Andy Shevchenko wrote: > On Sun, Feb 11, 2024 at 12:14 PM Kent Gibson <warthog618@gmail.com> wrote: > > > > The documentation for default_values mentions high/low which can be > > confusing, particularly when the ACTIVE_LOW flag is set. > > > > Replace high/low with active/inactive to clarify that the values are > > logical not physical. > > > > Similarly, clarify the interpretation of values in struct gpiohandle_data. > > I'm not against this particular change, but I want the entire GPIO > documentation to be aligned in the terminology aspect. Is this the > case after this patch? I.o.w. have we replaced all leftovers? > Agreed. Those are the last remnants of the low/high terminolgy that I am aware of, certainly the last in gpio.h. Having a closer look to double check... Ah - it is still used in Documentation/userspace-api/gpio/sysfs.rst - not somewhere I go very often. Would you like that updated in a separate patch? Cheers, Kent.
On Mon, Feb 12, 2024 at 1:13 AM Kent Gibson <warthog618@gmail.com> wrote: > On Sun, Feb 11, 2024 at 06:58:14PM +0200, Andy Shevchenko wrote: > > On Sun, Feb 11, 2024 at 12:14 PM Kent Gibson <warthog618@gmail.com> wrote: > > > > > > The documentation for default_values mentions high/low which can be > > > confusing, particularly when the ACTIVE_LOW flag is set. > > > > > > Replace high/low with active/inactive to clarify that the values are > > > logical not physical. > > > > > > Similarly, clarify the interpretation of values in struct gpiohandle_data. > > > > I'm not against this particular change, but I want the entire GPIO > > documentation to be aligned in the terminology aspect. Is this the > > case after this patch? I.o.w. have we replaced all leftovers? > > Agreed. Those are the last remnants of the low/high terminolgy that I am > aware of, certainly the last in gpio.h. > > Having a closer look to double check... > > Ah - it is still used in Documentation/userspace-api/gpio/sysfs.rst - > not somewhere I go very often. > Would you like that updated in a separate patch? Yes, please. For this one Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
On Mon, Feb 12, 2024 at 11:28 AM Andy Shevchenko <andy.shevchenko@gmail.com> wrote: > > On Mon, Feb 12, 2024 at 1:13 AM Kent Gibson <warthog618@gmail.com> wrote: > > On Sun, Feb 11, 2024 at 06:58:14PM +0200, Andy Shevchenko wrote: > > > On Sun, Feb 11, 2024 at 12:14 PM Kent Gibson <warthog618@gmail.com> wrote: > > > > > > > > The documentation for default_values mentions high/low which can be > > > > confusing, particularly when the ACTIVE_LOW flag is set. > > > > > > > > Replace high/low with active/inactive to clarify that the values are > > > > logical not physical. > > > > > > > > Similarly, clarify the interpretation of values in struct gpiohandle_data. > > > > > > I'm not against this particular change, but I want the entire GPIO > > > documentation to be aligned in the terminology aspect. Is this the > > > case after this patch? I.o.w. have we replaced all leftovers? > > > > Agreed. Those are the last remnants of the low/high terminolgy that I am > > aware of, certainly the last in gpio.h. > > > > Having a closer look to double check... > > > > Ah - it is still used in Documentation/userspace-api/gpio/sysfs.rst - > > not somewhere I go very often. > > Would you like that updated in a separate patch? > > Yes, please. For this one > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Also "The values are boolean, zero for low, nonzero for high." https://docs.kernel.org/driver-api/gpio/consumer.html And there as well "With this, all the gpiod_set_(array)_value_xxx() functions interpret the parameter "value" as "asserted" ("1") or "de-asserted" ("0")." So, should we use asserted-deasserted? On https://docs.kernel.org/driver-api/gpio/ "get returns value for signal "offset", 0=low, 1=high, or negative error .. reg_set output set register (out=high) for generic GPIO reg_clr output clear register (out=low) for generic GPIO" (Not sure about the last two, though) https://docs.kernel.org/driver-api/gpio/intro.html "Output values are writable (high=1, low=0)." A-ha, here is the section about this: https://docs.kernel.org/driver-api/gpio/intro.html#active-high-and-active-low. On https://docs.kernel.org/driver-api/gpio/drivers-on-gpio.html "ledtrig-gpio: drivers/leds/trigger/ledtrig-gpio.c will provide a LED trigger, i.e. a LED will turn on/off in response to a GPIO line going high or low (and that LED may in turn use the leds-gpio as per above)." So, can you re-read all of it for high/low asserted/deasserted, active/inactive and amend accordingly?
On Mon, Feb 12, 2024 at 11:44:02AM +0200, Andy Shevchenko wrote: > On Mon, Feb 12, 2024 at 11:28 AM Andy Shevchenko > <andy.shevchenko@gmail.com> wrote: > > > > On Mon, Feb 12, 2024 at 1:13 AM Kent Gibson <warthog618@gmail.com> wrote: > > > On Sun, Feb 11, 2024 at 06:58:14PM +0200, Andy Shevchenko wrote: > > > > On Sun, Feb 11, 2024 at 12:14 PM Kent Gibson <warthog618@gmail.com> wrote: > > > > > > > > > > The documentation for default_values mentions high/low which can be > > > > > confusing, particularly when the ACTIVE_LOW flag is set. > > > > > > > > > > Replace high/low with active/inactive to clarify that the values are > > > > > logical not physical. > > > > > > > > > > Similarly, clarify the interpretation of values in struct gpiohandle_data. > > > > > > > > I'm not against this particular change, but I want the entire GPIO > > > > documentation to be aligned in the terminology aspect. Is this the > > > > case after this patch? I.o.w. have we replaced all leftovers? > > > > > > Agreed. Those are the last remnants of the low/high terminolgy that I am > > > aware of, certainly the last in gpio.h. > > > > > > Having a closer look to double check... > > > > > > Ah - it is still used in Documentation/userspace-api/gpio/sysfs.rst - > > > not somewhere I go very often. > > > Would you like that updated in a separate patch? > > > > Yes, please. For this one > > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> > > Also > "The values are boolean, zero for low, nonzero for high." > https://docs.kernel.org/driver-api/gpio/consumer.html > > And there as well > "With this, all the gpiod_set_(array)_value_xxx() functions interpret > the parameter "value" as "asserted" ("1") or "de-asserted" ("0")." > So, should we use asserted-deasserted? > > > On https://docs.kernel.org/driver-api/gpio/ > "get > returns value for signal "offset", 0=low, 1=high, or negative error > > ... > > reg_set > output set register (out=high) for generic GPIO > > reg_clr > output clear register (out=low) for generic GPIO" > (Not sure about the last two, though) > > https://docs.kernel.org/driver-api/gpio/intro.html > "Output values are writable (high=1, low=0)." > > > A-ha, here is the section about this: > https://docs.kernel.org/driver-api/gpio/intro.html#active-high-and-active-low. > > > On https://docs.kernel.org/driver-api/gpio/drivers-on-gpio.html > "ledtrig-gpio: drivers/leds/trigger/ledtrig-gpio.c will provide a LED > trigger, i.e. a LED will turn on/off in response to a GPIO line going > high or low (and that LED may in turn use the leds-gpio as per > above)." > > So, can you re-read all of it for high/low asserted/deasserted, > active/inactive and amend accordingly? > Well that got out of control quickly - I was only considering userspace documentation, not internals nor code comments. So, no, not today. Looks like you've got the internals covered though. Cheers, Kent.
On Mon, Feb 12, 2024 at 05:56:07PM +0800, Kent Gibson wrote: > On Mon, Feb 12, 2024 at 11:44:02AM +0200, Andy Shevchenko wrote: > > On Mon, Feb 12, 2024 at 11:28 AM Andy Shevchenko > > <andy.shevchenko@gmail.com> wrote: > > > > > > On Mon, Feb 12, 2024 at 1:13 AM Kent Gibson <warthog618@gmail.com> wrote: > > > > On Sun, Feb 11, 2024 at 06:58:14PM +0200, Andy Shevchenko wrote: > > > > > On Sun, Feb 11, 2024 at 12:14 PM Kent Gibson <warthog618@gmail.com> wrote: > > > > > > > > > > > > The documentation for default_values mentions high/low which can be > > > > > > confusing, particularly when the ACTIVE_LOW flag is set. > > > > > > > > > > > > Replace high/low with active/inactive to clarify that the values are > > > > > > logical not physical. > > > > > > > > > > > > Similarly, clarify the interpretation of values in struct gpiohandle_data. > > > > > > > > > > I'm not against this particular change, but I want the entire GPIO > > > > > documentation to be aligned in the terminology aspect. Is this the > > > > > case after this patch? I.o.w. have we replaced all leftovers? > > > > > > > > Agreed. Those are the last remnants of the low/high terminolgy that I am > > > > aware of, certainly the last in gpio.h. > > > > > > > > Having a closer look to double check... > > > > > > > > Ah - it is still used in Documentation/userspace-api/gpio/sysfs.rst - > > > > not somewhere I go very often. > > > > Would you like that updated in a separate patch? > > > > > > Yes, please. For this one > > > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> > > In response after re-reading these docs: > > Also > > "The values are boolean, zero for low, nonzero for high." > > https://docs.kernel.org/driver-api/gpio/consumer.html > > That one is logical and should be changed. > > And there as well > > "With this, all the gpiod_set_(array)_value_xxx() functions interpret > > the parameter "value" as "asserted" ("1") or "de-asserted" ("0")." > > So, should we use asserted-deasserted? > > We should use active/inactive rather than asserted/de-asserted. This is the only place that terminology is used - which is ironic as it is this section (_active_low_semantics) that explicitly describes the physical/logical mapping. > > > > On https://docs.kernel.org/driver-api/gpio/ > > "get > > returns value for signal "offset", 0=low, 1=high, or negative error > > > > ... The struct gpio_chip interface is physical, not logical - the active low conversion is handled in gpiolib, so this (driver.h) is correct as is. > > > > reg_set > > output set register (out=high) for generic GPIO > > > > reg_clr > > output clear register (out=low) for generic GPIO" > > (Not sure about the last two, though) > > > > https://docs.kernel.org/driver-api/gpio/intro.html > > "Output values are writable (high=1, low=0)." > > I read that to be physical values, so good as is. > > > > A-ha, here is the section about this: > > https://docs.kernel.org/driver-api/gpio/intro.html#active-high-and-active-low. > > > > > > On https://docs.kernel.org/driver-api/gpio/drivers-on-gpio.html > > "ledtrig-gpio: drivers/leds/trigger/ledtrig-gpio.c will provide a LED > > trigger, i.e. a LED will turn on/off in response to a GPIO line going > > high or low (and that LED may in turn use the leds-gpio as per > > above)." > > Ditto - physical values. > > So, can you re-read all of it for high/low asserted/deasserted, > > active/inactive and amend accordingly? > > > So, from these, consumer.rst is the only file requiring any change. I'll submit a patch for that shortly. Cheers, Kent.
On Tue, Feb 13, 2024 at 12:34 PM Kent Gibson <warthog618@gmail.com> wrote: > On Mon, Feb 12, 2024 at 05:56:07PM +0800, Kent Gibson wrote: > > On Mon, Feb 12, 2024 at 11:44:02AM +0200, Andy Shevchenko wrote: > > > On Mon, Feb 12, 2024 at 11:28 AM Andy Shevchenko > > > <andy.shevchenko@gmail.com> wrote: .. > In response after re-reading these docs: > > > > Also > > > "The values are boolean, zero for low, nonzero for high." > > > https://docs.kernel.org/driver-api/gpio/consumer.html > > That one is logical and should be changed. > > > > And there as well > > > "With this, all the gpiod_set_(array)_value_xxx() functions interpret > > > the parameter "value" as "asserted" ("1") or "de-asserted" ("0")." > > > So, should we use asserted-deasserted? > > We should use active/inactive rather than asserted/de-asserted. This is > the only place that terminology is used - which is ironic as it is this > section (_active_low_semantics) that explicitly describes the > physical/logical mapping. .. > > > So, can you re-read all of it for high/low asserted/deasserted, > > > active/inactive and amend accordingly? > > So, from these, consumer.rst is the only file requiring any change. > I'll submit a patch for that shortly. Thanks for taking care of this!
On Sun, Feb 11, 2024 at 11:14 AM Kent Gibson <warthog618@gmail.com> wrote: > The documentation for default_values mentions high/low which can be > confusing, particularly when the ACTIVE_LOW flag is set. > > Replace high/low with active/inactive to clarify that the values are > logical not physical. > > Similarly, clarify the interpretation of values in struct gpiohandle_data. > > Signed-off-by: Kent Gibson <warthog618@gmail.com> After the fixes pointed out by others: Acked-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij
On Sun, Feb 11, 2024 at 06:14:21PM +0800, Kent Gibson wrote: > The documentation for default_values mentions high/low which can be > confusing, particularly when the ACTIVE_LOW flag is set. > > Replace high/low with active/inactive to clarify that the values are > logical not physical. > > Similarly, clarify the interpretation of values in struct gpiohandle_data. > > Signed-off-by: Kent Gibson <warthog618@gmail.com> Just checking where we are at with this patch, given you've merged the two documentation patches that followed on from it. I realize you have bigger fish to fry at the moment, so sorry for any distraction, but I just want to ensure there isn't something you are expecting from me or it hasn't fallen through the cracks. Cheers, Kent.
On Thu, Feb 15, 2024 at 2:07 AM Kent Gibson <warthog618@gmail.com> wrote: > > On Sun, Feb 11, 2024 at 06:14:21PM +0800, Kent Gibson wrote: > > The documentation for default_values mentions high/low which can be > > confusing, particularly when the ACTIVE_LOW flag is set. > > > > Replace high/low with active/inactive to clarify that the values are > > logical not physical. > > > > Similarly, clarify the interpretation of values in struct gpiohandle_data. > > > > Signed-off-by: Kent Gibson <warthog618@gmail.com> > > Just checking where we are at with this patch, given you've merged the > two documentation patches that followed on from it. > > I realize you have bigger fish to fry at the moment, so sorry for any > distraction, but I just want to ensure there isn't something you are > expecting from me or it hasn't fallen through the cracks. > > Cheers, > Kent. Now queued. I had skimmed through the discussion and was under the impression that you'll be sending a v2 of this one, sorry. Bart
diff --git a/include/uapi/linux/gpio.h b/include/uapi/linux/gpio.h index 103cd3c6c81e..f7cb8ae87df7 100644 --- a/include/uapi/linux/gpio.h +++ b/include/uapi/linux/gpio.h @@ -399,8 +399,8 @@ struct gpioline_info_changed { * a batch of input or output lines, but they must all have the same * characteristics, i.e. all inputs or all outputs, all active low etc * @default_values: if the %GPIOHANDLE_REQUEST_OUTPUT is set for a requested - * line, this specifies the default output value, should be 0 (low) or - * 1 (high), anything else than 0 or 1 will be interpreted as 1 (high) + * line, this specifies the default output value, should be 0 (inactive) or + * 1 (active). Anything other than 0 or 1 will be interpreted as active. * @consumer_label: a desired consumer label for the selected GPIO line(s) * such as "my-bitbanged-relay" * @lines: number of lines requested in this request, i.e. the number of @@ -426,8 +426,8 @@ struct gpiohandle_request { * %GPIOHANDLE_REQUEST_OUTPUT, %GPIOHANDLE_REQUEST_ACTIVE_LOW etc, added * together * @default_values: if the %GPIOHANDLE_REQUEST_OUTPUT is set in flags, - * this specifies the default output value, should be 0 (low) or - * 1 (high), anything else than 0 or 1 will be interpreted as 1 (high) + * this specifies the default output value, should be 0 (inactive) or + * 1 (active). Anything other than 0 or 1 will be interpreted as active. * @padding: reserved for future use and should be zero filled * * Note: This struct is part of ABI v1 and is deprecated. @@ -443,7 +443,8 @@ struct gpiohandle_config { * struct gpiohandle_data - Information of values on a GPIO handle * @values: when getting the state of lines this contains the current * state of a line, when setting the state of lines these should contain - * the desired target state + * the desired target state. States are 0 (inactive) or 1 (active). + * When setting, anything other than 0 or 1 will be interpreted as active. * * Note: This struct is part of ABI v1 and is deprecated. * Use ABI v2 and &struct gpio_v2_line_values instead.