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: 127255 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp81765vqg; Thu, 27 Jul 2023 16:53:11 -0700 (PDT) X-Google-Smtp-Source: APBJJlH6taPWcVN2QTdZHYe9gORmt5F5vkSA1fNV3LOQQCiqlcqzbFSzCQMrLRm0JOpi5Tf6fkdV X-Received: by 2002:a05:6870:4251:b0:1ba:199a:984a with SMTP id v17-20020a056870425100b001ba199a984amr1093598oac.55.1690501991034; Thu, 27 Jul 2023 16:53:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690501991; cv=none; d=google.com; s=arc-20160816; b=up63dA6vIYFpDE2zBA1qtcmhZYZSvOkSSj71HojbF1N9ypkMw10EddzfuL1pFMXl4k DqXq4oq7WL3Vi4QxiGu5WseIzw7BUGHHR8+wbfHdkhsTCtyCjvF0vlfxwbjZ6QiewZqE nAoBehg9g638QkMxipCs8OoHcKkCYwwwLLPVKZwVUHJc6t9NI2dbnjXLglWCp6IDySpl oDXvqty2eND8cbPJ29J2bqLqxQLkXRDVJ9ngzZyaWr3wpjJ+2UBDwRCBOM8pCGsdZtTd GtxThL7nTOmdezp68sM2aT18UMLGwQ/5IIplo3SSwAWog+kddBmGnXUm7AcVEYyr+bQa PFlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KmnZ+NHz7PM0U1A/IX51H2Bjow4KLdppH5jj9uz/ocI=; fh=YlaQJ3TP8tbT2RGJU1jM+MHAbXw6RYFhYgmjWx/ZxUI=; b=PqbFY6hdlS7nnM7zY/cnh8woSmCjow2C/v9euFCimBpw/Lb75GZHiwK2UBNdFormEZ u2I6D775/ZvuMYrOdpSqqtZvvz3wASMg4xprVYrnxhvr6yBo4Z/hgXa4499oGMX5X7Dl s6N6PR2cfH/+L/GKywvov+PJaYBVLZG8Fp9c+qIEECqLl7ll0LNOcZd9MVtADQBOATtK RhB+NEQi5K190d+9UswmTmFCkcspPe8/b2c4EJB9IzWBr0LdNzGqVOIb6KbnJ0tFOH8n 3NLO+SrsZ7nETisvDsp/amiT9fhXEOjqoqGQoGxvlP9JZO65WyJrZ3jDbhbaRCIV12vZ rMKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@me.com header.s=1a1hai header.b=HfaFosew; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=me.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fe9-20020a056a002f0900b00686d854cb0dsi1961826pfb.23.2023.07.27.16.52.49; Thu, 27 Jul 2023 16:53:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@me.com header.s=1a1hai header.b=HfaFosew; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=me.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232741AbjG0Vxs (ORCPT + 99 others); Thu, 27 Jul 2023 17:53:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232706AbjG0VxU (ORCPT ); Thu, 27 Jul 2023 17:53:20 -0400 Received: from qs51p00im-qukt01080501.me.com (qs51p00im-qukt01080501.me.com [17.57.155.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7468526AE for ; Thu, 27 Jul 2023 14:52:54 -0700 (PDT) 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 Cc: Alain Volmat , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772619815856291509 X-GMAIL-MSGID: 1772619815856291509 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; }