From patchwork Wed Dec 30 16:43:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 7934251 Return-Path: X-Original-To: patchwork-linux-media@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 491D89F387 for ; Wed, 30 Dec 2015 16:47:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 66C55202F2 for ; Wed, 30 Dec 2015 16:47:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 764F7202EB for ; Wed, 30 Dec 2015 16:47:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754999AbbL3Qq6 (ORCPT ); Wed, 30 Dec 2015 11:46:58 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:32940 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754985AbbL3Qqz (ORCPT ); Wed, 30 Dec 2015 11:46:55 -0500 Received: by mail-wm0-f49.google.com with SMTP id f206so71492895wmf.0 for ; Wed, 30 Dec 2015 08:46:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-type:content-transfer-encoding; bh=LBVnJDn7P+cMo8d4AEWcQs9xvvBv6fqIdoJscWvsQlc=; b=xJBR2Wt7mtCHZby9yH3ilF3lR6xebrWh8/hRLE2dAak57QXSI5q5XUJsFORGgF533F zGSLHR0Rs//JexebA18MRmTvAsvbysfAEp5WanXL9DGECBZMaLMK+hfut9C9x60ayu7v CtRSCG7exP72LgTnkavS4P/kzkO/hedU/IWc1SUdgRyuHLllfOTPgDP5qA94MXjkYOuh Q1MpRjar2g4V62OQ8L2xpLVh5BMNYU2uer1I/GzAEU473WqimFsmo2r84YUqqKjsdv34 X3KH6owzp9W2hm5j+Mz5Yuoi3DmMBpTxDhe7px7cV3taIKBxEKP4gx8GAE2/m/t/KhxC KgrQ== X-Received: by 10.28.210.143 with SMTP id j137mr17539788wmg.13.1451494014375; Wed, 30 Dec 2015 08:46:54 -0800 (PST) Received: from ?IPv6:2003:62:5f55:ba00:84bb:b7f:fe67:66b9? (p200300625F55BA0084BB0B7FFE6766B9.dip0.t-ipconnect.de. [2003:62:5f55:ba00:84bb:b7f:fe67:66b9]) by smtp.googlemail.com with ESMTPSA id u126sm57876918wme.3.2015.12.30.08.46.53 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 30 Dec 2015 08:46:53 -0800 (PST) From: Heiner Kallweit Subject: [PATCH 11/16] media: rc: nuvoton-cir: improve logical device handling To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Message-ID: <568409CF.2050101@gmail.com> Date: Wed, 30 Dec 2015 17:43:59 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Only enable the logical devices after the registers have been initialized. The call to nvt_enable_logical_dev in nvt_resume is not needed as this is done implicitely by nvt_cir_regs_init now. Signed-off-by: Heiner Kallweit --- drivers/media/rc/nuvoton-cir.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index cf6ccb3..e01fdc8 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -352,9 +352,8 @@ static void nvt_cir_ldev_init(struct nvt_dev *nvt) val |= psval; nvt_cr_write(nvt, val, psreg); - /* Select CIR logical device and enable */ + /* Select CIR logical device */ nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR); - nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN); nvt_set_ioaddr(nvt, &nvt->cir_addr); @@ -366,7 +365,7 @@ static void nvt_cir_ldev_init(struct nvt_dev *nvt) static void nvt_cir_wake_ldev_init(struct nvt_dev *nvt) { - /* Select ACPI logical device, enable it and CIR Wake */ + /* Select ACPI logical device and anable it */ nvt_select_logical_dev(nvt, LOGICAL_DEV_ACPI); nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN); @@ -376,9 +375,8 @@ static void nvt_cir_wake_ldev_init(struct nvt_dev *nvt) /* enable pme interrupt of cir wakeup event */ nvt_set_reg_bit(nvt, PME_INTR_CIR_PASS_BIT, CR_ACPI_IRQ_EVENTS2); - /* Select CIR Wake logical device and enable */ + /* Select CIR Wake logical device */ nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR_WAKE); - nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN); nvt_set_ioaddr(nvt, &nvt->cir_wake_addr); @@ -461,6 +459,9 @@ static void nvt_cir_regs_init(struct nvt_dev *nvt) /* and finally, enable interrupts */ nvt_set_cir_iren(nvt); + + /* enable the CIR logical device */ + nvt_enable_logical_dev(nvt, LOGICAL_DEV_CIR); } static void nvt_cir_wake_regs_init(struct nvt_dev *nvt) @@ -495,6 +496,9 @@ static void nvt_cir_wake_regs_init(struct nvt_dev *nvt) /* clear any and all stray interrupts */ nvt_cir_wake_reg_write(nvt, 0xff, CIR_WAKE_IRSTS); + + /* enable the CIR WAKE logical device */ + nvt_enable_logical_dev(nvt, LOGICAL_DEV_CIR_WAKE); } static void nvt_enable_wake(struct nvt_dev *nvt) @@ -1070,7 +1074,9 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) nvt_cir_wake_ldev_init(nvt); nvt_efm_disable(nvt); - /* Initialize CIR & CIR Wake Config Registers */ + /* Initialize CIR & CIR Wake Config Registers + * and enable logical devices + */ nvt_cir_regs_init(nvt); nvt_cir_wake_regs_init(nvt); @@ -1198,9 +1204,6 @@ static int nvt_resume(struct pnp_dev *pdev) /* open interrupt */ nvt_set_cir_iren(nvt); - /* Enable CIR logical device */ - nvt_enable_logical_dev(nvt, LOGICAL_DEV_CIR); - nvt_cir_regs_init(nvt); nvt_cir_wake_regs_init(nvt);