Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp128197pxw; Fri, 8 Apr 2022 03:16:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrGCOHe0YRLo3YNTnUcxbeV44SldTHV0wtrolhoKnq1oC4nrVB47WSn+kg6e6tZ+ZI5BgE X-Received: by 2002:a17:90a:2a84:b0:1ca:aefa:91b3 with SMTP id j4-20020a17090a2a8400b001caaefa91b3mr21297537pjd.104.1649412980300; Fri, 08 Apr 2022 03:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649412980; cv=none; d=google.com; s=arc-20160816; b=ChgX0H3DknhDEEoPY/ZDgIDROuO0dN78gYuHgy/Q4ric7NtiJw3gpbfdeaFCAG2iNf wA3L8BKLCMYxWwWcbz7dkAqQrTsB1gSek4Wy43R8afBENU27wVnEpCXmNTWQah90kgoD SOjHkv3YzP3B+gaDxM3w0CfTKD2vkHJ8C3n8RzuGDbp0QQTFRy2FyRb8vpIOsA304MIE WQbz+hVlDSjAukCBa/PV2liUpN0LEkLTLTrtc1p2anAZxlpadrFN0C3Hvv9f0OnKQNj+ Ff1halqnB21ZiG05qNfk0vZuW3jgi0lpDMGG8Et2SRF2pZaq32b73gqSVJLvjym21ulN N8Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:cc:to:subject:from:date :dkim-signature; bh=NrebAZrO+cMXZp6CaRNO+bsoFWQqrGGUkEnoihN5xWs=; b=BotV11kw/Rud3E27PPPXTcY0hOR3xgc5OEUDJEU4s3wKz7+5H9q5SlqeQ/MygUyxRC 6Cjq+Q+dCfMi6umur1M/wSwETWjOunaqaxwM7lM6qveK7qaTJubqj6EBSn74sF0irASd KfkY7AjwTWlLypJYt9y8TmPESVhXzuiGH7FipxIcyeXscwR74uefueOd8nlaXt/bRhC/ tqoQc+hLvo51Snelg8SAg+GHvoa7k9LwAvR/1c4gInaIrwyeFwk/sjnEXF7eKzFsiNBe bCy0tb297SciWTmiEtAk8gzP+7pRyqgdfxQY6w7mC+uo8rRg3MXQjTmSXFkUneZCUX7u j41g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=MQYgpLVv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d4-20020a170902728400b00155f7af1822si375391pll.484.2022.04.08.03.16.04; Fri, 08 Apr 2022 03:16:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=MQYgpLVv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231694AbiDHJk7 (ORCPT + 99 others); Fri, 8 Apr 2022 05:40:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229825AbiDHJk5 (ORCPT ); Fri, 8 Apr 2022 05:40:57 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E18E013F2B; Fri, 8 Apr 2022 02:38:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1649410729; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NrebAZrO+cMXZp6CaRNO+bsoFWQqrGGUkEnoihN5xWs=; b=MQYgpLVvrULNIgrboUzg9K7r/BL1qhCJH2swSW53nukPGpWNhy0WYujcm5bZQlBIHbnG9T w+LprBkTUAsdopa7B81SeZTwlDHLsMr5aCuAHFmEtZKIfjPG7CneBAucIygR/tVO4Avfly /8j/0b+RpGf+2VwXoRSgIdrFa2S+KfQ= Date: Fri, 08 Apr 2022 10:38:38 +0100 From: Paul Cercueil Subject: Re: [PATCH v18 3/3] drm/ingenic: Add dw-hdmi driver specialization for jz4780 To: "H. Nikolaus Schaller" Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Paul Boddie , Laurent Pinchart , Jernej Skrabec , David Airlie , Daniel Vetter , Maxime Ripard , Kieran Bingham , Jonas Karlman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mips@vger.kernel.org, letux-kernel@openphoenux.org, Ezequiel Garcia Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Le jeu., avril 7 2022 at 13:16:11 +0200, H. Nikolaus Schaller=20 a =E9crit : > From: Paul Boddie >=20 > A specialisation of the generic Synopsys HDMI driver is employed for > JZ4780 HDMI support. This requires a new driver, plus device tree and > configuration modifications. >=20 > Here we add Kconfig DRM_INGENIC_DW_HDMI, Makefile and driver code. >=20 > Note that there is no hpd-gpio installed on the CI20 board HDMI > connector. Hence there is no hpd detection by the connector driver > and we have to enable polling in the dw-hdmi core driver. >=20 > For that we need to set .poll_enabled but that struct component > can only be accessed by core code. Hence we use the public > setter function drm_kms_helper_hotplug_event() introduced before. >=20 > Also note that we disable Color Space Conversion since it is not > working on jz4780. >=20 > Signed-off-by: Paul Boddie > Signed-off-by: Ezequiel Garcia > Signed-off-by: H. Nikolaus Schaller The patch looks good, if I can get an ack/review (Neil?), I can merge=20 the whole series. Cheers, -Paul > --- > drivers/gpu/drm/ingenic/Kconfig | 9 ++ > drivers/gpu/drm/ingenic/Makefile | 1 + > drivers/gpu/drm/ingenic/ingenic-dw-hdmi.c | 103=20 > ++++++++++++++++++++++ > 3 files changed, 113 insertions(+) > create mode 100644 drivers/gpu/drm/ingenic/ingenic-dw-hdmi.c >=20 > diff --git a/drivers/gpu/drm/ingenic/Kconfig=20 > b/drivers/gpu/drm/ingenic/Kconfig > index 001f59fb06d56..090830bcbde7f 100644 > --- a/drivers/gpu/drm/ingenic/Kconfig > +++ b/drivers/gpu/drm/ingenic/Kconfig > @@ -24,4 +24,13 @@ config DRM_INGENIC_IPU >=20 > The Image Processing Unit (IPU) will appear as a second primary=20 > plane. >=20 > +config DRM_INGENIC_DW_HDMI > + tristate "Ingenic specific support for Synopsys DW HDMI" > + depends on MACH_JZ4780 > + select DRM_DW_HDMI > + help > + Choose this option to enable Synopsys DesignWare HDMI based=20 > driver. > + If you want to enable HDMI on Ingenic JZ4780 based SoC, you should > + select this option. > + > endif > diff --git a/drivers/gpu/drm/ingenic/Makefile=20 > b/drivers/gpu/drm/ingenic/Makefile > index d313326bdddbb..f10cc1c5a5f22 100644 > --- a/drivers/gpu/drm/ingenic/Makefile > +++ b/drivers/gpu/drm/ingenic/Makefile > @@ -1,3 +1,4 @@ > obj-$(CONFIG_DRM_INGENIC) +=3D ingenic-drm.o > ingenic-drm-y =3D ingenic-drm-drv.o > ingenic-drm-$(CONFIG_DRM_INGENIC_IPU) +=3D ingenic-ipu.o > +obj-$(CONFIG_DRM_INGENIC_DW_HDMI) +=3D ingenic-dw-hdmi.o > diff --git a/drivers/gpu/drm/ingenic/ingenic-dw-hdmi.c=20 > b/drivers/gpu/drm/ingenic/ingenic-dw-hdmi.c > new file mode 100644 > index 0000000000000..72f8b44998a51 > --- /dev/null > +++ b/drivers/gpu/drm/ingenic/ingenic-dw-hdmi.c > @@ -0,0 +1,103 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* Copyright (C) 2011-2013 Freescale Semiconductor, Inc. > + * Copyright (C) 2019, 2020 Paul Boddie > + * > + * Derived from dw_hdmi-imx.c with i.MX portions removed. > + */ > + > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +static const struct dw_hdmi_mpll_config ingenic_mpll_cfg[] =3D { > + { 45250000, { { 0x01e0, 0x0000 }, { 0x21e1, 0x0000 }, { 0x41e2,=20 > 0x0000 } } }, > + { 92500000, { { 0x0140, 0x0005 }, { 0x2141, 0x0005 }, { 0x4142,=20 > 0x0005 } } }, > + { 148500000, { { 0x00a0, 0x000a }, { 0x20a1, 0x000a }, { 0x40a2,=20 > 0x000a } } }, > + { 216000000, { { 0x00a0, 0x000a }, { 0x2001, 0x000f }, { 0x4002,=20 > 0x000f } } }, > + { ~0UL, { { 0x0000, 0x0000 }, { 0x0000, 0x0000 }, { 0x0000,=20 > 0x0000 } } } > +}; > + > +static const struct dw_hdmi_curr_ctrl ingenic_cur_ctr[] =3D { > + /*pixelclk bpp8 bpp10 bpp12 */ > + { 54000000, { 0x091c, 0x091c, 0x06dc } }, > + { 58400000, { 0x091c, 0x06dc, 0x06dc } }, > + { 72000000, { 0x06dc, 0x06dc, 0x091c } }, > + { 74250000, { 0x06dc, 0x0b5c, 0x091c } }, > + { 118800000, { 0x091c, 0x091c, 0x06dc } }, > + { 216000000, { 0x06dc, 0x0b5c, 0x091c } }, > + { ~0UL, { 0x0000, 0x0000, 0x0000 } }, > +}; > + > +/* > + * Resistance term 133Ohm Cfg > + * PREEMP config 0.00 > + * TX/CK level 10 > + */ > +static const struct dw_hdmi_phy_config ingenic_phy_config[] =3D { > + /*pixelclk symbol term vlev */ > + { 216000000, 0x800d, 0x0005, 0x01ad}, > + { ~0UL, 0x0000, 0x0000, 0x0000} > +}; > + > +static enum drm_mode_status > +ingenic_dw_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, > + const struct drm_display_info *info, > + const struct drm_display_mode *mode) > +{ > + if (mode->clock < 13500) > + return MODE_CLOCK_LOW; > + /* FIXME: Hardware is capable of 270MHz, but setup data is missing.=20 > */ > + if (mode->clock > 216000) > + return MODE_CLOCK_HIGH; > + > + return MODE_OK; > +} > + > +static struct dw_hdmi_plat_data ingenic_dw_hdmi_plat_data =3D { > + .mpll_cfg =3D ingenic_mpll_cfg, > + .cur_ctr =3D ingenic_cur_ctr, > + .phy_config =3D ingenic_phy_config, > + .mode_valid =3D ingenic_dw_hdmi_mode_valid, > + .output_port =3D 1, > +}; > + > +static const struct of_device_id ingenic_dw_hdmi_dt_ids[] =3D { > + { .compatible =3D "ingenic,jz4780-dw-hdmi" }, > + { /* Sentinel */ }, > +}; > +MODULE_DEVICE_TABLE(of, ingenic_dw_hdmi_dt_ids); > + > +static void ingenic_dw_hdmi_cleanup(void *data) > +{ > + struct dw_hdmi *hdmi =3D (struct dw_hdmi *)data; > + > + dw_hdmi_remove(hdmi); > +} > + > +static int ingenic_dw_hdmi_probe(struct platform_device *pdev) > +{ > + struct dw_hdmi *hdmi; > + > + hdmi =3D dw_hdmi_probe(pdev, &ingenic_dw_hdmi_plat_data); > + if (IS_ERR(hdmi)) > + return PTR_ERR(hdmi); > + > + return devm_add_action_or_reset(&pdev->dev,=20 > ingenic_dw_hdmi_cleanup, hdmi); > +} > + > +static struct platform_driver ingenic_dw_hdmi_driver =3D { > + .probe =3D ingenic_dw_hdmi_probe, > + .driver =3D { > + .name =3D "dw-hdmi-ingenic", > + .of_match_table =3D ingenic_dw_hdmi_dt_ids, > + }, > +}; > +module_platform_driver(ingenic_dw_hdmi_driver); > + > +MODULE_DESCRIPTION("JZ4780 Specific DW-HDMI Driver Extension"); > +MODULE_LICENSE("GPL v2"); > +MODULE_ALIAS("platform:dw-hdmi-ingenic"); > -- > 2.33.0 >=20