From patchwork Tue Nov 23 00:00:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12633183 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 D0FB3C433EF for ; Tue, 23 Nov 2021 00:00:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232292AbhKWADh (ORCPT ); Mon, 22 Nov 2021 19:03:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232661AbhKWADe (ORCPT ); Mon, 22 Nov 2021 19:03:34 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE3A3C061756 for ; Mon, 22 Nov 2021 16:00:26 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id i12so17061391wmq.4 for ; Mon, 22 Nov 2021 16:00:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zno9bQ5DKPDGFXaWJYzQ6mt0dgCKnqyGQEt5L3RiCzo=; b=nHi1sbC5JPCkeQaESyCyv4h+oKnrEGSUuA5H06/J5W2xWau5jBnBNuY+qjMd9CFgHN HlOpVO+Iy++tPRDOWJeUjZM96C914w7PdBlaybx4jTxtoNMiEEyKe0TCWtOaOEIJka8v H3Qb2MuxuS/rbQ1pl/cDzCf1r3957cxIxorYzrhDf75NVG0NuNcqYRm4XmBxuBieUtfQ jXMckT1TUi3kR8TRv/dtDCbFfD4v2oIxYVF6QLpSaTbS3KdFLY2GFngGan32ybEP9NC5 hKeHnthDkaL7nbciM2YN3GK9H0cl/t9rbjjpYIH+Mh0eoi1dv6LF0lqE8mhVPuHNC5rW ywpA== 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=zno9bQ5DKPDGFXaWJYzQ6mt0dgCKnqyGQEt5L3RiCzo=; b=W7/gImCQwePqeBarubyHvzzjA7140uj7IDFv9FyxfsGBSAAl9ey36lct32T3bemEc4 lNZjcMa0lKczI4eK1f52y//UbnqtxGRy/4Cgh9zaTYLco8jIFWxxrkd3WVyd7Vsw8syc GqIqpCSBH8ENLvK2FqFUPU2JZu+S1CAnB8YJDz5RIaPbvQuU6NNEObGm0ShpyTjG6Xft GZsMwzMIqmzPH4bkW8yMnlCiF2aNxCyGdCGbJZuH08xDcLcka/V7GwS+FB87ZqT1PYGb vkf+w233LzgGoMM2t2kr9JvfJFXUW7ql2mCiyyizpFLW2G6uLi0BcwwaiwR3D2kBNIXK LwHw== X-Gm-Message-State: AOAM530kDlNRGkO3QjNcgod9S6XC2XWv5p2v5bQJg5p3VM6Lf/2ogg1X /Ye1UCe2ivZVu17JFmzxErVxk0V4dlQ= X-Google-Smtp-Source: ABdhPJw1kSuaovbzhW8ICvBwEJsB1HAQKnfXO4caV4czvi3Y3WHIYgyeRNwQjjdNhwhnKUfgX9D87g== X-Received: by 2002:a1c:1b15:: with SMTP id b21mr1450757wmb.174.1637625625484; Mon, 22 Nov 2021 16:00:25 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id s13sm23650782wmc.47.2021.11.22.16.00.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 16:00:25 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, paul.kocialkowski@bootlin.com Cc: sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com, laurent.pinchart@ideasonboard.com, yong.zhi@intel.com, bingbu.cao@intel.com, jeanmichel.hautbois@ideasonboard.com, kieran.bingham@ideasonboard.com, hdegoede@redhat.com Subject: [PATCH v5 01/17] media: i2c: Re-order runtime pm initialisation Date: Tue, 23 Nov 2021 00:00:01 +0000 Message-Id: <20211123000017.43187-2-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123000017.43187-1-djrscally@gmail.com> References: <20211123000017.43187-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The kerneldoc for pm_runtime_set_suspended() says: "It is not valid to call this function for devices with runtime PM enabled" To satisfy that requirement, re-order the calls so that pm_runtime_enable() is the last one. Fixes: 11c0d8fdccc5 ("media: i2c: Add support for the OV8865 image sensor") Signed-off-by: Daniel Scally --- Changes in v5: - None drivers/media/i2c/ov8865.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index ce50f3ea87b8..490832cdb831 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -2897,8 +2897,8 @@ static int ov8865_probe(struct i2c_client *client) /* Runtime PM */ - pm_runtime_enable(sensor->dev); pm_runtime_set_suspended(sensor->dev); + pm_runtime_enable(sensor->dev); /* V4L2 subdev register */ From patchwork Tue Nov 23 00:00:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12633189 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 AFDA7C4332F for ; Tue, 23 Nov 2021 00:00:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232804AbhKWADq (ORCPT ); Mon, 22 Nov 2021 19:03:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232529AbhKWADg (ORCPT ); Mon, 22 Nov 2021 19:03:36 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C60DC06175A for ; Mon, 22 Nov 2021 16:00:28 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id p18so17032079wmq.5 for ; Mon, 22 Nov 2021 16:00:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Fg94uUQn2/SXglU+IC4DmHKHCZy+RICRqtDlkkYk8qQ=; b=icFiZHIcemu4dgdti/RAmQIUxSP3EjSd6rTh58Wqwx3FP4WOT8qohhQVK32PQ9aLS4 IEUBuuv/KgF2I33693Zty5s2HOUGWrkvPZHb4jEoGOwYSGG4sTP2+Cuvp/LtpPIxwjtj 4sZplevTUYRXZ8iAnW4iIZqL4J9ubRSwdVcJgxBf1leVlAXhXtAhxB4d3PB21i88jF0i 167kLWY7BLNW/UubASdDZR7cii44dajEPD4PFPd+ajk11+fNTaGUCqypUziqTQgnRDgi RMRff8lMQoG5rlreg28DULtMHiy0mtvX9dlLYhdwurYs9GycDvv+cdL3P99T4ML2O+1x +tEQ== 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=Fg94uUQn2/SXglU+IC4DmHKHCZy+RICRqtDlkkYk8qQ=; b=ULV1pQiFCyVS99uzTqW6AXYXcseYddQZvNHPJiCm/X5KqMpWlyohDuHRWarT6cclWF n4M4SP1UweFxYrKwCeUJf6OgGVvfr8O+YIaDmIm/BbtEQQsH9koXS1cLAyvjisRSMWrR SqPv67JAbRg7y03DympDsORZyZCHlvhbNfP/cPmOSOxpGIioUAlM4q6M4+Fs2vY1H2aP VvsePuhBEbfXQIpT7ohXBSDr02AJAEE57EJ6X3DDyKg3vml6AvfQl62X+DRndW8iPRiI h0Cdmj/YizBFU/qMvO5h6Wbhs0ngTBevge5Wqz0eAh4qp6iae0N8NeCBVeBMvxYZh5Lt tVGQ== X-Gm-Message-State: AOAM5310uBWfXYBZbuF0pRcqiW9ltJZ1rxscKY/HTVjIgJZso72/r9pF 4VqI41Gy40tQJRCvBDXXXWMnpI2AM0w= X-Google-Smtp-Source: ABdhPJwYUHed9Ylf1ABB8wj216MIhzimBvL4K58ZgmATlFIlFDADxqv39fRB1PWy3JmGKAdce4+x6w== X-Received: by 2002:a05:600c:2308:: with SMTP id 8mr1344825wmo.179.1637625626409; Mon, 22 Nov 2021 16:00:26 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id s13sm23650782wmc.47.2021.11.22.16.00.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 16:00:26 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, paul.kocialkowski@bootlin.com Cc: sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com, laurent.pinchart@ideasonboard.com, yong.zhi@intel.com, bingbu.cao@intel.com, jeanmichel.hautbois@ideasonboard.com, kieran.bingham@ideasonboard.com, hdegoede@redhat.com Subject: [PATCH v5 02/17] media: i2c: ov8865: Fix lockdep error Date: Tue, 23 Nov 2021 00:00:02 +0000 Message-Id: <20211123000017.43187-3-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123000017.43187-1-djrscally@gmail.com> References: <20211123000017.43187-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Hans de Goede ov8865_state_init() calls ov8865_state_mipi_configure() which uses __v4l2_ctrl_s_ctrl[_int64](). This means that sensor->mutex (which is also sensor->ctrls.handler.lock) must be locked before calling ov8865_state_init(). Note ov8865_state_mipi_configure() is also used in other places where the lock is already held so it cannot be changed itself. This fixes the following lockdep kernel WARN: [ 13.233421] WARNING: CPU: 0 PID: 8 at drivers/media/v4l2-core/v4l2-ctrls-api.c:833 __v4l2_ctrl_s_ctrl+0x4d/0x60 [videodev] ... [ 13.234063] Call Trace: [ 13.234074] ov8865_state_configure+0x98b/0xc00 [ov8865] [ 13.234095] ov8865_probe+0x4b1/0x54c [ov8865] [ 13.234117] i2c_device_probe+0x13c/0x2d0 Fixes: 11c0d8fdccc5 ("media: i2c: Add support for the OV8865 image sensor") Signed-off-by: Hans de Goede --- Changes in v5: - None drivers/media/i2c/ov8865.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index 490832cdb831..fe064e716ea8 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -2891,7 +2891,9 @@ static int ov8865_probe(struct i2c_client *client) if (ret) goto error_mutex; + mutex_lock(&sensor->mutex); ret = ov8865_state_init(sensor); + mutex_unlock(&sensor->mutex); if (ret) goto error_ctrls; From patchwork Tue Nov 23 00:00:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12633187 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 1C572C433EF for ; Tue, 23 Nov 2021 00:00:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232674AbhKWADm (ORCPT ); Mon, 22 Nov 2021 19:03:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232563AbhKWADg (ORCPT ); Mon, 22 Nov 2021 19:03:36 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B61FCC06175B for ; Mon, 22 Nov 2021 16:00:28 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id az34-20020a05600c602200b0033bf8662572so494724wmb.0 for ; Mon, 22 Nov 2021 16:00:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N5VLlSGrPMPQfxfPi/xiMtdvJoInSe41Unx5TPzmG8w=; b=kU79JDH+dF8FIUpNKxA7uIEvH5Dnj4JtOAP9Xg5bTVMzvKoCpxOgNofdEZ41XYko3Z 6XetyMvzFHMx5lKbmCwUrU3+OkRiLx8EX/FGv/FT+jiA6nnjMI6lsT9U2vANX5hIJ5XH lb+xp2gKK8ienzCqXTLx4NOLr/rxpgxwFNJ3+SdMfNu9SfjwnYLtt3oMOOz/U6Pi/6MJ U0nQhFhStBA4SigO5Is46tDTyWGFqfeBdvfLVY6t16gxsZSc99HCrtEDdjw63MWGDmI4 NwDtf/vHQjsFW2pf2LlXGZWFVIr9WQHfntvBkfYVcXU8II6keFr0HOGQd60033rN5Ee2 lZAg== 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=N5VLlSGrPMPQfxfPi/xiMtdvJoInSe41Unx5TPzmG8w=; b=oD0Lziu0goVswSU3P/K15Itlb2aZn8RHWDWuFXnSeHs1XosvTZdFz1XxT5P/lhac1P eaTny9yEpIZf4B7lmmsdouW1Cd5UEltnL5WlizC44up3OjYxfyUNYjqodS9ChaaT1YRd eKSef5lBBFz4icQQRdn6jRDWW9rcCQfAoxwLnYK6qFQqRtDMoFJQHaFNk4P3dygBhZ4H 2Wu44ddnHqIThlMomRFLr0+W60v0/rZQT8Q8W7FbSGeSyTPP4k6iyKa00ZfYhre9hX6I 8pXnXgNzFZEFgkNqMvP3kANTHnEDWVpglNfCTCwjUZMa6fRho60L3v4GX2/JL+kphqz1 iNJg== X-Gm-Message-State: AOAM530oceyyjsc0OyZ2OqqH675WGkr6Ir170JxxqSyWjGqeItFthrR/ ZUet9AQV6nixERALE8qT/Q4O7iPygaE= X-Google-Smtp-Source: ABdhPJxjXoZJG26E5yGkWSEgDVMI/BslWv6uqGBwpLu1uQTY6pMn3wxbhBZvgk5jg2arvUZZIBpa3w== X-Received: by 2002:a1c:1d48:: with SMTP id d69mr1366524wmd.143.1637625627363; Mon, 22 Nov 2021 16:00:27 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id s13sm23650782wmc.47.2021.11.22.16.00.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 16:00:27 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, paul.kocialkowski@bootlin.com Cc: sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com, laurent.pinchart@ideasonboard.com, yong.zhi@intel.com, bingbu.cao@intel.com, jeanmichel.hautbois@ideasonboard.com, kieran.bingham@ideasonboard.com, hdegoede@redhat.com Subject: [PATCH v5 03/17] media: i2c: Add ACPI support to ov8865 Date: Tue, 23 Nov 2021 00:00:03 +0000 Message-Id: <20211123000017.43187-4-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123000017.43187-1-djrscally@gmail.com> References: <20211123000017.43187-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The ov8865 sensor is sometimes found on x86 platforms enumerated via ACPI. Add an ACPI match table to the driver so that it's probed on those platforms. Signed-off-by: Daniel Scally --- Changes in v5: - None drivers/media/i2c/ov8865.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index fe064e716ea8..9f1c0d66c4f9 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -2948,6 +2949,12 @@ static const struct dev_pm_ops ov8865_pm_ops = { SET_RUNTIME_PM_OPS(ov8865_suspend, ov8865_resume, NULL) }; +static const struct acpi_device_id ov8865_acpi_match[] = { + {"INT347A"}, + { } +}; +MODULE_DEVICE_TABLE(acpi, ov8865_acpi_match); + static const struct of_device_id ov8865_of_match[] = { { .compatible = "ovti,ov8865" }, { } @@ -2958,6 +2965,7 @@ static struct i2c_driver ov8865_driver = { .driver = { .name = "ov8865", .of_match_table = ov8865_of_match, + .acpi_match_table = ov8865_acpi_match, .pm = &ov8865_pm_ops, }, .probe_new = ov8865_probe, From patchwork Tue Nov 23 00:00:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12633191 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 6C4B7C433FE for ; Tue, 23 Nov 2021 00:00:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232666AbhKWADt (ORCPT ); Mon, 22 Nov 2021 19:03:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232684AbhKWADh (ORCPT ); Mon, 22 Nov 2021 19:03:37 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 969A6C061714 for ; Mon, 22 Nov 2021 16:00:29 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id y196so17036352wmc.3 for ; Mon, 22 Nov 2021 16:00:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=q+3MLDYJ/ZL65E+0XzcCajbT6diDBCTk6oc3BzWVgoU=; b=FybhARAoTnQHaafZwlqNdgfgq943E6OUGLF7NMU3ohZWecWhRkWkUm56s3u5Z7nFnh ZUYlp4cNOt4sZ83i/eJ7xhshyQgLw8r+uBR2WbaBll1nKQW9HiEkwwufbANJxj212Wk2 VVPgpO28I6iIz8TgZzdnulscmUyC8duNa8kHeh2Tb5rZTRjR092qI+NaJD/356V8KsFY LTTCyMXCVwxaicK9BKo8mC3+db5OnR4khADglHX30V/FHZEzpdvAIMA8mxdZMctJGdJV HWtatqZUNeWxyaU/JoHGbMULs/GOgYgOl7tU725aLh4xwJVn2kcvg01Q+a0G2n5lAi5+ qehg== 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=q+3MLDYJ/ZL65E+0XzcCajbT6diDBCTk6oc3BzWVgoU=; b=W3zNUHcd7PledHsE63jTjY7Hwu3HYGlswn8jhWta8tdCIV0/LxUzxdWPwFp0XLc8OC 3Xob6J/qOo00zF0KoANFna5Au9n7lL+fFtmx0nz+HrS+9qb7Sx0bZkKDpcQsJRxZSNFl VaVmZcMtiV8Sc9gBu4CW1TcHsgBGPjBqhXB4OHOwmuyblkQmXoIcICu6xnnJ7hJsS66s tPQv5W69eBHUgAjcL3D4loTkJmAXfYNolvVwDpCpmZU0AC+9bgsWOVVe4uxSAY38NcYK xY8qxi+kkXIgvxA6015yXTj+OELeXWjhKru3ydyEg4L0Ttn2UqgS4WC+usEiT4tLsXTy /5SA== X-Gm-Message-State: AOAM5303+ktotDe8xfATZ71A7DgjgERL+DWWPKk0eEGpDkR0RaGf7+ae Mwi3PlqsvogTKpbGwVYPOfknIP/6xPA= X-Google-Smtp-Source: ABdhPJwAXDcfRwTHbsOirYHGKJNkxAO75WHilH3xa796F7k7fF5FG5COOsYVDNA2Y+IV7w6qJQoeQA== X-Received: by 2002:a05:600c:35d4:: with SMTP id r20mr1510175wmq.76.1637625628276; Mon, 22 Nov 2021 16:00:28 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id s13sm23650782wmc.47.2021.11.22.16.00.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 16:00:27 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, paul.kocialkowski@bootlin.com Cc: sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com, laurent.pinchart@ideasonboard.com, yong.zhi@intel.com, bingbu.cao@intel.com, jeanmichel.hautbois@ideasonboard.com, kieran.bingham@ideasonboard.com, hdegoede@redhat.com Subject: [PATCH v5 04/17] media: i2c: Fix incorrect value in comment Date: Tue, 23 Nov 2021 00:00:04 +0000 Message-Id: <20211123000017.43187-5-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123000017.43187-1-djrscally@gmail.com> References: <20211123000017.43187-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The PLL configuration defined here sets 72MHz (which is correct), not 80MHz. Correct the comment. Reviewed-by: Paul Kocialkowski Signed-off-by: Daniel Scally --- drivers/media/i2c/ov8865.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index 9f1c0d66c4f9..a6372a0989e1 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -713,7 +713,7 @@ static const struct ov8865_pll2_config ov8865_pll2_config_native = { /* * EXTCLK = 24 MHz * DAC_CLK = 360 MHz - * SCLK = 80 MHz + * SCLK = 72 MHz */ static const struct ov8865_pll2_config ov8865_pll2_config_binning = { From patchwork Tue Nov 23 00:00:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12633193 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 5410CC4332F for ; Tue, 23 Nov 2021 00:00:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232939AbhKWADv (ORCPT ); Mon, 22 Nov 2021 19:03:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232198AbhKWADh (ORCPT ); Mon, 22 Nov 2021 19:03:37 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A3EAC06173E for ; Mon, 22 Nov 2021 16:00:30 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id j140-20020a1c2392000000b003399ae48f58so586594wmj.5 for ; Mon, 22 Nov 2021 16:00:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZHk04WIzJnhBqPJPdsES5xLMWYgCbqGKTYJP80oXQ0w=; b=VrUpJj+RRy2rWWjQqnXAuFD+Vdm+r3MlBOXsNpWofSgiMfKVbUyoOr28HtV2ybOiR+ bMNVn+i11zsJGfimI4g/68Ezcxk2wdwumWVFnnikyDneRmfWz604o31klHI3A58DR1sy m5I/IuiU+EatJfRSRZNQFk/6dGg0BbeBB+8WzR9GtPou1vOjkxpmNbuGmcGa9V+CYKd5 EIv/ALLTQ7QOb2713a5s5bqdCDLFfT/NyxpYjSuG9eptFy79MCCyfhm0p4E6y7o7wzLu QokOKRA3d0QbwisGcZsIZvvn6U3yEOwJq2l4850paCd4GUoZSsAQyFPAZ0Di265hKT3W 11yQ== 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=ZHk04WIzJnhBqPJPdsES5xLMWYgCbqGKTYJP80oXQ0w=; b=7vx99pIoMwMMlA7Da8dMKPeOgjQuju04awhcdn0pW5V3KQe+3jEWKeF4el+JXrHhSR nvBdsrroJbP/1QwqQzrxapUbt5cvGOmmKQsDRcbJkNn4b7qfJ5GsFjqQWbl2ii6aFcY3 tJnSgScsHKrbmvzsDUdRN5PnUFtGkYmBDjEZLQRHRoJWilZo15SX2xswdFtRPoCYPsHJ jSjjMdSqN/eUTn/1WXFRiin/ZpNuFyg+mmMIdD6DVhaB1czj7mt9FJ3U9tQQ2qfcMch3 K9IA7CN8odGuzbaYOYKUj7U+XhmO8X3wh+GrZjP928yYjUBJRQ7cjJ0nzxZGuwvbjaBa xqZQ== X-Gm-Message-State: AOAM530vwHiP3Y6cWNGL3fogkAPkkEuYZ+mrfHBqmRVB7/7OEkmFBHr5 KyEayiBUPm1i1CH3NiJ4GJJaJte4O1M= X-Google-Smtp-Source: ABdhPJxWXnwT1ztQu9dMT+BCNJSFeIfrNSDwjHjfoCxHBahlcbbKXtXz3afoK03frEvb5ZNordulCA== X-Received: by 2002:a1c:488:: with SMTP id 130mr1412090wme.157.1637625629203; Mon, 22 Nov 2021 16:00:29 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id s13sm23650782wmc.47.2021.11.22.16.00.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 16:00:28 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, paul.kocialkowski@bootlin.com Cc: sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com, laurent.pinchart@ideasonboard.com, yong.zhi@intel.com, bingbu.cao@intel.com, jeanmichel.hautbois@ideasonboard.com, kieran.bingham@ideasonboard.com, hdegoede@redhat.com Subject: [PATCH v5 05/17] media: i2c: Defer probe if not endpoint found Date: Tue, 23 Nov 2021 00:00:05 +0000 Message-Id: <20211123000017.43187-6-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123000017.43187-1-djrscally@gmail.com> References: <20211123000017.43187-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The ov8865 driver is one of those that can be connected to a CIO2 device by the cio2-bridge code. This means that the absence of an endpoint for this device is not necessarily fatal, as one might be built by the cio2-bridge when it probes. Return -EPROBE_DEFER if no endpoint is found rather than a fatal error. Signed-off-by: Daniel Scally --- Changes in v5: - None drivers/media/i2c/ov8865.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index a6372a0989e1..68fdb1ce1e94 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -2796,10 +2796,8 @@ static int ov8865_probe(struct i2c_client *client) /* Graph Endpoint */ handle = fwnode_graph_get_next_endpoint(dev_fwnode(dev), NULL); - if (!handle) { - dev_err(dev, "unable to find endpoint node\n"); - return -EINVAL; - } + if (!handle) + return -EPROBE_DEFER; sensor->endpoint.bus_type = V4L2_MBUS_CSI2_DPHY; From patchwork Tue Nov 23 00:00:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12633195 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 EB605C433F5 for ; Tue, 23 Nov 2021 00:00:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232505AbhKWADz (ORCPT ); Mon, 22 Nov 2021 19:03:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232637AbhKWADj (ORCPT ); Mon, 22 Nov 2021 19:03:39 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEC07C061757 for ; Mon, 22 Nov 2021 16:00:31 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id p3-20020a05600c1d8300b003334fab53afso594428wms.3 for ; Mon, 22 Nov 2021 16:00:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QAOFuTZDcU6UY2gLUMYLWM7C8t9BlrHjSO1QA9m0wvE=; b=HhRigLZtH8/BVsDQDM2RUBb5nKctu0DjsZKjzZGfUuvEJ8MHBw5MN3ZO9IQeAI+g8d JexwbMWpW2u6u/LnWt82XS4ndJMHuxneD7dCoGlIuVK43MG+0M3I1orqoz5MDnWvrQ20 7QjZkncq25M85MGpzrLXXq/X7M2pN2us3t6g8V69Do14rgnbAxqzrckic7XU3fZ19f4w xUqi9uzSj3dUcijvNV54ayrdQFZCcqY0in20ya+4m5HdV1ubxCXZzuWe12j5QD/3QtF/ 6/ldW7P+DuPck//z4r+F2D9oKS7xd4fZiesanXe0yqLlFFR4cKyfbWAxnld2kzRWv8p+ J8WQ== 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=QAOFuTZDcU6UY2gLUMYLWM7C8t9BlrHjSO1QA9m0wvE=; b=2wfiB5BLbF9Ivb59VwljoTizQ+pwWCLkEgDTac7rL2zC7i8n95/H8JeWu29+su+avD emGOC8oXmmcPfi6gL0NAH6GX+x13i+9s87RbcFdiMo/FUdb6rclM8c3VTxIaUGh9vfPI Cwie9hRImT6eSuUtaFJEwEUGn6ttxzqYB+myEpaAUjrfOAuFjShEu+HOmmqc+My8iz8a 9zSM+wwkskvQMMTZwR8C6UTRYePE+X6uFhvBRONvTjy2Qo92xW+JaEbsc+RDpAV9S2fV vl4Omxn7DcUNhORYeffxzLGbveO88QcOEojK6CSZuTBB/ifn7E1wYJmKK3LLJK9bpcjf 7d6g== X-Gm-Message-State: AOAM531/Cxgr9gZMG9wsm+B+LjsJrGstJJKOK+jhFcE/O75GE2WR42SA zB8kDa1/B4y+n41iuPBhhiFRQAR/nu4= X-Google-Smtp-Source: ABdhPJyppJWYvAfZRaGhJC4runXAfl6hMNdPSLHBFFEwjTnziZpj3Ju9isP6xur4vMtmQgKwRTO51w== X-Received: by 2002:a05:600c:3489:: with SMTP id a9mr1484770wmq.120.1637625630315; Mon, 22 Nov 2021 16:00:30 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id s13sm23650782wmc.47.2021.11.22.16.00.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 16:00:29 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, paul.kocialkowski@bootlin.com Cc: sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com, laurent.pinchart@ideasonboard.com, yong.zhi@intel.com, bingbu.cao@intel.com, jeanmichel.hautbois@ideasonboard.com, kieran.bingham@ideasonboard.com, hdegoede@redhat.com Subject: [PATCH v5 06/17] media: i2c: Support 19.2MHz input clock in ov8865 Date: Tue, 23 Nov 2021 00:00:06 +0000 Message-Id: <20211123000017.43187-7-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123000017.43187-1-djrscally@gmail.com> References: <20211123000017.43187-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The ov8865 driver as written expects a 24MHz input clock, but the sensor is sometimes found on x86 platforms with a 19.2MHz input clock supplied. Add a set of PLL configurations to the driver to support that rate too. As ACPI doesn't auto-configure the clock rate, check for a clock-frequency during probe and set that rate if one is found. Signed-off-by: Daniel Scally --- Changes in v5: - (Sakari) Constified some new structs - (Sakari) Reworked .probe() to account for the possibility of no clock being acquired, provided a clock-frequency is present in fwnode properties. drivers/media/i2c/ov8865.c | 195 +++++++++++++++++++++++++++---------- 1 file changed, 143 insertions(+), 52 deletions(-) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index 68fdb1ce1e94..e52e43bd7787 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -21,10 +21,6 @@ #include #include -/* Clock rate */ - -#define OV8865_EXTCLK_RATE 24000000 - /* Register definitions */ /* System */ @@ -567,6 +563,25 @@ struct ov8865_sclk_config { unsigned int sclk_div; }; +struct ov8865_pll_configs { + const struct ov8865_pll1_config *pll1_config; + const struct ov8865_pll2_config *pll2_config_native; + const struct ov8865_pll2_config *pll2_config_binning; +}; + +/* Clock rate */ + +enum extclk_rate { + OV8865_19_2_MHZ, + OV8865_24_MHZ, + OV8865_NUM_SUPPORTED_RATES +}; + +static const unsigned long supported_extclk_rates[] = { + [OV8865_19_2_MHZ] = 19200000, + [OV8865_24_MHZ] = 24000000, +}; + /* * General formulas for (array-centered) mode calculation: * - photo_array_width = 3296 @@ -635,9 +650,7 @@ struct ov8865_mode { struct v4l2_fract frame_interval; - const struct ov8865_pll1_config *pll1_config; - const struct ov8865_pll2_config *pll2_config; - const struct ov8865_sclk_config *sclk_config; + bool pll2_binning; const struct ov8865_register_value *register_values; unsigned int register_values_count; @@ -665,6 +678,9 @@ struct ov8865_sensor { struct regulator *avdd; struct regulator *dvdd; struct regulator *dovdd; + + unsigned long extclk_rate; + const struct ov8865_pll_configs *pll_configs; struct clk *extclk; struct v4l2_fwnode_endpoint endpoint; @@ -680,43 +696,70 @@ struct ov8865_sensor { /* Static definitions */ /* - * EXTCLK = 24 MHz * PHY_SCLK = 720 MHz * MIPI_PCLK = 90 MHz */ -static const struct ov8865_pll1_config ov8865_pll1_config_native = { - .pll_pre_div_half = 1, - .pll_pre_div = 0, - .pll_mul = 30, - .m_div = 1, - .mipi_div = 3, - .pclk_div = 1, - .sys_pre_div = 1, - .sys_div = 2, + +static const struct ov8865_pll1_config ov8865_pll1_config_native_19_2mhz = { + .pll_pre_div_half = 1, + .pll_pre_div = 2, + .pll_mul = 75, + .m_div = 1, + .mipi_div = 3, + .pclk_div = 1, + .sys_pre_div = 1, + .sys_div = 2, +}; + +static const struct ov8865_pll1_config ov8865_pll1_config_native_24mhz = { + .pll_pre_div_half = 1, + .pll_pre_div = 0, + .pll_mul = 30, + .m_div = 1, + .mipi_div = 3, + .pclk_div = 1, + .sys_pre_div = 1, + .sys_div = 2, }; /* - * EXTCLK = 24 MHz * DAC_CLK = 360 MHz * SCLK = 144 MHz */ -static const struct ov8865_pll2_config ov8865_pll2_config_native = { - .pll_pre_div_half = 1, - .pll_pre_div = 0, - .pll_mul = 30, - .dac_div = 2, - .sys_pre_div = 5, - .sys_div = 0, +static const struct ov8865_pll2_config ov8865_pll2_config_native_19_2mhz = { + .pll_pre_div_half = 1, + .pll_pre_div = 5, + .pll_mul = 75, + .dac_div = 1, + .sys_pre_div = 1, + .sys_div = 3, +}; + +static const struct ov8865_pll2_config ov8865_pll2_config_native_24mhz = { + .pll_pre_div_half = 1, + .pll_pre_div = 0, + .pll_mul = 30, + .dac_div = 2, + .sys_pre_div = 5, + .sys_div = 0, }; /* - * EXTCLK = 24 MHz * DAC_CLK = 360 MHz * SCLK = 72 MHz */ -static const struct ov8865_pll2_config ov8865_pll2_config_binning = { +static const struct ov8865_pll2_config ov8865_pll2_config_binning_19_2mhz = { + .pll_pre_div_half = 1, + .pll_pre_div = 2, + .pll_mul = 75, + .dac_div = 2, + .sys_pre_div = 10, + .sys_div = 0, +}; + +static const struct ov8865_pll2_config ov8865_pll2_config_binning_24mhz = { .pll_pre_div_half = 1, .pll_pre_div = 0, .pll_mul = 30, @@ -725,6 +768,23 @@ static const struct ov8865_pll2_config ov8865_pll2_config_binning = { .sys_div = 0, }; +static const struct ov8865_pll_configs ov8865_pll_configs_19_2mhz = { + .pll1_config = &ov8865_pll1_config_native_19_2mhz, + .pll2_config_native = &ov8865_pll2_config_native_19_2mhz, + .pll2_config_binning = &ov8865_pll2_config_binning_19_2mhz, +}; + +static const struct ov8865_pll_configs ov8865_pll_configs_24mhz = { + .pll1_config = &ov8865_pll1_config_native_24mhz, + .pll2_config_native = &ov8865_pll2_config_native_24mhz, + .pll2_config_binning = &ov8865_pll2_config_binning_24mhz, +}; + +static const struct ov8865_pll_configs *ov8865_pll_configs[] = { + &ov8865_pll_configs_19_2mhz, + &ov8865_pll_configs_24mhz, +}; + static const struct ov8865_sclk_config ov8865_sclk_config_native = { .sys_sel = 1, .sclk_sel = 0, @@ -934,9 +994,7 @@ static const struct ov8865_mode ov8865_modes[] = { .frame_interval = { 1, 30 }, /* PLL */ - .pll1_config = &ov8865_pll1_config_native, - .pll2_config = &ov8865_pll2_config_native, - .sclk_config = &ov8865_sclk_config_native, + .pll2_binning = false, /* Registers */ .register_values = ov8865_register_values_native, @@ -990,9 +1048,7 @@ static const struct ov8865_mode ov8865_modes[] = { .frame_interval = { 1, 30 }, /* PLL */ - .pll1_config = &ov8865_pll1_config_native, - .pll2_config = &ov8865_pll2_config_native, - .sclk_config = &ov8865_sclk_config_native, + .pll2_binning = false, /* Registers */ .register_values = ov8865_register_values_native, @@ -1050,9 +1106,7 @@ static const struct ov8865_mode ov8865_modes[] = { .frame_interval = { 1, 30 }, /* PLL */ - .pll1_config = &ov8865_pll1_config_native, - .pll2_config = &ov8865_pll2_config_binning, - .sclk_config = &ov8865_sclk_config_native, + .pll2_binning = true, /* Registers */ .register_values = ov8865_register_values_binning, @@ -1116,9 +1170,7 @@ static const struct ov8865_mode ov8865_modes[] = { .frame_interval = { 1, 90 }, /* PLL */ - .pll1_config = &ov8865_pll1_config_native, - .pll2_config = &ov8865_pll2_config_binning, - .sclk_config = &ov8865_sclk_config_native, + .pll2_binning = true, /* Registers */ .register_values = ov8865_register_values_binning, @@ -1513,12 +1565,11 @@ static int ov8865_isp_configure(struct ov8865_sensor *sensor) static unsigned long ov8865_mode_pll1_rate(struct ov8865_sensor *sensor, const struct ov8865_mode *mode) { - const struct ov8865_pll1_config *config = mode->pll1_config; - unsigned long extclk_rate; + const struct ov8865_pll1_config *config; unsigned long pll1_rate; - extclk_rate = clk_get_rate(sensor->extclk); - pll1_rate = extclk_rate * config->pll_mul / config->pll_pre_div_half; + config = sensor->pll_configs->pll1_config; + pll1_rate = sensor->extclk_rate * config->pll_mul / config->pll_pre_div_half; switch (config->pll_pre_div) { case 0: @@ -1552,10 +1603,12 @@ static int ov8865_mode_pll1_configure(struct ov8865_sensor *sensor, const struct ov8865_mode *mode, u32 mbus_code) { - const struct ov8865_pll1_config *config = mode->pll1_config; + const struct ov8865_pll1_config *config; u8 value; int ret; + config = sensor->pll_configs->pll1_config; + switch (mbus_code) { case MEDIA_BUS_FMT_SBGGR10_1X10: value = OV8865_MIPI_BIT_SEL(10); @@ -1622,9 +1675,12 @@ static int ov8865_mode_pll1_configure(struct ov8865_sensor *sensor, static int ov8865_mode_pll2_configure(struct ov8865_sensor *sensor, const struct ov8865_mode *mode) { - const struct ov8865_pll2_config *config = mode->pll2_config; + const struct ov8865_pll2_config *config; int ret; + config = mode->pll2_binning ? sensor->pll_configs->pll2_config_binning : + sensor->pll_configs->pll2_config_native; + ret = ov8865_write(sensor, OV8865_PLL_CTRL12_REG, OV8865_PLL_CTRL12_PRE_DIV_HALF(config->pll_pre_div_half) | OV8865_PLL_CTRL12_DAC_DIV(config->dac_div)); @@ -1658,7 +1714,7 @@ static int ov8865_mode_pll2_configure(struct ov8865_sensor *sensor, static int ov8865_mode_sclk_configure(struct ov8865_sensor *sensor, const struct ov8865_mode *mode) { - const struct ov8865_sclk_config *config = mode->sclk_config; + const struct ov8865_sclk_config *config = &ov8865_sclk_config_native; int ret; ret = ov8865_write(sensor, OV8865_CLK_SEL0_REG, @@ -2053,9 +2109,11 @@ static int ov8865_mode_configure(struct ov8865_sensor *sensor, static unsigned long ov8865_mode_mipi_clk_rate(struct ov8865_sensor *sensor, const struct ov8865_mode *mode) { - const struct ov8865_pll1_config *config = mode->pll1_config; + const struct ov8865_pll1_config *config; unsigned long pll1_rate; + config = sensor->pll_configs->pll1_config; + pll1_rate = ov8865_mode_pll1_rate(sensor, mode); return pll1_rate / config->m_div / 2; @@ -2783,7 +2841,8 @@ static int ov8865_probe(struct i2c_client *client) struct ov8865_sensor *sensor; struct v4l2_subdev *subdev; struct media_pad *pad; - unsigned long rate; + unsigned int rate = 0; + unsigned int i; int ret; sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); @@ -2852,19 +2911,51 @@ static int ov8865_probe(struct i2c_client *client) /* External Clock */ sensor->extclk = devm_clk_get(dev, NULL); - if (IS_ERR(sensor->extclk)) { + if (PTR_ERR(sensor->extclk) == -ENOENT) { + dev_info(dev, "no external clock found, continuing...\n"); + sensor->extclk = NULL; + } else if (IS_ERR(sensor->extclk)) { dev_err(dev, "failed to get external clock\n"); ret = PTR_ERR(sensor->extclk); goto error_endpoint; } - rate = clk_get_rate(sensor->extclk); - if (rate != OV8865_EXTCLK_RATE) { - dev_err(dev, "clock rate %lu Hz is unsupported\n", rate); + /* + * We could have either a 24MHz or 19.2MHz clock rate from either dt or + * ACPI...but we also need to support the weird IPU3 case which will + * have an external clock AND a clock-frequency property. Check for the + * clock-frequency property and if found, set that rate if we managed + * to acquire a clock. This should cover the ACPI case. If the system + * uses devicetree then the configured rate should already be set, so + * we can just read it. + */ + ret = fwnode_property_read_u32(dev_fwnode(dev), "clock-frequency", + &rate); + if (!ret && sensor->extclk) { + ret = clk_set_rate(sensor->extclk, rate); + if (ret) + return dev_err_probe(dev, ret, + "failed to set clock rate\n"); + } else if (ret && !sensor->extclk) { + return dev_err_probe(dev, ret, "invalid clock config\n"); + } + + sensor->extclk_rate = rate ? rate : clk_get_rate(sensor->extclk); + + for (i = 0; i < ARRAY_SIZE(supported_extclk_rates); i++) { + if (sensor->extclk_rate == supported_extclk_rates[i]) + break; + } + + if (i == ARRAY_SIZE(supported_extclk_rates)) { + dev_err(dev, "clock rate %lu Hz is unsupported\n", + sensor->extclk_rate); ret = -EINVAL; goto error_endpoint; } + sensor->pll_configs = ov8865_pll_configs[i]; + /* Subdev, entity and pad */ subdev = &sensor->subdev; From patchwork Tue Nov 23 00:00:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12633201 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 16F3EC433EF for ; Tue, 23 Nov 2021 00:01:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233192AbhKWAEE (ORCPT ); Mon, 22 Nov 2021 19:04:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232768AbhKWADj (ORCPT ); Mon, 22 Nov 2021 19:03:39 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96BA2C061759 for ; Mon, 22 Nov 2021 16:00:32 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id ay10-20020a05600c1e0a00b0033aa12cdd33so807166wmb.1 for ; Mon, 22 Nov 2021 16:00:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1DtjaKUQu8kNaLZX0DxyN5Qbi+T3FEtA3UdvU6Vjxws=; b=qyRpDsFqS4zxUa0b/vbmLqjaKmPdM+sAgP7ke7kbMRtKOwFgmNfg4VHs7lUHwiPklA jyrHR0ZblMixgCTmA+rh2SNQqMJb2dtfqlvBa3iptYYoJ7IfsKd1a/O0g83p2y+rM9LX vFWSGeDdR+l5mFO7Ou5bRVck3R/1MBjt9OnhtRpZ20gbfonGB5oKJ+lG3wAkesqw3Yiy 1/SS48Y5H9Q/r8GafP2kthEkv3uIJCXS1Bdf1xTz1gxmBffEtxB2S+U6V+c/6ftisnxq Av/o03GtxtGryJILwQ1Zl/lJ++1YYr7P+YpcIq3B85f6VWsVF+LO/8M6o5mugFuBTL+n yFew== 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=1DtjaKUQu8kNaLZX0DxyN5Qbi+T3FEtA3UdvU6Vjxws=; b=AKAFe5MsZW4Q0LPlsQCiPZpcyqRHalkRDhq6/x1RAVv4kM46Cl2qXhQJyhjpNYV83N PL7spjwJQX6nGpNEVN9kQ/z8wNmbtIhhAhQ2uDq3E1ijfpzlT4e2tsJAA48fz72NOXVl RPRP688zDeRVoIF56oinEueFfgUvvg9QFQQMDqAHOCO0aXngjK7ZcCGHdOmDW3aWURz5 kS+1TyLdVb7Ne7ew5eUoFjCAnm3maqpS0Z2JHRQ1mMNOOas8h7cmGWvdO3i4YT2HSi+C RVYXTfOlBPesCvUosOQegQ0nAnn+B0QvITscA8mOU+NQ3JvEsgUSELO4lX0ZViav3LL+ o68A== X-Gm-Message-State: AOAM531l0QwAe6GQw6IALI/rFiy6ShKDRzViUnnrcgGUEYTVTTUrU98p o1zjn+g9qe+QGkPmG0A3gEyaXpVF9Ss= X-Google-Smtp-Source: ABdhPJxbRXSDngfnTQrx/IsplTlDgU4fhoLiuSZZ3Bt5z0zD+6x+gHmfAfGtkN0LcSzRFlOSZ20fDA== X-Received: by 2002:a7b:cbd8:: with SMTP id n24mr1433352wmi.150.1637625631286; Mon, 22 Nov 2021 16:00:31 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id s13sm23650782wmc.47.2021.11.22.16.00.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 16:00:30 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, paul.kocialkowski@bootlin.com Cc: sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com, laurent.pinchart@ideasonboard.com, yong.zhi@intel.com, bingbu.cao@intel.com, jeanmichel.hautbois@ideasonboard.com, kieran.bingham@ideasonboard.com, hdegoede@redhat.com Subject: [PATCH v5 07/17] media: i2c: Add .get_selection() support to ov8865 Date: Tue, 23 Nov 2021 00:00:07 +0000 Message-Id: <20211123000017.43187-8-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123000017.43187-1-djrscally@gmail.com> References: <20211123000017.43187-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The ov8865 driver's v4l2_subdev_pad_ops currently does not include .get_selection() - add support for that callback. Signed-off-by: Daniel Scally --- Changes in v5: - None drivers/media/i2c/ov8865.c | 64 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index e52e43bd7787..87e34ad9c9a6 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -450,6 +450,15 @@ #define OV8865_PRE_CTRL0_PATTERN_COLOR_SQUARES 2 #define OV8865_PRE_CTRL0_PATTERN_BLACK 3 +/* Pixel Array */ + +#define OV8865_NATIVE_WIDTH 3296 +#define OV8865_NATIVE_HEIGHT 2528 +#define OV8865_ACTIVE_START_TOP 32 +#define OV8865_ACTIVE_START_LEFT 80 +#define OV8865_ACTIVE_WIDTH 3264 +#define OV8865_ACTIVE_HEIGHT 2448 + /* Macros */ #define ov8865_subdev_sensor(s) \ @@ -2756,12 +2765,67 @@ static int ov8865_enum_frame_interval(struct v4l2_subdev *subdev, return 0; } +static void +__ov8865_get_pad_crop(struct ov8865_sensor *sensor, + struct v4l2_subdev_state *state, unsigned int pad, + enum v4l2_subdev_format_whence which, struct v4l2_rect *r) +{ + const struct ov8865_mode *mode = sensor->state.mode; + + switch (which) { + case V4L2_SUBDEV_FORMAT_TRY: + *r = *v4l2_subdev_get_try_crop(&sensor->subdev, state, pad); + break; + case V4L2_SUBDEV_FORMAT_ACTIVE: + r->height = mode->output_size_y; + r->width = mode->output_size_x; + r->top = (OV8865_NATIVE_HEIGHT - mode->output_size_y) / 2; + r->left = (OV8865_NATIVE_WIDTH - mode->output_size_x) / 2; + break; + } +} + +static int ov8865_get_selection(struct v4l2_subdev *subdev, + struct v4l2_subdev_state *state, + struct v4l2_subdev_selection *sel) +{ + struct ov8865_sensor *sensor = ov8865_subdev_sensor(subdev); + + switch (sel->target) { + case V4L2_SEL_TGT_CROP: + mutex_lock(&sensor->mutex); + __ov8865_get_pad_crop(sensor, state, sel->pad, + sel->which, &sel->r); + mutex_unlock(&sensor->mutex); + break; + case V4L2_SEL_TGT_NATIVE_SIZE: + sel->r.top = 0; + sel->r.left = 0; + sel->r.width = OV8865_NATIVE_WIDTH; + sel->r.height = OV8865_NATIVE_HEIGHT; + break; + case V4L2_SEL_TGT_CROP_BOUNDS: + case V4L2_SEL_TGT_CROP_DEFAULT: + sel->r.top = OV8865_ACTIVE_START_TOP; + sel->r.left = OV8865_ACTIVE_START_LEFT; + sel->r.width = OV8865_ACTIVE_WIDTH; + sel->r.height = OV8865_ACTIVE_HEIGHT; + break; + default: + return -EINVAL; + } + + return 0; +} + static const struct v4l2_subdev_pad_ops ov8865_subdev_pad_ops = { .enum_mbus_code = ov8865_enum_mbus_code, .get_fmt = ov8865_get_fmt, .set_fmt = ov8865_set_fmt, .enum_frame_size = ov8865_enum_frame_size, .enum_frame_interval = ov8865_enum_frame_interval, + .get_selection = ov8865_get_selection, + .set_selection = ov8865_get_selection, }; static const struct v4l2_subdev_ops ov8865_subdev_ops = { From patchwork Tue Nov 23 00:00:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12633197 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 82C4BC433FE for ; Tue, 23 Nov 2021 00:00:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232181AbhKWAD5 (ORCPT ); Mon, 22 Nov 2021 19:03:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232493AbhKWADk (ORCPT ); Mon, 22 Nov 2021 19:03:40 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87CA3C06175A for ; Mon, 22 Nov 2021 16:00:33 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id b12so35694667wrh.4 for ; Mon, 22 Nov 2021 16:00:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mtJuoHgwOtsLSpTXAQDDOtUZ41bnHmFVV8n3W21EEqI=; b=VIwjkz0sgVmAevwcBteVU1rQCUEmH7LqSV+VIH3kDj+8NEqVqaho2u8G1ItWMKMqwO ioXgHo0S0RHzKbcyrbmF77gkxQRCOxQtGW+jCuBzhWObLJBgryca7yrao46LI0rWuOmt 0BSrrMcS1tUS66eilEH8tPLYH3fYS/Z6fRps0rDn2Sukun9JnUQv79Yc04Br9eEjNXmI sc0AXL6l+gjvKWj6WLxIf/459Uua/vkbqBMiKjO6uyrVqjnVksTR1bK70MCT2hSD87/0 V878UBxuasQNZHNqBDKkNZUWI5TuBTdpbrezN5R6WKFEjw4IPtvhTkPsb/6TFVM4UyNp MYgQ== 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=mtJuoHgwOtsLSpTXAQDDOtUZ41bnHmFVV8n3W21EEqI=; b=13cqQcBb7QIMq+LZnWbXVHGJ6jH3gBcmf5fTOje9LBnlSO/SRVYQQ5CBAJBw/8Xi/U RP2WyCKXCgObh7GksOMYmhMukv5j4Hpn5cIcdHNCSS/9lhen60U4/iMHrzn+jdnftq52 DoRWkPpSg0rF1REzg6Jn+p/+PrLwWmn6D7wWbOuHRbkjb4xAGJo7vcwupRRpiD8x5x25 GnSfViT4TrNGWnE+lSU1oHGGLpKU92Gjb8X3GeazcNolySpw5nGMzCIdXICHnwZdRcMg S/plRkQjiaxybe+ISlyN6V91Jccyx9iq9IZ4dcDPBwDVjLXpjS/Md0zKkgnmotvhYJq5 2W7A== X-Gm-Message-State: AOAM531Wxbttaf0/lExPF5U6AxOwh+ej6JOQKL0xE/m0dh3RWiCchdSS DzKRqjM0bIOgbvah92mTB+UcM5wCBjw= X-Google-Smtp-Source: ABdhPJzWEhAAkAKUWPuC/Mez/wO3VhmY3EHdF6L6G4EepPxfu23gvpiqPX8UcrlXHKe33OKj2XEC5g== X-Received: by 2002:a5d:4523:: with SMTP id j3mr1717360wra.185.1637625632173; Mon, 22 Nov 2021 16:00:32 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id s13sm23650782wmc.47.2021.11.22.16.00.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 16:00:31 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, paul.kocialkowski@bootlin.com Cc: sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com, laurent.pinchart@ideasonboard.com, yong.zhi@intel.com, bingbu.cao@intel.com, jeanmichel.hautbois@ideasonboard.com, kieran.bingham@ideasonboard.com, hdegoede@redhat.com Subject: [PATCH v5 08/17] media: i2c: Switch control to V4L2_CID_ANALOGUE_GAIN Date: Tue, 23 Nov 2021 00:00:08 +0000 Message-Id: <20211123000017.43187-9-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123000017.43187-1-djrscally@gmail.com> References: <20211123000017.43187-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The V4L2_CID_GAIN control for this driver configures registers that the datasheet specifies as analogue gain. Switch the control's ID to V4L2_CID_ANALOGUE_GAIN. Reviewed-by: Paul Kocialkowski Signed-off-by: Daniel Scally --- Changes in v5: - None drivers/media/i2c/ov8865.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index 87e34ad9c9a6..2d5b7b8c2c9e 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -2150,7 +2150,7 @@ static int ov8865_exposure_configure(struct ov8865_sensor *sensor, u32 exposure) /* Gain */ -static int ov8865_gain_configure(struct ov8865_sensor *sensor, u32 gain) +static int ov8865_analog_gain_configure(struct ov8865_sensor *sensor, u32 gain) { int ret; @@ -2460,8 +2460,8 @@ static int ov8865_s_ctrl(struct v4l2_ctrl *ctrl) if (ret) return ret; break; - case V4L2_CID_GAIN: - ret = ov8865_gain_configure(sensor, ctrl->val); + case V4L2_CID_ANALOGUE_GAIN: + ret = ov8865_analog_gain_configure(sensor, ctrl->val); if (ret) return ret; break; @@ -2506,7 +2506,8 @@ static int ov8865_ctrls_init(struct ov8865_sensor *sensor) /* Gain */ - v4l2_ctrl_new_std(handler, ops, V4L2_CID_GAIN, 128, 8191, 128, 128); + v4l2_ctrl_new_std(handler, ops, V4L2_CID_ANALOGUE_GAIN, 128, 8191, 128, + 128); /* White Balance */ From patchwork Tue Nov 23 00:00:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12633199 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 4D920C433EF for ; Tue, 23 Nov 2021 00:00:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233128AbhKWAD7 (ORCPT ); Mon, 22 Nov 2021 19:03:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232468AbhKWADm (ORCPT ); Mon, 22 Nov 2021 19:03:42 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 712B6C06175B for ; Mon, 22 Nov 2021 16:00:34 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id o13so818292wrs.12 for ; Mon, 22 Nov 2021 16:00:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+8UFUy7ThCe4jhpBTOiwYDEJxRZU23B7iZjGG7ye0e4=; b=PuePU9lC/Gl+6pwA5uBClMSF3uGA/ZYwcD3VUjpdHYcOpnLL9nMDtJRz1lEy5AFy84 0BtwUrQdlDpj/ZlstcWxJEu/WBng4lbvdV3j9ty7At4cawP6/O2b9IyNBn80wLRFok2B uMs31JzY9egue7LnVerWXGs3LnEaVM4L59BXBGKVGzYx20QFtS+T/g8VNbjC2VL6u3EY hY/z82BF3WM8jJjq23PeqZUo0JckJ3bqiB/4gN5ufn5CdaFwsbKGHCEbbkGr7ZseMynA Xq7COmt5xVC44l55Cguq3fEsHGfp+xEYiUuoKUb2eEJYgUiWYlbAERnvgnxgJGIgzv3f wNQg== 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=+8UFUy7ThCe4jhpBTOiwYDEJxRZU23B7iZjGG7ye0e4=; b=qNWQW1jqU/N4+IvKldg+WxnWJP9NKDPRwWj9llpN3AYfjIKjs7sjKQvZMUoRibArTH lwpDw6CftE4coJOu/JBttaKBz+hfcVRnNSPDD1c8ZPYm5mJAOpaRx9Nvgn8qwO0G7ioH ibMpMSOLkuTLxLqN2qppEY1BCFNvxRqkKzTk7OmOAqspmOZaY7LPFGuzEg9V4nIsUdu5 CCPr62bWkYdOJqDATE+hbN7cEsyUCbAn/DmJfbhZlvDHsnYrmdfsSQOnS2BzYLlCEsdV MHCs9F6NvKfoniSf0BITkwcnbgGXSKEz+OyVOD4+dUkRarTLoEZjUMsTYmrXA8vK9C/w 1PDg== X-Gm-Message-State: AOAM532szyDUGcsiwMZwyaJWHkZhHWwNg1ZV5a4iEU+1tB5H+Qw2f/o+ LKM7JKFI1k+IFrep0CvT7pbDKY78cxI= X-Google-Smtp-Source: ABdhPJzMi+UecxU1lxxQDG3cWvEFaS2sW5Hb/TkC0t1IVdpPOwMHSYO/rpS7jvuHlTtWfYPgs3MeAQ== X-Received: by 2002:adf:cd04:: with SMTP id w4mr1640629wrm.406.1637625633115; Mon, 22 Nov 2021 16:00:33 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id s13sm23650782wmc.47.2021.11.22.16.00.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 16:00:32 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, paul.kocialkowski@bootlin.com Cc: sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com, laurent.pinchart@ideasonboard.com, yong.zhi@intel.com, bingbu.cao@intel.com, jeanmichel.hautbois@ideasonboard.com, kieran.bingham@ideasonboard.com, hdegoede@redhat.com Subject: [PATCH v5 09/17] media: i2c: Add vblank control to ov8865 Date: Tue, 23 Nov 2021 00:00:09 +0000 Message-Id: <20211123000017.43187-10-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123000017.43187-1-djrscally@gmail.com> References: <20211123000017.43187-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add a V4L2_CID_VBLANK control to the ov8865 driver. Signed-off-by: Daniel Scally --- Changes in v5: - None drivers/media/i2c/ov8865.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index 2d5b7b8c2c9e..27043b9426a1 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -183,6 +183,8 @@ #define OV8865_VTS_H(v) (((v) & GENMASK(11, 8)) >> 8) #define OV8865_VTS_L_REG 0x380f #define OV8865_VTS_L(v) ((v) & GENMASK(7, 0)) +#define OV8865_TIMING_MAX_VTS 0xffff +#define OV8865_TIMING_MIN_VTS 0x04 #define OV8865_OFFSET_X_H_REG 0x3810 #define OV8865_OFFSET_X_H(v) (((v) & GENMASK(15, 8)) >> 8) #define OV8865_OFFSET_X_L_REG 0x3811 @@ -675,6 +677,7 @@ struct ov8865_state { struct ov8865_ctrls { struct v4l2_ctrl *link_freq; struct v4l2_ctrl *pixel_rate; + struct v4l2_ctrl *vblank; struct v4l2_ctrl_handler handler; }; @@ -2225,6 +2228,20 @@ static int ov8865_test_pattern_configure(struct ov8865_sensor *sensor, ov8865_test_pattern_bits[index]); } +/* Blanking */ + +static int ov8865_vts_configure(struct ov8865_sensor *sensor, u32 vblank) +{ + u16 vts = sensor->state.mode->output_size_y + vblank; + int ret; + + ret = ov8865_write(sensor, OV8865_VTS_H_REG, OV8865_VTS_H(vts)); + if (ret) + return ret; + + return ov8865_write(sensor, OV8865_VTS_L_REG, OV8865_VTS_L(vts)); +} + /* State */ static int ov8865_state_mipi_configure(struct ov8865_sensor *sensor, @@ -2476,6 +2493,8 @@ static int ov8865_s_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_TEST_PATTERN: index = (unsigned int)ctrl->val; return ov8865_test_pattern_configure(sensor, index); + case V4L2_CID_VBLANK: + return ov8865_vts_configure(sensor, ctrl->val); default: return -EINVAL; } @@ -2492,6 +2511,8 @@ static int ov8865_ctrls_init(struct ov8865_sensor *sensor) struct ov8865_ctrls *ctrls = &sensor->ctrls; struct v4l2_ctrl_handler *handler = &ctrls->handler; const struct v4l2_ctrl_ops *ops = &ov8865_ctrl_ops; + const struct ov8865_mode *mode = &ov8865_modes[0]; + unsigned int vblank_max, vblank_def; int ret; v4l2_ctrl_handler_init(handler, 32); @@ -2528,6 +2549,13 @@ static int ov8865_ctrls_init(struct ov8865_sensor *sensor) ARRAY_SIZE(ov8865_test_pattern_menu) - 1, 0, 0, ov8865_test_pattern_menu); + /* Blanking */ + vblank_max = OV8865_TIMING_MAX_VTS - mode->output_size_y; + vblank_def = mode->vts - mode->output_size_y; + ctrls->vblank = v4l2_ctrl_new_std(handler, ops, V4L2_CID_VBLANK, + OV8865_TIMING_MIN_VTS, vblank_max, 1, + vblank_def); + /* MIPI CSI-2 */ ctrls->link_freq = @@ -2708,6 +2736,10 @@ static int ov8865_set_fmt(struct v4l2_subdev *subdev, sensor->state.mbus_code != mbus_code) ret = ov8865_state_configure(sensor, mode, mbus_code); + __v4l2_ctrl_modify_range(sensor->ctrls.vblank, OV8865_TIMING_MIN_VTS, + OV8865_TIMING_MAX_VTS - mode->output_size_y, + 1, mode->vts - mode->output_size_y); + complete: mutex_unlock(&sensor->mutex); From patchwork Tue Nov 23 00:00:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12633217 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 762C5C433EF for ; Tue, 23 Nov 2021 00:01:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231174AbhKWAE2 (ORCPT ); Mon, 22 Nov 2021 19:04:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232662AbhKWADm (ORCPT ); Mon, 22 Nov 2021 19:03:42 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44E12C06175C for ; Mon, 22 Nov 2021 16:00:35 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id n33-20020a05600c502100b0032fb900951eso593651wmr.4 for ; Mon, 22 Nov 2021 16:00:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ek64K3SBQDEWfOp0wcNmphEXZLJLopy1OLyhPbXY4T0=; b=FE564jU5fLSyG7pzGaxjLNSRbj4sN7YZE6+36BDsYqyto9ZnOVNfGVoq53UnkZONkC eQv7cRx6CVPAEvJWZwJ2iGPFeCC6PQcxMecwE79JiuVoAkkaaKxFuOvTDhM2O9gsiju3 KrWvB02vz1hCwn1mMWoa5gPB2fnWg/lFl3zabIJo0Qugv6VuW7x9sALKJYTjBXAToiLB P1ExpTMSzzbp9QisUa32h3dHY3P8gsq1BnzMvuNBvhpQOkpjtzsrXFj6ZQzYkTUZ08wO wBjp5IMyjQM/0EzwPCtx3EF4xrAcfXjrLGFXczVt9lqFiYbBhlProuWOdm+2kU2vQ8al i12Q== 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=ek64K3SBQDEWfOp0wcNmphEXZLJLopy1OLyhPbXY4T0=; b=5ySElzuG15aUynngHAPjDM+Mw6/uuJufLp6QaHBsfisO4zljeL7zG9Sj850umN7erO 0dWCt3vXQCanqb31Wr79L5IhDwEUYX2ygZR0fq24sp+b2LNX3nwbksovIXHkP482Yw0f nNut3/wR5i+jWA0yG+KD25aNP7eGzcPk6nJU0GWk342jg+5U95N/mH0cVt5RUW1zMUZP sl3Ytn75oWG+5ZmOMxK0LKdYFSchKWQ1bt1bKtTiEQpQHy6Qz9jHic+DhdQl2UCLiTH/ kZvFojL0VOlXijCs8V333cJXkKkQI/pDeJk5iu9gL+UgJ7Sw0/0qqcrBtCLAVKWg+uBs Yylw== X-Gm-Message-State: AOAM530ZHMzEGusmJXOmGIvrde2G0g4AMupsaMbNbw3w0zni4UAUixaR AdsRf30y9ShYG1GlcCMor10Zr1Q5ZIE= X-Google-Smtp-Source: ABdhPJxF5LYZOsvBOGFBEX92yvZo3PLoKmJ5vMhwdlokP3h5nc3GCC19qrzqtaD3PS3RjUirzAdTtg== X-Received: by 2002:a7b:c444:: with SMTP id l4mr34335057wmi.115.1637625633937; Mon, 22 Nov 2021 16:00:33 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id s13sm23650782wmc.47.2021.11.22.16.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 16:00:33 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, paul.kocialkowski@bootlin.com Cc: sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com, laurent.pinchart@ideasonboard.com, yong.zhi@intel.com, bingbu.cao@intel.com, jeanmichel.hautbois@ideasonboard.com, kieran.bingham@ideasonboard.com, hdegoede@redhat.com Subject: [PATCH v5 10/17] media: i2c: Add hblank control to ov8865 Date: Tue, 23 Nov 2021 00:00:10 +0000 Message-Id: <20211123000017.43187-11-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123000017.43187-1-djrscally@gmail.com> References: <20211123000017.43187-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add a V4L2_CID_HBLANK control to the ov8865 driver. This is read only with timing control intended to be done via vblanking alone. Signed-off-by: Daniel Scally --- Changes in v5: - None drivers/media/i2c/ov8865.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index 27043b9426a1..f1ee0e425adf 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -677,6 +677,7 @@ struct ov8865_state { struct ov8865_ctrls { struct v4l2_ctrl *link_freq; struct v4l2_ctrl *pixel_rate; + struct v4l2_ctrl *hblank; struct v4l2_ctrl *vblank; struct v4l2_ctrl_handler handler; @@ -2513,6 +2514,7 @@ static int ov8865_ctrls_init(struct ov8865_sensor *sensor) const struct v4l2_ctrl_ops *ops = &ov8865_ctrl_ops; const struct ov8865_mode *mode = &ov8865_modes[0]; unsigned int vblank_max, vblank_def; + unsigned int hblank; int ret; v4l2_ctrl_handler_init(handler, 32); @@ -2550,6 +2552,13 @@ static int ov8865_ctrls_init(struct ov8865_sensor *sensor) 0, 0, ov8865_test_pattern_menu); /* Blanking */ + hblank = mode->hts - mode->output_size_x; + ctrls->hblank = v4l2_ctrl_new_std(handler, ops, V4L2_CID_HBLANK, hblank, + hblank, 1, hblank); + + if (ctrls->hblank) + ctrls->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; + vblank_max = OV8865_TIMING_MAX_VTS - mode->output_size_y; vblank_def = mode->vts - mode->output_size_y; ctrls->vblank = v4l2_ctrl_new_std(handler, ops, V4L2_CID_VBLANK, @@ -2696,6 +2705,7 @@ static int ov8865_set_fmt(struct v4l2_subdev *subdev, struct v4l2_mbus_framefmt *mbus_format = &format->format; const struct ov8865_mode *mode; u32 mbus_code = 0; + unsigned int hblank; unsigned int index; int ret = 0; @@ -2740,6 +2750,10 @@ static int ov8865_set_fmt(struct v4l2_subdev *subdev, OV8865_TIMING_MAX_VTS - mode->output_size_y, 1, mode->vts - mode->output_size_y); + hblank = mode->hts - mode->output_size_x; + __v4l2_ctrl_modify_range(sensor->ctrls.hblank, hblank, hblank, 1, + hblank); + complete: mutex_unlock(&sensor->mutex); From patchwork Tue Nov 23 00:00:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12633203 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 9052AC433EF for ; Tue, 23 Nov 2021 00:01:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232870AbhKWAEI (ORCPT ); Mon, 22 Nov 2021 19:04:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232827AbhKWADs (ORCPT ); Mon, 22 Nov 2021 19:03:48 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A7C3C06175F for ; Mon, 22 Nov 2021 16:00:36 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id d72-20020a1c1d4b000000b00331140f3dc8so1134979wmd.1 for ; Mon, 22 Nov 2021 16:00:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rDhiDTRaE38BiqhE35BpdDHZOA4cnDvmczVi9KFTNAw=; b=P4KYf1J15IoNmhLXLtTjqNGUPU3DyyEDHqiZewF46ETIpDZhiOVl55cAfpzYMm+LiL /pVqRbhysgTb/Jz6lhw/+O7yeE/6M+c2974i3XCYiRWugLsZadoC/iu9W/QRvvHFUCic LV2fdpySmVCJMige7Sb4NclqtK3yBTV4yN/wWdBLOYXp93Djy7yB1SvquTPofpznhnos 5f6cKhj2Mchj/x53Nd3VIOqMx3R0Sf6fg1DWCcKknooejmNxRX/sdwoEQkt99gsBgPAL HEow8KvwG9QTk+zaBKIkvPGk8UgWFJfs61+tpaXoMLAh9PyQdB397SQfPjMFJBpz1VcE g6Gw== 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=rDhiDTRaE38BiqhE35BpdDHZOA4cnDvmczVi9KFTNAw=; b=vpMKK0FrH1CmLOgM6o+92iWEBHhKhWqG20xQMi+CApiCT9AHEMsxJtkRjxO0eJ23ec XaMDK6hyJjeovnsUOIPrFZf5MLTfIAcXU+O2Zl0UZmE1rF/bS99IV7vGTD9BvyvMVUIJ 4BIGkOEYgEhEUkyJiVJcLsSzka0KzmaE8mS62Ws+IBx1+apMkAuK7k5SfzPMCjovcYUB xsKu4KfhUfCubyi3nsbHkgpRaYJ3sRftEYCVJzXVa8oo+U+LusqslqmdQ0sf2UHAuN6v IMSaZ+SmslAmpTtR7kSby/rHE/pDz9j+81Xb+vrbI59+SZjStPTy4vRQR5w75Ow223Ix 8PsQ== X-Gm-Message-State: AOAM532HqG+fbMwwShBZvu7BBCIRjUw0JB+UPXuiHBHo1YwUP23343At yLWY7sfz5RsR8SWEtCXq0EwnrASzLyQ= X-Google-Smtp-Source: ABdhPJx3df6sNiJfCymjnVJiij52rSiMAZUtbGFwtk1iI/jmxJ5JVEZP/e1dS42BtxwXaOdi2PEY8g== X-Received: by 2002:a7b:cf25:: with SMTP id m5mr36045802wmg.51.1637625634826; Mon, 22 Nov 2021 16:00:34 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id s13sm23650782wmc.47.2021.11.22.16.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 16:00:34 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, paul.kocialkowski@bootlin.com Cc: sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com, laurent.pinchart@ideasonboard.com, yong.zhi@intel.com, bingbu.cao@intel.com, jeanmichel.hautbois@ideasonboard.com, kieran.bingham@ideasonboard.com, hdegoede@redhat.com Subject: [PATCH v5 11/17] media: i2c: Update HTS values in ov8865 Date: Tue, 23 Nov 2021 00:00:11 +0000 Message-Id: <20211123000017.43187-12-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123000017.43187-1-djrscally@gmail.com> References: <20211123000017.43187-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The HTS values for some of the modes in the ov8865 driver are a bit unusual, coming in lower than the output_size_x is set to. It seems like they might be calculated to fit the desired framerate into a configuration with just two data lanes. To bring this more in line with expected behaviour, raise the HTS values above the output_size_x. The corollary of that change is that the hardcoded frame intervals against the modes no longer make sense, so remove those entirely. Update the .g/s_frame_interval() callbacks to calculate the frame interval based on the current mode and the vblank and hblank settings. The implementation of the .enum_frame_interval() callback is no longer suitable since the possible frame rate is now a continuous range depending on the vblank control setting, so remove that callback entirely. Signed-off-by: Daniel Scally --- Changes in v5: - None drivers/media/i2c/ov8865.c | 65 +++++++------------------------------- 1 file changed, 11 insertions(+), 54 deletions(-) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index f1ee0e425adf..f4a899e463de 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -659,8 +659,6 @@ struct ov8865_mode { unsigned int blc_anchor_right_start; unsigned int blc_anchor_right_end; - struct v4l2_fract frame_interval; - bool pll2_binning; const struct ov8865_register_value *register_values; @@ -964,7 +962,7 @@ static const struct ov8865_mode ov8865_modes[] = { { /* Horizontal */ .output_size_x = 3264, - .hts = 1944, + .hts = 3888, /* Vertical */ .output_size_y = 2448, @@ -1003,9 +1001,6 @@ static const struct ov8865_mode ov8865_modes[] = { .blc_anchor_right_start = 1984, .blc_anchor_right_end = 2239, - /* Frame Interval */ - .frame_interval = { 1, 30 }, - /* PLL */ .pll2_binning = false, @@ -1018,11 +1013,11 @@ static const struct ov8865_mode ov8865_modes[] = { { /* Horizontal */ .output_size_x = 3264, - .hts = 2582, + .hts = 3888, /* Vertical */ .output_size_y = 1836, - .vts = 2002, + .vts = 2470, .size_auto = true, .size_auto_boundary_x = 8, @@ -1057,9 +1052,6 @@ static const struct ov8865_mode ov8865_modes[] = { .blc_anchor_right_start = 1984, .blc_anchor_right_end = 2239, - /* Frame Interval */ - .frame_interval = { 1, 30 }, - /* PLL */ .pll2_binning = false, @@ -1115,9 +1107,6 @@ static const struct ov8865_mode ov8865_modes[] = { .blc_anchor_right_start = 992, .blc_anchor_right_end = 1119, - /* Frame Interval */ - .frame_interval = { 1, 30 }, - /* PLL */ .pll2_binning = true, @@ -1179,9 +1168,6 @@ static const struct ov8865_mode ov8865_modes[] = { .blc_anchor_right_start = 992, .blc_anchor_right_end = 1119, - /* Frame Interval */ - .frame_interval = { 1, 90 }, - /* PLL */ .pll2_binning = true, @@ -2628,11 +2614,18 @@ static int ov8865_g_frame_interval(struct v4l2_subdev *subdev, { struct ov8865_sensor *sensor = ov8865_subdev_sensor(subdev); const struct ov8865_mode *mode; + unsigned int framesize; + unsigned int fps; mutex_lock(&sensor->mutex); mode = sensor->state.mode; - interval->interval = mode->frame_interval; + framesize = mode->hts * (mode->output_size_y + + sensor->ctrls.vblank->val); + fps = DIV_ROUND_CLOSEST(sensor->ctrls.pixel_rate->val, framesize); + + interval->interval.numerator = 1; + interval->interval.denominator = fps; mutex_unlock(&sensor->mutex); @@ -2777,41 +2770,6 @@ static int ov8865_enum_frame_size(struct v4l2_subdev *subdev, return 0; } -static int ov8865_enum_frame_interval(struct v4l2_subdev *subdev, - struct v4l2_subdev_state *sd_state, - struct v4l2_subdev_frame_interval_enum *interval_enum) -{ - const struct ov8865_mode *mode = NULL; - unsigned int mode_index; - unsigned int interval_index; - - if (interval_enum->index > 0) - return -EINVAL; - /* - * Multiple modes with the same dimensions may have different frame - * intervals, so look up each relevant mode. - */ - for (mode_index = 0, interval_index = 0; - mode_index < ARRAY_SIZE(ov8865_modes); mode_index++) { - mode = &ov8865_modes[mode_index]; - - if (mode->output_size_x == interval_enum->width && - mode->output_size_y == interval_enum->height) { - if (interval_index == interval_enum->index) - break; - - interval_index++; - } - } - - if (mode_index == ARRAY_SIZE(ov8865_modes)) - return -EINVAL; - - interval_enum->interval = mode->frame_interval; - - return 0; -} - static void __ov8865_get_pad_crop(struct ov8865_sensor *sensor, struct v4l2_subdev_state *state, unsigned int pad, @@ -2870,7 +2828,6 @@ static const struct v4l2_subdev_pad_ops ov8865_subdev_pad_ops = { .get_fmt = ov8865_get_fmt, .set_fmt = ov8865_set_fmt, .enum_frame_size = ov8865_enum_frame_size, - .enum_frame_interval = ov8865_enum_frame_interval, .get_selection = ov8865_get_selection, .set_selection = ov8865_get_selection, }; From patchwork Tue Nov 23 00:00:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12633215 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 1C85EC433F5 for ; Tue, 23 Nov 2021 00:01:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232577AbhKWAEY (ORCPT ); Mon, 22 Nov 2021 19:04:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232829AbhKWADs (ORCPT ); Mon, 22 Nov 2021 19:03:48 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04B01C06175E for ; Mon, 22 Nov 2021 16:00:37 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id p3-20020a05600c1d8300b003334fab53afso594591wms.3 for ; Mon, 22 Nov 2021 16:00:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D3axH8ge32Jqy1teSAzH+Oc/5EGMfinICo5RgkR4VMU=; b=khY+uZqnPAN2czfdT7PrANh+YhmupRdExWcLPcIrg3uxtWthfjBOEQWpEUBeSjMhR5 FheJLTQrWfcu5hO3Lea8xFmwL+9IM7S8dZ80PoaySnqmWnElUpOontLAGUBdd4pFjJHf vYidXrtnO6mY9zKYJDoKVzD2bqpFfIzqYSKmXbpyslO5yeQzg6YQeF9IhuDSlnwUOnCL tO9WvWYyHbbolxGIeOoxbp1VVFHxhm4bzQX+lWG6xIP4nyFbTaCuhbDcN7ERR34UJ7i6 /6l3GHZdMkulTM5yl/5kqXN85Q4I5isZJJRwc12vI5BCV1xk35eP3NzCzaHKVD1QESCn /5Wg== 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=D3axH8ge32Jqy1teSAzH+Oc/5EGMfinICo5RgkR4VMU=; b=urXx/bwcIu+aRea1ZuxZxVN1a4Wrsy00IwM1Spq1Ioi+Z+I8eS4jZ9kS5pquCJEYOw o85gWA5eGUYxW/BcDQqd6FdK9mn8phs4DU3Bfoub9LhfAWUkS3WpKfHHfXeNXW9ZoB40 1Rgc9OBXBd8k2Y5zrJpkQ5uyKDc0wFh0m4hTsysg5Bs3Kc5edMMAXJhnuD7YyDOx63hh HsIUNuZcLpDlEW/xIb1hdgZuLfDe8Y74xJf0MJVdu7/U8oVXla6EpMnAd0bjVjyuZLcA TJld54FfYMt9DPUTvLagiSrSKkpVLmS3yqLYYPTpS0IkJsrLxhIGizbT5bcwYhyl6bDx ce0g== X-Gm-Message-State: AOAM533vYZW2L6OLGD8Yl4K6xUQIcIDCOMpR4LS42+rfCSnyntvNXhQz vCCUdBPuv/7qGgXE0jgnjovUwZ5EL8I= X-Google-Smtp-Source: ABdhPJzzjm/tQKdBBg4NtHxIgGb2vs0/Vm++lP+GCcohOZaHOe5Sr2417vzSVJQMmHjrbVG/yVqMGA== X-Received: by 2002:a05:600c:a08:: with SMTP id z8mr1548399wmp.52.1637625635659; Mon, 22 Nov 2021 16:00:35 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id s13sm23650782wmc.47.2021.11.22.16.00.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 16:00:35 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, paul.kocialkowski@bootlin.com Cc: sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com, laurent.pinchart@ideasonboard.com, yong.zhi@intel.com, bingbu.cao@intel.com, jeanmichel.hautbois@ideasonboard.com, kieran.bingham@ideasonboard.com, hdegoede@redhat.com Subject: [PATCH v5 12/17] media: i2c: cap exposure at height + vblank in ov8865 Date: Tue, 23 Nov 2021 00:00:12 +0000 Message-Id: <20211123000017.43187-13-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123000017.43187-1-djrscally@gmail.com> References: <20211123000017.43187-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Exposure limits depend on the total height; when vblank is altered (and thus the total height is altered), change the exposure limits to reflect the new cap. Signed-off-by: Daniel Scally --- Changes in v5: - (JM) Added OV8865_INTEGRATION_TIME_MARGIN to reduce the maximum possible exposure, without which setting values within 8 lines of max causes an entirely black image. drivers/media/i2c/ov8865.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index f4a899e463de..811438c44b58 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -143,6 +143,7 @@ #define OV8865_EXPOSURE_CTRL_L_REG 0x3502 #define OV8865_EXPOSURE_CTRL_L(v) ((v) & GENMASK(7, 0)) #define OV8865_EXPOSURE_GAIN_MANUAL_REG 0x3503 +#define OV8865_INTEGRATION_TIME_MARGIN 8 #define OV8865_GAIN_CTRL_H_REG 0x3508 #define OV8865_GAIN_CTRL_H(v) (((v) & GENMASK(12, 8)) >> 8) @@ -677,6 +678,7 @@ struct ov8865_ctrls { struct v4l2_ctrl *pixel_rate; struct v4l2_ctrl *hblank; struct v4l2_ctrl *vblank; + struct v4l2_ctrl *exposure; struct v4l2_ctrl_handler handler; }; @@ -2454,6 +2456,20 @@ static int ov8865_s_ctrl(struct v4l2_ctrl *ctrl) unsigned int index; int ret; + /* If VBLANK is altered we need to update exposure to compensate */ + if (ctrl->id == V4L2_CID_VBLANK) { + int exposure_max; + + exposure_max = sensor->state.mode->output_size_y + ctrl->val - + OV8865_INTEGRATION_TIME_MARGIN; + __v4l2_ctrl_modify_range(sensor->ctrls.exposure, + sensor->ctrls.exposure->minimum, + exposure_max, + sensor->ctrls.exposure->step, + min(sensor->ctrls.exposure->val, + exposure_max)); + } + /* Wait for the sensor to be on before setting controls. */ if (pm_runtime_suspended(sensor->dev)) return 0; @@ -2510,8 +2526,8 @@ static int ov8865_ctrls_init(struct ov8865_sensor *sensor) /* Exposure */ - v4l2_ctrl_new_std(handler, ops, V4L2_CID_EXPOSURE, 16, 1048575, 16, - 512); + ctrls->exposure = v4l2_ctrl_new_std(handler, ops, V4L2_CID_EXPOSURE, 16, + 1048575, 16, 512); /* Gain */ @@ -2700,6 +2716,7 @@ static int ov8865_set_fmt(struct v4l2_subdev *subdev, u32 mbus_code = 0; unsigned int hblank; unsigned int index; + int exposure_max; int ret = 0; mutex_lock(&sensor->mutex); @@ -2747,6 +2764,13 @@ static int ov8865_set_fmt(struct v4l2_subdev *subdev, __v4l2_ctrl_modify_range(sensor->ctrls.hblank, hblank, hblank, 1, hblank); + exposure_max = mode->vts - OV8865_INTEGRATION_TIME_MARGIN; + __v4l2_ctrl_modify_range(sensor->ctrls.exposure, + sensor->ctrls.exposure->minimum, exposure_max, + sensor->ctrls.exposure->step, + min(sensor->ctrls.exposure->val, + exposure_max)); + complete: mutex_unlock(&sensor->mutex); From patchwork Tue Nov 23 00:00:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12633211 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 33C2BC433EF for ; Tue, 23 Nov 2021 00:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232661AbhKWAET (ORCPT ); Mon, 22 Nov 2021 19:04:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232869AbhKWADt (ORCPT ); Mon, 22 Nov 2021 19:03:49 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB004C0613DD for ; Mon, 22 Nov 2021 16:00:37 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id n29so35661259wra.11 for ; Mon, 22 Nov 2021 16:00:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SIlmIyIn/GiySb/nhjHxa+6YJSRna71Nk7IiTYJOcqQ=; b=pSYrtLiaNHS4ZmjKKU+fQugneIQDW822IBmjhDUo/xIsrcrbco/1YhP/FNMqjyHP0h UFJZ1bnLJOiKepVcyl9gUOgqC+sMQrzma881aSMkv86UXoxnrnJZDsm53UcKR9+twx2U PWWCrqPIO6jVjZlWRiVTyAXR+HQHo69HDqhr3kb3ZGJAzG7G42b2SpOm21pMHacdfwI1 a5/kisExMtKkJ62/ZfzK6eJ2e7Xjkhf7u5f2eYSGciKeweSSKZ8vSghl3UvM1X6im+Kp ySfhrDs7IceSpoJ5iXkuu+BZzLaFOFvtmg773CfUEiHQ4I5xBEXPJHaAzUk1X5kToyiG dTSw== 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=SIlmIyIn/GiySb/nhjHxa+6YJSRna71Nk7IiTYJOcqQ=; b=20sgiaHc+mKfYqr19vJlW+aJcPk7pqvCcGWfRF7kxheFNLy+5xo6q9k0GUQ+/8WdPQ ynJ0gpOi7WacF4LKUhdeVzri3tx0jqhS8sY/jknAVawNTY+4UGP9d96SDRQhuCHhQR1j 54SPBHeb74MIfS4d0RxnxH9DDjr8Gjs0ey3lKOk3+GZxkVMel/3WtNLiBIM+TzvtPIcj WdP5U4WEkskns90J+38xXD1gqzooOvaw2HnnPhWxM189oyVHn8349hdH+KsuhTrAQKNy X7AXze8yIb1sUJEp3zBqDNjw0n93EU4eOfTm7uGfdkjyMvXPrCTHsrtmXwqXvqhYWOnr NjlA== X-Gm-Message-State: AOAM533DfKAa4/QTmn3zS7Gsm+82O3iiWQZbH0DTcA2/sHt/28oNV2fh TA7GhlRpVf0dF5H98P2/ZIee+d26WM4= X-Google-Smtp-Source: ABdhPJz0aClkMViTPSEgYR3H3Tua6RMhAqUVjP59aBCzLRhzYvvTT/uxcf7CRPP4De17NLnynL8Zcw== X-Received: by 2002:adf:e682:: with SMTP id r2mr1683519wrm.281.1637625636576; Mon, 22 Nov 2021 16:00:36 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id s13sm23650782wmc.47.2021.11.22.16.00.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 16:00:36 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, paul.kocialkowski@bootlin.com Cc: sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com, laurent.pinchart@ideasonboard.com, yong.zhi@intel.com, bingbu.cao@intel.com, jeanmichel.hautbois@ideasonboard.com, kieran.bingham@ideasonboard.com, hdegoede@redhat.com Subject: [PATCH v5 13/17] media: i2c: Add controls from fwnode to ov8865 Date: Tue, 23 Nov 2021 00:00:13 +0000 Message-Id: <20211123000017.43187-14-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123000017.43187-1-djrscally@gmail.com> References: <20211123000017.43187-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add V4L2_CID_CAMERA_ORIENTATION and V4L2_CID_CAMERA_SENSOR_ROTATION controls to the ov8865 driver by attempting to parse them from firmware. Signed-off-by: Daniel Scally --- Changes in v5: - None drivers/media/i2c/ov8865.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index 811438c44b58..45b569f1e7c0 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -2515,6 +2515,7 @@ static int ov8865_ctrls_init(struct ov8865_sensor *sensor) struct v4l2_ctrl_handler *handler = &ctrls->handler; const struct v4l2_ctrl_ops *ops = &ov8865_ctrl_ops; const struct ov8865_mode *mode = &ov8865_modes[0]; + struct v4l2_fwnode_device_properties props; unsigned int vblank_max, vblank_def; unsigned int hblank; int ret; @@ -2578,6 +2579,15 @@ static int ov8865_ctrls_init(struct ov8865_sensor *sensor) v4l2_ctrl_new_std(handler, NULL, V4L2_CID_PIXEL_RATE, 1, INT_MAX, 1, 1); + /* set properties from fwnode (e.g. rotation, orientation) */ + ret = v4l2_fwnode_device_parse(sensor->dev, &props); + if (ret) + goto error_ctrls; + + ret = v4l2_ctrl_new_fwnode_properties(handler, ops, &props); + if (ret) + goto error_ctrls; + if (handler->error) { ret = handler->error; goto error_ctrls; From patchwork Tue Nov 23 00:00:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12633213 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 70276C433F5 for ; Tue, 23 Nov 2021 00:01:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232931AbhKWAEW (ORCPT ); Mon, 22 Nov 2021 19:04:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232841AbhKWADt (ORCPT ); Mon, 22 Nov 2021 19:03:49 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7719C0613E0 for ; Mon, 22 Nov 2021 16:00:38 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id g191-20020a1c9dc8000000b0032fbf912885so1120356wme.4 for ; Mon, 22 Nov 2021 16:00:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=U9ZVbvAuegXr+a+vlcFgH630TcEnv1wQ1dMPufLVmio=; b=OORmd6iaMoobwEvQDMy65A2bI9tvY0rz2VuEsfii6JXtrnUo12AlVnCMlAOokt+zeW a/oFIvfNI0B7jM7FiCjsrVj3BklvQSmaRiIZvEFpBc+KMH9M/ditmVDbKojdsIN/mXp6 0i1LM3wVA465aFZ0dGgV4+e1mrgoDhcvGYV7wqwM+A4tJzPtYuBJHLrN+tKNfQoCilRH YBLI+7upMdLWRuPspzvqz39OAZRos4GgyOQjwIGXzJieDZtMfC1MbdCic0kuHPwZO2Ju iwkX6/f5VrMf8scry7miDKmJiD71XNaP2VTVHJEZDE5ZTrD8Y5MU/YaJlhQMxqiieefQ cBBQ== 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=U9ZVbvAuegXr+a+vlcFgH630TcEnv1wQ1dMPufLVmio=; b=5uAmBd2zYtOWplePFZt5rYhVY01DI4LmU5VNbQCj+ic80VdcvDKh5Dj5qMn9hD9S26 79JGBl0SDRhJaS4cdPJ9uknBaKIzl66z07fOyPxo+JXEkr0biyzKZc2F08P9gDDneV4n Lmn2lcFZ87lgx/1jzWSX44MCBVELUszfCQTY7/f9KYmHyLI6sZtQ0pd3QDJ4R3IP1wEn nFGByB6ec9UkbxxbN9zvr0zsQfZL5GaewC+9rwFGrj46YfU8k6kPUmUqiBIDwtJRZpIH Rmp3GBhJLYOP6pwC4UqxFX5gMzDHgvKOH+ALm9WbLUxU4CBZhu0s6rYN7UHs+/gwSiB3 0flA== X-Gm-Message-State: AOAM531YR+F6AqWD9+5oZlK6Qs5RYVufTz/IeKQ3RbOGvbcdB7+v3Hm1 HuxKf00SsgUSDazqqKIP1CbJURjmsZA= X-Google-Smtp-Source: ABdhPJwgZk1Kbq0eKvkkvDMcd73lA1RU7weKuELttT56aNPz4R1gs4ZKBeTLycEtsgK5YENDI31zRg== X-Received: by 2002:a1c:1d42:: with SMTP id d63mr34896338wmd.184.1637625637496; Mon, 22 Nov 2021 16:00:37 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id s13sm23650782wmc.47.2021.11.22.16.00.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 16:00:37 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, paul.kocialkowski@bootlin.com Cc: sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com, laurent.pinchart@ideasonboard.com, yong.zhi@intel.com, bingbu.cao@intel.com, jeanmichel.hautbois@ideasonboard.com, kieran.bingham@ideasonboard.com, hdegoede@redhat.com Subject: [PATCH v5 14/17] media: i2c: Switch exposure control unit to lines Date: Tue, 23 Nov 2021 00:00:14 +0000 Message-Id: <20211123000017.43187-15-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123000017.43187-1-djrscally@gmail.com> References: <20211123000017.43187-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The ov8865 driver currently has the unit of the V4L2_CID_EXPOSURE control as 1/16th of a line. This is what the sensor expects, but isn't very intuitive. Switch the control to be in units of a line and simply do the 16x multiplication before passing the value to the sensor. The datasheet for this sensor gives minimum exposure as 2 lines, so take the opportunity to correct the lower bounds of the control. Signed-off-by: Daniel Scally Tested-by: Jean-Michel Hautbois Reviewed-by: Jean-Michel Hautbois --- Changes in v5: - None drivers/media/i2c/ov8865.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index 45b569f1e7c0..1cc9f78bb97a 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -2126,6 +2126,9 @@ static int ov8865_exposure_configure(struct ov8865_sensor *sensor, u32 exposure) { int ret; + /* The sensor stores exposure in units of 1/16th of a line */ + exposure *= 16; + ret = ov8865_write(sensor, OV8865_EXPOSURE_CTRL_HH_REG, OV8865_EXPOSURE_CTRL_HH(exposure)); if (ret) @@ -2527,8 +2530,8 @@ static int ov8865_ctrls_init(struct ov8865_sensor *sensor) /* Exposure */ - ctrls->exposure = v4l2_ctrl_new_std(handler, ops, V4L2_CID_EXPOSURE, 16, - 1048575, 16, 512); + ctrls->exposure = v4l2_ctrl_new_std(handler, ops, V4L2_CID_EXPOSURE, 2, + 65535, 1, 32); /* Gain */ From patchwork Tue Nov 23 00:00:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12633207 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 6163AC433F5 for ; Tue, 23 Nov 2021 00:01:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231150AbhKWAEN (ORCPT ); Mon, 22 Nov 2021 19:04:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232867AbhKWADt (ORCPT ); Mon, 22 Nov 2021 19:03:49 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DBD9C0613E1 for ; Mon, 22 Nov 2021 16:00:40 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id 77-20020a1c0450000000b0033123de3425so640648wme.0 for ; Mon, 22 Nov 2021 16:00:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nmycPypIJ0tQoO6fOl5oVytxmaegv4XnGAjK0yMO+p0=; b=SV0nCM6oVVOmXRjSvIvFfpafcNz4W7cSMvE4zhsTI5TmGUl/vZ3WoNwBcvNm3Ea42i bstZCxGFsBSvu2s08w3zlsPhaHlOOp1qw1T8XyeTQzNkSn16mWHGYceqHpM+WsJf4v4w Fqzr+3uMZZjiZ6Mx0LQv4RPzVhKA4JGjwoxKpJaDFYdj0KyUmnNjTs3qey3MIiUb5Phd d4KEJxs3vLDNxSSrgp7dsDWbwa4x+WmV7T+GNhVDNyJpxDbWw3ue7VNnMmgtueTNrqKy tnBf54euEK2OVHm037T37h8p9xeylKjjpvHqZxLCa05vYZ+7JbjnqNKN2cWHwE6PvyI3 N8rw== 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=nmycPypIJ0tQoO6fOl5oVytxmaegv4XnGAjK0yMO+p0=; b=Z+/tGCEXBt5jLFSSjlu8F8+sDVdM4hqH9b2c9sM8F1Hab+dnFy0A4YI+EWJ0MiGb2H Uw+cSSlQZ9O7JQ9GPHYSwtYZqungs/AnV/P4/kibpPhLY+3VgZPKOyS2EFw23Y7APPKu t+t+rzdDK0u06H34vN5NXkSC6ujNDuB8QXFqmp/V+AW+HVwP12e2gL8uur3s5nKFkERy dRq1HJthDPDg5oNRr/IiA3J/4OpEKwaoQIHFYwyBCpLvV46/NXxV8PdwFWO7xhdknkW1 h4TmqOLokKNeKNeyEWw9ls6+Rc8ovpt+Y/MmoBEhpfNj1pDYNp+9ovnqtEDVFqp5Dxrs +VaA== X-Gm-Message-State: AOAM5320pQMAVEs+BR7ohtw2K70UsmyRF4l4CjtdXO/NY5wQgc3fsti+ KvFxYy+vIAEjjY1z2vDAOLbW8oWMuK8= X-Google-Smtp-Source: ABdhPJxPuOWcToVlO2dKUIQhkGpMchzoAsnNFg/FL137ckpd4JwSRUliAzNqpNYpjHAuv43F/P6fhA== X-Received: by 2002:a05:600c:1e8d:: with SMTP id be13mr34779858wmb.79.1637625638733; Mon, 22 Nov 2021 16:00:38 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id s13sm23650782wmc.47.2021.11.22.16.00.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 16:00:38 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, paul.kocialkowski@bootlin.com Cc: sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com, laurent.pinchart@ideasonboard.com, yong.zhi@intel.com, bingbu.cao@intel.com, jeanmichel.hautbois@ideasonboard.com, kieran.bingham@ideasonboard.com, hdegoede@redhat.com Subject: [PATCH v5 15/17] media: i2c: Use dev_err_probe() in ov8865 Date: Tue, 23 Nov 2021 00:00:15 +0000 Message-Id: <20211123000017.43187-16-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123000017.43187-1-djrscally@gmail.com> References: <20211123000017.43187-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There is a chance that regulator_get() returns -EPROBE_DEFER, in which case printing an error message is undesirable. To avoid spurious messages in dmesg in the event that -EPROBE_DEFER is returned, use dev_err_probe() on error paths for regulator_get(). Signed-off-by: Daniel Scally --- Changes in v5: - None drivers/media/i2c/ov8865.c | 46 +++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index 1cc9f78bb97a..1aa577dba0a3 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -2957,6 +2957,26 @@ static int ov8865_probe(struct i2c_client *client) sensor->dev = dev; sensor->i2c_client = client; + /* Regulators */ + + /* DVDD: digital core */ + sensor->dvdd = devm_regulator_get(dev, "dvdd"); + if (IS_ERR(sensor->dvdd)) + return dev_err_probe(dev, PTR_ERR(sensor->dvdd), + "cannot get DVDD regulator\n"); + + /* DOVDD: digital I/O */ + sensor->dovdd = devm_regulator_get(dev, "dovdd"); + if (IS_ERR(sensor->dovdd)) + return dev_err_probe(dev, PTR_ERR(sensor->dovdd), + "cannot get DOVDD regulator\n"); + + /* AVDD: analog */ + sensor->avdd = devm_regulator_get(dev, "avdd"); + if (IS_ERR(sensor->avdd)) + return dev_err_probe(dev, PTR_ERR(sensor->avdd), + "cannot get AVDD (analog) regulator\n"); + /* Graph Endpoint */ handle = fwnode_graph_get_next_endpoint(dev_fwnode(dev), NULL); @@ -2987,32 +3007,6 @@ static int ov8865_probe(struct i2c_client *client) goto error_endpoint; } - /* Regulators */ - - /* DVDD: digital core */ - sensor->dvdd = devm_regulator_get(dev, "dvdd"); - if (IS_ERR(sensor->dvdd)) { - dev_err(dev, "cannot get DVDD (digital core) regulator\n"); - ret = PTR_ERR(sensor->dvdd); - goto error_endpoint; - } - - /* DOVDD: digital I/O */ - sensor->dovdd = devm_regulator_get(dev, "dovdd"); - if (IS_ERR(sensor->dovdd)) { - dev_err(dev, "cannot get DOVDD (digital I/O) regulator\n"); - ret = PTR_ERR(sensor->dovdd); - goto error_endpoint; - } - - /* AVDD: analog */ - sensor->avdd = devm_regulator_get(dev, "avdd"); - if (IS_ERR(sensor->avdd)) { - dev_err(dev, "cannot get AVDD (analog) regulator\n"); - ret = PTR_ERR(sensor->avdd); - goto error_endpoint; - } - /* External Clock */ sensor->extclk = devm_clk_get(dev, NULL); From patchwork Tue Nov 23 00:00:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12633209 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 22537C433F5 for ; Tue, 23 Nov 2021 00:01:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232923AbhKWAEQ (ORCPT ); Mon, 22 Nov 2021 19:04:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232879AbhKWADt (ORCPT ); Mon, 22 Nov 2021 19:03:49 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F3CEC0613F1 for ; Mon, 22 Nov 2021 16:00:41 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id c4so35662792wrd.9 for ; Mon, 22 Nov 2021 16:00:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KIGNvcARpMlW7oz6VNmdq8EGxgVuFaq/E3tv969Js34=; b=oC4YQ7tcCT1MQe8Q0JEwMd8RWPnyrlayXdlMgX3Ozyn37o1fUcrxwrd5hhg7Eumxrn z6hzO2yssQGa+WEpvumtanMZiBKVOzJ6NITUG1xZxOcLkjayCeGEfKDAK1XAlgRsCIhG GK604iJ1iALgqNiGAgoTfbSQNrCesgeV49CGsH78gjRrzzrKTPihG9CrLb+IG2AGDEh5 eWJbNy3dAXq1R434i3qpKMoCS2DUpBAujI30t8aaUTsQ/MEKMUYu5BUz5g1DvY/QR4kl 8D4o2NTmqjqzBvlsL4EWEkE2PuHueZdQfkIen3JWeF2hPEwHirl3v+5oQoOitSvTGFQn 8GbA== 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=KIGNvcARpMlW7oz6VNmdq8EGxgVuFaq/E3tv969Js34=; b=xpa2PhlpjU6n+pF9yTdqo5D9UPWULUoTpaO9AY4XqGy/WFSRcaHOSOqFtTX9+LHNh3 0ON2cGfnc0TN/jbeQxmeNaGTRLVulFlbRlKfiQuuFVgkhggs2Dz7PQw6oBlbxgXsXJR/ ZFfXu3KydH9pKwAV8G5ZK29HQW414g3TbP+9uR8Pf7kwDLrOKZFWEiH5PTJzBR+8gh/V dUOvW72poaj//vCvwbSmF8UjZgFmrG2P8AY6AM3SkhbqIiFi/Yvj5WeG0UU24H1wQ/gk 694EZvE4FgFd/N/R3APCQlHebL0yI0s/HzAD3Kbcj3TUMW7YDT+51ftwQgGHsivYo00R +6kQ== X-Gm-Message-State: AOAM531O8/xR/0UOv/M879NS5AX79iiD2qq5er4QhKxqt9tMzdrC8Uoq Ksy+CfS/t0csjou/K1vPGftfWOLO5JM= X-Google-Smtp-Source: ABdhPJyNcMFh13MFcuoPmyRQDjpVW25hKnVlPQA1cSBLrG4zm8P2/iQV9pu8FVtikQSYRtciD2ozAg== X-Received: by 2002:a5d:4846:: with SMTP id n6mr1565192wrs.249.1637625639729; Mon, 22 Nov 2021 16:00:39 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id s13sm23650782wmc.47.2021.11.22.16.00.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 16:00:39 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, paul.kocialkowski@bootlin.com Cc: sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com, laurent.pinchart@ideasonboard.com, yong.zhi@intel.com, bingbu.cao@intel.com, jeanmichel.hautbois@ideasonboard.com, kieran.bingham@ideasonboard.com, hdegoede@redhat.com Subject: [PATCH v5 16/17] media: i2c: Fix max gain in ov8865 Date: Tue, 23 Nov 2021 00:00:16 +0000 Message-Id: <20211123000017.43187-17-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123000017.43187-1-djrscally@gmail.com> References: <20211123000017.43187-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The maximum gain figure in the v4l2 ctrl is wrong. The field is 12 bits wide, which is where the 8191 figure comes from, but the datasheet is specific that maximum gain is 16x (the low seven bits are fractional, so 16x gain is 2048) Signed-off-by: Daniel Scally --- Changes in v5: - Patch added drivers/media/i2c/ov8865.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index 1aa577dba0a3..ebdb20d3fe9d 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -2535,7 +2535,7 @@ static int ov8865_ctrls_init(struct ov8865_sensor *sensor) /* Gain */ - v4l2_ctrl_new_std(handler, ops, V4L2_CID_ANALOGUE_GAIN, 128, 8191, 128, + v4l2_ctrl_new_std(handler, ops, V4L2_CID_ANALOGUE_GAIN, 128, 2048, 128, 128); /* White Balance */ From patchwork Tue Nov 23 00:00:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12633205 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 A2C51C433F5 for ; Tue, 23 Nov 2021 00:01:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232615AbhKWAEL (ORCPT ); Mon, 22 Nov 2021 19:04:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232579AbhKWADu (ORCPT ); Mon, 22 Nov 2021 19:03:50 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE337C06173E for ; Mon, 22 Nov 2021 16:00:41 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id d27so35752074wrb.6 for ; Mon, 22 Nov 2021 16:00:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eBgM5YIUKdVJWZmB9Bdu+nzzi7aCarsQ2Djtv4VPP7w=; b=jmgNmeljKZxDQ8ypUvfQj1hXYQ7NX2p9+2EgzAvsHjxCE1qyPLpTiouc4HVVHG8qt+ rECNUUyfucevmbny9f0u4ePsImSzTega970upIWXSQlSsm/XPUdaR7UjH3KGGk9xEAIU eD4Ndwu/COxxBj497eCKoOcpmUDr+HTBIMqtKs16xnVga/QoNtMHko7cVI9gst4vBF7R oLkw3KN1JCgZKr/LE0FVUd55J+OM76o/dz11X/GdES1Ww1jh/+S/Xr5Ksb3/gAgde2wg yEqcXNkSL8cV2/LklQPfQnjH3MGeUWz4wXLNoSTyWCl0Ve8VC6KDIBi/tOLr+Xv120MW LQXw== 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=eBgM5YIUKdVJWZmB9Bdu+nzzi7aCarsQ2Djtv4VPP7w=; b=VGkIT3qhLEUTkN5UDMg+twg2vVR2CgxMP8A/kRqemZ751iyYBbo3Amw8ATXHotbB/8 4DRIWbDHan4QB7GhwTW7QEBoa0sZW2Y0kY6Ph7gIKStEVB0cQN/e96DsVBpIbNtJ+b3c uFTJqKmTF79qDRIJaO3YGzZiaTNFluu++eqxz8+7csq9B0ApFdfPdrIX/Z6U90quhBoE LflGMyA7jPX+FIJwBqpIbxNp1+GMKvFm9nie95ATxoM3wUyoau0+lBkOvl86btdQ/y2a hjoIdi14OMnaDsrBY+91TSDOk0IyX6pxi04BcMi9oysfYqAPexeuSopGbLLKPr8xO53c 52fw== X-Gm-Message-State: AOAM530SOCz3Wb6JarttkkiOmtKZMw1lmeCIjZ+AJf/0fm89Irta81+s p27d0iyRXvGRMmUXhirTTeEwo6xJv58= X-Google-Smtp-Source: ABdhPJx1AsUGxU8WbEHjG7ez5adJ+QVHAlCDaHp282cWptVQupr1GRfr9g9hpfa97r/zTfu86AjNvg== X-Received: by 2002:a5d:4b0e:: with SMTP id v14mr1750227wrq.196.1637625640651; Mon, 22 Nov 2021 16:00:40 -0800 (PST) Received: from localhost.localdomain (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net. [86.13.91.161]) by smtp.gmail.com with ESMTPSA id s13sm23650782wmc.47.2021.11.22.16.00.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 16:00:40 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org, paul.kocialkowski@bootlin.com Cc: sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com, laurent.pinchart@ideasonboard.com, yong.zhi@intel.com, bingbu.cao@intel.com, jeanmichel.hautbois@ideasonboard.com, kieran.bingham@ideasonboard.com, hdegoede@redhat.com, Andy Shevchenko Subject: [PATCH v5 17/17] media: ipu3-cio2: Add INT347A to cio2-bridge Date: Tue, 23 Nov 2021 00:00:17 +0000 Message-Id: <20211123000017.43187-18-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123000017.43187-1-djrscally@gmail.com> References: <20211123000017.43187-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org ACPI _HID INT347A represents the OV8865 sensor, the driver for which can support the platforms that the cio2-bridge serves. Add it to the array of supported sensors so the bridge will connect the sensor to the CIO2 device. Reviewed-by: Andy Shevchenko Signed-off-by: Daniel Scally --- Changes in v5: - None drivers/media/pci/intel/ipu3/cio2-bridge.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/pci/intel/ipu3/cio2-bridge.c b/drivers/media/pci/intel/ipu3/cio2-bridge.c index 0b586b4e537e..4550be801311 100644 --- a/drivers/media/pci/intel/ipu3/cio2-bridge.c +++ b/drivers/media/pci/intel/ipu3/cio2-bridge.c @@ -22,6 +22,8 @@ static const struct cio2_sensor_config cio2_supported_sensors[] = { /* Omnivision OV5693 */ CIO2_SENSOR_CONFIG("INT33BE", 0), + /* Omnivision OV8865 */ + CIO2_SENSOR_CONFIG("INT347A", 1, 360000000), /* Omnivision OV2680 */ CIO2_SENSOR_CONFIG("OVTI2680", 0), };