From patchwork Sat May 19 18:31:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jernej_=C5=A0krabec?= X-Patchwork-Id: 10412991 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E5FF760353 for ; Sat, 19 May 2018 18:35:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D856C27CEE for ; Sat, 19 May 2018 18:35:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCEF72868C; Sat, 19 May 2018 18:35:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 57E3E27CEE for ; Sat, 19 May 2018 18:35:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=zvJmlomWVb5t4Kuvnxw8iywv86AkN/LDOMv5RCBEqcs=; b=Crp54EGi3VJHnohNzxxGmzlI9j EFvBdGYVSSUDifTjh1x2Qu311qVo2rB7WOiJZl1HaTNHXBxaL4aoYBmTqU/74hddGqaSQ8inLrHkS VsfYxDzLG8H9Y+8DWehl8714rQp9mg3S21utYXNpvPIJgQFhKTQhAnqhQZfkv35eCjO0L84onW/Al oNYnYcAT8GUA+dh2Xlk4S1T+j6dYKlqxX6BgJF9Wom5q3sIFgp+EBCnQNDVsxnnJTv58LrkzQLwIg c1poTYaaEdIEEnNkVHwyuyUVut4ovvb3pvgOukhsmKiZeN6CLHxtYAwFa7aq51q8TzCUwr8LUf6eA VC2qykNA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fK6ho-0001qG-Il; Sat, 19 May 2018 18:35:48 +0000 Received: from mailout3.siol.net ([213.250.19.130] helo=mail.siol.net) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fK6f8-0006ao-Qf for linux-arm-kernel@lists.infradead.org; Sat, 19 May 2018 18:33:08 +0000 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180519_113303_086531_2FDE9CFA X-CRM114-Status: GOOD ( 11.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 },