From patchwork Wed Sep 18 17:13:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: srinivas pandruvada X-Patchwork-Id: 2908051 Return-Path: X-Original-To: patchwork-linux-input@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 D15BFBFF05 for ; Wed, 18 Sep 2013 17:13:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 700C3203AF for ; Wed, 18 Sep 2013 17:13:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0BAEE203AD for ; Wed, 18 Sep 2013 17:13:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751948Ab3IRRNI (ORCPT ); Wed, 18 Sep 2013 13:13:08 -0400 Received: from mga02.intel.com ([134.134.136.20]:53756 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751651Ab3IRRNH (ORCPT ); Wed, 18 Sep 2013 13:13:07 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 18 Sep 2013 10:13:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.90,930,1371106800"; d="scan'208";a="405303300" Received: from spandruv-linux-test.jf.intel.com ([10.7.199.164]) by orsmga002.jf.intel.com with ESMTP; 18 Sep 2013 10:13:06 -0700 From: Srinivas Pandruvada To: linux-input@vger.kernel.org, linux-iio@vger.kernel.org Cc: jic23@kernel.org, jkosina@suse.cz, holler@ahsoftware.de, Srinivas Pandruvada Subject: [PATCH 2/3] IIO: call sensor hub open close function Date: Wed, 18 Sep 2013 10:13:18 -0700 Message-Id: <1379524399-16995-2-git-send-email-srinivas.pandruvada@linux.intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1379524399-16995-1-git-send-email-srinivas.pandruvada@linux.intel.com> References: <1379524399-16995-1-git-send-email-srinivas.pandruvada@linux.intel.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Call hid_sensor_hub_device_open when user space opens device and call hid_sensor_hub_device_close when device is closed. This helps in saving power. Signed-off-by: Srinivas Pandruvada --- drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index 87419c4..b6e77e0 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c @@ -34,6 +34,12 @@ static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig, struct hid_sensor_common *st = iio_trigger_get_drvdata(trig); int state_val; + if (state) { + if (sensor_hub_device_open(st->hsdev)) + return -EIO; + } else + sensor_hub_device_close(st->hsdev); + state_val = state ? 1 : 0; if (IS_ENABLED(CONFIG_HID_SENSOR_ENUM_BASE_QUIRKS)) ++state_val;