Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2189280rwb; Mon, 19 Sep 2022 00:39:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ewMZ1KInp1y6iwhXJnolUMc1leVFUjn+h0KZf7RTx6CS3kb2axukdjKrvdeC5Ij26WfJO X-Received: by 2002:a05:6402:5212:b0:451:6301:593e with SMTP id s18-20020a056402521200b004516301593emr14387584edd.119.1663573143504; Mon, 19 Sep 2022 00:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663573143; cv=none; d=google.com; s=arc-20160816; b=0O3/4b86ddSKaU0pJQutb1jQaitkLW8XXYW+WEijrBf0+yXQT81FLCG2Xq19ODsJuh ptNmoor+Pbeb7dWFYaDd8geBzWgJVCuVFg1DvW+tak230dSKQtn2fc8BHRv2gTHCOGyy wGbNfp7xf+9jOqg+trffpzGzhby4VyL6lgbj8JW6xuTOtHT6mlC3yng2FIzOcUh7sgrj 4Jc/LbmT8t0QqSqClNK/RvfJaz96C28PJGVVJMxzVI4vkl03T4pxEUASYnjx5kaSHdCA oHsFavgPdl8AzjAKvG+c4uUuNQo5/7XAW1L3LECx+2LIKwA5WDj18PY0rKITnbWeEFsg svdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wEdLDJgFEyr3Rx0kdQrhspWlZowoghD3V/H8ktxN3TY=; b=VENJIuA5yjo51ERHTPTjy3r5PYCQ/WEMIi+ChBjeZZzvy4A/XMwJ+YEPM6cLP4dCcw rm9sDRBFMur0JfabNosEdTkvSr5ajTkwBGS2gAk+WchOFZNrP6MYUCwc2faxayHOIF9N 5dMgqfBrBCknDtV1DtGkSqkfomvdBMiL0JsDlGkdvwlwiMlwHqHI79oVxSx/CgvskWDw zaSHEr8J4ZCaAWE0TLiOHhm+VNNJp17ST53niOHUtLj9+LpfDtuloLWn8f4nMyvuxE17 6NNJMulqWPbuHGU3Xv/Hg+6hFDq7vQFgNDxbG5n5Fxtq8sAekqQqmbW+fdbpk5Du4Rf2 p14g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=OgBqv3IZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f19-20020a056402355300b00446d2c52ca7si9572082edd.127.2022.09.19.00.38.38; Mon, 19 Sep 2022 00:39:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=OgBqv3IZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229679AbiISHIW (ORCPT + 99 others); Mon, 19 Sep 2022 03:08:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229810AbiISHIU (ORCPT ); Mon, 19 Sep 2022 03:08:20 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 335CC1CB28 for ; Mon, 19 Sep 2022 00:08:18 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id r7so4928217wrm.2 for ; Mon, 19 Sep 2022 00:08:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=wEdLDJgFEyr3Rx0kdQrhspWlZowoghD3V/H8ktxN3TY=; b=OgBqv3IZzdUFqvuLhn6EFV4R9bDvxhESon8U4vW40j+TSLmigg9qsdpoGxMi5BPLLg 0unGK3NEoyGanilR3J1V/VKvExTq6SrFYMDXmYaiIPnSEozEMMSwmhzdYDM+gIrOaaMg Ji3IDXFgdCSA73EiM4w021yuoCXfNAJVAHRUc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=wEdLDJgFEyr3Rx0kdQrhspWlZowoghD3V/H8ktxN3TY=; b=Xx6yq9vTkzZiBqPqL6JRCyFrTpB4igHeGidiPTqccACrlHzCCpPaVVExa8Sz4vRlrg of4TV4LDJmSGy9RnGeyaFvXUmXFh2iHfRUyhUbedSTypuHUAoxu2cwGnYB/CDejnYsC5 cC+9i6Hs1UJRVGpBkwgiCeA5w9aWp1UMl17m5YaslCcDgtHUNpEq0GG68NhHkI588WEH n1jX9DLe+aUK+9lJ5y61ezv5LuwuPGosX5fpZndnBvRWYVUUFZ/O9YZNL0gtrCigSF/N UmBB66Xmd3eBaoEmsoTVnW7nGOmpQtWEGwItAz1hxGNYZWJjHnUAbefMlw2F26+QQWR6 aVKQ== X-Gm-Message-State: ACrzQf3+PRQDsY/bXSikRmxG7U9OsbI3GVJFsQl4ulQtY6Mpp5LOs/3r stux+uMQOnn7yJs1ykIP7/J3KQ== X-Received: by 2002:adf:f3d2:0:b0:22a:e5d2:5c with SMTP id g18-20020adff3d2000000b0022ae5d2005cmr6872977wrp.131.1663571296615; Mon, 19 Sep 2022 00:08:16 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i (net-188-217-56-12.cust.vodafonedsl.it. [188.217.56.12]) by smtp.gmail.com with ESMTPSA id bk23-20020a0560001d9700b0022b014fb0b7sm2088897wrb.110.2022.09.19.00.08.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 00:08:16 -0700 (PDT) Date: Mon, 19 Sep 2022 09:08:13 +0200 From: Tommaso Merciai To: Mikhail Rudenko Cc: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Sakari Ailus , 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: <20220919070813.GA3958@tom-ThinkPad-T14s-Gen-2i> 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> <87r10bo1k5.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87r10bo1k5.fsf@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mikhail, On Fri, Sep 16, 2022 at 04:44:31PM +0300, Mikhail Rudenko wrote: > > On 2022-09-16 at 15:34 +02, Tommaso Merciai wrote: > > Hi Mikhail, > > > > On Thu, Sep 15, 2022 at 11:50:23PM +0300, Mikhail Rudenko wrote: > >> > >> Hi Tommaso, > >> > >> On 2022-09-14 at 17:51 +02, Tommaso Merciai wrote: > >> > Hi Mikhail, > >> > I do a first round on reviewing your driver :) > >> > > >> > On Sun, Sep 11, 2022 at 11:01:35PM +0300, Mikhail Rudenko wrote: > > > > >> >> + > >> >> + ov4689->xvclk = devm_clk_get(dev, "xvclk"); > >> >> + if (IS_ERR(ov4689->xvclk)) { > >> >> + dev_err(dev, "Failed to get xvclk\n"); > >> >> + return -EINVAL; > >> >> + } > >> > > >> > ^ I think is better to use devm_clk_get_optional instead of clck_get. > >> > clck_get can fail in CPU's that use ACPI > >> > > >> >> + > >> >> + 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", > > > > [1] https://patchwork.linuxtv.org/project/linux-media/patch/20220627150453.220292-5-tommaso.merciai@amarulasolutions.com/ > > > > Let me know if you need more details. > > Thanks for the pointer! I'll try to implement something along the lines > of your ov5693 series. > > But I'm not sure that will be enough to support ACPI systems > correctly. What about lanes number and link frequency checks? Should > they be made conditional on CONFIG_OF? Anything else I don't know? In my opinion, lanes number and link frequency checks are ok :) We don't need conditional CONFIG_OF. fwnode* function support both ACPI and dts. Thanks, Tommaso > > > > > Regards, > > Tommaso > > > -- > Best regards, > Mikhail Rudenko -- Tommaso Merciai Embedded Linux Engineer tommaso.merciai@amarulasolutions.com __________________________________ Amarula Solutions SRL Via Le Canevare 30, 31100 Treviso, Veneto, IT T. +39 042 243 5310 info@amarulasolutions.com www.amarulasolutions.com