Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp394738lqp; Thu, 4 Apr 2024 17:30:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX79zBgelmUayI7Dpog+JOw3zi6hL5tPrmm7sUstG39SAE69i3RufxrqdxZL2ci/x+CNkGlMD79duq8Uro43qHbfqcpuuTz5CDZfBpmBA== X-Google-Smtp-Source: AGHT+IHU1XH3UWrHs+Csh4PrTZuNgAtgtW6RuD5XSRVToSnvEIgN/3367VDlJIPl+DT6k7OI7cbq X-Received: by 2002:a17:906:5615:b0:a51:9cdc:bbc6 with SMTP id f21-20020a170906561500b00a519cdcbbc6mr666839ejq.60.1712277039677; Thu, 04 Apr 2024 17:30:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712277039; cv=pass; d=google.com; s=arc-20160816; b=p4UOJnU7av3BHr5HqaIwjPV9cD+26PYqZ2sO5brCR6GC3l14wnhekxVLYiE/iggGhq lhKt1dla+HVtLhGkUbjIuqMFysCRIvgh4e0n6lcBBuNr19uv2gjqmt6fTuCymNyrgLag XZer15urJcGMeaJ4YWlXM3Dloz1cr+R/3OiScUGcbkdrB57vRvj1CdAyD6KZv1vw4br+ E3212gJv4KZUbKbeJ1NlcHX3AhLxhFZJSte9g6byxQe54I6JoJ2x+3dzCGqkdtei24aM emkDGUxA1P6hh4QxeUM9ENKix37KyxttHjrIDk01fukoHr6lQd1X4PCJp7vdGo/Y2mXb QNlQ== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=qGt59heqX0LzwtX6QO6FxTaNLRifoHIlymDGYTHl+14=; fh=51lLf6Egjg9R3zJy6Y5iRLdCrjyfZLPcvuBfujwVm4c=; b=tA9TdnZfFGTBhg6h2uvgjZON00L7OzfcyR/IsiZCLWB39qvJomyOD5F+/C59TWJs85 jEEgHG4sjzUC3SXNqZT5qDIEFjzPkjMntd8XxfUY5Pfl49QxVT+R4dJGdk3sE2T/gku3 G1ASHj6p8DlCgUWajIeINETboFQDmCboymNoKlbletUdcswhme4PUl2g39DRJIzpsqj7 sY4rpMWJ4bXf10W9IvrhPXxxDV5Lvd76l4y8aNogHrcOUJzylZiO4sl9dWEPs62CNBKj 6CNz1o7Q8feomyWomIJqDHW8/iiV5ILszXvDtLjicxWHecVCbPDIsAqSZs4yM+/LDHhM dyRQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=Kxpa2wFs; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-132293-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132293-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id l10-20020a1709066b8a00b00a4732e58b42si153778ejr.424.2024.04.04.17.30.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 17:30:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132293-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=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=Kxpa2wFs; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-132293-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132293-linux.lists.archive=gmail.com@vger.kernel.org" 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 51B721F227F5 for ; Fri, 5 Apr 2024 00:30:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E4B5B5695; Fri, 5 Apr 2024 00:30:32 +0000 (UTC) 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="Kxpa2wFs" Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (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 E6D197FF for ; Fri, 5 Apr 2024 00:30:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712277032; cv=none; b=pF6gFw7xtj3eIJ5AK7yjYJt1eYo2anoAQvUFeByiuTFUUCcSyR37Tbq5PM98NcJKBlPbCP5o3yMjvdrFWeueKrhuk5RW0hHFXmlzgfaXInbBLybuVFnDso9SauIVrM3B4AKot85dvS3OR2s9ydlktAYxuKJB9JW3TppDtiL+M1g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712277032; c=relaxed/simple; bh=jm2S4gXt5t03+EYoZp2cT5abCQ0PDuVgQv0IOQbbDsQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=LhqoCv1A5Fma8MoZ7VSG0wU8JWQ7muq3iiNgJfOybE08v3xARnTwMlOl/amlR6i0baMjfUkSsHYY0xbQ+H63Tx7bNBQ1jNg0vzE4h3VwuP1+/+iyGYBgwP/HDJ0o5XWDBEKCuEEAYtBkUiBbtE0ZOwqv3+mKACOQ4YcfQ2911jg= 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=Kxpa2wFs; arc=none smtp.client-ip=209.85.222.182 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 Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-78d423ab87dso69320685a.1 for ; Thu, 04 Apr 2024 17:30:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1712277028; x=1712881828; 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=qGt59heqX0LzwtX6QO6FxTaNLRifoHIlymDGYTHl+14=; b=Kxpa2wFsJnUkxI3KZ8h/XKqngVhIal5uRK9tSJLCEPTyeI9qt3IkP+ZDx0nDTW5FhO CjigdYkjD57jI1PFamOQrum/vTwDYmqR/tGjTQphkexU3yw/lvlOs5tKu1CSpLndVkCi dCeUCIPqP99ATCESnyA1kq9VOzQ8sKMVhLbP0VWwo9OsiKG7l9rEMgq1HEYUZVuJZqks Liud8dz8tzYuj0tSGzDJmjmgXuEu7By/DUDdAVo5bhxz2ox6QwHOZH/pLaQWSxJc2AMb Pa9Lkcsb73kImFS/zru+zzkvg9P9eFJEBX1zsqWoEiXzC9De7A4iSy1dl7NstxXJM7Wa o2ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712277028; x=1712881828; 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=qGt59heqX0LzwtX6QO6FxTaNLRifoHIlymDGYTHl+14=; b=YonuKVoexZ6NyBHFytomouDbiFxJakF6d61wrazXReqkG5EETqb8p/qyGPHjsT7jOr S8RwXN5foa8kQb4r0h2/efycISNvd5b+meqaOBPdL5MtHn3YDMUgoxB4yThCk+QMz98p js/9in//sXbB/jbqm1lCwsTsR2+Bo+GFwxX/8DnCo8G9/uPPv/6A7eiSXGhrxEtYy/vt X/Tx6C3BN0n9yCwszUc6aW1vGjzmMdE00e8B4n1exfYfJAqzNyEn6t7G+g1SPueWjdOJ E6gFuMfrOwo+2jxGqDDagRBwxD7FjrUIqGM3s/Q+Shtc9SwzzygDBHg3i+tpEZEQtzQR kHYA== X-Gm-Message-State: AOJu0YyJlK/fNs6WWauB0VaoK8/OO0vmW0JHWOXHHM1x9Vdm9N5w7dLP vI+A45lkX5emTz7JgrW6EezEz9EBqJ4vbc7D+f5YGM5zAPm88TQFYwEJD225o5odluHOxUSJYDE FJc8= X-Received: by 2002:a05:622a:296:b0:431:51d:42b1 with SMTP id z22-20020a05622a029600b00431051d42b1mr1253239qtw.42.1712277027867; Thu, 04 Apr 2024 17:30:27 -0700 (PDT) Received: from megalith.oryx-coho.ts.net (d24-150-219-207.home.cgocable.net. [24.150.219.207]) by smtp.gmail.com with ESMTPSA id o4-20020ac86d04000000b00432feda5986sm232728qtt.35.2024.04.04.17.30.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 17:30:27 -0700 (PDT) From: Trevor Gamblin To: linux-pwm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, u.kleine-koenig@pengutronix.de, michael.hennerich@analog.com, nuno.sa@analog.com, tgamblin@baylibre.com, dlechner@baylibre.com Subject: [RFC PATCH 0/3] pwm: add support for duty_offset Date: Thu, 4 Apr 2024 20:30:22 -0400 Message-ID: <20240405003025.739603-1-tgamblin@baylibre.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series extends the PWM subsystem to support the duty_offset feature found on some PWM devices. It includes a patch to enable this feature for the axi-pwmgen driver, which can also serve as an example of how to implement it for other devices. It also contains a patch adding a new pwm_config_full() function mirroring the behavior of pwm_config() but with duty_offset included, to help maintain compatibility for drivers that don't support the feature. The series was tested on actual hardware using a Zedboard. An oscilloscope was used to validate that the generated PWM signals matched the requested ones. The libpwm [1] tool was also used for testing the char device functionality. The series is marked RFC as there are some outstanding questions about implementation: 1. In drivers/pwm/core.c, __pwm_apply() was modified to check that the sum of state->duty_offset + state->duty_cycle does not exceed state->period, but in the character device section these values are being checked separately. Is this intentional? What is the intended behavior? 2. Should __pwm_apply() explicitly disallow PWM_POLARITY_INVERSED and duty_offset together? 3. Are there other places that would need duty_offset handling which have been missed? Note that in addition to the other patches in this series, the changes to the axi-pwmgen driver rely on [2] and [3], which haven't been picked up yet. [1] https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/libpwm.git/ [2] https://lore.kernel.org/linux-pwm/20240301173343.1086332-1-tgamblin@baylibre.com/ [3] https://lore.kernel.org/linux-pwm/20240314204722.1291993-1-tgamblin@baylibre.com/ Trevor Gamblin (3): pwm: add duty offset support pwm: axi-pwmgen: add duty offset support pwm: add pwm_config_full to pwm.h drivers/pwm/core.c | 75 +++++++++++++++++++++++++++++++++--- drivers/pwm/pwm-axi-pwmgen.c | 35 +++++++++++++---- include/linux/pwm.h | 52 ++++++++++++++++++++++--- include/trace/events/pwm.h | 6 ++- 4 files changed, 147 insertions(+), 21 deletions(-) -- 2.44.0