Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp950399ybm; Wed, 27 May 2020 11:59:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHp7rF7xITl88jadxpFym58MusyWl1I1GRJeImbFBtMiLN4S/w5k+oulkJKgBN1A0whVg7 X-Received: by 2002:a17:906:8694:: with SMTP id g20mr7517882ejx.75.1590605999031; Wed, 27 May 2020 11:59:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590605999; cv=none; d=google.com; s=arc-20160816; b=0ZecfNTErHC0WsC21X5tvbld7He+l1yRjrA9guDM18pHAHAxdcYtq+m8J9WSS1Ea8D IBXVbJEdkyQzNC6+4wSkBrnnj2aW5NznekvWI11C97I1/lwskBalwGX0F/cnb6/GZIBf CsJrYfjhNqv3wUWtzupvN3xKvNKlS8Ix43pwjh/Te0HChU/5agKqdU/f2kPizAZtNPgC JeFsZkN1TQv5Gxf1jkP2MquQ7Mif5HXeZzD5wZAMGGy9ZipdqGXrjAbIBcuxPtKy970N fRM4ugpRoNlbqevX+Jb4VKHaGT/M6CsHbBqPQXcqeMytsneVDChzxpWRVk32bMyxIUGd dE3A== 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:dkim-signature; bh=GHAf0GBSggKB3r+PycYRr3qDNQS5GVSL5h32VX4ho1I=; b=f+W3rGCfbDXCDblMzdsvmBze/K2Dc0Bf8+XXdV+RnH/2IaM5iv9wbkznISq1IWWyPg 1MjI8tJ4XvcSk0ZqqwlMuivpjGG3UYYyZTV6xOVImNGEQtijvwYjSsz3nI+BOs6rT3eA 3fi/DoJH1CunxWDGsLAy3c8nogUNIP4gT7DHU4GlE1viDvgBFaQN5ASg4pn5orv8zVgs ebKVrh4GIKdG6oZ4/31uMiybN6klOYqG4T/xL4DSHyb6KjaIqtEMzAA8YSrTiT7i5rfZ K87dDwl7jjr9+aOV7U53iBfpOruj/YupAOIwLpNFMQQx7MAucXy1vhhCXZl3uuvN3cPc usCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=p04hcC86; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="F6rcJ/R5"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b17si2101143edt.100.2020.05.27.11.59.35; Wed, 27 May 2020 11:59:59 -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=@cerno.tech header.s=fm2 header.b=p04hcC86; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="F6rcJ/R5"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390204AbgE0PuC (ORCPT + 98 others); Wed, 27 May 2020 11:50:02 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:40009 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390180AbgE0Pt4 (ORCPT ); Wed, 27 May 2020 11:49:56 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id E2483582037; Wed, 27 May 2020 11:49:55 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 27 May 2020 11:49:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=GHAf0GBSggKB3 r+PycYRr3qDNQS5GVSL5h32VX4ho1I=; b=p04hcC86BQ1iBLAhPJrhcsMjVPiNK Wa74afvIsSikdLKz0UgPXne38otChh6ZJCW/onv5L2PDvbjK3nolsZm1HGaaJ9IA Kuj/Yfkhe26PWZ3+lF/KUH7/GMdDnZl+ytoZUk3sjD7KEAm73K8A3bU+U9XE0tBM 9YQBAbgSc1eUFsQWwVab3YiQ0nK+yBjMBMg2/LUUXq+8Inybaq7/y4mU0GXqNNii IFHDBnZNViEQs+lHn0CUWLYjwmbmYFfRmETQYqbANOCnfW9iwDcLRfJJ/u8Vb/5q lXebxb9JYS6MnCaDVjxOE423afpmWCsc0ez12K/KZXYsxFDx4grKcx/4Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=GHAf0GBSggKB3r+PycYRr3qDNQS5GVSL5h32VX4ho1I=; b=F6rcJ/R5 hspkGX06Fmq9s/nhea485+EYc6ViOrLUzGZIqnWuyK3I1gvQ93TCh5wBStUGXZzm ZG/RIxFe6+dQR/Gka42MpwFyxsY0XUQVfSrwhm+2Sp6TFG2byqQhYQvcyYdz8ed6 0iyzC3u1uyiGro3o5DXLRmTTnFs5k+VE0LoDlSUBwM6jFG2+S3fS2bufC0S7Lqzh BIWUbTLtgCRw6lMiw42JWJ1V9cBEBFCRjDN6eQqtFC3kRKldfPSGfJywZWf4JmCs c8OOBiOgElAbTohwmwrqP86gcMGcR6LBm4NNlXCeRKZdvaSoPtOSyGAWrN9lK8Ky o0pmEJIrK775Wg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddvgedgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgepjeenuc frrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 832743061CCB; Wed, 27 May 2020 11:49:55 -0400 (EDT) From: Maxime Ripard To: Nicolas Saenz Julienne , Eric Anholt Cc: dri-devel@lists.freedesktop.org, linux-rpi-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Dave Stevenson , Tim Gover , Phil Elwell , Maxime Ripard Subject: [PATCH v3 025/105] drm/vc4: crtc: Deal with different number of pixel per clock Date: Wed, 27 May 2020 17:47:55 +0200 Message-Id: <69a64690a7a87bbd3fad59b7409baabcec40c8d7.1590594512.git-series.maxime@cerno.tech> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: 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 Some of the HDMI pixelvalves in vc5 output two pixels per clock cycle. Let's put the number of pixel output per clock cycle in the CRTC data and update the various calculations to reflect that. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_crtc.c | 17 ++++++++++------- drivers/gpu/drm/vc4/vc4_drv.h | 3 +++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index db056dfe14df..a3fc7dd97446 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -282,6 +282,7 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc) bool is_dsi = (vc4_encoder->type == VC4_ENCODER_TYPE_DSI0 || vc4_encoder->type == VC4_ENCODER_TYPE_DSI1); u32 format = is_dsi ? PV_CONTROL_FORMAT_DSIV_24 : PV_CONTROL_FORMAT_24; + u8 ppc = vc4_crtc->data->pixels_per_clock; /* Reset the PV fifo. */ CRTC_WRITE(PV_CONTROL, 0); @@ -289,17 +290,16 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc) CRTC_WRITE(PV_CONTROL, 0); CRTC_WRITE(PV_HORZA, - VC4_SET_FIELD((mode->htotal - - mode->hsync_end) * pixel_rep, + VC4_SET_FIELD((mode->htotal - mode->hsync_end) * pixel_rep / ppc, PV_HORZA_HBP) | - VC4_SET_FIELD((mode->hsync_end - - mode->hsync_start) * pixel_rep, + VC4_SET_FIELD((mode->hsync_end - mode->hsync_start) * pixel_rep / ppc, PV_HORZA_HSYNC)); + CRTC_WRITE(PV_HORZB, - VC4_SET_FIELD((mode->hsync_start - - mode->hdisplay) * pixel_rep, + VC4_SET_FIELD((mode->hsync_start - mode->hdisplay) * pixel_rep / ppc, PV_HORZB_HFP) | - VC4_SET_FIELD(mode->hdisplay * pixel_rep, PV_HORZB_HACTIVE)); + VC4_SET_FIELD(mode->hdisplay * pixel_rep / ppc, + PV_HORZB_HACTIVE)); CRTC_WRITE(PV_VERTA, VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end, @@ -1040,6 +1040,7 @@ static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = { static const struct vc4_crtc_data bcm2835_pv0_data = { .hvs_channel = 0, .debugfs_name = "crtc0_regs", + .pixels_per_clock = 1, .encoder_types = { [PV_CONTROL_CLK_SELECT_DSI] = VC4_ENCODER_TYPE_DSI0, [PV_CONTROL_CLK_SELECT_DPI_SMI_HDMI] = VC4_ENCODER_TYPE_DPI, @@ -1049,6 +1050,7 @@ static const struct vc4_crtc_data bcm2835_pv0_data = { static const struct vc4_crtc_data bcm2835_pv1_data = { .hvs_channel = 2, .debugfs_name = "crtc1_regs", + .pixels_per_clock = 1, .encoder_types = { [PV_CONTROL_CLK_SELECT_DSI] = VC4_ENCODER_TYPE_DSI1, [PV_CONTROL_CLK_SELECT_DPI_SMI_HDMI] = VC4_ENCODER_TYPE_SMI, @@ -1058,6 +1060,7 @@ static const struct vc4_crtc_data bcm2835_pv1_data = { static const struct vc4_crtc_data bcm2835_pv2_data = { .hvs_channel = 1, .debugfs_name = "crtc2_regs", + .pixels_per_clock = 1, .encoder_types = { [PV_CONTROL_CLK_SELECT_DPI_SMI_HDMI] = VC4_ENCODER_TYPE_HDMI, [PV_CONTROL_CLK_SELECT_VEC] = VC4_ENCODER_TYPE_VEC, diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index 329185a53a79..8c0f714f557b 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -453,6 +453,9 @@ struct vc4_crtc_data { /* Which channel of the HVS this pixelvalve sources from. */ int hvs_channel; + /* Number of pixels output per clock period */ + u8 pixels_per_clock; + enum vc4_encoder_type encoder_types[4]; const char *debugfs_name; }; -- git-series 0.9.1