Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp500485ima; Fri, 1 Feb 2019 06:36:48 -0800 (PST) X-Google-Smtp-Source: ALg8bN5jF34Y5OdstvoxghRYVnlPrA7bGWrixzuBg/wFR9KvVHrcKiCcq3BmL9fffdB/HgA2avyt X-Received: by 2002:a17:902:820d:: with SMTP id x13mr41012336pln.229.1549031808288; Fri, 01 Feb 2019 06:36:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549031808; cv=none; d=google.com; s=arc-20160816; b=rp2J8igHrK7ZZyqJMzXXSsn9WF8+PnolNLVfn8UPQ/nlX817n1ShwPxFpwZkPAOkcw h2LzphhcuO0WDyw5feZT2ngJljdMdrUMU76NeaJmprXLA+sKaZdh+iZcYMHta993BVCB V4fx0NHbUe0XAmGA+rrkIbB1OvB2SoyXOAZ+noYyj1Z4FRRh+rFfztz1aLzx754cMn4y +PmqJyI2XdaGbJIK3UqNpEB+n3xIrOYedmeQ1Yisu0PTed3/Hee35yNhDf1qzRbM9N5b kHAMUWOd9YRLAIKNxZ0njAXFOmz0bLGZkBUHkYd63bXALq3eFeNhy4jeJHKkxCslMxFm ovCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=xDTvjg/nXebcdXocsOOitS0hh02ek9EoczA/KSbNN2M=; b=xAfTybHo8J/iC/B5RrnOXlBife6fI5EyY7oWY8e+9uQRXaAf8wTHBKNpX+ppybM+Qs A2BXBnQWWaEsFmW0a0G1rLZVLtXJtxYC1XsSMntUPblRCqCWonBR6GIAEJNU61Dlp6XK FjznzCnlDv2jOQsGdRvGQNmbRqpbMiDfvTlC0vpnjRmDUdW0ZjikRBzMEbkHrUglUhdk 6ELYz5BCDYYV48KUnmIDE/0K3jGGPf/WqUROzY0r5uT9OFusEZH+niTcxLfBic9WiL/7 338r2nKaPnDkDmc07X9p0rKh9Sr/6Rht09+DJJ1WwaJ0vB+Nn1dCWFQlupdfyyR/kggC x66w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mogvw0en; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y4si7604275pfk.172.2019.02.01.06.36.32; Fri, 01 Feb 2019 06:36:48 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mogvw0en; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727945AbfBAOZ6 (ORCPT + 99 others); Fri, 1 Feb 2019 09:25:58 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:32852 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727348AbfBAOZ5 (ORCPT ); Fri, 1 Feb 2019 09:25:57 -0500 Received: by mail-wm1-f67.google.com with SMTP id r24so4671635wmh.0; Fri, 01 Feb 2019 06:25:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xDTvjg/nXebcdXocsOOitS0hh02ek9EoczA/KSbNN2M=; b=mogvw0ensvu00i3tUUrhWfrSNC6zmfH1DWpCYrScFIWYO+KwLUURPAJiPzFkzJ5kkv 3RyB+aWSWDyC5PqNQJ/JNnUcCJMCxb4P0uyS700yFNS5HGIE3BHUKoAxuCltYvfGFj4f +wiUGiwPjooDgvsiXCA7AkmZmPyqav5/gRheLGnnoWWnf9LT5vyV+Q+8Prrx4gSuaF1x bCD+PNFyCWUlewX128fZ89KfuEmHRo/mm4fTYzvwmPwiYQigls48m0UXS0NexRZH9L6F BcpGOQ2o2yjRT6DHptprZYH21exwjgPP8nW9bmB5cfDHa7B4qNCwxZ6g51J6V41SvNQU b+QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xDTvjg/nXebcdXocsOOitS0hh02ek9EoczA/KSbNN2M=; b=H5d0r0+xC8H7Rtb415H9rrUHQk6T5FDVOm/iqGgC2Z7K2n7EVr1CNlZ71ogeRxNsrv d8PKKQ33is2xrRX5/GHhAy9TYIVPs9uM1mMNu4kiCvCcIimzsL2yr5bn9I4WE0lp7Yvh tyV70y2Xep7QOLDkyuwxFslhGzxHvtfHY6x3HADypSfsEn2iYZW3WSijEF/jKp0s3jjp ePVdVzZ2FxWinLPO68lVLmWD1u2NuF/4BzmXKOAJ9ctvcetcWV2IMz6UC6pAUlJ2fZHo XDEnGUr+VqeH/I01E6w/X2Tz4ICJ5usMKRt6OJOgS2INz9FDoOF7OZSPtt7ME26lKFIi uQ3A== X-Gm-Message-State: AHQUAua4fVFJvfH8H0lhtm5jtHZPKV2N4LMz1Lbo5tExwRmL8FIEyEiw PWgZiMMzPpE+fSAw6Qt+khjQoX89Kl5K9dWCeXQ= X-Received: by 2002:a1c:2e43:: with SMTP id u64mr2740767wmu.52.1549031155288; Fri, 01 Feb 2019 06:25:55 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a1c:8b48:0:0:0:0:0 with HTTP; Fri, 1 Feb 2019 06:25:54 -0800 (PST) In-Reply-To: <20181229133318.18128-5-jbx6244@gmail.com> References: <20181229133318.18128-1-jbx6244@gmail.com> <20181229133318.18128-5-jbx6244@gmail.com> From: Johan Jonker Date: Fri, 1 Feb 2019 15:25:54 +0100 Message-ID: Subject: Re: [PATCH v2 4/7] drm: rockchip: introduce rk3066 hdmi To: heiko@sntech.de Cc: hjc@rock-chips.com, airlied@linux.ie, robh+dt@kernel.org, mark.rutland@arm.com, mturquette@baylibre.com, sboyd@kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Beside the binding for "rockchip,rk3066-vop" this patch series also has a new binding for "rockchip,rk3066-hdmi". Can Rob Herring advise here? Including the document describing the binding. This patch still has the original license text included. Can the copyright holder (or Sandy) approve the replacement of the GPL text by a SPDX License Identifier for GPL-2.0? Is Heiko's test setup for rk3066 already functional? Thanks 2018-12-29 14:33 GMT+01:00, Johan Jonker : > +++ b/drivers/gpu/drm/rockchip/rk3066_hdmi.c > @@ -0,0 +1,928 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd > + * Zheng Yang > + * > + * This software is licensed under the terms of the GNU General Public > + * License version 2, as published by the Free Software Foundation, and > + * may be copied, distributed, and modified under those terms. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */ > +static inline u8 rk3066_hdmi_get_power_mode(struct rk3066_hdmi *hdmi) > +{ > + return hdmi_readb(hdmi, HDMI_SYS_CTRL) & HDMI_SYS_POWER_MODE_MASK; > +} > + > +static void rk3066_hdmi_set_power_mode(struct rk3066_hdmi *hdmi, int mode) > +{ > + u8 current_mode, next_mode; > + u8 i = 0; > + The function rk3066_hdmi_get_power_mode can also returns 0 with VIO power domain disabled. That would lead to an endless loop. Just replaced 0 with HDMI_SYS_POWER_MODE_A to prevent a crash. Please advise if this function is OK with you? > + current_mode = rk3066_hdmi_get_power_mode(hdmi); > + > + dev_dbg(hdmi->dev, "mode :%d\n", mode); > + dev_dbg(hdmi->dev, "current_mode :%d\n", current_mode); > + > + if (current_mode == mode) > + return; > + > + do { > + if (current_mode > mode) > + next_mode = current_mode / 2; > + else { > + if (current_mode < HDMI_SYS_POWER_MODE_A) > + next_mode = HDMI_SYS_POWER_MODE_A; > + else > + next_mode = current_mode * 2; > + } > + > + dev_dbg(hdmi->dev, "%d: next_mode :%d\n", i, next_mode); > + > + if (next_mode != HDMI_SYS_POWER_MODE_D) { > + hdmi_modb(hdmi, HDMI_SYS_CTRL, > + HDMI_SYS_POWER_MODE_MASK, next_mode); > + } else { > + hdmi_writeb(hdmi, HDMI_SYS_CTRL, > + HDMI_SYS_POWER_MODE_D | > + HDMI_SYS_PLL_RESET_MASK); > + usleep_range(90, 100); > + hdmi_writeb(hdmi, HDMI_SYS_CTRL, > + HDMI_SYS_POWER_MODE_D | > + HDMI_SYS_PLLB_RESET); > + usleep_range(90, 100); > + hdmi_writeb(hdmi, HDMI_SYS_CTRL, > + HDMI_SYS_POWER_MODE_D); > + } > + current_mode = next_mode; > + i = i + 1; > + } while ((next_mode != mode) && (i < 5)); > +static const struct drm_display_mode edid_cea_modes[] = { > + /* 4 - 1280x720@60Hz 16:9 */ > + { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 1390, > + 1430, 1650, 0, 720, 725, 730, 750, 0, > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > + .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, > +}; > + > +static int rk3066_hdmi_connector_get_modes(struct drm_connector > *connector) > +{ > + struct rk3066_hdmi *hdmi = to_rk3066_hdmi(connector); > + struct drm_display_mode *mode = NULL; > + struct edid *edid; > + int ret = 0; > + > + if (!hdmi->ddc) > + return 0; > + > + hdmi->hdmi_data.sink_is_hdmi = false; > + > + edid = drm_get_edid(connector, hdmi->ddc); > + if (edid) { > + hdmi->hdmi_data.sink_is_hdmi = drm_detect_hdmi_monitor(edid); > + > + dev_info(hdmi->dev, "monitor type : %s : %dx%d cm\n", > + (hdmi->hdmi_data.sink_is_hdmi ? "HDMI" : "DVI"), > + edid->width_cm, edid->height_cm); > + > + drm_connector_update_edid_property(connector, edid); > + ret = drm_add_edid_modes(connector, edid); > + kfree(edid); > + } > + The DRM framework doesn't provide a function to make a CEA mode. DVI-D needs a mode set here. Adding more modes needs an extra for loop. For now one mode is enough. Just leave it that way.? Please advise. > + if ((ret == 0) || (hdmi->hdmi_data.sink_is_hdmi == false)) { > + hdmi->hdmi_data.sink_is_hdmi = false; > + > + mode = drm_mode_duplicate(hdmi->drm_dev, &edid_cea_modes[0]); > + if (!mode) > + return ret; > + mode->type |= DRM_MODE_TYPE_PREFERRED; > + drm_mode_probed_add(connector, mode); > + ret++; > + > + dev_info(hdmi->dev, "no CEA mode found, use default\n"); > + } > + > + return ret; > +} > +struct platform_driver rk3066_hdmi_driver = { > + .probe = rk3066_hdmi_probe, > + .remove = rk3066_hdmi_remove, > + .driver = { > + .name = "rockchip-rk3066hdmi", > + .of_match_table = rk3066_hdmi_dt_ids, > + }, > +}; > diff --git a/drivers/gpu/drm/rockchip/rk3066_hdmi.h > b/drivers/gpu/drm/rockchip/rk3066_hdmi.h > new file mode 100644 > index 000000000..f4c2e2081 > --- /dev/null > +++ b/drivers/gpu/drm/rockchip/rk3066_hdmi.h > @@ -0,0 +1,235 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd > + * Zheng Yang > + * > + * This software is licensed under the terms of the GNU General Public > + * License version 2, as published by the Free Software Foundation, and > + * may be copied, distributed, and modified under those terms. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */