From patchwork Tue Feb 15 23:07:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 542906 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 B6138C433F5 for ; Tue, 15 Feb 2022 23:07:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240786AbiBOXID (ORCPT ); Tue, 15 Feb 2022 18:08:03 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240552AbiBOXIC (ORCPT ); Tue, 15 Feb 2022 18:08:02 -0500 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 095C063A6 for ; Tue, 15 Feb 2022 15:07:51 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id w11so522700wra.4 for ; Tue, 15 Feb 2022 15:07:50 -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=SMY5mZRDZ5zSeVhczFX3GzI0HUddpNaRbL4SPzwPbzs=; b=P65b+cGa5QtW+XotpjFNzSYoINLupFXuF5daKH9OVJr29xdmItyabRxnPMAkQ1mK7/ YqCFkMxmkp/bTjXvwY6fJbkb1Utz6tYMrCl/KeDIbmVq4iS5NqG1DggQtHDZbHI5Kk9j GUwTUicAbgCPFqDXLgysHZNWmrJAu7u22iEeRcsOilBCs1fo26ymNPfa0gtF2TNiNvM2 MvasjZYR4/H1SrR49/WOBh6/A96lHLTYlkX6TMXQySRiC47XguV9fZsfoGD9iW7NcQAz dIboPE5QC2oPwRA/pTFxw9eRd3ZMkWWFkd6dTkTJvc1clHH3hUhh9nRZi2gOsKuHiQMg qlBw== 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=SMY5mZRDZ5zSeVhczFX3GzI0HUddpNaRbL4SPzwPbzs=; b=gRGq7N3ArBZDQjt2eV6G8minRml2B6szJGk/RkvFTLvXE68ZVU0ipvTQ6gNhAbF6MF nZBsBMtFOrRChksOq0m9t/t0dbL0t04oEe/Oc6iVhPEXp3cT/sbl7nM2OnJAZirvezhb CAg7FlCilb1IkwuFE6xY2qpJibfct7fynHmD0YmWwSfSxbw9HrcDTeAatuIW9IxPzNJ2 mhLTm4IpGd2WJQxgGStcVERWlFxJDFDbnDz4Mb0OyU6HwetaEljPV/hO0iavHcNRdsQx SAD00sedH4HYn6JAthG/GJQ1wycm3l/DAAhcf/ZXFeVentSo+cY6vbakoqGhZikNig25 VbbQ== X-Gm-Message-State: AOAM530DSC6PM4eEgFQ/s6hfzq3xvlAwJCrDAB6WLjGtVKZyGpZLaA+s 7KiPYYJ2mAbPiQ0VCKX3VeToVaa+qNY1bA== X-Google-Smtp-Source: ABdhPJxf4SxJE4nJsLRuPwdOiUCfv+xQRh8N2igutokd9L0OUiToKzn6frlSWKDsNItIwiPcnzA4yQ== X-Received: by 2002:a5d:6244:0:b0:1e7:686d:41e7 with SMTP id m4-20020a5d6244000000b001e7686d41e7mr103495wrv.491.1644966469669; Tue, 15 Feb 2022 15:07:49 -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 w18sm16956590wrl.62.2022.02.15.15.07.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 15:07:49 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org Cc: yong.zhi@intel.com, sakari.ailus@linux.intel.com, bingbu.cao@intel.com, tian.shu.qiu@intel.com, andriy.shevchenko@linux.intel.com, hverkuil-cisco@xs4all.nl Subject: [PATCH 01/10] media: uapi: Add IPU3 packed Y10 format Date: Tue, 15 Feb 2022 23:07:28 +0000 Message-Id: <20220215230737.1870630-2-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220215230737.1870630-1-djrscally@gmail.com> References: <20220215230737.1870630-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Some platforms with an Intel IPU3 have an IR sensor producing 10 bit greyscale format data that is transmitted over a CSI-2 bus to a CIO2 device - this packs the data into 32 bytes per 25 pixels. Detail that format. Signed-off-by: Daniel Scally Reviewed-by: Nicolas Dufresne --- .../userspace-api/media/v4l/pixfmt-yuv-luma.rst | 14 +++++++++++++- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst index 8ebd58c3588f..5465ce3bb533 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst @@ -48,6 +48,17 @@ are often referred to as greyscale formats. - ... - ... + * .. _V4L2-PIX-FMT-IPU3-Y10: + + - ``V4L2_PIX_FMT_IPU3_Y10`` + - 'ip3y' + + - Y'\ :sub:`0`\ [7:0] + - Y'\ :sub:`1`\ [5:0] Y'\ :sub:`0`\ [9:8] + - Y'\ :sub:`2`\ [3:0] Y'\ :sub:`1`\ [9:6] + - Y'\ :sub:`3`\ [1:0] Y'\ :sub:`2`\ [9:4] + - Y'\ :sub:`3`\ [9:2] + * .. _V4L2-PIX-FMT-Y10: - ``V4L2_PIX_FMT_Y10`` @@ -133,4 +144,5 @@ are often referred to as greyscale formats. For the Y16 and Y16_BE formats, the actual sampling precision may be lower than 16 bits. For example, 10 bits per pixel uses values in the range 0 to - 1023. + 1023. For the ip3y format 25 pixels are packed into 32 bytes, which leaves + the 6 most significant bits of the last byte padded with 0. diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 642cb90f457c..89691bbb372d 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1265,6 +1265,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_Y16_BE: descr = "16-bit Greyscale BE"; break; case V4L2_PIX_FMT_Y10BPACK: descr = "10-bit Greyscale (Packed)"; break; case V4L2_PIX_FMT_Y10P: descr = "10-bit Greyscale (MIPI Packed)"; break; + case V4L2_PIX_FMT_IPU3_Y10: descr = "10-bit greyscale (IPU3 Packed)"; break; case V4L2_PIX_FMT_Y8I: descr = "Interleaved 8-bit Greyscale"; break; case V4L2_PIX_FMT_Y12I: descr = "Interleaved 12-bit Greyscale"; break; case V4L2_PIX_FMT_Z16: descr = "16-bit Depth"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index df8b9c486ba1..b378c7e37eac 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -569,6 +569,7 @@ struct v4l2_pix_format { /* Grey bit-packed formats */ #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */ #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */ +#define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */ /* Palette formats */ #define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */ From patchwork Tue Feb 15 23:07:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 542905 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 057F7C433EF for ; Tue, 15 Feb 2022 23:07:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242541AbiBOXIF (ORCPT ); Tue, 15 Feb 2022 18:08:05 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241021AbiBOXIF (ORCPT ); Tue, 15 Feb 2022 18:08:05 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 236C565E0 for ; Tue, 15 Feb 2022 15:07:54 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id m126-20020a1ca384000000b0037bb8e379feso2497447wme.5 for ; Tue, 15 Feb 2022 15:07:54 -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=44CmJ4QtyEm7oBo0dApTxf2TlNPg1exYdSOKt0txzwU=; b=jkF7jdZpnPrMlilVWbpTbDKOI/ny/TP1HBWftbaIttn3qOEkWdzAHJLzPH/vcWrBVq i1PZBxVxM3Gwr/lG05MQf2pWVM5trbw4VA7J709Z/qAeHWEzsTpkDAEjT6g8R5BO5E/W CYxyQm0CUzi4sbQbQEKBZTh+U9inwSZ4o8mz0Q6bz2ZDF2qOqfThlNJNFnEiG0xjPFnV weC3PKz2gznTAdWHohAVvMBK1JlTF/UxG+zqctcCVcJNxRSk/RRRCfgOnLBKheB26gkt CjTXm0np4SXsOpjKvJNrIkU2Jj46UXfZUarrS0BH5OXmm5vipcMicDB7eyXJBbimx4li s+2Q== 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=44CmJ4QtyEm7oBo0dApTxf2TlNPg1exYdSOKt0txzwU=; b=3SLU7UI/WlC3s4lwEdu+pcvqZnuWhMF6HsUzXgHYKwFqptWgSYvLvdAb9q+JrPuKX1 OEwVUuE/0JdM9RCm0VgJbtjHpQN5hUhe9fJKHSKJJmLb72oBmM1e3rGcUwOax6pq5HWb Yq8bAq38pGrCF3w3Zq06lOlK+/7qR9V2/VAkLgcMhmQgJ2CZmwaG4UiR3pbxxodl7AVV XSH5/7epzRDjz+pTEpuC45ybFFHgU/KHNxwLvJKuV20WbKOLKwRaLDVefvMVuTjxvEoZ FTriffZZB/4jdugad5VzXpDt4H0fehvB01ADUB3FLToGiSe8F05ZlV81uI3ixN4r12ny wZDA== X-Gm-Message-State: AOAM532bTJZuquc2X8sC1Kr3prpNoJst02sEwl6C0uUr8sTz2g3Ou7K2 GF5QhgF/bmngBycBEwAcrmQQsVd/MRo4LA== X-Google-Smtp-Source: ABdhPJyfZwzzti6+BF0O0YZbr+2Y0iEhLXz3Ha1j8fU7VNnTXgnBrYDeWD44iL7284z7C/8DuiMcNw== X-Received: by 2002:a05:600c:1583:b0:346:3f83:6b8 with SMTP id r3-20020a05600c158300b003463f8306b8mr113497wmf.75.1644966472805; Tue, 15 Feb 2022 15:07:52 -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 w18sm16956590wrl.62.2022.02.15.15.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 15:07:52 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org Cc: yong.zhi@intel.com, sakari.ailus@linux.intel.com, bingbu.cao@intel.com, tian.shu.qiu@intel.com, andriy.shevchenko@linux.intel.com, hverkuil-cisco@xs4all.nl Subject: [PATCH 03/10] media: i2c: Add acpi support to ov7251 Date: Tue, 15 Feb 2022 23:07:30 +0000 Message-Id: <20220215230737.1870630-4-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220215230737.1870630-1-djrscally@gmail.com> References: <20220215230737.1870630-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add support for enumeration through ACPI to the ov7251 driver Signed-off-by: Daniel Scally --- drivers/media/i2c/ov7251.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c index ebb299f207e5..d6fe574cb9e0 100644 --- a/drivers/media/i2c/ov7251.c +++ b/drivers/media/i2c/ov7251.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -1490,9 +1491,16 @@ static const struct of_device_id ov7251_of_match[] = { }; MODULE_DEVICE_TABLE(of, ov7251_of_match); +static const struct acpi_device_id ov7251_acpi_match[] = { + { "INT347E" }, + { } +}; +MODULE_DEVICE_TABLE(acpi, ov7251_acpi_match); + static struct i2c_driver ov7251_i2c_driver = { .driver = { .of_match_table = ov7251_of_match, + .acpi_match_table = ov7251_acpi_match, .name = "ov7251", }, .probe_new = ov7251_probe, From patchwork Tue Feb 15 23:07:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 542904 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 9B5D5C4332F for ; Tue, 15 Feb 2022 23:07:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243245AbiBOXII (ORCPT ); Tue, 15 Feb 2022 18:08:08 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241021AbiBOXIH (ORCPT ); Tue, 15 Feb 2022 18:08:07 -0500 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 1197365E0 for ; Tue, 15 Feb 2022 15:07:56 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id d27so518806wrb.5 for ; Tue, 15 Feb 2022 15:07:55 -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=7YNBUO8XgUFmBpbbAekPgNEEx1eoBe6SU8q8/QoD89s=; b=NAwNs5H/3Z5UlLXwzs59eJ1V/KqfMhnYE+x/l8H5D4vIMMPbsEa2YrapZ33hSRNRG5 Xql6SPV5m/mSbtQM/OIJWvOGxMqKsDuvp8Nmo/LZF9nkNlIT3TTv/rTy00R/Ra2WgTqN OUN4US97weIWPgwOlQWI9831Lt4dGxCzQt5ffX11th/rY4SzL/BryXtYGaVRC0n7C4uD 8aguPXF4va+J7BIkC9jcHvgx+i9Q1bYO4o9DFo6YVIEV9i57X6gAprOL3XveJv9m32nG 2bMv0zBM/ftMcgPSGS1t+84x6Xh14ZeKHXVfrNUpnMJXBwN1JDkJPRFFm3oKXr8C0+/p czLA== 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=7YNBUO8XgUFmBpbbAekPgNEEx1eoBe6SU8q8/QoD89s=; b=jRS5Qus1w5AAtRcGiw1pffuIb5RtAyR+iNMs/ZRcnLQZbep5iBuiKmbbiBoDnYHWMG rabQZEKPoK08JzdX8erH9kt8fG/L9B4RigudJPbv22WN2dMtfjJas19tW7PMXRFpNdnp MBaw51sYyoDUku00Wk57zTwIMVz4tXZRR2O7GSM9TcNl8UtMKk99zvti1hevTJPZvH67 Rf5mckhjqPLZB9Oythviz3gyxRoaOyJzBuaUPS1pLS330VhmqPWZycCm9G1VVORki33f ZU9E5o9tKZy5l8UTBv+3jaCTzowzxycljm+MSlPZCSTlv+sSnNAl/VJcByk+KKWElWqS +zsg== X-Gm-Message-State: AOAM5307tnKal99i1WihNj9eXJNFa9hngnrQEhZy4ZaVELz4AWNWZ1ay U8kUcOUqCqPUMAq2qs5GAdj8uIB6Tnt3cQ== X-Google-Smtp-Source: ABdhPJwXJaqq0Wgr6KOLL3xpxOqHaFW9lQqXbO+HuPGcQKB1g5hW+QTHsOC9OZPzkXg/lu2o8NYqyw== X-Received: by 2002:adf:dec8:0:b0:1e4:9a2f:e3d1 with SMTP id i8-20020adfdec8000000b001e49a2fe3d1mr170878wrn.374.1644966474679; Tue, 15 Feb 2022 15:07:54 -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 w18sm16956590wrl.62.2022.02.15.15.07.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 15:07:54 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org Cc: yong.zhi@intel.com, sakari.ailus@linux.intel.com, bingbu.cao@intel.com, tian.shu.qiu@intel.com, andriy.shevchenko@linux.intel.com, hverkuil-cisco@xs4all.nl Subject: [PATCH 05/10] media: i2c: Add ov7251_pll_configure() Date: Tue, 15 Feb 2022 23:07:32 +0000 Message-Id: <20220215230737.1870630-6-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220215230737.1870630-1-djrscally@gmail.com> References: <20220215230737.1870630-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Rather than having the pll settings hidden inside mode blobs, define them in structs and use a dedicated function to set them. This makes it simpler to extend the driver to support other external clock frequencies. Signed-off-by: Daniel Scally --- drivers/media/i2c/ov7251.c | 165 ++++++++++++++++++++++++++++++------- 1 file changed, 135 insertions(+), 30 deletions(-) diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c index 5c5f7a15a640..809450b5a99a 100644 --- a/drivers/media/i2c/ov7251.c +++ b/drivers/media/i2c/ov7251.c @@ -42,6 +42,16 @@ #define OV7251_TIMING_FORMAT2_MIRROR BIT(2) #define OV7251_PRE_ISP_00 0x5e00 #define OV7251_PRE_ISP_00_TEST_PATTERN BIT(7) +#define OV7251_PLL1_PRE_DIV_REG 0x30b4 +#define OV7251_PLL1_MULT_REG 0x30b3 +#define OV7251_PLL1_DIVIDER_REG 0x30b1 +#define OV7251_PLL1_PIX_DIV_REG 0x30b0 +#define OV7251_PLL1_MIPI_DIV_REG 0x30b5 +#define OV7251_PLL2_PRE_DIV_REG 0x3098 +#define OV7251_PLL2_MULT_REG 0x3099 +#define OV7251_PLL2_DIVIDER_REG 0x309d +#define OV7251_PLL2_SYS_DIV_REG 0x309a +#define OV7251_PLL2_ADC_DIV_REG 0x309b struct reg_value { u16 reg; @@ -60,6 +70,27 @@ struct ov7251_mode_info { struct v4l2_fract timeperframe; }; +struct ov7251_pll1_config { + unsigned int pre_div; + unsigned int mult; + unsigned int div; + unsigned int pix_div; + unsigned int mipi_div; +}; + +struct ov7251_pll2_config { + unsigned int pre_div; + unsigned int mult; + unsigned int div; + unsigned int sys_div; + unsigned int adc_div; +}; + +struct ov7251_pll_configs { + const struct ov7251_pll1_config *pll1; + const struct ov7251_pll2_config *pll2; +}; + struct ov7251 { struct i2c_client *i2c_client; struct device *dev; @@ -71,6 +102,8 @@ struct ov7251 { struct clk *xclk; u32 xclk_freq; + const struct ov7251_pll_configs *pll_configs; + struct regulator *io_regulator; struct regulator *core_regulator; struct regulator *analog_regulator; @@ -100,6 +133,36 @@ static inline struct ov7251 *to_ov7251(struct v4l2_subdev *sd) return container_of(sd, struct ov7251, sd); } +enum xclk_rate { + OV7251_24_MHZ, + OV7251_NUM_SUPPORTED_RATES +}; + +static const struct ov7251_pll1_config ov7251_pll1_config_24_mhz = { + .pre_div = 0x03, + .mult = 0x64, + .div = 0x01, + .pix_div = 0x0a, + .mipi_div = 0x05 +}; + +static const struct ov7251_pll2_config ov7251_pll2_config_24_mhz = { + .pre_div = 0x04, + .mult = 0x28, + .div = 0x00, + .sys_div = 0x05, + .adc_div = 0x04 +}; + +static const struct ov7251_pll_configs ov7251_pll_configs_24_mhz = { + .pll1 = &ov7251_pll1_config_24_mhz, + .pll2 = &ov7251_pll2_config_24_mhz +}; + +static const struct ov7251_pll_configs *ov7251_pll_configs[] = { + [OV7251_24_MHZ] = &ov7251_pll_configs_24_mhz +}; + static const struct reg_value ov7251_global_init_setting[] = { { 0x0103, 0x01 }, { 0x303b, 0x02 }, @@ -118,16 +181,6 @@ static const struct reg_value ov7251_setting_vga_30fps[] = { { 0x301c, 0xf0 }, { 0x3023, 0x05 }, { 0x3037, 0xf0 }, - { 0x3098, 0x04 }, /* pll2 pre divider */ - { 0x3099, 0x28 }, /* pll2 multiplier */ - { 0x309a, 0x05 }, /* pll2 sys divider */ - { 0x309b, 0x04 }, /* pll2 adc divider */ - { 0x309d, 0x00 }, /* pll2 divider */ - { 0x30b0, 0x0a }, /* pll1 pix divider */ - { 0x30b1, 0x01 }, /* pll1 divider */ - { 0x30b3, 0x64 }, /* pll1 multiplier */ - { 0x30b4, 0x03 }, /* pll1 pre divider */ - { 0x30b5, 0x05 }, /* pll1 mipi divider */ { 0x3106, 0xda }, { 0x3503, 0x07 }, { 0x3509, 0x10 }, @@ -256,16 +309,6 @@ static const struct reg_value ov7251_setting_vga_60fps[] = { { 0x301c, 0x00 }, { 0x3023, 0x05 }, { 0x3037, 0xf0 }, - { 0x3098, 0x04 }, /* pll2 pre divider */ - { 0x3099, 0x28 }, /* pll2 multiplier */ - { 0x309a, 0x05 }, /* pll2 sys divider */ - { 0x309b, 0x04 }, /* pll2 adc divider */ - { 0x309d, 0x00 }, /* pll2 divider */ - { 0x30b0, 0x0a }, /* pll1 pix divider */ - { 0x30b1, 0x01 }, /* pll1 divider */ - { 0x30b3, 0x64 }, /* pll1 multiplier */ - { 0x30b4, 0x03 }, /* pll1 pre divider */ - { 0x30b5, 0x05 }, /* pll1 mipi divider */ { 0x3106, 0xda }, { 0x3503, 0x07 }, { 0x3509, 0x10 }, @@ -394,16 +437,6 @@ static const struct reg_value ov7251_setting_vga_90fps[] = { { 0x301c, 0x00 }, { 0x3023, 0x05 }, { 0x3037, 0xf0 }, - { 0x3098, 0x04 }, /* pll2 pre divider */ - { 0x3099, 0x28 }, /* pll2 multiplier */ - { 0x309a, 0x05 }, /* pll2 sys divider */ - { 0x309b, 0x04 }, /* pll2 adc divider */ - { 0x309d, 0x00 }, /* pll2 divider */ - { 0x30b0, 0x0a }, /* pll1 pix divider */ - { 0x30b1, 0x01 }, /* pll1 divider */ - { 0x30b3, 0x64 }, /* pll1 multiplier */ - { 0x30b4, 0x03 }, /* pll1 pre divider */ - { 0x30b5, 0x05 }, /* pll1 mipi divider */ { 0x3106, 0xda }, { 0x3503, 0x07 }, { 0x3509, 0x10 }, @@ -519,6 +552,10 @@ static const struct reg_value ov7251_setting_vga_90fps[] = { { 0x5001, 0x80 }, }; +static const unsigned long supported_xclk_rates[] = { + [OV7251_24_MHZ] = 24000000, +}; + static const s64 link_freq[] = { 240000000, }; @@ -692,6 +729,63 @@ static int ov7251_read_reg(struct ov7251 *ov7251, u16 reg, u8 *val) return 0; } +static int ov7251_pll_configure(struct ov7251 *ov7251) +{ + const struct ov7251_pll_configs *configs; + int ret; + + configs = ov7251->pll_configs; + + ret = ov7251_write_reg(ov7251, OV7251_PLL1_PRE_DIV_REG, + configs->pll1->pre_div); + if (ret < 0) + return ret; + + ret = ov7251_write_reg(ov7251, OV7251_PLL1_MULT_REG, + configs->pll1->mult); + if (ret < 0) + return ret; + ret = ov7251_write_reg(ov7251, OV7251_PLL1_DIVIDER_REG, + configs->pll1->div); + if (ret < 0) + return ret; + + ret = ov7251_write_reg(ov7251, OV7251_PLL1_PIX_DIV_REG, + configs->pll1->pix_div); + if (ret < 0) + return ret; + + ret = ov7251_write_reg(ov7251, OV7251_PLL1_MIPI_DIV_REG, + configs->pll1->mipi_div); + if (ret < 0) + return ret; + + ret = ov7251_write_reg(ov7251, OV7251_PLL2_PRE_DIV_REG, + configs->pll2->pre_div); + if (ret < 0) + return ret; + + ret = ov7251_write_reg(ov7251, OV7251_PLL2_MULT_REG, + configs->pll2->mult); + if (ret < 0) + return ret; + + ret = ov7251_write_reg(ov7251, OV7251_PLL2_DIVIDER_REG, + configs->pll2->div); + if (ret < 0) + return ret; + + ret = ov7251_write_reg(ov7251, OV7251_PLL2_SYS_DIV_REG, + configs->pll2->sys_div); + if (ret < 0) + return ret; + + ret = ov7251_write_reg(ov7251, OV7251_PLL2_ADC_DIV_REG, + configs->pll2->adc_div); + + return ret; +} + static int ov7251_set_exposure(struct ov7251 *ov7251, s32 exposure) { u16 reg; @@ -1143,6 +1237,11 @@ static int ov7251_s_stream(struct v4l2_subdev *subdev, int enable) mutex_lock(&ov7251->lock); if (enable) { + ret = ov7251_pll_configure(ov7251); + if (ret) + return dev_err_probe(ov7251->dev, ret, + "error configuring PLLs\n"); + ret = ov7251_set_register_array(ov7251, ov7251->current_mode->data, ov7251->current_mode->data_size); @@ -1325,6 +1424,7 @@ static int ov7251_probe(struct i2c_client *client) struct ov7251 *ov7251; u8 chip_id_high, chip_id_low, chip_rev; int ret; + int i; ov7251 = devm_kzalloc(dev, sizeof(struct ov7251), GFP_KERNEL); if (!ov7251) @@ -1363,6 +1463,11 @@ static int ov7251_probe(struct i2c_client *client) dev_err(dev, "could not set xclk frequency\n"); return ret; } + for (i = 0; i < ARRAY_SIZE(supported_xclk_rates); i++) + if (ov7251->xclk_freq == supported_xclk_rates[i]) + break; + + ov7251->pll_configs = ov7251_pll_configs[i]; ov7251->io_regulator = devm_regulator_get(dev, "vdddo"); if (IS_ERR(ov7251->io_regulator)) { From patchwork Tue Feb 15 23:07:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 542903 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 54420C433F5 for ; Tue, 15 Feb 2022 23:08:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236611AbiBOXIL (ORCPT ); Tue, 15 Feb 2022 18:08:11 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243412AbiBOXIJ (ORCPT ); Tue, 15 Feb 2022 18:08:09 -0500 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 7BA2F65E0 for ; Tue, 15 Feb 2022 15:07:58 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id e3so590803wra.0 for ; Tue, 15 Feb 2022 15:07:58 -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=yIAKZBtnJQwKXWI1ucGmm1tOZicYz+1srhpP8quz3OY=; b=IYgHE7mLYLnJgTvwkQGc7edqQKDxjVmpv2tKZHfD8bEb4cv5FRfJ6lPmVuDGGis4pH Yt224WdmekPb5OspNO3C2hNIsBf4ysXCKL2+xHLDty7CulBfNS+FqOTaNnQgXzGq2mYV pAJ65MSlUsf34vT8IhGPnEtDufNjijZEFUiFgKKcwN1vrvSc6CJDFkyueQrr4XdgBvop b9TNtwsDAUVGWXcGxQf1/Y8vSjCH53jCPfSVYf0fbfeImbem38TonmeffSpAOGNl2rgb cyEP7USWEWpXDlxGuGbaxulD+4JVt6F7dNb9gn4BtIYIu4w5S2sNF9+ff8ZfpGllEpAH yH/w== 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=yIAKZBtnJQwKXWI1ucGmm1tOZicYz+1srhpP8quz3OY=; b=fBOBdjN7XEnMXJwkF69868PNRpnUmppF9Hupu+27uMnUYIZbCiBE6w4khlzcOJMWQo DEmYhIxO/Rm2v2nkFAnE3NKUbDoLAwW53Oe0cV5jTbGAF9YGoxJkKhGeWSabUrBFBpVP 5/SebCk52+oUeILHoIVjyRcAeyw747DzHBPHfEkpxT1tAozuhkBtTqvvtj9+CjXDu2hz GzHA9RH8CkaJ1eGamWRTynETC1HbeRfKMAS2luxSsjlodAKLNOlAVHFE6wRisZ7J/2qB d5as54Fg6RnoZ/Lpdtdwmfj7KehkM2o8dWfGc3PXykgfmRQm8wkufRCBDQ6BYE5xxJW/ TxkQ== X-Gm-Message-State: AOAM531IPFCytZINBpEBSFfkvj4ckgBXJEVAyMC73cYDZbnLUAdfQ3yY nKpov3z/ycFIwgHavGpY84XVSzYqTLZtwQ== X-Google-Smtp-Source: ABdhPJxf7vfHdFxvVdhqLPG4HgXOs2Xj0GO19sRCIYz6rYek5e7wCnSx9c1X0xVWRDkL/ZtX18DQKg== X-Received: by 2002:adf:e607:0:b0:1e4:b899:212f with SMTP id p7-20020adfe607000000b001e4b899212fmr146237wrm.173.1644966477110; Tue, 15 Feb 2022 15:07:57 -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 w18sm16956590wrl.62.2022.02.15.15.07.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 15:07:56 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org Cc: yong.zhi@intel.com, sakari.ailus@linux.intel.com, bingbu.cao@intel.com, tian.shu.qiu@intel.com, andriy.shevchenko@linux.intel.com, hverkuil-cisco@xs4all.nl Subject: [PATCH 07/10] media: i2c: Add ov7251_detect_chip() Date: Tue, 15 Feb 2022 23:07:34 +0000 Message-Id: <20220215230737.1870630-8-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220215230737.1870630-1-djrscally@gmail.com> References: <20220215230737.1870630-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org .probe() is quite busy for this driver; make it cleaner by moving the chip verification to a dedicated function. Signed-off-by: Daniel Scally --- drivers/media/i2c/ov7251.c | 62 +++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c index 92605ecdfaa4..f137a1e87537 100644 --- a/drivers/media/i2c/ov7251.c +++ b/drivers/media/i2c/ov7251.c @@ -1442,11 +1442,43 @@ static int ov7251_check_hwcfg(struct ov7251 *ov7251) return ret; } +static int ov7251_detect_chip(struct ov7251 *ov7251) +{ + u8 chip_id_high, chip_id_low, chip_rev; + int ret; + + ret = ov7251_read_reg(ov7251, OV7251_CHIP_ID_HIGH, &chip_id_high); + if (ret < 0 || chip_id_high != OV7251_CHIP_ID_HIGH_BYTE) + return dev_err_probe(ov7251->dev, -ENODEV, + "could not read ID high\n"); + + ret = ov7251_read_reg(ov7251, OV7251_CHIP_ID_LOW, &chip_id_low); + if (ret < 0 || chip_id_low != OV7251_CHIP_ID_LOW_BYTE) + return dev_err_probe(ov7251->dev, -ENODEV, + "could not read ID low\n"); + + ret = ov7251_read_reg(ov7251, OV7251_SC_GP_IO_IN1, &chip_rev); + if (ret < 0) + return dev_err_probe(ov7251->dev, -ENODEV, + "could not read revision\n"); + chip_rev >>= 4; + + dev_info(ov7251->dev, + "OV7251 revision %x (%s) detected at address 0x%02x\n", + chip_rev, + chip_rev == 0x4 ? "1A / 1B" : + chip_rev == 0x5 ? "1C / 1D" : + chip_rev == 0x6 ? "1E" : + chip_rev == 0x7 ? "1F" : "unknown", + ov7251->i2c_client->addr); + + return 0; +} + static int ov7251_probe(struct i2c_client *client) { struct device *dev = &client->dev; struct ov7251 *ov7251; - u8 chip_id_high, chip_id_low, chip_rev; unsigned int rate = 0; int ret; int i; @@ -1578,34 +1610,10 @@ static int ov7251_probe(struct i2c_client *client) goto free_entity; } - ret = ov7251_read_reg(ov7251, OV7251_CHIP_ID_HIGH, &chip_id_high); - if (ret < 0 || chip_id_high != OV7251_CHIP_ID_HIGH_BYTE) { - dev_err(dev, "could not read ID high\n"); - ret = -ENODEV; - goto power_down; - } - ret = ov7251_read_reg(ov7251, OV7251_CHIP_ID_LOW, &chip_id_low); - if (ret < 0 || chip_id_low != OV7251_CHIP_ID_LOW_BYTE) { - dev_err(dev, "could not read ID low\n"); - ret = -ENODEV; - goto power_down; - } - - ret = ov7251_read_reg(ov7251, OV7251_SC_GP_IO_IN1, &chip_rev); - if (ret < 0) { - dev_err(dev, "could not read revision\n"); - ret = -ENODEV; + ret = ov7251_detect_chip(ov7251); + if (ret) goto power_down; - } - chip_rev >>= 4; - dev_info(dev, "OV7251 revision %x (%s) detected at address 0x%02x\n", - chip_rev, - chip_rev == 0x4 ? "1A / 1B" : - chip_rev == 0x5 ? "1C / 1D" : - chip_rev == 0x6 ? "1E" : - chip_rev == 0x7 ? "1F" : "unknown", - client->addr); ret = ov7251_read_reg(ov7251, OV7251_PRE_ISP_00, &ov7251->pre_isp_00); From patchwork Tue Feb 15 23:07:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scally X-Patchwork-Id: 542902 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 A40EBC4332F for ; Tue, 15 Feb 2022 23:08:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244348AbiBOXIM (ORCPT ); Tue, 15 Feb 2022 18:08:12 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243451AbiBOXIL (ORCPT ); Tue, 15 Feb 2022 18:08:11 -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 8D88665E0 for ; Tue, 15 Feb 2022 15:08:00 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id h6so494185wrb.9 for ; Tue, 15 Feb 2022 15:08:00 -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=l2tRfNrOIKSoY0VV6Ty+DAIfmKgy5ueutRp2dWCh5N8=; b=PD3lJUsN8qPv5UHjhZchPZvcRsBUS1Xn9Y86GpZxWDrbgStg3LXVP/tfnM4P7TSpYI N2MY9cfjvK0YOGBaDA0e77geHyZiBl9oBxLc2KFyScYVONOV4VLB6ZxPmcQ3Cn7QuFyh IgkEw+NVsw+Fzr9rCGBsouh9C2mVNgGfXXRD6D5hNSBG4+pcIPs82UpJKSrrMDsnXZmz 9vXB3eLbVJMhwdBmZeDvDNEDaLIn1KOhnmuaEq4p/2eXijJhvbtypwvB6ZOC40eEpvPg rxeGeyeO8NnIHIWRQBRVwIMl2HVxaRVTrxhG3C1p+dHm+7Qznks2lPp2emPQXCMq7aKR 9pxQ== 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=l2tRfNrOIKSoY0VV6Ty+DAIfmKgy5ueutRp2dWCh5N8=; b=hcZ9m3qSo/0mLj+fMs8YhvOsi9Z/Vd72xeEv/yyPZg0gP1MB7ESb98jvXImgJm7sUm TD0gm4EjEu9h1x+sdg2hjyNrezmUgyRkXQxqSPojxf2qp5bghfHjt0pxjhjDELpwYET3 7DSr8sKXHF3z3pCdGSQOUVuWZC4qrYno6ziklXigr7Jpliz3vnyqTBv+O+DB1U7oSB5e Ppp+DbqOdxazvEZEQWzsIzkTHMGThOfo7ydbZj6WKgjIRpWg7A/nqTV9gAXSt8yQhQYF S8hUKzYraLZhfPcIWyiR+36Eyoc0lEh/KAH60A/TCfWF2GmnDaGps5UyajLkCNq/IFko +eHQ== X-Gm-Message-State: AOAM531ZCCPRqOixeqSnmxr2OwzlZPvrMpGZC/TqQy03cPcfxzWtlEjE pdUR0uVDdOzEgsI1d0mI2hKQO9J30K8pjg== X-Google-Smtp-Source: ABdhPJwyjDUeKKWmw2gNSF/NQP1ARSi9LWPJGNMG4fNyQdBATH4e+kZQ0jiHVL86cgYeYPeGsiP+qA== X-Received: by 2002:adf:d082:0:b0:1e3:16e2:d611 with SMTP id y2-20020adfd082000000b001e316e2d611mr165280wrh.716.1644966479230; Tue, 15 Feb 2022 15:07:59 -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 w18sm16956590wrl.62.2022.02.15.15.07.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 15:07:58 -0800 (PST) From: Daniel Scally To: linux-media@vger.kernel.org Cc: yong.zhi@intel.com, sakari.ailus@linux.intel.com, bingbu.cao@intel.com, tian.shu.qiu@intel.com, andriy.shevchenko@linux.intel.com, hverkuil-cisco@xs4all.nl Subject: [PATCH 09/10] media: i2c: Remove .s_power() from ov7251 Date: Tue, 15 Feb 2022 23:07:36 +0000 Message-Id: <20220215230737.1870630-10-djrscally@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220215230737.1870630-1-djrscally@gmail.com> References: <20220215230737.1870630-1-djrscally@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The .s_power() callback is deprecated, and now that we have pm_runtime functionality in the driver there's no further use for it. Delete the function. Signed-off-by: Daniel Scally --- drivers/media/i2c/ov7251.c | 44 +------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c index d620ed6a4e42..5e7422ca4ab9 100644 --- a/drivers/media/i2c/ov7251.c +++ b/drivers/media/i2c/ov7251.c @@ -903,43 +903,6 @@ static int __maybe_unused ov7251_sensor_resume(struct device *dev) return ov7251_set_power_on(ov7251); } -static int ov7251_s_power(struct v4l2_subdev *sd, int on) -{ - struct ov7251 *ov7251 = to_ov7251(sd); - int ret = 0; - - mutex_lock(&ov7251->lock); - - /* If the power state is not modified - no work to do. */ - if (ov7251->power_on == !!on) - goto exit; - - if (on) { - ret = ov7251_set_power_on(ov7251); - if (ret < 0) - goto exit; - - ret = ov7251_set_register_array(ov7251, - ov7251_global_init_setting, - ARRAY_SIZE(ov7251_global_init_setting)); - if (ret < 0) { - dev_err(ov7251->dev, "could not set init registers\n"); - ov7251_set_power_off(ov7251); - goto exit; - } - - ov7251->power_on = true; - } else { - ov7251_set_power_off(ov7251); - ov7251->power_on = false; - } - -exit: - mutex_unlock(&ov7251->lock); - - return ret; -} - static int ov7251_set_hflip(struct ov7251 *ov7251, s32 value) { u8 val = ov7251->timing_format2; @@ -1384,10 +1347,6 @@ static int ov7251_set_frame_interval(struct v4l2_subdev *subdev, return ret; } -static const struct v4l2_subdev_core_ops ov7251_core_ops = { - .s_power = ov7251_s_power, -}; - static const struct v4l2_subdev_video_ops ov7251_video_ops = { .s_stream = ov7251_s_stream, .g_frame_interval = ov7251_get_frame_interval, @@ -1405,7 +1364,6 @@ static const struct v4l2_subdev_pad_ops ov7251_subdev_pad_ops = { }; static const struct v4l2_subdev_ops ov7251_subdev_ops = { - .core = &ov7251_core_ops, .video = &ov7251_video_ops, .pad = &ov7251_subdev_pad_ops, }; @@ -1690,7 +1648,7 @@ static int ov7251_probe(struct i2c_client *client) pm_runtime_disable(ov7251->dev); pm_runtime_put_noidle(ov7251->dev); power_down: - ov7251_s_power(&ov7251->sd, false); + ov7251_set_power_off(ov7251); free_entity: media_entity_cleanup(&ov7251->sd.entity); free_ctrl: