Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4972875pxu; Tue, 13 Oct 2020 11:25:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKBsCBm0id5WLdX4oZX0PpFF3NvOu4SxR9iSG0j7fQVsnRUm84rmhFXY/qkjX8jTpBA7mQ X-Received: by 2002:a17:906:b1c9:: with SMTP id bv9mr1058480ejb.495.1602613516169; Tue, 13 Oct 2020 11:25:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602613516; cv=none; d=google.com; s=arc-20160816; b=B+uRqe+UNuTiOlV1N3aPEDcR+6QCsnC2s8YAVmybIyIFUGArY0o4ijQTiBBTerPZGb E3Iv1xVFKOEncLfE8XJD+vztNg40oDwfYusr0MwPOIkb6KYoj+IajLG5pUEEG9hXbrFV /9rYj+dVGsSaLHfIlWv8L3CL+fM9nmUnU5ef0pQiTzpitW5djYjIWDJHIpxvbfrjA23h O6QQpitHxNNBa4Flr39/jm/kQmuk7ddS6+pSk6ZmNVvO9TjwSqgjBuiiTHezhHlv26c7 yZZBaKjnCiS+w2gPA4Qa/+DL7upoTDICsvOtXr20X9P0P9Z5lETDUMPmxgrNydUZG1D+ siMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=kB7+OoCtGJRRoFjBpsnNXS7YxLxFbwrR6h9xYYLB7HY=; b=pOiR5C0VWTRjnqoiuPsOA77ljnDf2dDo/aJDd1y+lRVL4WLbwQy2lYJjOwH3uHf2HI luIozfg0FIjQ+jXmVBdDgVT/+gNYTnY3ynjfXsDmW36zGKZVbJI/rTvJLR3hANdUsk6c rQisLebNz8JTFcrCSpRedR/sa7ZDH0dPqcpCm59JWJG+a+QUk+1Zt79EFr8UPwA7+dgq S3yrvOS/T0PryzYDq53RegWzaCf+YCgLTKbSBRoGs3PmAo61t0dvlyzQh7hyariZxwaQ i3RqAlrVywYl+2OXtKJup1z8QLcwURmwafoD3ddNQnAMRa6eTuNa44iNqA+mMfv5iKr9 Ak1Q== 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 k15si351614eds.533.2020.10.13.11.24.53; Tue, 13 Oct 2020 11:25:16 -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 S2404222AbgJMJIU (ORCPT + 99 others); Tue, 13 Oct 2020 05:08:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404121AbgJMJIP (ORCPT ); Tue, 13 Oct 2020 05:08:15 -0400 Received: from hillosipuli.retiisi.eu (hillosipuli.retiisi.eu [IPv6:2a01:4f9:c010:4572::81:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D46F3C0613D0; Tue, 13 Oct 2020 02:08:14 -0700 (PDT) Received: from valkosipuli.localdomain (valkosipuli.retiisi.org.uk [IPv6:2a01:4f9:c010:4572::80:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hillosipuli.retiisi.eu (Postfix) with ESMTPS id 8F33C634C87; Tue, 13 Oct 2020 12:07:05 +0300 (EEST) Received: from sailus by valkosipuli.localdomain with local (Exim 4.92) (envelope-from ) id 1kSGGv-0002fj-Dc; Tue, 13 Oct 2020 12:07:05 +0300 Date: Tue, 13 Oct 2020 12:07:05 +0300 From: Sakari Ailus To: Hugues Fruchet Cc: Alexandre Torgue , Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Alain Volmat , Yannick Fertre , Philippe CORNU Subject: Re: [PATCH] media: stm32-dcmi: add support of BT656 bus Message-ID: <20201013090704.GL6413@valkosipuli.retiisi.org.uk> References: <1602087290-18020-1-git-send-email-hugues.fruchet@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1602087290-18020-1-git-send-email-hugues.fruchet@st.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Hugues, On Wed, Oct 07, 2020 at 06:14:50PM +0200, Hugues Fruchet wrote: > Add support of BT656 embedded synchronization bus. > This mode allows to save hardware synchro lines hsync & vsync > by replacing them with synchro codes embedded in data stream. > This bus type is only compatible with 8 bits width data bus. > Due to reserved values 0x00 & 0xff used for synchro codes, > valid data only vary from 0x1 to 0xfe, this is up to sensor > to clip accordingly pixel data. As a consequence of this > clipping, JPEG is not supported when using this bus type. > DCMI crop feature is also not available with this bus type. You can have more than 62 characters per line. In fact, 75 is the recommended maximum. You should also amend the bindings to cover BT.656 mode. Also bus-type should probably be made mandatory, too. > > Signed-off-by: Hugues Fruchet > --- > drivers/media/platform/stm32/stm32-dcmi.c | 37 +++++++++++++++++++++++++++++-- > 1 file changed, 35 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c > index fd1c41c..d7d7cdb 100644 > --- a/drivers/media/platform/stm32/stm32-dcmi.c > +++ b/drivers/media/platform/stm32/stm32-dcmi.c > @@ -157,6 +157,7 @@ struct stm32_dcmi { > struct vb2_queue queue; > > struct v4l2_fwnode_bus_parallel bus; > + enum v4l2_mbus_type bus_type; > struct completion complete; > struct clk *mclk; > enum state state; > @@ -777,6 +778,23 @@ static int dcmi_start_streaming(struct vb2_queue *vq, unsigned int count) > if (dcmi->bus.flags & V4L2_MBUS_PCLK_SAMPLE_RISING) > val |= CR_PCKPOL; > > + /* > + * BT656 embedded synchronisation bus mode. > + * > + * Default SAV/EAV mode is supported here with default codes > + * SAV=0xff000080 & EAV=0xff00009d. > + * With DCMI this means LSC=SAV=0x80 & LEC=EAV=0x9d. > + */ > + if (dcmi->bus_type == V4L2_MBUS_BT656) { > + val |= CR_ESS; > + > + /* Unmask all codes */ > + reg_write(dcmi->regs, DCMI_ESUR, 0xffffffff);/* FEC:LEC:LSC:FSC */ > + > + /* Trig on LSC=0x80 & LEC=0x9d codes, ignore FSC and FEC */ > + reg_write(dcmi->regs, DCMI_ESCR, 0xff9d80ff);/* FEC:LEC:LSC:FSC */ > + } > + > reg_write(dcmi->regs, DCMI_CR, val); > > /* Set crop */ > @@ -1067,8 +1085,9 @@ static int dcmi_set_fmt(struct stm32_dcmi *dcmi, struct v4l2_format *f) > if (ret) > return ret; > > - /* Disable crop if JPEG is requested */ > - if (pix->pixelformat == V4L2_PIX_FMT_JPEG) > + /* Disable crop if JPEG is requested or BT656 bus is selected */ > + if (pix->pixelformat == V4L2_PIX_FMT_JPEG && > + dcmi->bus_type != V4L2_MBUS_BT656) > dcmi->do_crop = false; > > /* pix to mbus format */ > @@ -1592,6 +1611,11 @@ static int dcmi_formats_init(struct stm32_dcmi *dcmi) > if (dcmi_formats[i].mbus_code != mbus_code.code) > continue; > > + /* Exclude JPEG if BT656 bus is selected */ > + if (dcmi_formats[i].fourcc == V4L2_PIX_FMT_JPEG && > + dcmi->bus_type == V4L2_MBUS_BT656) > + continue; > + > /* Code supported, have we got this fourcc yet? */ > for (j = 0; j < num_fmts; j++) > if (sd_fmts[j]->fourcc == > @@ -1873,9 +1897,18 @@ static int dcmi_probe(struct platform_device *pdev) > dev_err(&pdev->dev, "CSI bus not supported\n"); > return -ENODEV; > } > + > + if (ep.bus_type == V4L2_MBUS_BT656 && > + ep.bus.parallel.bus_width != 8) { > + dev_err(&pdev->dev, "BT656 bus conflicts with %d bits bus width (8 bits required)\n", > + ep.bus.parallel.bus_width); bus_width is unsigned here. > + return -ENODEV; > + } > + > dcmi->bus.flags = ep.bus.parallel.flags; > dcmi->bus.bus_width = ep.bus.parallel.bus_width; > dcmi->bus.data_shift = ep.bus.parallel.data_shift; > + dcmi->bus_type = ep.bus_type; > > irq = platform_get_irq(pdev, 0); > if (irq <= 0) -- Regards, Sakari Ailus