From patchwork Tue Mar 5 10:08:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 10840517 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 5C72E1669 for ; Wed, 6 Mar 2019 08:09:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A8252CAFD for ; Wed, 6 Mar 2019 08:09:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E91F2CBFD; Wed, 6 Mar 2019 08:09:33 +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=BAD_ENC_HEADER,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 DC78C2CAFD for ; Wed, 6 Mar 2019 08:09:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7D3A66E0AD; Wed, 6 Mar 2019 08:09:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from esa1.microchip.iphmx.com (esa1.microchip.iphmx.com [68.232.147.91]) by gabe.freedesktop.org (Postfix) with ESMTPS id 14B3089BF1 for ; Tue, 5 Mar 2019 10:08:10 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.58,443,1544511600"; d="scan'208";a="28727151" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 05 Mar 2019 03:08:09 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Mar 2019 03:08:08 -0700 Received: from MWHPR11MB1549.namprd11.prod.outlook.com (10.172.54.17) by MWHPR11MB1647.namprd11.prod.outlook.com (10.172.55.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.21; Tue, 5 Mar 2019 10:08:06 +0000 Received: from MWHPR11MB1549.namprd11.prod.outlook.com ([fe80::54fe:95ed:b0cf:55a6]) by MWHPR11MB1549.namprd11.prod.outlook.com ([fe80::54fe:95ed:b0cf:55a6%9]) with mapi id 15.20.1665.020; Tue, 5 Mar 2019 10:08:06 +0000 From: To: , , , , , , , , , Subject: [PATCH v2 6/7] drm: atmel-hlcdc: enable sys_clk during initalization. Thread-Topic: [PATCH v2 6/7] drm: atmel-hlcdc: enable sys_clk during initalization. Thread-Index: AQHU0ztTj0DTJY9F7UiMYZcuK/OaDw== Date: Tue, 5 Mar 2019 10:08:06 +0000 Message-ID: <1551780434-4580-7-git-send-email-claudiu.beznea@microchip.com> References: <1551780434-4580-1-git-send-email-claudiu.beznea@microchip.com> In-Reply-To: <1551780434-4580-1-git-send-email-claudiu.beznea@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0502CA0011.eurprd05.prod.outlook.com (2603:10a6:803:1::24) To MWHPR11MB1549.namprd11.prod.outlook.com (2603:10b6:301:c::17) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [94.177.32.154] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c8a74836-6dd4-413a-b04b-08d6a15275fc x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:MWHPR11MB1647; x-ms-traffictypediagnostic: MWHPR11MB1647: x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; MWHPR11MB1647; 23:BVJdaMVkJizzHuljx4ewjOF/Knbj5Mm/UkDRlvs?= =?iso-8859-1?q?Y/0zfKrA3X3ZRgK?= =?iso-8859-1?q?Y5irBufga/ONMou2VLSk/3QPgvslxpvpBDX/ygWdt3cuPUAhROptOtMe2iFR?= =?iso-8859-1?q?2MLjzDBXYfnXygUFTfTPUiFwdvs5CKAawv4hYfYk79u/d3eOZSdVtY7XISDx?= =?iso-8859-1?q?+FcQ6pN2imlyDVxHxqjAjjHOA+oTG3UV7f24DCuxQ1BOhQjdGjk+vx77sf6l?= =?iso-8859-1?q?K8xG5Cw4R1tZfAdtsvWTeGlNBI4P82LZivaCIRaLRN05mc1vEmImWPU5fWPy?= =?iso-8859-1?q?YUDGM6oGpjVKR0ncRUh2hHrWb6QllrJbfFh3U1kRwiwQuggsdqCm9SFAveFN?= =?iso-8859-1?q?+VZHwGDYyFjEZiWAwmCKdFNnh1DBEnmuzH1MDlulbdupW1tKlSo1jl650JPk?= =?iso-8859-1?q?jMuoEsnJQ0QPOsGueL/1O9J2uf6oF8FoDQE8OGgM9r2+/moOJs37MxWtG225?= =?iso-8859-1?q?gjF7AYX/xHY1zYzKC02II+ASsrw3HKNy6kRje/+3KmFiVGTz6imOH3Ea+OEo?= =?iso-8859-1?q?KvImEpAxkpyyVZDDOJNd04LtaS+M5Uxl9Bghfh3PKTlPXtyXe5xkKi2UgO7H?= =?iso-8859-1?q?GZFw88Db/VlxHRCzJTTvgR9WxMKovxUjz2Iv3U10ktGdWi65ZQC0oIUD8tvh?= =?iso-8859-1?q?blhgF+CHrIw84dz8ouvKeY7CDHOtcQcb3ZSHd0JRqhE/6Yetg0qRitqiJGbl?= =?iso-8859-1?q?ZnwuNFobxZ787WUwdTaz0koi1rdpyQ1Hu3S9IuwCLQYVZWkyeAAZZZlrYjG+?= =?iso-8859-1?q?vCXYmRYUtkjBmu8AVLwF48AH1TuUyMICv/8LYr1F87Ma/qBBMg+IXtWDZxrJ?= =?iso-8859-1?q?/LldEPtC2yNFbI/j3DFFk5PhbfdOwnEE1/lEWjgESWtVd3FE21lrVMSiQU1o?= =?iso-8859-1?q?0n8zPDJOEdnjpON8zTz5ECJfYkdMQS5Iq3/xxWrVmjzaohYP/+C8L7Gf9qDb?= =?iso-8859-1?q?9y/jFo1/5c9U3LOpdz/DutKAscH0l2twjIyAvndnXYcK3UfRYmu2BHIUPEUK?= =?iso-8859-1?q?hKoiBUdpLecRrYxJ50kngitmeLMbCZhoAiS0QDoMhrJNpirn9ukhsunqJ+XB?= =?iso-8859-1?q?oGu1v0+zf6iEwHFu1Yw7wllifSvSqi6p3peKUczFMc1IJlZhb7zpfCQPEPwl?= =?iso-8859-1?q?K/Ffp4BPoUROxTY9wHUGqNBi4uiZOELPxbpA3FnlJbOv0GW35o3G7UswCY3T?= =?iso-8859-1?q?0uBU8wWZG171hKPH1rEW7XEkCftyiOeR+GekRiygwdr7PLbk+G1UQ9yEAVNd?= =?iso-8859-1?q?px7kTNeHgC+mw3pkVyjmNvF15Kz940adE0wlcmJPz6nG8OYf1kihQUa0AcXg?= =?iso-8859-1?q?Md/kYRypGt8TwQMTxNJdwBjzVtC/W0?= x-microsoft-antispam-prvs: x-forefront-prvs: 0967749BC1 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(396003)(39860400002)(346002)(136003)(366004)(199004)(189003)(106356001)(72206003)(3846002)(99286004)(81156014)(52116002)(36756003)(76176011)(14454004)(81166006)(66066001)(8676002)(110136005)(6116002)(105586002)(6486002)(7736002)(5660300002)(8936002)(305945005)(25786009)(102836004)(54906003)(97736004)(316002)(2906002)(7416002)(2501003)(2616005)(186003)(71190400001)(6506007)(386003)(256004)(476003)(68736007)(11346002)(71200400001)(6512007)(2201001)(107886003)(53936002)(446003)(50226002)(486006)(4326008)(86362001)(6436002)(478600001)(14444005)(26005)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR11MB1647; H:MWHPR11MB1549.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: HlP00Fi6Cby7UCgqkDLn9JYuuA+pz3BMZv9ayEAuoAA33IfRwDdjDocvB3VKsXkmmDyp73i0PptxzYNVfB+olp+3+3uQeR5atkmgxZy0xjQCg5DDkAqzRlfigvUKX9cexibsFFfsjHiHotVAW5/U59++s8a25C/lRaqJazwg2tF9pyo5vcIByBdzV9oKZbRw1YlqLdOf4bwZgejT1DeiDha0BO6QbMJcs+c1PAGcZe4MaZra6iT6mAtkmCRHAYmA5Q5YcmIH8LRh0j9fOTQugFkDxRqyHhz5OC9scuoOLEW7NjpTR27AryyFtQL5uW0v6IDLNuRQcjGFA7720KgaAFBA/hOkV/Onf5cMHA5ll3QcTIm0Nw2oeLXaQj8V3oLKw/4yDhXyO5bTNR95z+RhdZTDBT9efIC33MxO7Yn32nw= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: c8a74836-6dd4-413a-b04b-08d6a15275fc X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Mar 2019 10:08:06.2572 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1647 X-OriginatorOrg: microchip.com X-Mailman-Approved-At: Wed, 06 Mar 2019 08:09:28 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f2LlApE9KLEwvJ1Xgh4TXz5Ls7//fcDvuKAIwlZx2AU=; b=umEs3RHrp3THL2GfaNgs6SMWdxbRQYwcTeKAX+WQ/ofYnVV4V5rf0oFoIbvFK0sqT331vhngXlzbBVVzZL6kVnVCDeOjhadYhmVtMnY/ESKozUrNeYyrJTYJHTvRmz3BoQgg/bIp3RwvPyRcx/5IT83G5mGhAuHVZuZ+z7CeM3k= X-Mailman-Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Claudiu.Beznea@microchip.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: devicetree@vger.kernel.org, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Sandeep.Sheriker@microchip.com, Claudiu.Beznea@microchip.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sandeep Sheriker Mallikarjun For SAM9X60 SoC, sys_clk is through lcd_gclk clock source and this needs to be enabled before enabling lcd_clk. Signed-off-by: Sandeep Sheriker Mallikarjun [claudiu.beznea@microchip.com: add fixed_clksrc checks] Signed-off-by: Claudiu Beznea --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c index 0be13eceedba..8bf51f853721 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c @@ -625,10 +625,18 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev) dc->hlcdc = dev_get_drvdata(dev->dev->parent); dev->dev_private = dc; + if (dc->desc->fixed_clksrc) { + ret = clk_prepare_enable(dc->hlcdc->sys_clk); + if (ret) { + dev_err(dev->dev, "failed to enable sys_clk\n"); + goto err_destroy_wq; + } + } + ret = clk_prepare_enable(dc->hlcdc->periph_clk); if (ret) { dev_err(dev->dev, "failed to enable periph_clk\n"); - goto err_destroy_wq; + goto err_sys_clk_disable; } pm_runtime_enable(dev->dev); @@ -664,6 +672,9 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev) err_periph_clk_disable: pm_runtime_disable(dev->dev); clk_disable_unprepare(dc->hlcdc->periph_clk); +err_sys_clk_disable: + if (dc->desc->fixed_clksrc) + clk_disable_unprepare(dc->hlcdc->sys_clk); err_destroy_wq: destroy_workqueue(dc->wq); @@ -688,6 +699,8 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev) pm_runtime_disable(dev->dev); clk_disable_unprepare(dc->hlcdc->periph_clk); + if (dc->desc->fixed_clksrc) + clk_disable_unprepare(dc->hlcdc->sys_clk); destroy_workqueue(dc->wq); } @@ -805,6 +818,8 @@ static int atmel_hlcdc_dc_drm_suspend(struct device *dev) regmap_read(regmap, ATMEL_HLCDC_IMR, &dc->suspend.imr); regmap_write(regmap, ATMEL_HLCDC_IDR, dc->suspend.imr); clk_disable_unprepare(dc->hlcdc->periph_clk); + if (dc->desc->fixed_clksrc) + clk_disable_unprepare(dc->hlcdc->sys_clk); return 0; } @@ -814,6 +829,8 @@ static int atmel_hlcdc_dc_drm_resume(struct device *dev) struct drm_device *drm_dev = dev_get_drvdata(dev); struct atmel_hlcdc_dc *dc = drm_dev->dev_private; + if (dc->desc->fixed_clksrc) + clk_prepare_enable(dc->hlcdc->sys_clk); clk_prepare_enable(dc->hlcdc->periph_clk); regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, dc->suspend.imr);