From patchwork Tue Dec 4 16:36:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 10712181 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 95F03109C for ; Tue, 4 Dec 2018 16:36:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87EB92BEE6 for ; Tue, 4 Dec 2018 16:36:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BA3E2BEEB; Tue, 4 Dec 2018 16:36:13 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 245BF2BEE6 for ; Tue, 4 Dec 2018 16:36:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726941AbeLDQgM (ORCPT ); Tue, 4 Dec 2018 11:36:12 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:37906 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726487AbeLDQgM (ORCPT ); Tue, 4 Dec 2018 11:36:12 -0500 Received: from avalon.bb.dnainternet.fi (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7366C553; Tue, 4 Dec 2018 17:36:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1543941371; bh=6dNkMdKQnMTtraOX7mAVDj7vFU4z85U7P/xgD/1yFSw=; h=From:To:Cc:Subject:Date:From; b=U/OQwF3YmAKwderw9SpXPWCL/0YWS+vIiZ2Lr1Ed922UvrpLiU9gVQc/GgeZqKrph h0VLDE3Kx0BQcLTAo5yQEKaVhYiCxL7UnfjQleXr6V9O7bYYhMRn8fd8qWF/v2aYcK gKnHwTz02e8BhS6dmB6CsH4xnj+R+i3+EiwzVzJE= From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Cc: linux-renesas-soc@vger.kernel.org, kieran.bingham@ideasonboard.com Subject: [PATCH v2] drm: rcar-du: dw-hdmi: Reject modes with a too high clock frequency Date: Tue, 4 Dec 2018 18:36:40 +0200 Message-Id: <20181204163640.316-1-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Implement a .mode_valid() handler in the R-Car glue layer to reject modes with an unsupported clock frequency. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) Changes since v1: - Add a comment to explain where the limit comes from diff --git a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c index 75490a3e0a2a..603bb340e8cf 100644 --- a/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c +++ b/drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c @@ -35,6 +35,20 @@ static const struct rcar_hdmi_phy_params rcar_hdmi_phy_params[] = { { ~0UL, 0x0000, 0x0000, 0x0000 }, }; +static enum drm_mode_status +rcar_hdmi_mode_valid(struct drm_connector *connector, + const struct drm_display_mode *mode) +{ + /* + * The maximum supported clock frequency is 297 MHz, as shown in the PHY + * parameters table. + */ + if (mode->clock > 297000) + return MODE_CLOCK_HIGH; + + return MODE_OK; +} + static int rcar_hdmi_phy_configure(struct dw_hdmi *hdmi, const struct dw_hdmi_plat_data *pdata, unsigned long mpixelclock) @@ -59,6 +73,7 @@ static int rcar_hdmi_phy_configure(struct dw_hdmi *hdmi, } static const struct dw_hdmi_plat_data rcar_dw_hdmi_plat_data = { + .mode_valid = rcar_hdmi_mode_valid, .configure_phy = rcar_hdmi_phy_configure, };