From patchwork Sat Jan 11 00:22:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13935624 Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (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 BE607137E for ; Sat, 11 Jan 2025 00:22:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736554949; cv=none; b=mqmT2VPjNZZvh8U0gsgqx6GsuGL9jP7mdOt7vd8x5xeM9IoL4fDDYzEdxSTL09MBH0kubXkgNZ5x5RgbAp70h4BT9f51Ynoea++aAtgfJDoJcHb27Qj5yRq2mLTzWUCDH53p2gVeNfNymVRhUD6fsfOT0i+yWoI9xnx2pMpII1M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736554949; c=relaxed/simple; bh=vVsJao09SSWQ3bDdl3NzByMcH3l/KrVPXfGUsydWWjY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cSP5hhvh+5MOh61boIFscS2ssQzg9rx3Gc4Aiy9l9ktsFSIgF3CoqyynDWyp65x3UanNJD5MzWYVnWiceGbCzZJBeRYn1DIxHghXi9iu90IW8nZ1eLvlrBCXwApVM84dX/hiq2RfJAITqrLxO1/dKF8fJx4IKfIwtgi5vz7SeUk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=06iMKko3; arc=none smtp.client-ip=209.85.210.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="06iMKko3" Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-71e163493efso1480312a34.3 for ; Fri, 10 Jan 2025 16:22:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1736554945; x=1737159745; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=hOSrHqat25E3J2ntKwhDL3+ISPypujVEBEo062ZVv3k=; b=06iMKko3b1dqmF5PvxqgUmEw3Oh9/QC5dKZWpenmi2csqjrvAOWaNU1ODkAGqoMEPn J9etGkd7d3KaR3FN82B1HAqmW9/neFy/bOfxoZk0KDmt/uCxK0yvA3/cRBMMu5UavCHf zO3HETLIsleHdR+r+xeQJ4vMBT2V/6K29/KeWNz+sxNUNFS1Ni+vDChQIrnx9TPZNgX3 +z1/3XcwnlCdtJhi2t5eOBBlIcAl1mLF1jqvFErxmAglHRsNkOf9sHHPl/+MLEzK/+t6 hmDWsZHBD20sU39NGrUHriXKtzVoYXyEXasrIC8+B5zQEnKn5CT5FLjjBpbwCNXfpquB JsGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736554945; x=1737159745; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hOSrHqat25E3J2ntKwhDL3+ISPypujVEBEo062ZVv3k=; b=SHnMkJIbdsY3rafUHqDaeNAjdhEu3ZYvMrCxDYWwZk7heYw1ZoqMPlUWs1MvT4sWmj VpCq3ofjL8wyRiitFhBu40/4YNrt6dmUcUTS0TjSFs8Zp8ePW2KwAt7z6CWKnJ/kStK0 CUS9l7W4CTH5r4jGDUhcbDAMypehdldSmKpj02Y3KjOY2xXy50pnGlBf2H5/XZWq8EDY 5l6Y7mft3i1Qz/9Dw6eq4Q2qhlQrxeHOkJ0rrAtwZnUiQDiID9xEp42mIWZQxUq7cnWA 1ZlqzbU214jKjF3BE5lNqGTaX0v16phmyv+rJMYM3r5t74Etzh9ILIxlHOeSMj6t84y/ sBeQ== X-Forwarded-Encrypted: i=1; AJvYcCXI+eQ6eVb3vvo9O8atHyzYPjwI90SeA9oQcBqjC+MqQpb5Zxrp9aMXziOJiIyePm9/hJwUd/VA33w=@vger.kernel.org X-Gm-Message-State: AOJu0YyZqUnkI+/61XDdXDyoXf6TppB59zypyCDqZ7iIc0BL3mstTpx/ 6i26GlcmtzfLxLHVqQBQJChP3cW6OCXxrAV0wIZDI/nvOOH2Eh+k4ItMz/DNS1w= X-Gm-Gg: ASbGnctZLyl0mzUc0KSge05VvaYPKxTc5MEZYo0TCLsN1/nFbUjfhONJoBbaXY9eI9l BDbUB55uDn1T20y7AvJf83Orw8lG6awigQL2qiWA0tCMXAZ4jkNzLNiqzct/snFEeSkomf7suGn BktiIlCEM8kxEwW/POL5sSzB8KkkQ2gG9sCurKNbgRW1Xj5I71Uw6+olvdpHvoE8GrNZLShEVF+ rIy56hnzYbThBCsa/8JITcVibZkRXoCnqn3Up7hFKhiyaU/l8xIgUakzMjRimoGhhJQI0E93WPt gOqfLPk3aJed X-Google-Smtp-Source: AGHT+IEy12bmnfix4EdPD6eusw//tSIAVQKq6c50HTj3WJnQZoistgCQSMnwIKsbjXwwS8kUqOwKYA== X-Received: by 2002:a05:6830:d16:b0:71e:17f2:26d8 with SMTP id 46e09a7af769-721e2e9a3cdmr7839798a34.22.1736554944790; Fri, 10 Jan 2025 16:22:24 -0800 (PST) Received: from [127.0.1.1] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-723186280easm1228941a34.59.2025.01.10.16.22.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 16:22:24 -0800 (PST) From: David Lechner Date: Fri, 10 Jan 2025 18:22:04 -0600 Subject: [PATCH v2 1/4] tools/counter: gitignore counter_watch_events Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-counter-ti-eqep-add-direction-support-v2-1-c6b6f96d2db9@baylibre.com> References: <20250110-counter-ti-eqep-add-direction-support-v2-0-c6b6f96d2db9@baylibre.com> In-Reply-To: <20250110-counter-ti-eqep-add-direction-support-v2-0-c6b6f96d2db9@baylibre.com> To: William Breathitt Gray , Fabrice Gasnier Cc: Judith Mendez , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, David Lechner X-Mailer: b4 0.14.2 Ignore the executable counter_watch_events when building in-tree. Signed-off-by: David Lechner --- tools/counter/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/counter/.gitignore b/tools/counter/.gitignore index 9fd290d4bf439bd39a918371d00617d0bfb75d8a..22d8727d2696a875845cce0542945b3e416648d5 100644 --- a/tools/counter/.gitignore +++ b/tools/counter/.gitignore @@ -1,2 +1,3 @@ /counter_example +/counter_watch_events /include/linux/counter.h From patchwork Sat Jan 11 00:22:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13935625 Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) (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 7CE1879D2 for ; Sat, 11 Jan 2025 00:22:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736554951; cv=none; b=IhbMj+pQLC0s7GZ9irK/Yyiv0q36Fy8uWMrA2wQ9buTIPndHdkKumrw7dx5CLa6mmv13cxPd/TGVfCyofIflaEZwMn+kT9dbKo3G8ckYUT8t0jkWd4TiPx39dQYgXF4KCRpviye9+BSgq60EQ+3OONi559RFRIPwFa52zgUYZNw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736554951; c=relaxed/simple; bh=wvbzDL5AhiGelEihmC6YBvaJBEJ1CgebykByFmweYMU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OWyMxVwEzkpvw48rpfIuTf20F3aAw40UkVk2qMCNGoP9UBUHNi6yO0/FudkQQHEUaaklatnoxvXmE8N+Hw4lyqWljCEjbsM+OqvUmDEu/hQZeWJfxy3cQejGV5exPQ8+vGmvojgedalUZ9jQt7105uPR/2Ndzl9Lpl/BcYuUCtc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=ptGPu3LS; arc=none smtp.client-ip=209.85.167.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="ptGPu3LS" Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-3eb98b3b63dso646821b6e.1 for ; Fri, 10 Jan 2025 16:22:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1736554947; x=1737159747; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=NW8e0hxsXp+vQFvDPfQqx4iFekcjRNa9r51bkAvubqg=; b=ptGPu3LSkG/+ZmiGm+z1TrT/0lTu4Cp+zZ1VBrlEJd74Ycv4l76vK2VBq8IScZBizf yqlT4fA5mnVKwKXgkVFFjeGSy2COVtZLQoesTD50pIctGhecXNMk3xfrzdlan13O0rsj tBqTnvyLOv+QtXWZkvDqOHtjVWkxKq6opUK+hTLo4ALHMUNe6qVa+FTvNquf2N4+8gbY 8LoVHzBwBUz1zFljbuR/0hfLPYCLw1WaKNz0sWUs2PqOYIJC8PU+CnJ5EK+z6TGHYgzB 8q2Gpw1VMW3mDxDhcnxjouBE02ASqK3aNjvItsMkhhgR55fBEuIllSSsuvipJGPbCIRY 45Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736554947; x=1737159747; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NW8e0hxsXp+vQFvDPfQqx4iFekcjRNa9r51bkAvubqg=; b=T0mPsIOrswJT4rp93seuY/43lano/CLSJv1aOiwU9OOvDEi/IwBsUMNkYKNcw0Yq5I LQjY52POmEIipe6lY6ltrnC2WWOJDpyHaOGHQGxnisOMdTfvOtIsfhDqf1RNkY8bH194 YVBsvyF+CHfWkrFcZ1NjSBZmyjJ7JBdQ8wF2jURW1XGxPmtT2ed2Jw7owYJ6o94v5ZCN uuQjHi0ee37+dx+JwmwJvo9Xnn9CTW+I9EEiCi5my5TWXf6TgOlxZ+Ydu+sR0zJXMM+A dFReTFkUg2YEAjSbT9b9fT/5+8f1VRQeGJjWYEYkv0GJ3/aKhdIJF41/zWMF4V/hGPF2 aE+w== X-Forwarded-Encrypted: i=1; AJvYcCXrY9ePC12olaH+/TPw+6Ai7C0CG4VqfLZ9nAAcckPkD6kDFwFuc/yg6NJy15qT/4J0lSKaSz1a4FA=@vger.kernel.org X-Gm-Message-State: AOJu0Ywb1mxiTHk+FpBqP3eBBCT3fFiImWEq/ySavyjO4C9RKu9iA4k+ 2Pt8qG5/uNLigmgWminYmn+fVrwcF5B3YR0cc2lcajJbaa3sIqno/OxiAh8YSuQ= X-Gm-Gg: ASbGncv9gVrs4K4U0AksnEv2OZGIwQda1n+BiOB/Mo4GBNjXrYhcfr0Dkg78I+t9T8T OYqRnSKygwnWHg5H9VBXDm3wZM3utft8mICi/+i8KBniv2ndZoXvALdJaaHbqgOtafoAav2pGUv XI/Vquy+kHpS9KDNxhbng8xA7FhoiMX/ZYuwTO7arN2h38VvDUYC1Jki9lC4jpujLP97nx8eVhf DAIajdDxfFV2s5ipyQZhfkCzhzWcu1ZSTXgqLKq0YvNE/qFPmu7TJvebDso5lT7RZb9HH3CwzCV oApYZD4Zfx6A X-Google-Smtp-Source: AGHT+IEoNoeWncNV9t+kRIbcV6xhg/XvZirmBilfvjPRkU868V7K9GDkUMtffvSsWmEZcUZoWo/hPQ== X-Received: by 2002:a05:6808:1996:b0:3e6:3a82:f790 with SMTP id 5614622812f47-3ef2ebcb1c6mr7727253b6e.6.1736554947325; Fri, 10 Jan 2025 16:22:27 -0800 (PST) Received: from [127.0.1.1] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-723186280easm1228941a34.59.2025.01.10.16.22.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 16:22:26 -0800 (PST) From: David Lechner Date: Fri, 10 Jan 2025 18:22:05 -0600 Subject: [PATCH v2 2/4] counter: add direction change event Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-counter-ti-eqep-add-direction-support-v2-2-c6b6f96d2db9@baylibre.com> References: <20250110-counter-ti-eqep-add-direction-support-v2-0-c6b6f96d2db9@baylibre.com> In-Reply-To: <20250110-counter-ti-eqep-add-direction-support-v2-0-c6b6f96d2db9@baylibre.com> To: William Breathitt Gray , Fabrice Gasnier Cc: Judith Mendez , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, David Lechner X-Mailer: b4 0.14.2 Add COUNTER_EVENT_DIRECTION_CHANGE to be used by drivers to emit events when a counter detects a change in direction. Signed-off-by: David Lechner --- include/uapi/linux/counter.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/linux/counter.h b/include/uapi/linux/counter.h index 008a691c254bdb49b9c922d7591e755e82b38a84..350b45d616bb102c16f8b60e9039272db20d1be9 100644 --- a/include/uapi/linux/counter.h +++ b/include/uapi/linux/counter.h @@ -65,6 +65,8 @@ enum counter_event_type { COUNTER_EVENT_CHANGE_OF_STATE, /* Count value captured */ COUNTER_EVENT_CAPTURE, + /* Direction change detected */ + COUNTER_EVENT_DIRECTION_CHANGE, }; /** From patchwork Sat Jan 11 00:22:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13935626 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (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 B876E200CD for ; Sat, 11 Jan 2025 00:22:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736554952; cv=none; b=KDIHfAyJSA39X3Noe2mgISnBQ2GSR0+YHShwDo6/Jw7gfcExvegieyLsOpyC0y5SpPrMTQbrmq7cIIUYNL+5Or/4JPPymUHWViPmufwjtWrGx3ksdpPj2AFfmAi7wVbXrBPNeMqMYomlWGO2dEl3ERdfkcyvd31GGVMN176Mt8w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736554952; c=relaxed/simple; bh=9xM1O3PFOmAJu4AafJvQ521D7CpKL5YLHrLmCJg4Zt4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jcc0waO7bDNxNfQw4hjaa1JkLlHDQgdyAPthIluWserTiN14FWGclPf6a3McXTCpwwLnbG90my/od4xtuJjam1kRPAgtldvQ46aUUqzmXm3xDfrk9LQ9XKSo9+iTRF09adfYQMmDh7l6BgLiSCTFlkE/8oBasPw2ZNL8B9IOyto= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=1rvw2QAG; arc=none smtp.client-ip=209.85.210.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="1rvw2QAG" Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-71e16519031so1280153a34.1 for ; Fri, 10 Jan 2025 16:22:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1736554950; x=1737159750; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=jhqKWXhW3hFzYZziQPv1bc807P1AVczWs3LFNPTX0uc=; b=1rvw2QAG8CY5VoZ6oPWEYExYJdbcYcWlhXNGo8BQ5Y4kg9OzuDpmU9rgISZyh3P1qp jrSDa0RA4YVfCHg1NkjI9L6bVTbIxNjqTyYW+KA3VdBL+Xexw3eLIq28jO5k4Om4IuJF nuLDf7eHWCipFJY0xShJMlwDEZImRtRbxVMCvX+wOUZ5DevnF9qMIA+YsvgJq3B+oBiV /ipO6L0Ao++rTDFRztf495bC7V4wIZDlX7T9GPGk9mzkJfIB9nmclYSymb4Ky4ZaZwe2 aFFnYJdOra5Nsq8vaVzfqxIwXOJN1gy556ykALiv4ozZChS05M1ozkcBNJA0ZHmh4hwC /XnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736554950; x=1737159750; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jhqKWXhW3hFzYZziQPv1bc807P1AVczWs3LFNPTX0uc=; b=S7hT9Sax/HySVr+PxB1V/0AdhHxh/Ay9jIj28xrOqeAOteixzPumu35WFHJ5NzcnpU NJm7k5oerWIf6mT1vOwcdqjNIwy6h2XG9yW6GmCXEy2vacc1iqWn+5en6xK60DfhLqe4 YfmmPwbeFOlRJ1qRq+UEQi1RVY4l9ZFYZPRiccnLEjQcMqbihXtHntD4v4E5hbIBYOKp /SMM0F3sBGKd47T4QrPpTgwyu3Bp9uoubmrSumkkUYCaP65sCJ30HwihXgoAHXwIftaB b1GoBQbizj3ZzEVaSnYLs3tiQ/VkulBFeLjMq2N9lzWspX0XeiENxG7fGeJr66X7/f5W t3WQ== X-Forwarded-Encrypted: i=1; AJvYcCUxgQ7ybZxPUMhf7rEyToZdR9SMBW7FqQFRUafgIPz+tsDslf3pCzoaOaw14hQBv9ph0ZYIJgEvKi0=@vger.kernel.org X-Gm-Message-State: AOJu0Yz/dKY+7sz5ypE78KICinyjuBawM3p9ew/mGGHjjiefvrFFFMmm 0GVuwcos6LqgEH+dM7f/3tB07uzXIdCh9tlTix/1RPmqgxOfKSjpDAayfKgOmNQ= X-Gm-Gg: ASbGncu0Q9Slek7zv/zB0yzWkQRU4EoMZp1AzBLVH/rTd6YdXcMK6CCgmMhaz6EYAKO W4cfo7sVQr8zqp2bc8id7Kr6NGqv5HAPxmcWdQg6VkraJFlkDMV3hrI5TaCO2uUlan2RwlRy5wz 1BSz0UmUKTBGk2LnhIWewwOEVdLgYPLjSixruR5w7Hs4IGt40ouVzUtK++nnXIeBW7G2HlsQMKe iTabGZDaHiV6PhmR1Scr9nBnZIFeS+aPygUXNLn4RG13LYsvrVkr+EurhTrirTerdN+Hi8+x+6m 93aWtIgLl8EF X-Google-Smtp-Source: AGHT+IFPOIw0fqjJHlxoL7+RAYiJ65vO0ScrJRgmr4AC4BGEAX0MS8GdoHgfQhYbeLUIlQL41y7MGQ== X-Received: by 2002:a05:6830:4412:b0:70f:7375:e2b5 with SMTP id 46e09a7af769-723187a6aa7mr3323327a34.6.1736554949928; Fri, 10 Jan 2025 16:22:29 -0800 (PST) Received: from [127.0.1.1] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-723186280easm1228941a34.59.2025.01.10.16.22.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 16:22:28 -0800 (PST) From: David Lechner Date: Fri, 10 Jan 2025 18:22:06 -0600 Subject: [PATCH v2 3/4] tools/counter: add direction change event to watcher Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-counter-ti-eqep-add-direction-support-v2-3-c6b6f96d2db9@baylibre.com> References: <20250110-counter-ti-eqep-add-direction-support-v2-0-c6b6f96d2db9@baylibre.com> In-Reply-To: <20250110-counter-ti-eqep-add-direction-support-v2-0-c6b6f96d2db9@baylibre.com> To: William Breathitt Gray , Fabrice Gasnier Cc: Judith Mendez , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, David Lechner X-Mailer: b4 0.14.2 Add support for the new COUNTER_EVENT_DIRECTION_CHANGE to the counter_watch_events tool. Signed-off-by: David Lechner --- tools/counter/counter_watch_events.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/counter/counter_watch_events.c b/tools/counter/counter_watch_events.c index 107631e0f2e315ae66f2150c0e7c1e1bc9a026fc..15e21b0c5ffd71f87c0fbe473e55598c1fb41ff3 100644 --- a/tools/counter/counter_watch_events.c +++ b/tools/counter/counter_watch_events.c @@ -38,6 +38,7 @@ static const char * const counter_event_type_name[] = { "COUNTER_EVENT_INDEX", "COUNTER_EVENT_CHANGE_OF_STATE", "COUNTER_EVENT_CAPTURE", + "COUNTER_EVENT_DIRECTION_CHANGE", }; static const char * const counter_component_type_name[] = { @@ -118,6 +119,7 @@ static void print_usage(void) " evt_index (COUNTER_EVENT_INDEX)\n" " evt_change_of_state (COUNTER_EVENT_CHANGE_OF_STATE)\n" " evt_capture (COUNTER_EVENT_CAPTURE)\n" + " evt_direction_change (COUNTER_EVENT_DIRECTION_CHANGE)\n" "\n" " chan= channel for this watch [default: 0]\n" " id= component id for this watch [default: 0]\n" @@ -157,6 +159,7 @@ enum { WATCH_EVENT_INDEX, WATCH_EVENT_CHANGE_OF_STATE, WATCH_EVENT_CAPTURE, + WATCH_EVENT_DIRECTION_CHANGE, WATCH_CHANNEL, WATCH_ID, WATCH_PARENT, @@ -183,6 +186,7 @@ static char * const counter_watch_subopts[WATCH_SUBOPTS_MAX + 1] = { [WATCH_EVENT_INDEX] = "evt_index", [WATCH_EVENT_CHANGE_OF_STATE] = "evt_change_of_state", [WATCH_EVENT_CAPTURE] = "evt_capture", + [WATCH_EVENT_DIRECTION_CHANGE] = "evt_direction_change", /* channel, id, parent */ [WATCH_CHANNEL] = "chan", [WATCH_ID] = "id", @@ -278,6 +282,7 @@ int main(int argc, char **argv) case WATCH_EVENT_INDEX: case WATCH_EVENT_CHANGE_OF_STATE: case WATCH_EVENT_CAPTURE: + case WATCH_EVENT_DIRECTION_CHANGE: /* match counter_event_type: subtract enum value */ ret -= WATCH_EVENT_OVERFLOW; watches[i].event = ret; From patchwork Sat Jan 11 00:22:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13935627 Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.42]) (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 63915383BF for ; Sat, 11 Jan 2025 00:22:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736554954; cv=none; b=O6H52FfhxvT3X1Rdljj9wQCq7bVfcwmKnzA1ej1EAEecEFJPEXKISnrDEkEFesB7cJnxNckwfN6jg8wNwSm+sDs/uDCz2XGfiaPT4NYpmfFIswXpARRemw+fol5MvFiCKOsplQbi3eB+HuX/bIJ8G5XnAH7rB/K8kNCMj+uu3C4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736554954; c=relaxed/simple; bh=Sm/vCJR0UNJ9M+n6RDDO/DQSL6/4GQ8GHSNkCxO+NJw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=p1n6gT/1Nvz4U7dmCk4epvKeUYiJGlyNPI6u4Q3ltfOMqKSV8SRl+mi+U09cqZfUjuK1HewEtBfyZfykaZT4VgDFcPaUoRJDVW8JEleEmFMbAXx5ErJDEhBvZrCqxh4eLj0n0f0Jl7LknhKx8et4tzOwLfSwKA18A+XmPW9lqdE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=N2WnwNIq; arc=none smtp.client-ip=209.85.210.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="N2WnwNIq" Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-71e287897ceso1676409a34.0 for ; Fri, 10 Jan 2025 16:22:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1736554951; x=1737159751; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=wxjqlH5d2yGAK7gT8nLx4cF++/77RWW2OaRQuEiqFjw=; b=N2WnwNIqW6xBuT2dPG9H/8Ndlu1l3xAddnhmjhAkW2pLdijwEupBRamnJ0P0rsbGJ0 aXsycM+Gv831XXVtN3D2yg0zjIyiKN54fuEwzo71Q1j3KzVMCOM10KGGeB5KM7/j08+O l8/wR3VSAXBW9SJeZamSeAlQUNyqMuRaO2PlPE8O3nsIB4PsCoI5EJ4qiYPJZWMXvnyv A8zRZ1iS63VzpLLPOv5gAIfRBqyDQvNFtykImJcrBSRoI7wpy2NktJVg6aEFbSBZbzLR MMltMUy4wkf7C9FkiP36Nhlio8nRg3XfxPKvzL86zkZOAsHC69vpzysLnx/L5Bnuyq3M pC6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736554951; x=1737159751; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wxjqlH5d2yGAK7gT8nLx4cF++/77RWW2OaRQuEiqFjw=; b=JX/kBk1pC9nKEEyGDkaoNoFfM/K+dB7sXXW+6WIFsbXxQghf2fVtrrJSrw1W/C+gQH emahIEdovsUiavfBK3eJPPb0ce3Lv9gufCg0epbWDZLPEJQHHZ77Pd8NZT45OkG9u/29 3mvqKwyNaemgC/7SJN2xpui5mJnF+NTa75FJQtlz+MnEGwY/6balSc7BhBcRGzXsGbsN vmQQ4nGuV3yHRMXTwfEoZkbJ30evhHwhiUL+xls5lR6WIFnIvaZH3HOU/ElkiLUHflcO sxLYfDn2IGZG1141zBaLcAQNEsek+ob42QQcOJAWV/5r4azXLXN6B+FYHiK4bVNBtNof ou7g== X-Forwarded-Encrypted: i=1; AJvYcCUPfsy7EH0uEfAqTZmPcpgkdIKd2uX4Hze1/tyVzPxMYOKGv1R435A16hxZ78csEinSNSHknpGu+Y4=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1P7mV2YnZXx+FGaGapXdpN/KQfVrOnvXDLpN12muJvex4YshK yhbORm3peZnxx9WIqHnUnLSHHIDXS0THNZTKDBNVz/Ak0IhU35Ts2OA638Xnmb8= X-Gm-Gg: ASbGnctJ8jL3ujSvVhBtWw7Pe2Srb/Qpjy7cbgyep2RJ4lzcBbBHgJRPgLkbEQg93q+ oDiQzEzuloL2vXFzsCWb3pOyBKMTYg/m+SQhXGsg91JIt2MgXLUihXHhJiIn/nyg4KQMpmkxl4T TiFb9Ev7nEzd3EuyQWJU6cAzxpzcowaOI231zBc09qmJ1wZRsTKJooHyyKawXJ3tTDGL31f+9zw t0W3ooPFqqe5nsVJuHu599acE/bzmv45IDQc397XCGJk1f4My0FcLhdfZfDcQLbJyx7BJuBHXxy RzvNoshVidbj X-Google-Smtp-Source: AGHT+IF1c+ZliXJuhcHSKrpXBnYw8ejPWHsdb36/Pxj+4Gk9f8NaXMfIl2+Gr6DQISDAokbNcEV8gw== X-Received: by 2002:a05:6830:911:b0:71e:72:3ab6 with SMTP id 46e09a7af769-721e2ef6454mr7121733a34.26.1736554951626; Fri, 10 Jan 2025 16:22:31 -0800 (PST) Received: from [127.0.1.1] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-723186280easm1228941a34.59.2025.01.10.16.22.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 16:22:31 -0800 (PST) From: David Lechner Date: Fri, 10 Jan 2025 18:22:07 -0600 Subject: [PATCH v2 4/4] counter: ti-eqep: add direction support Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-counter-ti-eqep-add-direction-support-v2-4-c6b6f96d2db9@baylibre.com> References: <20250110-counter-ti-eqep-add-direction-support-v2-0-c6b6f96d2db9@baylibre.com> In-Reply-To: <20250110-counter-ti-eqep-add-direction-support-v2-0-c6b6f96d2db9@baylibre.com> To: William Breathitt Gray , Fabrice Gasnier Cc: Judith Mendez , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, David Lechner X-Mailer: b4 0.14.2 Add support for reading the direction and for emitting direction change events to the ti-eqep counter driver. Signed-off-by: David Lechner --- drivers/counter/ti-eqep.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/counter/ti-eqep.c b/drivers/counter/ti-eqep.c index bc586eff0daeb52857c10fc89e4f9c0262c3441b..d21c157e531a614215b50f2271f18c998413a572 100644 --- a/drivers/counter/ti-eqep.c +++ b/drivers/counter/ti-eqep.c @@ -107,6 +107,15 @@ #define QCLR_PCE BIT(1) #define QCLR_INT BIT(0) +#define QEPSTS_UPEVNT BIT(7) +#define QEPSTS_FDF BIT(6) +#define QEPSTS_QDF BIT(5) +#define QEPSTS_QDLF BIT(4) +#define QEPSTS_COEF BIT(3) +#define QEPSTS_CDEF BIT(2) +#define QEPSTS_FIMF BIT(1) +#define QEPSTS_PCEF BIT(0) + /* EQEP Inputs */ enum { TI_EQEP_SIGNAL_QEPA, /* QEPA/XCLK */ @@ -286,6 +295,9 @@ static int ti_eqep_events_configure(struct counter_device *counter) case COUNTER_EVENT_UNDERFLOW: qeint |= QEINT_PCU; break; + case COUNTER_EVENT_DIRECTION_CHANGE: + qeint |= QEINT_QDC; + break; } } @@ -298,6 +310,7 @@ static int ti_eqep_watch_validate(struct counter_device *counter, switch (watch->event) { case COUNTER_EVENT_OVERFLOW: case COUNTER_EVENT_UNDERFLOW: + case COUNTER_EVENT_DIRECTION_CHANGE: if (watch->channel != 0) return -EINVAL; @@ -368,11 +381,27 @@ static int ti_eqep_position_enable_write(struct counter_device *counter, return 0; } +static int ti_eqep_direction_read(struct counter_device *counter, + struct counter_count *count, + enum counter_count_direction *direction) +{ + struct ti_eqep_cnt *priv = counter_priv(counter); + u32 qepsts; + + regmap_read(priv->regmap16, QEPSTS, &qepsts); + + *direction = (qepsts & QEPSTS_QDF) ? COUNTER_COUNT_DIRECTION_FORWARD + : COUNTER_COUNT_DIRECTION_BACKWARD; + + return 0; +} + static struct counter_comp ti_eqep_position_ext[] = { COUNTER_COMP_CEILING(ti_eqep_position_ceiling_read, ti_eqep_position_ceiling_write), COUNTER_COMP_ENABLE(ti_eqep_position_enable_read, ti_eqep_position_enable_write), + COUNTER_COMP_DIRECTION(ti_eqep_direction_read), }; static struct counter_signal ti_eqep_signals[] = { @@ -439,6 +468,9 @@ static irqreturn_t ti_eqep_irq_handler(int irq, void *dev_id) if (qflg & QFLG_PCU) counter_push_event(counter, COUNTER_EVENT_UNDERFLOW, 0); + if (qflg & QFLG_QDC) + counter_push_event(counter, COUNTER_EVENT_DIRECTION_CHANGE, 0); + regmap_write(priv->regmap16, QCLR, qflg); return IRQ_HANDLED;