From nobody Tue Dec 2 01:27:26 2025 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 E7D3C34D906 for ; Fri, 21 Nov 2025 16:08:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763741335; cv=none; b=rurzraRxq3vsETdb7/7CmQESLWEY5IKv8sqt0GV472MHfzi9w1UnDKJklIy2L+ztgkkeYt30EEdnb6nds4zJLNO5vr+dK7iqCRcbtGj1JqJrX127n6UWJw7mC1rhtF0JA8D55Kj6rPZ2xvCdu1dpTFgyC6wtXVCdA6zzA7OGurc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763741335; c=relaxed/simple; bh=+t6QRXttRpX5nce6uZuXOYAkO7xTEcrDg1qTPVsuBuk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TAVnf6es8eleVidBnYJ4lDwTG1pqotVDAqG4vU/8oU2nDvHO5+bBnuXRtgqwhfjhXeY9ZrCP8+m7+gGMFcZeRqKMrZRrhsXsX3SVFI7m0vtff1pj17SnDfM3pthpi2RYo9zVzEMJuMd3OMueHCOut7mbAQpnlO9d9jXyDS4Okjw= 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=IJp0x6Oc; arc=none smtp.client-ip=209.85.128.45 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IJp0x6Oc" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4779cc419b2so23647215e9.3 for ; Fri, 21 Nov 2025 08:08:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763741331; x=1764346131; 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=8o2eYAk4+T2MvJcophYUy9RZhVssXZ1GeiS/j2h3xk8=; b=IJp0x6Oc2nW+PGonCRDevst2Z7j9C/SyOawKu2FLVDmPzGB7Etga9VuaUHR/haegKf xk/6KPNA9aWEknSLoOPxgMiP6eYrV2FBjBfJ2baJYG0kC9sGmw289C9k24N1roL+t2kQ d/aKB3yoEo86TKptUUoWzCSv1z8t5hnu8cZWXd0mln+F/9GtDxd0ciIECxJuOgtIch2S KG+1LYIJneal4YxKikQJ7jiD7PHIl9bkrBEyUsZ0Yos+YuRYf1WBmfCji+FAH+sn8bC2 g4k1rrH5DEBTT1TQ/pfznyigL5NqOR6qM3mF4cHB+puGggqoQC+hvCYIC+H4KFMkKvgQ 3a8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763741331; x=1764346131; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=8o2eYAk4+T2MvJcophYUy9RZhVssXZ1GeiS/j2h3xk8=; b=f6D0rSjoMM1g42kBeFCweSWNxKRrTQzc58SH8Iu7u2ZjrqIYj5XagY6MGmRtyBIEZ8 15Tr2bgWaA3E/48svclVnpeq/07NEmRbqXFfoxCLBauOsIwXAZhKsTLAZPzthuzK4Aqy Uyl/wYPFN9jtt45M6Sg/6VY87L8BRiK3He90Tt24v8YD67i6OnV7no2Gsd7fmLmw4YCd kQWoG9DcKvZhMePAfFtgo5Xbl6+248SpnxlGaGHqw/XGIJUK4L2OB2XUIMO/Nhf8bVDU xjaj4ba1nqteKlKWG96KsrDvBU2Ai51+iosujhcZNuvabQJ24sPk2EVqnAF1W5KEGl95 ez8A== X-Forwarded-Encrypted: i=1; AJvYcCVcUu42Plw9Oub+euezepARiXOAWc+s3pE6ySDXO1mvqAaYuu58i6wdXHm4YdqLQOXoGRg2RlY83Rvvi3E=@vger.kernel.org X-Gm-Message-State: AOJu0YzTFqJy26Vq4HFht0CoRIlRiopDm8vUVYJer7jAiIHPI+YM3SPu yUUnvZAUar62hFqzO6Z+o6yxkxJVVhDhclCpvpBdxrrzI9Ei18MdSyhl X-Gm-Gg: ASbGncs4SvvO1wQtldXSKPxjUtZ1O2vtKE+V48oeNOW7TD3Wq1p+jLfF56KMdwLbOA7 g8+G6rNXSbnRy7rOm4TpGYITlZZy9Y1kHqCy0qo7rWcqstSA5ibtqmxYv0IPk9o8v8B0YgHHnhv CjxSoY6FLjQORSOCkJoBUeYqpYM4HQLXDF2VQAMg/9pNSz7ajNi1RlaNisTo4OugIiOkGO+MGo8 rEki0LWhH927m+EeVP0NWs6ox1TECfBh7FQVt/fUTIipvNMsSMHNFIpgMnw5wNmlOs8u/hGYfSr Xhs2I2BDS7IleLu2SXA858nkFomryt/2ARpAn3jZsqwCQC4639uo7AKvymQSSrdu0ivfPY17aRQ Lhlq5UMCPr+mYxBgGZccyZVZMzcHXXCoWc87dCbC5ISIGfe/tjBwAGwkDX/N/g7PiraX68UKuRa pT2R6TLU5Ro8DtEkMR9cIhspxkj08topkeBHbT0Vpka+5YSvZzy81h4ZTl7VoweJj3SpejPYEPL BosucH6ww== X-Google-Smtp-Source: AGHT+IEJXgXSUSmmo2SsXVmfT6DnwKWByn13rXM7axdiuHfSioFwEpENFf28kMwD6HAfy6nncBRDDA== X-Received: by 2002:a05:600c:3b01:b0:477:54cd:200a with SMTP id 5b1f17b1804b1-477c110325dmr23471945e9.6.1763741330953; Fri, 21 Nov 2025 08:08:50 -0800 (PST) Received: from biju.lan (host86-162-200-138.range86-162.btcentralplus.com. [86.162.200.138]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-477a9dea7fcsm89496195e9.8.2025.11.21.08.08.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 08:08:50 -0800 (PST) From: Biju X-Google-Original-From: Biju To: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Geert Uytterhoeven , Linus Walleij Cc: Biju Das , linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das , linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [DO NOT APPLY PATCH v8 08/15] tools/poeg: Add test app for poeg Date: Fri, 21 Nov 2025 16:08:15 +0000 Message-ID: <20251121160842.371922-9-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251121160842.371922-1-biju.das.jz@bp.renesas.com> References: <20251121160842.371922-1-biju.das.jz@bp.renesas.com> 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 Content-Type: text/plain; charset="utf-8" From: Biju Das Add test app for poeg for controlling output disable through user space. Signed-off-by: Biju Das --- tools/poeg/Build | 1 + tools/poeg/Makefile | 53 +++++++++++++++++++++++++++++++++++++++ tools/poeg/poeg_app.c | 58 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 tools/poeg/Build create mode 100644 tools/poeg/Makefile create mode 100644 tools/poeg/poeg_app.c diff --git a/tools/poeg/Build b/tools/poeg/Build new file mode 100644 index 000000000000..f960920a4afb --- /dev/null +++ b/tools/poeg/Build @@ -0,0 +1 @@ +poeg_app-y +=3D poeg_app.o diff --git a/tools/poeg/Makefile b/tools/poeg/Makefile new file mode 100644 index 000000000000..669c914d9c98 --- /dev/null +++ b/tools/poeg/Makefile @@ -0,0 +1,53 @@ +# SPDX-License-Identifier: GPL-2.0 +include ../scripts/Makefile.include + +bindir ?=3D /usr/bin + +ifeq ($(srctree),) +srctree :=3D $(patsubst %/,%,$(dir $(CURDIR))) +srctree :=3D $(patsubst %/,%,$(dir $(srctree))) +endif + +# Do not use make's built-in rules +# (this improves performance and avoids hard-to-debug behaviour); +MAKEFLAGS +=3D -r + +override CFLAGS +=3D -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include + +ALL_TARGETS :=3D poeg_app +ALL_PROGRAMS :=3D $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS)) + +all: $(ALL_PROGRAMS) + +export srctree OUTPUT CC LD CFLAGS +include $(srctree)/tools/build/Makefile.include + +# +# We need the following to be outside of kernel tree +# +$(OUTPUT)include/linux/poeg.h: ../../include/linux/pinctrl/rzg2l-poeg.h + mkdir -p $(OUTPUT)include/linux 2>&1 || true + ln -sf $(CURDIR)/../../include/linux/pinctrl/rzg2l-poeg.h $@ + +prepare: $(OUTPUT)include/linux/poeg.h + +POEG_EXAMPLE :=3D $(OUTPUT)poeg_app.o +$(POEG_EXAMPLE): prepare FORCE + $(Q)$(MAKE) $(build)=3Dpoeg_app +$(OUTPUT)poeg_app: $(POEG_EXAMPLE) + $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ + +clean: + rm -f $(ALL_PROGRAMS) + rm -rf $(OUTPUT)include/linux/poeg.h + find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete + +install: $(ALL_PROGRAMS) + install -d -m 755 $(DESTDIR)$(bindir); \ + for program in $(ALL_PROGRAMS); do \ + install $$program $(DESTDIR)$(bindir); \ + done + +FORCE: + +.PHONY: all install clean FORCE prepare diff --git a/tools/poeg/poeg_app.c b/tools/poeg/poeg_app.c new file mode 100644 index 000000000000..4ff8e5c007dc --- /dev/null +++ b/tools/poeg/poeg_app.c @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * POEG - example userspace application + * Copyright (C) 2023 Biju Das + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +int main(int argc, char *argv[]) +{ + struct poeg_cmd cmd; + unsigned int val; + long cmd_val; + char *p; + int i; + + cmd_val =3D strtol(argv[1], &p, 10); + if (*p !=3D '\0' || errno !=3D 0) + return 1; // In main(), returning non-zero means failure + + fd =3D open("/dev/poeg3", O_RDWR); + if (fd < 0) + perror("open"); + else + printf("[POEG]open\n"); + + cmd.val =3D cmd_val; + cmd.channel =3D 4; + if (cmd.val =3D=3D RZG2L_POEG_OUTPUT_DISABLE_USR_ENABLE_CMD) + printf("[POEG] user control pin output disable enabled\n"); + else + printf("[POEG] user control pin output disable disabled\n"); + + ret =3D write(fd, &cmd, sizeof(cmd)); + if (ret =3D=3D -1) { + perror("Failed to write cmd data"); + return 1; + } + + if (close(fd) !=3D 0) + perror("close"); + else + printf("[POEG]close\n"); + + return 0; +} --=20 2.43.0