Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1453601rda; Mon, 23 Oct 2023 13:07:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEl3JZa9He4k7zM9ei/MIGp+YuLFlVMpzkgyMZ6cil8CvuuE2DvperRvBk3tRZ453rZqfMp X-Received: by 2002:a05:6a20:440b:b0:159:f884:4d6e with SMTP id ce11-20020a056a20440b00b00159f8844d6emr754107pzb.40.1698091660864; Mon, 23 Oct 2023 13:07:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698091660; cv=none; d=google.com; s=arc-20160816; b=d+Hlre92dGITZ7lel/Q1eO8i8o/LVWFF2gPfiRTcTlASeb18pXmeos8L5Pnbr4eTCA HCKOwMDdl0WmAur+lXdbcrL/wRrScjYWnUwtaPUp/VpSArtDZkqkovmW2S7K8oHmGdbI NpoASleG+h/8pHeNdw0abJNxhnRrvySmCRGf9oeRBmhBpzSLQLi8YoSQuTrBF8mhVyyN wKgvX7/6ENau4aw8fqC8YzYXhWBK4PcGwt6Hu8k90AVaOZkrSoBlWyfEtqnVhERp8qqt pD18pV0KWFuplS85waA20YaKY1sH7b5K8/wgSoePjsuyL2tTN4Dji/xLdfuu8IAyxxu+ h0Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature:dkim-filter; bh=6nprZO3dzKZSeMwqmtQlXFQ3CBnQLenNbiuNbUHf8kU=; fh=ebDwXqOyy0pzXMbvTf2Nw1sCzNwyId7WjjmpDv0CsBs=; b=ky1ZATiRW1IfTnMD1+oPeQB4tDw1HocpLTkoPSYoqsq72oQJEcQRfFKckz/ZHG4H3Y tWHZBgBP4r7aSq2SOvo2k1NnN1ywPcJgKPvazFKdWm3o0glWMJwm7VqKfI/EWnn1Dvf4 4SJuIXsCarxUpD2Tr8Q22r0USeLxS9WiycwjgfKbprli9MhZHCVKRMe+xf62pZ5zggHP sr/l1sqREMGcE695sJvkwM6d5HbIFS5eWkB3o6CMB91J6vuQC0Y7EClvX0z4t5HPOHKs XK9OprYdIHsNFogkv3CWIPdZOJdrpdnA9XioH9HkvwIo1SIENVwsbJkrsufN6dPg8bum Ea1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=tkrlIrhp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=salutedevices.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id e11-20020a056a001a8b00b00690feb23e3esi7298692pfv.17.2023.10.23.13.07.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 13:07:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@salutedevices.com header.s=mail header.b=tkrlIrhp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=salutedevices.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 7F7D9806E3F3; Mon, 23 Oct 2023 13:07:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230246AbjJWUHb (ORCPT + 99 others); Mon, 23 Oct 2023 16:07:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229829AbjJWUH3 (ORCPT ); Mon, 23 Oct 2023 16:07:29 -0400 Received: from mx1.sberdevices.ru (mx2.sberdevices.ru [45.89.224.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A4E4D68; Mon, 23 Oct 2023 13:07:27 -0700 (PDT) Received: from p-infra-ksmg-sc-msk02 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id D5EB6120014; Mon, 23 Oct 2023 23:07:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru D5EB6120014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salutedevices.com; s=mail; t=1698091644; bh=6nprZO3dzKZSeMwqmtQlXFQ3CBnQLenNbiuNbUHf8kU=; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type:From; b=tkrlIrhp/4WgQfs8TbMCH/7ZNqvAq47LWAm85Ym2H5td7RCq64AH2Ige5Kxl7Cuv2 f0PYoVvzkryj2McKPii14GPp8+tTnax5CX8gmvmkZ2Hu7XX+GXi+kT2Oql403afsyh BwxrtPMierl8ZjlHyp4ypiJGV5oOTyCEmFfMqYBSOCpoJao3IRo+y7fLwTvlc5ISzS zXAITWdhebzq2rMbZBQIxf/m9cCrFyzjyBOUlYaah4KZ/YJ8OLl/PXEiIzA0YpLLqY KnicpAlJD8tsrGSoU0Ns0af5+Ozj+53KkJlsHYAeLxnbbDMBSKrKyrjGYF6cOrxcQE tmLoSPVyT5dhA== Received: from p-i-exch-sc-m01.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Mon, 23 Oct 2023 23:07:24 +0300 (MSK) Received: from [192.168.1.127] (100.64.160.123) by p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.37; Mon, 23 Oct 2023 23:07:24 +0300 Message-ID: <10dcc778-f165-407e-b765-760d277d5e35@salutedevices.com> Date: Mon, 23 Oct 2023 23:07:46 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V3 RESEND] pwm: meson: add pwm support for S4 Content-Language: en-US To: JunYi Zhao , , , , , , , , , , References: <20231016052457.1191838-1-junyi.zhao@amlogic.com> From: George Stark In-Reply-To: <20231016052457.1191838-1-junyi.zhao@amlogic.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) To p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 180818 [Oct 23 2023] X-KSMG-AntiSpam-Version: 6.0.0.2 X-KSMG-AntiSpam-Envelope-From: gnstark@salutedevices.com X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 542 542 3d23828e213bab96daa5e52f9cef518f74e40214, {Tracking_from_domain_doesnt_match_to}, salutedevices.com:7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;p-i-exch-sc-m01.sberdevices.ru:7.1.1,5.0.1;100.64.160.123:7.1.2;127.0.0.199:7.1.2, FromAlignment: s, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2023/10/23 18:09:00 #22267281 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 23 Oct 2023 13:07:38 -0700 (PDT) Hello JunYi Zhao On 10/16/23 08:24, 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; may be bool 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); > + 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 -- Best regards George