From patchwork Thu Jun 13 15:13:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayan Halder X-Patchwork-Id: 10992155 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 022DE1515 for ; Thu, 13 Jun 2019 15:13:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E49F41FF41 for ; Thu, 13 Jun 2019 15:13:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7F86205FD; Thu, 13 Jun 2019 15:13:16 +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 7A9341FF41 for ; Thu, 13 Jun 2019 15:13:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 12B8689B06; Thu, 13 Jun 2019 15:13:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-ve1eur03on0624.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe09::624]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0A9EF89B06 for ; Thu, 13 Jun 2019 15:13:13 +0000 (UTC) Received: from AM0PR08MB4226.eurprd08.prod.outlook.com (20.179.36.17) by AM0PR08MB4468.eurprd08.prod.outlook.com (20.179.35.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1987.12; Thu, 13 Jun 2019 15:13:10 +0000 Received: from AM0PR08MB4226.eurprd08.prod.outlook.com ([fe80::bc0c:5148:629e:1a31]) by AM0PR08MB4226.eurprd08.prod.outlook.com ([fe80::bc0c:5148:629e:1a31%6]) with mapi id 15.20.1987.010; Thu, 13 Jun 2019 15:13:10 +0000 From: Ayan Halder To: "james qian wang (Arm Technology China)" , Ayan Halder , Liviu Dudau , Brian Starkey , "airlied@linux.ie" , "daniel@ffwll.ch" , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH v2] drm/komeda: Make Komeda interrupts shareable Thread-Topic: [PATCH v2] drm/komeda: Make Komeda interrupts shareable Thread-Index: AQHVIfqDLdXCjTdCoUOWEBxFONS5qQ== Date: Thu, 13 Jun 2019 15:13:10 +0000 Message-ID: <20190613151257.32297-1-ayan.halder@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LO2P265CA0245.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8a::17) To AM0PR08MB4226.eurprd08.prod.outlook.com (2603:10a6:208:147::17) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.21.0 x-originating-ip: [217.140.106.51] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5bb68c40-2942-459d-a13c-08d6f011a561 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600148)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:AM0PR08MB4468; x-ms-traffictypediagnostic: AM0PR08MB4468: nodisclaimer: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:56; x-forefront-prvs: 0067A8BA2A x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(346002)(376002)(39860400002)(366004)(189003)(199004)(66066001)(72206003)(110136005)(316002)(2906002)(486006)(73956011)(66946007)(66476007)(66556008)(64756008)(81166006)(4326008)(8936002)(50226002)(44832011)(66446008)(476003)(6116002)(3846002)(2501003)(68736007)(2616005)(14454004)(36756003)(478600001)(6486002)(6512007)(53936002)(6436002)(81156014)(2201001)(71190400001)(71200400001)(6506007)(386003)(5024004)(14444005)(256004)(5660300002)(52116002)(1076003)(305945005)(86362001)(8676002)(7736002)(25786009)(26005)(186003)(102836004)(99286004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR08MB4468; H:AM0PR08MB4226.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: dgS8jc7D6j/3ixr+u1JZoB6Qi0AyHIMvgqFl8k5MWHn/PPQwEyV1kBQFUMrPgTFSMXw48n0vYT6P9Uqcj6kHHWrKW5rwEWGDzhdrTIQ4X/BpL8K/yEjo6S9zBZPnOGMu31xkQBmdvvDE3gzB8FBrfyObY28vHs6kVgqYCml4MY5LA2k1kl36cXfBai31frDo+0HZfJJZ+4aqZqkcg1+1X+/ltFmGjUf2GkuDy2ndbGvFW/lTonZM3SuYfA+of3IDzduNt10tvGE/sQGQwbVaOxCZy0xn250E8CgREWS3rc6ugqCEoVQYIh/ZQWxOTU2QMvoLLO7F/YSUYiR3e24XJQ5qMFp8pQjY8Oit8ZBtYTIuk0lELSlMr/Kzvc1pNjpmWXe0kO9vO+vpctF3RWNcTaFw17OS0wAC5Fq0fLBxeXI= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5bb68c40-2942-459d-a13c-08d6f011a561 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Jun 2019 15:13:10.5039 (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: Ayan.Halder@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4468 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=Nzj6MzH2pmOXiTX7PZgRezf7afByiP578fSn+fcp0PM=; b=my07G9XgfGoIzq81PKv6TN0PMPMjv/U+xTj9K+LgyTYR51+teuXgTQsmLTGwHVkuWrVCN5ebf9GTvGBBhBGS5LsX/Ml4/3Pk17tT1QldbQa540MELh/2FjPotHrpVZ7JVFcpRsqG9if9ngZLSVLumFheHewTw0P+SJVksv0R2b0= X-Mailman-Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ayan.Halder@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 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Komeda interrupts may be shared with other hardware blocks. One needs to use devm_request_irq() with IRQF_SHARED to create a shared interrupt handler. As a result of not using drm_irq_install() api, one needs to set "(struct drm_device *)->irq_enabled = true/false" to enable/disable vblank interrupts. Changes from v1:- 1. Squashed the following two patches into one (as the second patch is a consequence of the first one):- drm/komeda: Avoid using DRIVER_IRQ_SHARED drm/komeda: Enable/Disable vblank interrupts 2. Fixed the commit message (as pointed by Daniel Vetter) 3. Removed calls to 'drm_irq_uninstall()' as we are no longer using drm_irq_install() 4. Removed the struct member 'komeda_kms_driver.irq_handler' as it is not used anywhere. Signed-off-by: Ayan Kumar halder Reviewed-by: Liviu Dudau Reviewed-by: James Qian Wang (Arm Technology China) --- drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c index 86f6542afb40..bb2bffc0e022 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c @@ -58,7 +58,6 @@ static struct drm_driver komeda_kms_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_PRIME | DRIVER_HAVE_IRQ, .lastclose = drm_fb_helper_lastclose, - .irq_handler = komeda_kms_irq_handler, .gem_free_object_unlocked = drm_gem_cma_free_object, .gem_vm_ops = &drm_gem_cma_vm_ops, .dumb_create = komeda_gem_cma_dumb_create, @@ -194,23 +193,26 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev) drm_mode_config_reset(drm); - err = drm_irq_install(drm, mdev->irq); + err = devm_request_irq(drm->dev, mdev->irq, + komeda_kms_irq_handler, IRQF_SHARED, + drm->driver->name, drm); if (err) goto cleanup_mode_config; err = mdev->funcs->enable_irq(mdev); if (err) - goto uninstall_irq; + goto cleanup_mode_config; + + drm->irq_enabled = true; err = drm_dev_register(drm, 0); if (err) - goto uninstall_irq; + goto cleanup_mode_config; return kms; -uninstall_irq: - drm_irq_uninstall(drm); cleanup_mode_config: + drm->irq_enabled = false; drm_mode_config_cleanup(drm); komeda_kms_cleanup_private_objs(kms); free_kms: @@ -223,9 +225,9 @@ void komeda_kms_detach(struct komeda_kms_dev *kms) struct drm_device *drm = &kms->base; struct komeda_dev *mdev = drm->dev_private; + drm->irq_enabled = false; mdev->funcs->disable_irq(mdev); drm_dev_unregister(drm); - drm_irq_uninstall(drm); component_unbind_all(mdev->dev, drm); komeda_kms_cleanup_private_objs(kms); drm_mode_config_cleanup(drm);