Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp652426ybb; Wed, 8 Apr 2020 07:23:44 -0700 (PDT) X-Google-Smtp-Source: APiQypJ582jiKX2VsuGsQucEcwKx8rfAJP8db8vSz4i0GnfoJHNwf6ekrp/8w+JwG8Umtx2W9MFJ X-Received: by 2002:a9d:8e4:: with SMTP id 91mr6132466otf.130.1586355823815; Wed, 08 Apr 2020 07:23:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586355823; cv=none; d=google.com; s=arc-20160816; b=vw97nyseB5jBlGHzCFrxIVBjZYfj9W7ipYDd+Hm9a3FhmBPYBaWkJlvcyy+Wb6DfO3 MV//Sh7sKCjE4Fd7TLe64Ar3tmKS3V1qFHHqmVzzQBY/ahZS2YMH5PV1C93kvqurrXBG tdgeFCni1IieYmXane7Fx+sqqHjiBN7odhaEJKsWYoejx7KwfbydzFfZQaU5ogJtvcJK unAWU7rCwWS0qeVqQUvJ+/9mNxueeGab8YH8fSb81kEVJvP9nn2OJIouqiXzR//OPmi3 duh8H4udDGm87zrwQ5TtVT4GxImkz1fPmsNK9aBAMGu+0UjUq9qmAcKAkzDoeKwFtgx6 pHRw== 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=xa0jsgSZvhAu9qLIAzgdV/p9IbYtIZxjPtuYfg0RgUo=; b=apznfJHsLr+yh2iUCPTSYmzCUPwTN4zL+xvDvmBcEf6FmI4G+BpuQCg2rJHjtcKoHr 89mWLW5wq28aTSjNbKUpNhNaL2W9IR+H5KKl5nj1UYigSBL9Ut0V+sUpaO6JtR179cpj eXxtfEXwQ6e5neAH1+COfiITbSHO4FfzmhAtpOggoLHqqpN2OSGdDmM0271TowSEc4tM wxA+FNBcRElTDnZimT9p1F8s2TSM7/5CBdpdW+Mm1n081LgT+ZZ150S8dDohx1AYg6KV xZY0bW9f5r4VqQx6mlJkUzs7lz2hNeL5f45Ytz5wfMqvznBGePXlCXYekqm7raU9dKRq hI2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gRUviviq; 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 u137si1932114oie.160.2020.04.08.07.23.29; Wed, 08 Apr 2020 07:23:43 -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=gRUviviq; 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 S1728749AbgDHMfq (ORCPT + 99 others); Wed, 8 Apr 2020 08:35:46 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:33615 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727883AbgDHMfp (ORCPT ); Wed, 8 Apr 2020 08:35:45 -0400 Received: by mail-ed1-f66.google.com with SMTP id z65so8407856ede.0 for ; Wed, 08 Apr 2020 05:35:42 -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=xa0jsgSZvhAu9qLIAzgdV/p9IbYtIZxjPtuYfg0RgUo=; b=gRUviviqC24Bj2U3Aq5OtUVPx4mO/jN9xEiRvX1d8xksOHMUV5rC78+7W/a4siaB10 077PCLjkA2BvcXkMnv4yQvhjlOYbiN4mpyA4F1gKZ4B/HwRcWwVNoU7bRMc54IgrN6M7 v1vcBIktG7POpd86IWze0cJXJSEABoW2/Ykb4= 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=xa0jsgSZvhAu9qLIAzgdV/p9IbYtIZxjPtuYfg0RgUo=; b=aovltaciw5zGQKR7+iXZ6fk0qE5WmsZtrZ+uBoZVnEy3NEiQUrOhqegaM2Re0rwgDz QvlIKhs/GKqeQOSYOtyH9gp+ii5jI++LVJYGCg5qFPECZ9xBjd+BEGlfQpBxfTWfFqwX 697GGid//k4ivBHHNyM3tlNMjui39cdEiaxxuCSLzBwjfC9LkAk2xKY6XmOjs7n9cIbv F3cKof+w6UlTFYinrlRHB6fAC5eF8EXd0JY20U3yK4qZkWdkCvkkhYtijRER1WLHzJ4l eOCyfhftS4wqoEHfhrCndIsmtzRC0QtHxieu/5v8KXOmPDtQqg+cK9fmT5Ljw7mMmWwm RfDQ== X-Gm-Message-State: AGi0PubhdF199/mAgWh6eX0b8/DxuN7Fnx2dYAfMzb1FpA12yNe6zZIW /e6Ld6MiEvOJfbaUmAyFXbPuKfZ++sBI1A== X-Received: by 2002:a17:906:66c1:: with SMTP id k1mr6656259ejp.208.1586349341060; Wed, 08 Apr 2020 05:35:41 -0700 (PDT) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com. [209.85.128.48]) by smtp.gmail.com with ESMTPSA id o15sm3503111ejb.71.2020.04.08.05.35.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Apr 2020 05:35:40 -0700 (PDT) Received: by mail-wm1-f48.google.com with SMTP id f20so5257313wmh.3 for ; Wed, 08 Apr 2020 05:35:40 -0700 (PDT) X-Received: by 2002:a1c:9e08:: with SMTP id h8mr4273596wme.183.1586349339478; Wed, 08 Apr 2020 05:35:39 -0700 (PDT) MIME-Version: 1.0 References: <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> <20200407172035.GM6127@valkosipuli.retiisi.org.uk> <20200408122127.i27hrmjh3pbjeulk@gilmour.lan> In-Reply-To: <20200408122127.i27hrmjh3pbjeulk@gilmour.lan> From: Tomasz Figa Date: Wed, 8 Apr 2020 14:35:28 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6 1/3] media: dt-bindings: ov8856: Document YAML bindings To: Maxime Ripard Cc: Sakari Ailus , Robert Foss , 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 Wed, Apr 8, 2020 at 2:21 PM Maxime Ripard wrote: > > On Tue, Apr 07, 2020 at 08:20:35PM +0300, Sakari Ailus wrote: > > On Tue, Apr 07, 2020 at 06:46:06PM +0200, Tomasz Figa wrote: > > > 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. > > > > That's possible, yes; in this case there wouldn't be a guarantee the > > frequency wouldn't be far off. > > assigned-clock-rates is really fragile... There's zero guarantee on > how far the actual rate is going to be from the asked one, but more > importantly you have zero guarantee on the time frame that rate is > going to be enforced for. > Is there such a guarantee if clk_set_rate() is called? > It's simply going to change the rate as a one-off thing, and if > there's the next millisecond someone else is going to change its rate > one way or another, it's going to do so and you won't have any > notification. > > And even semantically, they do not share the same meaning at all, so > we should really stop using assigned-clock-rates if we can, instead of > pushing it. > > Maxime