From patchwork Wed Jun 5 10:35:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Qian Wang X-Patchwork-Id: 10976587 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 23B6876 for ; Wed, 5 Jun 2019 10:35:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 157F61FFCD for ; Wed, 5 Jun 2019 10:35:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0870B27FAC; Wed, 5 Jun 2019 10:35:40 +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 2CE9C2863B for ; Wed, 5 Jun 2019 10:35:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 28BF7894DD; Wed, 5 Jun 2019 10:35:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60048.outbound.protection.outlook.com [40.107.6.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5017789350 for ; Wed, 5 Jun 2019 10:35:35 +0000 (UTC) Received: from VE1PR08MB5006.eurprd08.prod.outlook.com (10.255.159.31) by VE1PR08MB4670.eurprd08.prod.outlook.com (10.255.114.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1943.22; Wed, 5 Jun 2019 10:35:32 +0000 Received: from VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::206b:5cf6:97e:1358]) by VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::206b:5cf6:97e:1358%7]) with mapi id 15.20.1943.018; Wed, 5 Jun 2019 10:35:32 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey , "maarten.lankhorst@linux.intel.com" , "sean@poorly.run" Subject: [PATCH 1/3] drm/komeda: Unify mclk/pclk/pipeline->aclk to one MCLK Thread-Topic: [PATCH 1/3] drm/komeda: Unify mclk/pclk/pipeline->aclk to one MCLK Thread-Index: AQHVG4pnBDzr0NGrek2q4CapHlQ2Aw== Date: Wed, 5 Jun 2019 10:35:32 +0000 Message-ID: <20190605103506.22863-2-james.qian.wang@arm.com> References: <20190605103506.22863-1-james.qian.wang@arm.com> In-Reply-To: <20190605103506.22863-1-james.qian.wang@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-clientproxiedby: HK0PR03CA0041.apcprd03.prod.outlook.com (2603:1096:203:2f::29) To VE1PR08MB5006.eurprd08.prod.outlook.com (2603:10a6:803:113::31) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 67296dcd-f70f-46da-87f4-08d6e9a18952 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:VE1PR08MB4670; x-ms-traffictypediagnostic: VE1PR08MB4670: nodisclaimer: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:305; x-forefront-prvs: 00594E8DBA x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(136003)(366004)(396003)(346002)(199004)(189003)(103116003)(3846002)(110136005)(86362001)(81156014)(81166006)(2501003)(36756003)(66066001)(71200400001)(71190400001)(1076003)(52116002)(316002)(4326008)(99286004)(2906002)(76176011)(256004)(14444005)(54906003)(26005)(8676002)(6116002)(2201001)(386003)(68736007)(55236004)(102836004)(25786009)(7736002)(14454004)(6506007)(2616005)(11346002)(50226002)(486006)(446003)(53936002)(6512007)(476003)(6486002)(6436002)(305945005)(8936002)(73956011)(66446008)(64756008)(66556008)(66476007)(66946007)(186003)(478600001)(5660300002); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB4670; H:VE1PR08MB5006.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: BvpQE7fiGm2dtRfKyB2SfU7F6//ahKKmIyLNkmXGlPNDoym+v3WJDHG+3WjohUoq+4faOR16nLSn1HKjYWlwRCd4EVV9LmhJI+U0rRPt3f+flR09EiFpIwgNqpgXUFWxj7KPcIUHTKJ7/J+IiJSpZj/sddekzwlSwSGUHshz2wR/b2FT4Go7AlxxiLv2pJpNRpRzfNjyH+lf603O9wT+C9Gz/nrqciZWZMtw5OqKxPZl6rkoUi7Hwur+fHFsXDfsG0vPtdJVF1eWu67mURUn7JD+aHZVrLgLf6qbOpMXN+tUcdHyvkIQV0RJCVRCi9P+26qWLI89nh91BqevlgkcQXsyCIkx3+AGp58vr+0bNpyUECR5js82Evgg46Ciero/9OXGT8+AFoJAkdHdh/mWcGwngBAbmhAf+5+U71paOVM= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67296dcd-f70f-46da-87f4-08d6e9a18952 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jun 2019 10:35:32.5815 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: james.qian.wang@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4670 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zth6lmIUC0ihXdvvS2iNEHbpzEVMrZ66ZzIhVxRYYhs=; b=Jw7pjVBb4fVy6/qJLLM64LNzMsMKMLOgFotYmcT2+UldHMxXa3fP365BTpbhMNCLEaqehEs2zfJKrA2U75ohJmH7YdTRxiwS6M4ugDg8wdPNFRX0PZU5v6puY3l4mWZ174Ao1TTCjb4eBcoGyP3NeQSWGKYEmtOip3rUg+N3EWo= X-Mailman-Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; 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: nd , Ayan Halder , "Oscar Zhang \(Arm Technology China\)" , "Tiannan Zhu \(Arm Technology China\)" , "Jonathan Chai \(Arm Technology China\)" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Julien Yin \(Arm Technology China\)" , "Channing Chen \(Arm Technology China\)" , "james qian wang \(Arm Technology China\)" , "Yiqi Kang \(Arm Technology China\)" , "thomas Sun \(Arm Technology China\)" , "Lowry Li \(Arm Technology China\)" , Ben Davis Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Current komeda driver uses three dedicated clks for a specific purpose: - mclk: main engine clock - pclk: APB clock - pipeline->aclk: AXI clock. But per spec the komeda HW only has three input clks: - ACLK: used for AXI masters, APB slave and most pipeline processing - PXCLK for pipeline 0: output pixel clock for pipeline 0 - PXCLK for pipeline 1: output pixel clock for pipeline 1 So one ACLK is enough, no need to split it to three mclk/pclk/axiclk. drop pclk/pipeline->axiclk. but only keep one mclk in komeda driver. Signed-off-by: James Qian Wang (Arm Technology China) --- .../gpu/drm/arm/display/komeda/komeda_crtc.c | 11 ------- .../gpu/drm/arm/display/komeda/komeda_dev.c | 33 ++++--------------- .../gpu/drm/arm/display/komeda/komeda_dev.h | 2 -- .../drm/arm/display/komeda/komeda_pipeline.c | 1 - .../drm/arm/display/komeda/komeda_pipeline.h | 2 -- 5 files changed, 7 insertions(+), 42 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index b5190a1f75eb..3933f4377cc1 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -127,9 +127,6 @@ komeda_crtc_prepare(struct komeda_crtc *kcrtc) DRM_ERROR("failed to enable mclk.\n"); } - err = clk_prepare_enable(master->aclk); - if (err) - DRM_ERROR("failed to enable axi clk for pipe%d.\n", master->id); err = clk_set_rate(master->pxlclk, pxlclk_rate); if (err) DRM_ERROR("failed to set pxlclk for pipe%d\n", master->id); @@ -170,7 +167,6 @@ komeda_crtc_unprepare(struct komeda_crtc *kcrtc) mdev->dpmode = new_mode; clk_disable_unprepare(master->pxlclk); - clk_disable_unprepare(master->aclk); if (new_mode == KOMEDA_MODE_INACTIVE) clk_disable_unprepare(mdev->mclk); @@ -374,13 +370,6 @@ komeda_crtc_mode_valid(struct drm_crtc *crtc, const struct drm_display_mode *m) return MODE_CLOCK_HIGH; } - if (clk_round_rate(master->aclk, mode_clk) < pxlclk) { - DRM_DEBUG_ATOMIC("aclk can't satisfy the requirement of %s-clk: %ld.\n", - m->name, pxlclk); - - return MODE_CLOCK_HIGH; - } - return MODE_OK; } diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c index 485d8bd12e39..f8f6edbf6f0d 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c @@ -115,13 +115,6 @@ static int komeda_parse_pipe_dt(struct komeda_dev *mdev, struct device_node *np) pipe = mdev->pipelines[pipe_id]; - clk = of_clk_get_by_name(np, "aclk"); - if (IS_ERR(clk)) { - DRM_ERROR("get aclk for pipeline %d failed!\n", pipe_id); - return PTR_ERR(clk); - } - pipe->aclk = clk; - clk = of_clk_get_by_name(np, "pxclk"); if (IS_ERR(clk)) { DRM_ERROR("get pxclk for pipeline %d failed!\n", pipe_id); @@ -144,14 +137,8 @@ static int komeda_parse_dt(struct device *dev, struct komeda_dev *mdev) { struct platform_device *pdev = to_platform_device(dev); struct device_node *child, *np = dev->of_node; - struct clk *clk; int ret; - clk = devm_clk_get(dev, "mclk"); - if (IS_ERR(clk)) - return PTR_ERR(clk); - - mdev->mclk = clk; mdev->irq = platform_get_irq(pdev, 0); if (mdev->irq < 0) { DRM_ERROR("could not get IRQ number.\n"); @@ -205,16 +192,15 @@ struct komeda_dev *komeda_dev_create(struct device *dev) goto err_cleanup; } - mdev->pclk = devm_clk_get(dev, "pclk"); - if (IS_ERR(mdev->pclk)) { - DRM_ERROR("Get APB clk failed.\n"); - err = PTR_ERR(mdev->pclk); - mdev->pclk = NULL; + mdev->mclk = devm_clk_get(dev, "mclk"); + if (IS_ERR(mdev->mclk)) { + DRM_ERROR("Get engine clk failed.\n"); + err = PTR_ERR(mdev->mclk); + mdev->mclk = NULL; goto err_cleanup; } - /* Enable APB clock to access the registers */ - clk_prepare_enable(mdev->pclk); + clk_prepare_enable(mdev->mclk); mdev->funcs = product->identify(mdev->reg_base, &mdev->chip); if (!komeda_product_match(mdev, product->product_id)) { @@ -315,15 +301,10 @@ void komeda_dev_destroy(struct komeda_dev *mdev) } if (mdev->mclk) { + clk_disable_unprepare(mdev->mclk); devm_clk_put(dev, mdev->mclk); mdev->mclk = NULL; } - if (mdev->pclk) { - clk_disable_unprepare(mdev->pclk); - devm_clk_put(dev, mdev->pclk); - mdev->pclk = NULL; - } - devm_kfree(dev, mdev); } diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h index 5126879d597e..5feaed2dc93f 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h @@ -160,8 +160,6 @@ struct komeda_dev { struct komeda_chip_info chip; /** @fmt_tbl: initialized by &komeda_dev_funcs->init_format_table */ struct komeda_format_caps_table fmt_tbl; - /** @pclk: APB clock for register access */ - struct clk *pclk; /** @mclk: HW main engine clk */ struct clk *mclk; diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c index 0bb443b336f7..78e44d9e1520 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c @@ -53,7 +53,6 @@ void komeda_pipeline_destroy(struct komeda_dev *mdev, } clk_put(pipe->pxlclk); - clk_put(pipe->aclk); of_node_put(pipe->of_output_dev); of_node_put(pipe->of_output_port); diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h index 0c3f101e0dce..090a5d92d5f1 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h @@ -388,8 +388,6 @@ struct komeda_pipeline { struct komeda_dev *mdev; /** @pxlclk: pixel clock */ struct clk *pxlclk; - /** @aclk: AXI clock */ - struct clk *aclk; /** @id: pipeline id */ int id; /** @avail_comps: available components mask of pipeline */