From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74D7EC433E2 for ; Tue, 8 Sep 2020 08:06:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0AF8521D6C for ; Tue, 8 Sep 2020 08:06:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="u6/W+IxZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729719AbgIHIGU (ORCPT ); Tue, 8 Sep 2020 04:06:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729597AbgIHIGJ (ORCPT ); Tue, 8 Sep 2020 04:06:09 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36EDDC061573 for ; Tue, 8 Sep 2020 01:06:08 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id a9so16192213wmm.2 for ; Tue, 08 Sep 2020 01:06:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:autocrypt:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=eWo2kYwUoWPVeccpxO/K1W2oBeYjJTMFlNwy28NbHxc=; b=u6/W+IxZ64rJ2uBh1jRYEKBjDOCTXOqgHZY5pL6pDMm424O7X3KabBFKyibCXkO65g Ls6I8Y7/j1ljHP7mgyuie5Fzj6OrGFuRy12fdbPJSmgNhM0qcOl0x1KsCLHeV9KM2H3E 08Irl4JgTgmR4CXCjy17y+dFsLD2/5m09342t4fbevrC2/+mm6bpX+jeloCnQQ/QMcpG AN31nDbUGGgnGU9OhhBmdsOCgurU01ibdFqU/YGVIjuLOqpRO+P1VSI8bYE7a+CfTfR3 zQX7zQDrg8Cf4Y22wnTcPXrlsLBMgaWKrylFY8yJf61AH67zk+sjBnpDcVHtm4CpTtUJ xC1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:autocrypt :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=eWo2kYwUoWPVeccpxO/K1W2oBeYjJTMFlNwy28NbHxc=; b=Mmwun5hmLFR11iSLqcWy26QcGcZXO/l6fwjS5p/UgjtxQ+nAjIeF1p4wPwUHfOxqoR BEKnx6CUdIh+C901YoD14FptnapNbTb7CJa1qKtjDfrAsrTsKd+4BcXYgzKpw7Y/6nk9 VyHVOtjHZUATsA//Sz9gjEfdLQdrO9KLL1vxORw0YWZuzv2Rm6Xi9MUCe1CZxf+33zgT Bv4qpCMbK4yK7IR6+Hq31F0aLVLzNwuuTF8Ze8J1C3cYdk2UlfxKB62LQKb8tt8IJyrb bI0QzVLX0Cr9i+e2tfzYSzvjSrqDBomeepV3fyyVudkbcHwj1Uf02BodErNZx6d/o8JT 17OQ== X-Gm-Message-State: AOAM531BHgKmfoLAHasFEOUAmI36P0pz02JJKvKSewMPGLdDZN8We+Kb EJKhl2LCpRfLM8HlkIf2I04ooQaBuuaMCD8t X-Google-Smtp-Source: ABdhPJwkN/jRHCMYfAS/IOC/xt0opBf7vw0QsYgmmUq42d6BCs+vTOItdnUXZHjCoOmMpmtce6MTEQ== X-Received: by 2002:a1c:a707:: with SMTP id q7mr3318717wme.152.1599552366034; Tue, 08 Sep 2020 01:06:06 -0700 (PDT) Received: from ?IPv6:2a01:e35:2ec0:82b0:28ac:1772:9398:891a? ([2a01:e35:2ec0:82b0:28ac:1772:9398:891a]) by smtp.gmail.com with ESMTPSA id i6sm36456168wra.1.2020.09.08.01.06.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Sep 2020 01:06:05 -0700 (PDT) Subject: Re: [PATCH 6/6] drm/meson: add support for MIPI-DSI transceiver To: dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org References: <20200907081825.1654-1-narmstrong@baylibre.com> <20200907081825.1654-7-narmstrong@baylibre.com> <20200907084351.GV2352366@phenom.ffwll.local> <20200907084423.GW2352366@phenom.ffwll.local> <20200907180315.GY2352366@phenom.ffwll.local> From: Neil Armstrong Autocrypt: addr=narmstrong@baylibre.com; prefer-encrypt=mutual; keydata= xsBNBE1ZBs8BCAD78xVLsXPwV/2qQx2FaO/7mhWL0Qodw8UcQJnkrWmgTFRobtTWxuRx8WWP GTjuhvbleoQ5Cxjr+v+1ARGCH46MxFP5DwauzPekwJUD5QKZlaw/bURTLmS2id5wWi3lqVH4 BVF2WzvGyyeV1o4RTCYDnZ9VLLylJ9bneEaIs/7cjCEbipGGFlfIML3sfqnIvMAxIMZrvcl9 qPV2k+KQ7q+aXavU5W+yLNn7QtXUB530Zlk/d2ETgzQ5FLYYnUDAaRl+8JUTjc0CNOTpCeik 80TZcE6f8M76Xa6yU8VcNko94Ck7iB4vj70q76P/J7kt98hklrr85/3NU3oti3nrIHmHABEB AAHNKE5laWwgQXJtc3Ryb25nIDxuYXJtc3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UFIV4MpDdFDame7PB50s73gF/pfQbjw5Wxtes/0FnqydfId95s+eej+17ldGp lMv1ok7K0H/WJSdr7UwDAHEYU++p4RRTJP6DHWXcByVlpNQ4SSAiivmWiwOt490+Ac7ATQRN WQbPAQgAvIoM384ZRFocFXPCOBir5m2J+96R2tI2XxMgMfyDXGJwFilBNs+fpttJlt2995A8 0JwPj8SFdm6FBcxygmxBBCc7i/BVQuY8aC0Z/w9Vzt3Eo561r6pSHr5JGHe8hwBQUcNPd/9l 2ynP57YTSE9XaGJK8gIuTXWo7pzIkTXfN40Wh5jeCCspj4jNsWiYhljjIbrEj300g8RUT2U0 FcEoiV7AjJWWQ5pi8lZJX6nmB0lc69Jw03V6mblgeZ/1oTZmOepkagwy2zLDXxihf0GowUif GphBDeP8elWBNK+ajl5rmpAMNRoKxpN/xR4NzBg62AjyIvigdywa1RehSTfccQARAQABwsBf BBgBAgAJBQJNWQbPAhsMAAoJEBaat7Gkz/iuteIH+wZuRDqK0ysAh+czshtG6JJlLW6eXJJR Vi7dIPpgFic2LcbkSlvB8E25Pcfz/+tW+04Urg4PxxFiTFdFCZO+prfd4Mge7/OvUcwoSub7 ZIPo8726ZF5/xXzajahoIu9/hZ4iywWPAHRvprXaim5E/vKjcTeBMJIqZtS4u/UK3EpAX59R XVxVpM8zJPbk535ELUr6I5HQXnihQm8l6rt9TNuf8p2WEDxc8bPAZHLjNyw9a/CdeB97m2Tr zR8QplXA5kogS4kLe/7/JmlDMO8Zgm9vKLHSUeesLOrjdZ59EcjldNNBszRZQgEhwaarfz46 BSwxi7g3Mu7u5kUByanqHyA= Organization: Baylibre Message-ID: Date: Tue, 8 Sep 2020 10:06:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200907180315.GY2352366@phenom.ffwll.local> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 07/09/2020 20:03, Daniel Vetter wrote: > On Mon, Sep 07, 2020 at 11:03:29AM +0200, Neil Armstrong wrote: >> On 07/09/2020 10:44, Daniel Vetter wrote: >>> On Mon, Sep 07, 2020 at 10:43:51AM +0200, Daniel Vetter wrote: >>>> On Mon, Sep 07, 2020 at 10:18:25AM +0200, Neil Armstrong wrote: >>>>> The Amlogic AXg SoCs embeds a Synopsys DW-MIPI-DSI transceiver (ver 1.21a), with a custom >>>>> glue managing the IP resets, clock and data input similar to the DW-HDMI Glue on other >>>>> Amlogic SoCs. >>>>> >>>>> This adds support for the Glue managing the transceiver, mimicing the init flow provided >>>>> by Amlogic to setup the ENCl encoder, the glue, the transceiver, the digital D-PHY and the >>>>> Analog PHY in the proper way. >>>>> >>>>> The DW-MIPI-DSI transceiver + D-PHY are directly clocked by the VCLK2 clock, which pixel clock >>>>> is derived and feeds the ENCL encoder and the VIU pixel reader. >>>>> >>>>> An optional "MEAS" clock can be enabled to measure the delay between each vsync feeding the >>>>> DW-MIPI-DSI transceiver. >>>>> >>>>> Signed-off-by: Neil Armstrong >>>> >>>> More dw-hdmi drivers which aren't bridges but components, and the thing is >>>> still midlayer-y as heck :-/ >>> >>> *dw-dsi, but really they both work the same way and should both be fixed >>> ... >> >> They are bridges but since they have platform-dependent code due to theirs's generic IP >> nature, they need to be intanciated by components to sync with the platform code. > > Yeah that's how it currently works, but there's not much reason why it > needs to work like that. That platform glue code can also be put behind > the drm_bridge abstraction, and we could use the normal dt based bridge > lookup like for everything else. > > Afaiui the only reason dw-* bridge drivers work like that is because for > historical reasons we only had component.c at first, and none of the more > fancy dynamic bridge lookup. So would be really good to switch this all > over to a proper&clean bridge abstraction, and not leak everything around. Does it mean we should avoit using components, right ? > > I've typed up what I think should be the way forward a few times already, > but thus far not even the todo.rst entry materialized: > > https://lore.kernel.org/dri-devel/20200430135841.GE10381@phenom.ffwll.local/ > > If everyone is always about "not in my patch series" it'll never happen. Today, the dw-mipi-dsi and dw-mipi-hdmi has mandatory callbacks to implement vendor specific features, like : - hdmi/dsi phy handling when mixed into the glue/custom/synopsys but with platform specific values - platform specific mode validation - hpd setup => could use laurent's work here with no_connector, but how do we handle rxsense ??? - dsi timings/lane mbps ? these are platform phy specific For amlogic, I can split the "component" code handling venc/vclk into a primary bridge and add a secondary driver only handling the glue around dw-mipi-dsi/dw-mipi-hdmi, would that be a good start ? Neil > > Cheers, Daniel > > >> >> Neil >> >>> >>>> >>>> Can we try to fix this? There's a ton of this going on, and the more we >>>> add the old fashioned way the harder this gets to fix up for real. >>>> -Daniel >>>> >>>>> --- >>>>> drivers/gpu/drm/meson/Kconfig | 7 + >>>>> drivers/gpu/drm/meson/Makefile | 1 + >>>>> drivers/gpu/drm/meson/meson_dw_mipi_dsi.c | 562 ++++++++++++++++++++++ >>>>> 3 files changed, 570 insertions(+) >>>>> create mode 100644 drivers/gpu/drm/meson/meson_dw_mipi_dsi.c >>>>> >>>>> diff --git a/drivers/gpu/drm/meson/Kconfig b/drivers/gpu/drm/meson/Kconfig >>>>> index 9f9281dd49f8..385f6f23839b 100644 >>>>> --- a/drivers/gpu/drm/meson/Kconfig >>>>> +++ b/drivers/gpu/drm/meson/Kconfig >>>>> @@ -16,3 +16,10 @@ config DRM_MESON_DW_HDMI >>>>> default y if DRM_MESON >>>>> select DRM_DW_HDMI >>>>> imply DRM_DW_HDMI_I2S_AUDIO >>>>> + >>>>> +config DRM_MESON_DW_MIPI_DSI >>>>> + tristate "MIPI DSI Synopsys Controller support for Amlogic Meson Display" >>>>> + depends on DRM_MESON >>>>> + default y if DRM_MESON >>>>> + select DRM_DW_MIPI_DSI >>>>> + select GENERIC_PHY_MIPI_DPHY >>>>> diff --git a/drivers/gpu/drm/meson/Makefile b/drivers/gpu/drm/meson/Makefile >>>>> index 28a519cdf66b..2cc870e91182 100644 >>>>> --- a/drivers/gpu/drm/meson/Makefile >>>>> +++ b/drivers/gpu/drm/meson/Makefile >>>>> @@ -5,3 +5,4 @@ meson-drm-y += meson_rdma.o meson_osd_afbcd.o >>>>> >>>>> obj-$(CONFIG_DRM_MESON) += meson-drm.o >>>>> obj-$(CONFIG_DRM_MESON_DW_HDMI) += meson_dw_hdmi.o >>>>> +obj-$(CONFIG_DRM_MESON_DW_MIPI_DSI) += meson_dw_mipi_dsi.o >>>>> diff --git a/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c >>>>> new file mode 100644 >>>>> index 000000000000..bbe1294fce7c >>>>> --- /dev/null >>>>> +++ b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c >>>>> @@ -0,0 +1,562 @@ >>>>> +// SPDX-License-Identifier: GPL-2.0-or-later >>>>> +/* >>>>> + * Copyright (C) 2016 BayLibre, SAS >>>>> + * Author: Neil Armstrong >>>>> + * Copyright (C) 2015 Amlogic, Inc. All rights reserved. >>>>> + */ >>>>> + >>>>> +#include >>>>> +#include >>>>> +#include >>>>> +#include >>>>> +#include >>>>> +#include >>>>> +#include >>>>> +#include >>>>> + >>>>> +#include