Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp5878607imm; Sat, 19 May 2018 11:34:13 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqXC2BcSXwt/F1uV3NhxP4rpCfFVHKujO9wEOrbR+g0L9J2RWPfRc8iVWLivPyG8hYXLMwL X-Received: by 2002:a62:3ec2:: with SMTP id y63-v6mr14171808pfj.102.1526754853306; Sat, 19 May 2018 11:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526754853; cv=none; d=google.com; s=arc-20160816; b=M4ylSzC8IN9u1rhECEP0jGlbegnEEGF8/J2CC++r2wwKqirQFt+aQ4rljWtKRhQ5yD 2W1z+103VcH4h1GkCXd8XcKN96HhRX/Qzqi0LgATU1AK+39p/7y0kcPwf2i4NyvYOhtV BLS06EgWaEk1CB07Z+4SAMshZdJ7jnHc3gNkp1RcdidR3K+66UX3D3cXkRDccAXfsFQu EXKubY20eOZtCya7eWDIFZBPAazMy3/7i8nOJTYsCQ7Udg6sLL756HBIp1vucEcDKBXc aIzvTuCAm9Z0Wet5FYbC49pHdgXVo1vbJV5dzYTahDmFMYEvCaTOO9FI2EUskM43MSEi 2hjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=XLYeA+yEWV+5Boq3TBOlGOOBoSjsf3oawpRsIH8Citc=; b=oUkHa14cv9cbly/t4oFjw0/Xguc+hA/fkbFDI5T4qm+MOYkpRXGoYVWAF260s1ukR0 fBDOB5yWcxPdRA/YP3Vzl7LaWohtoYa0uwH9zUe085xG07BNVcmZFkcyDQ5dC1QHRLeC D5Rx2VL01c6UBV85/wmAVhR4OO9ZrqRtICcNdlOGPebYivlW8H9ks5sJ/XnsalG11NIM gj2VN3pdWQ49TFhR5TWgYGQDuU7A7xS41zlviI1zEicbEdJvMPm3EjHvmQJvwY5RHPHy a6XjXk6A7unVQ6C6afUXnOruhq5CMshHqv9Bs4KP6hJ52bmDxxAumVa2Yy2KxhhuCKbB vKFQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q11-v6si8011105pgc.669.2018.05.19.11.33.59; Sat, 19 May 2018 11:34:13 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752724AbeESSdE (ORCPT + 99 others); Sat, 19 May 2018 14:33:04 -0400 Received: from mailout8.siol.net ([213.250.19.135]:34794 "EHLO mail.siol.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752519AbeESScx (ORCPT ); Sat, 19 May 2018 14:32:53 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTP id 7A859520640; Sat, 19 May 2018 20:32:51 +0200 (CEST) X-Virus-Scanned: amavisd-new at psrvmta10.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta10.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id WtD1Uijusqjb; Sat, 19 May 2018 20:32:51 +0200 (CEST) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTPS id E459552047D; Sat, 19 May 2018 20:32:50 +0200 (CEST) Received: from localhost.localdomain (unknown [194.152.15.144]) (Authenticated sender: 031275009) by mail.siol.net (Postfix) with ESMTPSA id 7EFE6520640; Sat, 19 May 2018 20:32:48 +0200 (CEST) From: Jernej Skrabec To: maxime.ripard@bootlin.com, wens@csie.org, robh+dt@kernel.org Cc: mark.rutland@arm.com, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH 10/15] drm/sun4i: Add support for R40 TV TCONs Date: Sat, 19 May 2018 20:31:22 +0200 Message-Id: <20180519183127.2718-11-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180519183127.2718-1-jernej.skrabec@siol.net> References: <20180519183127.2718-1-jernej.skrabec@siol.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org R40 display pipeline has a lot of possible configurations. HDMI can be connected to 2 different TCONs (out of 4) and mixers can be connected to any TCON. All this must be configured in TCON TOP. Along with definition of TCON capabilities also add mux callback, which can configure this complex pipeline. For now, only TCON TV is supported. Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index e0c562ce1c22..81b9551e4f78 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -1274,6 +1274,31 @@ static int sun6i_tcon_set_mux(struct sun4i_tcon *tcon, return 0; } +static int sun8i_r40_tcon_tv_set_mux(struct sun4i_tcon *tcon, + const struct drm_encoder *encoder, + int index) +{ + if (encoder->encoder_type == DRM_MODE_ENCODER_TMDS) + sun8i_tcon_top_set_hdmi_src(tcon->tcon_top, index); + + sun8i_tcon_top_de_config(tcon->tcon_top, tcon->id, + tcon_type_tv, index); + + return 0; +} + +static int sun8i_r40_tcon_tv_set_mux_0(struct sun4i_tcon *tcon, + const struct drm_encoder *encoder) +{ + return sun8i_r40_tcon_tv_set_mux(tcon, encoder, 0); +} + +static int sun8i_r40_tcon_tv_set_mux_1(struct sun4i_tcon *tcon, + const struct drm_encoder *encoder) +{ + return sun8i_r40_tcon_tv_set_mux(tcon, encoder, 1); +} + static const struct sun4i_tcon_quirks sun4i_a10_quirks = { .has_channel_0 = true, .has_channel_1 = true, @@ -1321,6 +1346,18 @@ static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = { .has_channel_1 = true, }; +static const struct sun4i_tcon_quirks sun8i_r40_tv_0_quirks = { + .has_channel_1 = true, + .needs_tcon_top = true, + .set_mux = sun8i_r40_tcon_tv_set_mux_0, +}; + +static const struct sun4i_tcon_quirks sun8i_r40_tv_1_quirks = { + .has_channel_1 = true, + .needs_tcon_top = true, + .set_mux = sun8i_r40_tcon_tv_set_mux_1, +}; + static const struct sun4i_tcon_quirks sun8i_v3s_quirks = { .has_channel_0 = true, }; @@ -1345,6 +1382,8 @@ const struct of_device_id sun4i_tcon_of_table[] = { { .compatible = "allwinner,sun8i-a33-tcon", .data = &sun8i_a33_quirks }, { .compatible = "allwinner,sun8i-a83t-tcon-lcd", .data = &sun8i_a83t_lcd_quirks }, { .compatible = "allwinner,sun8i-a83t-tcon-tv", .data = &sun8i_a83t_tv_quirks }, + { .compatible = "allwinner,sun8i-r40-tcon-tv-0", .data = &sun8i_r40_tv_0_quirks }, + { .compatible = "allwinner,sun8i-r40-tcon-tv-1", .data = &sun8i_r40_tv_1_quirks }, { .compatible = "allwinner,sun8i-v3s-tcon", .data = &sun8i_v3s_quirks }, { .compatible = "allwinner,sun9i-a80-tcon-lcd", .data = &sun9i_a80_tcon_lcd_quirks }, { .compatible = "allwinner,sun9i-a80-tcon-tv", .data = &sun9i_a80_tcon_tv_quirks }, -- 2.17.0