lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <34824fc2-af03-48e3-98b8-04fae28c9a64@gmail.com>
Date: Wed, 4 Feb 2026 18:34:50 +0200
From: Erikas Bitovtas <xerikasxx@...il.com>
To: David Lechner <dlechner@...libre.com>, Jonathan Cameron
 <jic23@...nel.org>, Nuno Sá <nuno.sa@...log.com>,
 Andy Shevchenko <andy@...nel.org>, Rob Herring <robh@...nel.org>,
 Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
 <conor+dt@...nel.org>, Kevin Tsai <ktsai@...ellamicro.com>
Cc: linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
 linux-kernel@...r.kernel.org, ~postmarketos/upstreaming@...ts.sr.ht,
 phone-devel@...r.kernel.org
Subject: Re: [PATCH 2/2] iio: light: Add support for Capella cm36686 and
 cm36672p sensors

> I assume you have the hardware and can do a test to confirm this. :-)

I tested the formula used in Xiaomi's driver in the mainline kernel and
compared it against the downstream kernel, and the lux readings match between
them. Therefore, I suppose this solution could be good for now.
Although my formula for calculating scale is wrong - it should be inverse
proportionate to integration time. So:
80ms -> 1.28
160ms -> 0.64 (what Xiaomi uses)
320ms -> 0.32
640ms -> 0.16
This can be achieved by multiplying als_trans_ratio by integration time used in
Xiaomi's driver, and then dividing by integration time we have set up at the
given moment.
For example, suppose we set our int time in mainline to 80ms
16 (als_trans_ration) * 16 (160ms / 10000) = 256
256 / 8 (80ms / 10000) = 32
Starting here, we calculate based on how Xiaomi calculates scale for their values:
32 * 40000 = 1280000
val = 1280000 / 1000000 = 1
val2 = 1280000 % 1000000 = 280000
And that leaves us with scale of 1.280000.
Of course, comments on how we came to this value would be included as well.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ