Received: by 10.223.185.116 with SMTP id b49csp1031789wrg; Fri, 16 Feb 2018 11:08:51 -0800 (PST) X-Google-Smtp-Source: AH8x224lHzHcRmvrWs9asfGYSL1jN9PgvOZ5s4v7aJpH5BEcclr9xqAkkyR1zGd6xWXFaHZkmC5W X-Received: by 10.98.141.66 with SMTP id z63mr6929153pfd.165.1518808131212; Fri, 16 Feb 2018 11:08:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518808131; cv=none; d=google.com; s=arc-20160816; b=c8CZwIy3zWEsRqNLzifMRieW59OR/hmv3/Y9ZhofspHUH3p5zy2oQDw2Q1BtFAK/2c BWEiSuX2zVwDszIA1nvNivCKdzWkkBUrOMGbNNIsX5fGKcOA2GduKqfNX3QYQRL6rky9 t3pjVl4o82cqxfGBiHgPW2tMD8ZMCfAvStndW3LpYScIHJP6Rd4ZxQvmwKi6Po3klCQ4 iLunl2MrzirLSc5XMcLsyVoNcZ5ayzVhURiF1fPT+sXG1jNvPGCimk1Cqhu2WBFDcOZn +2TIz/x3IjCKEYOYhpoQujZaM6RAYPgVuEDYjDEKUq/QwhGOq3++/im0EEy0sBXBb7pb 3zLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:arc-authentication-results; bh=fkmX66hKZfU1heI8YvDxRqkiF3eZAsD8hvXsPMd85Dk=; b=AKNTwI6vQYKJoO/KzmFcf3+jFqRob4Yt+g7Nfxx9guS6gzBj2iVlWQ2d+VtopK8tRG eRZM/UHJtK2E/1mOGb6TDOeH3Gh1wLQsq61kit2kDeFDIsHMxQ5t7m75+VfqpU8SpIRu ThCGyYJXMLvytuDRcCDV1/mfGwhGOdaeNhfo1cTaiECU2QiFIGTeT4xt6UDJTRO2PNrD rpyjeOlTQY3P/e9QrilRt7K+xB3RE4TNnpUU+LKQ8lfDKabmR9pVmDowtVNoGcLbBR0+ 2S6usYvJ2z7VlJbkwaAik68v4KBEqpe+h5WTILVt8gpf8jkaJtStLAm77guNkAuot2Kz bVIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1si67456pgc.593.2018.02.16.11.08.37; Fri, 16 Feb 2018 11:08:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030393AbeBPNPk (ORCPT + 99 others); Fri, 16 Feb 2018 08:15:40 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33578 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030316AbeBPNPj (ORCPT ); Fri, 16 Feb 2018 08:15:39 -0500 Received: by mail-wm0-f67.google.com with SMTP id x4so5491025wmc.0; Fri, 16 Feb 2018 05:15:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=fkmX66hKZfU1heI8YvDxRqkiF3eZAsD8hvXsPMd85Dk=; b=XOLG2M//9Lf7gM6hq9wSh1W/UtoQGWYCjXK07Y3Bn+EbbXF3/FZiCqc2+RwieV2sAb AvoxMc0ZfDfNNe2FNU2EDNe2A6Faw09SLGLGEgSvrJKVy9Db7EJaMsx3jGUgBQpgNuYQ qHjFt6sk7OJDXfpxKcvn3mK6NkyBx2l9703SzynQYfDR1lMwEOOG6SK8116mjXLhEOkC iRr/ZEhMISBO2VrWSbmaePOCLA/Gz4OYNVFiMsR7ThCCzwbJQ9g6MngPzD2+vm4YucmL Cdn5QNwJHH6WW/tR4+RaCqfD4l6+aolRB99IBB1hOCNQKJ8kia6YzU8G09ILTCySdSQa A/0g== X-Gm-Message-State: APf1xPDHqxgkHMSBzZpC8rZEoMBnhrvxI+LtybwywKAKJmW8omVKAoPg 9MxATbK1dkNALkkwgj18C4QbcIcp X-Received: by 10.80.194.193 with SMTP id u1mr8123142edf.88.1518786937725; Fri, 16 Feb 2018 05:15:37 -0800 (PST) Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com. [74.125.82.41]) by smtp.gmail.com with ESMTPSA id h2sm11661226edc.13.2018.02.16.05.15.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Feb 2018 05:15:37 -0800 (PST) Received: by mail-wm0-f41.google.com with SMTP id k87so3120832wmi.0; Fri, 16 Feb 2018 05:15:37 -0800 (PST) X-Received: by 10.28.3.65 with SMTP id 62mr4727215wmd.116.1518786936671; Fri, 16 Feb 2018 05:15:36 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.134.148 with HTTP; Fri, 16 Feb 2018 05:15:16 -0800 (PST) In-Reply-To: <20180216130741.jjtjwbnjcmsnz3ds@flea.lan> References: <20180214135612.21356-1-embed3d@gmail.com> <20180215141154.monvwx25awwetqrc@flea.lan> <00ece3d8-52ac-c51d-1867-97f7fd84dadf@gmail.com> <20180216130741.jjtjwbnjcmsnz3ds@flea.lan> From: Chen-Yu Tsai Date: Fri, 16 Feb 2018 21:15:16 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] rtc: ac100: Fix ac100 determine rate bug To: Maxime Ripard Cc: Philipp Rossak , Alessandro Zummo , alexandre.belloni@bootlin.com, linux-kernel , linux-sunxi , linux-rtc@vger.kernel.org, Mike Turquette , Stephen Boyd Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 16, 2018 at 9:07 PM, Maxime Ripard wrote: > On Fri, Feb 16, 2018 at 12:10:18PM +0800, Chen-Yu Tsai wrote: >> > diff --git a/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts >> > b/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts >> > index 6550bf0e594b..6f56d429f17e 100644 >> > --- a/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts >> > +++ b/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts >> > @@ -175,11 +175,18 @@ >> > compatible = "x-powers,ac100-rtc"; >> > interrupt-parent = <&r_intc>; >> > interrupts = <0 IRQ_TYPE_LEVEL_LOW>; >> > - clocks = <&ac100_codec>; >> > + clocks = <&ac100_rtc_32k>; >> > #clock-cells = <1>; >> > clock-output-names = "cko1_rtc", >> > "cko2_rtc", >> > "cko3_rtc"; >> > + >> > + ac100_rtc_32k: rtc-32k-oscillator { >> > + compatible = "fixed-clock"; >> > + #clock-cells = <0>; >> > + clock-frequency = <32768>; >> > + clock-output-names = "ac100-rtc-32k"; >> > + }; >> > }; >> > }; >> > }; >> > >> > What do you think about that solution? >> >> That's not quite right either. As I mentioned before, the >> RTC block has two clock inputs, one 4MHz signal from the >> codec block, and one 32.768 kHz signal from an external >> crystal. The original device tree binding describes the >> first one, and the 32.768 kHz clock was registered by >> the RTC driver internally. >> >> If you're going to add the crystal clock, you still need >> to keep the codec one. Note that this does not fix what >> Maxime is asking you. I've already provided an explanation: >> >> The clock core allows registering clocks with not-yet-existing >> clock parents. Parents are matches by string names. If no >> clock by that name is registered yet, the clock core simply >> orphans the new clock if the unregistered parent is its >> current parent or simply ignores that parent if its not the >> current parent. This is entirely valid and is what we are >> counting on here, as we haven't implemented the codec-side >> driver. > > So, we end up in a situation where clk_hw_get_num_parents returns the > amount of clocks we can be parented to (orphans or not), but > clk_hw_get_parent_by_index will not return the orphan clocks? There is no placeholder for missing parents, unlike the regulator subsystem that has a dummy regulator for this purpose. > That's pretty bad :/ Yeah. I didn't expect this to happen. But to be fair, I should have done the check on clk_hw_get_parent_by_index. > Is there a way to test before registering that all our parents are > actually there? clk_get? That's probably the way to do it. However in the AC100 RTC case, I left it open to be missing on purpose, so we could use the RTC without waiting for the codec to be supported. ChenYu