Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2958203pxb; Mon, 17 Jan 2022 09:00:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzPwZXOOHg0PbXJyqgwWNYo4Wx7DghYPUjzUhBNUW2BHhgDyrMiYsr1hh71hVbyQ2wKjjAw X-Received: by 2002:a63:da4e:: with SMTP id l14mr12491658pgj.220.1642438858540; Mon, 17 Jan 2022 09:00:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642438858; cv=none; d=google.com; s=arc-20160816; b=Y5u1VjoGphhVxsq9gUV5+97TX5RK9gBxsUQv/00+mpGJXtE/kvCIIXGKaBNH5mh0TM vUqNCrrx2n/VipS09C+DNEZtX7v8Iq/1ntWM5S2ivQwvhcH5CdT6L+1eBieKIJU9WU7Q o4Y0lXF0fKy0Ki1I708z81xNndGoI6YW89OV6l60g+OuqTd048KcTKbqHCMoXq+icr78 2IxS8vjwNIgt9hnTImLE+G5W62gRa69qs02EG0S0jIc1rbyRx3DcyJUwdDIwvMiq5ix/ p5/crAAC5TdcDlyWi2GJu1XutwKpKYDqsPJ6e+5yDjAJqvmJkmPysIQhXiEWVUxVF0vW bgxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=cplFrJ8necrGLsJmG8lCqt3OfBE+JxOPEe6kRr7y9ZE=; b=CXF/wZMSHp5LeMeY54vxhxLJAN6HY5O85o27BsIjmGCh+ZoY+m/NW8V8JNzuiaILeZ W33QUB19I1sHlo/zH2VcN0FD9zgbxG9basRQSRGsbWBjEeOiEdHRLBOs6gEdL8CUweXv FMrJhSwpP0hSLcnwZtumk2uHQZNYJNgmcHoYu8b5weBn5l2tyEA1uNzedFRwPb/GTMSu uSCXAeuYTeAX5OhUKNXxI+Ztgb5lh+zyUbU/2+4jFBV8CFlJFglgPC6+5xyxhf94UFcI 0Hz3BHuUs5p7UUt5UFVFWQLC6N5VXxZGeALKskJ4rxxGHnJxjlorKOL+tlJL5fmIPxD3 h1Iw== 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 me12si6043707pjb.129.2022.01.17.09.00.45; Mon, 17 Jan 2022 09:00:58 -0800 (PST) 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 S238178AbiAQI3R (ORCPT + 99 others); Mon, 17 Jan 2022 03:29:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238153AbiAQI3P (ORCPT ); Mon, 17 Jan 2022 03:29:15 -0500 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE7DDC061574; Mon, 17 Jan 2022 00:29:14 -0800 (PST) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 4AA461C0002; Mon, 17 Jan 2022 08:29:10 +0000 (UTC) Date: Mon, 17 Jan 2022 09:30:12 +0100 From: Jacopo Mondi To: Michael Riesch Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Rob Herring , Sakari Ailus , Ezequiel Garcia , Laurent Pinchart , Daniel Scally , Niklas =?utf-8?Q?S=C3=B6derlund?= Subject: Re: [PATCH 2/2] media: v4l2-mediabus: add support for dual edge sampling Message-ID: <20220117083012.jhrpcqf7htw6yr3n@uno.localdomain> References: <20220114105755.730200-1-michael.riesch@wolfvision.net> <20220114105755.730200-3-michael.riesch@wolfvision.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220114105755.730200-3-michael.riesch@wolfvision.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Michael On Fri, Jan 14, 2022 at 11:57:55AM +0100, Michael Riesch wrote: > Some devices support sampling of the parallel data at both edges of the > interface pixel clock in order to reduce the pixel clock by two. > Add a mediabus flag that represents this feature. > > Signed-off-by: Michael Riesch I was not expecting this :) But I guess makes sense to add such option. Reviewed-by: Jacopo Mondi Thanks j > --- > drivers/media/v4l2-core/v4l2-fwnode.c | 23 +++++++++++++++++++---- > include/media/v4l2-mediabus.h | 17 +++++++++-------- > 2 files changed, 28 insertions(+), 12 deletions(-) > > diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c > index 00457e1e93f6..70adf6549f5b 100644 > --- a/drivers/media/v4l2-core/v4l2-fwnode.c > +++ b/drivers/media/v4l2-core/v4l2-fwnode.c > @@ -296,10 +296,25 @@ v4l2_fwnode_endpoint_parse_parallel_bus(struct fwnode_handle *fwnode, > > if (!fwnode_property_read_u32(fwnode, "pclk-sample", &v)) { > flags &= ~(V4L2_MBUS_PCLK_SAMPLE_RISING | > - V4L2_MBUS_PCLK_SAMPLE_FALLING); > - flags |= v ? V4L2_MBUS_PCLK_SAMPLE_RISING : > - V4L2_MBUS_PCLK_SAMPLE_FALLING; > - pr_debug("pclk-sample %s\n", v ? "high" : "low"); > + V4L2_MBUS_PCLK_SAMPLE_FALLING | > + V4L2_MBUS_PCLK_SAMPLE_DUALEDGE); > + switch (v) { > + case 0: > + flags |= V4L2_MBUS_PCLK_SAMPLE_FALLING; > + pr_debug("pclk-sample low\n"); > + break; > + case 1: > + flags |= V4L2_MBUS_PCLK_SAMPLE_RISING; > + pr_debug("pclk-sample high\n"); > + break; > + case 2: > + flags |= V4L2_MBUS_PCLK_SAMPLE_DUALEDGE; > + pr_debug("pclk-sample dual edge\n"); > + break; > + default: > + pr_warn("invalid argument for pclk-sample"); > + break; > + } > } > > if (!fwnode_property_read_u32(fwnode, "data-active", &v)) { > diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h > index 841e190aedd9..c98f956ef586 100644 > --- a/include/media/v4l2-mediabus.h > +++ b/include/media/v4l2-mediabus.h > @@ -57,17 +57,18 @@ > #define V4L2_MBUS_VSYNC_ACTIVE_LOW BIT(5) > #define V4L2_MBUS_PCLK_SAMPLE_RISING BIT(6) > #define V4L2_MBUS_PCLK_SAMPLE_FALLING BIT(7) > -#define V4L2_MBUS_DATA_ACTIVE_HIGH BIT(8) > -#define V4L2_MBUS_DATA_ACTIVE_LOW BIT(9) > +#define V4L2_MBUS_PCLK_SAMPLE_DUALEDGE BIT(8) > +#define V4L2_MBUS_DATA_ACTIVE_HIGH BIT(9) > +#define V4L2_MBUS_DATA_ACTIVE_LOW BIT(10) > /* FIELD = 0/1 - Field1 (odd)/Field2 (even) */ > -#define V4L2_MBUS_FIELD_EVEN_HIGH BIT(10) > +#define V4L2_MBUS_FIELD_EVEN_HIGH BIT(11) > /* FIELD = 1/0 - Field1 (odd)/Field2 (even) */ > -#define V4L2_MBUS_FIELD_EVEN_LOW BIT(11) > +#define V4L2_MBUS_FIELD_EVEN_LOW BIT(12) > /* Active state of Sync-on-green (SoG) signal, 0/1 for LOW/HIGH respectively. */ > -#define V4L2_MBUS_VIDEO_SOG_ACTIVE_HIGH BIT(12) > -#define V4L2_MBUS_VIDEO_SOG_ACTIVE_LOW BIT(13) > -#define V4L2_MBUS_DATA_ENABLE_HIGH BIT(14) > -#define V4L2_MBUS_DATA_ENABLE_LOW BIT(15) > +#define V4L2_MBUS_VIDEO_SOG_ACTIVE_HIGH BIT(13) > +#define V4L2_MBUS_VIDEO_SOG_ACTIVE_LOW BIT(14) > +#define V4L2_MBUS_DATA_ENABLE_HIGH BIT(15) > +#define V4L2_MBUS_DATA_ENABLE_LOW BIT(16) > > /* Serial flags */ > /* CSI-2 D-PHY number of data lanes. */ > -- > 2.30.2 >