From patchwork Mon Jul 8 10:52:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13726407 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 95621C3271E for ; Mon, 8 Jul 2024 10:53:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=9t9CW2ikDJ93nVzHMjsfMYNAYP8IQbMk6FtSVUZ+Oyo=; b=Sim0Hci2fF0JcT1qaDSyvrWhks RhBD75EVXviNuCEnCYPK/B4D5WMlb1ULVS0uBdzc9M85Ky1d+KtW+cn4eabZZg2fTu98eHRXuShIL HSx81HRLD8mP1WARmSgdZJ61pigGMC0AXbRbEe/JWRSVOmFyUMa7Knr8Pjj7qRrga+9IAayxyYg7m YF9ct+zGJqJiwEhsR+UmE45uHmyZ3riKXeOtw1La9d7E2Nilv1KfQafoF7xOlAzCLqOgxiMGfUdip 0ZcaO0BS/1lK85n+NfhjNvjWNuI89K5s/PEot1mpAejfTQaO5Of4yLH/uNJedCd6QlD/mMFQqevXf ZwBdzmRQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQlze-00000003VE2-1JyY; Mon, 08 Jul 2024 10:53:14 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQlzN-00000003VCW-3wDu for linux-arm-kernel@lists.infradead.org; Mon, 08 Jul 2024 10:53:00 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-426685732dcso6486275e9.1 for ; Mon, 08 Jul 2024 03:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1720435976; x=1721040776; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9t9CW2ikDJ93nVzHMjsfMYNAYP8IQbMk6FtSVUZ+Oyo=; b=eSqAxKis22t/1eYwFtZUN5rDP4bUftI3sHj1cqr6GO937J/3YQmVgfSWaBhw4F80Ed TAM9/XU9wl6qZZoWhfYHP0C0c/E0byxhQnCIH/XbDmSfNbX/HXcfMAm9d0x9PVzAKaza Dlcy1mULZs4CISHK/JSb3UsgesGN7IE2xSEd/C1KUA2HZTWB00uwNGVgBM0fLsmfQnGw 8wbn8/DvQQ5qZvzH2JMs8M0Lsy7YbuUDVL7b+/HoaDjBvAjBRsahdw/rPWootSwfd/Xv 7ON84GQtuKSNIBWotI9vFHuiQ41OixxH/AjPymEyWkO3kEfe5Ju+3S1I8BFByBbpbQPB aDxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720435976; x=1721040776; 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=9t9CW2ikDJ93nVzHMjsfMYNAYP8IQbMk6FtSVUZ+Oyo=; b=qW8uplixkYkzacTQkwhV0jAFa9S7ErRVnLNHlCOqZWfgYt1TBAycwNQIRWZWj6jTNW wmMKxDPE4I/+lvh2+xvlmZ4osXtrxw6V2awLQRsS2Hm07aAzhYK8weUlSAq9dKzW+c+q fUbyCNVL84/8y5kJ2e6d6/e4TL2EuKQxcaiCFutwQbittPM0BcAk/a7N7L5IvTIRZDZN KfL0U5DO3MTdZJL2ekh/KcgRWgXKhc3HxKk9jqLZsdwfWSPkpYzUTxsOTeNveOBXEd6z wP4iocipXV/NA3PMobmRgrnSy4De1bOFpL35vevfTFy9rWWTeJ8/MEhla45wSjEo0/Cp d7dQ== X-Forwarded-Encrypted: i=1; AJvYcCWcNBUKbz0VhATIuBEpn+y0RH3EMKi09f4zStDYDelLTi7tfihcFrnJe+0Fo8tptlwmS3+jEFHwcRp9BLu/KBBz4lJ9XtTSqTHmVB0RCfO/yWctFfY= X-Gm-Message-State: AOJu0Yzw9hdLvGJ3LjUrD1Ldqu8TwtotcgndcFD7fBqA8Z8p7T5/3YYQ TQbwXVrdcUFTQSjrOknqogvHgeMv31Q9KW1/H60hUuMjVQ4OyTsjJIuKyUQ4wjI= X-Google-Smtp-Source: AGHT+IGdYnypB7xTlH719+DjiVuD4czKnIEonrQHHTOzz00kZsM072lcPEtJDLFCd8IDnJcosZHsxA== X-Received: by 2002:a5d:698b:0:b0:367:8fee:443b with SMTP id ffacd0b85a97d-3679dd56208mr7132968f8f.41.1720435975893; Mon, 08 Jul 2024 03:52:55 -0700 (PDT) Received: from localhost (p50915e7b.dip0.t-ipconnect.de. [80.145.94.123]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3678a648dd3sm15478080f8f.89.2024.07.08.03.52.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 03:52:55 -0700 (PDT) From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: linux-pwm@vger.kernel.org Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-trace-kernel@vger.kernel.org, Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , Fabrice Gasnier , Maxime Coquelin , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH 0/6] pwm: New abstraction and userspace API Date: Mon, 8 Jul 2024 12:52:26 +0200 Message-ID: X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2672; i=u.kleine-koenig@baylibre.com; h=from:subject:message-id; bh=Yb0WIAoaOKNp5Xv4PSSI4KumM0UVBL2yI5MvTxK0YKQ=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBmi8TrEwrhSTsU+WYFtDXfVOsElXp4JJimZYycX tewSw9AhzyJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZovE6wAKCRCPgPtYfRL+ TpT8B/4vQpye6kHDXbHQtKqAcG7Sgx9KXOlhnKnRcpDujDsY4SrDDFUOJPa7BlanQ0cSAMjHreK rHzfyEKef43R5JBJF5F3jR9u1rUqEEeAiYbT9S9VnekSqSWvIM3urOm4iat7fF9u0rZcq6Vu+iB 67lAEXjus5D3kI01bmaOWTP07W2orpkPJJB5Wa92l+VIjTTLy0TzjfjWHDjdMdaIwS0sDlnWw5Z hFcXNfJnX9eL+HgkJ375kbLNlfZ3fmvCipjYjxtX/R6i+WszdErNUBtImwe7LEf1+8D0xo7drSn w2P2Sy2CLGEOZahAreDlzGG6Irq+Q8QsMCPI2lsnw+hBK1XH X-Developer-Key: i=u.kleine-koenig@baylibre.com; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240708_035258_216972_0E2B99BB X-CRM114-Status: GOOD ( 17.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello, this series implements a new abstraction to model the output waveform of a PWM. The main improvement is that it defines a duty_offset instead of a polarity and so allows to model more wave forms. The motivation for this is that we need a PWM channel to have an offset compared to another channel from the same chip, that is something like that: __ __ __ / \_______________/ \_______________/ \_________ ^ __ ^ __ ^ __ ____/ \_______________/ \_______________/ \_____ ^ ^ ^ The kernel API for that is still missing (so it cannot be used yet from the iio driver we intend to use it), but there is a userspace API that makes use of it. This is actually the 2nd series that implements a userspace API using a chardev, the userspace lib from the last iteration is updated accordingly. See https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/libpwm.git The series bases on top of https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next plus the patch pwm: Make info in traces about affected pwm more useful available at https://lore.kernel.org/linux-pwm/20240705211452.1157967-2-u.kleine-koenig@baylibre.com/ . Unfortunately this requires a new set of callbacks for lowlevel drivers. In this series axi-pwmgen and stm32 are converted accordingly. The documentation situation is not optimal yet, and I expect that the locking patch triggers a lockdep warning for the meson driver. This is however a false positive and a problem that needs addressing in the clk subsystem. Looking forward to your feedback, Uwe Kleine-König Uwe Kleine-König (6): pwm: Add more locking pwm: New abstraction for PWM waveforms pwm: Add support for pwmchip devices for faster and easier userspace access pwm: Add tracing for waveform callbacks pwm: axi-pwmgen: Implementation of the waveform callbacks pwm: stm32: Implementation of the waveform callbacks drivers/pwm/core.c | 678 +++++++++++++++++++++++++++++++++-- drivers/pwm/pwm-axi-pwmgen.c | 148 +++++--- drivers/pwm/pwm-stm32.c | 605 +++++++++++++++++++------------ include/linux/pwm.h | 51 +++ include/trace/events/pwm.h | 134 ++++++- include/uapi/linux/pwm.h | 24 ++ 6 files changed, 1334 insertions(+), 306 deletions(-) create mode 100644 include/uapi/linux/pwm.h base-commit: 120a528213b6693214e3cbc24a9c3052a4b1024b prerequisite-patch-id: 0e21153cd012f41ba9db52357fd08219af53e26c