From patchwork Wed Jul 13 15:05:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 12916872 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 A7389C43334 for ; Wed, 13 Jul 2022 15:05:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236786AbiGMPF3 (ORCPT ); Wed, 13 Jul 2022 11:05:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236759AbiGMPFN (ORCPT ); Wed, 13 Jul 2022 11:05:13 -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 EA55141D38 for ; Wed, 13 Jul 2022 08:05:12 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id l68so6683935wml.3 for ; Wed, 13 Jul 2022 08:05:12 -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=jE26kz8uLkTSQmG0BFSrQuTDJo25o/aqMTxY60BA87o=; b=gUbx5q33LywiMvhPgpaKOwbSPMBdwh4DwBxzRhs75JniMIr93Dn1/4Ci9jaQsEfgER PeMyJBJk+WS4Ogyr5bMn4TpjguNtzgtVXfB6Zt37HvLtSwphQt4naefxFhby1dedvW8L 5uIx8qPLZauFeY3yc3dyJ3aAGKv7o1E+SDHcM= 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=jE26kz8uLkTSQmG0BFSrQuTDJo25o/aqMTxY60BA87o=; b=WUkj723jF+5R3wM8U0N2Ls36aHVbtTt/af4jsl2yL8wNrdmaOEtAVi1Ob+h8PmOGHv tF72M3KxAWYDgjWPS1q6nFA13JpsNZqbQlERzZvnxK1U+NjNfNRW/HgK3uTMQ+rsyJvI EwdO51XXA3dfLzySKhQzQvKPue/GSvNzOu4PAqHBr+NRbJDgrwpxb8swMd7lGFR4BMBG Hmy9TlDIl4Pwr17WWMnsO1I5Hak+uda5XSWQP1UDXOKgaYLuQzI59zsO7Wrq8BlAw0zD Y1Qt0+U11QodjJqFJKIePNnz00eYxRjQHPjeumMMDf0XQy/hCF68KRORJETjOXaJhdGK 2zFw== X-Gm-Message-State: AJIora83K21Zma7f0tzXsHMvVELzAgP2NFZc4za6fvJWqYZ7FSoGNozg 2c7H6KzDqSb4ot3LDgZ1eg9B6Q== X-Google-Smtp-Source: AGRyM1uKWukIoMsKGox2XaO6iG6qJ0Oa0WKKnKK2MgGEiClVKXd64DuIW0iEQ4YutRAbRbtODMSzMg== X-Received: by 2002:a05:600c:25ce:b0:3a2:dd48:9b33 with SMTP id 14-20020a05600c25ce00b003a2dd489b33mr4202758wml.134.1657724711316; Wed, 13 Jul 2022 08:05:11 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-51-7.cust.vodafonedsl.it. [188.217.51.7]) by smtp.gmail.com with ESMTPSA id f17-20020a05600c4e9100b003a2d87aea57sm1465537wmq.10.2022.07.13.08.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 08:05:11 -0700 (PDT) From: Tommaso Merciai To: tommaso.merciai@amarulasolutions.com Cc: linuxfancy@googlegroups.com, linux-amarula@amarulasolutions.com, quentin.schulz@theobroma-systems.com, Jacopo Mondi , Daniel Scally , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 1/6] media: ov5693: count num_supplies using array_size Date: Wed, 13 Jul 2022 17:05:01 +0200 Message-Id: <20220713150506.2085214-2-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220713150506.2085214-1-tommaso.merciai@amarulasolutions.com> References: <20220713150506.2085214-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 Reviewed-by: Jacopo Mondi Reviewed-by: Daniel Scally --- Changes since v3: - Add reviewed-by tag, suggested by Jacopo, Krzysztof Changes since v4: - Add Daniel reviewed-by tag 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 Jul 13 15:05:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 12916873 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 3202FC433EF for ; Wed, 13 Jul 2022 15:05:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236799AbiGMPFa (ORCPT ); Wed, 13 Jul 2022 11:05:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236766AbiGMPFQ (ORCPT ); Wed, 13 Jul 2022 11:05:16 -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 4D27241983 for ; Wed, 13 Jul 2022 08:05:14 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id o8so6683740wms.2 for ; Wed, 13 Jul 2022 08:05:14 -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=REFGbYhE8dpEN5VkA7iNJtkkSRmeBAdrouvG3pc5rZ4=; b=AM60TdZ8HZ7OvyRBTLrizQyAPLSegdev4X8ef/09hXQ+9EFvoS7XjwIxhY63YCpNiU 7uSFl6+2V79L8KUeZ+9ysF/Ewo0Zk3Giv9QaI6kIPmPYMAQkv/nU8QmniG0W0guT2K14 hLuMRyufymQJR9pM7CjhmuqPNb209cVatb34s= 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=REFGbYhE8dpEN5VkA7iNJtkkSRmeBAdrouvG3pc5rZ4=; b=eyHe/xJ0asKO+K6lIbFYMrrQ7WEa+tH/6N7V8k4X7sq/h1PTQ17lwSGTWIwtQH+LTc keXgZMBBsOwdU1Oc+OaOMaqo6+61mVfD+wTZZb++NstfMPFBuE9jrEveGbOCyQoyb9xM E42geuZHwlDkSK9zQJCPQmDcgoJKySKH9dz4yNSVS6ZCkUVMn7oIStb6m/QeA1PzyKrC wh/qSIl/M/5H7+Y6dbGaup2JRQxWcO9jqzu3lCB2TAQoVrxV0HqYXE6qPJXoTWAXqS+o 9e2TbzCtyyArUy8SEkIH5WIOIbd9iyUA2GtubC7U4Di91h09ihNuTYR2AY1YPWdCdt+K aKHQ== X-Gm-Message-State: AJIora+LIITUuNeQuoVXMvKtofKpC0YbUAWqMI2gvc1QBEPzxM1gc93O 9C93icAx7VtmyfAQQUJEd3oAMQ== X-Google-Smtp-Source: AGRyM1tHZLl/74d091mxos1zDPmZ1SRQ+WdI5OSIR3EtkxpYjxa0w7cskJrV9t4ghkhHnD0Qyi9QKQ== X-Received: by 2002:a05:600c:4306:b0:3a2:e9e0:3626 with SMTP id p6-20020a05600c430600b003a2e9e03626mr3979142wme.175.1657724712868; Wed, 13 Jul 2022 08:05:12 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-51-7.cust.vodafonedsl.it. [188.217.51.7]) by smtp.gmail.com with ESMTPSA id f17-20020a05600c4e9100b003a2d87aea57sm1465537wmq.10.2022.07.13.08.05.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 08:05:12 -0700 (PDT) From: Tommaso Merciai To: tommaso.merciai@amarulasolutions.com Cc: linuxfancy@googlegroups.com, linux-amarula@amarulasolutions.com, quentin.schulz@theobroma-systems.com, Jacopo Mondi , Daniel Scally , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 2/6] media: ov5693: add dvdd into ov5693_supply_names array Date: Wed, 13 Jul 2022 17:05:02 +0200 Message-Id: <20220713150506.2085214-3-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220713150506.2085214-1-tommaso.merciai@amarulasolutions.com> References: <20220713150506.2085214-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 Reviewed-by: Jacopo Mondi Reviewed-by: Daniel Scally --- Changes since v3: - Add reviewed-by tag, suggested by Jacopo, Krzysztof Changes since v4: - Add Daniel reviewed-by tag 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 Jul 13 15:05:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 12916874 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 5B1DBCCA479 for ; Wed, 13 Jul 2022 15:05:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236777AbiGMPFc (ORCPT ); Wed, 13 Jul 2022 11:05:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236757AbiGMPF1 (ORCPT ); Wed, 13 Jul 2022 11:05:27 -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 1671B422D0 for ; Wed, 13 Jul 2022 08:05:16 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id o4so15928748wrh.3 for ; Wed, 13 Jul 2022 08:05:15 -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=ctpa/T2vVk1WErHGmcuqVVZ1P5/ZM5PQkEWqW8vXr7A=; b=JVDAlTtDsN8PsHafG8dXhWTX7BJMdlCzVqsgtKaV1wrud89XcIpTz+LM58T+E10vtb utb1i/Zjxo+/kx2kX1bsCxtzlzY06n31E6+IZnw6OsBkOIX6tno5D/tOrwOoYfrJJ2Mv tdI4JUpnWU/mZVQSj2Wk7g3pnam43egQr8dpA= 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=ctpa/T2vVk1WErHGmcuqVVZ1P5/ZM5PQkEWqW8vXr7A=; b=TvekwDXmaN9E0wbyTFagLebpAjJuzFCzffpHss/a++FSvNGE2HsjCkKBw8YrFABOM1 Td/WNz1NfXyy+h2QXmLBRQLGu7OzUMpujijUv33HfFbdGfvAFDs3UiQq05VgzlaIz3gH eOrTIb8+W+AySd6oQ5fSVblFEDVOgTlQ9nXOP3Amn72rDyBTMIfj8+khxLEuIlI49z1d UZ9NxIVPTo4ZpuqrZOrhZlSBp+VMn/lz9GmgKNLCe/FRZF9ZehbugcoYk2HgHk8iTzI1 7RobG8T2A0pwoh06eM7kGsKI1N2xQyL+iXLACeTkb+4XNx/jT5goMYNsHL51S4V/xM5j P4jw== X-Gm-Message-State: AJIora/anJ0KIyDOGGtbBZC3ObvdzjfEZdaX1reXAOajqpmtU1oNPqhN U0w0yjorZEhgYRuUMK3SMGzqLg== X-Google-Smtp-Source: AGRyM1tAev8LArHYi+huEh3+yoOvjVzMlK7NXt7yr3pRp5fyd99Ap26DP2Bki+psEKEV9rVlxQgXRA== X-Received: by 2002:a5d:4d0b:0:b0:21d:819e:5765 with SMTP id z11-20020a5d4d0b000000b0021d819e5765mr3648022wrt.232.1657724714580; Wed, 13 Jul 2022 08:05:14 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-51-7.cust.vodafonedsl.it. [188.217.51.7]) by smtp.gmail.com with ESMTPSA id f17-20020a05600c4e9100b003a2d87aea57sm1465537wmq.10.2022.07.13.08.05.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 08:05:14 -0700 (PDT) From: Tommaso Merciai To: tommaso.merciai@amarulasolutions.com Cc: linuxfancy@googlegroups.com, linux-amarula@amarulasolutions.com, quentin.schulz@theobroma-systems.com, Jacopo Mondi , Daniel Scally , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 3/6] media: ov5693: rename clk into xvclk Date: Wed, 13 Jul 2022 17:05:03 +0200 Message-Id: <20220713150506.2085214-4-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220713150506.2085214-1-tommaso.merciai@amarulasolutions.com> References: <20220713150506.2085214-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 Reviewed-by: Jacopo Mondi --- Changes since v3: - Add reviewed-by tag, suggested by Jacopo, Krzysztof 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 Jul 13 15:05:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 12916875 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 ED8D0C433EF for ; Wed, 13 Jul 2022 15:05:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236824AbiGMPFd (ORCPT ); Wed, 13 Jul 2022 11:05:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236754AbiGMPF1 (ORCPT ); Wed, 13 Jul 2022 11:05:27 -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 689FB422C9 for ; Wed, 13 Jul 2022 08:05:17 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id j29-20020a05600c1c1d00b003a2fdafdefbso824309wms.2 for ; Wed, 13 Jul 2022 08:05:17 -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=ROC0BgtK/N+kzsuCvrmnTVmfs20tFROFRODZongU+to=; b=Pi5HkNDEePtwLENMxhS57celmg+tdd/mSPqrqoqtqKqgFR47zmJL43321HVoJsC1wh 2Ud7XZDrDnroE7O/HvJ1dACw+i1hu1/QPVKbng4G4R2fl4M27TBuUik/krIn28kowmyq RxPEwPE1Z2f1MhfozV+mXVDeTPKpjt9zECO7A= 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=ROC0BgtK/N+kzsuCvrmnTVmfs20tFROFRODZongU+to=; b=R6pVgnQRiauB0+c0P+uNT8C6y36ZioW+qch/BYPDreTzKIL4n78kvL4bg2aDYplGLd L34a91MeUtqMvOgyLpN3Vv2eG0og3VB+E6sY1X0aY11z6o69OYd4APq/bSKwPddOi1aS 6bp/kMH/MSnsxTfIHBjOu4PXxXOmvFcZo7QejD5SuHFMtd3E0TkNVnlw0C+QLrXJcWl/ FRPvBXEjuISNt+On8LT0lwHQbYM5V25adDPNk+fNXrFnLBPMPHK4sixIjmay6JnXqdzi rM8kgteksqdufsVV+cWoNMPR32FLNA8PC2gycmBZAmH/vXt1L2Qog8w6Tq+rTKGPQPcY SoHQ== X-Gm-Message-State: AJIora8IQOZ63CmK4QfY2yxVbKW1oS2H9mHudTgc3eWDNidP3wzFJL3H w8Nag+1/h8nAQbpqM+CmiOntXA== X-Google-Smtp-Source: AGRyM1uDpBa2YqrIh4DfrwnpIykVgeyNgM9u34R9X0eMAUH4W9M6X2Y9ZFxHZ4e6GiheLd84Xvyhaw== X-Received: by 2002:a05:600c:a187:b0:3a2:eb3e:f1d4 with SMTP id id7-20020a05600ca18700b003a2eb3ef1d4mr10115330wmb.174.1657724715931; Wed, 13 Jul 2022 08:05:15 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-51-7.cust.vodafonedsl.it. [188.217.51.7]) by smtp.gmail.com with ESMTPSA id f17-20020a05600c4e9100b003a2d87aea57sm1465537wmq.10.2022.07.13.08.05.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 08:05:15 -0700 (PDT) From: Tommaso Merciai To: tommaso.merciai@amarulasolutions.com Cc: linuxfancy@googlegroups.com, linux-amarula@amarulasolutions.com, quentin.schulz@theobroma-systems.com, Jacopo Mondi , Daniel Scally , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 4/6] media: ov5693: add support for acpi clock-frequency prop Date: Wed, 13 Jul 2022 17:05:04 +0200 Message-Id: <20220713150506.2085214-5-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220713150506.2085214-1-tommaso.merciai@amarulasolutions.com> References: <20220713150506.2085214-1-tommaso.merciai@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add support for ACPI-based platforms that specify the clock frequency by using the "clock-frequency" property instead of specifying a clock provider reference Signed-off-by: Tommaso Merciai Reviewed-by: Jacopo Mondi --- Changes since v2: - Fix commit body as suggested by Sakari, Jacopo - Add details to commit body as suggested by Jacopo - Move ov5693_check_hwcfg into ov5693_hwcfg - Fix xvclk_rate position as suggested by Jacopo - Use devm_clk_get_optional instead of devm_clk_get as suggested Jacopo Changes since v3: - Fix commit body as suggested by Jacopo - Add reviewed-by tags, suggested by Jacopo, Krzysztof Changes since v4: - Remove wrong Sakari reviewed-by tag, suggested by Krzysztof, Sakari - Revert ov5693_check_hwcfg function changes. Keep clk init on probe function as suggested by Sakari - Fix commit body - Fix commit msg drivers/media/i2c/ov5693.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/ov5693.c b/drivers/media/i2c/ov5693.c index d2adc5513a21..701468267f20 100644 --- a/drivers/media/i2c/ov5693.c +++ b/drivers/media/i2c/ov5693.c @@ -1408,13 +1408,25 @@ static int ov5693_probe(struct i2c_client *client) v4l2_i2c_subdev_init(&ov5693->sd, client, &ov5693_ops); - ov5693->xvclk = devm_clk_get(&client->dev, "xvclk"); - if (IS_ERR(ov5693->xvclk)) { - dev_err(&client->dev, "Error getting clock\n"); - return PTR_ERR(ov5693->xvclk); + ov5693->xvclk = devm_clk_get_optional(&client->dev, "xvclk"); + if (IS_ERR(ov5693->xvclk)) + return dev_err_probe(&client->dev, PTR_ERR(ov5693->xvclk), + "failed to get xvclk: %ld\n", + PTR_ERR(ov5693->xvclk)); + + if (ov5693->xvclk) { + xvclk_rate = clk_get_rate(ov5693->xvclk); + } else { + ret = fwnode_property_read_u32(dev_fwnode(&client->dev), + "clock-frequency", + &xvclk_rate); + + if (ret) { + dev_err(&client->dev, "can't get clock frequency"); + return ret; + } } - xvclk_rate = clk_get_rate(ov5693->xvclk); if (xvclk_rate != OV5693_XVCLK_FREQ) dev_warn(&client->dev, "Found clk freq %u, expected %u\n", xvclk_rate, OV5693_XVCLK_FREQ); From patchwork Wed Jul 13 15:05:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 12916876 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 10A70C43334 for ; Wed, 13 Jul 2022 15:05:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236830AbiGMPFf (ORCPT ); Wed, 13 Jul 2022 11:05:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236783AbiGMPF2 (ORCPT ); Wed, 13 Jul 2022 11:05:28 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A597422EA for ; Wed, 13 Jul 2022 08:05:20 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id be14-20020a05600c1e8e00b003a04a458c54so1367339wmb.3 for ; Wed, 13 Jul 2022 08:05:20 -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=SFLYTnxGltOS1OadQL4iHNlIKerC7uXMw8HZbX2h5Bw=; b=pWJ2mDStBxvqxqXEyUi5/wzW/gakcUiJFUflrpQlBba7NBb0yWb2gWSnqUtp+ydGEU lB04w2koWZ60Yk8CW6v3QYjPG8phb1dnMYAmCYKbZEeJaU1mKQH6T9p83F/TgRhO0mIf YeczGts5Bz8QQS1mUT3srd6mT2h+fDzbYFvN4= 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=SFLYTnxGltOS1OadQL4iHNlIKerC7uXMw8HZbX2h5Bw=; b=dthCehql3SW/kxd439/WJSD77DKSX6Yqyk9AnKFOyrFnZK4wq0UYRF+7pkevE4Bhe/ Nxh2DuKiCW4LfOnRCMhvECnHRxG9dq+4J/DLQ1Xs0z/R1NipfSNGP/0VfuVu8KLUEOHa vO9AgnCBCLiCmhVeqs3ZP3whVGLqVo7kY713Dimfqt3WkstdHLMz4+OfoNhC9Urosb/n 1vi4Q28BRQevdG7ygiw6LQ1JhEIO3GAAqrPGhAlv4HTDwwBMkwKt1MvFIZqvgr/UaUhN PrtPrxJs+zREQx+2CUR8Q+QwYD1XXOluQw3MzA79Nk44Ff8yt3xFzYZ6XMnseBWy6PTB mMlg== X-Gm-Message-State: AJIora+A0hKYfxQWNRzvin8IIeHfgZ1TTB8tDti8dfPyCOx60TBVKC1H dP2WGX0fZdSA23UV/Zf5cj9N5A== X-Google-Smtp-Source: AGRyM1vKDLV5XMD/EiFbzgEkFckN+SUKqhPWdZjReQCFv4hhO6CPOuc3kfklirPAo3JWhXvjEuI3KQ== X-Received: by 2002:a1c:a1c7:0:b0:3a2:f171:8d68 with SMTP id k190-20020a1ca1c7000000b003a2f1718d68mr4139777wme.111.1657724718777; Wed, 13 Jul 2022 08:05:18 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-51-7.cust.vodafonedsl.it. [188.217.51.7]) by smtp.gmail.com with ESMTPSA id f17-20020a05600c4e9100b003a2d87aea57sm1465537wmq.10.2022.07.13.08.05.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 08:05:18 -0700 (PDT) From: Tommaso Merciai To: tommaso.merciai@amarulasolutions.com Cc: linuxfancy@googlegroups.com, linux-amarula@amarulasolutions.com, quentin.schulz@theobroma-systems.com, Krzysztof Kozlowski , 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 v7 5/6] media: dt-bindings: ov5693: document YAML binding Date: Wed, 13 Jul 2022 17:05:05 +0200 Message-Id: <20220713150506.2085214-6-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220713150506.2085214-1-tommaso.merciai@amarulasolutions.com> References: <20220713150506.2085214-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 Changes since v3: - Add reviewed-by tags, suggested by Jacopo, Krzysztof Changes since v4: - Remove wrong Sakari reviewed-by tag, suggested by Krzysztof, Sakari Changes since v5: - Remove dovdd-supply, avdd-supply, dvdd-supply from required properties as suggested by Jacopo Changes since v6: - Add missing port node as suggested by Sakari, Rob bot .../bindings/media/i2c/ovti,ov5693.yaml | 124 ++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 125 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..359dc08440a8 --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/ovti,ov5693.yaml @@ -0,0 +1,124 @@ +# 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 + + port: + description: MIPI CSI-2 transmitter port + $ref: /schemas/graph.yaml#/$defs/port-base + additionalProperties: false + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + properties: + link-frequencies: true + + data-lanes: + minItems: 1 + maxItems: 2 + + required: + - data-lanes + - link-frequencies + +required: + - compatible + - reg + - clocks + - 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 f679152bdbad..61c2d28aff4f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14838,6 +14838,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 Jul 13 15:05:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 12916877 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 31213C433EF for ; Wed, 13 Jul 2022 15:05:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236783AbiGMPFh (ORCPT ); Wed, 13 Jul 2022 11:05:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236762AbiGMPF2 (ORCPT ); Wed, 13 Jul 2022 11:05:28 -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 C636C422F9 for ; Wed, 13 Jul 2022 08:05:20 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id v16so15880943wrd.13 for ; Wed, 13 Jul 2022 08:05:20 -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=89nMQY6HYa205yz8a9PXVreqJnhbEp/5UjZ/0K+ojBk=; b=XuaI59GVVdLaY9nGGjKfAeviXgy/ApZnblUPAMvzh46fG/tmr3xTD1thS/DDCwEtuc GBpP29/u6JHMFSWSwwseqH5VrHazePwy0/LKvr+Kp3lDKiruCavOroFiysLzV3SYaneP fsu75ziErn8Qtva15PVP6DadY4A132NVDqQS8= 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=89nMQY6HYa205yz8a9PXVreqJnhbEp/5UjZ/0K+ojBk=; b=0r+tHdmggyRZ3HVOxeX5qAbO1Yo/OmKisZWUxYqReCVJvUkIxRL4J9GAwv36NcJ4Jf 9uuiULaDKiRXX80LxTpukXVM/dZMZ3/KJ8J7B8Sfo2I8RPnkhxnKDVAvs+ArXK+lTRqM F0bpbBA2h7902folyQmLE+n4avfRqn2MKwM75qqAnOsllQeOLZ+phUUQEETz9tn49KKV MXnFUlMeMxTLDog3EO1Y5XWy1wG2GQyaIx8MCxgskQLtSrh1YAWvrepYM9mVbiZF7Djr eRKWYCBm/rA7K6Sm8B/UiHOKkXJkM/fdOiYIQ0ETmHv7Ws6XGqty8Ii9dvQ3mnQF2/9j rbqw== X-Gm-Message-State: AJIora9PnqkvnuoHJuSM+Uzx7Bv3yccgl0obxmq+zpSxjAykxbn9d2VC uEIbejSYx5gvB6Y8Fh7N/jabFg== X-Google-Smtp-Source: AGRyM1t3t3ov77Q3+O1KqqHLoZA8HZXwyZ27oOlPTEg5Ae5GY3X5ipE2PQP8rWM0aKzLnNmLKd588g== X-Received: by 2002:a5d:5143:0:b0:21d:61b6:5225 with SMTP id u3-20020a5d5143000000b0021d61b65225mr3649852wrt.164.1657724720297; Wed, 13 Jul 2022 08:05:20 -0700 (PDT) Received: from tom-ThinkPad-T14s-Gen-2i.station (net-188-217-51-7.cust.vodafonedsl.it. [188.217.51.7]) by smtp.gmail.com with ESMTPSA id f17-20020a05600c4e9100b003a2d87aea57sm1465537wmq.10.2022.07.13.08.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 08:05:20 -0700 (PDT) From: Tommaso Merciai To: tommaso.merciai@amarulasolutions.com Cc: linuxfancy@googlegroups.com, linux-amarula@amarulasolutions.com, quentin.schulz@theobroma-systems.com, Jacopo Mondi , Daniel Scally , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 6/6] media: ov5693: add ov5693_of_match, dts support Date: Wed, 13 Jul 2022 17:05:06 +0200 Message-Id: <20220713150506.2085214-7-tommaso.merciai@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220713150506.2085214-1-tommaso.merciai@amarulasolutions.com> References: <20220713150506.2085214-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 Reviewed-by: Jacopo Mondi Reviewed-by: Daniel Scally --- Changes since v2: - Change patch order 7 -> 6 as suggested by Sakari - Add missing signed-off as suggested by Jacopo Changes since v3: - Add reviewed-by tags, suggested by Jacopo, Krzysztof Changes since v4: - Remove wrong Sakari reviewed-by tag, suggested by Krzysztof, Sakari - Add Daniel reviewed-by tag 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 701468267f20..82a9b2de7735 100644 --- a/drivers/media/i2c/ov5693.c +++ b/drivers/media/i2c/ov5693.c @@ -1533,10 +1533,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,