Received: by 10.223.185.116 with SMTP id b49csp2934561wrg; Sun, 18 Feb 2018 09:57:27 -0800 (PST) X-Google-Smtp-Source: AH8x22734UVwAKyo+H1jdDD+L/qJg5o7aAi7WI8MkER3TTJSHwOax6vG0vN2zkOmLoJVdtpF8drI X-Received: by 10.98.13.24 with SMTP id v24mr1118856pfi.89.1518976647776; Sun, 18 Feb 2018 09:57:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518976647; cv=none; d=google.com; s=arc-20160816; b=hSn75OiPtEcLFtfrplYXwc4Zxibm+mHWh4WPkG3/Qx9W+9dbKtKSkC1AJPWJMu/z3d YZENAgL43OP2AhR1wM/8kStwewTMzk+MCpoaw+3aKIEf6xGdmUb+kXzbEa4THwOYen1Z fzQl1KA7sBTpdP9Jn+G+QjKY1vrYu2hK5I393sErwm1sHOyzjY5Hnq4bEn+yL5bHw6JC GThkK1wmHt+/TCthANNjApatg35cr8jWSZWalYKcLYkyrR9ZWw1RTIttR2mFJ5g8AOJj uRVopK1sIjD3m2mscwQOEdhi5502uEzQa8/AP1w+p9q6rGsyo3f5SpAZJUk08s0Xu1bJ mj7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=MC2+AwmOzrbqWuXpYBHHpfLqf1glhp6ALmFH6OLBZog=; b=bi7fWy9WxHYgTAjIcbTgL4BiAPeWJKr3bKTsHgtb/LrcCDIgbRi9tUS7Jy+4tYrP4/ wRu7bdqxdP8ep5mLRWdj3o7MBY8Khv77xTWzi+o2/JPLF/B66+tw8hoslVlAI6rgpOoC nkwqM6/nzkYaMN70XoliAyK8+eU3l/GTotkTFTkCG8UmFC3th/DTpqpfckgcW3fazEjY p3AzNc1DOR9gxiJAdKqGayRGMGAJ8Qg3IWkiK3KPf4KwFFFn0TTvUHEJJJh/jeuTmJnw H0XY7Ces9DvCjbzJg8p7Iq+uMcq8lXDxlWxNeVFOup4ztArsOIaYwmRofk7sM+r2KWCM 6+nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rFFVS7w5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11si749151pgu.96.2018.02.18.09.57.13; Sun, 18 Feb 2018 09:57:27 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rFFVS7w5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751570AbeBRR4I (ORCPT + 99 others); Sun, 18 Feb 2018 12:56:08 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:45002 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751442AbeBRR4G (ORCPT ); Sun, 18 Feb 2018 12:56:06 -0500 Received: by mail-wr0-f196.google.com with SMTP id v65so7433560wrc.11; Sun, 18 Feb 2018 09:56:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=MC2+AwmOzrbqWuXpYBHHpfLqf1glhp6ALmFH6OLBZog=; b=rFFVS7w5oNAu1MzjYJbeSjd8CQs8LOTTk1JiaI3gDdGbD6BYHGAyxklc9pujpzgEDN sauYrmGH3sHYy3Z4fDwQrx++EJQ+OvJLWLiWL/jysDu8aJ32noeRSAxZIcSJY5IhePBE hEUHtKk5Ao/EGUyDxP3UkVcsnpoPI+0GvOmDdygCzi1lcjOlMpP/d2X9wStzPXLyk5h1 jy51rkszrpEe92nZizTnQ2gnziSxgw/FztcR2FkdK/VuA8myXFrvlFFRjdiUeOeWOI9z FsM5yvTOVw8BEw2ltDNR2vpEgv/8+sgW8dmOlqJr2CP/pk/74N0HHpX51jz2BtNjqkLJ xwWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=MC2+AwmOzrbqWuXpYBHHpfLqf1glhp6ALmFH6OLBZog=; b=FWR+cJmJyWhsW33/IhsvOlprNAaCJSAxUT/otNWQxKKIthUHZjrcxWmQTORFm1hb8e 3Ty0N6PB5i4fg0Bj3D0TsCUe8BhigOui9h/UUE10Q6WgSv9ZsYJ20+L5kfaBt6xzQ6s8 8EI3wI03qgerf8pn8ctXX4f5KR2TIYXbkdLeXk7MDNqnrWTlGSTT4daXmdVegxOxnZwz bMkpQvB7qlBbgJILwQh7d8sTiSROpxe5d/Bf1Ud2Pa8wpuZqKzidrCpcmwx8nsx4H8A/ 1AjHES+C2hpQGfTek0LgpRPvxEeH/C0b9aU7uff6gGH/N4x+TQHN5WFFyl78NWvGPFlx sHhw== X-Gm-Message-State: APf1xPD/URLbKpDSZH9hMQPRzQIbXXuReZX5olJPT1ASxHV6nGbK6+MK TfWqUk/jtVR6qiDmOjcv+4A= X-Received: by 10.223.176.86 with SMTP id g22mr10348190wra.11.1518976565455; Sun, 18 Feb 2018 09:56:05 -0800 (PST) Received: from [192.168.2.62] (p578F04D2.dip0.t-ipconnect.de. [87.143.4.210]) by smtp.gmail.com with ESMTPSA id p5sm24112878wmf.13.2018.02.18.09.56.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Feb 2018 09:56:04 -0800 (PST) Subject: Re: [PATCH v3] rtc: ac100: Fix ac100 determine rate bug To: Chen-Yu Tsai , Maxime Ripard Cc: Alessandro Zummo , alexandre.belloni@bootlin.com, linux-kernel , linux-sunxi , linux-rtc@vger.kernel.org, Mike Turquette , Stephen Boyd References: <20180214135612.21356-1-embed3d@gmail.com> <20180215141154.monvwx25awwetqrc@flea.lan> <00ece3d8-52ac-c51d-1867-97f7fd84dadf@gmail.com> <20180216130741.jjtjwbnjcmsnz3ds@flea.lan> From: Philipp Rossak Message-ID: Date: Sun, 18 Feb 2018 18:55:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16.02.2018 14:15, Chen-Yu Tsai wrote: > 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 > So how should we proceed with this issue? Should I send a new version with a fixed comment or should I implement the check in clk_get function? For the second option I will need about 3 weeks to submit a proper patch since I have the next two weeks some other stuff to do. If a proper fix is required earlier, it might be better if someone else is taking care about a fix. Philipp