Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH 0/3] drivers/thermal/qcom/tsens: Add ability to read and shift-in non-contiguous calibration data
@ 2023-04-06 14:58 Bryan O'Donoghue
  2023-04-06 14:58 ` [PATCH 1/3] thermal/drivers/tsens: Add error/debug prints to calibration read Bryan O'Donoghue
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Bryan O'Donoghue @ 2023-04-06 14:58 UTC (permalink / raw)
  To: amitk, thara.gopinath, agross, andersson, konrad.dybcio, rafael,
	daniel.lezcano, rui.zhang, dmitry.baryshkov
  Cc: linux-pm, linux-arm-msm, linux-kernel, Bryan O'Donoghue

On MSM8939 the last sensor has calibration data that cannot be extracted in
one big read.

Rather than have a lot of MSM8939 specific code this series makes a generic
modification to allow any other calibration data that is non-contiguous to
be extracted and recovered.

For example s9-p2 takes bits 1-5 from @4b and bit 13 from @4d. The bit from
bit13 then becomes the sixth bit in the calibration data.

tsens_s9_p2: s9-p2@4b {
    reg = <0x4b 0x1>;
    bits = <1 5>;
};

tsens_s9_p2_msb: s9-p2-msb@4d {
    reg = <0x4d 0x1>;
    bits = <13 1>;
};

A register desciptor is introduced in the driver which takes the place of
the previous unsigned int hw_ids array in struct tsens_plat_data.

This new structure contains the previous hardware id and two variables
p1_shift and p2_shift.

If p1_shift or p2_shift is non-zero then this tells
tsens_read_calibration() to search for sX-pY-msb where msb means "most
significant bits".

The value at p1_shift/p2_shift is then used to right shift the value read
from sX-pY-msb and or that value into the base value from sX-pY.

The nvmem 'bits' field provides the mask.

Bryan O'Donoghue (3):
  thermal/drivers/tsens: Add error/debug prints to calibration read
  thermal/drivers/tsens: Describe sensor registers via a structure
  thermal/drivers/tsens: Extract and shift-in optional MSB

 drivers/thermal/qcom/tsens-v0_1.c | 56 +++++++++++++++++++++++++++++--
 drivers/thermal/qcom/tsens.c      | 50 ++++++++++++++++++++++++---
 drivers/thermal/qcom/tsens.h      | 16 ++++++++-
 3 files changed, 115 insertions(+), 7 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-04-06 22:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-06 14:58 [PATCH 0/3] drivers/thermal/qcom/tsens: Add ability to read and shift-in non-contiguous calibration data Bryan O'Donoghue
2023-04-06 14:58 ` [PATCH 1/3] thermal/drivers/tsens: Add error/debug prints to calibration read Bryan O'Donoghue
2023-04-06 17:36   ` Dmitry Baryshkov
2023-04-06 14:58 ` [PATCH 2/3] thermal/drivers/tsens: Describe sensor registers via a structure Bryan O'Donoghue
2023-04-06 17:43   ` Dmitry Baryshkov
2023-04-06 14:58 ` [PATCH 3/3] thermal/drivers/tsens: Extract and shift-in optional MSB Bryan O'Donoghue
2023-04-06 17:47   ` Dmitry Baryshkov
2023-04-06 16:20 ` [PATCH 0/3] drivers/thermal/qcom/tsens: Add ability to read and shift-in non-contiguous calibration data Stephan Gerhold
2023-04-06 22:36   ` Bryan O'Donoghue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox