From patchwork Mon Nov 5 10:45:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Jourdan X-Patchwork-Id: 10669899 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E12814BD for ; Tue, 6 Nov 2018 08:15:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 115832A13D for ; Tue, 6 Nov 2018 08:15:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05E442A174; Tue, 6 Nov 2018 08:15:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 983212A13D for ; Tue, 6 Nov 2018 08:15:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4D0796E366; Tue, 6 Nov 2018 08:15:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id B3FFE6E18D for ; Mon, 5 Nov 2018 10:45:14 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id f1-v6so6053019wmg.1 for ; Mon, 05 Nov 2018 02:45:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TKLLvWWerHEA8gEOK4LIPCxH8mV2pQQNbPRbXsJkDBo=; b=JQlrDCyjFQz/O6bpbQmG3QoYq7h360c9dYh/luIIUN8hUdYnxnoPQIE8xDMUif+s2B zwLnvfF65tZ2Z5pLPKFPW8rfLQc+7VKev/qPPJsi1uiqr6WwX9EhYJKpOWZukr/LVAqo 5lH/XE637igyIXv2Dev25PP6zQ9QmklOFNPOUR/ZueVykfwZ0rhJJjHH2NFD6Qvpy9U6 eNTRO6ld8VX3s6u7BRjaWz5GRfA7JVA4XDD/xPSI3ZUZAL/vcf0SuC+h6UD8MmDvEeM0 uGwublULnTGtnyi4I5z0YVjIG+NtzjFsP+vKgXil5yqSwIv3rQJ1TFhVyF+lm3W7q3L8 uymw== X-Gm-Message-State: AGRZ1gLPTS8lajb+ns3jwk+SaXGrjUE0LpnqJqyqgBlsV7F2HTyQizCf uiX6Z9IzbVZep86DDyWSoghOTsrDJdwQeQ== X-Google-Smtp-Source: AJdET5cYQF9CdzXKWyLDSYw7/iD+eX8aCH6yOAPFbEcWqC2b9qv5FM/kh3ZCO6a7uE/wsfOp2xnmUA== X-Received: by 2002:a1c:4489:: with SMTP id r131-v6mr6026875wma.121.1541414713396; Mon, 05 Nov 2018 02:45:13 -0800 (PST) Received: from localhost.localdomain (abo-99-183-68.mtp.modulonet.fr. [85.68.183.99]) by smtp.gmail.com with ESMTPSA id p125-v6sm8033114wmp.2.2018.11.05.02.45.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 02:45:11 -0800 (PST) From: Maxime Jourdan To: Neil Armstrong Subject: [PATCH 1/2] dt-bindings: display: amlogic, meson-vpu: Add optional canvas provider node Date: Mon, 5 Nov 2018 11:45:07 +0100 Message-Id: <20181105104508.23090-2-mjourdan@baylibre.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181105104508.23090-1-mjourdan@baylibre.com> References: <20181105104508.23090-1-mjourdan@baylibre.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 06 Nov 2018 08:14:57 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Kevin Hilman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Jerome Brunet Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Allows using the new canvas provider module if present. Signed-off-by: Maxime Jourdan Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt index 057b81335775..c65fd7a7467c 100644 --- a/Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt +++ b/Documentation/devicetree/bindings/display/amlogic,meson-vpu.txt @@ -67,6 +67,8 @@ Required properties: Optional properties: - power-domains: Optional phandle to associated power domain as described in the file ../power/power_domain.txt +- amlogic,canvas: phandle to canvas provider node as described in the file + ../soc/amlogic/amlogic,canvas.txt Required nodes: From patchwork Mon Nov 5 10:45:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Jourdan X-Patchwork-Id: 10669891 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B32D813BF for ; Tue, 6 Nov 2018 08:15:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A508F2A13D for ; Tue, 6 Nov 2018 08:15:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 993932A174; Tue, 6 Nov 2018 08:15:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2AA5D2A13D for ; Tue, 6 Nov 2018 08:15:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B0A5D6E35D; Tue, 6 Nov 2018 08:15:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4F6386E18E for ; Mon, 5 Nov 2018 10:45:16 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id r63-v6so7795594wma.4 for ; Mon, 05 Nov 2018 02:45:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jHG3pEhuEYUagxkiAojd6GLQqBQ8g60ZmVS+lON+9AU=; b=VDVX3TVYKGZdFWcM5738MFYghZBw+Z/pu8ZWsPgy/i92t3CowPuz06VP5Q9ngoyq8k Gt9Dhdalf7ohxzK+r56eMAkwNKuKxnH6aDCK/zRzmOtpe/JsjIQGyIru60x2SWcGaS03 oiRogXqKV96MQi2vLI8tgr9FdZx/z9cGz+UhzncIrwBxyi2hjoS6r3S8YXUm65SNTeZk o5QZWk7ykGlDuV5ATCkm/s5GImBltIrOo9FTMzJMSti8ClUReeOyehOlCu/qIjsSoMed ITa3VyhzN2ZgUL2brw67ZwW0gQoPR2Bs3sBVSu9ZYY4ESJC8WXn7YQ6ERFt5CU1Pqsl0 qj2w== X-Gm-Message-State: AGRZ1gLuwmuP52PJIxobQptzo7fKt8uWSpt14J3WnI8MAT0dmnxiNy58 cseKtDADY4Z09uK1r0d66YRRdQ== X-Google-Smtp-Source: AJdET5c3vMDFdsazXfk30zZXypAXRytdXY124vuVqH0Id0zsC++l56yH44uyWgzw9A3qdzSACEJ26Q== X-Received: by 2002:a1c:a757:: with SMTP id q84-v6mr4126035wme.61.1541414714743; Mon, 05 Nov 2018 02:45:14 -0800 (PST) Received: from localhost.localdomain (abo-99-183-68.mtp.modulonet.fr. [85.68.183.99]) by smtp.gmail.com with ESMTPSA id p125-v6sm8033114wmp.2.2018.11.05.02.45.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 02:45:13 -0800 (PST) From: Maxime Jourdan To: Neil Armstrong Subject: [PATCH 2/2] drm/meson: Use optional canvas provider Date: Mon, 5 Nov 2018 11:45:08 +0100 Message-Id: <20181105104508.23090-3-mjourdan@baylibre.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181105104508.23090-1-mjourdan@baylibre.com> References: <20181105104508.23090-1-mjourdan@baylibre.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 06 Nov 2018 08:14:57 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Kevin Hilman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Jerome Brunet Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This is the first step into converting the meson/drm driver to use the canvas module. If a canvas provider node is detected in DT, use it. Otherwise, fall back to what is currently being done. Signed-off-by: Maxime Jourdan --- drivers/gpu/drm/meson/Kconfig | 1 + drivers/gpu/drm/meson/meson_crtc.c | 14 ++++++--- drivers/gpu/drm/meson/meson_drv.c | 46 ++++++++++++++++++----------- drivers/gpu/drm/meson/meson_drv.h | 4 +++ drivers/gpu/drm/meson/meson_plane.c | 8 ++++- 5 files changed, 51 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/meson/Kconfig b/drivers/gpu/drm/meson/Kconfig index 3ce51d8dfe1c..c28b69f48555 100644 --- a/drivers/gpu/drm/meson/Kconfig +++ b/drivers/gpu/drm/meson/Kconfig @@ -7,6 +7,7 @@ config DRM_MESON select DRM_GEM_CMA_HELPER select VIDEOMODE_HELPERS select REGMAP_MMIO + select MESON_CANVAS config DRM_MESON_DW_HDMI tristate "HDMI Synopsys Controller support for Amlogic Meson Display" diff --git a/drivers/gpu/drm/meson/meson_crtc.c b/drivers/gpu/drm/meson/meson_crtc.c index 05520202c967..b3bc0b0ee07f 100644 --- a/drivers/gpu/drm/meson/meson_crtc.c +++ b/drivers/gpu/drm/meson/meson_crtc.c @@ -193,10 +193,16 @@ void meson_crtc_irq(struct meson_drm *priv) } else meson_vpp_disable_interlace_vscaler_osd1(priv); - meson_canvas_setup(priv, MESON_CANVAS_ID_OSD1, - priv->viu.osd1_addr, priv->viu.osd1_stride, - priv->viu.osd1_height, MESON_CANVAS_WRAP_NONE, - MESON_CANVAS_BLKMODE_LINEAR); + if (priv->canvas) + meson_canvas_config(priv->canvas, priv->canvas_id_osd1, + priv->viu.osd1_addr, priv->viu.osd1_stride, + priv->viu.osd1_height, MESON_CANVAS_WRAP_NONE, + MESON_CANVAS_BLKMODE_LINEAR, 0); + else + meson_canvas_setup(priv, MESON_CANVAS_ID_OSD1, + priv->viu.osd1_addr, priv->viu.osd1_stride, + priv->viu.osd1_height, MESON_CANVAS_WRAP_NONE, + MESON_CANVAS_BLKMODE_LINEAR); /* Enable OSD1 */ writel_bits_relaxed(VPP_OSD1_POSTBLEND, VPP_OSD1_POSTBLEND, diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index d3443125e661..b39c38c2350d 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -216,24 +216,33 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) goto free_drm; } - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dmc"); - if (!res) { - ret = -EINVAL; - goto free_drm; - } - /* Simply ioremap since it may be a shared register zone */ - regs = devm_ioremap(dev, res->start, resource_size(res)); - if (!regs) { - ret = -EADDRNOTAVAIL; - goto free_drm; - } + priv->canvas = meson_canvas_get(dev); + if (!IS_ERR(priv->canvas)) { + ret = meson_canvas_alloc(priv->canvas, &priv->canvas_id_osd1); + if (ret) + goto free_drm; + } else { + priv->canvas = NULL; - priv->dmc = devm_regmap_init_mmio(dev, regs, - &meson_regmap_config); - if (IS_ERR(priv->dmc)) { - dev_err(&pdev->dev, "Couldn't create the DMC regmap\n"); - ret = PTR_ERR(priv->dmc); - goto free_drm; + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dmc"); + if (!res) { + ret = -EINVAL; + goto free_drm; + } + /* Simply ioremap since it may be a shared register zone */ + regs = devm_ioremap(dev, res->start, resource_size(res)); + if (!regs) { + ret = -EADDRNOTAVAIL; + goto free_drm; + } + + priv->dmc = devm_regmap_init_mmio(dev, regs, + &meson_regmap_config); + if (IS_ERR(priv->dmc)) { + dev_err(&pdev->dev, "Couldn't create the DMC regmap\n"); + ret = PTR_ERR(priv->dmc); + goto free_drm; + } } priv->vsync_irq = platform_get_irq(pdev, 0); @@ -315,6 +324,9 @@ static void meson_drv_unbind(struct device *dev) struct drm_device *drm = dev_get_drvdata(dev); struct meson_drm *priv = drm->dev_private; + if (priv->canvas) + meson_canvas_free(priv->canvas, priv->canvas_id_osd1); + drm_dev_unregister(drm); drm_kms_helper_poll_fini(drm); drm_fbdev_cma_fini(priv->fbdev); diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h index 8450d6ac8c9b..728d0ca33732 100644 --- a/drivers/gpu/drm/meson/meson_drv.h +++ b/drivers/gpu/drm/meson/meson_drv.h @@ -22,6 +22,7 @@ #include #include #include +#include #include struct meson_drm { @@ -31,6 +32,9 @@ struct meson_drm { struct regmap *dmc; int vsync_irq; + struct meson_canvas *canvas; + u8 canvas_id_osd1; + struct drm_device *drm; struct drm_crtc *crtc; struct drm_fbdev_cma *fbdev; diff --git a/drivers/gpu/drm/meson/meson_plane.c b/drivers/gpu/drm/meson/meson_plane.c index 12c80dfcff59..51bec8e98a39 100644 --- a/drivers/gpu/drm/meson/meson_plane.c +++ b/drivers/gpu/drm/meson/meson_plane.c @@ -90,6 +90,7 @@ static void meson_plane_atomic_update(struct drm_plane *plane, .y2 = state->crtc_y + state->crtc_h, }; unsigned long flags; + u8 canvas_id_osd1; /* * Update Coordinates @@ -104,8 +105,13 @@ static void meson_plane_atomic_update(struct drm_plane *plane, (0xFF << OSD_GLOBAL_ALPHA_SHIFT) | OSD_BLK0_ENABLE; + if (priv->canvas) + canvas_id_osd1 = priv->canvas_id_osd1; + else + canvas_id_osd1 = MESON_CANVAS_ID_OSD1; + /* Set up BLK0 to point to the right canvas */ - priv->viu.osd1_blk0_cfg[0] = ((MESON_CANVAS_ID_OSD1 << OSD_CANVAS_SEL) | + priv->viu.osd1_blk0_cfg[0] = ((canvas_id_osd1 << OSD_CANVAS_SEL) | OSD_ENDIANNESS_LE); /* On GXBB, Use the old non-HDR RGB2YUV converter */