From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C6DF9C54EBE for ; Mon, 16 Jan 2023 18:44:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: References:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/H3mwD9fFkorQWTrMeqIa6CKQoBS/gfyIGWpr4yPYqQ=; b=EhjgZfzo7S1xE3 Q03hWi84TNxhYmUze3VmqjpX008lqN4UvDmk87Z024MFVxNBQiEw05ZFV6gAhZqZO945vmEDZgRt9 OazJsKkjgAKJ0VUO4PMIzxmAeUvcsPYBWC2IJvY4j+4pWtGB6UI2ylrt+EMakbZyoik7D9w2NYLhK pM9X07iS5BnbvPBp1TCyuvkv1iA0Jsv/eRY5qkOmX7YcJ1/18FpCb+2gkXQjjdAH/9fuya407KGq8 cx6doYVd7uHnYx+GsKYbCqEQdAU8J/90Ae6jL5H3TTQJuP99ehRE7UzemHaEHP46rpC+QpdIAbHqe ukiGtLgxv35VDGglow3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHURr-00Bkbj-1n; Mon, 16 Jan 2023 18:43:11 +0000 Received: from mail-yb1-xb2d.google.com ([2607:f8b0:4864:20::b2d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHURn-00Bkaw-4L for linux-arm-kernel@lists.infradead.org; Mon, 16 Jan 2023 18:43:08 +0000 Received: by mail-yb1-xb2d.google.com with SMTP id v19so25393304ybv.1 for ; Mon, 16 Jan 2023 10:43:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=rlIydODY/LfpwItZTwtL4rzfyzEiXyrm/RMUswozIX8=; b=OUGKEjvhy/swyG5hBFXyFKBADXRYGg2Tnv2lo9xqvxIfswyC0uVTH4neehdoFiys6K DJttWBjlEft3Ka2XvzsnS6nE2sjau6TTQzhOt7S+AoDcsbqSHdW83chVFdqzwqxtJ3xp 5GWtFffSzf6n6eghxZZ/r6n5Tilh49rb+2TgRijjALlKUXK/HaJS4y8mnWCrizJk7m23 7Kn3rVt37SzXRMos70rE99Vnn46PJ/RmQJN3g/P7wShJ0ZWNxqUhWt3FmTP1dIH59ec2 D/AkWwTkWNKl6w0z9JuQGVst42aOoLec/kyIH3TTDSd+FAWLOVwbsY6qTLz2cN3BlhhU 18vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rlIydODY/LfpwItZTwtL4rzfyzEiXyrm/RMUswozIX8=; b=P3V55f09T5XKkS53i4WK+wa+zka8ptyx/IrwJgBbyizIM2TF6X80OqTV56+e1T3RI3 MmeP5Gm455MT6eTEE6hwwy0l9cWCAC0ng7jQgZzpcQQ3k6ydO3y81s8eGISfHv7KXow2 Du/ZJ0wCfR6gZUo9jJaERIzdZdHzEC0aFU9BHTfE4hHOZ5w4P4vy55dIzEOGLkTynmdv edsUX+Lr8hJriIzW+VbnSWCK7aRlY30cB7J6wIVu5TOXlBZjc3YhYKS1loJZJ4SKWwDX DOx4yiImaCR3YhMduAxLPj114XnmyjqCqooBuAdJUob0LSDD4OTvZtLHB6CNwIhz76lG p08g== X-Gm-Message-State: AFqh2kq/akQT3UD2+0tB6u0YTcCQbxLKDkZIKQUv8r0xWtwUPgwe3h82 ouotfuOQKmOYi7kMNY0p0xK1fmNlTDoWcw1QlXU= X-Google-Smtp-Source: AMrXdXv66G8WXqBNuBYzpHAknsAJtQxSzEtqqiHk7smapGoNCVADxDJchudqYt89nC5nxEOavqo3qPuHbu9lbraGcnY= X-Received: by 2002:a25:d505:0:b0:7c0:10aa:961e with SMTP id r5-20020a25d505000000b007c010aa961emr70364ybe.346.1673894585852; Mon, 16 Jan 2023 10:43:05 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a05:6918:26c5:b0:10e:d15b:5860 with HTTP; Mon, 16 Jan 2023 10:43:05 -0800 (PST) In-Reply-To: <20230116101651.jjzz2rcdehs5wvsi@houat> References: <20191215165924.28314-5-wens@kernel.org> <20230116100359.4479-1-olecom@gmail.com> <20230116101651.jjzz2rcdehs5wvsi@houat> From: Oleg Verych Date: Mon, 16 Jan 2023 21:43:05 +0300 Message-ID: Subject: Re: [PATCH 04/14] media: sun4i-csi: Fix [HV]sync polarity handling To: Maxime Ripard Cc: wens@kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, mark.rutland@arm.com, mchehab@kernel.org, robh+dt@kernel.org, sakari.ailus@linux.intel.com, wens@csie.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230116_104307_187417_65ABC8D5 X-CRM114-Status: GOOD ( 20.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi! On 1/16/23, Maxime Ripard wrote: > Hi, > > On Mon, Jan 16, 2023 at 01:03:59PM +0300, Oleg Verych wrote: >> > - hsync_pol = !!(bus->flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH); >> > - vsync_pol = !!(bus->flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH); >> > + /* >> > + * This hardware uses [HV]REF instead of [HV]SYNC. Based on the >> > + * provided timing diagrams in the manual, positive polarity >> > + * equals active high [HV]REF. >> > + * >> > + * When the back porch is 0, [HV]REF is more or less equivalent >> > + * to [HV]SYNC inverted. >> > + */ >> > + href_pol = !!(bus->flags & V4L2_MBUS_HSYNC_ACTIVE_LOW); >> > + vref_pol = !!(bus->flags & V4L2_MBUS_VSYNC_ACTIVE_LOW); >> >> After this change has been made there is a need of explicit explanation >> of what "Active high" / "Active low" in dts really mean. > > Why? It will be better understood by a person behind an oscilloscope who is trying to figure out the logic behind dts, csi driver, csi controller, wire voltage levels by just reading device tree definitions. Because dts must be changed in order to connect source / sink devices. > > I'm sorry, it's not clear to me what is confusing in those excerpts? I'm sorry too, maybe that is not clear. Confusion is here: >> > + hsync-active = <1>; /* Active high */ >> >> original CSI driver i.e. <1> - active high >> > + hsync-active = <0>; /* Active high */ >> >> this change patchset i.e. <0> - active high >> > + hsync-active = <1>; /* Active high */ >> >> this patcheset i.e. <1> - active high >> Currently physical high/low voltage levels are like that: >> (I'm not sure about vsync-active) >> >> * hsync-active = <0>; /* HSYNC active 'low' => wire active is 'high' */ > > Yes > >> CSI register setting: href_pol: 1, > > Not really, no. It's what this patch commit log is saying: HREF is > !HSYNC, so in order to get a hsync pulse active high, you need to set > href_pol to 0. I'm totally confused here. That `hsync-active = <0>` -> `href_pol: 1` was found by `printk()`-like debugging. (This can be not relevant or incorrect) What was found also is that active high horizontal wire (whatever it is called in datasheet, PCB, dts or driver) from e.g. FPGA corresponds to `href_pol: 1` to correctly read image lines sent. Thanks! -- sed 'sh && sed && node.js + olecom = happiness and mirth' << '' -o--=O`C #oo'L O <___=E M _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel