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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35565C54EE9 for ; Mon, 19 Sep 2022 06:33:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229610AbiISGdW (ORCPT ); Mon, 19 Sep 2022 02:33:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbiISGdU (ORCPT ); Mon, 19 Sep 2022 02:33:20 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8244317A88; Sun, 18 Sep 2022 23:33:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663569199; x=1695105199; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=r0/uBQA5005Rs7fYs3jAa6s1cVz0tORDno4ZJmynCXc=; b=HfWiTD30ya3KzIEB5BzjcJzveFdfn3v6SzYSsLVyWN+WJJ5dN26yuCBt rD2Y+nR1XPoqOIinwkiWxIEf4Cqr/dljimBFkhVSIOOAd4vgjpn2MKEm5 gCxlYo1Y+Iix0yTx5/PTZFCeDt+LVZJPg4gRiH09HZFXgvJeFaBmFOb76 IRLN8cI4vGhZ7PfM7sBPzzGqEm9lGJ3BpizkJrcEEOlRralNUBFIF3oWe y7rq23XZ065biZfggxpTvcknQhLfuSJsMyTgnf+ceVeWyYMTZGXojftsz 70v3JOFGZ7DpGYFl2awewKsL/+EBeVvWlrx+Hw1zL4vm/kv1mjyC4ln5p A==; X-IronPort-AV: E=McAfee;i="6500,9779,10474"; a="282344198" X-IronPort-AV: E=Sophos;i="5.93,327,1654585200"; d="scan'208";a="282344198" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2022 23:33:19 -0700 X-IronPort-AV: E=Sophos;i="5.93,327,1654585200"; d="scan'208";a="760738803" Received: from punajuuri.fi.intel.com (HELO paasikivi.fi.intel.com) ([10.237.72.43]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2022 23:33:15 -0700 Received: from paasikivi.fi.intel.com (localhost [127.0.0.1]) by paasikivi.fi.intel.com (Postfix) with SMTP id BB04220078; Mon, 19 Sep 2022 09:33:12 +0300 (EEST) Date: Mon, 19 Sep 2022 06:33:12 +0000 From: Sakari Ailus To: Tommaso Merciai Cc: Mikhail Rudenko , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Hans Verkuil , Jacopo Mondi , Shawn Tu , Randy Dunlap , Daniel Scally , Christian Hemp , Laurent Pinchart , Marek Vasut , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] media: i2c: add support for ov4689 Message-ID: References: <20220911200147.375198-1-mike.rudenko@gmail.com> <20220911200147.375198-3-mike.rudenko@gmail.com> <20220914155122.GA9874@tom-ThinkPad-T14s-Gen-2i> <87k064pa2v.fsf@gmail.com> <20220916133401.GB2701@tom-ThinkPad-T14s-Gen-2i> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220916133401.GB2701@tom-ThinkPad-T14s-Gen-2i> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Hi Tommaso, On Fri, Sep 16, 2022 at 03:34:01PM +0200, Tommaso Merciai wrote: > > >> + ret = clk_set_rate(ov4689->xvclk, OV4689_XVCLK_FREQ); > > >> + if (ret < 0) { > > >> + dev_err(dev, "Failed to set xvclk rate (24MHz)\n"); > > >> + return ret; > > >> + } > > >> + if (clk_get_rate(ov4689->xvclk) != OV4689_XVCLK_FREQ) > > >> + dev_warn(dev, "xvclk mismatched, modes are based on 24MHz\n"); > > > > > > > > > What do you think about? > > > Thanks. > > > > Unfortunately, I have no experience with ACPI-based devices. :( > > > > Do you mean that in the case of an ACPI device and devm_clk_get_optional > > returning NULL we should assume that the clock is already enabled and > > will stay enabled during sensor operation? How should we distinguish it > > from the case of an OF-based system and clock just missing from device > > tree? > > Not exaclty :) > > I copy comment from [1] > > if you use ov5693->xvclk to identify the ACPI vs OF use case shouldn't > you use the get_optionl() version ? Otherwise in the ACPI case you will have > -ENOENT if there's not 'xvclk' property and bail out. > > Unless my understanding is wrong on ACPI we have "clock-frequency" and > on OF "xvclk" with an "assigned-clock-rates", Generally yes. It's also possible to have a clock in ACPI based system although those clocks do not come from ACPI. See e.g. drivers/platform/x86/intel/int3472/clk_and_regulator.c . -- Sakari Ailus