From patchwork Thu Nov 30 17:14:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 10085395 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 AD71F60311 for ; Thu, 30 Nov 2017 17:14:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 948AB2A268 for ; Thu, 30 Nov 2017 17:14:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8998B2A273; Thu, 30 Nov 2017 17:14:23 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B8FED2A268 for ; Thu, 30 Nov 2017 17:14:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BE7606EB28; Thu, 30 Nov 2017 17:14:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lb2-smtp-cloud8.xs4all.net (lb2-smtp-cloud8.xs4all.net [194.109.24.25]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0C4716EB28 for ; Thu, 30 Nov 2017 17:14:19 +0000 (UTC) Received: from [192.168.2.10] ([212.251.195.8]) by smtp-cloud8.xs4all.net with ESMTPA id KSPdejzpSg5cRKSPgefo0b; Thu, 30 Nov 2017 18:14:18 +0100 To: Maling list - DRI developers , Maxime Ripard , Chen-Yu Tsai From: Hans Verkuil Subject: drm/sun4i: no picture when connected to a 4k display Message-ID: <2c4b6086-00d6-9297-6ac7-4327e9a81208@xs4all.nl> Date: Thu, 30 Nov 2017 18:14:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Language: en-US X-CMAE-Envelope: MS4wfNB4mfkx6k/Z2zhYtNdKh4WK9Np4O0HT7P+33VCWXCCWYrFCdPzm18gU2jvVaKtlWWre2B+/tseqiHHF2rtwgtv0qn69mtdR/modVpWN9WfGYHyIuaG6 VY38fVuN3rbEdNXe6Nf7da0LRxO5B0UcLrlNyFv0Xl3tH9HlEqQvXarXYGi/PAZ6giyVHeCPlNnZBddyOFyOwcGjEDLJB0gFz/IU3AQEaUc/kS62UvhQUIf2 WBLb+Cqi1lDZ5QORqZ/4UGeKDBBdqWeVmSsJko5t15Q= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hi Maxime, Chen-Yu, When I connect my cubieboard running 4.15-rc1 to my 4k display I get no picture. Some digging found that there is no check against the upper pixelclock limit of the HDMI output, so X selects a 4kp60 format at 594 MHz, which obviously won't work. I whipped up the quick patch below, but this information about the max support HDMI frequency should probably come from the device tree. Although for the A10 and A20 I guess it could also be hardcoded in the source since this code is only used for sun4i. Anyway, when I use this patch I get a proper 1080p60 picture. Regards, Hans Signed-off-by: Hans Verkuil diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index dda904ec0534..dc2f550f54ff 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -208,8 +208,17 @@ static int sun4i_hdmi_get_modes(struct drm_connector *connector) return ret; } +static int sun4i_hdmi_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) +{ + if (mode->clock > 170000) + return MODE_CLOCK_HIGH; + return MODE_OK; +} + static const struct drm_connector_helper_funcs sun4i_hdmi_connector_helper_funcs = { .get_modes = sun4i_hdmi_get_modes, + .mode_valid = sun4i_hdmi_mode_valid, }; static enum drm_connector_status