From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev,
Javier Carrasco <javier.carrasco.cruz@gmail.com>,
Stable@vger.kernel.org,
Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: [PATCH 6.1 059/112] iio: common: ms_sensors: ms_sensors_i2c: fix humidity conversion time table
Date: Sat, 30 Dec 2023 11:59:32 +0000 [thread overview]
Message-ID: <20231230115808.597776906@linuxfoundation.org> (raw)
In-Reply-To: <20231230115806.714618407@linuxfoundation.org>
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <javier.carrasco.cruz@gmail.com>
commit 54cf39ec16335dadbe1ba008d8e5e98dae3e26f8 upstream.
The HTU21 offers 4 sampling frequencies: 20, 40, 70 and 120, which are
associated to an index that is used to select the right measurement
resolution and its corresponding measurement time. The current
implementation selects the measurement resolution and the temperature
measurement time properly, but it does not select the right humidity
measurement time in all cases.
In summary, the 40 and 70 humidity measurement times are swapped.
The reason for that is probably the unusual coding for the measurement
resolution. According to the datasheet, the bits [7,0] of the "user
register" are used as follows to select the bit resolution:
--------------------------------------------------
| Bit 7 | Bit 0 | RH | Temp | Trh (us) | Tt (us) |
--------------------------------------------------
| 0 | 0 | 12 | 14 | 16000 | 50000 |
--------------------------------------------------
| 0 | 1 | 8 | 12 | 3000 | 13000 |
--------------------------------------------------
| 1 | 0 | 10 | 13 | 5000 | 25000 |
--------------------------------------------------
| 1 | 1 | 11 | 11 | 8000 | 7000 |
--------------------------------------------------
*This table is available in the official datasheet, page 13/21. I have
just appended the times provided in the humidity/temperature tables,
pages 3/21, 5/21. Note that always a pair of resolutions is selected.
The sampling frequencies [20, 40, 70, 120] are assigned to a linear
index [0..3] which is then coded as follows [1]:
Index [7,0]
--------------
idx 0 0,0
idx 1 1,0
idx 2 0,1
idx 3 1,1
That is done that way because the temperature measurements are being
used as the reference for the sampling frequency (the frequencies and
the temperature measurement times are correlated), so increasing the
index always reduces the temperature measurement time and its
resolution. Therefore, the temperature measurement time array is as
simple as [50000, 25000, 13000, 7000]
On the other hand, the humidity resolution cannot follow the same
pattern because of the way it is coded in the "user register", where
both resolutions are selected at the same time. The humidity measurement
time array is the following: [16000, 3000, 5000, 8000], which defines
the following assignments:
Index [7,0] Trh
-----------------------
idx 0 0,0 16000 -> right, [0,0] selects 12 bits (Trh = 16000)
idx 1 1,0 3000 -> wrong! [1,0] selects 10 bits (Trh = 5000)
idx 2 0,1 5000 -> wrong! [0,1] selects 8 bits (Trh = 3000)
idx 3 1,1 8000 -> right, [1,1] selects 11 bits (Trh = 8000)
The times have been ordered as if idx = 1 -> [0,1] and idx = 2 -> [1,0],
which is not the case for the reason explained above.
So a simple modification is required to obtain the right humidity
measurement time array, swapping the values in the positions 1 and 2.
The right table should be the following: [16000, 5000, 3000, 8000]
Fix the humidity measurement time array with the right idex/value
coding.
[1] The actual code that makes this coding and assigns it to the current
value of the "user register" is the following:
config_reg &= 0x7E;
config_reg |= ((i & 1) << 7) + ((i & 2) >> 1);
Fixes: d574a87cc311 ("Add meas-spec sensors common part")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20231026-topic-htu21_conversion_time-v1-1-bd257dc44209@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/common/ms_sensors/ms_sensors_i2c.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
+++ b/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
@@ -15,8 +15,8 @@
/* Conversion times in us */
static const u16 ms_sensors_ht_t_conversion_time[] = { 50000, 25000,
13000, 7000 };
-static const u16 ms_sensors_ht_h_conversion_time[] = { 16000, 3000,
- 5000, 8000 };
+static const u16 ms_sensors_ht_h_conversion_time[] = { 16000, 5000,
+ 3000, 8000 };
static const u16 ms_sensors_tp_conversion_time[] = { 500, 1100, 2100,
4100, 8220, 16440 };
next prev parent reply other threads:[~2023-12-30 12:09 UTC|newest]
Thread overview: 121+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-30 11:58 [PATCH 6.1 000/112] 6.1.70-rc1 review Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 001/112] kasan: disable kasan_non_canonical_hook() for HW tags Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 002/112] bpf: Fix prog_array_map_poke_run map poke update Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 003/112] HID: i2c-hid: acpi: Unify ACPI ID tables format Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 004/112] HID: i2c-hid: Add IDEA5002 to i2c_hid_acpi_blacklist[] Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 005/112] drm/amd/display: fix hw rotated modes when PSR-SU is enabled Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 006/112] ARM: dts: dra7: Fix DRA7 L3 NoC node register size Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 007/112] ARM: OMAP2+: Fix null pointer dereference and memory leak in omap_soc_device_init Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 008/112] reset: Fix crash when freeing non-existent optional resets Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 009/112] s390/vx: fix save/restore of fpu kernel context Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 010/112] wifi: iwlwifi: pcie: add another missing bh-disable for rxq->lock Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 011/112] wifi: mac80211: check if the existing link config remains unchanged Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 012/112] wifi: mac80211: mesh: check element parsing succeeded Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 013/112] wifi: mac80211: mesh_plink: fix matches_local logic Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 014/112] Revert "net/mlx5e: fix double free of encap_header in update funcs" Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 015/112] Revert "net/mlx5e: fix double free of encap_header" Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 016/112] net/mlx5e: Fix slab-out-of-bounds in mlx5_query_nic_vport_mac_list() Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 017/112] net/mlx5: Introduce and use opcode getter in command interface Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 018/112] net/mlx5: Prevent high-rate FW commands from populating all slots Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 019/112] net/mlx5: Re-organize mlx5_cmd struct Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 020/112] net/mlx5e: Fix a race in command alloc flow Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 021/112] net/mlx5e: fix a potential double-free in fs_udp_create_groups Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 022/112] net/mlx5: Fix fw tracer first block check Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 023/112] net/mlx5e: Correct snprintf truncation handling for fw_version buffer Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 024/112] net/mlx5e: Correct snprintf truncation handling for fw_version buffer used by representors Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 025/112] net: mscc: ocelot: fix eMAC TX RMON stats for bucket 256-511 and above Greg Kroah-Hartman
2023-12-30 11:58 ` [PATCH 6.1 026/112] octeontx2-pf: Fix graceful exit during PFC configuration failure Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 027/112] net: Return error from sk_stream_wait_connect() if sk_wait_event() fails Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 028/112] net: sched: ife: fix potential use-after-free Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 029/112] ethernet: atheros: fix a memleak in atl1e_setup_ring_resources Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 030/112] net/rose: fix races in rose_kill_by_device() Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 031/112] Bluetooth: Fix deadlock in vhci_send_frame Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 032/112] Bluetooth: hci_event: shut up a false-positive warning Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 033/112] net: mana: select PAGE_POOL Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 034/112] net: check vlan filter feature in vlan_vids_add_by_dev() and vlan_vids_del_by_dev() Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 035/112] afs: Fix the dynamic roots d_delete to always delete unused dentries Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 036/112] afs: Fix dynamic root lookup DNS check Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 037/112] net: check dev->gso_max_size in gso_features_check() Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 038/112] keys, dns: Allow key types (eg. DNS) to be reclaimed immediately on expiry Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 039/112] afs: Fix overwriting of result of DNS query Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 040/112] afs: Fix use-after-free due to get/remove race in volume tree Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 041/112] ASoC: hdmi-codec: fix missing report for jack initial status Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 042/112] ASoC: fsl_sai: Fix channel swap issue on i.MX8MP Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 043/112] i2c: aspeed: Handle the coalesced stop conditions with the start conditions Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 044/112] x86/xen: add CPU dependencies for 32-bit build Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 045/112] pinctrl: at91-pio4: use dedicated lock class for IRQ Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 046/112] gpiolib: cdev: add gpio_device locking wrapper around gpio_ioctl() Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 047/112] nvme-pci: fix sleeping function called from interrupt context Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 048/112] drm/i915/mtl: limit second scaler vertical scaling in ver >= 14 Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 049/112] drm/i915: Relocate intel_atomic_setup_scalers() Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 050/112] drm/i915: Fix intel_atomic_setup_scalers() plane_state handling Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 051/112] drm/i915/dpt: Only do the POT stride remap when using DPT Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 052/112] drm/i915/mtl: Add MTL for remapping CCS FBs Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 053/112] drm/i915: Fix ADL+ tiled plane stride when the POT stride is smaller than the original Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 054/112] interconnect: Treat xlate() returning NULL node as an error Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 055/112] iio: imu: inv_mpu6050: fix an error code problem in inv_mpu6050_read_raw Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 056/112] interconnect: qcom: sm8250: Enable sync_state Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 057/112] Input: ipaq-micro-keys - add error handling for devm_kmemdup Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 058/112] scsi: bnx2fc: Fix skb double free in bnx2fc_rcv() Greg Kroah-Hartman
2023-12-30 11:59 ` Greg Kroah-Hartman [this message]
2023-12-30 11:59 ` [PATCH 6.1 060/112] iio: adc: ti_am335x_adc: Fix return value check of tiadc_request_dma() Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 061/112] iio: triggered-buffer: prevent possible freeing of wrong buffer Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 062/112] ALSA: usb-audio: Increase delay in MOTU M quirk Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 063/112] usb-storage: Add quirk for incorrect WP on Kingston DT Ultimate 3.0 G3 Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 064/112] wifi: cfg80211: Add my certificate Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 065/112] wifi: cfg80211: fix certs build to not depend on file order Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 066/112] USB: serial: ftdi_sio: update Actisense PIDs constant names Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 067/112] USB: serial: option: add Quectel EG912Y module support Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 068/112] USB: serial: option: add Foxconn T99W265 with new baseline Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 069/112] USB: serial: option: add Quectel RM500Q R13 firmware support Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 070/112] ALSA: hda/realtek: Add quirk for ASUS ROG GV302XA Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 071/112] Bluetooth: hci_event: Fix not checking if HCI_OP_INQUIRY has been sent Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 072/112] Bluetooth: af_bluetooth: Fix Use-After-Free in bt_sock_recvmsg Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 073/112] Bluetooth: L2CAP: Send reject on command corrupted request Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 074/112] Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 075/112] Bluetooth: Add more enc key size check Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 076/112] net: usb: ax88179_178a: avoid failed operations when device is disconnected Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 077/112] Input: soc_button_array - add mapping for airplane mode button Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 078/112] net: 9p: avoid freeing uninit memory in p9pdu_vreadf Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 079/112] net: rfkill: gpio: set GPIO direction Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 080/112] net: ks8851: Fix TX stall caused by TX buffer overrun Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 081/112] dt-bindings: nvmem: mxs-ocotp: Document fsl,ocotp Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 082/112] smb: client: fix OOB in cifsd when receiving compounded resps Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 083/112] smb: client: fix potential OOB in cifs_dump_detail() Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 084/112] smb: client: fix OOB in SMB2_query_info_init() Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 085/112] smb: client: fix OOB in smbCalcSize() Greg Kroah-Hartman
2023-12-30 11:59 ` [PATCH 6.1 086/112] drm/i915: Reject async flips with bigjoiner Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 087/112] 9p: prevent read overrun in protocol dump tracepoint Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 088/112] RISC-V: Fix do_notify_resume / do_work_pending prototype Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 089/112] loop: do not enforce max_loop hard limit by (new) default Greg Kroah-Hartman
2023-12-31 15:49 ` Sven Joachim
2024-01-01 12:16 ` Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 090/112] dm thin metadata: Fix ABBA deadlock by resetting dm_bufio_client Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 091/112] Revert "drm/amd/display: Do not set DRR on pipe commit" Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 092/112] btrfs: zoned: no longer count fresh BG region as zone unusable Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 093/112] ubifs: fix possible dereference after free Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 094/112] ublk: move ublk_cancel_dev() out of ub->mutex Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 095/112] selftests: mptcp: join: fix subflow_send_ack lookup Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 096/112] Revert "scsi: aacraid: Reply queue mapping to CPUs based on IRQ affinity" Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 097/112] scsi: core: Always send batch on reset or error handling command Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 098/112] tracing / synthetic: Disable events after testing in synth_event_gen_test_init() Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 099/112] dm-integrity: dont modify bios immutable bio_vec in integrity_metadata() Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 100/112] pinctrl: starfive: jh7100: ignore disabled device tree nodes Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 101/112] bus: ti-sysc: Flush posted write only after srst_udelay Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 102/112] gpio: dwapb: mask/unmask IRQ when disable/enale it Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 103/112] lib/vsprintf: Fix %pfwf when current node refcount == 0 Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 104/112] thunderbolt: Fix memory leak in margining_port_remove() Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 105/112] KVM: arm64: vgic: Simplify kvm_vgic_destroy() Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 106/112] KVM: arm64: vgic: Add a non-locking primitive for kvm_vgic_vcpu_destroy() Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 107/112] KVM: arm64: vgic: Force vcpu vgic teardown on vcpu destroy Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 108/112] x86/alternatives: Sync core before enabling interrupts Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 109/112] mm/damon/core: make damon_start() waits until kdamond_fn() starts Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 110/112] fuse: share lookup state between submount and its parent Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 111/112] wifi: cfg80211: fix CQM for non-range use Greg Kroah-Hartman
2023-12-30 12:00 ` [PATCH 6.1 112/112] wifi: nl80211: fix deadlock in nl80211_set_cqm_rssi (6.6.x) Greg Kroah-Hartman
2023-12-30 16:29 ` [PATCH 6.1 000/112] 6.1.70-rc1 review Florian Fainelli
2023-12-30 18:14 ` SeongJae Park
2023-12-31 9:49 ` Naresh Kamboju
2023-12-31 12:04 ` Ron Economos
2023-12-31 16:33 ` Guenter Roeck
2024-01-01 9:26 ` Pavel Machek
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=20231230115808.597776906@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=patches@lists.linux.dev \
--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