Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4559882ybb; Tue, 7 Apr 2020 09:48:11 -0700 (PDT) X-Google-Smtp-Source: APiQypJHRqLh394O2t65bntIHsMQLI5jI1gxafC49ViBUcWVz9IoWnHv14HbmE5JcAOSWnQuhQxT X-Received: by 2002:a05:6830:1382:: with SMTP id d2mr2250065otq.214.1586278091060; Tue, 07 Apr 2020 09:48:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586278091; cv=none; d=google.com; s=arc-20160816; b=1IFLU4Y6HvgwfNFG7muMY6swStbmI/pobhYpgkaw35N9q3wIEffekpcky3+6b6jrOe NMql1GTCOopcOr8QnwPGOrxU/NWR3bTSwRfnq6gIKPHIRLIhAznf/OLm4vBk0Uldoxas nDjei0zrFDfJUvAh6kT2gatMHh4XoeYqtMch52lQQ2Xp7JQOrR1IC2TwK24S3a9Bz3o2 9V5tHPJ6eseUXcxAq3bhm3YNRC3gl1wmxeaYgVMENvkywXEnCDMJLRlXMfB1mlxo+ArB 7x0+VanuIgCX05p8fo6rX4Lwn57YD+J15Dyb+sStlcnel+WApr0+DB6KiyZFcGQdgaoN LKRA== 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=BMeg8/u+aAWyp+BW+T1dMXhjJgPZOJD50ZkqHJzzRoE=; b=Q70HGl/H8qciUxlSwxp6+3r+PWicnH9l45IBz+KY+s9W6OPxhI3UT6VDjSKygHE3ZB wP3dXg2WdjdeWSGahcmgayquHIj+SGr88g/y082W21T5uVLSqeJ9DOY4CPVSNxWyPzJt reBLgMPC9myJBeRBZhe45pmrb/cE0NMX9mH/IpEOg/TJFlX8mW+Rbo+ic/Qic/ExPxwF WQiMue5rifuLK22UJkpmxwoFGLyJLNMMBF26pmhaXueSZUnnZ2XrFIFyV4bZfCOwC90d 8kdzCZnI5ImpVuWr02KJ1jBhU9vr8UOtnrwojh6ZdQTUMtQPBtlTi2o4CRzFj2tMk7gq B/UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=f5RWEbf+; 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 t83si930981oig.239.2020.04.07.09.47.58; Tue, 07 Apr 2020 09:48:11 -0700 (PDT) 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=f5RWEbf+; 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 S1726634AbgDGQqY (ORCPT + 99 others); Tue, 7 Apr 2020 12:46:24 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:46416 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726332AbgDGQqY (ORCPT ); Tue, 7 Apr 2020 12:46:24 -0400 Received: by mail-ed1-f68.google.com with SMTP id cf14so4833907edb.13 for ; Tue, 07 Apr 2020 09:46:21 -0700 (PDT) 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=BMeg8/u+aAWyp+BW+T1dMXhjJgPZOJD50ZkqHJzzRoE=; b=f5RWEbf+E0nWNJpvEWdEO8ocghgxfw4wvjDh9gLkUt0zvFUzMbiSxfotaP5774Ypuf lTmNnoMP6E7bkI5RDgeZqPaGu2ZZNhCC4a9oR8gdn1sr0AhsRh5VOEIieUEMYhlKwF02 cG9muzV5Wbm2HWH/7PNjnhkB+sSrU9DCGcGwU= 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=BMeg8/u+aAWyp+BW+T1dMXhjJgPZOJD50ZkqHJzzRoE=; b=FSyDUf0jPRQzcHI3HAbNUh8qXK389Ed+qmE8U3zsZpC9eDyRiClAgs7vuns46AuxbY AHj7YdYmSQdQiR7Kkq9PJybajyuP1psFR417oU/avFlC+mQsg9yDTIymb7RWE5VsC5Fp cNA/cSkD/xczVUgy27nybF8zb543RIF498Xb/Oq/1OgDafn2UhBOLMB264yHfKcrEHXI 1RzZ41aZjhXn7opRNdwCsPx9YdWpEoCfEW88wyvDx8szAoMMVMvIs72TZMYiNYPnmgTk PRhDt3Q6dR0MxAt9KoEIMo5rwz+1ryiAJAk7kMOD1pvc+KAEqmAQeJm4mAW215anECEg cZ9Q== X-Gm-Message-State: AGi0Pubn+24E9q5TXfJ7LxCbehx8QnIo/xP70DXjEXD98f9nbVVWWO5q AZ8/Kjq+VeECAJE5VvC7w4noUwe+Z3HRZw== X-Received: by 2002:aa7:d781:: with SMTP id s1mr2796470edq.108.1586277980717; Tue, 07 Apr 2020 09:46:20 -0700 (PDT) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com. [209.85.128.44]) by smtp.gmail.com with ESMTPSA id n21sm115731edo.68.2020.04.07.09.46.19 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Apr 2020 09:46:20 -0700 (PDT) Received: by mail-wm1-f44.google.com with SMTP id y20so2547393wma.4 for ; Tue, 07 Apr 2020 09:46:19 -0700 (PDT) X-Received: by 2002:a1c:a913:: with SMTP id s19mr215349wme.134.1586277979069; Tue, 07 Apr 2020 09:46:19 -0700 (PDT) MIME-Version: 1.0 References: <20200331133346.372517-2-robert.foss@linaro.org> <20200401080705.j4goeqcqhoswhx4u@gilmour.lan> <20200403232736.GA6127@valkosipuli.retiisi.org.uk> <20200404093446.vuvwrhn5436h4d3s@gilmour.lan> <20200406083506.GE6127@valkosipuli.retiisi.org.uk> <20200407083647.4mocdl7aqa3x737q@gilmour.lan> <20200407123232.ktvaifhqntgzvkap@gilmour.lan> <20200407163916.GL6127@valkosipuli.retiisi.org.uk> In-Reply-To: <20200407163916.GL6127@valkosipuli.retiisi.org.uk> From: Tomasz Figa Date: Tue, 7 Apr 2020 18:46:06 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6 1/3] media: dt-bindings: ov8856: Document YAML bindings To: Sakari Ailus Cc: Robert Foss , Maxime Ripard , Dongchun Zhu , Fabio Estevam , Andy Shevchenko , linux-media , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , linux-kernel , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" 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 Tue, Apr 7, 2020 at 6:40 PM Sakari Ailus wrote: > > On Tue, Apr 07, 2020 at 05:47:41PM +0200, Robert Foss wrote: > > On Tue, 7 Apr 2020 at 14:32, Maxime Ripard wrote: > > > > > > Hi Robert, > > > > > > On Tue, Apr 07, 2020 at 01:29:05PM +0200, Robert Foss wrote: > > > > On Tue, 7 Apr 2020 at 10:36, Maxime Ripard wrote: > > > > > On Mon, Apr 06, 2020 at 11:35:07AM +0300, Sakari Ailus wrote: > > > > > > > But that 19.2MHz is not a limitation of the device itself, it's a > > > > > > > limitation of our implementation, so we can instead implement > > > > > > > something equivalent in Linux using a clk_set_rate to 19.2MHz (to make > > > > > > > sure that our parent clock is configured at the right rate) and the > > > > > > > clk_get_rate and compare that to 19.2MHz (to make sure that it's not > > > > > > > been rounded too far apart from the frequency we expect). > > > > > > > > > > > > > > This is doing exactly the same thing, except that we don't encode our > > > > > > > implementation limitations in the DT, but in the driver instead. > > > > > > > > > > > > What I really wanted to say that a driver that doesn't get the clock > > > > > > frequency from DT but still sets that frequency is broken. > > > > > > > > > > > > This frequency is highly system specific, and in many cases only a certain > > > > > > frequency is usable, for a few reasons: On many SoCs, not all common > > > > > > frequencies can be used (e.g. 9,6 MHz, 19,2 MHz and 24 MHz; while others > > > > > > are being used as well), and then that frequency affects the usable CSI-2 > > > > > > bus frequencies directly --- and of those, only safe, known-good ones > > > > > > should be used. IOW, getting the external clock frequency wrong typically > > > > > > has an effect that that none of the known-good CSI-2 bus clock frequencies > > > > > > are available. > > > > > > > > > > So clock-frequency is not about the "Frequency of the xvclk clock in > > > > > Hertz", but the frequency at which that clock must run on this > > > > > particular SoC / board to be functional? > > > > > > > > > > If so, then yeah, we should definitely keep it, but the documentation > > > > > of the binding should be made clearer as well. > > > > > > > > Alright so, let me summarise the desired approach then. > > > > > > There's a separate discussion on the same topic here: > > > https://lore.kernel.org/linux-media/20200407122106.GD4751@pendragon.ideasonboard.com/ > > > > Thanks for the link. > > > > > > > > > ACPI: > > > > - Fetch the "clock-frequency" property > > > > - Verify it to be 19.2Mhz > > > > > > > > DT: > > > > - Fetch the "clock-frequency" property > > > > - Verify it to be 19.2Mhz > > > > - Get xvclk clock > > > > - Get xvclk clock rate > > > > - Verify xvclk clock rate to be 19.2Mhz > > > > > > The current status is that you should > > > 's/clock-frequency/link-frequencies/', and in order to replace > > > assigned-clock-rates, you'll want to have a clk_set_rate to 19.2MHz > > > between steps 3 and 4 > > > > Would we want to 's/clock-frequency/link-frequencies/' for ACPI too? > > I imagine that would cause some breakage. > > It would, yes, and it would be no more correct on DT either. > > There are basically two possibilities here; either use the clock-frequency > property and set the frequency, or rely on assigned-clock-rates, and get > the frequency instead. > > The latter, while I understand it is generally preferred, comes with having > to figure out the register list set that closest matches the frequency > obtained. The former generally gets around this silently by the clock > driver setting the closest frequency it can support. Wouldn't the former actually cause problems, because the closest frequency the clock driver can support could be pretty far from the one requested? (E.g. 19.2 MHz vs 24 MHz) The driver needs to check the resulting frequency anyway. Perhaps a simplified approach of rounding the result of clk_get_rate() to a multiple of 100 KHz and comparing it to the hardcoded value would be enough in practice?