Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1900638imd; Sun, 4 Nov 2018 12:03:47 -0800 (PST) X-Google-Smtp-Source: AJdET5fJMBFgedPT2hEFYa773mPHTIaRbXc/ksDwqn0Qb5EDFZ0bZdFrPYh93eddE4kqLgR6tROD X-Received: by 2002:a62:8d16:: with SMTP id z22-v6mr19429221pfd.185.1541361827442; Sun, 04 Nov 2018 12:03:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541361827; cv=none; d=google.com; s=arc-20160816; b=MUrEXaJippZGz88vEaS4lcDWcSVlhQb0O5Quxb633t1xJS6Q3FVNxucbRdwDvHkdnT qjrxBNLVEJYK/DB9b+RDt5B0Be4fj4e8060LAejoKBLnR4eGnG1Wt2rmUVXZPwIStLxT YCvtzkde/QN3qPdJlFqYOfV9qDSETUiknPWGLFKwE+PiJw+xahEK65kj0dvv7KUDM3nq yq0FZt4VVszqZ6Lt3ApHJ1/zWYX0zRxWEtlhzzfdy9+QibXM4FS89yPICseiWUfEIogU 2kk3rTGIcSPhDzikYp4zvbiddXaSvXPGB5BUVeyd7R7DLZaCVvG2Lb4bxxQgU6K/G//t FVHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=0yoTGNtDgxiWYaxjIokFqUnjLvljXhjIkHu6ZIUy6yo=; b=ib9zBkFGY2LDl0nRfzPaCmVw5x7wvOzMTXoCrz3XJ6u5Fs5+QAPUvQIPygwHd4flpU e3dOEXB8ITk8hEsTxbnonAU551eOGs8o/DSXGAxYb+B/t18uu62qIhn+dqe4gG+O5HX7 nLH/48DyeFcAzqt0w6VRkEZ67aMfdr2+9tahgHj4dsurLG+7Uzbet4Cq7ZPNDQrK8eHQ w+tjWWNqpW7H0B0ayYeGfTANsCTLBtRRWgddAQVdsqWfb87h5MehUUYe5mF4w6b83Xbn Q5oGbpbv4XcKA7L77lCRjeoDQG84CgEDJzKhVoVB0V+A7PJmKkpEZi4NXGOGWKFqT5mc DlAA== 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 f66-v6si41698010pfc.35.2018.11.04.12.03.32; Sun, 04 Nov 2018 12:03:47 -0800 (PST) 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 S2387627AbeKEDoM (ORCPT + 99 others); Sun, 4 Nov 2018 22:44:12 -0500 Received: from mailoutvs22.siol.net ([185.57.226.213]:47511 "EHLO mail.siol.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387616AbeKEDoL (ORCPT ); Sun, 4 Nov 2018 22:44:11 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTP id 7F227521257; Sun, 4 Nov 2018 19:28:17 +0100 (CET) X-Virus-Scanned: amavisd-new at psrvmta11.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta11.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id coJbQlaTzQkU; Sun, 4 Nov 2018 19:28:17 +0100 (CET) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTPS id D71B75212AF; Sun, 4 Nov 2018 19:28:15 +0100 (CET) Received: from localhost.localdomain (cpe1-8-82.cable.triera.net [213.161.8.82]) (Authenticated sender: 031275009) by mail.siol.net (Postfix) with ESMTPSA id 65A8B521292; Sun, 4 Nov 2018 19:28:13 +0100 (CET) From: Jernej Skrabec To: maxime.ripard@bootlin.com, wens@csie.org Cc: robh+dt@kernel.org, mturquette@baylibre.com, sboyd@kernel.org, airlied@linux.ie, architt@codeaurora.org, a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, 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, jernej.skrabec@siol.net Subject: [PATCH v3 16/28] drm/sun4i: dw-hdmi: Make mode_valid function configurable Date: Sun, 4 Nov 2018 19:26:53 +0100 Message-Id: <20181104182705.18047-17-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181104182705.18047-1-jernej.skrabec@siol.net> References: <20181104182705.18047-1-jernej.skrabec@siol.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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. Reviewed-by: Chen-Yu Tsai 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/sun4= i/sun8i_dw_hdmi.c index ed2983770e9c..ec122136ee9d 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c @@ -5,6 +5,7 @@ =20 #include #include +#include #include =20 #include @@ -33,8 +34,8 @@ static const struct drm_encoder_funcs sun8i_dw_hdmi_enc= oder_funcs =3D { }; =20 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, str= uct device *master, hdmi->dev =3D &pdev->dev; encoder =3D &hdmi->encoder; =20 + hdmi->quirks =3D of_device_get_match_data(dev); + encoder->possible_crtcs =3D sun8i_dw_hdmi_find_possible_crtcs(drm, dev->of_node); /* @@ -168,7 +171,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, str= uct device *master, =20 sun8i_hdmi_phy_init(hdmi->phy); =20 - plat_data->mode_valid =3D &sun8i_dw_hdmi_mode_valid; + plat_data->mode_valid =3D hdmi->quirks->mode_valid; plat_data->phy_ops =3D sun8i_hdmi_phy_get_ops(); plat_data->phy_name =3D "sun8i_dw_hdmi_phy"; plat_data->phy_data =3D hdmi->phy; @@ -230,8 +233,15 @@ static int sun8i_dw_hdmi_remove(struct platform_devi= ce *pdev) return 0; } =20 +static const struct sun8i_dw_hdmi_quirks sun8i_a83t_quirks =3D { + .mode_valid =3D sun8i_dw_hdmi_mode_valid_a83t, +}; + static const struct of_device_id sun8i_dw_hdmi_dt_ids[] =3D { - { .compatible =3D "allwinner,sun8i-a83t-dw-hdmi" }, + { + .compatible =3D "allwinner,sun8i-a83t-dw-hdmi", + .data =3D &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/sun4= i/sun8i_dw_hdmi.h index 7fdc1ecd2892..a645b8bc9f58 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h @@ -170,6 +170,11 @@ struct sun8i_hdmi_phy { struct sun8i_hdmi_phy_variant *variant; }; =20 +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; @@ -178,6 +183,7 @@ struct sun8i_dw_hdmi { struct sun8i_hdmi_phy *phy; struct dw_hdmi_plat_data plat_data; struct regulator *regulator; + const struct sun8i_dw_hdmi_quirks *quirks; struct reset_control *rst_ctrl; }; =20 --=20 2.19.1