Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3399107ybl; Sun, 15 Dec 2019 09:02:06 -0800 (PST) X-Google-Smtp-Source: APXvYqwdBItRrL9Q1AZqc9/l/PrQFf8drE11ox1AgamLwmOXxBUIR/9bQH9vX2V7OGLonBca7zFU X-Received: by 2002:a9d:6f07:: with SMTP id n7mr26430511otq.112.1576429326927; Sun, 15 Dec 2019 09:02:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576429326; cv=none; d=google.com; s=arc-20160816; b=lpUhTSuIJ6NyUGP0pIU1kQ20eQDUkenQ6fi/TtMigsri9mV/b8dz4ldx6Ik+9NpDKF oK8IkCrNZv9OtDSl5k7h63oonJ85QQKSt6Qd/B7gKUjJPEOCU05509J0DIMRKp8gwvso dmE4uVyKE3uvRUmiw7VdiKD0d0pcEQ/DLky8lF8PwsmsgW5h97oKz47gt4ip+54EfjjD qg1etZHowMoDFRMyCyWUpYgn4mkwd+kIeiKiBwve+TIXZ4ZF8p+PPodEH9kR4NG+dFTy iMn+NXZTppUQeavDTFR6RGzYqijVSEHXc5mKicWaPg8zh5ZvIq7ejLIDj+NPm62kQquV Fh6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LeDKLMKvkY3ktslLBsFHksfYQVDpoifctuVUdPj8dUY=; b=rkx+GFQ8roAUTy5zpkHRFmnA/bH2Kg93tgJ6Mq5lmwriw0SYAOYmcC3s9m1n/MSCBq BgG8PwUypvjlq4MtJ13NO6KkAW9PLnt6KWP8rzK1ulbl2Hr+7uFraui9TKhJJzS5Xobw 8yVE7XNgBIuITIxLgX2RrWKB0jsm/XzU1OKJAOxPXEtp2C0l83mkevnuT756FrBkEV9U n5674VYLoCkg4bW86L8eFeoZn7wjRdWdXlsadBCUwegx252Rv9JLZ7BG1BZ5//JL1T4l MkYQpSv+Rn0JKBj42kwbEDAy0u6vm3euTUc9XsDh9eear5FUB0d97GtjETOV0kNEG6VK T1HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qPHlms8R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65si9306928otw.204.2019.12.15.09.01.55; Sun, 15 Dec 2019 09:02:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qPHlms8R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727066AbfLORA1 (ORCPT + 99 others); Sun, 15 Dec 2019 12:00:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:54888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726136AbfLOQ7a (ORCPT ); Sun, 15 Dec 2019 11:59:30 -0500 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6FAEC24654; Sun, 15 Dec 2019 16:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429169; bh=EvY3LwRt0f5Tvf7gcoGOEsDupUlInqW1mNCeFk7ve3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qPHlms8RDy0m/MzsOfVjqrcisYEQwVZwsvvQLsGFf/yO16N1gXeFT/9lGSdDVBI2J 9WykYKUqXK28CKGeZrJh6uST59Zb+UD7f94fN6fJMsYbySt6uOdMBjzCO2SXTTM2+y crawrkADDaSicfm7uuE1/DW0batDau1NcqoaBe+I= Received: by wens.tw (Postfix, from userid 1000) id 374BC5FD34; Mon, 16 Dec 2019 00:59:26 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Mauro Carvalho Chehab , Sakari Ailus , Rob Herring , Mark Rutland Cc: Chen-Yu Tsai , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai Subject: [PATCH 03/14] media: sun4i-csi: Fix data sampling polarity handling Date: Mon, 16 Dec 2019 00:59:13 +0800 Message-Id: <20191215165924.28314-4-wens@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191215165924.28314-1-wens@kernel.org> References: <20191215165924.28314-1-wens@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen-Yu Tsai The CLK_POL field specifies whether data is sampled on the falling or rising edge of PCLK, not whether the data lines are active high or low. Evidence of this can be found in the timing diagram labeled "horizontal size setting and pixel clock timing". Fix the setting by checking the correct flag, V4L2_MBUS_PCLK_SAMPLE_RISING. While at it, reorder the three polarity flag checks so HSYNC and VSYNC are grouped together. Fixes: 577bbf23b758 ("media: sunxi: Add A10 CSI driver") Signed-off-by: Chen-Yu Tsai --- drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c b/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c index d6979e11a67b..8b567d0f019b 100644 --- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c +++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c @@ -279,8 +279,8 @@ static int sun4i_csi_start_streaming(struct vb2_queue *vq, unsigned int count) csi->regs + CSI_WIN_CTRL_H_REG); hsync_pol = !!(bus->flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH); - pclk_pol = !!(bus->flags & V4L2_MBUS_DATA_ACTIVE_HIGH); vsync_pol = !!(bus->flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH); + pclk_pol = !!(bus->flags & V4L2_MBUS_PCLK_SAMPLE_RISING); writel(CSI_CFG_INPUT_FMT(csi_fmt->input) | CSI_CFG_OUTPUT_FMT(csi_fmt->output) | CSI_CFG_VSYNC_POL(vsync_pol) | -- 2.24.0