From patchwork Thu Jul 22 20:33:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12394659 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6DD3C4338F for ; Thu, 22 Jul 2021 20:34:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C173C60EB5 for ; Thu, 22 Jul 2021 20:34:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230465AbhGVTxz (ORCPT ); Thu, 22 Jul 2021 15:53:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230429AbhGVTxy (ORCPT ); Thu, 22 Jul 2021 15:53:54 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 135B9C061757; Thu, 22 Jul 2021 13:34:28 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id l4so76112wrs.4; Thu, 22 Jul 2021 13:34:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vzW8GMtaQ4KcRpdIHbGNsw4JG8M1qRceMOo6dYenjfc=; b=oCHwo2CcmBrFYiWf9q1Uit4Tvthunuo8sQPnOPNSfTW1nf2jwcU6ztjs5VwPOkuRqa Z+ePwWK1Qwpo3ErzxW9IctM/2K7CxDlplnA6wU92AByhujI+y6nLk6mdGhFOx+opPq4D Blsm/PN/c6MM1P0+JiCMz7JgCD4x7wmdrRvy6ldI+ddbwndkc4d5UVFvVnNTv89tn58E 3SGvRpzuGCy9pHmpTn+t/I6KSWoicmYprniVZ/4tfD8xsmo/djdnZ/uKtTdXG0R8mO5a JSn/pDFBNTRRpqDTETXtHxSkFFIPDb6GlKQy5pEnqGzSyQPh1GPCjb9vCEi8PU0fVIby OODw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vzW8GMtaQ4KcRpdIHbGNsw4JG8M1qRceMOo6dYenjfc=; b=dpIL1WgI0/nYQBBruPadmre33CoU2NPMhbRqfGWUsq9aHXn9bT5aR5EQJO5B9r0jDO 4SoL56tpdTKIedMp+6fBpkqAtEEpUFjCtSuuPAkvjfV948FAcWekfJyqH7DfURVPebX/ M7l51I1SZShS0QPY5H99CjGGG3JTUI7JRIVlNs818KqiBZXDPUqgZZEu3UWcO1N/uW0v DoVxB9q7lBBHX+bpf7kBm0yc+KXejqaVGaFavZY1MKzJRKzZdjtokVVgK8jOU8VTLoLY SMA05b94VtJpWtvaYi4vEdUbXSQX/dtG4NEp3LPIocSTZWBtqI2Vrz1oX6xkRjWuHSgx BEKg== X-Gm-Message-State: AOAM533Cr6PNgHbg0JvIR0aR9z7wy/pRWrAh4IV/Az/xjAtoe2UrrlYZ /420tHO2HAPVBha16kBOpJbnJyVXBL4= X-Google-Smtp-Source: ABdhPJx2zSqDwrfDSNQRKtL1DeWx08i0724Uqu1FwG5Z85/i5PjwlRGxfP0IKnMByzKpT9VcIpLFdg== X-Received: by 2002:a5d:4522:: with SMTP id j2mr1685636wra.43.1626986066693; Thu, 22 Jul 2021 13:34:26 -0700 (PDT) Received: from valhalla.home ([2.29.20.106]) by smtp.gmail.com with ESMTPSA id b16sm31036455wrw.46.2021.07.22.13.34.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 13:34:26 -0700 (PDT) From: Daniel Scally To: Daniel Scally , Mauro Carvalho Chehab , Sakari Ailus , Paul Kocialkowski , Ezequiel Garcia , Hans Verkuil , Yang Li , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list) Cc: Yong Zhi , Bingbu Cao , Tianshu Qiu , Colin Ian King , laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com Subject: [PATCH 01/13] media: i2c: Add ACPI support to ov8865 Date: Thu, 22 Jul 2021 21:33:55 +0100 Message-Id: <20210722203407.3588046-2-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210722203407.3588046-1-djrscally@gmail.com> References: <20210722203407.3588046-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 --- 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 ce50f3ea87b8..fe60cda3dea7 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -5,6 +5,7 @@ * Author: Paul Kocialkowski */ +#include #include #include #include @@ -2946,6 +2947,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" }, { } @@ -2956,6 +2963,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 Thu Jul 22 20:33:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12394661 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F9BEC43214 for ; Thu, 22 Jul 2021 20:34:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5388060EBC for ; Thu, 22 Jul 2021 20:34:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231131AbhGVTyI (ORCPT ); Thu, 22 Jul 2021 15:54:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230467AbhGVTx4 (ORCPT ); Thu, 22 Jul 2021 15:53:56 -0400 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 F25B6C06175F; Thu, 22 Jul 2021 13:34:28 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id q16-20020a1ca7100000b0290236ec98bebaso388606wme.1; Thu, 22 Jul 2021 13:34:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aCSiRsSc77XUIHiH+AnKMlHAFci4QLpzq2T2vg3uLkE=; b=VQ7ukDiTvqcYlJjMTCKFQ3Iy448egN2KbomVv5JI0o8Lfycwx6F80gGF1QR67w2qSd 7EwINe9p7IF+SHJiBXu3uIecL4gVnUuXTI6Lddu/r2MiH2Gd336LiFjSwatx2wOz7j+a 5zUs1WGWWVxmqQdzBJfVp3FJ+ApC53hDn8PCKsMZdh/SG79U+aCreTt4CHx22ETGHAZr rmjghV5dcmlCDzq+XoweuBIhyoO6JrOH/l07P7sPA5ToZg1RpKuUPjYslHGX9e9Rf/IM j9nQUx+NwXE8yGKaDRwroJvAkrGPt7M5rnHZrnqweq2DZt18XW2uxCM4Ox2c8b9G38re Qoaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aCSiRsSc77XUIHiH+AnKMlHAFci4QLpzq2T2vg3uLkE=; b=RtpzUx8l5kXdivAUP89qyWbmLbl9OxkRmK7elWurjgrFuDjgTMzKGa2fYEtaHab/uN ilCkUJROPPeRR97snsW3D8HVzY3Fa+hUehbIIBvwRNXn+gwhfSh/YUuHiJTIXdebZB5i MhzJxLIQN18AjXEvWwqeH4GS0f/vTDZ4yXmJGAIbyp5WDAHtO8lDFuSa+ws/8kw/SUaa mgSS+nr6Y/b+SPqQM0Vw+UEZJ/vMEyS52KoWVCMe7NJK0WKpJjYFmhMjG7TqiGhMKwr1 5khXrhXZ+mPIlBf6yXEylAcytkqZnX+DbbKQa+bWXmyNiNx1FurVv+qO5qmCfjiyKDhH mOrQ== X-Gm-Message-State: AOAM532axK+QLUZkRHZW3h/98gl1d7ga4VZjvbueNoUPQdm8C1vzHJ38 TOLDPEGAd6uczYcjD+me86k= X-Google-Smtp-Source: ABdhPJyw9Qe1SeItVB5HS4QSD91MmzQXAZDhhqvLC74eih6JHgdmDdTMiCzkntk7AV9zHULyLfRpyw== X-Received: by 2002:a1c:ed0a:: with SMTP id l10mr1276053wmh.151.1626986067646; Thu, 22 Jul 2021 13:34:27 -0700 (PDT) Received: from valhalla.home ([2.29.20.106]) by smtp.gmail.com with ESMTPSA id b16sm31036455wrw.46.2021.07.22.13.34.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 13:34:27 -0700 (PDT) From: Daniel Scally To: Daniel Scally , Mauro Carvalho Chehab , Sakari Ailus , Paul Kocialkowski , Ezequiel Garcia , Hans Verkuil , Yang Li , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list) Cc: Yong Zhi , Bingbu Cao , Tianshu Qiu , Colin Ian King , laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com Subject: [PATCH 02/13] media: i2c: Fix incorrect value in comment Date: Thu, 22 Jul 2021 21:33:56 +0100 Message-Id: <20210722203407.3588046-3-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210722203407.3588046-1-djrscally@gmail.com> References: <20210722203407.3588046-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. Signed-off-by: Daniel Scally Reviewed-by: Paul Kocialkowski --- 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 fe60cda3dea7..2ef146e7e7ef 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 Thu Jul 22 20:33:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12394663 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 395CFC4338F for ; Thu, 22 Jul 2021 20:34:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1C14A60EB6 for ; Thu, 22 Jul 2021 20:34:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231201AbhGVTyJ (ORCPT ); Thu, 22 Jul 2021 15:54:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230479AbhGVTx4 (ORCPT ); Thu, 22 Jul 2021 15:53:56 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CC82C061575; Thu, 22 Jul 2021 13:34:30 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id n4so4066665wms.1; Thu, 22 Jul 2021 13:34:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=k4qNnWFiHZbuAXHFsT+bKVbo+jmeTJ2ycqVV3Ikcsts=; b=BSImA2lwtaRokOJRUn5SwmTIPFyLWwyhK/M/tQvrARgoEoBaLrf3tZBUD/FRtOh3tp eiUOsGctClX0UX33WUdnPT14ahGDVjcvcALlhxRsEUig1lOwuyvw9wqESfWkLvd/CjSM oo5Y//Z2DB8CGNE3pVWWaeUa142YyoAeO7dXSWIYI4TG+9lmAP6W9LzgRcrsR/20z19e FoTIC8vm94svw6bimIsuObgAshpX08ZAGrpQNukI9sVkcDGnAg6T+ft6zOftvsVlEswY u62tpQN1k5ibMfVHYJpN7w5dgbIkU3iyUH3JAJdRsOi7kikryAXdSCQTXsBXUP+MwUht OIig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=k4qNnWFiHZbuAXHFsT+bKVbo+jmeTJ2ycqVV3Ikcsts=; b=RRZ+29akMs9jcBlFxfxVC+VPbfj0aCj8gAASSVMEGdMBF3dOxhaVl5x3O9Gkj4fBxc vq38b4Ip/TEHxIHoDZ6Fxcn2diWUok+pIOk+SXaggnYW5i3+qrvUBpOy9inhjNu4RfCh /aRf8avk2hN3LRuFtpdG0CXI2IEV7SEHDtvYzJPRkoI86hQICaU95p9+3BVk2MTmS6+j jQQK0QZbFhvjOlWTXP703z3vflXBT9BogSGEte7JxEub+2YqTweikhHZMZIvFwIZcYKH XZ9QcfMkM9vVAdcclrChA0pkqU5KjIDuuOOykksUVGBDiR5M+5JXBDkr/55JKanf0xxk kaZQ== X-Gm-Message-State: AOAM532DhnDWxTccBCU+qJ9UKIhDHkYQ9O5zDHI8kbGEVMrl7+fdXMAv c8/RXcRkdC/EFbFys5KVewPmW9UVK0A= X-Google-Smtp-Source: ABdhPJxuUYOIrMjTT0PHXDGl123GNVze3cIfwmvhX3Am/8DZBNlyAGuBTELDFZaVArxEef5w3rzb7w== X-Received: by 2002:a05:600c:4ca7:: with SMTP id g39mr1308902wmp.72.1626986068657; Thu, 22 Jul 2021 13:34:28 -0700 (PDT) Received: from valhalla.home ([2.29.20.106]) by smtp.gmail.com with ESMTPSA id b16sm31036455wrw.46.2021.07.22.13.34.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 13:34:28 -0700 (PDT) From: Daniel Scally To: Daniel Scally , Mauro Carvalho Chehab , Sakari Ailus , Paul Kocialkowski , Ezequiel Garcia , Hans Verkuil , Yang Li , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list) Cc: Yong Zhi , Bingbu Cao , Tianshu Qiu , Colin Ian King , laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com Subject: [PATCH 03/13] media: i2c: Defer probe if not endpoint found Date: Thu, 22 Jul 2021 21:33:57 +0100 Message-Id: <20210722203407.3588046-4-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210722203407.3588046-1-djrscally@gmail.com> References: <20210722203407.3588046-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 --- 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 2ef146e7e7ef..66182142c28b 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 Thu Jul 22 20:33:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12394667 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BA5AC4338F for ; Thu, 22 Jul 2021 20:34:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E68AB60EBA for ; Thu, 22 Jul 2021 20:34:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231245AbhGVTyK (ORCPT ); Thu, 22 Jul 2021 15:54:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230526AbhGVTx6 (ORCPT ); Thu, 22 Jul 2021 15:53:58 -0400 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 7B636C061757; Thu, 22 Jul 2021 13:34:31 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id g12so4070317wme.2; Thu, 22 Jul 2021 13:34:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HNd/zrFSnbVVK7tkVRqXgL3ZTic0XmSJrzcwHUq0XkQ=; b=a3gJDB86ofKDN3ZwkGguIggb5pxkABuCH2vqJf/+hRte8qePyV6hKOMYhPkT/iwMk+ XQ1GIDqu4a3++cCx3FhIe/3UsBJmhkGXAFoN6DdTKJdzYFToyvcQ5T8Fu3ELVExgL8wU APqGXsxGGkAfnl0TdMRHMyHoPxxslXkh511rZ0+aVKz/SMUSsCOYVMoVGvmzva0/gzJR 2U1MAwvn9zyjA7boMx4piCmOjA0IhQl9suqwpHa97Es2ahLOmb+e0pv/diAHhztMG01a 2t+SMSgrAUPACRnKlMQvuyJbQd4CKrBzLaAlKz3iwC2F1dGiqazpE2VMwB09BD0QfMK1 D9eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HNd/zrFSnbVVK7tkVRqXgL3ZTic0XmSJrzcwHUq0XkQ=; b=AAzsSecS5/q3GY+n58Um9uHe4FxfXIYYlyesfp5HaBA+xqZDPdKG30Spdiq69dWWzQ xaDgt2dYg2iciHLDs7pz5EGpeT+xhtMgIaqMNTaaJ3SvFnm34Cwvpe5Q43izytt1O3sn H1kJWb+LtrSdLfqR8uHdGEDPyhBaqwKStn3tFoQZek00oLz/VdG6y+sRUqktXaEcfuLE kkrwC49NGvf4yHhV1cL5fuEW+5BVKv+tp4o11+vqLZao2PL0ywwCkWUGnSfB1fFcEo8N RLZLVr8c895V9jc7UF8qfYcqIfCEH4TL23DTlQ5LVGPmbCi03LjRbnH6gYMyHd9rZWRN Totw== X-Gm-Message-State: AOAM5327WVCbddQ8lLMJn3S0Bqb97OZF+i5M3V6ek+DCtJ3IV1/SPOyA IUEg3HHJAxXL+8WL8kiAXbY= X-Google-Smtp-Source: ABdhPJz+t4qUAGg3biFXCrklIBGjL8wMqIqI+QhxXLEIlZFzzY0u9ajyv4sU75PWjsCh29BsJuvAQw== X-Received: by 2002:a7b:cd9a:: with SMTP id y26mr10751114wmj.76.1626986070049; Thu, 22 Jul 2021 13:34:30 -0700 (PDT) Received: from valhalla.home ([2.29.20.106]) by smtp.gmail.com with ESMTPSA id b16sm31036455wrw.46.2021.07.22.13.34.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 13:34:29 -0700 (PDT) From: Daniel Scally To: Daniel Scally , Mauro Carvalho Chehab , Sakari Ailus , Paul Kocialkowski , Ezequiel Garcia , Hans Verkuil , Yang Li , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list) Cc: Yong Zhi , Bingbu Cao , Tianshu Qiu , Colin Ian King , laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com Subject: [PATCH 04/13] media: i2c: Support 19.2MHz input clock in ov8865 Date: Thu, 22 Jul 2021 21:33:58 +0100 Message-Id: <20210722203407.3588046-5-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210722203407.3588046-1-djrscally@gmail.com> References: <20210722203407.3588046-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 --- drivers/media/i2c/ov8865.c | 158 +++++++++++++++++++++++++++---------- 1 file changed, 115 insertions(+), 43 deletions(-) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index 66182142c28b..8739eea762c5 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 */ @@ -665,6 +661,9 @@ struct ov8865_sensor { struct regulator *avdd; struct regulator *dvdd; struct regulator *dovdd; + + unsigned long extclk_rate; + unsigned int extclk_rate_idx; struct clk *extclk; struct v4l2_fwnode_endpoint endpoint; @@ -680,49 +679,83 @@ 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_configs_native[] = { + { /* 19.2 MHz input clock */ + .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, + }, + { /* 24MHz input clock */ + .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_configs_native[] = { + /* 19.2MHz input clock */ + { + .pll_pre_div_half = 1, + .pll_pre_div = 5, + .pll_mul = 75, + .dac_div = 1, + .sys_pre_div = 1, + .sys_div = 3, + }, + /* 24MHz input clock */ + { + .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_configs_binning[] = { + /* 19.2MHz input clock */ + { + .pll_pre_div_half = 1, + .pll_pre_div = 2, + .pll_mul = 75, + .dac_div = 2, + .sys_pre_div = 10, + .sys_div = 0, + }, + /* 24MHz input clock */ + { .pll_pre_div_half = 1, .pll_pre_div = 0, .pll_mul = 30, .dac_div = 2, .sys_pre_div = 10, .sys_div = 0, + } }; static const struct ov8865_sclk_config ov8865_sclk_config_native = { @@ -934,8 +967,8 @@ static const struct ov8865_mode ov8865_modes[] = { .frame_interval = { 1, 30 }, /* PLL */ - .pll1_config = &ov8865_pll1_config_native, - .pll2_config = &ov8865_pll2_config_native, + .pll1_config = ov8865_pll1_configs_native, + .pll2_config = ov8865_pll2_configs_native, .sclk_config = &ov8865_sclk_config_native, /* Registers */ @@ -990,8 +1023,8 @@ static const struct ov8865_mode ov8865_modes[] = { .frame_interval = { 1, 30 }, /* PLL */ - .pll1_config = &ov8865_pll1_config_native, - .pll2_config = &ov8865_pll2_config_native, + .pll1_config = ov8865_pll1_configs_native, + .pll2_config = ov8865_pll2_configs_native, .sclk_config = &ov8865_sclk_config_native, /* Registers */ @@ -1050,8 +1083,8 @@ static const struct ov8865_mode ov8865_modes[] = { .frame_interval = { 1, 30 }, /* PLL */ - .pll1_config = &ov8865_pll1_config_native, - .pll2_config = &ov8865_pll2_config_binning, + .pll1_config = ov8865_pll1_configs_native, + .pll2_config = ov8865_pll2_configs_binning, .sclk_config = &ov8865_sclk_config_native, /* Registers */ @@ -1116,8 +1149,8 @@ static const struct ov8865_mode ov8865_modes[] = { .frame_interval = { 1, 90 }, /* PLL */ - .pll1_config = &ov8865_pll1_config_native, - .pll2_config = &ov8865_pll2_config_binning, + .pll1_config = ov8865_pll1_configs_native, + .pll2_config = ov8865_pll2_configs_binning, .sclk_config = &ov8865_sclk_config_native, /* Registers */ @@ -1266,6 +1299,13 @@ static const struct ov8865_register_value ov8865_init_sequence[] = { { 0x4503, 0x10 }, }; +/* Clock rate */ + +static const unsigned long supported_extclk_rates[] = { + 19200000, + 24000000, +}; + static const s64 ov8865_link_freq_menu[] = { 360000000, }; @@ -1513,12 +1553,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 = &mode->pll1_config[sensor->extclk_rate_idx]; + pll1_rate = sensor->extclk_rate * config->pll_mul / config->pll_pre_div_half; switch (config->pll_pre_div) { case 0: @@ -1552,10 +1591,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 = &mode->pll1_config[sensor->extclk_rate_idx]; + switch (mbus_code) { case MEDIA_BUS_FMT_SBGGR10_1X10: value = OV8865_MIPI_BIT_SEL(10); @@ -1622,9 +1663,11 @@ 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_config[sensor->extclk_rate_idx]; + 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)); @@ -2053,9 +2096,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 = &mode->pll1_config[sensor->extclk_rate_idx]; + pll1_rate = ov8865_mode_pll1_rate(sensor, mode); return pll1_rate / config->m_div / 2; @@ -2783,7 +2828,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; + unsigned int i; int ret; sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); @@ -2858,13 +2904,39 @@ static int ov8865_probe(struct i2c_client *client) 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. Check for a + * clock-frequency property and if found, set that rate. This should + * cover ACPI case. If the system uses devicetree then the configured + * rate should already be set, so we'll have to check it. + */ + + ret = fwnode_property_read_u32(dev_fwnode(dev), "clock-frequency", + &rate); + if (!ret) { + ret = clk_set_rate(sensor->extclk, rate); + if (ret) { + dev_err(dev, "failed to set clock rate\n"); + return ret; + } + } + + sensor->extclk_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->extclk_rate_idx = i; + /* Subdev, entity and pad */ subdev = &sensor->subdev; From patchwork Thu Jul 22 20:33:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12394665 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32A31C4320E for ; Thu, 22 Jul 2021 20:34:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2043760EB9 for ; Thu, 22 Jul 2021 20:34:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231219AbhGVTyK (ORCPT ); Thu, 22 Jul 2021 15:54:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231133AbhGVTx6 (ORCPT ); Thu, 22 Jul 2021 15:53:58 -0400 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 6B56DC061575; Thu, 22 Jul 2021 13:34:32 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id p9so1966840wmq.5; Thu, 22 Jul 2021 13:34:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Zc8lJhsZsMg2PwiVZ5DjhWyoqaqqGvcwxv1tCnyX65U=; b=tQg/4OjlZfISJ7v0FQq/oNMhbHgJMOFHs0erdfr8XCro6uwr155GyhB9cjuxMpJmtm 8tdiswJfYunNcFYkXbEkUBB6wOqzkxZ96ju+8etmGLviiKDrhKnjbTnA4tAZ76i3t8Pc S1vp/X8jvl4y9k2OUwqsczOuAa1CclNJMKjuspkn2NLZid6y8LVUcjIrF+xxhSAzMD1U E8hbKScPEDwRfiQLodneQYeO+pU6mRQmRbE8BVdGJ07nY5vBQ5GW/qVcgCtUP3IQ6psQ YcVDXFEqQU6xp4hZ4oV/kiTt07MnTXhM1oDCoTzCKNPszCzzzSn9YpPsG3pL+FBuR96e pH8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Zc8lJhsZsMg2PwiVZ5DjhWyoqaqqGvcwxv1tCnyX65U=; b=fyhq8GFPag/xnNatU5dFXikdFjvbCPUQWbnTx454X30BoVebC+VjsXk3brSJNALvVS 0sfGaztWuV7XVsS0XxazTu5Ya9r42r+JoQ6xJIqwbDELnNXwWmeJMfwQ+XCZHOtpr7dq SDvx2p+ZaLgt7jXXXnuyOjZFn9fFUAVMYSUR2YTP3H0vOjnBwwmmnlKSUFLs0Hj5nsbT 4iS/1bA4kchEviCx7e/Nuf7sGVdU+Ec7J0KM7566vs5vlBAqKz7ZOWkCvnJqE3mLAgm+ eJYn6CBx3Srl7RTdAikkyhyEJXlnuqycF+k9OCe/IGPM6QtlqcCywWgg6sxERSNI2Tsz qn9w== X-Gm-Message-State: AOAM532qW9Hogsg8NoxfVsM6bZ0KuVp5NdHEuqjg7I5K/34X+RlBF+Av rF8tIGCPkJ5B1kdFrPhBgWk= X-Google-Smtp-Source: ABdhPJxtTWYjGixe7BdARyeMks/fr1sGf5GNP+HMlKGAhzpJ96G6vOHu0srBkhh0dlcDl1DAFs8Mxg== X-Received: by 2002:a1c:4b0b:: with SMTP id y11mr9184547wma.109.1626986071111; Thu, 22 Jul 2021 13:34:31 -0700 (PDT) Received: from valhalla.home ([2.29.20.106]) by smtp.gmail.com with ESMTPSA id b16sm31036455wrw.46.2021.07.22.13.34.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 13:34:30 -0700 (PDT) From: Daniel Scally To: Daniel Scally , Mauro Carvalho Chehab , Sakari Ailus , Paul Kocialkowski , Ezequiel Garcia , Hans Verkuil , Yang Li , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list) Cc: Yong Zhi , Bingbu Cao , Tianshu Qiu , Colin Ian King , laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com Subject: [PATCH 05/13] media: i2c: Add .get_selection() support to ov8865 Date: Thu, 22 Jul 2021 21:33:59 +0100 Message-Id: <20210722203407.3588046-6-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210722203407.3588046-1-djrscally@gmail.com> References: <20210722203407.3588046-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 Reported-by: kernel test robot --- drivers/media/i2c/ov8865.c | 61 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index 8739eea762c5..c012f5cb11ab 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) \ @@ -2743,12 +2752,64 @@ 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) +{ + 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 = sensor->state.mode->output_size_y; + r->width = sensor->state.mode->output_size_x; + r->top = (OV8865_NATIVE_HEIGHT - sensor->state.mode->output_size_y) / 2; + r->left = (OV8865_NATIVE_WIDTH - sensor->state.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, }; static const struct v4l2_subdev_ops ov8865_subdev_ops = { From patchwork Thu Jul 22 20:34:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 12394683 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F126C4338F for ; Thu, 22 Jul 2021 20:35:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 06AAA60EB8 for ; Thu, 22 Jul 2021 20:35:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231272AbhGVTyN (ORCPT ); Thu, 22 Jul 2021 15:54:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231135AbhGVTx7 (ORCPT ); Thu, 22 Jul 2021 15:53:59 -0400 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 6FB41C06175F; Thu, 22 Jul 2021 13:34:33 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id j2so30599wrx.9; Thu, 22 Jul 2021 13:34:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pPYPamu3BTSvC4xDyNwMS1rZ00+Vamo+vGwg9BlQGtg=; b=QU64f1ey246ueY7K6FvQaR+tNFW7/c2ASWKR7EbrVG8mHVYrWdttwIfkiTuXn6WySv EQ4tlcU0qfG8G9OY8tJfcPowVYwtXs2rGlF9opDSKHClD076pik9LwAxbXPjKiLmf2uy hRuveWJGiMDZax4GPRPscX1uL4J4b1gHOex18wSRYNhrHhSCI5LkKyk1hYvzrAUmpfRv j26ddwvFEc1IxxfaWJoWoRwUSmePz04LnRBGNMeBfAuQWt0yj4xrPD3MaD3XUa4B1vXt 8Gr8szSFzGDEM4/Qv6M/Y1Df4DKJTeVRevVrlG+Pt0X4cwprQjC9CKcENBAWyEg5rGDb yAMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pPYPamu3BTSvC4xDyNwMS1rZ00+Vamo+vGwg9BlQGtg=; b=SJRvFiEXFGMBy3WE1ULwx46gapyJQEpMg4xm8DMhK0ZhupvJPiZgjtIYRWa3BgwZbb 1opzNl0nuffEzXbPcEIrcdFdReF/IsE9oYA5CjvxEE3fHxxHX+gsgQDozi/1MpeWKMTg Y2XS5qmEN0BxnhQu4XNyfE5t3Gkiod3pLiRAHE+YHhFUtFYYQjg5JOuSrPePNYqIL0Uc yrFzNA1oL0mTa7ZjG7VJvdR8IFw/7miAzIp1cYymRh3htRYw7PdgRT9Idin4HFSwhlaY V4otLuwd2QpDh8YpOhpvVJjaMheh6eKrbbHAPqb1rHtP0CGX9p3HLbpGh/XlKiXhuU4T bu5g== X-Gm-Message-State: AOAM5314GLDEqGs0dK4MikXwBRhMdMrmUljY3eYI+JAtJKSYyrAKY6Ey NEzqyt4A/K45liDod0LAej0= X-Google-Smtp-Source: ABdhPJwuQtSj3WdwEsIQAuebOcWSO4nxHjoXKk5zgWs2KV9+vs5ewXxHifizW3b6wheZ3rAIXQ6CxQ== X-Received: by 2002:adf:f74f:: with SMTP id z15mr1788475wrp.54.1626986072117; Thu, 22 Jul 2021 13:34:32 -0700 (PDT) Received: from valhalla.home ([2.29.20.106]) by smtp.gmail.com with ESMTPSA id b16sm31036455wrw.46.2021.07.22.13.34.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 13:34:31 -0700 (PDT) From: Daniel Scally To: Daniel Scally , Mauro Carvalho Chehab , Sakari Ailus , Paul Kocialkowski , Ezequiel Garcia , Hans Verkuil , Yang Li , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list) Cc: Yong Zhi , Bingbu Cao , Tianshu Qiu , Colin Ian King , laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com Subject: [PATCH 06/13] media: i2c: Switch control to V4L2_CID_ANALOGUE_GAIN Date: Thu, 22 Jul 2021 21:34:00 +0100 Message-Id: <20210722203407.3588046-7-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210722203407.3588046-1-djrscally@gmail.com> References: <20210722203407.3588046-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. Signed-off-by: Daniel Scally Reviewed-by: Paul Kocialkowski --- drivers/media/i2c/ov8865.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index c012f5cb11ab..09558a3342dd 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -2137,7 +2137,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; @@ -2447,8 +2447,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; @@ -2493,7 +2493,7 @@ 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 Thu Jul 22 20:34: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: 12394669 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80735C4320E for ; Thu, 22 Jul 2021 20:34:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 65CF660EB5 for ; Thu, 22 Jul 2021 20:34:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231258AbhGVTyM (ORCPT ); Thu, 22 Jul 2021 15:54:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231140AbhGVTyA (ORCPT ); Thu, 22 Jul 2021 15:54:00 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62CA2C061575; Thu, 22 Jul 2021 13:34:34 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id j2so30632wrx.9; Thu, 22 Jul 2021 13:34:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=F7F7FKEX65DVemwtWBC2EFzoLsG6Afm2QAYRv7Pr9qg=; b=jqKXdRAR6BoiR2UVwS0BCE+Xitmr2/W6tlRHgt5tRMduYhQwYnS/SHhZ0Q6oWEAPj/ gqIb0SDFUW3H8GDPzPYfy9TPJ6xmHlF2GpIVMi4rR3ZSn9aTpkoo3k+yUtMl80e5MpzE zFzInKt4guP/C+nbpzq7jAyl3KRy9oPM7RGiseAr8sRSUsMGEo/QKem+uYxz1WnfXz4N hSTLKLPE0aHKDMFpbW5yxvVWPYuuE8ac6kcF5B66UajM9wChzngvZ8HiqSnFpffwYtSv IifR4sSRAiijdLbP8FCO2vpG//9aqSklKhY2GjIaTlMcfGKSPO8hAqSb2Sp3YFbpbyg4 O8Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F7F7FKEX65DVemwtWBC2EFzoLsG6Afm2QAYRv7Pr9qg=; b=hPKMRr5pSreMjIYcBCNhKP9xIpiCqXsDuLQy/QxEm+A3QzkdN2lxePRaDgpnGlCo55 i/edY0GeS9F9Q7Y4KpAuNkW4Hjq8DW0q9kEu44YksGxZDh2eJgFGaaGiBAqUtNiELGGv mjqMliedcco/VNRNuTsNHy5bmzXkRXB9g0bhf3s9eKorMuHig/ulLkI6exyr0i4UsXKX 6cjlrBpSl9z4Ktpye7j+c5c6M0zgsfWsXMUVZMoLBDI0G9CD1NBL6blng147PerSewiM O1hih7Idyn6mCKMdVy/lyxoFdRXcG4OQ0otXr5n8DuPVUSH2q9V9+cjy41HqYRqVqUWh 4rbg== X-Gm-Message-State: AOAM5327Ysa7atWlL914osetX9tsRFC+5o8q5rxoueoWF30vHov33R6M TDcDH+KSEzJcn3gFPSA6DNw= X-Google-Smtp-Source: ABdhPJzCyn1ajcevaV10ig+70Fap+aRpr2tkOBi+Ow/jmZRa058/aGNFaBMZe1qDsSBf5Bgpe9ZfzQ== X-Received: by 2002:a5d:4e4d:: with SMTP id r13mr1776715wrt.224.1626986073023; Thu, 22 Jul 2021 13:34:33 -0700 (PDT) Received: from valhalla.home ([2.29.20.106]) by smtp.gmail.com with ESMTPSA id b16sm31036455wrw.46.2021.07.22.13.34.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 13:34:32 -0700 (PDT) From: Daniel Scally To: Daniel Scally , Mauro Carvalho Chehab , Sakari Ailus , Paul Kocialkowski , Ezequiel Garcia , Hans Verkuil , Yang Li , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list) Cc: Yong Zhi , Bingbu Cao , Tianshu Qiu , Colin Ian King , laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com Subject: [PATCH 07/13] media: i2c: Add vblank control to ov8865 Date: Thu, 22 Jul 2021 21:34:01 +0100 Message-Id: <20210722203407.3588046-8-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210722203407.3588046-1-djrscally@gmail.com> References: <20210722203407.3588046-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 --- drivers/media/i2c/ov8865.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index 09558a3342dd..daead1fc9314 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 @@ -658,6 +660,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; }; @@ -2212,6 +2215,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, @@ -2463,6 +2480,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; } @@ -2479,6 +2498,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 = sensor->state.mode; + unsigned int vblank_max, vblank_def; int ret; v4l2_ctrl_handler_init(handler, 32); @@ -2514,6 +2535,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 = @@ -2694,6 +2722,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); @@ -3019,6 +3051,8 @@ static int ov8865_probe(struct i2c_client *client) /* Sensor */ + sensor->state.mode = &ov8865_modes[0]; + ret = ov8865_ctrls_init(sensor); if (ret) goto error_mutex; From patchwork Thu Jul 22 20:34: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: 12394671 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0711C4338F for ; Thu, 22 Jul 2021 20:34:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B421D60EB6 for ; Thu, 22 Jul 2021 20:34:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231307AbhGVTyO (ORCPT ); Thu, 22 Jul 2021 15:54:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231145AbhGVTyA (ORCPT ); Thu, 22 Jul 2021 15:54:00 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5420AC061757; Thu, 22 Jul 2021 13:34:35 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id z8so48888wru.7; Thu, 22 Jul 2021 13:34:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xmqc6kqrkWj1mXENQhId89XMxonfs77fQNDrmKC80v0=; b=SzlyWqjA7QFNOyDOP3LqMz29aZy3K7EyNhgwFOthk9YOom2CGaM0JqApgV9HvfERJ3 +qUnJeA/9tcXbWdUmjgrC+wCgN6naQXnAOOZsfUw+8dFLkaLgBnrjBL3uEXmWYNUjHYX YXqi/TZu/W3hIMr48es/PohNlIVe+O+FsLw5WfWzPiOvcTZnygEI3t3M4cZboPsHFn7O k9EYq9SzjXlhLq/n326EhprMImHoL9cJM/1wjwbYurSI1/vvEir9fp0NL2GPlBrEVrwT 74syMJNgzAvpQQQydQB9fLoLGESrimws303Hs/wagFTiaR1zz30VeinG0ubWXmJgR/v+ d4kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xmqc6kqrkWj1mXENQhId89XMxonfs77fQNDrmKC80v0=; b=opsTgNXqwBtJdowJVgM50vM7IZUJZkCtUG0ZY5H6LQOe8Iu85OwYEjh5MbDvrqcaDI B3QDVxAlP4SWTir/RQTuIUbcT1UOA7W+otjsTUEP/DWEFaGfagRHODSGiHWzKgBlI9nN oJQFQRim4NCHYeHJRHLaXk7HzGTal4nPNQOud+YmlX80HgSaXOVLtGRNA7gqlpz9HKTP U3eNrA/dvAj73Lgg6J2JdelHie0eZxzyEZrNutstgzDcRtAXEF9tBjnLXJM1FLh0bQPq AbS2ljtmMkBhGk6R7iRKNerARoi3WauZ5MwbPnm4QdtbPtUIFNW6kBIjUj/cgokkrHoP JC+Q== X-Gm-Message-State: AOAM531MGFmRAG8nHzpfXlJGZsOqmoY3YKNJOZ2mnhNqmKK+pyIeNBhp lbV/x6Uf/wPIsS6dfTZgfsU= X-Google-Smtp-Source: ABdhPJx5kHcMQ1jMudr72mFrmprprmqIwLtMyhA3Af3ZmUkn5f612e/QZtGyf7OvcplW2Jb/Gfl0hQ== X-Received: by 2002:a5d:64cc:: with SMTP id f12mr1708893wri.201.1626986074008; Thu, 22 Jul 2021 13:34:34 -0700 (PDT) Received: from valhalla.home ([2.29.20.106]) by smtp.gmail.com with ESMTPSA id b16sm31036455wrw.46.2021.07.22.13.34.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 13:34:33 -0700 (PDT) From: Daniel Scally To: Daniel Scally , Mauro Carvalho Chehab , Sakari Ailus , Paul Kocialkowski , Ezequiel Garcia , Hans Verkuil , Yang Li , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list) Cc: Yong Zhi , Bingbu Cao , Tianshu Qiu , Colin Ian King , laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com Subject: [PATCH 08/13] media: i2c: Add hblank control to ov8865 Date: Thu, 22 Jul 2021 21:34:02 +0100 Message-Id: <20210722203407.3588046-9-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210722203407.3588046-1-djrscally@gmail.com> References: <20210722203407.3588046-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 --- One of the modes defined in this driver actually has HTS as a _lower_ value than output_size_x, which means the usual hblank = (hts - output_size_y) formula doesn't make sense. That seems really strange to me, but the Windows driver does it too so my understanding must be lacking there...I handled that by flooring hblank at 0, but there may be a much better way of doing this. 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 daead1fc9314..e1d3c0d50fdc 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -660,6 +660,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; @@ -2500,6 +2501,7 @@ static int ov8865_ctrls_init(struct ov8865_sensor *sensor) const struct v4l2_ctrl_ops *ops = &ov8865_ctrl_ops; const struct ov8865_mode *mode = sensor->state.mode; unsigned int vblank_max, vblank_def; + unsigned int hblank; int ret; v4l2_ctrl_handler_init(handler, 32); @@ -2536,6 +2538,13 @@ static int ov8865_ctrls_init(struct ov8865_sensor *sensor) 0, 0, ov8865_test_pattern_menu); /* Blanking */ + hblank = mode->hts < mode->output_size_x ? 0 : 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, @@ -2682,6 +2691,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; @@ -2726,6 +2736,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 ? 0 : mode->hts - mode->output_size_x; + __v4l2_ctrl_modify_range(sensor->ctrls.hblank, hblank, hblank, 1, + hblank); + complete: mutex_unlock(&sensor->mutex); From patchwork Thu Jul 22 20:34: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: 12394675 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FBA7C4338F for ; Thu, 22 Jul 2021 20:34:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B15A60EB5 for ; Thu, 22 Jul 2021 20:34:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231133AbhGVTyQ (ORCPT ); Thu, 22 Jul 2021 15:54:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231152AbhGVTyB (ORCPT ); Thu, 22 Jul 2021 15:54:01 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3021DC061575; Thu, 22 Jul 2021 13:34:36 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id d12so7210132wre.13; Thu, 22 Jul 2021 13:34:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cGfNPzr1gE/pmw2DJmPe2VzUTwaf4gzOMzWZ5kc+WcA=; b=pohVws68g8dDugN+8Ckyic30nOcpw662cgNlg2LoOUWpLq9W7/b5cpcYlBCa6wANtI diU5M/mXeCRdX1N7tKzBYSsgzZGoShl6Sd37uYA5xeV+TJzdIZPgKG90fKXjSDLrxUd4 Jsshw/jMg1MpZaM1GJJr8gPfZLIZZFAwkMkyDQXB9YVDGRHGhKSPk6DrXKv7HSYSxTgx TBA8kPTawYh14y+qBjiLv7t+58N5Mf4VDDA0/a0S8DzeSmRc/3MuMUtf/msEGBzC4BCn D9aVBm/QhVagaG20zkBcqbOVY7kBNXu7uvfaPGrfiuERlJnsiADeySX0jZhv4mtqQzYA 4rrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cGfNPzr1gE/pmw2DJmPe2VzUTwaf4gzOMzWZ5kc+WcA=; b=CfzhzVDLHg814qfxUGUWaE58tekuO5d2Qcd9b4Z4lxUX0i39ymBWetpqcjlfbLBofK 1xLy2iA/nCr5Lmy+PGz7sXxkYzyR/vtF7im25pvqDInhiN+zx081yTfqP+HfHFa1POfN AvbyPNKneqKworXpIVFDLr659I2r8f7HfYPVSdKLLB8dmwijhDunTr++zrkd6Gw3FM3N WfNr7ob+B8wvJS6MPscH/oSIU1CVl78NZ/J3+5fGyNVdxN2TWHQCqIeNy1jesuEidFuM y0Bj9+GCuUv2bP9eVWZ8vh2IUvvqGJfnxHHs5Cm3WawN5eV+oqvI73E1bDPKngYSI2hb lKfw== X-Gm-Message-State: AOAM533m3sF43ZXosoirZZ0wnDgs0kuOiZGecxJCG1ntfJfhg0tInYoI /6X9+aQQlntcl54xnanF3UU= X-Google-Smtp-Source: ABdhPJxpI+UKEJmljycF/UrHfPNtBWUTZ1jPKGIcDqsoDHp1Epa+hJ9qAMEahjsAEYsCGF7fwlMgvw== X-Received: by 2002:a5d:456d:: with SMTP id a13mr1738806wrc.255.1626986074884; Thu, 22 Jul 2021 13:34:34 -0700 (PDT) Received: from valhalla.home ([2.29.20.106]) by smtp.gmail.com with ESMTPSA id b16sm31036455wrw.46.2021.07.22.13.34.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 13:34:34 -0700 (PDT) From: Daniel Scally To: Daniel Scally , Mauro Carvalho Chehab , Sakari Ailus , Paul Kocialkowski , Ezequiel Garcia , Hans Verkuil , Yang Li , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list) Cc: Yong Zhi , Bingbu Cao , Tianshu Qiu , Colin Ian King , laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com Subject: [PATCH 09/13] media: i2c: cap exposure at height + vblank in ov8865 Date: Thu, 22 Jul 2021 21:34:03 +0100 Message-Id: <20210722203407.3588046-10-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210722203407.3588046-1-djrscally@gmail.com> References: <20210722203407.3588046-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 --- drivers/media/i2c/ov8865.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index e1d3c0d50fdc..941b0f94f249 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -662,6 +662,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; }; @@ -2455,6 +2456,18 @@ 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; + __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; @@ -2511,8 +2524,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 */ @@ -2693,6 +2706,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); @@ -2740,6 +2754,12 @@ static int ov8865_set_fmt(struct v4l2_subdev *subdev, __v4l2_ctrl_modify_range(sensor->ctrls.hblank, hblank, hblank, 1, hblank); + exposure_max = mode->vts; + __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 Thu Jul 22 20:34: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: 12394673 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D29CC432BE for ; Thu, 22 Jul 2021 20:34:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 74C1B60EB8 for ; Thu, 22 Jul 2021 20:34:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231298AbhGVTyP (ORCPT ); Thu, 22 Jul 2021 15:54:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231154AbhGVTyC (ORCPT ); Thu, 22 Jul 2021 15:54:02 -0400 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 10A23C061757; Thu, 22 Jul 2021 13:34:37 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id o1so68847wrp.5; Thu, 22 Jul 2021 13:34:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5vj2usC585h/5PbVMEnhZyeaPorYxZb5+19JRMHAV+I=; b=ogkp/bz69q7ZvB9TmeYsr0NT70lXZwtwsibF3yTuODqnwACM+p1Ag3OFNvW+nDKhoo LRAFdXeafgg41x386AGosqqUq1BcJFKNlEGYqEj8J1HkaeGirQFFKX0eO+eKNe4wZaIa GxjUP9QqlwZhBL8rZ46fyIFGjJ1gYuyHnCDtdLeqBI8sTcfV15zlJYq6HZ1ov2MMAj46 f36l1ErxVsQFvnuddXBk/rQvNFhttQ0s+NF0nH0kZQJL4ph5pIHCYjccYTxxo/0cYe/g DZnMQwY5VYmRnSltCCBREJanGSkT0CA7t1kPd7TUhi1s8AJCAarrNi94WlglAGP/qNkc nRog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5vj2usC585h/5PbVMEnhZyeaPorYxZb5+19JRMHAV+I=; b=bVZbr1oWn2S85mOilTEQMET13dieNuoWw2Q7BLHcYJ0NrZhGtTcXH5Sg0a6mO357+h UQLIsbovCBjakzerWgBunkvdqpDF19NPmhgMjDFiJ0FG38j2v9CatvVFGerZf8pRYsVy p0yLEABDzVoEGVjoWdnujhrdNCc4ZZFCX9k1n6JV/gP7w2Tk5BHW1jBMmDPd1i1IeGwx zY9WyTt+Z/2X+3g1uGTKZMNDmujFqpOW5N9NBkEBjIFIbepuPrERNLubjJFs5ovLyWB+ nLqKa7j7UGObb52yDfDdwde9FcsBnFb4Jj4KNRCz0VLJZnDSqEHxupAe9VkFsGku1jhy xrqQ== X-Gm-Message-State: AOAM532kCdP205OQk98WLV1gW60CpsUExCP/Y+/0IJbfP7BtEKDyDAa/ FUgBJ6J9CUS+PLLtqkPoeHs= X-Google-Smtp-Source: ABdhPJxFaXxfsbFzQYu7XThABPmOHVBOlMoSQmVSh284nJFTeoZOJLRq8Q9sJasMQpV3aCvWCCqVNA== X-Received: by 2002:a5d:4e89:: with SMTP id e9mr1850906wru.308.1626986075753; Thu, 22 Jul 2021 13:34:35 -0700 (PDT) Received: from valhalla.home ([2.29.20.106]) by smtp.gmail.com with ESMTPSA id b16sm31036455wrw.46.2021.07.22.13.34.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 13:34:35 -0700 (PDT) From: Daniel Scally To: Daniel Scally , Mauro Carvalho Chehab , Sakari Ailus , Paul Kocialkowski , Ezequiel Garcia , Hans Verkuil , Yang Li , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list) Cc: Yong Zhi , Bingbu Cao , Tianshu Qiu , Colin Ian King , laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com Subject: [PATCH 10/13] media: i2c: Add controls from fwnode to ov8865 Date: Thu, 22 Jul 2021 21:34:04 +0100 Message-Id: <20210722203407.3588046-11-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210722203407.3588046-1-djrscally@gmail.com> References: <20210722203407.3588046-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 --- 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 941b0f94f249..4954808f5416 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -2513,6 +2513,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 = sensor->state.mode; + struct v4l2_fwnode_device_properties props; unsigned int vblank_max, vblank_def; unsigned int hblank; int ret; @@ -2575,6 +2576,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 Thu Jul 22 20:34: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: 12394681 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75F0DC4338F for ; Thu, 22 Jul 2021 20:34:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5E88960EB8 for ; Thu, 22 Jul 2021 20:34:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231341AbhGVTyR (ORCPT ); Thu, 22 Jul 2021 15:54:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231163AbhGVTyE (ORCPT ); Thu, 22 Jul 2021 15:54:04 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A55BC061575; Thu, 22 Jul 2021 13:34:38 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id b7so39939wri.8; Thu, 22 Jul 2021 13:34:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GE21SVbP56JLHHeeUD31HSFfx1lzRy5IzAMg4KQauls=; b=FA7ZdzRjIUOdgr/EcEsxpgq0ybuGaGcbTPEjgnuGIS7X5PMzIC1PGUL/jzX767HqV8 AzdtpOxpm8+2cSKmY0Wmwyvp1tFNivX1uy0dOHt6Lt9lt62zRqNEI+v43LdD2+fHTETT +TKfZ4Ybx/RfNZNDf4yZ4Nit23rrwPAXgUWegjt+eOe4zp/mZm4JzYf96+pLAj+himHg pOTL+oGXjW21ZnilIAFeJvQgU8BZt65ybCK9sLuepMOFh9wrqFJQAMhdzqLi7iTASYN0 62luwvwABc/hkRokJX4RkOF84I+vxesh91MoSvfXJ32nIGYM3TZqgYIQ3ENDQcUapQXT f/Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GE21SVbP56JLHHeeUD31HSFfx1lzRy5IzAMg4KQauls=; b=CEXBjQiVSDjdOWXflpnhxXdwiCQr1Hb8mYnPKFyNXacpiva3yLxRSb6dlZtfzTRbu1 4AxJ6Ss6tVGTfTBC9FN1IBvljmtLJ5/jba+cIyAi8iMJk5/43SysmAyEIbMI8CVxtvId k35JxSoWJIZK7H5exmint0e5NYej4suQYYQjqRc6XuyVxa0Y+T3KH53rGi9qCF1QwV15 ew4KeD06rFgc86UkzIfz+8eQbNftFW6/0eGJJzrYwhmn3Clj30rrW4wpF9wi/KgTbqMm PzDzmHgx+C/BdQQ5NNcIh9j37nrGS6K7TlqkchA38w+F1l3AyYbkJ3m/Whq/KKsROeeq 1rqQ== X-Gm-Message-State: AOAM5315lX7VrS6OCRY/D2fVA6k6RTJwtVqA8+dj+ztgDdlkdTyxFuwP hU796BqUOKqaj+pXGXy6O5g= X-Google-Smtp-Source: ABdhPJyW7/VwMGMyAYEN1Y/4BfCMDQWlVAqvRUHcmQDr5vaK8LY2bOIqO05DjxHBxIrXzk016Z37mA== X-Received: by 2002:a05:6000:231:: with SMTP id l17mr1828100wrz.40.1626986076857; Thu, 22 Jul 2021 13:34:36 -0700 (PDT) Received: from valhalla.home ([2.29.20.106]) by smtp.gmail.com with ESMTPSA id b16sm31036455wrw.46.2021.07.22.13.34.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 13:34:36 -0700 (PDT) From: Daniel Scally To: Daniel Scally , Mauro Carvalho Chehab , Sakari Ailus , Paul Kocialkowski , Ezequiel Garcia , Hans Verkuil , Yang Li , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list) Cc: Yong Zhi , Bingbu Cao , Tianshu Qiu , Colin Ian King , laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com Subject: [PATCH 11/13] media: i2c: Switch exposure control unit to lines Date: Thu, 22 Jul 2021 21:34:05 +0100 Message-Id: <20210722203407.3588046-12-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210722203407.3588046-1-djrscally@gmail.com> References: <20210722203407.3588046-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 --- 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 4954808f5416..dca4db3039bb 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) @@ -2525,8 +2528,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 Thu Jul 22 20:34: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: 12394679 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AC19C432BE for ; Thu, 22 Jul 2021 20:34:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 555EB60EB5 for ; Thu, 22 Jul 2021 20:34:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231431AbhGVTyT (ORCPT ); Thu, 22 Jul 2021 15:54:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231167AbhGVTyF (ORCPT ); Thu, 22 Jul 2021 15:54:05 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FF6AC061757; Thu, 22 Jul 2021 13:34:39 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id b7so40025wri.8; Thu, 22 Jul 2021 13:34:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kBzHKf14UtrNlJA2H5tdqnU4j2hdnFUKhMnfyI6KfZE=; b=umlC8cmesoeVv/xahdvpCLlfF12YwZEwypt1Ob/sl9H3tRZT+/cox/OFIlH6jTpPdM sEtQKsvk2+H4FkGfwQqQYhx/HqpVuwuNcCpYebe1IE7UCSkiFNfIS6NNGUXcf86J/rCa +hbteXI3lmEIwwjtlIaExyDfLqUr17H/iZ/YI6qHo4kCNakVED0ht7FR3egMUWbI9BYP 6T9rOG5gNNqwsY2pgMlhjP7ci3W5+IbQilNPrMq0IqCQbB8Jl6nXlWkc7TdZkBEqXhV+ fsGwc3HWLkIa5oXruRIB1lgkceK1rWfJzDpAjxUgkc2FLPn3kM3/RRm8YufF2eaDsXzx 69Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kBzHKf14UtrNlJA2H5tdqnU4j2hdnFUKhMnfyI6KfZE=; b=eeiPwJ3qh+NDmQKdDUAhosWqpwJVmbsk7UskqDFlb3AuFNGDoh6kEiUU31PWZHuUR6 ovl+9erEE/wmbxEmeqK0UISinR7jaDrvRs0MsYTzLd77VdGNIjmYF14f0rpQY0MJtVXy SGZlAJtFLW5YZHFvtyrrGvVpvKm9HK5fEpVFg+scMB54qxfv7ihLbEcpek59F8OFsYVl TidIObLswaccG2BMOaIZ8tZ19BlHNSh3SLM+9qyhvAYplsH0Xn9dV9hMidwjWVmozp55 tv55n5yDHSDZyZK5PZ/j6Sf52e3nVlSMbaa5uy6a9DZaZFEb7vkA7cjNOBmowuXrve8v 6W0Q== X-Gm-Message-State: AOAM531BJ6B5AfRJrzaQM/lZ93CQO9YlPFjAdJRwJ4B1ta74Hz6JBil+ /iD19k8X/VSBsGYP1E8avpo= X-Google-Smtp-Source: ABdhPJxXqqgvGsVqqxKf7kB7IcM9k78Wjv+heoWI+/OLLBUI27Z3SYladJgy8enQEtRipEBOUzA/fA== X-Received: by 2002:adf:eb82:: with SMTP id t2mr1714093wrn.337.1626986078164; Thu, 22 Jul 2021 13:34:38 -0700 (PDT) Received: from valhalla.home ([2.29.20.106]) by smtp.gmail.com with ESMTPSA id b16sm31036455wrw.46.2021.07.22.13.34.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 13:34:37 -0700 (PDT) From: Daniel Scally To: Daniel Scally , Mauro Carvalho Chehab , Sakari Ailus , Paul Kocialkowski , Ezequiel Garcia , Hans Verkuil , Yang Li , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list) Cc: Yong Zhi , Bingbu Cao , Tianshu Qiu , Colin Ian King , laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com Subject: [PATCH 12/13] media: i2c: Remove unused macros from ov8865 Date: Thu, 22 Jul 2021 21:34:06 +0100 Message-Id: <20210722203407.3588046-13-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210722203407.3588046-1-djrscally@gmail.com> References: <20210722203407.3588046-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There are a number of macros defined in this driver that aren't actually used within it. There's a lot of macros defined in total, so removing the unused ones helps make it a bit less busy. Signed-off-by: Daniel Scally --- I wavered about including this, because it might be helpful for someone adding support for other features in the future to have these already defined, but in the end I thought it slightly better to be less busy. drivers/media/i2c/ov8865.c | 137 +------------------------------------ 1 file changed, 1 insertion(+), 136 deletions(-) diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index dca4db3039bb..9b38f2e16906 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -46,8 +46,6 @@ #define OV8865_PLL_CTRL6_REG 0x306 #define OV8865_PLL_CTRL6_SYS_DIV(v) (((v) - 1) & BIT(0)) -#define OV8865_PLL_CTRL8_REG 0x308 -#define OV8865_PLL_CTRL9_REG 0x309 #define OV8865_PLL_CTRLA_REG 0x30a #define OV8865_PLL_CTRLA_PRE_DIV_HALF(v) (((v) - 1) & BIT(0)) #define OV8865_PLL_CTRLB_REG 0x30b @@ -60,41 +58,21 @@ #define OV8865_PLL_CTRLE_SYS_DIV(v) ((v) & GENMASK(2, 0)) #define OV8865_PLL_CTRLF_REG 0x30f #define OV8865_PLL_CTRLF_SYS_PRE_DIV(v) (((v) - 1) & GENMASK(3, 0)) -#define OV8865_PLL_CTRL10_REG 0x310 -#define OV8865_PLL_CTRL11_REG 0x311 #define OV8865_PLL_CTRL12_REG 0x312 #define OV8865_PLL_CTRL12_PRE_DIV_HALF(v) ((((v) - 1) << 4) & BIT(4)) #define OV8865_PLL_CTRL12_DAC_DIV(v) (((v) - 1) & GENMASK(3, 0)) -#define OV8865_PLL_CTRL1B_REG 0x31b -#define OV8865_PLL_CTRL1C_REG 0x31c - #define OV8865_PLL_CTRL1E_REG 0x31e #define OV8865_PLL_CTRL1E_PLL1_NO_LAT BIT(3) -#define OV8865_PAD_OEN0_REG 0x3000 - -#define OV8865_PAD_OEN2_REG 0x3002 - -#define OV8865_CLK_RST5_REG 0x3005 - #define OV8865_CHIP_ID_HH_REG 0x300a #define OV8865_CHIP_ID_HH_VALUE 0x00 #define OV8865_CHIP_ID_H_REG 0x300b #define OV8865_CHIP_ID_H_VALUE 0x88 #define OV8865_CHIP_ID_L_REG 0x300c #define OV8865_CHIP_ID_L_VALUE 0x65 -#define OV8865_PAD_OUT2_REG 0x300d - -#define OV8865_PAD_SEL2_REG 0x3010 -#define OV8865_PAD_PK_REG 0x3011 -#define OV8865_PAD_PK_DRIVE_STRENGTH_1X (0 << 5) -#define OV8865_PAD_PK_DRIVE_STRENGTH_2X (1 << 5) -#define OV8865_PAD_PK_DRIVE_STRENGTH_3X (2 << 5) -#define OV8865_PAD_PK_DRIVE_STRENGTH_4X (3 << 5) #define OV8865_PUMP_CLK_DIV_REG 0x3015 -#define OV8865_PUMP_CLK_DIV_PUMP_N(v) (((v) << 4) & GENMASK(6, 4)) #define OV8865_PUMP_CLK_DIV_PUMP_P(v) ((v) & GENMASK(2, 0)) #define OV8865_MIPI_SC_CTRL0_REG 0x3018 @@ -102,21 +80,12 @@ GENMASK(7, 5)) #define OV8865_MIPI_SC_CTRL0_MIPI_EN BIT(4) #define OV8865_MIPI_SC_CTRL0_UNKNOWN BIT(1) -#define OV8865_MIPI_SC_CTRL0_LANES_PD_MIPI BIT(0) -#define OV8865_MIPI_SC_CTRL1_REG 0x3019 -#define OV8865_CLK_RST0_REG 0x301a -#define OV8865_CLK_RST1_REG 0x301b -#define OV8865_CLK_RST2_REG 0x301c -#define OV8865_CLK_RST3_REG 0x301d -#define OV8865_CLK_RST4_REG 0x301e #define OV8865_PCLK_SEL_REG 0x3020 #define OV8865_PCLK_SEL_PCLK_DIV_MASK BIT(3) #define OV8865_PCLK_SEL_PCLK_DIV(v) ((((v) - 1) << 3) & BIT(3)) -#define OV8865_MISC_CTRL_REG 0x3021 #define OV8865_MIPI_SC_CTRL2_REG 0x3022 -#define OV8865_MIPI_SC_CTRL2_CLK_LANES_PD_MIPI BIT(1) #define OV8865_MIPI_SC_CTRL2_PD_MIPI_RST_SYNC BIT(0) #define OV8865_MIPI_BIT_SEL_REG 0x3031 @@ -125,7 +94,6 @@ #define OV8865_CLK_SEL0_PLL1_SYS_SEL(v) (((v) << 7) & BIT(7)) #define OV8865_CLK_SEL1_REG 0x3033 #define OV8865_CLK_SEL1_MIPI_EOF BIT(5) -#define OV8865_CLK_SEL1_UNKNOWN BIT(2) #define OV8865_CLK_SEL1_PLL_SCLK_SEL_MASK BIT(1) #define OV8865_CLK_SEL1_PLL_SCLK_SEL(v) (((v) << 1) & BIT(1)) @@ -142,7 +110,6 @@ #define OV8865_EXPOSURE_CTRL_H(v) (((v) & GENMASK(15, 8)) >> 8) #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_GAIN_CTRL_H_REG 0x3508 #define OV8865_GAIN_CTRL_H(v) (((v) & GENMASK(12, 8)) >> 8) @@ -197,18 +164,6 @@ #define OV8865_INC_X_ODD(v) ((v) & GENMASK(4, 0)) #define OV8865_INC_X_EVEN_REG 0x3815 #define OV8865_INC_X_EVEN(v) ((v) & GENMASK(4, 0)) -#define OV8865_VSYNC_START_H_REG 0x3816 -#define OV8865_VSYNC_START_H(v) (((v) & GENMASK(15, 8)) >> 8) -#define OV8865_VSYNC_START_L_REG 0x3817 -#define OV8865_VSYNC_START_L(v) ((v) & GENMASK(7, 0)) -#define OV8865_VSYNC_END_H_REG 0x3818 -#define OV8865_VSYNC_END_H(v) (((v) & GENMASK(15, 8)) >> 8) -#define OV8865_VSYNC_END_L_REG 0x3819 -#define OV8865_VSYNC_END_L(v) ((v) & GENMASK(7, 0)) -#define OV8865_HSYNC_FIRST_H_REG 0x381a -#define OV8865_HSYNC_FIRST_H(v) (((v) & GENMASK(15, 8)) >> 8) -#define OV8865_HSYNC_FIRST_L_REG 0x381b -#define OV8865_HSYNC_FIRST_L(v) ((v) & GENMASK(7, 0)) #define OV8865_FORMAT1_REG 0x3820 #define OV8865_FORMAT1_FLIP_VERT_ISP_EN BIT(2) @@ -240,10 +195,6 @@ #define OV8865_AUTO_SIZE_CTRL_CROP_END_X_REG BIT(2) #define OV8865_AUTO_SIZE_CTRL_CROP_START_Y_REG BIT(1) #define OV8865_AUTO_SIZE_CTRL_CROP_START_X_REG BIT(0) -#define OV8865_AUTO_SIZE_X_OFFSET_H_REG 0x3842 -#define OV8865_AUTO_SIZE_X_OFFSET_L_REG 0x3843 -#define OV8865_AUTO_SIZE_Y_OFFSET_H_REG 0x3844 -#define OV8865_AUTO_SIZE_Y_OFFSET_L_REG 0x3845 #define OV8865_AUTO_SIZE_BOUNDARIES_REG 0x3846 #define OV8865_AUTO_SIZE_BOUNDARIES_Y(v) (((v) << 4) & GENMASK(7, 4)) #define OV8865_AUTO_SIZE_BOUNDARIES_X(v) ((v) & GENMASK(3, 0)) @@ -259,30 +210,10 @@ #define OV8865_BLC_CTRL0_TRIG_FORMAT_EN BIT(6) #define OV8865_BLC_CTRL0_TRIG_GAIN_EN BIT(5) #define OV8865_BLC_CTRL0_TRIG_EXPOSURE_EN BIT(4) -#define OV8865_BLC_CTRL0_TRIG_MANUAL_EN BIT(3) -#define OV8865_BLC_CTRL0_FREEZE_EN BIT(2) -#define OV8865_BLC_CTRL0_ALWAYS_EN BIT(1) #define OV8865_BLC_CTRL0_FILTER_EN BIT(0) #define OV8865_BLC_CTRL1_REG 0x4001 -#define OV8865_BLC_CTRL1_DITHER_EN BIT(7) -#define OV8865_BLC_CTRL1_ZERO_LINE_DIFF_EN BIT(6) -#define OV8865_BLC_CTRL1_COL_SHIFT_256 (0 << 4) #define OV8865_BLC_CTRL1_COL_SHIFT_128 (1 << 4) -#define OV8865_BLC_CTRL1_COL_SHIFT_64 (2 << 4) -#define OV8865_BLC_CTRL1_COL_SHIFT_32 (3 << 4) #define OV8865_BLC_CTRL1_OFFSET_LIMIT_EN BIT(2) -#define OV8865_BLC_CTRL1_COLUMN_CANCEL_EN BIT(1) -#define OV8865_BLC_CTRL2_REG 0x4002 -#define OV8865_BLC_CTRL3_REG 0x4003 -#define OV8865_BLC_CTRL4_REG 0x4004 -#define OV8865_BLC_CTRL5_REG 0x4005 -#define OV8865_BLC_CTRL6_REG 0x4006 -#define OV8865_BLC_CTRL7_REG 0x4007 -#define OV8865_BLC_CTRL8_REG 0x4008 -#define OV8865_BLC_CTRL9_REG 0x4009 -#define OV8865_BLC_CTRLA_REG 0x400a -#define OV8865_BLC_CTRLB_REG 0x400b -#define OV8865_BLC_CTRLC_REG 0x400c #define OV8865_BLC_CTRLD_REG 0x400d #define OV8865_BLC_CTRLD_OFFSET_TRIGGER(v) ((v) & GENMASK(7, 0)) @@ -337,66 +268,8 @@ /* MIPI */ -#define OV8865_MIPI_CTRL0_REG 0x4800 -#define OV8865_MIPI_CTRL1_REG 0x4801 -#define OV8865_MIPI_CTRL2_REG 0x4802 -#define OV8865_MIPI_CTRL3_REG 0x4803 -#define OV8865_MIPI_CTRL4_REG 0x4804 -#define OV8865_MIPI_CTRL5_REG 0x4805 -#define OV8865_MIPI_CTRL6_REG 0x4806 -#define OV8865_MIPI_CTRL7_REG 0x4807 -#define OV8865_MIPI_CTRL8_REG 0x4808 - -#define OV8865_MIPI_FCNT_MAX_H_REG 0x4810 -#define OV8865_MIPI_FCNT_MAX_L_REG 0x4811 - -#define OV8865_MIPI_CTRL13_REG 0x4813 -#define OV8865_MIPI_CTRL14_REG 0x4814 -#define OV8865_MIPI_CTRL15_REG 0x4815 -#define OV8865_MIPI_EMBEDDED_DT_REG 0x4816 - -#define OV8865_MIPI_HS_ZERO_MIN_H_REG 0x4818 -#define OV8865_MIPI_HS_ZERO_MIN_L_REG 0x4819 -#define OV8865_MIPI_HS_TRAIL_MIN_H_REG 0x481a -#define OV8865_MIPI_HS_TRAIL_MIN_L_REG 0x481b -#define OV8865_MIPI_CLK_ZERO_MIN_H_REG 0x481c -#define OV8865_MIPI_CLK_ZERO_MIN_L_REG 0x481d -#define OV8865_MIPI_CLK_PREPARE_MAX_REG 0x481e -#define OV8865_MIPI_CLK_PREPARE_MIN_REG 0x481f -#define OV8865_MIPI_CLK_POST_MIN_H_REG 0x4820 -#define OV8865_MIPI_CLK_POST_MIN_L_REG 0x4821 -#define OV8865_MIPI_CLK_TRAIL_MIN_H_REG 0x4822 -#define OV8865_MIPI_CLK_TRAIL_MIN_L_REG 0x4823 -#define OV8865_MIPI_LPX_P_MIN_H_REG 0x4824 -#define OV8865_MIPI_LPX_P_MIN_L_REG 0x4825 -#define OV8865_MIPI_HS_PREPARE_MIN_REG 0x4826 -#define OV8865_MIPI_HS_PREPARE_MAX_REG 0x4827 -#define OV8865_MIPI_HS_EXIT_MIN_H_REG 0x4828 -#define OV8865_MIPI_HS_EXIT_MIN_L_REG 0x4829 -#define OV8865_MIPI_UI_HS_ZERO_MIN_REG 0x482a -#define OV8865_MIPI_UI_HS_TRAIL_MIN_REG 0x482b -#define OV8865_MIPI_UI_CLK_ZERO_MIN_REG 0x482c -#define OV8865_MIPI_UI_CLK_PREPARE_REG 0x482d -#define OV8865_MIPI_UI_CLK_POST_MIN_REG 0x482e -#define OV8865_MIPI_UI_CLK_TRAIL_MIN_REG 0x482f -#define OV8865_MIPI_UI_LPX_P_MIN_REG 0x4830 -#define OV8865_MIPI_UI_HS_PREPARE_REG 0x4831 -#define OV8865_MIPI_UI_HS_EXIT_MIN_REG 0x4832 -#define OV8865_MIPI_PKT_START_SIZE_REG 0x4833 - #define OV8865_MIPI_PCLK_PERIOD_REG 0x4837 -#define OV8865_MIPI_LP_GPIO0_REG 0x4838 -#define OV8865_MIPI_LP_GPIO1_REG 0x4839 - -#define OV8865_MIPI_CTRL3C_REG 0x483c -#define OV8865_MIPI_LP_GPIO4_REG 0x483d - -#define OV8865_MIPI_CTRL4A_REG 0x484a -#define OV8865_MIPI_CTRL4B_REG 0x484b -#define OV8865_MIPI_CTRL4C_REG 0x484c -#define OV8865_MIPI_LANE_TEST_PATTERN_REG 0x484d -#define OV8865_MIPI_FRAME_END_DELAY_REG 0x484e -#define OV8865_MIPI_CLOCK_TEST_PATTERN_REG 0x484f + #define OV8865_MIPI_LANE_SEL01_REG 0x4850 #define OV8865_MIPI_LANE_SEL01_LANE0(v) (((v) << 0) & GENMASK(2, 0)) #define OV8865_MIPI_LANE_SEL01_LANE1(v) (((v) << 4) & GENMASK(6, 4)) @@ -407,7 +280,6 @@ /* ISP */ #define OV8865_ISP_CTRL0_REG 0x5000 -#define OV8865_ISP_CTRL0_LENC_EN BIT(7) #define OV8865_ISP_CTRL0_WHITE_BALANCE_EN BIT(4) #define OV8865_ISP_CTRL0_DPC_BLACK_EN BIT(2) #define OV8865_ISP_CTRL0_DPC_WHITE_EN BIT(1) @@ -416,17 +288,11 @@ #define OV8865_ISP_CTRL2_REG 0x5002 #define OV8865_ISP_CTRL2_DEBUG BIT(3) #define OV8865_ISP_CTRL2_VARIOPIXEL_EN BIT(2) -#define OV8865_ISP_CTRL2_VSYNC_LATCH_EN BIT(0) -#define OV8865_ISP_CTRL3_REG 0x5003 #define OV8865_ISP_GAIN_RED_H_REG 0x5018 #define OV8865_ISP_GAIN_RED_H(v) (((v) & GENMASK(13, 6)) >> 6) #define OV8865_ISP_GAIN_RED_L_REG 0x5019 #define OV8865_ISP_GAIN_RED_L(v) ((v) & GENMASK(5, 0)) -#define OV8865_ISP_GAIN_GREEN_H_REG 0x501a -#define OV8865_ISP_GAIN_GREEN_H(v) (((v) & GENMASK(13, 6)) >> 6) -#define OV8865_ISP_GAIN_GREEN_L_REG 0x501b -#define OV8865_ISP_GAIN_GREEN_L(v) ((v) & GENMASK(5, 0)) #define OV8865_ISP_GAIN_BLUE_H_REG 0x501c #define OV8865_ISP_GAIN_BLUE_H(v) (((v) & GENMASK(13, 6)) >> 6) #define OV8865_ISP_GAIN_BLUE_L_REG 0x501d @@ -434,7 +300,6 @@ /* VarioPixel */ -#define OV8865_VAP_CTRL0_REG 0x5900 #define OV8865_VAP_CTRL1_REG 0x5901 #define OV8865_VAP_CTRL1_HSUB_COEF(v) ((((v) - 1) << 2) & \ GENMASK(3, 2)) From patchwork Thu Jul 22 20:34: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: 12394677 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99855C432BE for ; Thu, 22 Jul 2021 20:34:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 83EDD60EB6 for ; Thu, 22 Jul 2021 20:34:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231367AbhGVTyS (ORCPT ); Thu, 22 Jul 2021 15:54:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231166AbhGVTyF (ORCPT ); Thu, 22 Jul 2021 15:54:05 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5712FC061575; Thu, 22 Jul 2021 13:34:40 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id z7so12437wrn.11; Thu, 22 Jul 2021 13:34:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rd2Uui4SgiL/O80dzJvFPj/8vT3gw3tY+/vUri5pveI=; b=IkQN4IJ/lADESUa47LmCZNJWrIUr7g+J6HXO8onCHCzoFN6Ii2khOlUL43nHdqpJ3t sPQER/hJ9y6UV8d6B5YXuX76iw0r/InpzWoEJGtVATUbDekcyNQY5YZGSVPS+GcP+67k miLUyFyjZ8aluJx07rx7QUqC71LAyWuwz69tHblgT/UrVXCWfSM1FGnq8PBY8vlzqU5H 2gTqWP0SXh1VgF+7MQ3cSPLWY0iieDkc3yyVBw39j+g9oIlK3TNhOY3ygZ8d4kJCgDvL Kgh98RkXMunp9TwyCZkOJu43nfXh1jv1L7nNbsCztKhlVUWJuaiiI4/RlW1GbGevBOrT sG6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rd2Uui4SgiL/O80dzJvFPj/8vT3gw3tY+/vUri5pveI=; b=PF35jPci7bLyrWMeBGB3sVbSi9NVOd00aCNIQTSmF6+RaNkrgcjzk36Qa/79gVfInA zteek8nE/B8Kc/+T6R76ayPJP649ppUyLgAQKvkVztMoPkOwajzJAZwtEsmotCA7Ptse 9/Qq+jTMI+CMP2FA0u+l9s2hTKyhxAzHySC5Ronqg+hmRrN3D70c1LmNnq5WCyEgAhw+ lBqb7P7as3G5AWj0ceU6vTrJXfSi/2JZDDraWta4dmT5pNNeTj7wgDE0RK+uKXqLrC99 AHfSSHPfu7VZdaOo110VgBvwr9AU9nhMWkGT2lBWv1Y9hh3Bq3ynJRS5ymlrNCo+omC3 pI/g== X-Gm-Message-State: AOAM532F/vWtDpHdthr3ZYVnvdjNSVARPdLaK0i+f6xHll8Oj4g2mM4Q L0XR8YP0uuO3mRbPIgxyt9M= X-Google-Smtp-Source: ABdhPJz9qYMOzyFPMiivE7abF/GUFcLsf6t8t8Bl0fQ2Wh0HtjQZoALY7LIqznQJDe99xhktf6L3kA== X-Received: by 2002:a05:6000:180b:: with SMTP id m11mr1802385wrh.6.1626986079030; Thu, 22 Jul 2021 13:34:39 -0700 (PDT) Received: from valhalla.home ([2.29.20.106]) by smtp.gmail.com with ESMTPSA id b16sm31036455wrw.46.2021.07.22.13.34.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jul 2021 13:34:38 -0700 (PDT) From: Daniel Scally To: Daniel Scally , Mauro Carvalho Chehab , Sakari Ailus , Paul Kocialkowski , Ezequiel Garcia , Hans Verkuil , Yang Li , linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)), linux-kernel@vger.kernel.org (open list) Cc: Yong Zhi , Bingbu Cao , Tianshu Qiu , Colin Ian King , laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com Subject: [PATCH 13/13] media: ipu3-cio2: Add INT347A to cio2-bridge Date: Thu, 22 Jul 2021 21:34:07 +0100 Message-Id: <20210722203407.3588046-14-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210722203407.3588046-1-djrscally@gmail.com> References: <20210722203407.3588046-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. Signed-off-by: Daniel Scally --- 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 4657e99df033..6195abd7582c 100644 --- a/drivers/media/pci/intel/ipu3/cio2-bridge.c +++ b/drivers/media/pci/intel/ipu3/cio2-bridge.c @@ -24,6 +24,8 @@ static const struct cio2_sensor_config cio2_supported_sensors[] = { CIO2_SENSOR_CONFIG("INT33BE", 0), /* Omnivision OV2680 */ CIO2_SENSOR_CONFIG("OVTI2680", 0), + /* Omnivision OV8865 */ + CIO2_SENSOR_CONFIG("INT347A", 1, 360000000), }; static const struct cio2_property_names prop_names = {