From patchwork Mon Jul 8 00:22:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 2824661 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E0DD5C0AB2 for ; Mon, 8 Jul 2013 00:23:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 02BD92012F for ; Mon, 8 Jul 2013 00:23:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0764B20121 for ; Mon, 8 Jul 2013 00:23:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753327Ab3GHAXM (ORCPT ); Sun, 7 Jul 2013 20:23:12 -0400 Received: from mail-ea0-f180.google.com ([209.85.215.180]:55930 "EHLO mail-ea0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753288Ab3GHAXJ (ORCPT ); Sun, 7 Jul 2013 20:23:09 -0400 Received: by mail-ea0-f180.google.com with SMTP id k10so2581676eaj.39 for ; Sun, 07 Jul 2013 17:23:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=vpdINkwDXhJ4+0ui/bfv1nQnzcLuiZ1UCEPcl7vbfn8=; b=W/WgDPxZaTxCa7JkG6924rq915O/rl4GVClGTZ4s0ewo3TjtVYU/1beWRHZ/uVtSB/ BA72lVXdMx4d6YZqp4uVA8uWe2z/BDJq/ZiMVkfco8DFfXTIWcrbj60qg0jL9yGKiclz emt89JbmZkYRgeyrE9OaqSOG4HdgYFooFUUBTjW/R2zXEh9Jr/FTGn+6UuqECXNeqJ73 Y8PQ9mG9i4UNsSUNTaM/Gv33deAKRbBFySX1de5UDIZoePaKqwOs/4yF8a5ME/gdGyHX TnoG7MGlEIPx5EY8iD/HKmB5XW+d/RqxdkN86YsbPpPc3PabQ28jCIEXZ9MKp4DYQNuO OEgQ== X-Received: by 10.15.94.11 with SMTP id ba11mr22102603eeb.101.1373242988193; Sun, 07 Jul 2013 17:23:08 -0700 (PDT) Received: from localhost.localdomain (IGLD-84-228-222-170.inter.net.il. [84.228.222.170]) by mx.google.com with ESMTPSA id p49sm37649382eeu.2.2013.07.07.17.23.06 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 07 Jul 2013 17:23:07 -0700 (PDT) From: Maxim Levitsky To: linux-media@vger.kernel.org Cc: Maxim Levitsky Subject: [PATCH 2/3] ene_ir: disable the device if wake is disabled It doesn't hurt and on my notebook despite clearing the wake flag the remote still wakes up the system. This way it doesn't Date: Mon, 8 Jul 2013 03:22:46 +0300 Message-Id: <1373242968-16055-3-git-send-email-maximlevitsky@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1373242968-16055-1-git-send-email-maximlevitsky@gmail.com> References: <1373242968-16055-1-git-send-email-maximlevitsky@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.1 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=ham 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 Signed-off-by: Maxim Levitsky --- drivers/media/rc/ene_ir.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c index a9cf3a4..61865ba 100644 --- a/drivers/media/rc/ene_ir.c +++ b/drivers/media/rc/ene_ir.c @@ -476,7 +476,7 @@ select_timeout: } /* Enable the device for receive */ -static void ene_rx_enable(struct ene_device *dev) +static void ene_rx_enable_hw(struct ene_device *dev) { u8 reg_value; @@ -504,11 +504,17 @@ static void ene_rx_enable(struct ene_device *dev) /* enter idle mode */ ir_raw_event_set_idle(dev->rdev, true); +} + +/* Enable the device for receive - wrapper to track the state*/ +static void ene_rx_enable(struct ene_device *dev) +{ + ene_rx_enable_hw(dev); dev->rx_enabled = true; } /* Disable the device receiver */ -static void ene_rx_disable(struct ene_device *dev) +static void ene_rx_disable_hw(struct ene_device *dev) { /* disable inputs */ ene_rx_enable_cir_engine(dev, false); @@ -516,8 +522,13 @@ static void ene_rx_disable(struct ene_device *dev) /* disable hardware IRQ and firmware flag */ ene_clear_reg_mask(dev, ENE_FW1, ENE_FW1_ENABLE | ENE_FW1_IRQ); - ir_raw_event_set_idle(dev->rdev, true); +} + +/* Disable the device receiver - wrapper to track the state */ +static void ene_rx_disable(struct ene_device *dev) +{ + ene_rx_disable_hw(dev); dev->rx_enabled = false; } @@ -1123,9 +1134,8 @@ static void ene_remove(struct pnp_dev *pnp_dev) } /* enable wake on IR (wakes on specific button on original remote) */ -static void ene_enable_wake(struct ene_device *dev, int enable) +static void ene_enable_wake(struct ene_device *dev, bool enable) { - enable = enable && device_may_wakeup(&dev->pnp_dev->dev); dbg("wake on IR %s", enable ? "enabled" : "disabled"); ene_set_clear_reg_mask(dev, ENE_FW1, ENE_FW1_WAKE, enable); } @@ -1134,9 +1144,12 @@ static void ene_enable_wake(struct ene_device *dev, int enable) static int ene_suspend(struct pnp_dev *pnp_dev, pm_message_t state) { struct ene_device *dev = pnp_get_drvdata(pnp_dev); - ene_enable_wake(dev, true); + bool wake = device_may_wakeup(&dev->pnp_dev->dev); + + if (!wake && dev->rx_enabled) + ene_rx_disable_hw(dev); - /* TODO: add support for wake pattern */ + ene_enable_wake(dev, wake); return 0; }