From patchwork Fri Nov 17 12:59:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 166163 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp506895vqn; Fri, 17 Nov 2023 05:01:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGq1Txp092lszctFsEw7JP2zNpaa56PycrlLfDfAbtUM1P10NPwLoo8n3UV6Ib5cnKSi2lZ X-Received: by 2002:a05:6870:538f:b0:1d5:aed5:6579 with SMTP id h15-20020a056870538f00b001d5aed56579mr20343338oan.4.1700226061150; Fri, 17 Nov 2023 05:01:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700226061; cv=none; d=google.com; s=arc-20160816; b=xok0/sijeWaJigQUVyLSYIFPoevMu8B+at0+tw1KUBA5JDlgXn47tSQYZg3Io0TSD+ WpHapJx207BupplFxryxPlUt6l31YSm6Ck2b7EWgh7+eRbz2yu6cNfLp7Hp5QkU9FxyH 5mJYZdH0f7tbKnSHZWls4kk+1X27UzAG8mTCEBOCOLYhXaYgpnf9F9wjNI3Ge/St6WFv 7Yk+9RKfmEv9UmjGSfyz2tLBPsKEnsthnwhcL2GdQUdCq7HSAZCBBlX127zpVbOtVxd4 V2uPNkCn7/owe/cNxPEEg4Ge/62HQ4XoAPlC+JstsQHOEtCwaVegxgO5SGjPsmmTu5o5 tsAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ehKsq2eqEr9TyGMWxrUge7Kmly0yBlqo6X+P3u0B3wQ=; fh=njdjvPz/8fUgTR5XHfg4rgXpBE+Eb+Wz3ojami6fduM=; b=SwAswfNH6rmYuj9IViDnufqD+livHH5p0Lprv4W+DLIw+OVBq+MlY2OTWY7gk9fQ1f nceq8MdOynVVTDW4THt/F8NnteNoqToArI7mj0ABUn9wK3quzrv/sf1aDU6h7O8iY0xN zaI0LhU4JuMQKvIQgC4DhLyIL9csf81FocT1f5F9cuuxoBL4i/thmqOeNKods3q3HQwz iIXy2BrM2pMGnsI8ID8/cOO064yOxABWHuuW4COE1pn+Rh9R+bucK6vpIyVXeh4dNLUf DRRtjHgfbSDfPhyA45kvO1D68G+rDGbU4ahMlAJYkUWaiHypAONgmcf8rr2ZSZnAPxqe d6NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=iFlL9k8y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id t24-20020a056870f21800b001ea03cd7fddsi531360oao.197.2023.11.17.05.01.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 05:01:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=iFlL9k8y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 216B080B31F0; Fri, 17 Nov 2023 05:00:16 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346025AbjKQM7l (ORCPT + 30 others); Fri, 17 Nov 2023 07:59:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231358AbjKQM7j (ORCPT ); Fri, 17 Nov 2023 07:59:39 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80A0FD59 for ; Fri, 17 Nov 2023 04:59:34 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40842752c6eso16560715e9.1 for ; Fri, 17 Nov 2023 04:59:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1700225973; x=1700830773; 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=ehKsq2eqEr9TyGMWxrUge7Kmly0yBlqo6X+P3u0B3wQ=; b=iFlL9k8y//xUTs+tOOYlyTZMbZa3ci8nw7R51ub3WXKV4ijOm9uUPKj4xrRJqEp6ui IynFk1gDTdfxQFbwgQCHCxHmZi0BtoFjUnYs0DoM1DL+jahyKsmFkzVpvUloSqyzNVTw cezQizlZjG6Ecy4EeHrGiJlE4EXt3A59awt1Jn2aZcuX2+50KqcG5vas6Li4SdKmpmWQ ItNnWQAJ+69beSJynK+TR6y1NLrsfc79TPhHu1ad6xg329eCQiAFo/bPPBSp+e5Dz4qz 7rekA4uTI9UBmu/02Tkprcptp94cSogb7DXxxyEocpM+rfclEQb5CeQz4MVcWuswiXxB C/3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700225973; x=1700830773; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ehKsq2eqEr9TyGMWxrUge7Kmly0yBlqo6X+P3u0B3wQ=; b=Wy3olp3Ocdxq3p269C59S6zRrGvvwV0Q5XuRYuqJY6tINEzCysxzGHisLPaWbJs2Jh 5NjOpDx6+E7kZzAqonAmAQtO/RdlDTWD6v2184ZXmkvWmoDHxnzEoyGB71iQx38N9U7d 3rmZbyN/cqYEUZurSrbw8HtWbmLhlCcNQ4lAdRUhX4MOKUmhNm1K5Vz1pd2gyImnqREC 4qMdkD8OxGWU9W6nbxBPmUAS2li9EXIkK4/l8YqN5bgHgNhhZBdON07uUuf+sEKK87v6 6/y/rtA386wZB5EkvO9jiDpIFXmFcEMVPB7kzglobjikKdoK0CY2qgysu0E3bmgZE62j i8bA== X-Gm-Message-State: AOJu0YzUxoPjz482V+bAquRnFdtCq4x0UbjIKToHvL/rSYlzF5qTZ+ds 6xEi0Qj9AWMWDi+juK5hePg5Zw== X-Received: by 2002:a05:600c:3548:b0:401:daf2:2737 with SMTP id i8-20020a05600c354800b00401daf22737mr14787836wmq.30.1700225972765; Fri, 17 Nov 2023 04:59:32 -0800 (PST) Received: from toaster.lan ([2a01:e0a:3c5:5fb1:8196:e423:38cb:9a09]) by smtp.googlemail.com with ESMTPSA id k21-20020a05600c1c9500b0040a487758dcsm2671343wms.6.2023.11.17.04.59.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 04:59:32 -0800 (PST) From: Jerome Brunet To: Thierry Reding , Neil Armstrong , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Jerome Brunet , Kevin Hilman , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-pwm@vger.kernel.org, JunYi Zhao Subject: [PATCH v2 1/6] dt-bindings: pwm: amlogic: fix s4 bindings Date: Fri, 17 Nov 2023 13:59:11 +0100 Message-ID: <20231117125919.1696980-2-jbrunet@baylibre.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231117125919.1696980-1-jbrunet@baylibre.com> References: <20231117125919.1696980-1-jbrunet@baylibre.com> MIME-Version: 1.0 X-Patchwork-Bot: notify X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 17 Nov 2023 05:00:17 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782816242274999794 X-GMAIL-MSGID: 1782816242274999794 s4 has been added to the compatible list while converting the Amlogic PWM binding documentation from txt to yaml. However, on the s4, the clock bindings have different meaning compared to the previous SoCs. On the previous SoCs the clock bindings used to describe which input the PWM channel multiplexer should pick among its possible parents. This is very much tied to the driver implementation, instead of describing the HW for what it is. When support for the Amlogic PWM was first added, how to deal with clocks through DT was not as clear as it nowadays. The Linux driver now ignores this DT setting, but still relies on the hard-coded list of clock sources. On the s4, the input multiplexer is gone. The clock bindings actually describe the clock as it exists, not a setting. The property has a different meaning, even if it is still 2 clocks and it would pass the check when support is actually added. Also the s4 cannot work if the clocks are not provided, so the property no longer optional. Finally, for once it makes sense to see the input as being numbered somehow. No need to bother with clock-names on the s4 type of PWM. Fixes: 43a1c4ff3977 ("dt-bindings: pwm: Convert Amlogic Meson PWM binding") Signed-off-by: Jerome Brunet Reviewed-by: Rob Herring --- .../devicetree/bindings/pwm/pwm-amlogic.yaml | 69 ++++++++++++++++--- 1 file changed, 60 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml b/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml index 527864a4d855..387976ed36d5 100644 --- a/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml +++ b/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml @@ -9,9 +9,6 @@ title: Amlogic PWM maintainers: - Heiner Kallweit -allOf: - - $ref: pwm.yaml# - properties: compatible: oneOf: @@ -43,12 +40,8 @@ properties: maxItems: 2 clock-names: - oneOf: - - items: - - enum: [clkin0, clkin1] - - items: - - const: clkin0 - - const: clkin1 + minItems: 1 + maxItems: 2 "#pwm-cells": const: 3 @@ -57,6 +50,57 @@ required: - compatible - reg +allOf: + - $ref: pwm.yaml# + + - if: + properties: + compatible: + contains: + enum: + - amlogic,meson8-pwm + - amlogic,meson8b-pwm + - amlogic,meson-gxbb-pwm + - amlogic,meson-gxbb-ao-pwm + - amlogic,meson-axg-ee-pwm + - amlogic,meson-axg-ao-pwm + - amlogic,meson-g12a-ee-pwm + - amlogic,meson-g12a-ao-pwm-ab + - amlogic,meson-g12a-ao-pwm-cd + - amlogic,meson-gx-pwm + - amlogic,meson-gx-ao-pwm + then: + # Historic bindings tied to the driver implementation + # The clocks provided here are meant to be matched with the input + # known (hard-coded) in the driver and used to select pwm clock + # source. Currently, the linux driver ignores this. + properties: + clock-names: + oneOf: + - items: + - enum: [clkin0, clkin1] + - items: + - const: clkin0 + - const: clkin1 + + # Newer IP block take a single input per channel, instead of 4 inputs + # for both channels + - if: + properties: + compatible: + contains: + enum: + - amlogic,meson-s4-pwm + then: + properties: + clocks: + items: + - description: input clock of PWM channel A + - description: input clock of PWM channel B + clock-names: false + required: + - clocks + additionalProperties: false examples: @@ -68,3 +112,10 @@ examples: clock-names = "clkin0", "clkin1"; #pwm-cells = <3>; }; + - | + pwm@1000 { + compatible = "amlogic,meson-s4-pwm"; + reg = <0x1000 0x10>; + clocks = <&pwm_src_a>, <&pwm_src_b>; + #pwm-cells = <3>; + };