Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3044778pxk; Mon, 7 Sep 2020 01:13:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVZ+lHOUFYoZ8nZTuOSDCBOAg5VtP9H/RKVlw45FTSeFyqE1hyE28nDRryyjAhiMT7y03f X-Received: by 2002:a17:906:bc98:: with SMTP id lv24mr20582100ejb.411.1599466399975; Mon, 07 Sep 2020 01:13:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599466399; cv=none; d=google.com; s=arc-20160816; b=0Nv8wg6YopdWZA9ARJN8cHHbFHwElhEfXFbhZrnhaQMxl8vpsV7inwXkNHFHR6ClDy vgMgkSyKJ4jahO3Dg3DQmV9A1u95UysZXCdvW9muMZVhx/elgtAOkAh4KWRJcbZuHtGR LiJr+cyLhZB9rCVEAiv5RxnAv8smQSF+CkRWCsarco89ehpOsXWj0w8q0OiVtbTUjd+a KSyXT61VtKaKlk6ISrad9wF6zMeF2frDtRUSVYiYOAQW2RnOFWfEar8+Ool7Awkuypve r5Ws1slRL/K0Ub44fVfhmlXEYULDTdUn5p1hCBBkplc+od0zLGF5/nwANW2xILWs1qSJ 9/SQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:autocrypt:from:references:cc:to:subject :dkim-signature; bh=vISUpoBN1kH4usxTG/CMAMfOFxyeKd1cKFFqqtgy4bk=; b=vGm1Oz29Na/WY7miw9Fn/p0lAp4/BBnes/92UwHfwGx62pcy1N2XGDhwS+6XYVYRes Rzgdpb/G1bxV73Hild3hgBqE9dG1hndf75ufS03/9ihfarTQHPNcBWyriItcS3t3Opcx x6h8m8UggXMwOsJL3zRMn30IHUVVxKZm5TRhMKC4yzZqn7d3N4xX8TJSpW5YU4k+GDE5 33jV3WmMHj4553spM4M+QWNEvrWHTo0HYzLnX2hXYVXBUHl7KdkGPBnAL3ltE0fQZ11b xWE0F6iCuWDTx32RlZ/kcBLG5oPETP/YukFCAeJxVmQ5BjW42z4yEh/TElGJryqGtNgB voQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=lJcGOUcO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v1si10289006ejd.6.2020.09.07.01.12.57; Mon, 07 Sep 2020 01:13:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=lJcGOUcO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727907AbgIGIKJ (ORCPT + 99 others); Mon, 7 Sep 2020 04:10:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727089AbgIGIJe (ORCPT ); Mon, 7 Sep 2020 04:09:34 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DD84C061573 for ; Mon, 7 Sep 2020 01:09:33 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id w5so14762838wrp.8 for ; Mon, 07 Sep 2020 01:09:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:autocrypt:organization:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=vISUpoBN1kH4usxTG/CMAMfOFxyeKd1cKFFqqtgy4bk=; b=lJcGOUcOHcK+PvwscgOv8mOjWubWf7aPCn0R/nFJ3UdfU5otHdGYsr4fh96L2epaP3 oJPhmAqZEMpDEorQcMgSWWUEi3ep6NK8/u8nauxq/JJmkqB8fbMeVfyDajkzli8GnaXK i2THOayjoaoeREPD7jK0JXwn4Td6qHMQKsxo4idqbZ2MRlFXdPZaGGWRFqWtj+zlg28o O3FD5XFp7CG+X1vU39q6HOUgnnlRrauSJbc6/Edm+uDCPMTro6CqSKOGXpETqf8jmogH yeQfQbHK30lPsShylfmL9Vj6BlVcLqT8NG4dl5Kxmc50pjZM3RgpO7eX3LvVgiVcCtD7 fQDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=vISUpoBN1kH4usxTG/CMAMfOFxyeKd1cKFFqqtgy4bk=; b=Yp/da4yrhTC4RAINQCH8toi1Pkenv2cBpK8FAif/9BMPaWK1ZS16xVlizx1OM7zrtk akhqSxWxUPNN3WaIfR2QKwkfLxm9U7M+qntXwxfkuQbXTjnsHPbdjjN8u13aifvGEXvb 2bkggHQT2ENH8KqqmYyrnx/hpx9OowNcaC8qE4PvjseZ+Hkc3+EOKRbXnV67wKR25BBo dd1oaL94at2W0l3dBlD3MRmMQcLlMoytEWCKStlnX5xME/i0wUnvkqO9NIm1OQxXsrNm Wju+Ar9qCk11jxkfG3OXkOOYQJExmHr3rUzE5TDAIdQulnza8fuaUmij8lxrtrnMr8QS 0/xQ== X-Gm-Message-State: AOAM5302XlzhxDbh/KllwpguMt+yvjXBHADwifUuwBCSmQFza41+DK9J YdzJqvgqBGmRmtiV87puto8xDA== X-Received: by 2002:adf:e6c2:: with SMTP id y2mr21872961wrm.117.1599466171895; Mon, 07 Sep 2020 01:09:31 -0700 (PDT) Received: from ?IPv6:2a01:e35:2ec0:82b0:5405:9623:e2f1:b2ac? ([2a01:e35:2ec0:82b0:5405:9623:e2f1:b2ac]) by smtp.gmail.com with ESMTPSA id i1sm31339865wrc.49.2020.09.07.01.09.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Sep 2020 01:09:31 -0700 (PDT) Subject: Re: [PATCH v2] drm/bridge: dw-mipi-dsi.c: Add VPG runtime config through debugfs To: Angelo Ribeiro , yannick.fertre@st.com, philippe.cornu@st.com, benjamin.gaignard@st.com, airlied@linux.ie, daniel@ffwll.ch, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, dri-devel@lists.freedesktop.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, pop.adrian61@gmail.com Cc: Jose Abreu , Gustavo Pimentel , Joao Pinto References: 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 AAHNKE5laWwgQXJtc3Ryb25nIDxuYXJtc3Ryb25nQGJheWxpYnJlLmNvbT7CwHsEEwEKACUC GyMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheABQJXD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YU++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: <5ecbb66f-1f65-d4c4-3593-49c537378efe@baylibre.com> Date: Mon, 7 Sep 2020 10:09:29 +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: 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 06/04/2020 15:49, Angelo Ribeiro wrote: > Add support for the video pattern generator (VPG) BER pattern mode and > configuration in runtime. > > This enables using the debugfs interface to manipulate the VPG after > the pipeline is set. > Also, enables the usage of the VPG BER pattern. > > Changes in v2: > - Added VID_MODE_VPG_MODE > - Solved incompatible return type on __get and __set > > Reported-by: kbuild test robot > Reported-by: Adrian Pop > Cc: Gustavo Pimentel > Cc: Joao Pinto > Cc: Jose Abreu > Signed-off-by: Angelo Ribeiro > --- > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 98 ++++++++++++++++++++++++--- > 1 file changed, 90 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > index b18351b..9de3645 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > @@ -91,6 +91,7 @@ > #define VID_MODE_TYPE_BURST 0x2 > #define VID_MODE_TYPE_MASK 0x3 > #define VID_MODE_VPG_ENABLE BIT(16) > +#define VID_MODE_VPG_MODE BIT(20) > #define VID_MODE_VPG_HORIZONTAL BIT(24) > > #define DSI_VID_PKT_SIZE 0x3c > @@ -221,6 +222,21 @@ > #define PHY_STATUS_TIMEOUT_US 10000 > #define CMD_PKT_STATUS_TIMEOUT_US 20000 > > +#ifdef CONFIG_DEBUG_FS > +#define VPG_DEFS(name, dsi) \ > + ((void __force *)&((*dsi).vpg_defs.name)) > + > +#define REGISTER(name, mask, dsi) \ > + { #name, VPG_DEFS(name, dsi), mask, dsi } > + > +struct debugfs_entries { > + const char *name; > + bool *reg; > + u32 mask; > + struct dw_mipi_dsi *dsi; > +}; > +#endif /* CONFIG_DEBUG_FS */ > + > struct dw_mipi_dsi { > struct drm_bridge bridge; > struct mipi_dsi_host dsi_host; > @@ -238,9 +254,12 @@ struct dw_mipi_dsi { > > #ifdef CONFIG_DEBUG_FS > struct dentry *debugfs; > - > - bool vpg; > - bool vpg_horizontal; > + struct debugfs_entries *debugfs_vpg; > + struct { > + bool vpg; > + bool vpg_horizontal; > + bool vpg_ber_pattern; > + } vpg_defs; > #endif /* CONFIG_DEBUG_FS */ > > struct dw_mipi_dsi *master; /* dual-dsi master ptr */ > @@ -530,9 +549,11 @@ static void dw_mipi_dsi_video_mode_config(struct dw_mipi_dsi *dsi) > val |= VID_MODE_TYPE_NON_BURST_SYNC_EVENTS; > > #ifdef CONFIG_DEBUG_FS > - if (dsi->vpg) { > + if (dsi->vpg_defs.vpg) { > val |= VID_MODE_VPG_ENABLE; > - val |= dsi->vpg_horizontal ? VID_MODE_VPG_HORIZONTAL : 0; > + val |= dsi->vpg_defs.vpg_horizontal ? > + VID_MODE_VPG_HORIZONTAL : 0; > + val |= dsi->vpg_defs.vpg_ber_pattern ? VID_MODE_VPG_MODE : 0; > } > #endif /* CONFIG_DEBUG_FS */ > > @@ -961,6 +982,68 @@ static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = { > > #ifdef CONFIG_DEBUG_FS > > +int dw_mipi_dsi_debugfs_write(void *data, u64 val) > +{ > + struct debugfs_entries *vpg = data; > + struct dw_mipi_dsi *dsi; > + u32 mode_cfg; > + > + if (!vpg) > + return -ENODEV; > + > + dsi = vpg->dsi; > + > + *vpg->reg = (bool)val; > + > + mode_cfg = dsi_read(dsi, DSI_VID_MODE_CFG); > + > + if (*vpg->reg) > + mode_cfg |= vpg->mask; > + else > + mode_cfg &= ~vpg->mask; > + > + dsi_write(dsi, DSI_VID_MODE_CFG, mode_cfg); > + > + return 0; > +} > + > +int dw_mipi_dsi_debugfs_show(void *data, u64 *val) > +{ > + struct debugfs_entries *vpg = data; > + > + if (!vpg) > + return -ENODEV; > + > + *val = *vpg->reg; > + > + return 0; > +} > + > +DEFINE_DEBUGFS_ATTRIBUTE(fops_x32, dw_mipi_dsi_debugfs_show, > + dw_mipi_dsi_debugfs_write, "%llu\n"); > + > +static void debugfs_create_files(void *data) > +{ > + struct dw_mipi_dsi *dsi = data; > + struct debugfs_entries debugfs[] = { > + REGISTER(vpg, VID_MODE_VPG_ENABLE, dsi), > + REGISTER(vpg_horizontal, VID_MODE_VPG_HORIZONTAL, dsi), > + REGISTER(vpg_ber_pattern, VID_MODE_VPG_MODE, dsi), > + }; > + int i; > + > + dsi->debugfs_vpg = kmalloc(sizeof(debugfs), GFP_KERNEL); > + if (!dsi->debugfs_vpg) > + return; > + > + memcpy(dsi->debugfs_vpg, debugfs, sizeof(debugfs)); > + > + for (i = 0; i < ARRAY_SIZE(debugfs); i++) > + debugfs_create_file(dsi->debugfs_vpg[i].name, 0644, > + dsi->debugfs, &dsi->debugfs_vpg[i], > + &fops_x32); > +} > + > static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi) > { > dsi->debugfs = debugfs_create_dir(dev_name(dsi->dev), NULL); > @@ -969,14 +1052,13 @@ static void dw_mipi_dsi_debugfs_init(struct dw_mipi_dsi *dsi) > return; > } > > - debugfs_create_bool("vpg", 0660, dsi->debugfs, &dsi->vpg); > - debugfs_create_bool("vpg_horizontal", 0660, dsi->debugfs, > - &dsi->vpg_horizontal); > + debugfs_create_files(dsi); > } > > static void dw_mipi_dsi_debugfs_remove(struct dw_mipi_dsi *dsi) > { > debugfs_remove_recursive(dsi->debugfs); > + kfree(dsi->debugfs_vpg); > } > > #else > Acked-by: Neil Armstrong Applying to drm-misc-next Thanks, Neil