Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp547108lqr; Wed, 5 Jun 2024 13:35:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUNL9rQaLjjBDVJpPJoogspnAafF15BP6Kp2/H7xCSKxhmXcJTR4Z90eCDRYSgr+bxt0UWXu4EvnLmwbs8KJnldSZr7g9QTr0ohH5aNVw== X-Google-Smtp-Source: AGHT+IGF7g/+EJCL0UsIj+obI0cmZWDccnv3XdWRD+QWUwpaiUhSPCJeCsHku17/G7ELYbJgnBvj X-Received: by 2002:a17:906:2bda:b0:a69:a9a:ba76 with SMTP id a640c23a62f3a-a699f88bdfdmr281533666b.43.1717619734671; Wed, 05 Jun 2024 13:35:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717619734; cv=pass; d=google.com; s=arc-20160816; b=S5OkjWhhxwRSYIJcVcB3VhOG4s3U8xVt1q5tchVLqUZb44bhuyXn6hYurQnTRgIEGX OfRr2n56zMyufj44W5czqj1VBPftR2HAH95Xzc+MibanE8qlCcwgdHovFmNOdfk1wO/t EWIIZmIAAGFBtrB8DGT5zfmFFEEVexGp36fQvBMa1I8ucHgKLTGADraICzLyHn6NmNZJ HaAXHjWqwNiCA/V7XgD+bPCbIp1vcONbFSJVymSOBVJhk8TJrLsxFuh7wg7o7M0DIeU9 7HJUDuLFWpsR5bFxyvCLwmHftam6aI5hnCsumkJgPWilwIv0oHy7iutCi+jAITb2P3jh jZfA== 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=1vJjuSTFz/Nsj8mn2a+s4dFUk/0rqc2v8wfC3wlpVhk=; fh=lgqc3PCImLr8Heg9SUNnfeThjqrWuv2YMo/unAqtZrI=; b=caFp/L5AjYYl94BgATCGTDO92tcosovA7fuIpHHZKkeELCu1AntFz5ZasfztOzKT/Y SKgWE/xVGNt/vGXCHs10Ca04IWbBkWwbNUV1sxzDk5QmEKKIyT5wBCidRZXa6NY9kqmJ 9FnaJ09yLJjK5b+P0qE2GJ6H47cx6CPuYElDp8mexh8A4i78+HMSCbv/0iGbt58yr+48 b2WVVjzAVtOJRQFPFokC2Rz5HB3SLb0hTVaxoCPep3c7XI0VTB21RHEx33nA72z/uIyV X37MxMFpQvL4CgPKPd9P3ETF8huoCf5fUCSSB+4KGYvqqbYqG3F7gJY9M2tyLrYVEKR5 ApWg==; 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=B2+wIEQ7; 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-203185-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203185-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a68ef7165c8si411715066b.298.2024.06.05.13.35.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 13:35:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203185-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=B2+wIEQ7; 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-203185-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203185-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 3638B1F249CC for ; Wed, 5 Jun 2024 20:35:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B58D915EFAE; Wed, 5 Jun 2024 20:35:22 +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="B2+wIEQ7" Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) (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 6354C15ECCE for ; Wed, 5 Jun 2024 20:35:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717619721; cv=none; b=dHMTy94YZlgImAV+afQTXO0olhNVEDwlKKcVbWTNOjkstxJTRFJDW/IyAdx9XJus7KXiIsxg2UpLqCpr9ptLm429Q556gnTLTpQZkhe0ycQT4Os+WPg+0aRMMF9xdiMhmz3D3n9H8X5WKHlT247qBXsSguX354OQT9CQ0kn8J1U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717619721; c=relaxed/simple; bh=A8Z51WtEhjIdfd88NhvVep8DkTcf2oWydKIzJrAqSCw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=kzVOVXWE0hFVyfIZBGuEZ+e/VGmiIFDfl/+FdrA+Fi1QmA34urtPTBUf9/b6Tz1oJ/oKB3DZyQG99Ri+NcnzQCxTmzKeDDM5YFI4LUPtH9z9IerFKgVbxWNw9TxTkdbqK1oH1s8U0bRqKd8lgmTAdb2h7C7NTDz7KglRHws+Lb8= 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=B2+wIEQ7; arc=none smtp.client-ip=209.85.167.174 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-oi1-f174.google.com with SMTP id 5614622812f47-3d1bc6e5f01so107711b6e.0 for ; Wed, 05 Jun 2024 13:35:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1717619718; x=1718224518; 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=1vJjuSTFz/Nsj8mn2a+s4dFUk/0rqc2v8wfC3wlpVhk=; b=B2+wIEQ7TlFGM5ZSRr5bkpq2V7KHSbEh3K28Sk8RdyTGkHMf/5mVwMYLLtTwjbi4ld EDX1HacPMLvlyEIUz6Y1vaEiHr0cOCdBWNVveyNG1D0iLhdQ/+iEfbc8kfNcYa2g554x iTVGVtYVeLu+xENyE8iRCfNByZ8Z7HAu7h9OOuyRL8u2QtFH/lCia9ApoYTINtfpghtP Ays9yBgvXwbuRi/LQD9Al9UexrQZlzaKzEUsxtHleZyjaYYzOZQvPHv52a5LpBE5u4BY ZJoN6iHZP/zwhqalyDFbCFSeAyFmHFp1eJvMI57UsdACh3eoaxik3sYOuKiePp6PiRTs OC5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717619718; x=1718224518; 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=1vJjuSTFz/Nsj8mn2a+s4dFUk/0rqc2v8wfC3wlpVhk=; b=GRnqW2M8GKAkbA5+W1qynV+cP518J3uVV4T+U0JMNgo2a5P3n2QPn1SPXKqCHR1f1b 2HsFOnlwdt0dWkAhg/M55W5ZshSUfd4vLsEyQ2oK1IGzlj++l5jtXXliYdgfAdX72LDQ KVZcSwBm0DQ6/weAnzPds7es/kpTKvoE1w4LtHgFHYXvjsIEcuz2BXGmNLKAFh/B04h+ vzxaudliu6xbocR0EmRY/FCOtm/q1vbCTYm+FqnWGTkh8q19uKmizYj1VhU/Hmd+wjyE 3ps4U3YbvHuJ7hYhNDmOBrAzNLN7TFUtM2tkN61k/shsYe4bQNJRrm/9wPxAi9FPQzB4 0ooQ== X-Gm-Message-State: AOJu0YwfZNNS9tjJ/VJA9dO3soiPo3gREI0fYW91jgr6SF5pK5JBc+Tq 1RGZW0/r+cRVE65pm8gZ+UUfzXzuNColwHx08EtWKe+MLBF2t6D0Hy/RamrJOMQ= X-Received: by 2002:aca:2104:0:b0:3c9:c2bc:6939 with SMTP id 5614622812f47-3d2044e7d00mr3533666b6e.57.1717619716846; Wed, 05 Jun 2024 13:35:16 -0700 (PDT) Received: from localhost.localdomain (d24-150-219-207.home.cgocable.net. [24.150.219.207]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6afc72485f8sm25359866d6.5.2024.06.05.13.35.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 13:35:16 -0700 (PDT) From: Trevor Gamblin To: linux-pwm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, ukleinek@baylibre.com, ukleinek@kernel.org, michael.hennerich@analog.com, nuno.sa@analog.com, tgamblin@baylibre.com, dlechner@baylibre.com, devicetree@vger.kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [RESEND][PATCH 0/2 v6] pwm: add axi-pwm-gen driver Date: Wed, 5 Jun 2024 16:35:04 -0400 Message-ID: <20240605203507.1934434-1-tgamblin@baylibre.com> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Resending due to missing real name in "From:" line. This series adds support for the AXI PWM GEN subsystem found on FPGA IP cores. It can be used to generate configurable PWM outputs, and includes options for external synchronization and clock signals. The work is being done on behalf of, and therefore lists maintainers from Analog Devices, Inc. The series has been tested on actual hardware using an EVAL-AD7985FMCZ evaluation board. An oscilloscope was used to validate that the generated PWM signal matched the requested one. There was previously a follow-up series (https://lore.kernel.org/linux-pwm/20240314204722.1291993-1-tgamblin@baylibre.com/) that enabled support for two different versions of the AXI PWM GEN IP. Since issues were identified with the v1 IP functionality and v2's regmap is the one listed on the device wiki (https://analogdevicesinc.github.io/hdl/library/axi_pwm_gen/index.html), the driver was changed to support only the v2 IP after squashing those additions. As a result, the overall driver is simpler as it no longer uses an axi_pwm_variant struct. Support for v1 IP can be added back later in the event that it is required. --- v6 changes: * Address feedback for driver in v5: * Add link to public device documentation in pwm-axi-pwmgen.c * Remove unnecessary line split in axi_pwmgen_setup * Remove unnecessary call to devm_add_action_or_reset() in axi_pwmgen_probe * Update documentation link in driver and binding commit messages Link to v5: https://lore.kernel.org/linux-pwm/20240424125850.4189116-1-tgamblin@baylibre.com/ v5 changes: * Address feedback for driver in v4: * Clarify device behavior in frontmatter * Include register name in bitfield definitions * Use devm_clk_rate_exclusive_get() and handle error * Squash v2 IP patches into series from: https://lore.kernel.org/linux-pwm/20240314204722.1291993-1-tgamblin@baylibre.com/ * Refactor driver code to support only v2 IP * Issues were identified with v1 IP implementation, so only v2 will be supported * Remove axi_pwm_variant struct and usage * Version check in axi_pwmgen_setup() left as-is to limit usage to * only v2 IP * Adjust dt bindings to use adi,axi-pwmgen-2.00.a Link to v4: https://lore.kernel.org/linux-pwm/20240301173343.1086332-1-tgamblin@baylibre.com/ v4 changes: * Address feedback for driver in v3: * Update to use devm_pwmchip_alloc() function * Simplify use of dev symbol in axi_pwmgen_probe * Remove unnecessary axi_pwmgen_from_chip function and use pwmchip_get_drvdata directly Link to v3: https://lore.kernel.org/linux-pwm/20240131214042.1335251-1-tgamblin@baylibre.com/ v3 changes: * Address feedback for driver in v2: * Remove unnecessary blank line in axi_pwmgen_apply * Use macros already defined in for version checking Link to v2: https://lore.kernel.org/linux-pwm/20240123220515.279439-1-tgamblin@baylibre.com/ v2 changes: * Address feedback for driver and device tree in v1: * Use more reasonable Kconfig approach * Use common prefixes for all functions * Rename axi_pwmgen struct to axi_pwmgen_ddata * Change use of "pwm" to "ddata" * Set and check state->polarity * Multiply safely with mul_u64_u64_div_u64() * Improve handling of max and zero periods * Error if clk_rate_hz > NSEC_PER_SEC * Add "Limitations" section at top of pwm-axi-pwmgen.c * Don't disable outputs by default * Remove unnecessary macros for period, duty, offset * Fix axi_pwmgen_ddata alignment * Don't artificially limit npwm to four * Use clk_rate_exclusive_get(), balance with clk_rate_exclusive_put() * Cache clk rate in axi_pwmgen_ddata * Don't assign pwm->chip.base, do assign pwm->chip.atomic * Relocate "unevaluatedProperties" in device tree binding * Remove redundant calls to clk_get_rate * Test contents of AXI_PWMGEN_REG_CORE_MAGIC instead of arbitrary AXI_PWMGEN_TEST_DATA in AXI_PWMGEN_REG_SCRATCHPAD * Remove redundant clk struct from axi_pwmgen_ddata * Add self as module author * Add major version check for IP core Link to v1: https://lore.kernel.org/linux-pwm/20240115201222.1423626-1-tgamblin@baylibre.com/ Drew Fustini (2): dt-bindings: pwm: Add AXI PWM generator pwm: Add driver for AXI PWM generator .../bindings/pwm/adi,axi-pwmgen.yaml | 48 ++++ MAINTAINERS | 9 + drivers/pwm/Kconfig | 13 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-axi-pwmgen.c | 241 ++++++++++++++++++ 5 files changed, 312 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/adi,axi-pwmgen.yaml create mode 100644 drivers/pwm/pwm-axi-pwmgen.c -- 2.45.1