From patchwork Mon Mar 11 13:36:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 160 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 171603F087 for ; Mon, 11 Mar 2019 14:38:08 +0100 (CET) Received: by mail-pf1-f200.google.com with SMTP id z1sf6170840pfz.8 for ; Mon, 11 Mar 2019 06:38:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1552311487; cv=pass; d=google.com; s=arc-20160816; b=X8yCoofVMr2GBgBfY66lZ6WVdw6+3vq0UbSZd9//u8dMVX7DhuDxULGhi7bMeY6GiT SCrK3dzRwq/GRHNYUPPv5ElcogzDPvgFx9i4UVyiqp1XEHygHnYj8uHvWvemtpm1A/pt +zS5VGiGgTvvyUvwzGdXEHiFUdFZY8tiMWjdaNEHKe8BBMbxrhaT4vIwVhSTWEOMp5RD K8bMOfUgrwEWt1/9lA4+C6kJi+/qWol4fC8jIeh/H4ZU3Q3cPPPJd3tBqpteyx6Uj+2G vpFqRM8GFkQs1/3uu1SLAiUgusWt2ti/nC/jjaXzkAe911DE8Wt5DuFNQJTPUyBTYAZu FiBQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=L4cMdXM/wegieFl3zHRm7z+J+QdKjCWF4aBkXH+5x/I=; b=Io4kPQirA3idxNXr1C9n6OD2bJ/+4en/V/eigeIa2IZsqD7fvjstdzhGSaaz7D96EX uXUCVTb/+8LRDRRUMOPO0NEaKPXP1OuZgBeEqr8BnaUDf/pbAVYf32ULuMJz+54v7wbA l+NzPhr+HJKh2U75Z9H+GH5G7l/Fk/Oc1W7uOJ1S6YNRDb/08t5BB3Y0hc68hwo3tQKD tX5xjR5LKiIPvzf1FNedrDBqwsejlW1vH7niYrNKEnWilje53XSp7Me6TrCROWwdVdnj IB7ZBMWoWb3DkyzQSc+ClybpfmukonBPaobJm2bhLVNuIHG4qd9tnvehGvmY5Dp+NPka Hzlw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FHFikPl0; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=L4cMdXM/wegieFl3zHRm7z+J+QdKjCWF4aBkXH+5x/I=; b=E3xj0w5kQdCON84eY/+2THc6r98kW6XPtiJ16IfgxeU2tg0c5QYGDrKFrRdSEod9rm Ckx3aDyx93Gh5YTdiPSw5DdBzc9HK31utlZLpxFxL+S1BAojenYqz/BR2pWb+srOSCrT 5PGa3zcphOEPxeug1fZk5u3cF3+7e/iHt2t9s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=L4cMdXM/wegieFl3zHRm7z+J+QdKjCWF4aBkXH+5x/I=; b=jXt5gQau0RvRiG6O6r6+UwbWVCVROUXkyrFhlJeQpGwz4JNtuJDut+KyVRcf7JUDET YJre/XHNgtOziqz8osjA2A4vaTgnJWQziAII1EVtlefyIGXo1AZeNWJQ54F3fmPWZDaz 216nSoaSZ05jkVnJu1QUaYMmtPcHVCTr1wvVoxUrlyzt0xHP9pMmxr4rjiT+/g/BdThz 4XQWb7dn6AK6aOPGc2N6N+LchzWxOwLHK2lGxmxH908PL7uBv78TaEhoybNlksZPGloZ 5UqZ1v9Wxb5jz89ZThTy5hb7qhCMfSKvVqov8rzrgLm+xEAsIVw8Nqp5/et8Rnhg7/oJ PKkw== X-Gm-Message-State: APjAAAVPnMP228yYjpe5+pdku1/oHLmFBHwBjGebooP+z68YG4eapjIG gPbyfUgQMpulaVDeBMDURkr6AJs9 X-Google-Smtp-Source: APXvYqzQPBB3DyUXS8TlpfXwH6dil2yvn8FR84KpfJC0pFNAD7xg6hj6+tiwWZXGU/XhQ0nHsWepwA== X-Received: by 2002:a62:1415:: with SMTP id 21mr12126713pfu.9.1552311486909; Mon, 11 Mar 2019 06:38:06 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:68c7:: with SMTP id d190ls6127275pgc.3.gmail; Mon, 11 Mar 2019 06:38:06 -0700 (PDT) X-Received: by 2002:a63:ad4f:: with SMTP id y15mr5923672pgo.5.1552311486525; Mon, 11 Mar 2019 06:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552311486; cv=none; d=google.com; s=arc-20160816; b=PdKKozlmGPwYKtGq9PPaLla8nSJM5RNEZosLQ2h3C6BuaOyAQFoud7PGRe4iGCPWtS h7k/g2N2odgA9un5uHauhf9C8HOeD0wTl9wpSorK4wI9qbplzTkOCEyAQcFQEDB6iTgw JNgocKe+p8mUUboJeMIHtNk++D0yUt4AdIQu54g9THKakHfuFFgkIrN7lsmEOM/uAqvT I8Tz7gxTsIiDrZT8CDi/4OyQqcBqsdl4BjTs7xNf+MLyn6oGa/kDoG4mA84ec4DjkPuX LaF5saDbW5Jlb8iFNNrdfS8aWKZwtSeimIckcdjrCqVqv6u+mVqUX2I7ik7/4k3b7m5q n05A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ji/qwC/DQKZSBaaS9TqlAOwzz5Vf5lhGPWQ9JxpSNtE=; b=V3RNc4x5IgdWQ5jB35JKJE81HXHCR1Qeq/JeC197ZxlEyY/t7guz2r0hnuHwxIu6aA SH7BA61LAMArtNItijLr/jZXo1KjcorFM6ThKMNxP27bxB/DS5xcNFrmJydzZPKB8J9k S+fFcx3mmAAmwiyIxAcIkXlmoEpWApfntnIzlaOhAasHzLR/D5l2fllJhCpS2rzLhmug 4n60xd7ggqVCufXuaM0BxI6HKABZp6tT5ANlLeoRImb++Dr0APwPMktNEETSQvSRpB1X VKhLqANp3xqONQwIJxnhuva+hBx/xQwG8dzYrzyXRcHfW5wTyfq9kJ9/ojboBVf70pEP SDLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FHFikPl0; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id f4sor8219797pgq.28.2019.03.11.06.38.06 for (Google Transport Security); Mon, 11 Mar 2019 06:38:06 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a65:60c7:: with SMTP id r7mr30943274pgv.37.1552311486234; Mon, 11 Mar 2019 06:38:06 -0700 (PDT) Received: from localhost.localdomain ([183.82.224.199]) by smtp.gmail.com with ESMTPSA id s79sm9960397pfa.61.2019.03.11.06.38.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2019 06:38:05 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , Michael Turquette , Rob Herring , Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-sunxi@googlegroups.com, Jagan Teki Subject: [PATCH v8 10/15] drm/sun4i: sun6i_mipi_dsi: Add has_mod_clk quirk Date: Mon, 11 Mar 2019 19:06:32 +0530 Message-Id: <20190311133637.18334-11-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190311133637.18334-1-jagan@amarulasolutions.com> References: <20190311133637.18334-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FHFikPl0; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , As per the user manual, look like mod clock is not mandatory for all Allwinner MIPI DSI controllers, it is connected to CLK_DSI_SCLK for A31 and not available in A64. So add has_mod_clk quirk and process the clk accordingly. Signed-off-by: Jagan Teki Tested-by: Merlijn Wajer --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 38 ++++++++++++++++++-------- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 5 ++++ 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index f42ea806f6c8..2a63e96aaff9 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -1126,6 +1127,7 @@ static int sun6i_dsi_probe(struct platform_device *pdev) dsi->dev = dev; dsi->host.ops = &sun6i_dsi_host_ops; dsi->host.dev = dev; + dsi->variant = of_device_get_match_data(dev); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(dev, res); @@ -1153,17 +1155,20 @@ static int sun6i_dsi_probe(struct platform_device *pdev) return PTR_ERR(dsi->reset); } - dsi->mod_clk = devm_clk_get(dev, "mod"); - if (IS_ERR(dsi->mod_clk)) { - dev_err(dev, "Couldn't get the DSI mod clock\n"); - return PTR_ERR(dsi->mod_clk); + if (dsi->variant->has_mod_clk) { + dsi->mod_clk = devm_clk_get(dev, "mod"); + if (IS_ERR(dsi->mod_clk)) { + dev_err(dev, "Couldn't get the DSI mod clock\n"); + return PTR_ERR(dsi->mod_clk); + } } /* * In order to operate properly, that clock seems to be always * set to 297MHz. */ - clk_set_rate_exclusive(dsi->mod_clk, 297000000); + if (dsi->variant->has_mod_clk) + clk_set_rate_exclusive(dsi->mod_clk, 297000000); dsi->dphy = devm_phy_get(dev, "dphy"); if (IS_ERR(dsi->dphy)) { @@ -1193,7 +1198,8 @@ static int sun6i_dsi_probe(struct platform_device *pdev) err_pm_disable: pm_runtime_disable(dev); err_unprotect_clk: - clk_rate_exclusive_put(dsi->mod_clk); + if (dsi->variant->has_mod_clk) + clk_rate_exclusive_put(dsi->mod_clk); return ret; } @@ -1205,7 +1211,8 @@ static int sun6i_dsi_remove(struct platform_device *pdev) component_del(&pdev->dev, &sun6i_dsi_ops); mipi_dsi_host_unregister(&dsi->host); pm_runtime_disable(dev); - clk_rate_exclusive_put(dsi->mod_clk); + if (dsi->variant->has_mod_clk) + clk_rate_exclusive_put(dsi->mod_clk); return 0; } @@ -1222,7 +1229,8 @@ static int __maybe_unused sun6i_dsi_runtime_resume(struct device *dev) } reset_control_deassert(dsi->reset); - clk_prepare_enable(dsi->mod_clk); + if (dsi->variant->has_mod_clk) + clk_prepare_enable(dsi->mod_clk); /* * Enable the DSI block. @@ -1250,7 +1258,8 @@ static int __maybe_unused sun6i_dsi_runtime_suspend(struct device *dev) { struct sun6i_dsi *dsi = dev_get_drvdata(dev); - clk_disable_unprepare(dsi->mod_clk); + if (dsi->variant->has_mod_clk) + clk_disable_unprepare(dsi->mod_clk); reset_control_assert(dsi->reset); regulator_disable(dsi->regulator); @@ -1263,9 +1272,16 @@ static const struct dev_pm_ops sun6i_dsi_pm_ops = { NULL) }; +static const struct sun6i_dsi_variant sun6i_a31_mipi_dsi = { + .has_mod_clk = true, +}; + static const struct of_device_id sun6i_dsi_of_table[] = { - { .compatible = "allwinner,sun6i-a31-mipi-dsi" }, - { } + { + .compatible = "allwinner,sun6i-a31-mipi-dsi", + .data = &sun6i_a31_mipi_dsi, + }, + { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, sun6i_dsi_of_table); diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index c570f2b3868f..5c4983212f89 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -15,6 +15,10 @@ #include +struct sun6i_dsi_variant { + bool has_mod_clk; +}; + struct sun6i_dsi { struct drm_connector connector; struct drm_encoder encoder; @@ -32,6 +36,7 @@ struct sun6i_dsi { struct sun4i_tcon *tcon; struct mipi_dsi_device *device; struct drm_panel *panel; + const struct sun6i_dsi_variant *variant; }; static inline struct sun6i_dsi *host_to_sun6i_dsi(struct mipi_dsi_host *host)