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: 13726405 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 7EEAD78C6B for ; Mon, 8 Jul 2024 10:52:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720435980; cv=none; b=YBM28v+wqZD/1qvoQKwIivaKA7/ivbf/RvdNvqw/BXFVMBvxb4KUN6BBIm7h42u/dtsuDNEQrdnH5ZHS537lO+zxjXOCQXKBEu+09fy86i+lcb+/h66dpmxLpYoAcuRwIQ/EUfZ2I5KTtX7hWd1pDvgzU6Ln9rglHuhCzxfGw9c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720435980; c=relaxed/simple; bh=Yb0WIAoaOKNp5Xv4PSSI4KumM0UVBL2yI5MvTxK0YKQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=o1jMVGvgheCkI/3UHmgFhYWXbno28XmD//ETAxAF/McgWZlOK49W/AAnGeOKMV1hUf5Gs3CtR/HpJ0/0CIetPRDixfOU/+1derL3tmoJ6nq5NgMX/AT9ZsUqj7tENobkTy0TvudrWRSb4os/egWotDrHttNFfvhaOA1bbF4zwaQ= 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=lpUfoC0d; arc=none smtp.client-ip=209.85.221.53 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="lpUfoC0d" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-36799fb93baso2534702f8f.0 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=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=9t9CW2ikDJ93nVzHMjsfMYNAYP8IQbMk6FtSVUZ+Oyo=; b=lpUfoC0dLAyD9F/v1/cnFdgcq9/TJtG0vk8VwrRsPFlT9x/tMH4pQAzH1OfGJFLuC1 2y2zKrTVD0RHWUehsJbdbkkoB8GdwmwpK44JKRztK7IFZZ2rgJutyoNgwGeJzhiznWww QXGTFkfO9CAkJoyEaYLPOdQICnLRxauUs2lFDbbi9q5PjVIhMP2z9EWwW3qjQYSg+yzC ZbseQYn/vMufCgh5/kuytEVG35zfb5C8+UZrjwso37QKNCGVr1bwW1RlqPz+zc7mj054 mhrMu2sefqiik0kdT2/tLA0cUhL2eNoltXNk2Wgxot0S30PzBqxiJD2vDwjIOsGMoF3Y T7rA== 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=FNlu+crzJzUrKt5BW9kNbFa2B3kLDLp+Awe3EFnKbgyy1TYcM5qWAEeyVC3anBQkd9 pW6y97RYbyMLLMCxcW/s7M4gcaGMirzPKsy28UCdrrDgATCWs1elBmepblfDTU49oJV7 qMdx0a58CLAPqvFYk+9ViXzVhJ3CaQv6EGwA79LDgPn7wzgtW7ie578jAur1/Pd1xGKJ cgkC4LWR3HgMiwSxRUe0UMUcMMGaVofrnmA1aTntdIfVXw30l+0yd58oD5YlvtFsR49J TLud5UUh/ByrH+19X6dvc7P/YXwvQfVu6wgbIJ2016cocOH5EKIGyrrizlpFx8NuK44x uq3g== X-Forwarded-Encrypted: i=1; AJvYcCWEG2W2h7cqA90rXhMNXxr+N3PeGdt9BsGXUV265LfotL2AF6Rhh+Oedp9XcuUNSkdEcjpNIePWXe7wrINKXaT9Dps9Tc+sfOk5i6Upq3w5sQgg X-Gm-Message-State: AOJu0YzyyzAgoRoJAToOsSvwatKL1/peYNF9p28LxLaSj4pzpj9Uvj5N l1YoHN+t4F5gE6yvAbWeeAfjlfl6csL5Mca9lL3n8H9g+306y023FlEmvJ1zf0Q= 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 Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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