Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp841127imm; Sun, 2 Sep 2018 00:31:29 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda5vti3Ob7q0Rw3P9Hfe0+Q/UEDKMND1NYLfm4o7Xw3A+xxvho09Y0lp5wACbfP1lLQsvZo X-Received: by 2002:a63:e516:: with SMTP id r22-v6mr21538736pgh.170.1535873489571; Sun, 02 Sep 2018 00:31:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535873489; cv=none; d=google.com; s=arc-20160816; b=dQOdYUp4dOY1OB1+4WhxoF6xVoDTf4ezqqN9kSYENf+oHm4H2tlGm4+LG5bHGP68z7 rWDxOMJJlFAsQ9Qv1CsoF4GH1hl6TRl20+3mUcLaaVQwZVeR2vgRmGAEr/ENBSZIJVvY 3XDHsEY2Z7ey4aoW8HEzDvy0JFFEbtv+1CSJBytNG8I31X1ZsG/c0c7/tWyWTSmC76k5 6GLCZZ1MVrzthK+fNOZSMczOqvyrqynScnPH7ntjDTMXkIMfWfro2IBCPU7uFSVbdLQx y+Fyi9PInWChIzc8efDfXoU2VYq1spGRp/k+8NfWsGz/JtDGHHi/4peJRsNrQ4KufBWO DkXA== 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=lfwTCnkOa7Gb9iQY739pdsMwnX+qAqIwavAo7eq/iyw=; b=Ebiso7QQZDJtwNsj9eLSle63Q72IBIWwslAaB98yQKZsWEhOU9EvBKrUDeLAUUunve 6VCH7OhM1cZ5Jetz3C7TFhWHRf7+qB7He+qR9RBv4AQtjLxHKU+RrbgSBU5JKtni+2ps gW/KvfAX76Y7+3RfCo659czt4IG0K+Gq54TraLMAOa+/MqPUkuz+iwCoLYi2zp7//A7I NZUBM00p8OM/qY4/L6TwCD92wp0XxNSpAh0WiFGPHYXDxbzV0wPeCjMH8TaeFRSBxOh+ AaoPJXR4u/nmSFeZjDRLe+dzHYnyWOaucRt78vus0DHXTvic90rbNhot7FCV7hJkqUbY gTHA== 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 g21-v6si15061873pgk.232.2018.09.02.00.31.14; Sun, 02 Sep 2018 00:31:29 -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 S1727523AbeIBLmb (ORCPT + 99 others); Sun, 2 Sep 2018 07:42:31 -0400 Received: from mailoutvs61.siol.net ([185.57.226.252]:54911 "EHLO mail.siol.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727415AbeIBLma (ORCPT ); Sun, 2 Sep 2018 07:42:30 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTP id 6003C520C9D; Sun, 2 Sep 2018 09:27:40 +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 of7ymJpEltlG; Sun, 2 Sep 2018 09:27:39 +0200 (CEST) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTPS id CD716520C96; Sun, 2 Sep 2018 09:27:39 +0200 (CEST) Received: from localhost.localdomain (unknown [194.152.15.144]) (Authenticated sender: 031275009) by mail.siol.net (Postfix) with ESMTPSA id 4E09B520C9D; Sun, 2 Sep 2018 09:27:37 +0200 (CEST) From: Jernej Skrabec To: robh+dt@kernel.org, maxime.ripard@bootlin.com, wens@csie.org Cc: mark.rutland@arm.com, mturquette@baylibre.com, sboyd@kernel.org, airlied@linux.ie, architt@codeaurora.org, a.hajda@samsung.com, jernej.skrabec@siol.net, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com Subject: [PATCH 16/27] drm/sun4i: dw-hdmi: Make mode_valid function configurable Date: Sun, 2 Sep 2018 09:26:32 +0200 Message-Id: <20180902072643.4917-17-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180902072643.4917-1-jernej.skrabec@siol.net> References: <20180902072643.4917-1-jernej.skrabec@siol.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since it is not possible to access sun8i-dw-hdmi driver private data inside mode_valid function, make it configurable. That way different versions of HDMI controllers can set different function, depending on it's limitations. Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 18 ++++++++++++++---- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 6 ++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c index 31875b636434..a5020fe8bd69 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -33,8 +34,8 @@ static const struct drm_encoder_funcs sun8i_dw_hdmi_encoder_funcs = { }; static enum drm_mode_status -sun8i_dw_hdmi_mode_valid(struct drm_connector *connector, - const struct drm_display_mode *mode) +sun8i_dw_hdmi_mode_valid_a83t(struct drm_connector *connector, + const struct drm_display_mode *mode) { if (mode->clock > 297000) return MODE_CLOCK_HIGH; @@ -102,6 +103,8 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, hdmi->dev = &pdev->dev; encoder = &hdmi->encoder; + hdmi->quirks = of_device_get_match_data(dev); + encoder->possible_crtcs = sun8i_dw_hdmi_find_possible_crtcs(drm, dev->of_node); /* @@ -156,7 +159,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, sun8i_hdmi_phy_init(hdmi->phy); - plat_data->mode_valid = &sun8i_dw_hdmi_mode_valid; + plat_data->mode_valid = hdmi->quirks->mode_valid; plat_data->phy_ops = sun8i_hdmi_phy_get_ops(); plat_data->phy_name = "sun8i_dw_hdmi_phy"; plat_data->phy_data = hdmi->phy; @@ -215,8 +218,15 @@ static int sun8i_dw_hdmi_remove(struct platform_device *pdev) return 0; } +static const struct sun8i_dw_hdmi_quirks sun8i_a83t_quirks = { + .mode_valid = sun8i_dw_hdmi_mode_valid_a83t, +}; + static const struct of_device_id sun8i_dw_hdmi_dt_ids[] = { - { .compatible = "allwinner,sun8i-a83t-dw-hdmi" }, + { + .compatible = "allwinner,sun8i-a83t-dw-hdmi", + .data = &sun8i_a83t_quirks, + }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, sun8i_dw_hdmi_dt_ids); diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h index aadbe0a10b0c..b718c47e00be 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h @@ -169,6 +169,11 @@ struct sun8i_hdmi_phy { struct sun8i_hdmi_phy_variant *variant; }; +struct sun8i_dw_hdmi_quirks { + enum drm_mode_status (*mode_valid)(struct drm_connector *connector, + const struct drm_display_mode *mode); +}; + struct sun8i_dw_hdmi { struct clk *clk_tmds; struct device *dev; @@ -176,6 +181,7 @@ struct sun8i_dw_hdmi { struct drm_encoder encoder; struct sun8i_hdmi_phy *phy; struct dw_hdmi_plat_data plat_data; + const struct sun8i_dw_hdmi_quirks *quirks; struct reset_control *rst_ctrl; }; -- 2.18.0