From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6AFCFA372C for ; Fri, 8 Nov 2019 18:42:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8C64B21882 for ; Fri, 8 Nov 2019 18:42:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573238529; bh=hOLr4d1sakZO1oqZEpnz48GO69KF6YcTrmFsD9e7yRg=; h=In-Reply-To:References:From:To:Cc:Subject:Date:List-ID:From; b=yXYu6f917Dh92MOO+92QBuGzagIrxNUz1ZrCjk3z3RgmQ5CEIjdiIsgPzx6jIYAGu 8ucf1Gl/lIpj85HZEr3ldoerut4TLRUknmLawIPtCAUUDbtKu0RmFw3dlSrdstqSBj Uravr/EnBSpMsRfGFyMJ36hDccNPcMBoT0X8mhhc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729674AbfKHSmJ (ORCPT ); Fri, 8 Nov 2019 13:42:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:46020 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727559AbfKHSmI (ORCPT ); Fri, 8 Nov 2019 13:42:08 -0500 Received: from kernel.org (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 334DD21848; Fri, 8 Nov 2019 18:42:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573238527; bh=hOLr4d1sakZO1oqZEpnz48GO69KF6YcTrmFsD9e7yRg=; h=In-Reply-To:References:From:To:Cc:Subject:Date:From; b=DAJGUlWDjjqC8cVK6Eg38iIC5Cfte0U2YqYLYmhMeSX8xX2TPdI8KnT8b1zIwDIr4 s1zXJd3yv3wJz86WWWGRqBsdUyB75lkVYI7Qz4NE7hIlZyjZF2q7hFH1pANxeKJczw mZKNA9rYKYK0gjQirJEYtw+YTPkR58G26ESxjVSI= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20191014102308.27441-1-tdas@codeaurora.org> <20191014102308.27441-6-tdas@codeaurora.org> <20191029175941.GA27773@google.com> <20191031174149.GD27773@google.com> <20191107210606.E536F21D79@mail.kernel.org> <20191108063543.0262921882@mail.kernel.org> From: Stephen Boyd To: Rob Clark Cc: Matthias Kaehlcke , Taniya Das , Michael Turquette , David Brown , Rajendra Nayak , linux-arm-msm , linux-soc@vger.kernel.org, linux-clk@vger.kernel.org, LKML , devicetree@vger.kernel.org, robh@kernel.org, Rob Herring , Jordan Crouse , Jeykumar Sankaran , Sean Paul Subject: Re: [PATCH v4 5/5] clk: qcom: Add Global Clock controller (GCC) driver for SC7180 User-Agent: alot/0.8.1 Date: Fri, 08 Nov 2019 10:42:06 -0800 Message-Id: <20191108184207.334DD21848@mail.kernel.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Quoting Rob Clark (2019-11-08 08:54:23) > On Thu, Nov 7, 2019 at 10:35 PM Stephen Boyd wrote: > > > > Quoting Rob Clark (2019-11-07 18:06:19) > > > On Thu, Nov 7, 2019 at 1:06 PM Stephen Boyd wrote: > > > > > > > > > > > > NULL is a valid clk pointer returned by clk_get(). What is the disp= lay > > > > driver doing that makes it consider NULL an error? > > > > > > > > > > do we not have an iface clk? I think the driver assumes we should > > > have one, rather than it being an optional thing.. we could ofc change > > > that > > > > I think some sort of AHB clk is always enabled so the plan is to just > > hand back NULL to the caller when they call clk_get() on it and nobody > > should be the wiser when calling clk APIs with a NULL iface clk. The > > common clk APIs typically just return 0 and move along. Of course, we'll > > also turn the clk on in the clk driver so that hardware can function > > properly, but we don't need to expose it as a clk object and all that > > stuff if we're literally just slamming a bit somewhere and never looking > > back. > > > > But it sounds like we can't return NULL for this clk for some reason? I > > haven't tried to track it down yet but I think Matthias has found it > > causes some sort of problem in the display driver. > > >=20 > ok, I guess we can change the dpu code to allow NULL.. but what would > the return be, for example on a different SoC where we do have an > iface clk, but the clk driver isn't enabled? Would that also return > NULL? I guess it would be nice to differentiate between those cases.. >=20 So the scenario is DT describes the clk dpu_node { clocks =3D <&cc AHB_CLK>; clock-names =3D "iface"; } but the &cc node has a driver that doesn't probe? I believe in this scenario we return -EPROBE_DEFER because we assume we should wait for the clk driver to probe and provide the iface clk. See of_clk_get_hw_from_clkspec() and how it looks through a list of clk providers and tries to match the &cc phandle to some provider. Once the driver probes, the match will happen and we'll be able to look up the clk in the provider with __of_clk_get_hw_from_provider(). If the clk provider decides that there isn't a clk object, it will return NULL and then eventually clk_hw_create_clk() will turn the NULL return value into a NULL pointer to return from clk_get().