Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2682784ybh; Mon, 16 Mar 2020 07:48:13 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsnd0e+eZbcNHqwl7UP3Wh7GQmfcDp/p85FO5IllKDSSQa1hXIeErrcDo9CSAsHHmGDHAhg X-Received: by 2002:a9d:67c3:: with SMTP id c3mr23030886otn.340.1584370093660; Mon, 16 Mar 2020 07:48:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584370093; cv=none; d=google.com; s=arc-20160816; b=01mPSEd+Ba3eL4ISBIUprnTSSDXQmK5Df+h2JBq/eGmXViP5xZZVjTGJm+Ccmli6l2 yg+yIbPWWpJrZD04kmA2YseOY9qsaD4oy9p4yP8gsgLCQMIETmZ1vF5ABiPIxsu9wgUy kCX2Lm6lIVaWLbG0EamrpIkwSSWmkj0xjBVfBe+g01LoV/CLe3VUNFsoVb3BQcyH+Q2j kQ9NRReH9hkZOxwLEIrV9QSecXKteO08JVOHa2NS9zDCVFi9yCWv7S3klkO2AVBo2wZg /yQdzyURCfq+uxJGM9VRmoBC+mdqHeLUBN5IdvG/mOuk4+Pv5f6rwLM+ifg033SFHSPC rSIQ== 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 :dkim-signature; bh=qWphxSgX8tvaA0uw7BWq3V+wrEdvIdlDRQbV6qHrzjg=; b=gkd69+lfJgXL9HHzFZt7rP/xokMW5pBxsMHorfqwA/JPKVKZLMrRahV1hrOMUJ4A2x jlZNSQu1ZmzpzPXuWClNYIxkZol8FCXvjDiQc/h1P5VVue12fBt3Xj1AbLdOZmbm/PRl hYs8/Mx+1fapTd/UqsZnB4HLv/uwew6lZoK+6lWkKRHV0KF+J43I0v/MUrghGyZP4v3z qgsA/4OJS6OUDyh7DJqZQpN4CdmOhvFJMGavmuDPMXrP4h2M5NEVArHBxn/s0S7ismH8 4RiZp6oEnxVU+gpI7CNd9lrkeG8DFZ9W4Muzve6Ez9IubJ+U1r2MKG+ungltPv/lg8M2 /iew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b="JHt/AE69"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i62si92903oih.41.2020.03.16.07.48.00; Mon, 16 Mar 2020 07:48:13 -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; dkim=pass header.i=@synopsys.com header.s=mail header.b="JHt/AE69"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731693AbgCPOrF (ORCPT + 99 others); Mon, 16 Mar 2020 10:47:05 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.73.133]:34142 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731445AbgCPOq7 (ORCPT ); Mon, 16 Mar 2020 10:46:59 -0400 Received: from mailhost.synopsys.com (mdc-mailhost1.synopsys.com [10.225.0.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 5D5FF400B0; Mon, 16 Mar 2020 14:46:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1584370018; bh=LN9uKbzVNlSJ2O4zRB08l1ExGsQQvCBB7mmSYtvGZrc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JHt/AE69tmQHie6O79odi3mt5wnEPoAqmp0CGrK+zwUL+u34z3hWbVYxVWlP+fZ0G tiVk6+wPCTwkWxtU4abWJATQhAJhZIAvZstkVT+NVFpRXiayMhrYcg7GPDafYy2gUm QscLCvxLV4N4KtEIZMpYazinlKbz6jGWW1CxXOVpYy2kuy7FL5eUEq8lSZqCaw/daY 2lxkBJZ7mEs0I0GGH0IazfTW8ZZa9Y0gSmNmQC7XNgKJHT9iG8kZhr8jTAvmfscn1R 4OOjXILGNzb1n9kxxeI8brN7hSPhAKLvWKuPE5QVCf5yRf4/xkANwRutFJPhRO4/Dv /03O4DT6UoRBw== Received: from paltsev-e7480.internal.synopsys.com (unknown [10.121.8.79]) by mailhost.synopsys.com (Postfix) with ESMTP id 6520DA005F; Mon, 16 Mar 2020 14:46:56 +0000 (UTC) From: Eugeniy Paltsev To: dri-devel@lists.freedesktop.org, Alexey Brodkin Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , devicetree@vger.kernel.org, Rob Herring , Eugeniy Paltsev Subject: [PATCH 1/2] DRM: ARC: add HDMI 2.0 TX encoder support Date: Mon, 16 Mar 2020 17:46:46 +0300 Message-Id: <20200316144647.10416-2-Eugeniy.Paltsev@synopsys.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200316144647.10416-1-Eugeniy.Paltsev@synopsys.com> References: <20200316144647.10416-1-Eugeniy.Paltsev@synopsys.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Synopsys ARC SoCs (like HSDK4xD) include on-chip DesignWare HDMI encoders. Support them with a platform driver to provide platform glue data to the dw-hdmi driver. Signed-off-by: Eugeniy Paltsev --- MAINTAINERS | 6 ++ drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/arc/Kconfig | 7 ++ drivers/gpu/drm/arc/Makefile | 1 + drivers/gpu/drm/arc/arc-dw-hdmi.c | 126 ++++++++++++++++++++++++++++++ 5 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/arc/arc-dw-hdmi.c diff --git a/MAINTAINERS b/MAINTAINERS index a6fbdf354d34..a6dd992c5f95 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1258,6 +1258,12 @@ S: Supported F: drivers/gpu/drm/arc/ F: Documentation/devicetree/bindings/display/snps,arcpgu.txt +ARC DW HDMI DRIVER +M: Eugeniy Paltsev +S: Supported +F: drivers/gpu/drm/arc/arc-dw-hdmi.c +F: Documentation/devicetree/bindings/display/bridge/snps,arc-dw-hdmi.txt + ARCNET NETWORK LAYER M: Michael Grzeschik L: netdev@vger.kernel.org diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 6493088a0fdd..5b0bcf7f45cd 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -109,7 +109,7 @@ obj-y += panel/ obj-y += bridge/ obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu/ obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/ -obj-$(CONFIG_DRM_ARCPGU)+= arc/ +obj-y += arc/ obj-y += hisilicon/ obj-$(CONFIG_DRM_ZTE) += zte/ obj-$(CONFIG_DRM_MXSFB) += mxsfb/ diff --git a/drivers/gpu/drm/arc/Kconfig b/drivers/gpu/drm/arc/Kconfig index e8f3d63e0b91..baec9d2a4fba 100644 --- a/drivers/gpu/drm/arc/Kconfig +++ b/drivers/gpu/drm/arc/Kconfig @@ -8,3 +8,10 @@ config DRM_ARCPGU Choose this option if you have an ARC PGU controller. If M is selected the module will be called arcpgu. + +config DRM_ARC_DW_HDMI + tristate "ARC DW HDMI" + depends on DRM && OF + select DRM_DW_HDMI + help + Synopsys DW HDMI driver for various ARC development boards diff --git a/drivers/gpu/drm/arc/Makefile b/drivers/gpu/drm/arc/Makefile index c7028b7427b3..7a156d8c2c3c 100644 --- a/drivers/gpu/drm/arc/Makefile +++ b/drivers/gpu/drm/arc/Makefile @@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_sim.o arcpgu_drv.o obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o +obj-$(CONFIG_DRM_ARC_DW_HDMI) += arc-dw-hdmi.o diff --git a/drivers/gpu/drm/arc/arc-dw-hdmi.c b/drivers/gpu/drm/arc/arc-dw-hdmi.c new file mode 100644 index 000000000000..4869dd668a51 --- /dev/null +++ b/drivers/gpu/drm/arc/arc-dw-hdmi.c @@ -0,0 +1,126 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Synopsys DW HDMI driver for various ARC development boards +// +// Copyright (C) 2020 Synopsys +// Author: Eugeniy Paltsev + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const struct dw_hdmi_mpll_config snps_hdmi_mpll_cfg[] = { + { + 27000000, { + { 0x00B3, 0x0000 }, + { 0x00B3, 0x0000 }, + { 0x00B3, 0x0000 } + }, + }, { + 74250000, { + { 0x0072, 0x0001}, + { 0x0072, 0x0001}, + { 0x0072, 0x0001} + }, + }, { + 148500000, { + { 0x0051, 0x0002}, + { 0x0051, 0x0002}, + { 0x0051, 0x0002} + }, + }, { + ~0UL, { + { 0x00B3, 0x0000 }, + { 0x00B3, 0x0000 }, + { 0x00B3, 0x0000 }, + }, + } +}; + +static const struct dw_hdmi_curr_ctrl snps_hdmi_cur_ctr[] = { + /* pixelclk bpp8 bpp10 bpp12 */ + { 27000000, { 0x0000, 0x0000, 0x0000 }, }, + { 74250000, { 0x0008, 0x0008, 0x0008 }, }, + { 148500000, { 0x001b, 0x001b, 0x001b }, }, + { ~0UL, { 0x0000, 0x0000, 0x0000 }, } +}; + + +static const struct dw_hdmi_phy_config snps_hdmi_phy_config[] = { + /* pixelclk symbol term vlev */ + { 27000000, 0x8009, 0x0004, 0x0232}, + { 74250000, 0x8009, 0x0004, 0x0232}, + { 148500000, 0x8009, 0x0004, 0x0232}, + { ~0UL, 0x8009, 0x0004, 0x0232} +}; + +static enum drm_mode_status snps_dw_hdmi_mode_valid(struct drm_connector *con, + const struct drm_display_mode *mode) +{ + return MODE_OK; +} + +static struct dw_hdmi_plat_data snps_dw_hdmi_drv_data = { + .mpll_cfg = snps_hdmi_mpll_cfg, + .cur_ctr = snps_hdmi_cur_ctr, + .phy_config = snps_hdmi_phy_config, + .mode_valid = snps_dw_hdmi_mode_valid, +}; + +static const struct of_device_id snps_dw_hdmi_dt_ids[] = { + { + .compatible = "snps,dw-hdmi-hsdk", + .data = &snps_dw_hdmi_drv_data + }, { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, snps_dw_hdmi_dt_ids); + +static int snps_dw_hdmi_probe(struct platform_device *pdev) +{ + const struct dw_hdmi_plat_data *plat_data; + const struct of_device_id *match; + struct dw_hdmi *hdmi; + + if (!pdev->dev.of_node) + return -ENODEV; + + match = of_match_node(snps_dw_hdmi_dt_ids, pdev->dev.of_node); + plat_data = match->data; + + hdmi = dw_hdmi_probe(pdev, plat_data); + if (IS_ERR(hdmi)) + return PTR_ERR(hdmi); + + platform_set_drvdata(pdev, hdmi); + + return 0; +} + +static int snps_dw_hdmi_remove(struct platform_device *pdev) +{ + struct dw_hdmi *hdmi = platform_get_drvdata(pdev); + + dw_hdmi_remove(hdmi); + + return 0; +} + +static struct platform_driver snps_dw_hdmi_platform_driver = { + .probe = snps_dw_hdmi_probe, + .remove = snps_dw_hdmi_remove, + .driver = { + .name = KBUILD_MODNAME, + .of_match_table = snps_dw_hdmi_dt_ids, + }, +}; +module_platform_driver(snps_dw_hdmi_platform_driver); + +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("ARC specific DW-HDMI driver extension"); +MODULE_AUTHOR("Eugeniy Paltsev "); -- 2.21.1