Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2251510ybh; Fri, 24 Jul 2020 08:08:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyrFClkR6D+pb10tFMRQC+3rYJAZPSCnmHf9Cs+CO/qL1YXk5Cq5ermAmbwa6Fuw1fjctr X-Received: by 2002:a50:bf07:: with SMTP id f7mr888658edk.356.1595603339562; Fri, 24 Jul 2020 08:08:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595603339; cv=none; d=google.com; s=arc-20160816; b=Ht6wpfH0QCzd9o29La1Bc1n2UNemCiTa9DFoO+T6r7HPxvecEOA9Urob16v3gYw01Z gRnO77XUaBo1Up4wMQEchLnCtUJVTPqDpQQZ9LU6KOhSrx+HLwih28ctFuRWy0dvNybH ji7kMolpWKd6GDu/Stxw1vIuWCfw8cj2GPvq9u5h/l4oDdPCXeqkFwHAC6PRWScQWmLM MRtE9mB8EHtcNu4NhHjmuZzPd2f8O2T/9bMoJfIWwoSVTLnxhhoW6SM4LXCSsbxVpwU+ aKOUAIOymwODoepyibhiIaA4WgJZ+tyu+3pU/J8RmGOsvZW5xCZJGtBkuM6wEOgHJa4C 1fLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=2cmZVZsT6g2xZHvAGRqe9ZJlxqvenUEK+MBoLTk0vrw=; b=0O63vP4+DzNAdF6atpElR7ARQ2a0g9fBzKJDPWsgs0tfjBeL1KmZbZBa+Y5e6BNCQ0 +iNznA016tNszvo8zD9UbYGcCOlPVEdhe6yZnIhByUS2aEQLr7lE5VmO13ziq8JSCBJN E/DVM8HOOUXVHGb+o8pIlbIj6SG6cNRYrJnm6FFKWT/urNUGiarT1k4RB2BhvRMV0/LE Uez0ACP2Rppr4EZRsukyDBj9I9lnxjczD7FwYB7hZDwUlD0UN+XciCD2l3hHAI3LCAdm V1oqPpZh10c1PIrYUqclRvTKxoMlK1IacJtmgfQTGW8YnYVzBB/E23OsgOwazqAgVzge qc2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e19si650611edr.218.2020.07.24.08.08.36; Fri, 24 Jul 2020 08:08:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726899AbgGXPIZ (ORCPT + 99 others); Fri, 24 Jul 2020 11:08:25 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:42486 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726366AbgGXPIY (ORCPT ); Fri, 24 Jul 2020 11:08:24 -0400 X-IronPort-AV: E=Sophos;i="5.75,391,1589209200"; d="scan'208";a="52963390" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 25 Jul 2020 00:08:23 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id A16C54005E3C; Sat, 25 Jul 2020 00:08:21 +0900 (JST) From: Lad Prabhakar To: Jacopo Mondi , Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, Kieran Bingham Cc: linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Biju Das , Prabhakar , Lad Prabhakar Subject: [PATCH 1/2] media: i2c: ov772x: Add support for BT656 mode Date: Fri, 24 Jul 2020 16:08:15 +0100 Message-Id: <1595603296-25903-2-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595603296-25903-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <1595603296-25903-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support to read the bus-type and enable BT656 mode if needed. Signed-off-by: Lad Prabhakar Reviewed-by: Biju Das --- drivers/media/i2c/ov772x.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c index 2cc6a67..3b7dfba 100644 --- a/drivers/media/i2c/ov772x.c +++ b/drivers/media/i2c/ov772x.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -434,6 +435,7 @@ struct ov772x_priv { #ifdef CONFIG_MEDIA_CONTROLLER struct media_pad pad; #endif + struct v4l2_fwnode_endpoint ep; }; /* @@ -585,7 +587,6 @@ static int ov772x_s_stream(struct v4l2_subdev *sd, int enable) enable ? 0 : SOFT_SLEEP_MODE); if (ret) goto done; - if (enable) { dev_dbg(&client->dev, "format %d, win %s\n", priv->cfmt->code, priv->win->name); @@ -1104,7 +1105,10 @@ static int ov772x_set_params(struct ov772x_priv *priv, goto ov772x_set_fmt_error; /* COM7: Sensor resolution and output format control. */ - ret = regmap_write(priv->regmap, COM7, win->com7_bit | cfmt->com7); + val = win->com7_bit | cfmt->com7; + if (priv->ep.bus_type == V4L2_MBUS_BT656) + val |= ITU656_ON_OFF; + ret = regmap_write(priv->regmap, COM7, val); if (ret < 0) goto ov772x_set_fmt_error; @@ -1354,6 +1358,7 @@ static const struct v4l2_subdev_ops ov772x_subdev_ops = { static int ov772x_probe(struct i2c_client *client) { + struct fwnode_handle *endpoint; struct ov772x_priv *priv; int ret; static const struct regmap_config ov772x_regmap_config = { @@ -1415,6 +1420,20 @@ static int ov772x_probe(struct i2c_client *client) goto error_clk_put; } + endpoint = fwnode_graph_get_next_endpoint(dev_fwnode(&client->dev), + NULL); + if (!endpoint) { + dev_err(&client->dev, "endpoint node not found\n"); + goto error_clk_put; + } + + ret = v4l2_fwnode_endpoint_parse(endpoint, &priv->ep); + fwnode_handle_put(endpoint); + if (ret) { + dev_err(&client->dev, "Could not parse endpoint\n"); + goto error_clk_put; + } + ret = ov772x_video_probe(priv); if (ret < 0) goto error_gpio_put; -- 2.7.4