From patchwork Tue Jan 26 04:00:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Meng Yi X-Patchwork-Id: 8118861 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D8CDB9FBE9 for ; Tue, 26 Jan 2016 08:48:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0BB7A2027D for ; Tue, 26 Jan 2016 08:48:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9EFFD202AE for ; Tue, 26 Jan 2016 08:48:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 161866E3FB; Tue, 26 Jan 2016 00:48:49 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0067.outbound.protection.outlook.com [207.46.100.67]) by gabe.freedesktop.org (Postfix) with ESMTPS id 20F976E1E5 for ; Mon, 25 Jan 2016 20:42:50 -0800 (PST) Received: from BN3PR0301CA0037.namprd03.prod.outlook.com (10.160.180.175) by CY1PR0301MB1259.namprd03.prod.outlook.com (10.161.213.11) with Microsoft SMTP Server (TLS) id 15.1.390.13; Tue, 26 Jan 2016 04:09:06 +0000 Received: from BN1AFFO11FD048.protection.gbl (2a01:111:f400:7c10::199) by BN3PR0301CA0037.outlook.office365.com (2a01:111:e400:4000::47) with Microsoft SMTP Server (TLS) id 15.1.390.13 via Frontend Transport; Tue, 26 Jan 2016 04:09:06 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD048.mail.protection.outlook.com (10.58.53.63) with Microsoft SMTP Server (TLS) id 15.1.355.15 via Frontend Transport; Tue, 26 Jan 2016 04:09:06 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u0Q491B0003500; Mon, 25 Jan 2016 21:09:02 -0700 From: Meng Yi To: , , , Subject: [PATCH 1/4] drm/fsl-dcu: Cleanup vblank interrupt mask and status setting code Date: Tue, 26 Jan 2016 12:00:30 +0800 Message-ID: <1453780833-32289-1-git-send-email-meng.yi@nxp.com> X-Mailer: git-send-email 2.1.0.27.g96db324 X-EOPAttributedMessage: 0 X-Matching-Connectors: 130982549464985404; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD048; 1:Jj//NMV9dI0igIbCSyxvxPVhA/ZZtW1zNxrdMLsKiTikobkAfU4Jm5q5YcKiFqxHapmBv03TzBZZTiloXbG9v/DSraIqkSbjOQDlE6+N/mgIpwDK6EE2oU2rT2hqvZFKGcYQAsLRhfGb5MrGfGkKWL7Lm2oNCYgv0siYdYJMWB88KOmo/AHDWrH+rxAsjo0a1sfYZBa7AfFau7w5roXmParTyW4OFNFz8HZUn6ismaHV+O/VfGnKihX8xOuBYToQJf6NRW8k4538bYOTBDlK31P4UgPXU317jgK19ZSnCUwZ9wMKvlcsg9yX7ipjQVSLjF2knJ1M9tfxjrkwyWXjXweYXHzxesR/VTqfJj+/l33JEJG1mm4BA9EcZ5zt+EVr4HPCBfjvoedQdekEP37v5QATiKofCxVAlUm04E1b5Th4IabBYkx7j+uzQDJpNpRu2wlnPdNxx3pvYWHuIekL5DCRpKLBR3G2ONXp2bUEbvz3WAtLwb6mhXtRq5pF8Y+ye8LM71Us8CfngZTTWWMlye0Ab6z7XiRsnZAydn9XU9tWd09tDe/8wHUxgnNv+cC9FCUuOo9M6KbkIStnksUaLA== X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(5001960100002)(106466001)(1096002)(104016004)(77096005)(1220700001)(6806005)(229853001)(11100500001)(105606002)(5008740100001)(50986999)(586003)(97736004)(19580395003)(81156007)(5001770100001)(47776003)(189998001)(19580405001)(2906002)(50466002)(87936001)(2201001)(4326007)(5003940100001)(36756003)(85426001)(50226001)(48376002)(86362001)(92566002)(33646002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1259; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 3a9003f8-d61c-4042-4ddd-08d326066f17 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1259; 2:hj1UayYs6hMzSsYq0XUMAfb8euHlUCdhBik/vO34oBsNIX/xp66Um3GnlCGvX87z37dI6d2HaY2tGWezN5+63JlYlRTrRjXrK4fkg1w2ZYmGxFPfuwNXXmSm9nR+v9n9Eva3IbkWioUd0HHpjVItMxWpa41VQOy7JUXImGBl2NLBDStIJfsiwvS9ABqvt8gr; 3:bfJE9ERDiGP0Y9ff+68B3wNyS9EduPVjsO358v0AtJMj3ldI4ujBLTV+5EpTy8nuyY+RLZZIZU3VMhvHDFom6kcKy6eQ6DJPA03R7Nljx56Aw7M8dkp/YpJ6A2hZB4xr0e0JT35ygw04MYlAR89t8d8WlLBue4aolJnc4lKfuRHmIqaqM6DS185DCFIioDTtCWzLvV536KXFmm/Hbvx5rS9OSkLGeb1PgupRkDm93Uo=; 25:46PtKdJcoeH4fiOuHuM9N8dw+2ZuAtS4gnjFRrNjKJjaN1sCjCcZCo7IkRP9q933ywzA7LEFuqQRxyNX2UaqQNAv/oQ/teI77MNaPjPHVXO7uguoSujmnjWxzLMBgTAu/F61E6AxkM4+tkXzS1oOvU3QSnAKHc3DQQpNQ7+XROsIBHSi+7zDw86mhQkWnd5UhqhnWf55d8gqqFAP/OMagljYWvF/lHAq0gGSNAk9mzCuQuvlz4sSAcyLMDYIdH8r X-Exchange-Antispam-Report-Test: UriScan:; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB1259; UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(123027)(601004)(2401047)(13017025)(8121501046)(13015025)(13023025)(5005006)(13024025)(13018025)(520078)(3002001)(10201501046); SRVR:CY1PR0301MB1259; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB1259; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1259; 4:KlGdm6uAues7VZ71vFF4L08H5O6a/+EZN2LmsSmx6fsEGREYXEyAseCyoHNRHbvfgnr0c3QvH3MsM16Oud3FaVJDBx+86CU+5kdwj124Ouyiw7TVy4pvcQ8JR1Zg0T6t55qGerElVjyHnomL7LaId+B+FVz5R5GUyRgj5LIuaXLdyOtSwcl1GBIg/ndhB00bZfXHaX5PiX09MIOv/OiCu9RXhPK2rByYn/qr0piga/WPy00S9urNl+gOMx812D/usbf5CIPCUPnmkwNLqxtempsaAE2sM7Etkl0Upq5TWB6rYt1AUrh1dTslZEIr+2IrdHhJcvBpDUjw7kVoBQzGJOo3WigK3w+ogusN3WfZj+ptu3o7FVUW8vIlhIeLi1nTC1tIysmF9iZwp8x1QcXTYjumRzWW24t73nl6JlXf2GiPGTthD6wmxLJfsPNetGgKH4O2+QI8GLNPqhXjOBytG2Kq8EFxqv1Tm4cBVxQxR25D0Mcjnr9/b/xemKpJlEQLI8CPAcEYlwyj2cHQ1q1hfimvu/Iv0IMBqXxei9xMCqQ= X-Forefront-PRVS: 08331F819E X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1259; 23:3w5KwbyALcZCCNdQ0RuFFkY71m+tNmFceDQ0dLD?= =?us-ascii?Q?eETexyMmf9RVDRzTb+uPGsn6xd7MgSxDhA4zTR0FdFvGkORYesNPwEXt4Wu7?= =?us-ascii?Q?kNhcKDWdJvzIN0PrX3J2mhkl7yYE3d8MV1g90JNjQzUNSi+9egt8sua7cEVa?= =?us-ascii?Q?V9UDKMblT6oy5niBqspWg0/eq9LIazh16URrT71htAp+TwBsQz5fWRvTCqnH?= =?us-ascii?Q?gMP0EeVbAoWZ9KJN0EBA4gx6slYb5oIrD7GgVDIUtIOZLLHyXWpOsKAZZocT?= =?us-ascii?Q?7MVs7t0DvrFGQpxu8CsKcBbOo7CME0xdtragxm5/5vxM3Jybbvb7g4B4hCF+?= =?us-ascii?Q?FBQdbQOtLfXU/NGLPacqjkPAr5vO8EiIn47HQyXo1U6T8FSV2t/m+h2PKEOV?= =?us-ascii?Q?IhxOgeS/k0+MY80R5jFpmcC0tHwLZDNoY5iAdNq3dP0VxhE1a747mRjZJnEq?= =?us-ascii?Q?+YIThtVsgO2d504Z8N9CRgJQ7+sIo3tKwosM1ziJ4JOH5SRxY8qfM5e+bafj?= =?us-ascii?Q?Tk3qdPZvoc4FCuV7cI/tVFRmInQDWSHh7COzz1ZYhn3/BAKXwfVpjTcaZRM9?= =?us-ascii?Q?7zaoTTJ3vNpiy+VZdNr1PpGPUsxvapztc/QDXkf/eyp748DkjYt+DQLy3tSD?= =?us-ascii?Q?dWUJAm+LCgenzUJ1qYjwa+YlmSm5dWN25p+WBekHj26/ezU9EhQoJcfst3SF?= =?us-ascii?Q?DY8YSt8AcVS4K5S/ctUWsY2P7rB4afzH+i+zFDFfuHiMQyJxOkuNeaKwtOaS?= =?us-ascii?Q?fTW2TFrQACgXAScRuiOfa9chg/m+x6tR0ssjJyJPENn+wgTkd6QbpSdwu/Y6?= =?us-ascii?Q?D+mHjpcvf7JuSJEL9LKIOYI1gXb8IAuzFFJaYHrYZOkZbgh4Ukx0HRiiFS5f?= =?us-ascii?Q?/OrDjcW2sWjNsZ2q2vMYstT593cgx9SLK9J0Z/zDC+r0PTDC4DNkG4fnAVU7?= =?us-ascii?Q?0arjTKwFztpROIIvHAvJ+Riusg4P+LBDHBikGPSzKvRp3azjbCnebzUU6uLk?= =?us-ascii?Q?daY2Mq6JZp1c/6wcJltB6oyzwg2bgP+G8JfNTHJUKI0P1IJABO9H6Uclm/We?= =?us-ascii?Q?QTvQjnPuGKl1jL9BUtGhiAEuSWeMX?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1259; 5:KIVjvgpd+Y2d3kKMT5nqKyB84WauClK9UDRvHRMi3lh073cdYn/1yfzXdixJgakQAe0eiC/EVLxJxNaJxjAlXvJR0mf1Um3/6zNhY38XStIRNBNx5VoMcCX10KafHDTxXUC9XmQ+joBZxbwV4/kgZtPk05xNbu90vjMfHrp29d0=; 24:SC4bFuWOLRDC054nJboZENmPmg1pCV53ZynT/LY2SXqU1LHCK/raIRmNEiBpRX5TCQ7UWG9WEcub56eOs5Ceu6lIxMJRkyobEMFMlRbK3cE= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2016 04:09:06.3113 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1259 X-Mailman-Approved-At: Tue, 26 Jan 2016 00:48:47 -0800 Cc: devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Meng Yi X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jianwei Wang Switch update interrupt mask bit with regmap_update_bits, and clear interrupt status by writing 1 to relevant bit before setting mask in fsl_dcu_drm_irq_init function. Signed-off-by: JianWei Wang Signed-off-by: Meng Yi --- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c index fca97d3..cbef47c 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c @@ -38,21 +38,17 @@ static const struct regmap_config fsl_dcu_regmap_config = { static int fsl_dcu_drm_irq_init(struct drm_device *dev) { struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; - unsigned int value; int ret; ret = drm_irq_install(dev, fsl_dev->irq); if (ret < 0) dev_err(dev->dev, "failed to install IRQ handler\n"); - ret = regmap_write(fsl_dev->regmap, DCU_INT_STATUS, 0); + ret = regmap_write(fsl_dev->regmap, DCU_INT_STATUS, 0xffffffff); if (ret) dev_err(dev->dev, "set DCU_INT_STATUS failed\n"); - ret = regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value); - if (ret) - dev_err(dev->dev, "read DCU_INT_MASK failed\n"); - value &= DCU_INT_MASK_VBLANK; - ret = regmap_write(fsl_dev->regmap, DCU_INT_MASK, value); + ret = regmap_update_bits(fsl_dev->regmap, DCU_INT_MASK, + DCU_INT_MASK_VBLANK, ~DCU_INT_MASK_VBLANK); if (ret) dev_err(dev->dev, "set DCU_INT_MASK failed\n"); ret = regmap_write(fsl_dev->regmap, DCU_UPDATE_MODE, @@ -143,14 +139,10 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg) static int fsl_dcu_drm_enable_vblank(struct drm_device *dev, unsigned int pipe) { struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; - unsigned int value; int ret; - ret = regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value); - if (ret) - dev_err(dev->dev, "read DCU_INT_MASK failed\n"); - value &= ~DCU_INT_MASK_VBLANK; - ret = regmap_write(fsl_dev->regmap, DCU_INT_MASK, value); + ret = regmap_update_bits(fsl_dev->regmap, DCU_INT_MASK, + DCU_INT_MASK_VBLANK, ~DCU_INT_MASK_VBLANK); if (ret) dev_err(dev->dev, "set DCU_INT_MASK failed\n"); return 0; @@ -160,14 +152,10 @@ static void fsl_dcu_drm_disable_vblank(struct drm_device *dev, unsigned int pipe) { struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; - unsigned int value; int ret; - ret = regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value); - if (ret) - dev_err(dev->dev, "read DCU_INT_MASK failed\n"); - value |= DCU_INT_MASK_VBLANK; - ret = regmap_write(fsl_dev->regmap, DCU_INT_MASK, value); + ret = regmap_update_bits(fsl_dev->regmap, DCU_INT_MASK, + DCU_INT_MASK_VBLANK, DCU_INT_MASK_VBLANK); if (ret) dev_err(dev->dev, "set DCU_INT_MASK failed\n"); }