Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp188439pxa; Tue, 4 Aug 2020 03:06:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypHDdTgacALwmGE8Av9vt0U2O8DnJ6Rb7657bPENeQcQwUiX+fIAYtlP0erEHf0NksWrWc X-Received: by 2002:a17:906:dbd8:: with SMTP id yc24mr7249916ejb.176.1596535560126; Tue, 04 Aug 2020 03:06:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596535560; cv=none; d=google.com; s=arc-20160816; b=ljqGq1kLkTAw43jruVnVm4FCNoi6DLXPPaKgYzBtZC6UIsRGyuz89ounQ8CCJ9jJRd 6auxzVN9YL6dnjicZ6pS7+Xq/r+Z/RJj/DoQIwZxgAcPHe0XDjyJj9d0RFXHgJTDDYqY x8MKOW2Usy3niUi63FPhnsn29PLUIAPRYE78OJ3Y0XR0ByDis5HfSJyjARYUGbiVXLup X+ADCbe0moL5zy0RvcoJWRDl5FP6JuFnugSjrhfvtwVCli0qYlG6jUkrubuB2C/KqFfx EEC0PEBHvMEUTIPVTzBS3PTe80PmZBUszqHsf12kMoEdRA2V+jufUlF7HWeQLTZzOSO7 YEGg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=9w/UIoNnaZ8iYtq5xCA3U8n+b2iHLpWpJE3T0gsn2Xs=; b=Uf7SyQE2wiW+tUL77iV9tZxriJbdbSNzW3UHQcwnh4V1N+1mdYwkkjgcKR2MHOchpU MMv3FjR/UDRsMzS7ab5X+o03fmt3cWdbWDBcJmyG/27UkoTLfzXLmVTVP1N2WjijfqDA maF99ZWouIQ/p0nSpDhFo0BhrLPCp/71lArcyIZxgn6TCzucFFZJg6/4Cf4DgbShRL3L /tK5yt6fINrzwbXo8ovgRC6guxLUYyzDriFDD0+a4DY/s+Cjg7ky8ioQaRsY/lNNFy24 VaBP4WXAGHWBiepNtu3YVmS8HN37q0iSVrHRsDfHUtjb87DBYSyDS2jMIzRKxKPdB042 7E9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ragnatech-se.20150623.gappssmtp.com header.s=20150623 header.b=wT3Lb1yB; 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 q6si12257724eja.511.2020.08.04.03.05.37; Tue, 04 Aug 2020 03:06:00 -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; dkim=pass header.i=@ragnatech-se.20150623.gappssmtp.com header.s=20150623 header.b=wT3Lb1yB; 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 S1728745AbgHDKFW (ORCPT + 99 others); Tue, 4 Aug 2020 06:05:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729649AbgHDKFQ (ORCPT ); Tue, 4 Aug 2020 06:05:16 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72AC6C061757 for ; Tue, 4 Aug 2020 03:05:15 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id v12so12575058ljc.10 for ; Tue, 04 Aug 2020 03:05:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech-se.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=9w/UIoNnaZ8iYtq5xCA3U8n+b2iHLpWpJE3T0gsn2Xs=; b=wT3Lb1yB8zokeznVPjG8nrxLWmGhzD0EWw0taPROWRHzQK0tjLxnl6FjbEwA20frra +isY4BojCn0Q08L0F2wrXq1BLxZu+/bLXU4wgHU9I21VRO+VvffObtMXT1hsEKn4IW6N V5jzhMfUo+MY84CqyYriOMDaMuje2YcqjsYz5/YkpCCv82G3S9jZIX5EiMBfdI3wQLHZ hETxf5HTHk+eYvh5WqK+U9PO01oisD/YUUQUQIegKHPgFjsI+4B3Po6OFMk+ipkYU3bj aCnJn43Jx6k32rXMuTKdh9WdTMAin62FS6tdIVZjf2ap4Nnuh2fUK8Jo8SZ+wUfHn0Rw dKsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=9w/UIoNnaZ8iYtq5xCA3U8n+b2iHLpWpJE3T0gsn2Xs=; b=g6Xy9viwmU3gh7cFcDe5Q/CE2oSRBKlqP16LnTo7KVDdtfpfB+jhsAqHPznagiWz8P Du46TxdrwGGcN/IV+8m06XUQE3DOfAl5tRmTNvcYUw30BkP+PIsGtNmHuFKw5oPuP+AT SKJLPGhFigEJHEsyTs0/CJeaHyGgL7ibtLeDZFeEV67GdVGN/+nM/KW5cAv6druMKADm Ql4N/Q7fdy+MJEpNeqHHMS+BcyHwMQsQwpRVTul0CEIkzF3otjycexeoJRV4vlQqQPbh zcbAxkx0vWgQnlDbggOj5itIAWKI6luTpy3KDNhaZOUDRF9Ct7vwG+hoDf/8p3tptdEC nyhg== X-Gm-Message-State: AOAM530a6WpjCUMWvk1ZmHaLrhO3ogcrg/pBEwsX7lRKCWfyLHRXISDX WuVQyInw9PpiS8aY7Qqoz7zI3g== X-Received: by 2002:a2e:b16c:: with SMTP id a12mr9657879ljm.146.1596535511483; Tue, 04 Aug 2020 03:05:11 -0700 (PDT) Received: from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203]) by smtp.gmail.com with ESMTPSA id s4sm6080146lfc.56.2020.08.04.03.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Aug 2020 03:05:10 -0700 (PDT) Date: Tue, 4 Aug 2020 12:05:10 +0200 From: Niklas To: "Lad, Prabhakar" Cc: Geert Uytterhoeven , Laurent Pinchart , Lad Prabhakar , Mauro Carvalho Chehab , linux-media , Linux-Renesas , LKML , Biju Das Subject: Re: [PATCH v2] media: rcar-vin: Add support to select data pins for YCbCr422-8bit input Message-ID: <20200804100510.GA2566810@oden.dyn.berto.se> References: <1596470573-15065-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> <20200803180618.GA2297236@oden.dyn.berto.se> <20200803192801.GC2297236@oden.dyn.berto.se> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lad, On 2020-08-04 09:04:25 +0100, Lad, Prabhakar wrote: > Hi Niklas, > > On Mon, Aug 3, 2020 at 8:28 PM Niklas wrote: > > > > Hi Lad, > > > > On 2020-08-03 20:17:54 +0100, Lad, Prabhakar wrote: > > > Hi Niklas, > > > > > > Thank you for the review. > > > > > > On Mon, Aug 3, 2020 at 7:06 PM Niklas wrote: > > > > > > > > Hi Lad, > > > > > > > > Thanks for your work. > > > > > > > > On 2020-08-03 17:02:53 +0100, Lad Prabhakar wrote: > > > > > Select the data pins for YCbCr422-8bit input format depending on > > > > > bus_width and data_shift passed as part of DT. > > > > > > > > > > Signed-off-by: Lad Prabhakar > > > > > Reviewed-by: Biju Das > > > > > --- > > > > > Changes for v2: > > > > > * Dropped DT binding documentation patch > > > > > * Select the data pins depending on bus-width and data-shift > > > > > > > > I like this v2 much better then v1, nice work! > > > > > > > > > > > > > > v1 - > > > > > https://patchwork.kernel.org/project/linux-renesas-soc/list/?series=323799 > > > > > --- > > > > > drivers/media/platform/rcar-vin/rcar-core.c | 5 +++++ > > > > > drivers/media/platform/rcar-vin/rcar-dma.c | 7 +++++++ > > > > > drivers/media/platform/rcar-vin/rcar-vin.h | 5 +++++ > > > > > 3 files changed, 17 insertions(+) > > > > > > > > > > diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c > > > > > index 7440c8965d27..55005d86928d 100644 > > > > > --- a/drivers/media/platform/rcar-vin/rcar-core.c > > > > > +++ b/drivers/media/platform/rcar-vin/rcar-core.c > > > > > @@ -624,6 +624,11 @@ static int rvin_parallel_parse_v4l2(struct device *dev, > > > > > vin->parallel = rvpe; > > > > > vin->parallel->mbus_type = vep->bus_type; > > > > > > > > > > + /* select VInDATA[15:8] pins for YCbCr422-8bit format */ > > > > > + if (vep->bus.parallel.bus_width == BUS_WIDTH_8 && > > > > > + vep->bus.parallel.data_shift == DATA_SHIFT_8) > > > > > + vin->parallel->ycbcr_8b_g = true; > > > > > + > > > > > > > > I would store the bus_width and bus_shift values in the struct > > > > rvin_parallel_entity and evaluate them in place rater then create a flag > > > > for this specific use-case.. > > > > > > > Ok will do that. > > > > > > > Also according to the documentation is the check correct? Do we not wish > > > > to use the new mode when bus_width == 16 and bus_shift == 8. The check > > > > you have here seems to describe a 8 lane bus where 0 lanes are used. > > > > > > > bus-width is the actual data lines used, so bus_width == 16 and > > > bus_shift == 8 would mean use lines 23:8, so just check for bus_width > > > == 8 and bus_shift == 8 should be sufficient. > > > > As you and Geert points out I was wrong, they should indeed both be 8. > > > > > > > > > I think you should also verify that bus_shift is either 0 or 8 as that > > > > is all the driver supports. > > > > > > > Not sure if thats correct.In that case this patch wont make sense, I > > > believed we agreed upon we determine the YDS depending on both > > > bus-width and bus-shift. > > > > I'm sorry I think I lost you :-) The driver is not capable of supporting > > bus_width = 8 and bus_shift = 2 right? Maybe we are talking about > > different things. > > > > What I tried to say (updated with the knowledge of that bus_width should > > indeed be 8 and not 16) was that would it make sens to with bus_width=8 > > allow for a bus_shift value other then 0 or 8? What for example would > > the driver do if the value was 2? > > > I think this should be possible but I am not sure how this will work. > For example on iWave G21D-Q7 platform with 16-bit wired bus say we > connect a 8-bit camera as below: > > bus-width = 8 and bus-shift = 2 > VI1_G0_B -> Not connected > VI1_G1_B -> Not connected > VI1_G2_B_16 -> Connected > VI1_G3_B -> Connected > VI1_G4_B -> Connected > VI1_G5_B -> Connected > VI1_G6_B -> Connected > VI1_G7_B -> Connected > VI1_DATA7_B/VI1_B7_B_16 -> Connected > VI1_DATA6_B/VI1_B6_B_16 -> Connected > VI1_DATA5_B/VI1_B5_B_16 -> Not connected > VI1_DATA4_B/VI1_B4_B_16 -> Not connected > VI1_DATA3_B/VI1_B3_B_16 -> Not connected > VI1_DATA2_B/VI1_B2_B_16 -> Not connected > VI1_DATA1_B/VI1_B1_B_16 -> Not connected > VI1_DATA0_B/VI1_B0_B_16 -> Not connected I agree this is how I would imagine bus-width = 8 and bus-shift = 2 to be wired. > > So in this case for 8-bit YCbCr422 format should YDS be set I am not > sure. Or is this not a valid case at all ? That is my question :-) I can't find anything int the documentation that would allow is to do anything other then bus-width = 8 together with bus-shift = 0 (do not set YDS) or bus-shift = 8 (set YDS). So that is why I suggested you check for this and print a warning if bus-shift is anything else :-) But if you can figured out how we can do a bus-shift = 2 as in your example then of course the check is wrong. I have not read the docs carefully enough about this to rule it out as impossible. > > Cheers, > Prabhakar > > > > > > > On iWave G21D-Q7 for VI2 interface VI2_G* pins are connected to SoC > > > and for VIN3 interface Vi3_DATA* pins are connected. So in this case > > > the capture only works for VIN2 only if YDS bit is set for 8-bit 422, > > > and for VIN3 capture only works if YDS is 0 > > > > > > &vin2 { > > > status = "okay"; > > > pinctrl-0 = <&vin2_pins>; > > > pinctrl-names = "default"; > > > > > > port { > > > #address-cells = <1>; > > > #size-cells = <0>; > > > > > > vin2ep: endpoint { > > > remote-endpoint = <&ov7725_2>; > > > bus-width = <8>; > > > data-shift = <8>; > > > }; > > > }; > > > }; > > > > > > &vin3 { > > > status = "okay"; > > > pinctrl-0 = <&vin3_pins>; > > > pinctrl-names = "default"; > > > > > > port { > > > #address-cells = <1>; > > > #size-cells = <0>; > > > > > > vin3ep: endpoint { > > > remote-endpoint = <&ov7725_3>; > > > bus-width = <8>; > > > }; > > > }; > > > }; > > > > > > > > > > > switch (vin->parallel->mbus_type) { > > > > > case V4L2_MBUS_PARALLEL: > > > > > vin_dbg(vin, "Found PARALLEL media bus\n"); > > > > > diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c > > > > > index 1a30cd036371..5db483877d65 100644 > > > > > --- a/drivers/media/platform/rcar-vin/rcar-dma.c > > > > > +++ b/drivers/media/platform/rcar-vin/rcar-dma.c > > > > > @@ -127,6 +127,8 @@ > > > > > #define VNDMR2_FTEV (1 << 17) > > > > > #define VNDMR2_VLV(n) ((n & 0xf) << 12) > > > > > > > > > > +#define VNDMR2_YDS BIT(22) > > > > > > > > This should be grouped with the other VNDMR2_* macros and not on its > > > > own. Also it should be sorted so it should be inserted between > > > > VNDMR2_CES and VNDMR2_FTEV. > > > > > > > > Also I know BIT() is a nice macro but the rest of the driver uses (1 << > > > > 22), please do the same for this one. > > > > > > > Sure will take care of it. > > > > > > > > + > > > > > /* Video n CSI2 Interface Mode Register (Gen3) */ > > > > > #define VNCSI_IFMD_DES1 (1 << 26) > > > > > #define VNCSI_IFMD_DES0 (1 << 25) > > > > > @@ -698,6 +700,11 @@ static int rvin_setup(struct rvin_dev *vin) > > > > > /* Data Enable Polarity Select */ > > > > > if (vin->parallel->mbus_flags & V4L2_MBUS_DATA_ENABLE_LOW) > > > > > dmr2 |= VNDMR2_CES; > > > > > + > > > > > + if (vin->parallel->ycbcr_8b_g && vin->mbus_code == MEDIA_BUS_FMT_UYVY8_2X8) > > > > > + dmr2 |= VNDMR2_YDS; > > > > > + else > > > > > + dmr2 &= ~VNDMR2_YDS; > > > > > > > > dmr2 is already unitized and YDS is cleared, no need to clear it again > > > > if you don't wish to set it. Taking this and the comments above into > > > > account this would become something like (not tested), > > > > > > > Agreed. > > > > > > > switch (vin->mbus_code) { > > > > case MEDIA_BUS_FMT_UYVY8_2X8: > > > > if (vin->parallel->bus_width == 16 && vin->parallel->bus_shift == 8) > > > > dmr2 |= VNDMR2_YDS; > > > > break; > > > > default: > > > > break; > > > > } > > > > > > > > > } > > > > > > > > > > /* > > > > > diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h > > > > > index c19d077ce1cb..3126fee9a89b 100644 > > > > > --- a/drivers/media/platform/rcar-vin/rcar-vin.h > > > > > +++ b/drivers/media/platform/rcar-vin/rcar-vin.h > > > > > @@ -87,6 +87,9 @@ struct rvin_video_format { > > > > > u8 bpp; > > > > > }; > > > > > > > > > > +#define BUS_WIDTH_8 8 > > > > > +#define DATA_SHIFT_8 8 > > > > > > > > As pointed out by Geert, not so useful, use 8 in the code :-) > > > > > > > Agreed will drop it. > > > > > > Cheers, > > > Prabhakar > > > > -- > > Regards, > > Niklas S?derlund -- Regards, Niklas S?derlund