Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp807679imw; Wed, 13 Jul 2022 08:19:08 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vFtZY2GMYPK2XayjdBRShA81k74fFdCZkqZwTBQdEB23W/4AKNzPy5bFwLG/dzFYZTLhVt X-Received: by 2002:a05:6402:d0a:b0:437:66ca:c211 with SMTP id eb10-20020a0564020d0a00b0043766cac211mr5720415edb.29.1657725548259; Wed, 13 Jul 2022 08:19:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657725548; cv=none; d=google.com; s=arc-20160816; b=rrlJbhLafS36QMMZobf8bRa214mJct6YL87RCVjMsVB5Qx1I+AjMDxS8JdiSKsQVVg +FB7DZq+neLMIig/qSV/ozW6OZXytuFhIM1dxRZKnUXNHEXB8xPAzan11zqJVOhkCy53 IzYRZi/8td+XEAD3ycd2tdRhZJPm9I4NAHzeoNXrZdrXFM7DmSOIpwzEbTzd8UH7IJ07 MUg/97T52xIXAbi1gMkGc7kmO+A6X6iHl5PgJGP/W0Mgr1v+igRpJaVLUNItjQo7God+ spkY6Fxih63z0mYpwzMRuXXXagaIeE/8cb8VnVv6MhR8jlUME2f4W+ZqmqUbdEpofJgH xlPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ROC0BgtK/N+kzsuCvrmnTVmfs20tFROFRODZongU+to=; b=WPv+fobCSsSn3ULImY2YlEsfrrMRpp5VmMBsDmKX6GtENTwLUo8bPjRMUftK2jR1TX 6rpUervGp8+hU/LCONNkXRC8gU/XzcVm4/lSrg/dKoSWe8GgKsYoBi2VfxKGNc98nzii D4l3jcry/No3TX/JnoulEGIgUxJg48l9G9Bpv2FTrKNaFWfhvjRbg2q7asNS8Jki8PfZ zI/Z+92WZUnhBQHyXbbzyWJz0y+bTuMwGyFTyBQbZNHRwaIAyffJuETuUSlT5QjubIgs oQ9GhmHik7NPynQNQqSFNb3KDc1nteP4u5lTP76ZLmFdvcOpMtWm9SADe4vhVTKaHW5b e5EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Pi5HkNDE; 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 e1-20020a056402330100b0043aa1df218dsi16647431eda.460.2022.07.13.08.18.43; Wed, 13 Jul 2022 08:19:08 -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=Pi5HkNDE; 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 S236837AbiGMPFj (ORCPT + 99 others); Wed, 13 Jul 2022 11:05:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236775AbiGMPF2 (ORCPT ); Wed, 13 Jul 2022 11:05:28 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AB3F422D9 for ; Wed, 13 Jul 2022 08:05:17 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id i204-20020a1c3bd5000000b003a2fa488efdso1046712wma.4 for ; Wed, 13 Jul 2022 08:05:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ROC0BgtK/N+kzsuCvrmnTVmfs20tFROFRODZongU+to=; b=Pi5HkNDEePtwLENMxhS57celmg+tdd/mSPqrqoqtqKqgFR47zmJL43321HVoJsC1wh 2Ud7XZDrDnroE7O/HvJ1dACw+i1hu1/QPVKbng4G4R2fl4M27TBuUik/krIn28kowmyq RxPEwPE1Z2f1MhfozV+mXVDeTPKpjt9zECO7A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ROC0BgtK/N+kzsuCvrmnTVmfs20tFROFRODZongU+to=; b=L6Coa/ju2dvo/K05Gp0Z/FVBHGTVls2iWRllTjICNXBGsjGo1kPBZjepKjxKjly0+/ uSOcGsgnGpP6zMALHRD/f6S0MTpkAjo2qoQaiDmb0OtZ77USK3yjbQZRopZ3R7tvOn8Z i82lov3Y/OCfFil5Jo/bLOMoeM6lsu0tD05WyO/xKNKTNlPTl6E7lY0bbBvei77k8fYD YiYAOkojPppV4ooiBznORwg32BByyaIoz6K+DWDaG2C2MKEjo3HBjDsTDNUJ5PZY4KLb cGHiv8zs+S+CO5sJgKymbR9fhq7KUBbEXstO41A8MUjn3WNRBNGWDDRgFNo2BXzoR+zW 4JUw== X-Gm-Message-State: AJIora/w4ADLF3q/eoh15eeElefG7ZQKpzr6f9+0Hl2mjyKBBj4lhWK6 fBBDwNfIDcO4MwIuwvqEvUfv/Q== X-Received: by 2002:a05:600c:a187:b0:3a2:eb3e:f1d4 with SMTP id id7-20020a05600ca18700b003a2eb3ef1d4mr10115330wmb.174.1657724715931; Wed, 13 Jul 2022 08:05:15 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-51-7.cust.vodafonedsl.it. [188.217.51.7]) by smtp.gmail.com with ESMTPSA id f17-20020a05600c4e9100b003a2d87aea57sm1465537wmq.10.2022.07.13.08.05.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 08:05:15 -0700 (PDT) From: Tommaso Merciai To: tommaso.merciai@amarulasolutions.com Cc: linuxfancy@googlegroups.com, linux-amarula@amarulasolutions.com, quentin.schulz@theobroma-systems.com, Jacopo Mondi , Daniel Scally , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 4/6] media: ov5693: add support for acpi clock-frequency prop Date: Wed, 13 Jul 2022 17:05:04 +0200 Message-Id: <20220713150506.2085214-5-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220713150506.2085214-1-tommaso.merciai@amarulasolutions.com> References: <20220713150506.2085214-1-tommaso.merciai@amarulasolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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,T_SCC_BODY_TEXT_LINE 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 Add support for ACPI-based platforms that specify the clock frequency by using the "clock-frequency" property instead of specifying a clock provider reference Signed-off-by: Tommaso Merciai Reviewed-by: Jacopo Mondi --- Changes since v2: - Fix commit body as suggested by Sakari, Jacopo - Add details to commit body as suggested by Jacopo - Move ov5693_check_hwcfg into ov5693_hwcfg - Fix xvclk_rate position as suggested by Jacopo - Use devm_clk_get_optional instead of devm_clk_get as suggested Jacopo Changes since v3: - Fix commit body as suggested by Jacopo - Add reviewed-by tags, suggested by Jacopo, Krzysztof Changes since v4: - Remove wrong Sakari reviewed-by tag, suggested by Krzysztof, Sakari - Revert ov5693_check_hwcfg function changes. Keep clk init on probe function as suggested by Sakari - Fix commit body - Fix commit msg drivers/media/i2c/ov5693.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/ov5693.c b/drivers/media/i2c/ov5693.c index d2adc5513a21..701468267f20 100644 --- a/drivers/media/i2c/ov5693.c +++ b/drivers/media/i2c/ov5693.c @@ -1408,13 +1408,25 @@ static int ov5693_probe(struct i2c_client *client) v4l2_i2c_subdev_init(&ov5693->sd, client, &ov5693_ops); - ov5693->xvclk = devm_clk_get(&client->dev, "xvclk"); - if (IS_ERR(ov5693->xvclk)) { - dev_err(&client->dev, "Error getting clock\n"); - return PTR_ERR(ov5693->xvclk); + ov5693->xvclk = devm_clk_get_optional(&client->dev, "xvclk"); + if (IS_ERR(ov5693->xvclk)) + return dev_err_probe(&client->dev, PTR_ERR(ov5693->xvclk), + "failed to get xvclk: %ld\n", + PTR_ERR(ov5693->xvclk)); + + if (ov5693->xvclk) { + xvclk_rate = clk_get_rate(ov5693->xvclk); + } else { + ret = fwnode_property_read_u32(dev_fwnode(&client->dev), + "clock-frequency", + &xvclk_rate); + + if (ret) { + dev_err(&client->dev, "can't get clock frequency"); + return ret; + } } - xvclk_rate = clk_get_rate(ov5693->xvclk); if (xvclk_rate != OV5693_XVCLK_FREQ) dev_warn(&client->dev, "Found clk freq %u, expected %u\n", xvclk_rate, OV5693_XVCLK_FREQ); -- 2.25.1