From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Matt Ranostay <matt.ranostay@konsulko.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Sasha Levin <alexander.levin@microsoft.com>
Subject: [PATCH 4.14 061/109] iio: health: max30102: Add power enable parameter to get_temp function
Date: Fri, 16 Mar 2018 16:23:30 +0100 [thread overview]
Message-ID: <20180316152333.272341014@linuxfoundation.org> (raw)
In-Reply-To: <20180316152329.844663293@linuxfoundation.org>
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
[ Upstream commit a9c47abbdd71dceeaf1b923e5ce10e700e036905 ]
Chip must not be in shutdown for reading temperature, so briefly leave
shutdown if buffer is not already running
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/health/max30102.c | 36 +++++++++++++++++++++++-------------
1 file changed, 23 insertions(+), 13 deletions(-)
--- a/drivers/iio/health/max30102.c
+++ b/drivers/iio/health/max30102.c
@@ -329,20 +329,31 @@ static int max30102_read_temp(struct max
return 0;
}
-static int max30102_get_temp(struct max30102_data *data, int *val)
+static int max30102_get_temp(struct max30102_data *data, int *val, bool en)
{
int ret;
+ if (en) {
+ ret = max30102_set_powermode(data, true);
+ if (ret)
+ return ret;
+ }
+
/* start acquisition */
ret = regmap_update_bits(data->regmap, MAX30102_REG_TEMP_CONFIG,
MAX30102_REG_TEMP_CONFIG_TEMP_EN,
MAX30102_REG_TEMP_CONFIG_TEMP_EN);
if (ret)
- return ret;
+ goto out;
msleep(35);
+ ret = max30102_read_temp(data, val);
+
+out:
+ if (en)
+ max30102_set_powermode(data, false);
- return max30102_read_temp(data, val);
+ return ret;
}
static int max30102_read_raw(struct iio_dev *indio_dev,
@@ -355,20 +366,19 @@ static int max30102_read_raw(struct iio_
switch (mask) {
case IIO_CHAN_INFO_RAW:
/*
- * Temperature reading can only be acquired while engine
- * is running
+ * Temperature reading can only be acquired when not in
+ * shutdown; leave shutdown briefly when buffer not running
*/
mutex_lock(&indio_dev->mlock);
-
if (!iio_buffer_enabled(indio_dev))
- ret = -EBUSY;
- else {
- ret = max30102_get_temp(data, val);
- if (!ret)
- ret = IIO_VAL_INT;
- }
-
+ ret = max30102_get_temp(data, val, true);
+ else
+ ret = max30102_get_temp(data, val, false);
mutex_unlock(&indio_dev->mlock);
+ if (ret)
+ return ret;
+
+ ret = IIO_VAL_INT;
break;
case IIO_CHAN_INFO_SCALE:
*val = 1000; /* 62.5 */
next prev parent reply other threads:[~2018-03-16 15:23 UTC|newest]
Thread overview: 141+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-16 15:22 [PATCH 4.14 000/109] 4.14.28-stable review Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 001/109] [PATCH] net: phy: fix resume handling Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 002/109] net: phy: Restore phy_resume() locking assumption Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 003/109] x86: Treat R_X86_64_PLT32 as R_X86_64_PC32 Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 004/109] ASoC: sun4i-i2s: Fix RX slot number of SUN8I Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 005/109] ASoC: sgtl5000: Fix suspend/resume Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 006/109] ASoC: wm_adsp: For TLV controls only register TLV get/set Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 007/109] ASoC: rt5651: Fix regcache sync errors on resume Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 008/109] usb: host: xhci-rcar: add support for r8a77965 Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 009/109] xhci: Fix front USB ports on ASUS PRIME B350M-A Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 010/109] xhci: fix endpoint context tracer output Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 011/109] serial: sh-sci: prevent lockup on full TTY buffers Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 012/109] tty/serial: atmel: add new version check for usart Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 013/109] uas: fix comparison for error code Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 014/109] staging: comedi: fix comedi_nsamples_left Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 015/109] staging: android: ashmem: Fix lockdep issue during llseek Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 016/109] USB: storage: Add JMicron bridge 152d:2567 to unusual_devs.h Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 017/109] usbip: vudc: fix null pointer dereference on udc->lock Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 018/109] usb: quirks: add control message delay for 1b1c:1b20 Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 019/109] usb: usbmon: Read text within supplied buffer size Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 020/109] usb: gadget: f_fs: Fix use-after-free in ffs_fs_kill_sb() Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 021/109] usb: dwc3: Fix lock-up on ID change during system suspend/resume Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 022/109] serial: 8250_pci: Add Brainboxes UC-260 4 port serial device Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 023/109] serial: core: mark port as initialized in autoconfig Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 024/109] earlycon: add reg-offset to physical address before mapping Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 025/109] dm mpath: fix passing integrity data Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 026/109] [PATCH] Revert "btrfs: use proper endianness accessors for super_copy" Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 027/109] drm/edid: set ELD connector type in drm_edid_to_eld() Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 028/109] dma-buf/fence: Fix lock inversion within dma-fence-array Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 029/109] video/hdmi: Allow "empty" HDMI infoframes Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 030/109] HID: multitouch: Only look at non touch fields in first packet of a frame Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 031/109] HID: elo: clear BTN_LEFT mapping Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 032/109] iwlwifi: mvm: rs: dont override the rate history in the search cycle Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 033/109] ARM: dts: koelsch: Move cec_clock to root node Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 034/109] clk: meson: gxbb: fix wrong clock for SARADC/SANA Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 035/109] ARM: dts: exynos: Correct Trats2 panel reset line Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 036/109] drm/amdgpu: fix get_max_engine_clock_in_mhz Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 037/109] staging: rtl8822be: fix missing null check on dev_alloc_skb return Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 038/109] typec: tcpm: fusb302: Resolve out of order messaging events Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 039/109] USB: ledtrig-usbport: fix of-node leak Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 040/109] sched: Stop switched_to_rt() from sending IPIs to offline CPUs Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 041/109] sched: Stop resched_cpu() " Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 042/109] crypto: ecc - Fix NULL pointer deref. on no default_rng Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 043/109] crypto: cavium - fix memory leak on info Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 044/109] test_firmware: fix setting old custom fw path back on exit Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 045/109] net: ieee802154: adf7242: Fix bug if defined DEBUG Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 046/109] rtc: brcmstb-waketimer: fix error handling in brcmstb_waketmr_probe() Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 047/109] net: xfrm: allow clearing socket xfrm policies Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 048/109] mtd: nand: fix interpretation of NAND_CMD_NONE in nand_command[_lp]() Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 049/109] net: thunderx: Set max queue count taking XDP_TX into account Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 050/109] ARM: dts: am335x-pepper: Fix the audio CODECs reset pin Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 051/109] ARM: dts: omap3-n900: " Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 052/109] mtd: nand: ifc: update bufnum mask for ver >= 2.0.0 Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 053/109] userns: Dont fail follow_automount based on s_user_ns Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 054/109] xfrm: Fix xfrm_replay_overflow_offload_esn Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 055/109] leds: pm8058: Silence pointer to integer size warning Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 056/109] clk: ti: clkctrl: add support for retrying failed init Greg Kroah-Hartman
2018-03-19 3:44 ` Dan Rue
2018-03-19 6:57 ` Tero Kristo
2018-03-19 7:24 ` Greg Kroah-Hartman
2018-03-19 16:42 ` Sasha Levin
2018-03-16 15:23 ` [PATCH 4.14 057/109] power: supply: ab8500_charger: Fix an error handling path Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 058/109] power: supply: ab8500_charger: Bail out in case of error in ab8500_charger_init_hw_registers() Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 059/109] drm/etnaviv: make THERMAL selectable Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 060/109] iio: adc: ina2xx: Shift bus voltage register to mask flag bits Greg Kroah-Hartman
2018-03-16 15:23 ` Greg Kroah-Hartman [this message]
2018-03-16 15:23 ` [PATCH 4.14 062/109] ath10k: update tdls teardown state to target Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 063/109] cpufreq: Fix governor module removal race Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 064/109] dmaengine: bcm2835-dma: Use vchan_terminate_vdesc() instead of desc_free Greg Kroah-Hartman
2018-03-16 18:46 ` Dan Rue
2018-03-17 14:32 ` Vinod Koul
2018-03-18 10:24 ` Greg Kroah-Hartman
2018-03-18 10:44 ` Greg Kroah-Hartman
2018-03-19 3:08 ` Vinod Koul
2018-03-19 7:14 ` Peter Ujfalusi
2018-03-19 7:23 ` Vinod Koul
2018-03-20 4:46 ` Vinod Koul
2018-03-16 15:23 ` [PATCH 4.14 065/109] dmaengine: amba-pl08x: " Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 066/109] drm/amdgpu:fix random missing of FLR NOTIFY Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 067/109] scsi: ses: dont ask for diagnostic pages repeatedly during probe Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 068/109] pwm: stmpe: Fix wrong register offset for hwpwm=2 case Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 069/109] drm/sun4i: Fix format mask in DE2 driver Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 070/109] pinctrl: sh-pfc: r8a7791: Add can_clk function Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 071/109] pinctrl: sh-pfc: r8a7795-es1: Fix MOD_SEL1 bit[25:24] to 0x3 when using STP_ISEN_1_D Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 072/109] perf annotate: Fix unnecessary memory allocation for s390x Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 073/109] perf annotate: Fix objdump comment parsing for Intel mov dissassembly Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 074/109] iwlwifi: mvm: avoid dumping assert log when device is stopped Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 075/109] drm/amdgpu:fix virtual dce bug Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 076/109] clk: qcom: msm8916: fix mnd_width for codec_digcodec Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 077/109] mwifiex: cfg80211: do not change virtual interface during scan processing Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 078/109] ath10k: fix invalid STS_CAP_OFFSET_MASK Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 079/109] tools/usbip: fixes build with musl libc toolchain Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 080/109] spi: sun6i: disable/unprepare clocks on remove Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 081/109] bnxt_en: Dont print "Link speed -1 no longer supported" messages Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 082/109] scsi: core: scsi_get_device_flags_keyed(): Always return device flags Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 083/109] scsi: devinfo: apply to HP XP the same flags as Hitachi VSP Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 084/109] scsi: dh: add new rdac devices Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 085/109] media: vsp1: Prevent suspending and resuming DRM pipelines Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 086/109] dm raid: fix raid set size revalidation Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 087/109] media: cpia2: Fix a couple off by one bugs Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 088/109] media: davinci: vpif_capture: add NULL check on devm_kzalloc return value Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 089/109] virtio_net: Disable interrupts if napi_complete_done rescheduled napi Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 090/109] net: sched: drop qdisc_reset from dev_graft_qdisc Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 091/109] veth: set peer GSO values Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 092/109] drm/amdkfd: Fix memory leaks in kfd topology Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 093/109] powerpc/modules: Dont try to restore r2 after a sibling call Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 094/109] powerpc/64: Dont trace irqs-off at interrupt return to soft-disabled context Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 095/109] arm64: dts: renesas: salvator-common: Add EthernetAVB PHY reset Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 096/109] agp/intel: Flush all chipset writes after updating the GGTT Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 097/109] mac80211_hwsim: enforce PS_MANUAL_POLL to be set after PS_ENABLED Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 098/109] mac80211: remove BUG() when interface type is invalid Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 099/109] crypto: caam/qi - use correct print specifier for size_t Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 100/109] ASoC: nuc900: Fix a loop timeout test Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 101/109] mmc: mmc_test: Ensure command queue is disabled for testing Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 102/109] Fix misannotated out-of-line _copy_to_user() Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 103/109] ipvlan: add L2 check for packets arriving via virtual devices Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 104/109] rcutorture/configinit: Fix build directory error message Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 105/109] locking/locktorture: Fix num reader/writer corner cases Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 106/109] ima: relax requiring a file signature for new files with zero length Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 107/109] IB/mlx5: revisit -Wmaybe-uninitialized warning Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 108/109] dmaengine: qcom_hidma: check pending interrupts Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 109/109] drm/i915/glk: Disable Guc and HuC on GLK Greg Kroah-Hartman
2018-03-16 19:40 ` [PATCH 4.14 000/109] 4.14.28-stable review Naresh Kamboju
2018-03-18 10:26 ` Greg Kroah-Hartman
2018-03-16 22:20 ` kernelci.org bot
2018-03-17 14:46 ` Guenter Roeck
2018-03-18 10:25 ` Greg Kroah-Hartman
2018-03-18 10:24 ` Greg Kroah-Hartman
2018-03-18 11:14 ` Greg Kroah-Hartman
2018-03-18 22:39 ` Guenter Roeck
2018-03-19 7:39 ` Greg Kroah-Hartman
2018-03-19 8:19 ` Dan Rue
2018-03-19 18:13 ` Kash Pande
2018-03-19 18:20 ` Guenter Roeck
2018-03-26 17:54 ` Kash Pande
2018-03-27 6:28 ` Greg Kroah-Hartman
2018-03-27 6:37 ` Guenter Roeck
2018-03-27 7:28 ` Greg Kroah-Hartman
2018-03-27 8:33 ` Thomas Backlund
2018-03-27 8:45 ` Greg Kroah-Hartman
2018-03-27 10:23 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180316152333.272341014@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=alexander.levin@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matt.ranostay@konsulko.com \
--cc=pmeerw@pmeerw.net \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).