Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3837868ybg; Sun, 20 Oct 2019 22:55:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvM0jxeM3mRQaUP9A2o86fhf6EJYJ8nBS9wQbqdwS1jiTOssTHo4oseOJb/9ccqqHOBD/l X-Received: by 2002:aa7:db49:: with SMTP id n9mr5513397edt.105.1571637346728; Sun, 20 Oct 2019 22:55:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571637346; cv=none; d=google.com; s=arc-20160816; b=NG7C6MbVLmCp669Ni03P3kVDrxuJIY6ztWALMPhxfXzUgQJtCSulvpNpnKQrqPMXQT MbliaYez5qpwFhKkdvGwfGbvqHaEf05vLPIxvpCqeiLNptW9PlFRjL8TLoVMiV017g1H caJRl2xCE3ZQ5ZyfGSMODYFXk1V1miAYnsL5DgEzLyJUXZ4U6h/0jWqrNBYL7E4TUvU/ 4KsNSmrlwe4nUsV4/uaGaG14L39t1Q4xnz9JlU2PmoLaZM4fL69PkLcqckBSQylFci/R guZI/N6MDVDImPqN/fPYFH7fHq+jS+3GcDlgPV8AGzYMmxDiO+Hk/FCOS8qApJuGtN/6 mFdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0VdDH0oiiJrSkc0zfZlLZPe7HDYCACJthi66MKbNDC8=; b=uhtU3EdNJo9HsKptebew70ABOtLPMEmi8BGyIk/0aNPCZj+KXFRb0v08SWzdWgMC1P lf3FwYggdU2vFtZmUPtVoeX4P/CSFje/rOPtkqMIT25CvR1Fub6LxDy1OGNwA2CBgs4m hXN1B++jCt1u4ZD9syFKC5ou/hyro7ogi4wPvWCNDqJtnlzoa58+lz3cTH/JNA9tk3tR tsloUa+6etD37lt7RreRyv3Iiur8+zvkaj/dK4S+tnGsDPX0iUHg8WZelhBPrBqlTwwq UkYayIaDk4fi72c9rMNM1Fp/XuhlYQJsr8x8ydCbRxOGbRctbthU2tedkfKuA3r1Wf+p ujYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VESvtTcv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p19si202578ejj.85.2019.10.20.22.55.23; Sun, 20 Oct 2019 22:55:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VESvtTcv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727350AbfJUFyi (ORCPT + 99 others); Mon, 21 Oct 2019 01:54:38 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:45987 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727319AbfJUFyg (ORCPT ); Mon, 21 Oct 2019 01:54:36 -0400 Received: by mail-pl1-f195.google.com with SMTP id y24so2119261plr.12 for ; Sun, 20 Oct 2019 22:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0VdDH0oiiJrSkc0zfZlLZPe7HDYCACJthi66MKbNDC8=; b=VESvtTcv2DeGmwubIKZAZZMJFC7evaOHf35UgBrRK8OvMQRAo1EAb5N5RbyD6UhdN0 ccHnOmwKLdm28vxymnPaIYWEKGNZiuVT85evQhKayVtpCcFs4vOjk8zxNzI4GBUDbsOv ldCTrsfkM3uEq5Ewar1DxCH0WjdlkX0nqXpvo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0VdDH0oiiJrSkc0zfZlLZPe7HDYCACJthi66MKbNDC8=; b=tcwMx5pnPn+pMnx0PUwWuOoh50g2+XhxHGlcmCkiC+ZM0IurDB+G/FwXjeqdlWDsVG UEYCMj/U/15aZUwAPd8XffxwLiaV4dPUzY492LLdHSzX/mioKEL8Wy9oObqW2JJJkrhF L2bnCalWavxjGkvdGD5owCjQP/EZ2OncGDjzcTXG9BH4rpwQBkeeDd19NNykNf6bcdMM +LngWNG65EsOpLI07AuOnYLz0vE18UEqqIK8b30wDIec0eWF89OxHziZX/aZ2h0zQUnF siFxqESM4z6UaB+/xTdILn46I8leIGzVvxb2zSoFFCmjMswVYqXPd7fJsn3J8RHbJvii KXgQ== X-Gm-Message-State: APjAAAUJFTkwd1DL/fiCorprQ13UNmFV9TNI1a3B9Vcn0GYjTi3YpwQK XTqGLeqhazZx8k35fWlgsJ3PhA== X-Received: by 2002:a17:902:ab82:: with SMTP id f2mr23379055plr.39.1571637275558; Sun, 20 Oct 2019 22:54:35 -0700 (PDT) Received: from localhost ([2620:15c:202:1:3c8f:512b:3522:dfaf]) by smtp.gmail.com with ESMTPSA id c64sm16902207pfc.19.2019.10.20.22.54.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 20 Oct 2019 22:54:35 -0700 (PDT) From: Gwendal Grignou To: briannorris@chromium.org, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, lee.jones@linaro.org, bleung@chromium.org, enric.balletbo@collabora.com, dianders@chromium.org, groeck@chromium.org, fabien.lahoudere@collabora.com Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, Gwendal Grignou Subject: [PATCH v2 15/18] iio: cros_ec: Remove pm function Date: Sun, 20 Oct 2019 22:54:00 -0700 Message-Id: <20191021055403.67849-16-gwendal@chromium.org> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog In-Reply-To: <20191021055403.67849-1-gwendal@chromium.org> References: <20191021055403.67849-1-gwendal@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since cros_ec_sensorhub is shutting down the FIFO when the device suspends, no need to slow down the EC sampling period rate. It was necesseary to do that before command CMD_FIFO_INT_ENABLE was introduced, but now all supported chromebooks have it. Signed-off-by: Gwendal Grignou --- New in v2. .../cros_ec_sensors/cros_ec_lid_angle.c | 1 - .../common/cros_ec_sensors/cros_ec_sensors.c | 1 - .../cros_ec_sensors/cros_ec_sensors_core.c | 47 ------------------- drivers/iio/light/cros_ec_light_prox.c | 1 - .../linux/iio/common/cros_ec_sensors_core.h | 5 -- 5 files changed, 55 deletions(-) diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_lid_angle.c b/drivers/iio/common/cros_ec_sensors/cros_ec_lid_angle.c index e30a59fcf0f95..af801e203623e 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_lid_angle.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_lid_angle.c @@ -127,7 +127,6 @@ MODULE_DEVICE_TABLE(platform, cros_ec_lid_angle_ids); static struct platform_driver cros_ec_lid_angle_platform_driver = { .driver = { .name = DRV_NAME, - .pm = &cros_ec_sensors_pm_ops, }, .probe = cros_ec_lid_angle_probe, .id_table = cros_ec_lid_angle_ids, diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c index 9e7903ff99f80..2eb4bb254fbde 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c @@ -314,7 +314,6 @@ MODULE_DEVICE_TABLE(platform, cros_ec_sensors_ids); static struct platform_driver cros_ec_sensors_platform_driver = { .driver = { .name = "cros-ec-sensors", - .pm = &cros_ec_sensors_pm_ops, }, .probe = cros_ec_sensors_probe, .id_table = cros_ec_sensors_ids, diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c index 3d2e17093c75a..e89c355bb4b35 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c @@ -716,52 +716,5 @@ int cros_ec_sensors_core_write(struct cros_ec_sensors_core_state *st, } EXPORT_SYMBOL_GPL(cros_ec_sensors_core_write); -static int __maybe_unused cros_ec_sensors_prepare(struct device *dev) -{ - struct iio_dev *indio_dev = dev_get_drvdata(dev); - struct cros_ec_sensors_core_state *st = iio_priv(indio_dev); - - if (st->curr_sampl_freq == 0) - return 0; - - /* - * If the sensors are sampled at high frequency, we will not be able to - * sleep. Set sampling to a long period if necessary. - */ - if (st->curr_sampl_freq < CROS_EC_MIN_SUSPEND_SAMPLING_FREQUENCY) { - mutex_lock(&st->cmd_lock); - st->param.cmd = MOTIONSENSE_CMD_EC_RATE; - st->param.ec_rate.data = CROS_EC_MIN_SUSPEND_SAMPLING_FREQUENCY; - cros_ec_motion_send_host_cmd(st, 0); - mutex_unlock(&st->cmd_lock); - } - return 0; -} - -static void __maybe_unused cros_ec_sensors_complete(struct device *dev) -{ - struct iio_dev *indio_dev = dev_get_drvdata(dev); - struct cros_ec_sensors_core_state *st = iio_priv(indio_dev); - - if (st->curr_sampl_freq == 0) - return; - - if (st->curr_sampl_freq < CROS_EC_MIN_SUSPEND_SAMPLING_FREQUENCY) { - mutex_lock(&st->cmd_lock); - st->param.cmd = MOTIONSENSE_CMD_EC_RATE; - st->param.ec_rate.data = st->curr_sampl_freq; - cros_ec_motion_send_host_cmd(st, 0); - mutex_unlock(&st->cmd_lock); - } -} - -const struct dev_pm_ops cros_ec_sensors_pm_ops = { -#ifdef CONFIG_PM_SLEEP - .prepare = cros_ec_sensors_prepare, - .complete = cros_ec_sensors_complete -#endif -}; -EXPORT_SYMBOL_GPL(cros_ec_sensors_pm_ops); - MODULE_DESCRIPTION("ChromeOS EC sensor hub core functions"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/light/cros_ec_light_prox.c b/drivers/iio/light/cros_ec_light_prox.c index da40c38370965..6bac02cdd898a 100644 --- a/drivers/iio/light/cros_ec_light_prox.c +++ b/drivers/iio/light/cros_ec_light_prox.c @@ -255,7 +255,6 @@ MODULE_DEVICE_TABLE(platform, cros_ec_light_prox_ids); static struct platform_driver cros_ec_light_prox_platform_driver = { .driver = { .name = "cros-ec-light-prox", - .pm = &cros_ec_sensors_pm_ops, }, .probe = cros_ec_light_prox_probe, .id_table = cros_ec_light_prox_ids, diff --git a/include/linux/iio/common/cros_ec_sensors_core.h b/include/linux/iio/common/cros_ec_sensors_core.h index b4eb3790cde11..db3da7ffcc376 100644 --- a/include/linux/iio/common/cros_ec_sensors_core.h +++ b/include/linux/iio/common/cros_ec_sensors_core.h @@ -30,9 +30,6 @@ enum { */ #define CROS_EC_SAMPLE_SIZE (sizeof(s64) * 2) -/* Minimum sampling period to use when device is suspending */ -#define CROS_EC_MIN_SUSPEND_SAMPLING_FREQUENCY 1000 /* 1 second */ - typedef irqreturn_t (*cros_ec_sensors_capture_t)(int irq, void *p); @@ -119,8 +116,6 @@ int cros_ec_sensors_core_write(struct cros_ec_sensors_core_state *st, struct iio_chan_spec const *chan, int val, int val2, long mask); -extern const struct dev_pm_ops cros_ec_sensors_pm_ops; - /* List of extended channel specification for all sensors */ extern const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[]; -- 2.23.0.866.gb869b98d4c-goog