Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2948032ybx; Fri, 8 Nov 2019 11:42:42 -0800 (PST) X-Google-Smtp-Source: APXvYqxlRPO1CXRPhvXTK5clFZrV1Zr+KHkPI8vndwzucsXrGCt5kNIsUqcdp+uXN660L0eNFi3L X-Received: by 2002:a50:a7a1:: with SMTP id i30mr12149338edc.94.1573242162160; Fri, 08 Nov 2019 11:42:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573242162; cv=none; d=google.com; s=arc-20160816; b=ABSfxEquogfTP2UELLZZhLwb10P91MaZnwr/eHsn18EeIKPphyI18Hg3IYNMuClHer PnEjOzQC7m8+oyEDyhkQR6nQGxd61oBEwOrEj/PDJMdmDDIJNoZHSTsCAFsrfp/7muKO +ZmtcaEHegTTvKnLW3oGGiUcf/Erpqvcdo8srBNvHzNYBXlu+LhTsiQoVk27copr04xh ad8NHXcDxkvIqJUDHZOA6o9sGpcpyRsd9LtVkDzYloidS2Gd+omv9P1r5gZyvWOAafoB 36qUuTWmjsp1MG58CsA0aZ5mtoRjJslUtfXRzr7AneFji7q0yd3EhU+jNWdF98itNyJy UwFw== 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 :in-reply-to:references:mime-version:dkim-signature; bh=PyL7QIbbkltCxwaoH07IawNE2jNHVrqm8WyCOzItjeg=; b=gF+o2P0O8uymardqe2VYmP4D7vq+P+Vsf/ZUwDuYZrEp2NuMlDBRkeqIHMDMmTIOuZ rZNn3WBcXqWIcFUj+KlQO/7oGyIi2sRfIdl/WncIQmDgiUd/L5S7uKPhVpx2rOVmZT4L zMAEYrOb1kLAP+Qi9xcYM0gqSHffxfeBhC/TFnZGi0gFJP5jN/4xPdJbE9TywOSv3Rh3 TSg57YVLJKqMy9kockUD+MRhTycJe5wactNsYE0EF+bFj8BcbQ9OWhPhjo4b2Fgu/+D/ Dsd6eLF7wKn5dYV2uN3/Dq4EHLSAp9L79PEjiHsVDEPbyfA5q1EAt3o3Uz5e+vTHocSd NrkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=URngXFsF; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i7si4807412eda.375.2019.11.08.11.42.18; Fri, 08 Nov 2019 11:42:42 -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=@chromium.org header.s=google header.b=URngXFsF; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389449AbfKHTlF (ORCPT + 99 others); Fri, 8 Nov 2019 14:41:05 -0500 Received: from mail-il1-f195.google.com ([209.85.166.195]:33321 "EHLO mail-il1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389262AbfKHTlF (ORCPT ); Fri, 8 Nov 2019 14:41:05 -0500 Received: by mail-il1-f195.google.com with SMTP id m5so6185175ilq.0 for ; Fri, 08 Nov 2019 11:41:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PyL7QIbbkltCxwaoH07IawNE2jNHVrqm8WyCOzItjeg=; b=URngXFsFBSlORoHTddkypzyzZQFTUiLnXUkdZpuMXhrfMjZG2m3oD/USA9MmfowJrk BMrMYPwPxK6xydfQPU3kY847M5KyFEeuL1Ogm/eD6iLT+1zj8wPSvAQtT56S3GJrn6I6 7YA+MRoku5DcTPQ4B05MB6Wm1oMj1BTNXV248= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PyL7QIbbkltCxwaoH07IawNE2jNHVrqm8WyCOzItjeg=; b=khWdqRfT9GbKs73g1NEtWqYxoihS+II9wCwQSdnNTrnPOrQZb5iiF2DNlZQanSaOgE V1ouis39AF5Rw/CgOiD6bkuVWEpgEmuqw02lC9qNcN5W9SWM64yRfEGzi7sxQhGvIMmD 2wJaTZYXhSRIVgnFubYLt6IQqQ7G/CxV2/511aG03st6lPl1iIfKX2aA/qu4i8+Xw547 RdC3W7cOAuA+hLTpLKMxNCMW9Ydcqp1L/CDr0CBHEqUKaWfBcRi04U06BTbHM8Cr0wnA B1RufmUVnVpJ1lbGavspHAFsBRqhMlDoDVlfLc5/24EbL2mxtkpiTvhwsPU7v6uidMQn zKTQ== X-Gm-Message-State: APjAAAXqn3zW9YP4cV41SIGTlTEk1JGDFuNQZfOzIOw2uUu6VLPPQIRF NttyrhCir9iwI4mrtgfs92q4VYJcZoqAP77L9lmyeQ== X-Received: by 2002:a92:ce0d:: with SMTP id b13mr14965777ilo.26.1573242064120; Fri, 08 Nov 2019 11:41:04 -0800 (PST) MIME-Version: 1.0 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> <20191108184207.334DD21848@mail.kernel.org> In-Reply-To: <20191108184207.334DD21848@mail.kernel.org> From: Rob Clark Date: Fri, 8 Nov 2019 11:40:53 -0800 Message-ID: Subject: Re: [PATCH v4 5/5] clk: qcom: Add Global Clock controller (GCC) driver for SC7180 To: Stephen Boyd 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 Content-Type: multipart/mixed; boundary="00000000000060dee60596daf6fb" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --00000000000060dee60596daf6fb Content-Type: text/plain; charset="UTF-8" On Fri, Nov 8, 2019 at 10:42 AM Stephen Boyd wrote: > > 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 display > > > > > 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. > > > > > > > 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.. > > > > So the scenario is DT describes the clk > > dpu_node { > clocks = <&cc AHB_CLK>; > clock-names = "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(). > ok, that was the scenario I was worried about (since unclk'd register access tends to be insta-reboot and hard to debug).. so I think it should be ok to make dpu just ignore NULL clks. From a quick look, I think something like the attached (untested). (Sorry, I'd just paste it inline but gmail somehow eats all the whitespace when I do that :-/) --00000000000060dee60596daf6fb Content-Type: text/x-patch; charset="US-ASCII"; name="0001-drm-msm-dpu-ignore-NULL-clocks.patch" Content-Disposition: attachment; filename="0001-drm-msm-dpu-ignore-NULL-clocks.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_k2qjo8of0 RnJvbSAwYTMxYWRiNTk5NGQ1ZGY0YzMzOTM2ODdiNGM2MDg0MDA1NTAyMjQ3IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBSb2IgQ2xhcmsgPHJvYmRjbGFya0BjaHJvbWl1bS5vcmc+CkRh dGU6IEZyaSwgOCBOb3YgMjAxOSAxMTozODo0NiAtMDgwMApTdWJqZWN0OiBbUEFUQ0hdIGRybS9t c20vZHB1OiBpZ25vcmUgTlVMTCBjbG9ja3MKClRoaXMgaXNuJ3QgYW4gZXJyb3IuICBBbHNvIHRo ZSBjbGsgQVBJcyBoYW5kbGUgdGhlIE5VTEwgY2FzZSwgc28gd2UgY2FuCmp1c3QgZGVsZXRlIHRo ZSBjaGVjay4KCkNoYW5nZS1JZDogSWIyNzI1YTQ0YTBhYjA3MGU0NGUwYzNkYTVlYWM5MTg5OTky YTQ1MTcKU2lnbmVkLW9mZi1ieTogUm9iIENsYXJrIDxyb2JkY2xhcmtAY2hyb21pdW0ub3JnPgot LS0KIGRy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