Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp236643lqp; Mon, 10 Jun 2024 02:24:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWcSQtaaxB+YnFOFcsjzu6UhQnxUiKOh+LhEYATgn7gFdu+RUant5/2c8HziPyxEFJcnHZVwh7O4mv9MdRNnCBPo3YO62KptqvTXR72AQ== X-Google-Smtp-Source: AGHT+IFbsHv/oKY0DFB7XA1zDpBfebzogulOYBTi33epMfMbfkptpjtcVOXPmTpIP5Z37MeN9b8S X-Received: by 2002:a05:6512:10cd:b0:52c:804e:e831 with SMTP id 2adb3069b0e04-52c804ee8a9mr5058072e87.47.1718011455395; Mon, 10 Jun 2024 02:24:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718011455; cv=pass; d=google.com; s=arc-20160816; b=DQxvcfIGG41peBeq+ec0nYhjVFnmXVYpnWXViEHsfIAA5Oxg0n9AEOOXWZ5y3jhvFJ J8U9qAdBQSUhixVnNUmUE+Iy3a0LBqy4CLXngYq91VbmhuigDoCgEjWRYY9w5GGrzw5p CS1Vg26TMHwqWWOPvsw0jXRbpuYuZgrkgPYXD4QvX7HQGlc/fALbxb+aQP387TF89ST6 URKWFJt4FEY1CGrOwb7tjyuT8V908yi/AQ040vgJu7obyBS/jb7xA4n04dOt2fLAQK9s 5/m/lQG2banl/pzhbxUHPPbwO3kDQcZJoxj8wIg1JFS359ICjDJMVL7N6gLMPzmB+Y4c Av/w== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=URK2Ozhs5KbL4aw49CG/ifndI/mBkWV5rsNcJfrG55c=; fh=vD4qvVzCoDpqylIt0o7A2I+mPgHxi2NgkdJH1yo1D4k=; b=GzcTfixH5YLM6uj+ZzShms3sXF4hJAOcpzlMqAVvQwr2FSaClhrUH4JSS54Z9hQX4D PCaY5Tbu0eOPZeszLe/yqokH/uDV+Vsoa/YYRGvuqSGziMSh+Mo67hUdcJC7wsqqKEpw JUGNkUyVRMofeahu53bCt+nCiPc3Ay6qLq/+zR7anQZjSaJ7E6dBjfptTJ2Jixgg5uyh hPPxv1T7Yk9rZQx9C00W4LLy9DX06oJT+atmN8eeJNIU+zzFZCHo08zYaSAs0Q04LDqW V2vwXzfgImCSZjqwtFOLGuN1t8TEfCUJc5KVqD0A51LcvtcvqaP0rnsruvjISj03rrSa lZXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QNe1029m; 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-207933-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207933-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f1f45e2cesi87235866b.558.2024.06.10.02.24.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 02:24:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207933-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QNe1029m; 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-207933-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207933-linux.lists.archive=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 10B141F22A18 for ; Mon, 10 Jun 2024 09:24:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A16107407C; Mon, 10 Jun 2024 09:23:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QNe1029m" Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (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 5F3817406A; Mon, 10 Jun 2024 09:23:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718011421; cv=none; b=QZsRRecUapmVhWUPVRC5UXlayux/h4du6CADwxaiUNi69LkdhzQoSmhKEvcqYwF4YenqOor5Lo7MIGedzpSP2CP8JEWsgtboW7sNJivJ5RbSbi/H8JAhUe6bMJHnk0ENfYHUi74PD5h5jvn3MC959Nq9xdL4lZcGHTlw3rK73us= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718011421; c=relaxed/simple; bh=MIk+bEBU0QLUp/D8INS2W8Ha6kIdaCi6god1JOJ+eWQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nKhPxgSTyUOHQTlmA4UekbNaTDTTmDJrbbMY7io/cABV0QcPYn81VmCLsoDqM0NfKObpceWSB2EAFJrnGRYoy5n7bSV3dz7IFSLscSm39xqFPUqnu+OgpC4U/69UVHVeb2cQRqWMWzDOUqwaxr45oBxQ0GGo9AVifwjXWvUk1w0= 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=QNe1029m; arc=none smtp.client-ip=209.85.215.173 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-f173.google.com with SMTP id 41be03b00d2f7-652fd0bb5e6so3656334a12.0; Mon, 10 Jun 2024 02:23:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718011419; x=1718616219; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=URK2Ozhs5KbL4aw49CG/ifndI/mBkWV5rsNcJfrG55c=; b=QNe1029mkxV69vPioEE9fEITcNr8hoi7ar05ONga2XMK+Hs8I+M30TUCbAIw2n3yvm jioRriuxDkcXLfMFFstkvg5NbjSmsytxle50bQpKbugqm02m01eqNY4pv7xkJdOqWzVq M0FMHp7JYltBOcf6b48O33lx8XuFpJZsBNnvWyQAuopi7LkTm7FD9WSAuAm+4LQlUBjQ I0B3y/DiDu1DBghkwzI2BxkqRvVaAmLtj/BlFwk8/Mce+N+XiG+ugSDr/lcrKzfOAwnQ RpnF/7/RQnEEFMt0XKIj4olaUmYku0/Xw34k5+JjEU9s2FAB1WX06Lg38+5qM+7C6Nan qfgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718011419; x=1718616219; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=URK2Ozhs5KbL4aw49CG/ifndI/mBkWV5rsNcJfrG55c=; b=HY9kJSscF64pW7krhbgOH2Y93ObMrslQU3DunAVZaNE9lBh5NpQ1RAuQis06TEkcBg mHrRL/7uwYg0n1T9C+sXGk/5xu/7vtIG6E+Tq17emoUGRC6UEKygjoZlx+TFurIYr/XP pAl2igKczYo0i+BrnkQ2ZSeFWA2TSOwLsnU6VgDqm+rMUzhZ44gUvLNFNrLiEpzpvh9v U1Z1UBTrEcmeuXrmfz8QZ2Jo1CnZTjoMeIg3GSZPwkRNESEr40G/pWjYR0Pyw3mvkztW Bnri7s22t0FDmf8uGIZZPkQFnaV5jfj4VzY97VqzEzO+BoRzGvSBPJMj7IUTKKqo33s2 zLNA== X-Forwarded-Encrypted: i=1; AJvYcCVu4wD9FfhZqMlfgGkmjInVhZ4q+cucALh4pt37itlIsWjDXzdl8JNbuRHflgFvzZc7QIPuX6t0So+YbdC8+PYC2hd2RE+mYpl3XJ2Yfgh3lQdhBR21MiBIYR14HRggBsRtpM513Q== X-Gm-Message-State: AOJu0YzPsvZM6dSLTieo24DuxVd7FQb/2JUGL49OBB+iivU4zeeS3Jnp w3QlgOq684c5c2ZE3Dss3gVEJLCkRf4OE6oeByOXQFOqjvncewWvqth1lg== X-Received: by 2002:a05:6a20:8417:b0:1b2:b60a:a42d with SMTP id adf61e73a8af0-1b2f968d9f8mr10458016637.4.1718011419450; Mon, 10 Jun 2024 02:23:39 -0700 (PDT) Received: from rigel.home.arpa ([118.209.204.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6efa2a319sm41318395ad.108.2024.06.10.02.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 02:23:39 -0700 (PDT) From: Kent Gibson To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org, brgl@bgdev.pl, corbet@lwn.net, drankinatty@gmail.com Cc: Kent Gibson Subject: [PATCH 2/2] Documentation: gpio: Clarify effect of active low flag on line edges Date: Mon, 10 Jun 2024 17:21:57 +0800 Message-Id: <20240610092157.9147-3-warthog618@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240610092157.9147-1-warthog618@gmail.com> References: <20240610092157.9147-1-warthog618@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The documentation does not make sufficiently clear that edge polarity is based on changes to the logical line values, and that the physical polarity of edges is dependent on the active low flag. Clarify the relationship between the active low flag and edge polarity for the functions that read edge events. Suggested-by: David C. Rankin Signed-off-by: Kent Gibson --- .../userspace-api/gpio/gpio-lineevent-data-read.rst | 5 +++++ Documentation/userspace-api/gpio/gpio-v2-line-event-read.rst | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Documentation/userspace-api/gpio/gpio-lineevent-data-read.rst b/Documentation/userspace-api/gpio/gpio-lineevent-data-read.rst index 68b8d4f9f604..d1e7e2383b0d 100644 --- a/Documentation/userspace-api/gpio/gpio-lineevent-data-read.rst +++ b/Documentation/userspace-api/gpio/gpio-lineevent-data-read.rst @@ -44,6 +44,11 @@ Edge detection must be enabled for the input line using either both. Edge events are then generated whenever edge interrupts are detected on the input line. +Edges are defined in terms of changes to the logical line value, so an inactive +to active transition is a rising edge. If ``GPIOHANDLE_REQUEST_ACTIVE_LOW`` is +set then logical polarity is the opposite of physical polarity, and +``GPIOEVENT_REQUEST_RISING_EDGE`` then corresponds to a falling physical edge. + The kernel captures and timestamps edge events as close as possible to their occurrence and stores them in a buffer from where they can be read by userspace at its convenience using `read()`. diff --git a/Documentation/userspace-api/gpio/gpio-v2-line-event-read.rst b/Documentation/userspace-api/gpio/gpio-v2-line-event-read.rst index 6513c23fb7ca..1312668e0f6a 100644 --- a/Documentation/userspace-api/gpio/gpio-v2-line-event-read.rst +++ b/Documentation/userspace-api/gpio/gpio-v2-line-event-read.rst @@ -40,6 +40,11 @@ Edge detection must be enabled for the input line using either both. Edge events are then generated whenever edge interrupts are detected on the input line. +Edges are defined in terms of changes to the logical line value, so an inactive +to active transition is a rising edge. If ``GPIO_V2_LINE_FLAG_ACTIVE_LOW`` is +set then logical polarity is the opposite of physical polarity, and +``GPIO_V2_LINE_FLAG_EDGE_RISING`` then corresponds to a falling physical edge. + The kernel captures and timestamps edge events as close as possible to their occurrence and stores them in a buffer from where they can be read by userspace at its convenience using `read()`. -- 2.39.2