From patchwork Wed Jun 29 15:29:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 12900311 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 CD46DC43334 for ; Wed, 29 Jun 2022 15:29:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233924AbiF2P3q (ORCPT ); Wed, 29 Jun 2022 11:29:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232340AbiF2P3p (ORCPT ); Wed, 29 Jun 2022 11:29:45 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E3E62E9FB for ; Wed, 29 Jun 2022 08:29:44 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id ge10so33340541ejb.7 for ; Wed, 29 Jun 2022 08:29:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rpdfidpXpaazosoDOCbj0RBJV66iHVFwcJEcEN756BA=; b=IUS/tQRV9Xs0sgYfGzsGhha70gjVBz73nkez+m28P78MxPJ1VnIrffUNwQHOD1NfT+ ApcTOwQaguPZMCwXAqs7FLzkEWj5L3+8to103g1o2rAmze8MxSROnytO0DzP7F/XyhKy IF0Kp8RgZkV+gLPO8ejmugKNnzK/fdxR412Gk= 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=rpdfidpXpaazosoDOCbj0RBJV66iHVFwcJEcEN756BA=; b=gK4925oOSsOeivWQiWHZFJXJJwxNdeZNm94DgN4CRBbK0YCHtOwuV8DKuXErlTifdb +ZoPuGPqSfiG5FgSki5SWnBjdy11uBx+a+tftxe2rRAh2rK+iBxm8JnkgkDr0fk4zgK9 FDSvigtlJKOyr7AyQgR1zZdneb82n/gJpzy5f+33xSNPp5NCSFJr4lD+oiT908qCZNQO eRmGRG1Ej7Xt+CrvTrlrEr7VkMNvpHjF4NHtgjc8uaFkSpCHBWK6nNWTh1HwQgjMODmp 03GHlzZZFwA69KzVzR8IrvelgDnfmGJdodhf09wKI2PgIfla7b95NVqIVw185fKRyDUn 4Zsg== X-Gm-Message-State: AJIora9A4o8XHXRhU6gFxdekM6TJC0egL2WLCjeGUZ0nfxHT8G3kc0ue bIR6N9GJ3ePBQoBBgg+QFGgbuA== X-Google-Smtp-Source: AGRyM1u4hDEDe8vTP5yvMrLYpGxV5O1fWsGZEEbyIItQ7ZfOMuq+gWVjiushepTKDboGCuaJ6DmYaA== X-Received: by 2002:a17:906:3f51:b0:712:3945:8c0d with SMTP id f17-20020a1709063f5100b0071239458c0dmr3823631ejj.302.1656516583001; Wed, 29 Jun 2022 08:29:43 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-58-216.cust.vodafonedsl.it. [188.217.58.216]) by smtp.gmail.com with ESMTPSA id h1-20020a1709063c0100b006feec47dae9sm7821853ejg.157.2022.06.29.08.29.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 08:29:42 -0700 (PDT) From: Tommaso Merciai To: tommaso.merciai@amarulasolutions.com Cc: linuxfancy@googlegroups.com, linux-amarula@amarulasolutions.com, quentin.schulz@theobroma-systems.com, Daniel Scally , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/6] media: ov5693: count num_supplies using array_size Date: Wed, 29 Jun 2022 17:29:28 +0200 Message-Id: <20220629152933.422990-2-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220629152933.422990-1-tommaso.merciai@amarulasolutions.com> References: <20220629152933.422990-1-tommaso.merciai@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Instead of hardcode OV5693_NUM_SUPPLIES in a define is better use ARRAY_SIZE function to count the number of supplies from ov5693_supply_names array Signed-off-by: Tommaso Merciai --- drivers/media/i2c/ov5693.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/ov5693.c b/drivers/media/i2c/ov5693.c index 117ff5403312..f410333c4c67 100644 --- a/drivers/media/i2c/ov5693.c +++ b/drivers/media/i2c/ov5693.c @@ -127,11 +127,15 @@ #define OV5693_LINK_FREQ_419_2MHZ 419200000 #define OV5693_PIXEL_RATE 167680000 -/* Miscellaneous */ -#define OV5693_NUM_SUPPLIES 2 - #define to_ov5693_sensor(x) container_of(x, struct ov5693_device, sd) +static const char * const ov5693_supply_names[] = { + "avdd", /* Analog power */ + "dovdd", /* Digital I/O power */ +}; + +#define OV5693_NUM_SUPPLIES ARRAY_SIZE(ov5693_supply_names) + struct ov5693_reg { u32 reg; u8 val; @@ -352,11 +356,6 @@ static const s64 link_freq_menu_items[] = { OV5693_LINK_FREQ_419_2MHZ }; -static const char * const ov5693_supply_names[] = { - "avdd", - "dovdd", -}; - static const char * const ov5693_test_pattern_menu[] = { "Disabled", "Random Data", From patchwork Wed Jun 29 15:29:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 12900312 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 C6764CCA47C for ; Wed, 29 Jun 2022 15:29:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234205AbiF2P3q (ORCPT ); Wed, 29 Jun 2022 11:29:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234198AbiF2P3p (ORCPT ); Wed, 29 Jun 2022 11:29:45 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6E4531900 for ; Wed, 29 Jun 2022 08:29:44 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id fw3so5681248ejc.10 for ; Wed, 29 Jun 2022 08:29:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pGYlZSXrL+oaB0Q/zXs3LZ4NFxxmWuNHZP0D34FWGxY=; b=KV+8dHaeHdOunXfe4zJndAKpkwl/svXXQfG0zQhaNXvUHKInvnYm0R2Q3egVLSxPCq wBgAYk8N/i+XTlBZXNu/4dvM2YUk4DflupZnt2Kn7BfVxmyYE+0y/JIYDGrhQl5V4jUv tBka2iTn9SsmjOAQ8PI+Nv/nVjIWmEJORxbzw= 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=pGYlZSXrL+oaB0Q/zXs3LZ4NFxxmWuNHZP0D34FWGxY=; b=6r57uqvl1I9rGOf7J9HQGITut/OWWt+ftK2HJZ5z8n2IGGsT100xhFLi4CgQ6DA07G bpaAVVAyhh+yDJO28YE0pgL9rKre2bgLpD8IwybpX7MaiiJYb5UdasQY/pbP4L6jowpP /ZOElDxqhJMOWu86dAU18iG+V2Bf2qIX9JzbIxNeplLm0oOLS1m81Pqo6KLHKsjZIWmX uJCFHstKLi6jvIwT0IcpmBP2AzS/hsvjxajf7kxR/6qLk/ngAWFNSb6G12vxcBIw5MNU 3O+6osiZmeSmixiPdemGpuX7LZEDrspefBMmGW+nv/cLNu3OYAlK9ARf7L6u8JJWc6Ug 1AXQ== X-Gm-Message-State: AJIora9QPd3h20oNdb4JTUqFxpHZOvbhvNEdT757qm3YBFvtY6LMY+NR lVApXV6NlkcqaT/FGRzzq+FnEw== X-Google-Smtp-Source: AGRyM1sBdXh3kcMM8zAhmTeuhRb1hhdkiB6AGPUfX7hV1kGhzl4x8Q72xG6q7Z1/6wZJgjgAde72hA== X-Received: by 2002:a17:907:6da2:b0:726:3ebd:9c9a with SMTP id sb34-20020a1709076da200b007263ebd9c9amr3935753ejc.628.1656516584426; Wed, 29 Jun 2022 08:29:44 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-58-216.cust.vodafonedsl.it. [188.217.58.216]) by smtp.gmail.com with ESMTPSA id h1-20020a1709063c0100b006feec47dae9sm7821853ejg.157.2022.06.29.08.29.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 08:29:44 -0700 (PDT) From: Tommaso Merciai To: tommaso.merciai@amarulasolutions.com Cc: linuxfancy@googlegroups.com, linux-amarula@amarulasolutions.com, quentin.schulz@theobroma-systems.com, Daniel Scally , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/6] media: ov5693: add dvdd into ov5693_supply_names array Date: Wed, 29 Jun 2022 17:29:29 +0200 Message-Id: <20220629152933.422990-3-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220629152933.422990-1-tommaso.merciai@amarulasolutions.com> References: <20220629152933.422990-1-tommaso.merciai@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add missing "dvdd" (Digital circuit power) entry into ov5693_supply_names array Signed-off-by: Tommaso Merciai --- drivers/media/i2c/ov5693.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/i2c/ov5693.c b/drivers/media/i2c/ov5693.c index f410333c4c67..9e84468d920e 100644 --- a/drivers/media/i2c/ov5693.c +++ b/drivers/media/i2c/ov5693.c @@ -132,6 +132,7 @@ static const char * const ov5693_supply_names[] = { "avdd", /* Analog power */ "dovdd", /* Digital I/O power */ + "dvdd", /* Digital circuit power */ }; #define OV5693_NUM_SUPPLIES ARRAY_SIZE(ov5693_supply_names) From patchwork Wed Jun 29 15:29:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 12900313 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 862C0C43334 for ; Wed, 29 Jun 2022 15:29:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234282AbiF2P34 (ORCPT ); Wed, 29 Jun 2022 11:29:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234238AbiF2P3v (ORCPT ); Wed, 29 Jun 2022 11:29:51 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A30731349 for ; Wed, 29 Jun 2022 08:29:47 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id lw20so33377623ejb.4 for ; Wed, 29 Jun 2022 08:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l2qHBG28ZF/0BqgZtfUZ2wwyoD54f6fad9bi6YF6qP8=; b=FRoTeRJqWCXMpSSGoW1bC/hsa/32en5X3gVT+hCgpFEGgM87veNqIMQuAIj8RWjY1k 3p2yOfDv+2OYvfXmloEK4W8SnOEwp91O/CVDpCqE1fLeE+trcEUZc+fpphXk+OWsdlMo MaMGsG4ZUOEFFccUovby8Mq4Yciw+urnI51wg= 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=l2qHBG28ZF/0BqgZtfUZ2wwyoD54f6fad9bi6YF6qP8=; b=Gr1AOZmBG+LnjXYk4XkZ6zfKB2G2t90wgvWQfLi1bjYs3azJTzKuU8tDiBebgoV89U fAMmB7RsOlyRESGG9EgRenghfFm7Jz7homgKguc/c7YPdcMCnpGs6qVQEhJUPfphNH8I CjLin3Wqh5bdBI1fcUkatLJxjMaOJzC9P3XAZLahdS/PeRfbmlckO5iIhENbc7Mkw7fR YjccOBupk4iDrtrX2VBHdwBjJ8nazgnl2Fyf1vdKk4P8gey22aFfo1bhiJW9J/Y0QEOd eSXbFCHDKJ12nWGbDCCq760y1ZBjS7aJVTiusRi8lYFChG1Bx56bhC8xYKI1Hmm+5kKU gLGw== X-Gm-Message-State: AJIora817zwXDr1WNCkUhirB8oVTBYqSwxLgqoHtPOFWWFwCObS+Hvtn DM/8mRWruFUOKjOExB4IyYA8cA== X-Google-Smtp-Source: AGRyM1s/fjJ/aZb6Nsgih4XdqPsiZQ+zrFpgSyyMiLHkBeFX8zNWoYgZNCQOUUHA69KHpga9AC3Psg== X-Received: by 2002:a17:906:2086:b0:712:1257:77bf with SMTP id 6-20020a170906208600b00712125777bfmr4043969ejq.655.1656516585942; Wed, 29 Jun 2022 08:29:45 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-58-216.cust.vodafonedsl.it. [188.217.58.216]) by smtp.gmail.com with ESMTPSA id h1-20020a1709063c0100b006feec47dae9sm7821853ejg.157.2022.06.29.08.29.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 08:29:45 -0700 (PDT) From: Tommaso Merciai To: tommaso.merciai@amarulasolutions.com Cc: linuxfancy@googlegroups.com, linux-amarula@amarulasolutions.com, quentin.schulz@theobroma-systems.com, Daniel Scally , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/6] media: ov5693: rename clk into xvclk Date: Wed, 29 Jun 2022 17:29:30 +0200 Message-Id: <20220629152933.422990-4-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220629152933.422990-1-tommaso.merciai@amarulasolutions.com> References: <20220629152933.422990-1-tommaso.merciai@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Rename clk pdata pointer into xvclk (system clock input). Same for clk_rate into xvclk_rate. This is more explicit Signed-off-by: Tommaso Merciai --- drivers/media/i2c/ov5693.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/media/i2c/ov5693.c b/drivers/media/i2c/ov5693.c index 9e84468d920e..d2adc5513a21 100644 --- a/drivers/media/i2c/ov5693.c +++ b/drivers/media/i2c/ov5693.c @@ -157,7 +157,7 @@ struct ov5693_device { struct gpio_desc *reset; struct gpio_desc *powerdown; struct regulator_bulk_data supplies[OV5693_NUM_SUPPLIES]; - struct clk *clk; + struct clk *xvclk; struct ov5693_mode { struct v4l2_rect crop; @@ -794,7 +794,7 @@ static void ov5693_sensor_powerdown(struct ov5693_device *ov5693) regulator_bulk_disable(OV5693_NUM_SUPPLIES, ov5693->supplies); - clk_disable_unprepare(ov5693->clk); + clk_disable_unprepare(ov5693->xvclk); } static int ov5693_sensor_powerup(struct ov5693_device *ov5693) @@ -804,7 +804,7 @@ static int ov5693_sensor_powerup(struct ov5693_device *ov5693) gpiod_set_value_cansleep(ov5693->reset, 1); gpiod_set_value_cansleep(ov5693->powerdown, 1); - ret = clk_prepare_enable(ov5693->clk); + ret = clk_prepare_enable(ov5693->xvclk); if (ret) { dev_err(ov5693->dev, "Failed to enable clk\n"); goto fail_power; @@ -1390,7 +1390,7 @@ static int ov5693_check_hwcfg(struct ov5693_device *ov5693) static int ov5693_probe(struct i2c_client *client) { struct ov5693_device *ov5693; - u32 clk_rate; + u32 xvclk_rate; int ret = 0; ov5693 = devm_kzalloc(&client->dev, sizeof(*ov5693), GFP_KERNEL); @@ -1408,16 +1408,16 @@ static int ov5693_probe(struct i2c_client *client) v4l2_i2c_subdev_init(&ov5693->sd, client, &ov5693_ops); - ov5693->clk = devm_clk_get(&client->dev, "xvclk"); - if (IS_ERR(ov5693->clk)) { + ov5693->xvclk = devm_clk_get(&client->dev, "xvclk"); + if (IS_ERR(ov5693->xvclk)) { dev_err(&client->dev, "Error getting clock\n"); - return PTR_ERR(ov5693->clk); + return PTR_ERR(ov5693->xvclk); } - clk_rate = clk_get_rate(ov5693->clk); - if (clk_rate != OV5693_XVCLK_FREQ) + xvclk_rate = clk_get_rate(ov5693->xvclk); + if (xvclk_rate != OV5693_XVCLK_FREQ) dev_warn(&client->dev, "Found clk freq %u, expected %u\n", - clk_rate, OV5693_XVCLK_FREQ); + xvclk_rate, OV5693_XVCLK_FREQ); ret = ov5693_configure_gpios(ov5693); if (ret) From patchwork Wed Jun 29 15:29:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 12900314 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 6AAFEC433EF for ; Wed, 29 Jun 2022 15:29:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234288AbiF2P35 (ORCPT ); Wed, 29 Jun 2022 11:29:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234242AbiF2P3v (ORCPT ); Wed, 29 Jun 2022 11:29:51 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 494033584B for ; Wed, 29 Jun 2022 08:29:49 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id lw20so33377791ejb.4 for ; Wed, 29 Jun 2022 08:29:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tAxDi2Wkl/35VdNLO85QV0zkWLjv9bTpycYmTXdG8/c=; b=Vu/XBGFDNdJlKBD6wvxg3TB3dSW4JFkrhIViX7Abdpgmv9018Ce4xqUNvNYV980N6/ F7+kMqMsvf57b+zktexwgYQeEjOFcIdxWiDoiXG7ogpXTk9I5EvPpG6SjlOodnU6+yg6 OCWOaPtZhbjcIpgExw0y60M7bTevlNocZiom0= 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=tAxDi2Wkl/35VdNLO85QV0zkWLjv9bTpycYmTXdG8/c=; b=c2QKTOQ6m0mef4b9gjb3562aQnosV6DeR2AmYRxjSFiabRzR0OseGW4UC3Z0qZp8Xv q3gjEOnOd2M5IDtMrZ5PTDtX4XRsweNX6SbnO2eujMWcwNSxox39GDda4XPQedX2dakv jQhiBoeWxKJlPt89Ssh/54u80/sQnXc87VATli3D00mdyNS1EICT7YQgzPR0IY/GQFc8 s1Xhz1JgSQCwgn2QfbMkq0aYbZR4n7cLp/U2z7nQKq6WreVFGeSwIHlpBJiwG/Wl3zJd eki+BVXIgNZmsOxqHEsAlTo7qQ22O3r27kPXO4Esj/0qWkuJkwfu1PEsZHyx8e7UNnAW zqAw== X-Gm-Message-State: AJIora/pOfGg3o36bi2lkPcgocR3hbMsVfbP2N2IQ97lNAXNEe9BrzMn L6ctux5PFPwQXUFAlhRyo0z8qQ== X-Google-Smtp-Source: AGRyM1ugYE074ctuuAmCkt6BZo4n6xyfhSk8+c819JgTB3O+bnFZ1X2dXHAPF0o2Bra1Smg+f86BkQ== X-Received: by 2002:a17:906:7303:b0:722:f008:2970 with SMTP id di3-20020a170906730300b00722f0082970mr3780343ejc.491.1656516587641; Wed, 29 Jun 2022 08:29:47 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-58-216.cust.vodafonedsl.it. [188.217.58.216]) by smtp.gmail.com with ESMTPSA id h1-20020a1709063c0100b006feec47dae9sm7821853ejg.157.2022.06.29.08.29.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 08:29:47 -0700 (PDT) From: Tommaso Merciai To: tommaso.merciai@amarulasolutions.com Cc: linuxfancy@googlegroups.com, linux-amarula@amarulasolutions.com, quentin.schulz@theobroma-systems.com, Daniel Scally , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/6] media: ov5693: move hw cfg functions into ov5693_hwcfg Date: Wed, 29 Jun 2022 17:29:31 +0200 Message-Id: <20220629152933.422990-5-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220629152933.422990-1-tommaso.merciai@amarulasolutions.com> References: <20220629152933.422990-1-tommaso.merciai@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Move hw configuration functions into ov5693_hwcfg. This is done to separate the code that handle the hw cfg from probe in a clean way. Add also support to get clock from "clock-frequency" fwnode in ov5675_hwcfg function Signed-off-by: Tommaso Merciai Reviewed-by: Jacopo Mondi --- Changes since v2: - Fix commit body as suggested by Sakari, Jacopo - Add details to commit body as suggested Jacopo - Move ov5693_check_hwcfg into ov5693_hwcfg - Fix xvclk_rate position as suggested Jacopo drivers/media/i2c/ov5693.c | 57 +++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/drivers/media/i2c/ov5693.c b/drivers/media/i2c/ov5693.c index d2adc5513a21..3c805a5a5181 100644 --- a/drivers/media/i2c/ov5693.c +++ b/drivers/media/i2c/ov5693.c @@ -1339,16 +1339,48 @@ static int ov5693_get_regulators(struct ov5693_device *ov5693) ov5693->supplies); } -static int ov5693_check_hwcfg(struct ov5693_device *ov5693) +static int ov5693_hwcfg(struct ov5693_device *ov5693) { struct fwnode_handle *fwnode = dev_fwnode(ov5693->dev); struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = V4L2_MBUS_CSI2_DPHY, }; struct fwnode_handle *endpoint; + u32 xvclk_rate; unsigned int i; int ret; + ov5693->xvclk = devm_clk_get_optional(ov5693->dev, "xvclk"); + if (IS_ERR(ov5693->xvclk)) + return dev_err_probe(ov5693->dev, PTR_ERR(ov5693->xvclk), + "failed to get xvclk: %ld\n", + PTR_ERR(ov5693->xvclk)); + + if (ov5693->xvclk) { + xvclk_rate = clk_get_rate(ov5693->xvclk); + } else { + ret = fwnode_property_read_u32(fwnode, "clock-frequency", + &xvclk_rate); + + if (ret) { + dev_err(ov5693->dev, "can't get clock frequency"); + return ret; + } + } + + if (xvclk_rate != OV5693_XVCLK_FREQ) + dev_warn(ov5693->dev, "Found clk freq %u, expected %u\n", + xvclk_rate, OV5693_XVCLK_FREQ); + + ret = ov5693_configure_gpios(ov5693); + if (ret) + return ret; + + ret = ov5693_get_regulators(ov5693); + if (ret) + return dev_err_probe(ov5693->dev, ret, + "Error fetching regulators\n"); + endpoint = fwnode_graph_get_next_endpoint(fwnode, NULL); if (!endpoint) return -EPROBE_DEFER; /* Could be provided by cio2-bridge */ @@ -1390,7 +1422,6 @@ static int ov5693_check_hwcfg(struct ov5693_device *ov5693) static int ov5693_probe(struct i2c_client *client) { struct ov5693_device *ov5693; - u32 xvclk_rate; int ret = 0; ov5693 = devm_kzalloc(&client->dev, sizeof(*ov5693), GFP_KERNEL); @@ -1400,7 +1431,7 @@ static int ov5693_probe(struct i2c_client *client) ov5693->client = client; ov5693->dev = &client->dev; - ret = ov5693_check_hwcfg(ov5693); + ret = ov5693_hwcfg(ov5693); if (ret) return ret; @@ -1408,26 +1439,6 @@ static int ov5693_probe(struct i2c_client *client) v4l2_i2c_subdev_init(&ov5693->sd, client, &ov5693_ops); - ov5693->xvclk = devm_clk_get(&client->dev, "xvclk"); - if (IS_ERR(ov5693->xvclk)) { - dev_err(&client->dev, "Error getting clock\n"); - return PTR_ERR(ov5693->xvclk); - } - - xvclk_rate = clk_get_rate(ov5693->xvclk); - if (xvclk_rate != OV5693_XVCLK_FREQ) - dev_warn(&client->dev, "Found clk freq %u, expected %u\n", - xvclk_rate, OV5693_XVCLK_FREQ); - - ret = ov5693_configure_gpios(ov5693); - if (ret) - return ret; - - ret = ov5693_get_regulators(ov5693); - if (ret) - return dev_err_probe(&client->dev, ret, - "Error fetching regulators\n"); - ov5693->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; ov5693->pad.flags = MEDIA_PAD_FL_SOURCE; ov5693->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; From patchwork Wed Jun 29 15:29:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 12900315 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 5EA0CC43334 for ; Wed, 29 Jun 2022 15:30:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234296AbiF2PaA (ORCPT ); Wed, 29 Jun 2022 11:30:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234269AbiF2P3y (ORCPT ); Wed, 29 Jun 2022 11:29:54 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AE612E9FB for ; Wed, 29 Jun 2022 08:29:51 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id ge10so33340541ejb.7 for ; Wed, 29 Jun 2022 08:29:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pG4516cohOqmzY/WeE217b5UjBeRS8XxQA8SMKP7KGY=; b=arEVbmUxx3OwnNqZEgZxU22aStquOwpo7XJjtET0t9mL+fvDxHY01rLSD7hsi/PVXu u6VhUQHgvToE2ef/1o6wmB+gKPbGCPNKX7i3J3pmnNWeoHNZpQ0wwHjal4zVOgp9fip/ 5CRfrjkmPajEYIXbyrtLPQSs5+JGBz6LDN7r8= 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=pG4516cohOqmzY/WeE217b5UjBeRS8XxQA8SMKP7KGY=; b=uKPTskbyxiAs3Vel18qdwqQICMaI+awv2NNKxScvN0zkOTTDPXuT4E/qoeoBmOkfrt HWgsVlZFnMKAps5riDWMYjMtJsJxpDh1YFldagzh+lg7KiPrdyN4Fpim/TygKP5dqfr7 A4n+FIAA3zfut71dWmmuyo2RwMri47UX5GP622jSBMQCZI8ks4wjgdeUzlQLyRcmiTVt kSZD1fuU805Wdz0Dhf5r48EukCikpJv2tF4EN/YsQFtgQASpUHOUM+n3eG0C+MKdAfFo KcQefOcLbEMz59sG9fsxVB6qbvvUQHnybYP7K6pq+br2PPsRyp5uB66DJCzvKiHuHHaT QndQ== X-Gm-Message-State: AJIora+e2XgXxOh42jawicSh8m2yYUBUXjCSLrc44ouYmMtxqDaiZc6A lChUWyDusIQodnjvym3/U9f9lg== X-Google-Smtp-Source: AGRyM1toGaKVephymUKJPJCnUlc+6N3lyjSelpmCnhcm9C25JlG7nI8aSxZzstumPRfgof48RMy+IQ== X-Received: by 2002:a17:907:60cc:b0:722:e564:eb11 with SMTP id hv12-20020a17090760cc00b00722e564eb11mr3800546ejc.736.1656516591069; Wed, 29 Jun 2022 08:29:51 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-58-216.cust.vodafonedsl.it. [188.217.58.216]) by smtp.gmail.com with ESMTPSA id h1-20020a1709063c0100b006feec47dae9sm7821853ejg.157.2022.06.29.08.29.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 08:29:50 -0700 (PDT) From: Tommaso Merciai To: tommaso.merciai@amarulasolutions.com Cc: linuxfancy@googlegroups.com, linux-amarula@amarulasolutions.com, quentin.schulz@theobroma-systems.com, Daniel Scally , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 5/6] media: dt-bindings: ov5693: document YAML binding Date: Wed, 29 Jun 2022 17:29:32 +0200 Message-Id: <20220629152933.422990-6-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220629152933.422990-1-tommaso.merciai@amarulasolutions.com> References: <20220629152933.422990-1-tommaso.merciai@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add documentation of device tree in YAML schema for the OV5693 CMOS image sensor from Omnivision Signed-off-by: Tommaso Merciai Reviewed-by: Krzysztof Kozlowski --- Changes since v1: - Fix allOf position as suggested by Krzysztof - Remove port description as suggested by Krzysztof - Fix EOF as suggested by Krzysztof Changes since v2: - Fix commit body as suggested by Krzysztof .../bindings/media/i2c/ovti,ov5693.yaml | 106 ++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 107 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ov5693.yaml diff --git a/Documentation/devicetree/bindings/media/i2c/ovti,ov5693.yaml b/Documentation/devicetree/bindings/media/i2c/ovti,ov5693.yaml new file mode 100644 index 000000000000..b83c9fc04023 --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/ovti,ov5693.yaml @@ -0,0 +1,106 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (c) 2022 Amarulasolutions +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/i2c/ovti,ov5693.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Omnivision OV5693 CMOS Sensor + +maintainers: + - Tommaso Merciai + +description: | + The Omnivision OV5693 is a high performance, 1/4-inch, 5 megapixel, CMOS + image sensor that delivers 2592x1944 at 30fps. It provides full-frame, + sub-sampled, and windowed 10-bit MIPI images in various formats via the + Serial Camera Control Bus (SCCB) interface. + + OV5693 is controlled via I2C and two-wire Serial Camera Control Bus (SCCB). + The sensor output is available via CSI-2 serial data output (up to 2-lane). + +allOf: + - $ref: /schemas/media/video-interface-devices.yaml# + +properties: + compatible: + const: ovti,ov5693 + + reg: + maxItems: 1 + + clocks: + description: + System input clock (aka XVCLK). From 6 to 27 MHz. + maxItems: 1 + + dovdd-supply: + description: + Digital I/O voltage supply, 1.8V. + + avdd-supply: + description: + Analog voltage supply, 2.8V. + + dvdd-supply: + description: + Digital core voltage supply, 1.2V. + + reset-gpios: + description: + The phandle and specifier for the GPIO that controls sensor reset. + This corresponds to the hardware pin XSHUTDN which is physically + active low. + maxItems: 1 + +required: + - compatible + - reg + - clocks + - dovdd-supply + - avdd-supply + - dvdd-supply + - port + +unevaluatedProperties: false + +examples: + - | + #include + #include + #include + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + ov5693: camera@36 { + compatible = "ovti,ov5693"; + reg = <0x36>; + + reset-gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&cif_clkout_m0>; + + clocks = <&cru SCLK_CIF_OUT>; + assigned-clocks = <&cru SCLK_CIF_OUT>; + assigned-clock-rates = <19200000>; + + avdd-supply = <&vcc_1v8>; + dvdd-supply = <&vcc_1v2>; + dovdd-supply = <&vcc_2v8>; + + rotation = <90>; + orientation = <0>; + + port { + ucam_out: endpoint { + remote-endpoint = <&mipi_in_ucam>; + data-lanes = <1 2>; + link-frequencies = /bits/ 64 <450000000>; + }; + }; + }; + }; + +... diff --git a/MAINTAINERS b/MAINTAINERS index 1fc9ead83d2a..844307cb20c4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14719,6 +14719,7 @@ M: Daniel Scally L: linux-media@vger.kernel.org S: Maintained T: git git://linuxtv.org/media_tree.git +F: Documentation/devicetree/bindings/media/i2c/ovti,ov5693.yaml F: drivers/media/i2c/ov5693.c OMNIVISION OV5695 SENSOR DRIVER From patchwork Wed Jun 29 15:29:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 12900316 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 97ADFC43334 for ; Wed, 29 Jun 2022 15:30:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234278AbiF2PaQ (ORCPT ); Wed, 29 Jun 2022 11:30:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234271AbiF2PaD (ORCPT ); Wed, 29 Jun 2022 11:30:03 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8DE536695 for ; Wed, 29 Jun 2022 08:30:01 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id n8so8766229eda.0 for ; Wed, 29 Jun 2022 08:30:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YM+AbWC19jugmctruXrYCqIRv2YGYgOFFX1PeI35Oss=; b=qLIJUtXYkIpODcJfHifnKXFE5qcQQLG2Wz/bg0gL0wYRpBV5vzhEa/8SGXn92FnQVi zxGF9NNWYpukQKcGa6B4pPCmoOhxJoyucSAqMfh1MUhOkMT5mJbsNFV0diMjIPWLkKiA h6pov3sYNneBYMfnhIXs93GwD58/PB4/+YfVM= 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=YM+AbWC19jugmctruXrYCqIRv2YGYgOFFX1PeI35Oss=; b=Tg/2BvKVX612Y3V5WOh1J83nejwIJcbGotsh6xcYlhmT987wIbJ1Je7ijQTGH8pO1T yI77p1m+/vr9zLgGAcH0TVRzyP38RnQB6I2dVK+AIMrmLoMyZfcIBjKrcIvYeA/sK+/5 whmlowoec2XhZ7OuNUaPBr3+hF4nB+kWbMVjym5B93NfnCUHcuVs9Fmpw+2mRm3+eh21 jAfhQkZN67DbIHErWbKO8vDfb9uBV8JO3H4LU0zEznyJHTX7Eai1msVGnLYne/e3DeQc zGWclfSThC2yCHJhiaGQqSpQAvbf5TmqMpSpVn5vXdkPR0GFcZKWUrYmlxDFuKpSCBnh 0+tA== X-Gm-Message-State: AJIora/tGHp0JPmorn7CdL0Nh8d/K1b2LkPB50p1pqQAXdHjy7OdC4bg sNdd9qZpzW6vCmnx0ANCsbWSRQ== X-Google-Smtp-Source: AGRyM1t76aeDWU3Npw3pikScp+6JZnN5RmrXhyErEib0ezH30zTOHpxmhgthGS8X1vCNZR/EaxGKpg== X-Received: by 2002:a05:6402:50ce:b0:435:9249:dfe9 with SMTP id h14-20020a05640250ce00b004359249dfe9mr4957862edb.310.1656516600532; Wed, 29 Jun 2022 08:30:00 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-58-216.cust.vodafonedsl.it. [188.217.58.216]) by smtp.gmail.com with ESMTPSA id h1-20020a1709063c0100b006feec47dae9sm7821853ejg.157.2022.06.29.08.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 08:30:00 -0700 (PDT) From: Tommaso Merciai To: tommaso.merciai@amarulasolutions.com Cc: linuxfancy@googlegroups.com, linux-amarula@amarulasolutions.com, quentin.schulz@theobroma-systems.com, Daniel Scally , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 6/6] media: ov5693: add ov5693_of_match, dts support Date: Wed, 29 Jun 2022 17:29:33 +0200 Message-Id: <20220629152933.422990-7-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220629152933.422990-1-tommaso.merciai@amarulasolutions.com> References: <20220629152933.422990-1-tommaso.merciai@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add ov5693_of_match. Device tree support Signed-off-by: Tommaso Merciai --- Changes since v2: - Change patch order 7 -> 6 as suggested by Sakari - Add missing signed-off as suggested by Jacopo drivers/media/i2c/ov5693.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/media/i2c/ov5693.c b/drivers/media/i2c/ov5693.c index 2359b00fc428..ac2ea3238db9 100644 --- a/drivers/media/i2c/ov5693.c +++ b/drivers/media/i2c/ov5693.c @@ -1532,10 +1532,17 @@ static const struct acpi_device_id ov5693_acpi_match[] = { }; MODULE_DEVICE_TABLE(acpi, ov5693_acpi_match); +static const struct of_device_id ov5693_of_match[] = { + { .compatible = "ovti,ov5693", }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, ov5693_of_match); + static struct i2c_driver ov5693_driver = { .driver = { .name = "ov5693", .acpi_match_table = ov5693_acpi_match, + .of_match_table = ov5693_of_match, .pm = &ov5693_pm_ops, }, .probe_new = ov5693_probe,