From patchwork Thu Jul 27 21:51:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 13330814 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 C65E2EB64DD for ; Thu, 27 Jul 2023 21:59:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1B59F10E60C; Thu, 27 Jul 2023 21:59:26 +0000 (UTC) Received: from qs51p00im-qukt01080501.me.com (qs51p00im-qukt01080501.me.com [17.57.155.22]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8EFBF10E60C for ; Thu, 27 Jul 2023 21:59:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1690494770; bh=KmnZ+NHz7PM0U1A/IX51H2Bjow4KLdppH5jj9uz/ocI=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=HfaFosewupSVW4LocN+Fh45yv/yOk7DM9vl1uPwvbMH+nnbcnyarbV9vT40J2YooV UYMrQFw1oPX8FyWjC4KfhWDMT1KtcbCydp+3dKYrphHGkml97N29HcFeTPMiZTld/X 89F2gfJZ2zapirmPqwaGu2ww6kZ5RvNlTwSRo5ll5x/T4vjkF19qNs9OHlmossenC2 R607BIJEEV44c0Qg1g2sy27AQFbd4zC1ZbNH8dzq5IQuAPlvuxFAkxIVR1Rl5xxJ0v CB1NZXHlgHphrtEdk0ICdE8UKPEYMRiQ0O0P9W3U8nVvq5bPjwbd3NNcOgirSqZxuG 0qXkjFvsyO5dQ== Received: from localhost (qs51p00im-dlb-asmtp-mailmevip.me.com [17.57.155.28]) by qs51p00im-qukt01080501.me.com (Postfix) with ESMTPSA id 0D14B1980373; Thu, 27 Jul 2023 21:52:49 +0000 (UTC) From: Alain Volmat To: Alain Volmat , David Airlie , Daniel Vetter Subject: [PATCH 10/14] drm/sti: add compositor support for stih418 platform Date: Thu, 27 Jul 2023 21:51:34 +0000 Message-Id: <20230727215141.53910-11-avolmat@me.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230727215141.53910-1-avolmat@me.com> References: <20230727215141.53910-1-avolmat@me.com> MIME-Version: 1.0 X-Proofpoint-GUID: caJkhSSYKcGWfwaRe3kL8KLlbXUXZNhq X-Proofpoint-ORIG-GUID: caJkhSSYKcGWfwaRe3kL8KLlbXUXZNhq X-Proofpoint-Virus-Version: =?utf-8?q?vendor=3Dfsecure_engine=3D1=2E1=2E170-?= =?utf-8?q?22c6f66c430a71ce266a39bfe25bc2903e8d5c8f=3A6=2E0=2E138=2C18=2E0?= =?utf-8?q?=2E790=2C17=2E11=2E62=2E513=2E0000000_definitions=3D2022-01-12=5F?= =?utf-8?q?02=3A2020-02-14=5F02=2C2022-01-12=5F02=2C2021-12-02=5F01_signatur?= =?utf-8?q?es=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 malwarescore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2307270198 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Alain Volmat Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On the STiH418, a new clock (proc_mixer) must be enabled in order to have the plane mixers properly behaving. Add a new st,stih418-compositor in order to describe the planes/mixers available on this platform. Signed-off-by: Alain Volmat --- drivers/gpu/drm/sti/sti_compositor.c | 26 ++++++++++++++++++++++++++ drivers/gpu/drm/sti/sti_compositor.h | 2 ++ drivers/gpu/drm/sti/sti_crtc.c | 11 +++++++++++ 3 files changed, 39 insertions(+) diff --git a/drivers/gpu/drm/sti/sti_compositor.c b/drivers/gpu/drm/sti/sti_compositor.c index 4bd7e305ab75..dfea3c1191a6 100644 --- a/drivers/gpu/drm/sti/sti_compositor.c +++ b/drivers/gpu/drm/sti/sti_compositor.c @@ -43,6 +43,23 @@ static const struct sti_compositor_data stih407_compositor_data = { }, }; +/* + * stiH418 compositor properties + */ +static const struct sti_compositor_data stih418_compositor_data = { + .nb_subdev = 8, + .subdev_desc = { + {STI_GPDPLUS_SUBDEV, (int)STI_GDP_0, 0x00000}, + {STI_GPDPLUS_SUBDEV, (int)STI_GDP_1, 0x10000}, + {STI_GPDPLUS_SUBDEV, (int)STI_GDP_2, 0x20000}, + {STI_GPDPLUS_SUBDEV, (int)STI_GDP_3, 0x30000}, + {STI_GPD_SUBDEV, (int)STI_GDP_4, 0x40000}, + {STI_GPD_SUBDEV, (int)STI_GDP_5, 0x50000}, + {STI_MIXER_MAIN_SUBDEV, STI_MIXER_MAIN, 0x100000}, + {STI_MIXER_AUX_SUBDEV, STI_MIXER_AUX, 0x110000}, + }, +}; + void sti_compositor_debugfs_init(struct sti_compositor *compo, struct drm_minor *minor) { @@ -169,6 +186,9 @@ static const struct of_device_id compositor_of_match[] = { { .compatible = "st,stih407-compositor", .data = &stih407_compositor_data, + }, { + .compatible = "st,stih418-compositor", + .data = &stih418_compositor_data, }, { /* end node */ } @@ -236,6 +256,12 @@ static int sti_compositor_probe(struct platform_device *pdev) return PTR_ERR(compo->clk_pix_aux); } + compo->clk_proc_mixer = devm_clk_get_optional(dev, "proc_mixer"); + if (IS_ERR(compo->clk_proc_mixer)) { + DRM_ERROR("Cannot get proc_mixer clock\n"); + return PTR_ERR(compo->clk_proc_mixer); + } + /* Get reset resources */ compo->rst_main = devm_reset_control_get_shared(dev, "compo-main"); /* Take compo main out of reset */ diff --git a/drivers/gpu/drm/sti/sti_compositor.h b/drivers/gpu/drm/sti/sti_compositor.h index 62545210b96d..fdc655f78579 100644 --- a/drivers/gpu/drm/sti/sti_compositor.h +++ b/drivers/gpu/drm/sti/sti_compositor.h @@ -57,6 +57,7 @@ struct sti_compositor_data { * @clk_compo_aux: clock for aux compo * @clk_pix_main: pixel clock for main path * @clk_pix_aux: pixel clock for aux path + * @clk_proc_mixer: clock for the mixers * @rst_main: reset control of the main path * @rst_aux: reset control of the aux path * @mixer: array of mixers @@ -72,6 +73,7 @@ struct sti_compositor { struct clk *clk_compo_aux; struct clk *clk_pix_main; struct clk *clk_pix_aux; + struct clk *clk_proc_mixer; struct reset_control *rst_main; struct reset_control *rst_aux; struct sti_mixer *mixer[STI_MAX_MIXER]; diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c index 3c7154f2d5f3..d93764e99b0e 100644 --- a/drivers/gpu/drm/sti/sti_crtc.c +++ b/drivers/gpu/drm/sti/sti_crtc.c @@ -67,6 +67,12 @@ sti_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode) pix_clk = compo->clk_pix_aux; } + /* Enable the mixer processing clock (if applicable) */ + if (clk_prepare_enable(compo->clk_proc_mixer)) { + DRM_INFO("Failed to prepare/enable processing mixer clk\n"); + goto proc_mixer_error; + } + /* Prepare and enable the compo IP clock */ if (clk_prepare_enable(compo_clk)) { DRM_INFO("Failed to prepare/enable compositor clk\n"); @@ -97,6 +103,8 @@ sti_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode) pix_error: clk_disable_unprepare(compo_clk); compo_error: + clk_disable_unprepare(compo->clk_proc_mixer); +proc_mixer_error: return -EINVAL; } @@ -122,6 +130,9 @@ static void sti_crtc_disable(struct drm_crtc *crtc) clk_disable_unprepare(compo->clk_compo_aux); } + /* Disable the mixer clock (if applicable) */ + clk_disable_unprepare(compo->clk_proc_mixer); + mixer->status = STI_MIXER_DISABLED; }