Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp68979lqj; Sat, 1 Jun 2024 08:18:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCULUzt/j/P1TWQgXdozLEB0OzOTMiuJlCXeLtcdF9T9UFYlX5+ZuzHqazJ2I7wwqmgzNW2GQopbLojslQI9Gp0HFZEmvCQbvOEuDflrgg== X-Google-Smtp-Source: AGHT+IGzY1GC6Dktq5U1qqBMInGfbdPY6tVQx+pnNj5uIcexWmJbj5NKtWg8OG+ng7funrZQ3+64 X-Received: by 2002:a05:6808:1784:b0:3c8:4214:fe65 with SMTP id 5614622812f47-3d1e347808bmr5854159b6e.7.1717255087610; Sat, 01 Jun 2024 08:18:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717255087; cv=pass; d=google.com; s=arc-20160816; b=XnIJaAfPUlH75FGeHMySzXOGYnBe+uT2+fWPhjC8UnbW3SL7AyCuoOGwGCZ6diyyxa 1OtFo0v2vSU214CCryfi4PJkbM04WEs35kqNXJ8eEYrkeqW74Mc6Zbq0beqZHd63DmSJ 0IIyjmSzVhhw2lRKALTgsDLmPeHfWj/e+FkASEzNqBvI5IwI+8c/+oTYWs+J0DY6SMfK NjhP+EGnv3LmiZR2RomT2sBfqYDZp8bAjkFkI+NA7zPi/Qnmaj0UOIVXC5juY+om1u6x UQ2dYsVBQrROUU6je5gGU1+gXshLR24MxMWiFoeAFxl4rNlsQ9NLTlhz5Orzd/oSmuxh hcPA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :from:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=Gc0PiB9/+lpFeH790GUJxfehuXfDL9d8PfqttuVMRqg=; fh=yb0LZOmp/gapB9NwqmOuxGEgRgKAL/ooZp54UG24wII=; b=MMZR50sekDBGwXBFJmh9cArz1gn8Y/aWL/HCdpCgBHb3OzVPsktkNS8jPeLAY88fG+ 1/gWOxwONcGHBabu2Z4g8ibVw5OWXwMw2eBAsMzDCt68kQ9wTEAhVf9EehfhA9kYOg5l 3wRUmD82ziirZon2XlYBWLn9nbTvRjrMUCQzDjmm0F8XNf3h9OBam4UhvLeKdh/dwQcK v/ts5BalFVl4jA8/yLVJdzc5htXbOxR/sxluDobzYa/lItm84c25aNhmEyN+VayTeFYJ blX/n525hLGwY3uVTr4NdmuuLWMFqGLmp4NDxe9IgAMVdBcY4dY8NyRiUPBSPzN1wp9Q eopg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=neoRfGaJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-197926-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197926-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4a733f77si46483886d6.105.2024.06.01.08.18.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jun 2024 08:18:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197926-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=neoRfGaJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-197926-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197926-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 423181C20BFC for ; Sat, 1 Jun 2024 15:18:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3AA6A1527B7; Sat, 1 Jun 2024 15:17:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="neoRfGaJ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 253F710949; Sat, 1 Jun 2024 15:17:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717255077; cv=none; b=PK1+z2Q8diavpFAUrhcJWdm1kalPI4+K2xWt9lIGlVelRwduOSICw508HC7aCZKVFalQFEAqkap79ziE/lsVa0suZN2uDB4lUp5uAo1/Ywer+YF4/z3hDr1TUYCnH+l7XkjQFXJKgYfJ860wlq4jzfIbDH+6AD9z0LR9f8UPHV4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717255077; c=relaxed/simple; bh=MiheRmDa9YIwfK0COcyZiMZofO0kN5bJO2zbV82w0Q8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dPipJJiysFYx8ygxjEObwv/iEXMYuebTLeVWJwgoXssubOjhkAi9jXaC83sa9XPZYL4TmP/eMoqbz5J8Z1rc3Nkd5aEh6l7Pg656EDPZYXFhRdNxJfh7P18mp8/YOSoTzwQbKNL0WEW0//eJmHpTOQqiDmdIYkEmRB4NyEnj54c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=neoRfGaJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28E88C116B1; Sat, 1 Jun 2024 15:17:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717255076; bh=MiheRmDa9YIwfK0COcyZiMZofO0kN5bJO2zbV82w0Q8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=neoRfGaJsRFWOk1FaODamSrVPP9Mkt05R2gvMBipBnzK1gyg+ILcqorphKVKXP7Gs F/R4Odn6vSj9GoNdKKK3FYuEB+UWeeTe0ceeBrwyPkZ2HsXvXMJdTUKFpNjGUC4lqW jpKJONY/2Yw1n2vrfXULQcfubiHTr6FYDdxpIOJ6vG+LdNB1Mh5SW8UVUHipwo8G++ 49rP8vVdhEOxQpE+M/kQzy43pt0aeAgPylF8ofIkz15XsbAJVnXd8q1eL3iYrynKPb 2zkxDRnj0veTWOOgfykURUV6zWrRKZfuCj8/xqemaiA8jWzGLV9B4bw4ZcqAHZvwOa hMjCOb4ycNi2Q== Message-ID: Date: Sat, 1 Jun 2024 17:17:51 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 5/5] dt-bindings: pwm: sun20i: Add options to select a clock source and DIV_M To: Hironori KIKUCHI Cc: linux-kernel@vger.kernel.org, =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Aleksandr Shubin , Cheo Fusi , linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev References: <20240531141152.327592-1-kikuchan98@gmail.com> <20240531141152.327592-6-kikuchan98@gmail.com> <851280ad-ac0e-47d1-99e2-4f3b5ea29f2f@kernel.org> From: Krzysztof Kozlowski Content-Language: en-US Autocrypt: addr=krzk@kernel.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewARAQABzSVLcnp5c3p0b2Yg S296bG93c2tpIDxrcnprQGtlcm5lbC5vcmc+wsGVBBMBCgA/AhsDBgsJCAcDAgYVCAIJCgsE FgIDAQIeAQIXgBYhBJvQfg4MUfjVlne3VBuTQ307QWKbBQJgPO8PBQkUX63hAAoJEBuTQ307 QWKbBn8P+Q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9hmCEuNSr+CLMdnRBY fv0= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 31/05/2024 19:57, Hironori KIKUCHI wrote: > Hello, > >>> This patch adds new options to select a clock source and DIV_M register >>> value for each coupled PWM channels. >> >> Please do not use "This commit/patch/change", but imperative mood. See >> longer explanation here: >> https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95 >> >> Bindings are before their users. This should not be last patch, because >> this implies there is no user. > > I'm sorry, I'll fix them. > >> This applies to all variants? Or the one you add? Confused... > > Apologies for confusing you. This applies to all variants. > >> >>> >>> Signed-off-by: Hironori KIKUCHI >>> --- >>> .../bindings/pwm/allwinner,sun20i-pwm.yaml | 19 +++++++++++++++++++ >>> 1 file changed, 19 insertions(+) >>> >>> diff --git a/Documentation/devicetree/bindings/pwm/allwinner,sun20i-pwm.yaml b/Documentation/devicetree/bindings/pwm/allwinner,sun20i-pwm.yaml >>> index b9b6d7e7c87..436a1d344ab 100644 >>> --- a/Documentation/devicetree/bindings/pwm/allwinner,sun20i-pwm.yaml >>> +++ b/Documentation/devicetree/bindings/pwm/allwinner,sun20i-pwm.yaml >>> @@ -45,6 +45,25 @@ properties: >>> description: The number of PWM channels configured for this instance >>> enum: [6, 9] >>> >>> + allwinner,pwm-pair-clock-sources: >>> + description: The clock source names for each PWM pair >>> + items: >>> + enum: [hosc, apb] >>> + minItems: 1 >>> + maxItems: 8 >> >> Missing type... and add 8 of such items to your example to make it complete. > > Thank you. I'll fix it. > >> >>> + >>> + allwinner,pwm-pair-clock-prescales: >>> + description: The prescale (DIV_M register) values for each PWM pair >>> + $ref: /schemas/types.yaml#/definitions/uint32-matrix >>> + items: >>> + items: >>> + minimum: 0 >>> + maximum: 8 >>> + minItems: 1 >>> + maxItems: 1 >>> + minItems: 1 >>> + maxItems: 8 >> >> This does not look like matrix but array. > > I wanted to specify values like this: > > allwinner,pwm-pair-clock-prescales = <0>, <1>, <3>; > allwinner,pwm-pair-clock-sources = "hosc", "apb", "hosc": > > These should correspond to each PWM pair. > This way, I thought we might be able to visually understand the relationship > between prescalers and sources, like clock-names and clocks. > > Is this notation uncommon, perhaps? It's still an array. > >> >> Why clock DIV cannot be deduced from typical PWM attributes + clock >> frequency? > > This SoC's PWM system has one shared prescaler and clock source for each pair > of PWM channels. I should have noted this earlier, sorry. > > Actually, the original v9 patch automatically deduced the DIV value > from the frequency. > However, because the two channels share a single prescaler, once one channel is > enabled, it affects and restricts the DIV value for the other channel > in the pair. > This introduces a problem of determining which channel should set the shared DIV > value. The original behavior was that the first channel enabled would win. There's nothing bad in this. > > Instead, this patch try to resolve the issue by specifying these > values for each PWM > pairs deterministically. > That's why it requires the new options. This does not solve that wrong divider can be programmed for second channel in each pair. Best regards, Krzysztof