Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2797263rdg; Mon, 16 Oct 2023 15:38:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhL2vCzwl8XQJ9jHBc4rq9xU6fSbiJlQikqn9GAS7wKiq8rGAPm0qnihXhkYZQTp+UIihL X-Received: by 2002:a05:6808:215:b0:3ab:870d:2d49 with SMTP id l21-20020a056808021500b003ab870d2d49mr710534oie.8.1697495905642; Mon, 16 Oct 2023 15:38:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697495905; cv=none; d=google.com; s=arc-20160816; b=NEJ8spmYskcBfbuOMGOlxNf44IKJnYGVTsnWgsP1/w9WN0dZGgLKmwN9t/snwca1Kg zyko7kUXMqeDgOA27p8VhoWtsCSnDGGSvq2SilEzQgcI2L+DBPipKuU/zxKcZWDXG2KH TdCyGtXyaRg4HvHy06hIQX9jacKA2Np98APjUbO+dooBTMVRjfsAoFJ8yeG+7BB+nNg3 p9mv6j3WNwQN/qnV7Qp70QJDmYKRSHHhNeud5ehawIa3cOTYzu0l9sDR5QAUGfemyiQm O6IVPYtlXZZiBsdudR2toOj79RjC9Df8kyaaUU36T2Fz+jCsUpf+yMoY7LE/hfzZOaqS gzRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=i39XjwlxzfyROJL5ZtjDitJDbtBRkjMBcPn9Tiv4fDo=; fh=eIcirgREBuKg2Vpd9aBCc+jP5S5k48EzliQnIfgDUEo=; b=DXg1wU8pYnlv9NhsRY5rU5jFefzB0BKjOmetp2wVBsHoXLdouxkRkIB1s60tx5LJKV 23Og4GUOYq85I8SFZRNEboXktYlQImL6SZh9oegsjJlgvmiYPfYGEcreepqCqbB7QTxH iO0RLGIJJQIe4g0ybujTgg9BSvf5bg7fNwJSmTxKwTZBQNo7AfHJNHW4mImmY9MaNwes lYJuioMEP07QNxCZb6+z+1BZkT7C/OAPfPg72PO578G1OgxstyYpNc8Ho0+C2K9KB1AF 3cZ5tL9rKDiI8BIZaeUETxhZLm2sK1rgkbcBso/5+OOX1PR9V2RmSq/L27Dt+Dnm9Knt SjIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gentoo.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id q6-20020a637506000000b005af4cc9e22fsi271957pgc.840.2023.10.16.15.38.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 15:38:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gentoo.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 42B348044FFC; Mon, 16 Oct 2023 15:38:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232615AbjJPWiP (ORCPT + 99 others); Mon, 16 Oct 2023 18:38:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbjJPWiO (ORCPT ); Mon, 16 Oct 2023 18:38:14 -0400 Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75BC2A1; Mon, 16 Oct 2023 15:38:12 -0700 (PDT) Date: Mon, 16 Oct 2023 22:37:49 +0000 From: Yixun Lan To: JunYi Zhao Cc: thierry.reding@gmail.com, u.kleine-koenig@pengutronix.de, neil.armstrong@linaro.org, khilman@baylibre.com, jbrunet@baylibre.com, martin.blumenstingl@googlemail.com, linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V3 RESEND] pwm: meson: add pwm support for S4 Message-ID: <20231016223749.GA7647@ofsar> References: <20231016052457.1191838-1-junyi.zhao@amlogic.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231016052457.1191838-1-junyi.zhao@amlogic.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Mon, 16 Oct 2023 15:38:23 -0700 (PDT) Hi JunYi On 13:24 Mon 16 Oct , JunYi Zhao wrote: > From: "junyi.zhao" > > Support PWM for S4 soc. > Now the PWM clock input is done in independent CLKCTRL registers. > And no more in the PWM registers. > PWM needs to obtain an external clock source. > > Signed-off-by: junyi.zhao > --- > V2 -> V3: > Rebase and Review the latest upstream code again. > After reconstruction, stick to the previous code as much as possible. > drivers/pwm/pwm-meson.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c > index 25519cddc2a9..fe9fd75747c4 100644 > --- a/drivers/pwm/pwm-meson.c > +++ b/drivers/pwm/pwm-meson.c > @@ -99,6 +99,7 @@ struct meson_pwm_channel { > struct meson_pwm_data { > const char * const *parent_names; > unsigned int num_parents; > + unsigned int extern_clk; > }; > > struct meson_pwm { > @@ -396,6 +397,10 @@ static const struct meson_pwm_data pwm_g12a_ao_cd_data = { > .num_parents = ARRAY_SIZE(pwm_g12a_ao_cd_parent_names), > }; > > +static const struct meson_pwm_data pwm_s4_data = { > + .extern_clk = true, > +}; > + > static const struct of_device_id meson_pwm_matches[] = { > { > .compatible = "amlogic,meson8b-pwm", > @@ -429,6 +434,10 @@ static const struct of_device_id meson_pwm_matches[] = { > .compatible = "amlogic,meson-g12a-ao-pwm-cd", > .data = &pwm_g12a_ao_cd_data > }, > + { > + .compatible = "amlogic,s4-pwm", > + .data = &pwm_s4_data, > + }, > {}, > }; > MODULE_DEVICE_TABLE(of, meson_pwm_matches); > @@ -451,6 +460,16 @@ static int meson_pwm_init_channels(struct meson_pwm *meson) > struct clk_parent_data div_parent = {}, gate_parent = {}; > struct clk_init_data init = {}; > > + if (meson->data->extern_clk) { > + snprintf(name, sizeof(name), "clkin%u", i); > + channel->clk = devm_clk_get(dev, name); use devm_clk_get_optional() which would save you from introducing the 'extern_clk' variable > + if (IS_ERR(channel->clk)) { > + dev_err(meson->chip.dev, "can't get device clock\n"); > + return PTR_ERR(channel->clk); > + } > + continue; > + } > + > snprintf(name, sizeof(name), "%s#mux%u", dev_name(dev), i); > > init.name = name; > > base-commit: 4d2c646ac07cf4a35ef1c4a935a1a4fd6c6b1a36 > -- > 2.41.0 > > > _______________________________________________ > linux-amlogic mailing list > linux-amlogic@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-amlogic -- Yixun Lan (dlan) Gentoo Linux Developer GPG Key ID AABEFD55