Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1209042pxk; Fri, 4 Sep 2020 03:46:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzv09tudb157DIkxXqz05DqmMbntGNx21WNFeC5kDvcPC3TrbQ3bQ5ykKYjPy8wzY6KWnVK X-Received: by 2002:a17:906:38c7:: with SMTP id r7mr6967419ejd.118.1599216365615; Fri, 04 Sep 2020 03:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599216365; cv=none; d=google.com; s=arc-20160816; b=T0vCiza/0jMax3sH+vqi+rJcVQCK8cSsZBSOrQoLet9I0UAvzq6DZ7MgMVsv67aW9/ ksrOv9/lhhbPG2vvukDo0WosCcULSEwPYb2ogKyaW2tBYJm/nu2PIEgibBElUtE5NV9v m2z2ydgt4rEyqfoIiPMzd/nMeS5zV9Vv13uLHs8YrCSalRbG+hhwfBzIjOPO4e3H60WU Y3i0C5bTFRKsR+KRUxMRk6+ssfZGZ3wXXFD7DPtD+6ghWl0CQ8UIXZ6SDOT8L5dhLUsG PCy8zOs69ookAkujd8KQMlaEVW0oM6b01uVuGo+2qJ/f7MC2Jl9XlhgxFYrjbS81l4g4 DB2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=e8nPxKy+m5RlFPC283HPw7n2T10zVXckorkt7lIqy6k=; b=mwLGLSXkD6fjtZZlv8H9uQa0bTo7TXQ1kbjoYRPYffllSOu9wSgP/w+GH5YG7u/q/T gDcQxSH8nyLNZottvXQXLuLeiAmJicNrKVYPNI2jsB4h0wkJ4Sn7Fq3LiGv3owdx09tP PVbImLOaJuix3VzemlrdIUXOVioNFKB1IspuhXDLB2caVIwfbm4VTDQURNBD+olWg4Fe 0nNJ0F7eglkZDu8ocM3uNDVXIeIirFDovtegqEgCEcSKukV69GIPqiAZN8boujCakZC9 1i3NCTVKTb4v1wtTT35OAv+z78jSZ04modtnGi7yzm3eokAAiF7sLMClafVh5i9X93h5 FAhg== 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 p10si695301edh.108.2020.09.04.03.45.42; Fri, 04 Sep 2020 03:46:05 -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 S1730095AbgIDKpJ (ORCPT + 99 others); Fri, 4 Sep 2020 06:45:09 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:56589 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726171AbgIDKpE (ORCPT ); Fri, 4 Sep 2020 06:45:04 -0400 X-Originating-IP: 93.34.118.233 Received: from uno.localdomain (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 636DA1C000C; Fri, 4 Sep 2020 10:44:55 +0000 (UTC) Date: Fri, 4 Sep 2020 12:48:42 +0200 From: Jacopo Mondi To: Lad Prabhakar Cc: Steve Longerbeam , Jacopo Mondi , Sakari Ailus , Laurent Pinchart , Paul , Hugues Fruchet , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar Subject: Re: [PATCH v3 2/3] media: i2c: ov5640: Add support for BT656 mode Message-ID: <20200904104842.hz6n6egjyqgarvlb@uno.localdomain> References: <20200813171337.5540-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20200813171337.5540-3-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200813171337.5540-3-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 Hi Prabhakar On Thu, Aug 13, 2020 at 06:13:36PM +0100, Lad Prabhakar wrote: > Enable support for BT656 mode. > > Signed-off-by: Lad Prabhakar > Reviewed-by: Biju Das Looks good to me Reviewed-by: Jacopo Mondi Thanks j > --- > drivers/media/i2c/ov5640.c | 46 ++++++++++++++++++++++++++++---------- > 1 file changed, 34 insertions(+), 12 deletions(-) > > diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c > index e36bc08bc17f..160d2857352a 100644 > --- a/drivers/media/i2c/ov5640.c > +++ b/drivers/media/i2c/ov5640.c > @@ -84,6 +84,7 @@ > #define OV5640_REG_VFIFO_HSIZE 0x4602 > #define OV5640_REG_VFIFO_VSIZE 0x4604 > #define OV5640_REG_JPG_MODE_SELECT 0x4713 > +#define OV5640_REG_CCIR656_CTRL00 0x4730 > #define OV5640_REG_POLARITY_CTRL00 0x4740 > #define OV5640_REG_MIPI_CTRL00 0x4800 > #define OV5640_REG_DEBUG_MODE 0x4814 > @@ -1215,6 +1216,20 @@ static int ov5640_set_autogain(struct ov5640_dev *sensor, bool on) > BIT(1), on ? 0 : BIT(1)); > } > > +static int ov5640_set_stream_bt656(struct ov5640_dev *sensor, bool on) > +{ > + int ret; > + > + ret = ov5640_write_reg(sensor, OV5640_REG_CCIR656_CTRL00, > + on ? 0x1 : 0x00); > + if (ret) > + return ret; > + > + return ov5640_write_reg(sensor, OV5640_REG_SYS_CTRL0, on ? > + OV5640_REG_SYS_CTRL0_SW_PWUP : > + OV5640_REG_SYS_CTRL0_SW_PWDN); > +} > + > static int ov5640_set_stream_dvp(struct ov5640_dev *sensor, bool on) > { > return ov5640_write_reg(sensor, OV5640_REG_SYS_CTRL0, on ? > @@ -2022,18 +2037,21 @@ static int ov5640_set_power_dvp(struct ov5640_dev *sensor, bool on) > * datasheet and hardware, 0 is active high > * and 1 is active low...) > */ > - if (flags & V4L2_MBUS_PCLK_SAMPLE_RISING) > - pclk_pol = 1; > - if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH) > - hsync_pol = 1; > - if (flags & V4L2_MBUS_VSYNC_ACTIVE_LOW) > - vsync_pol = 1; > + if (sensor->ep.bus_type == V4L2_MBUS_PARALLEL) { > + if (flags & V4L2_MBUS_PCLK_SAMPLE_RISING) > + pclk_pol = 1; > + if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH) > + hsync_pol = 1; > + if (flags & V4L2_MBUS_VSYNC_ACTIVE_LOW) > + vsync_pol = 1; > + > + ret = ov5640_write_reg(sensor, OV5640_REG_POLARITY_CTRL00, > + (pclk_pol << 5) | (hsync_pol << 1) | > + vsync_pol); > > - ret = ov5640_write_reg(sensor, OV5640_REG_POLARITY_CTRL00, > - (pclk_pol << 5) | (hsync_pol << 1) | vsync_pol); > - > - if (ret) > - return ret; > + if (ret) > + return ret; > + } > > /* > * powerdown MIPI TX/RX PHY & disable MIPI > @@ -2057,7 +2075,9 @@ static int ov5640_set_power_dvp(struct ov5640_dev *sensor, bool on) > * - 4: PCLK output enable > * - [3:0]: D[9:6] output enable > */ > - ret = ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT_ENABLE01, 0x7f); > + ret = ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT_ENABLE01, > + sensor->ep.bus_type == V4L2_MBUS_PARALLEL ? > + 0x7f : 0x1f); > if (ret) > return ret; > > @@ -2911,6 +2931,8 @@ static int ov5640_s_stream(struct v4l2_subdev *sd, int enable) > > if (sensor->ep.bus_type == V4L2_MBUS_CSI2_DPHY) > ret = ov5640_set_stream_mipi(sensor, enable); > + else if (sensor->ep.bus_type == V4L2_MBUS_BT656) > + ret = ov5640_set_stream_bt656(sensor, enable); > else > ret = ov5640_set_stream_dvp(sensor, enable); > > -- > 2.17.1 >