From patchwork Fri Dec 31 01:39:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 12701771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1EFE4C433F5 for ; Fri, 31 Dec 2021 01:39:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5612510E188; Fri, 31 Dec 2021 01:39:43 +0000 (UTC) Received: from mail-vk1-xa30.google.com (mail-vk1-xa30.google.com [IPv6:2607:f8b0:4864:20::a30]) by gabe.freedesktop.org (Postfix) with ESMTPS id D92E610E188 for ; Fri, 31 Dec 2021 01:39:41 +0000 (UTC) Received: by mail-vk1-xa30.google.com with SMTP id u1so14301340vkn.10 for ; Thu, 30 Dec 2021 17:39:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NA3/Zv81Gg1tMXhdtY74A6kQWlZXIaDfxv6gG1YrSw4=; b=lXTs9iiaSOIfN4pTwFlRRta3qZkoyaZT7jRVFolTZ0LQhZjxjeIcSYw6W1hO2EOTOh qbmGNCtAzGbvsf1tDmq58krSBTHew+77qweiuUJUF2THh4HcxYELr5EEMN8pQlUMjW84 +zUZ5bijGu6ofaJm598Y+BVqsNNBznodVc9H6RjoYEagVLvSqK5hAzcEMLDkVFmDw6+j 1Q//c7XejvdQpRP2WZUekQTkVQZIMCuaAxASk/DxwSQKeUH/ODQAxR7pSsg9imE0+rnK 0HimxSWUt54fBTanbZK8fr28Qvz0EtxfplXZcOQA4HRLrp7ufLb/q+k+81+EgiV3GQMT w/Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NA3/Zv81Gg1tMXhdtY74A6kQWlZXIaDfxv6gG1YrSw4=; b=MF968LUbb08QdyNe0VNtcWW/ANIJSAywGciB5c07sPlpLFpxOLL+C/mv3v0fO3QBnC 9JRCaBgdC6H1ykigXgYwixvpn2PEmXC+ipYYFXGy+8V87+ehe19dlyVMcK7vfJCU2yir +wSOo6ElVvrDj2Rx0x7MquWyVbtW6MjYAvfnNRKG79Npai68Cw3QQIRvvi9EjXWL6JBz cJ3qZ1NgKcFfsxu/Df9PAWUP7IRBHw6De/JICEL/qUNFtKMq76eQwW4MA5nogROgsGxR eNRGdbN7ix5022+o29qcqiHT1lwYGfastw1POpar62h48UKhGuZs/MzOIv8tZ90/GgnL AwBA== X-Gm-Message-State: AOAM533BMZrAZq6RvMTNA3jY1G34kQn23Z2Qk09g9uFbHXy0jNhFttrS TTqKXD1Epo5gbfm6XBy1Ui8= X-Google-Smtp-Source: ABdhPJx0DiuquTutl3ThrWnSdRn99Z2ksUAfyxFUKsLAjB0vKEy4QlpRQeE0p37KwdZFLHPgzCGWSw== X-Received: by 2002:a1f:a4ca:: with SMTP id n193mr10994533vke.29.1640914780920; Thu, 30 Dec 2021 17:39:40 -0800 (PST) Received: from localhost.localdomain ([2804:14c:485:504a:d549:ed49:6dac:47ee]) by smtp.gmail.com with ESMTPSA id t20sm3754993vsj.11.2021.12.30.17.39.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Dec 2021 17:39:40 -0800 (PST) From: Fabio Estevam To: linux@armlinux.org.uk Subject: [PATCH 1/2] drm/i2c/tda998x: Switch to atomic operations Date: Thu, 30 Dec 2021 22:39:29 -0300 Message-Id: <20211231013930.139754-1-festevam@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, dri-devel@lists.freedesktop.org, laurent.pinchart@ideasonboard.com, tomm.merciai@gmail.com, pbrobinson@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use the atomic version of the enable/disable operations to continue the transition to the atomic API, started with the introduction of .atomic_get_input_bus_fmts(). This will be needed to access the mode from the atomic state. Based on Laurent's commit a6ea7d268a63("drm: bridge: ti-sn65dsi83: Switch to atomic operations"). Tested on a imx6sx-udoo-neo board. Suggested-by: Marek Vasut Signed-off-by: Fabio Estevam Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/i2c/tda998x_drv.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index b7ec6c374fbd..adaa985af87e 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -1395,7 +1395,8 @@ static enum drm_mode_status tda998x_bridge_mode_valid(struct drm_bridge *bridge, return MODE_OK; } -static void tda998x_bridge_enable(struct drm_bridge *bridge) +static void tda998x_bridge_atomic_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct tda998x_priv *priv = bridge_to_tda998x_priv(bridge); @@ -1413,7 +1414,8 @@ static void tda998x_bridge_enable(struct drm_bridge *bridge) } } -static void tda998x_bridge_disable(struct drm_bridge *bridge) +static void tda998x_bridge_atomic_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct tda998x_priv *priv = bridge_to_tda998x_priv(bridge); @@ -1680,9 +1682,9 @@ static const struct drm_bridge_funcs tda998x_bridge_funcs = { .attach = tda998x_bridge_attach, .detach = tda998x_bridge_detach, .mode_valid = tda998x_bridge_mode_valid, - .disable = tda998x_bridge_disable, + .atomic_disable = tda998x_bridge_atomic_disable, .mode_set = tda998x_bridge_mode_set, - .enable = tda998x_bridge_enable, + .atomic_enable = tda998x_bridge_atomic_enable, }; /* I2C driver functions */ From patchwork Fri Dec 31 01:39:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 12701772 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AE909C433EF for ; Fri, 31 Dec 2021 01:39:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E28D110E507; Fri, 31 Dec 2021 01:39:46 +0000 (UTC) Received: from mail-vk1-xa33.google.com (mail-vk1-xa33.google.com [IPv6:2607:f8b0:4864:20::a33]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9E5D610E507 for ; Fri, 31 Dec 2021 01:39:44 +0000 (UTC) Received: by mail-vk1-xa33.google.com with SMTP id u198so14570616vkb.13 for ; Thu, 30 Dec 2021 17:39:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OT9Xu/jnBb8H1U17d0/7iXcChZ/+dLJThXHPYF1IBv4=; b=ldcBoKa/nSPNkYtkxDEQw1R7JQuXE5xQHwX4JbE1W+zCW4RPXnI0lVDBQPvbX+POvc jiRag6fv0JVdBK4nNlweJVnuvEO1tVd9MctznKgPok8lA7PHf/2lPab/2MzHwECdAVtk vd137kiD/Sj9eQu4PxnO5R08srk9ymQtGcfobScrLDZwAhhpkxkt6a+DHayDYQtrcwhS pHV8p3q+rN5jroaeYIDpL0DXqRmaTJvwRo3LcsllU8XwdvnQBP6WL6Dubq7omDMC7wuo c369oznCBpnobwiAb29p+C4uAlzdq0knzTHn/21tb9HURT99tbcEz3DhDwBb6yoBDjpD Ag3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OT9Xu/jnBb8H1U17d0/7iXcChZ/+dLJThXHPYF1IBv4=; b=HsrfoOSnH97/JStUgQ7eKuYnNyqLq3vX+YTHVRy5hyr4BYU9o9Hv0EAqVP8ZcyJD+6 itOaH1QMM8Ys97zutwgVFzvNiqlq9MgMLBS1HLSWzwboS19TYUu6gWfriahxsndzcvwr 49gh+kGL9O/EGn/g5LMR+jwa9u/csNZQy9yjVnJSanGS2LFL01xmf/M0jUHfzcqSBo86 S0TonuyKBcwbDlMj4g98xvpuVjYPU2jucYmHniHYxRduTLucwLfhCb7GII8KTBi9wmJV MUlcdxa54BbRjNR85utKiBil8HAYzU2wdxNfYuDvsUmc5rsjLDyJcHPSkvMf7u36hTWU +kTA== X-Gm-Message-State: AOAM533ts5E9MJWPkJ42G1ZrO1LboKyqOpbbbGUzSeWUkZHnKziKxA3f BvhmjEJLf5Xbyc2jWU9ekq0= X-Google-Smtp-Source: ABdhPJxCRthv8kjYM/PiFOfF0UMUkC0mSew1nncvGPv4zP3jfakjH9f/e1ldlr2CgZ2+jRaD+kxLyQ== X-Received: by 2002:a05:6122:2001:: with SMTP id l1mr11507628vkd.16.1640914783792; Thu, 30 Dec 2021 17:39:43 -0800 (PST) Received: from localhost.localdomain ([2804:14c:485:504a:d549:ed49:6dac:47ee]) by smtp.gmail.com with ESMTPSA id t20sm3754993vsj.11.2021.12.30.17.39.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Dec 2021 17:39:43 -0800 (PST) From: Fabio Estevam To: linux@armlinux.org.uk Subject: [PATCH 2/2] drm/i2c/tda998x: Implement atomic_get_input_bus_fmts Date: Thu, 30 Dec 2021 22:39:30 -0300 Message-Id: <20211231013930.139754-2-festevam@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211231013930.139754-1-festevam@gmail.com> References: <20211231013930.139754-1-festevam@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, dri-devel@lists.freedesktop.org, laurent.pinchart@ideasonboard.com, tomm.merciai@gmail.com, pbrobinson@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Implement the .atomic_get_input_bus_fmts callback to let the bridge indicate the pixel format it requires on the parallel bus to the LCDIF. Based on Marek's commit db8b7ca5b232 ("drm/bridge: ti-sn65dsi83: Replace connector format patching with atomic_get_input_bus_fmts"). Tested on a imx6sx-udoo-neo board. Suggested-by: Marek Vasut Signed-off-by: Fabio Estevam Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/i2c/tda998x_drv.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index adaa985af87e..d987481e97c1 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -1678,6 +1678,31 @@ static void tda998x_bridge_mode_set(struct drm_bridge *bridge, mutex_unlock(&priv->audio_mutex); } +#define MAX_INPUT_SEL_FORMATS 1 + +static u32 * +tda998x_atomic_get_input_bus_fmts(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state, + u32 output_fmt, + unsigned int *num_input_fmts) +{ + u32 *input_fmts; + + *num_input_fmts = 0; + + input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), + GFP_KERNEL); + if (!input_fmts) + return NULL; + + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24; + *num_input_fmts = 1; + + return input_fmts; +} + static const struct drm_bridge_funcs tda998x_bridge_funcs = { .attach = tda998x_bridge_attach, .detach = tda998x_bridge_detach, @@ -1685,6 +1710,10 @@ static const struct drm_bridge_funcs tda998x_bridge_funcs = { .atomic_disable = tda998x_bridge_atomic_disable, .mode_set = tda998x_bridge_mode_set, .atomic_enable = tda998x_bridge_atomic_enable, + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_get_input_bus_fmts = tda998x_atomic_get_input_bus_fmts, }; /* I2C driver functions */