From patchwork Tue Jul 12 16:33:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 2112 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 16DCB3F081 for ; Tue, 12 Jul 2022 18:34:17 +0200 (CEST) Received: by mail-wm1-f70.google.com with SMTP id x6-20020a05600c21c600b003a2e9d4a106sf1744631wmj.6 for ; Tue, 12 Jul 2022 09:34:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657643656; cv=pass; d=google.com; s=arc-20160816; b=Qk8cuhf4Nw+9MVLGBD9epIboMjrhLolgQRg9H+uQYMJjjabTRt2T87x13L92rSQWkV I4rv4ZWHGPH4AVQWj+L+HDX2htdCHB1KO7mLO0+hj0c8ZjlcPqPHVNmJbuZ+zxZiJin6 mryXLKwBMuhaNaQCaR1LgtUemm0NoGyu5POLmULCCJFY4b7XBGDz0UhhNqnCsC8xby/O OwllAf7YftzblhyEZxz6+Qo6XlzCMW+KK+ADjvsQDzDAc0DFEGCAnfXiYttYQllBt86D 44p6rE2SjDtuXml2qM4KXeONoM+Iy9QCYdOQKQQVsJWnYd14qOHTNk9fBQeZtCNEWoZr QABQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=mxEH89PmKMnWEHW9AlxllWbUvhaOT14FMXhYQnwScZQ=; b=zapH0hpWOu7cSn5bRNzG8xN6+3KxVXvU2DsaqTb21dDu8L8Lsrdvhw3lOZxhP+feoX fhSBIwj5FlfWO6k+cc29r6pRwHjYvyXyvVADorOj6C9vsRgdrXcRsjt6+XyKVuE0dgkj K0jb7ZSR26mkzI//j+rkXaPAy6t8OyJTnaNMrOXn5DwjPKhpRgJs9h6wov8UYF6Bnk9k LtRMz//dLRlhD302e/MAyPQcvXDaZAIeTFbBpyEOMhvtbMBA44EWV0nSV5+Xd7vbZIce JGm1gofIlWUlS2ImMW9oa7k/Y11gv7ZdRajhAcFMqwEQAIfxDoYJOntRnvP8qINF0EM2 0Ezg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Zi2SdcL8; spf=pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tommaso.merciai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=mxEH89PmKMnWEHW9AlxllWbUvhaOT14FMXhYQnwScZQ=; b=UTFF0zgrTPtIuTk0F+XbhfsaDSQs6/+DdmxXEwmvOHHqpHJ2dj+pjFcfOmzRSNhRtX klSA21iccZZR1McVKSIMqLug90qREgDjextKtSJ7jdO70KjYzMOKRyHrUU788a3N1JPc vsvpH1tuJcNd01m1iy9ZDZakj18S4FhOAZkXM= 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=mxEH89PmKMnWEHW9AlxllWbUvhaOT14FMXhYQnwScZQ=; b=d0yQIyds6s/QRPb0DcCiFTn8dvdeaRU/tDh9zPga+Mt2b+Z9Row5mGOm2fXMlmLBy4 4M8D50E19uRH9qN1O1ftkM9YJhSW/Ax+TK3UCfvdWf4PPqT5lxPPU5QhdICs/9OkI+gs XzrCgqAxfpMw8GbmyGRxdhNzE3x0K3OZf5d96T1bD7juUia4g5C0vY9iavFHMsEMgajb JUPlpYFmF/F5r7oSROsdp4iNEyrS02WKKZt+HDMLSMXsfH3IS7sFxSSgIOxhiSvmAhq0 S2WfZiYQLIu5MaGuggPIlSN1GbMaXfyb36mrIEnSH+SAi4x/KtImyliM53bqBgxRAFif 6msQ== X-Gm-Message-State: AJIora+9UuzZqndMZ//4iQqIm1PpDM91PyGBBu2M4tx/DLsYS6sLCp8I 2WzKowTfKHh4E6UKB82GFVfTovRJ X-Google-Smtp-Source: AGRyM1sdbKK3B7k7pggi8/eVxvDuJ0CQdu9uM7HJzGwC1GQwUSUtdRJvKAda8Yna7REgqqkye+Qskg== X-Received: by 2002:a5d:634d:0:b0:21d:6789:3e4d with SMTP id b13-20020a5d634d000000b0021d67893e4dmr24719643wrw.321.1657643656805; Tue, 12 Jul 2022 09:34:16 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a5d:588d:0:b0:21d:339f:dc1 with SMTP id n13-20020a5d588d000000b0021d339f0dc1ls4991288wrf.0.gmail; Tue, 12 Jul 2022 09:34:16 -0700 (PDT) X-Received: by 2002:adf:e18e:0:b0:21d:8d22:bb24 with SMTP id az14-20020adfe18e000000b0021d8d22bb24mr23330002wrb.397.1657643655830; Tue, 12 Jul 2022 09:34:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657643655; cv=none; d=google.com; s=arc-20160816; b=Ggv5uil4d+nMkHw4rTPGybJPKvK0H/2YY1EowrOruzfnraNZZC/Gt6SJvUD926xtpi 6RGTwLwk0qmuDAZJDnxuo7WHGzPPC32NHSJIvXv8v5QprCdWeKY2hMhNd0wdnZ+sqc0G Ro+RrRVRTc0QW7byIbIwgFa4H3mPZ8XuFO1p4OQpJi3KxnYW7iF8FyYFFT85AWuv40AR JXEuN03FXZoYDGCicY046cuk/GxjyyzLcx8DjzTT7aVg5ya7Rgs2QbZ7OUdh8GR5x6Ua bY9PF5801FLvfpo4kra9lUqkXq5NE8wQ+SKVmyVt28R5dUqxpSahoC0o+wRGtoN3D9QL xHiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ROC0BgtK/N+kzsuCvrmnTVmfs20tFROFRODZongU+to=; b=Pbc3X0n8gy3X5ym1qibeJmwzwIrIr63M8ztZYWjlHsdPZadhMYWXMhoOIav4dEgKO3 dux6F1VdLtudzN0FYa1pZXPpbROYKWfT0Xl3WT0TdRYpJb0/+HxCF7UBSaSVn+8PtnH8 grr/2pjt0cLZm5RyxkdG6hwHDdb9ACqqy/uhtnALSzv5RT+42SxrZKNnbGDhJqlzM6pz LETr0rqVDPHbDKV06VG76QRjRgstKZMEPzhGTb3zuHjwfNzxePefVdpjWi2LrP/ajb9N GxHoLquODgVnfTjYKbfnhMye3QgwTcxP+Ku/JM5hRuyVfbdM8iO1I6SmhB+PjEVjqTRa DGcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Zi2SdcL8; spf=pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tommaso.merciai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id v10-20020adf8b4a000000b002130f1dfe10sor4012528wra.73.2022.07.12.09.34.15 for (Google Transport Security); Tue, 12 Jul 2022 09:34:15 -0700 (PDT) Received-SPF: pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:adf:e0c9:0:b0:21b:8271:2348 with SMTP id m9-20020adfe0c9000000b0021b82712348mr21782133wri.222.1657643655627; Tue, 12 Jul 2022 09:34:15 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-53-214.cust.vodafonedsl.it. [188.217.53.214]) by smtp.gmail.com with ESMTPSA id j16-20020a5d6050000000b0021db2dcd0aasm2321052wrt.108.2022.07.12.09.34.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 09:34: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 v6 4/6] media: ov5693: add support for acpi clock-frequency prop Date: Tue, 12 Jul 2022 18:33:47 +0200 Message-Id: <20220712163349.1308540-5-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220712163349.1308540-1-tommaso.merciai@amarulasolutions.com> References: <20220712163349.1308540-1-tommaso.merciai@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: tommaso.merciai@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Zi2SdcL8; spf=pass (google.com: domain of tommaso.merciai@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tommaso.merciai@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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);