Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2116667imm; Tue, 10 Jul 2018 13:37:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdyovfMggRckIvo1qEDGKAyUA9ULLDM16cSKTFyFwEVsso8sJwJy0QeG56mDjrxPKoHO1C0 X-Received: by 2002:a17:902:9883:: with SMTP id s3-v6mr26002541plp.194.1531255028590; Tue, 10 Jul 2018 13:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531255028; cv=none; d=google.com; s=arc-20160816; b=j6nRTDkX68z+80XPmcRW7ym5VhSmBjLxZQXUkgq2l0S+QHm4cdUHVeLLJuIB39YLK1 QSrAAaWnJGSrb1hqmUjQZYEzqdG0I3IDVdwgbT/vGJexcRQiNg4Axc5Xb2LpqujHp/B4 /9F96FagPc13/XLRqU3dBvTYOOPMW6iiOVXcWPIekzlkM9Frp7FC9fk9sLFHIx9NSxo9 7DSPNQtDjkf8TSBufy6pkStaIqW/jdzhYN8I1TpmCr7Ii0Gc4Ij9dj43uIRaYGZBHBOJ pqdtOeb2XUNFfLHE8kn49TgXxvfmbnFZgAwPFM1MfB4Vi3lsWbQ4v+Rd8ksr6UUvVTen jqJA== 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=s+8ECsU7ZDtxpdlqxnmYhrTGtIcng8QHNTEvxdqV/Zk=; b=mo5CFl58Lr4GYKTKwR/fR66RQLmgKf1ZjdQ1KAxNZF6cnt2mfZyjKESu7fC9PoFGpy EAalvfuu7L6gO5wKeaJPMz+nnOOGJeou4qX5SAPBCZAW0lU5ZDRIwFGYG8f0V6xHD+PR Oa/+XcWBYvZtG1aa5oZEgh9sJ6D6Sy5DnllqCGTsC9qYk0emDQHkmfz5sh7iI4/cCx8E mnG8xdfCEuePsxHLGZ1d/C5V4Yp585JJpVhRhNoN3jrJ3tAl1UIYalx/EkLQsu2+4J2M ywisKhOLWP540iuYiADrPRK770kvtMTmLxoVWf+8gUJ7zvV3HT/Bifjgx8av68LeTkFQ KDBA== 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 u11-v6si4053740pgg.683.2018.07.10.13.36.53; Tue, 10 Jul 2018 13:37:08 -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 S1733039AbeGJUgi (ORCPT + 99 others); Tue, 10 Jul 2018 16:36:38 -0400 Received: from mailoutvs24.siol.net ([185.57.226.215]:47522 "EHLO mail.siol.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733011AbeGJUgi (ORCPT ); Tue, 10 Jul 2018 16:36:38 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Zimbra) with ESMTP id 81D7852272E; Tue, 10 Jul 2018 22:35:53 +0200 (CEST) X-Virus-Scanned: amavisd-new at psrvmta12.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta12.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id uQA3n-sSeK0R; Tue, 10 Jul 2018 22:35:53 +0200 (CEST) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Zimbra) with ESMTPS id 0833B52272F; Tue, 10 Jul 2018 22:35:53 +0200 (CEST) Received: from localhost.localdomain (unknown [194.152.15.144]) (Authenticated sender: 031275009) by mail.siol.net (Zimbra) with ESMTPSA id 913F552272E; Tue, 10 Jul 2018 22:35:50 +0200 (CEST) From: Jernej Skrabec To: maxime.ripard@bootlin.com, wens@csie.org, robh+dt@kernel.org Cc: airlied@linux.ie, 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-sunxi@googlegroups.com Subject: [PATCH v2 13/18] drm/sun4i: tcon: Add support for R40 TCON Date: Tue, 10 Jul 2018 22:35:06 +0200 Message-Id: <20180710203511.18454-14-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710203511.18454-1-jernej.skrabec@siol.net> References: <20180710203511.18454-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 TV TCON is basically the same as on A83T. However, it needs special handling, because it has to set up TCON TOP muxes at runtime. Reviewed-by: Chen-Yu Tsai Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 44ec3a3d4d64..5676b7faaca0 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -1291,6 +1291,40 @@ 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) +{ + struct device_node *port, *remote; + struct platform_device *pdev; + int id, ret; + + /* find TCON TOP platform device and TCON id */ + + port = of_graph_get_port_by_id(tcon->dev->of_node, 0); + if (!port) + return -EINVAL; + + id = sun4i_tcon_of_get_id_from_port(port); + of_node_put(port); + + remote = of_graph_get_remote_node(tcon->dev->of_node, 0, -1); + if (!remote) + return -EINVAL; + + pdev = of_find_device_by_node(remote); + of_node_put(remote); + if (!pdev) + return -EINVAL; + + if (encoder->encoder_type == DRM_MODE_ENCODER_TMDS) { + ret = sun8i_tcon_top_set_hdmi_src(&pdev->dev, id); + if (ret) + return ret; + } + + return sun8i_tcon_top_de_config(&pdev->dev, tcon->id, id); +} + static const struct sun4i_tcon_quirks sun4i_a10_quirks = { .has_channel_0 = true, .has_channel_1 = true, @@ -1338,6 +1372,11 @@ static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = { .has_channel_1 = true, }; +static const struct sun4i_tcon_quirks sun8i_r40_tv_quirks = { + .has_channel_1 = true, + .set_mux = sun8i_r40_tcon_tv_set_mux, +}; + static const struct sun4i_tcon_quirks sun8i_v3s_quirks = { .has_channel_0 = true, }; @@ -1362,6 +1401,7 @@ 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", .data = &sun8i_r40_tv_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.18.0