[v2,5/5] thermal/drivers/mediatek/lvts_thermal: Update calibration data documentation

Message ID 20230425133052.199767-6-bchihi@baylibre.com
State New
Headers
Series Add LVTS support for mt8192 |

Commit Message

Balsam CHIHI April 25, 2023, 1:30 p.m. UTC
  From: Balsam CHIHI <bchihi@baylibre.com>

Update LVTS calibration data documentation for mt8192 and mt8195.

Signed-off-by: Balsam CHIHI <bchihi@baylibre.com>
---
 drivers/thermal/mediatek/lvts_thermal.c | 59 ++++++++++++++++++-------
 1 file changed, 43 insertions(+), 16 deletions(-)
  

Comments

Nícolas F. R. A. Prado May 4, 2023, 1:01 a.m. UTC | #1
On Tue, Apr 25, 2023 at 03:30:52PM +0200, bchihi@baylibre.com wrote:
> From: Balsam CHIHI <bchihi@baylibre.com>
> 
> Update LVTS calibration data documentation for mt8192 and mt8195.
> 
> Signed-off-by: Balsam CHIHI <bchihi@baylibre.com>
> ---
>  drivers/thermal/mediatek/lvts_thermal.c | 59 ++++++++++++++++++-------
>  1 file changed, 43 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
> index 8df7b4c72a658..3df4989f9902b 100644
> --- a/drivers/thermal/mediatek/lvts_thermal.c
> +++ b/drivers/thermal/mediatek/lvts_thermal.c
> @@ -531,30 +531,57 @@ static int lvts_sensor_init(struct device *dev, struct lvts_ctrl *lvts_ctrl,
>   * The efuse blob values follows the sensor enumeration per thermal
>   * controller. The decoding of the stream is as follow:
>   *
> - * stream index map for MCU Domain :
> + * MT8195 :
> + * Stream index map for MCU Domain mt8195 :
>   *
> - * <-----mcu-tc#0-----> <-----sensor#0-----> <-----sensor#1----->
> - *  0x01 | 0x02 | 0x03 | 0x04 | 0x05 | 0x06 | 0x07 | 0x08 | 0x09
> + * <-----sensor#0-----> <-----sensor#1----->
> + *  0x04 | 0x05 | 0x06 | 0x07 | 0x08 | 0x09

I don't think you need to remove the controller calibration data from this
comment, even though you don't use it in the code. Could come in handy in the
future.

>   *
[..]
> + * MT8192 :
> + * Stream index map for MCU Domain mt8192 :
> + *
> + * <--------sensor#0---------> <--------sensor#1--------->
> + *  0x04 | 0x05 | 0x06 | 0x07 | 0x08 | 0x09 | 0x0A | 0x0B

Each sensor data is 3 bytes long, just like for MT8195. The fourth byte contains
the controller calibration data, but it is spread across these fourth bytes. I'd
just leave these bytes undocumented for now since they're not currently used.

So,

  + * <-----sensor#0----->        <-----sensor#1----->       
  + *  0x04 | 0x05 | 0x06 | 0x07 | 0x08 | 0x09 | 0x0A | 0x0B

etc.

With that fixed,

Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

Thanks,
Nícolas
  

Patch

diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index 8df7b4c72a658..3df4989f9902b 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -531,30 +531,57 @@  static int lvts_sensor_init(struct device *dev, struct lvts_ctrl *lvts_ctrl,
  * The efuse blob values follows the sensor enumeration per thermal
  * controller. The decoding of the stream is as follow:
  *
- * stream index map for MCU Domain :
+ * MT8195 :
+ * Stream index map for MCU Domain mt8195 :
  *
- * <-----mcu-tc#0-----> <-----sensor#0-----> <-----sensor#1----->
- *  0x01 | 0x02 | 0x03 | 0x04 | 0x05 | 0x06 | 0x07 | 0x08 | 0x09
+ * <-----sensor#0-----> <-----sensor#1----->
+ *  0x04 | 0x05 | 0x06 | 0x07 | 0x08 | 0x09
  *
- * <-----mcu-tc#1-----> <-----sensor#2-----> <-----sensor#3----->
- *  0x0A | 0x0B | 0x0C | 0x0D | 0x0E | 0x0F | 0x10 | 0x11 | 0x12
+ * <-----sensor#2-----> <-----sensor#3----->
+ *  0x0D | 0x0E | 0x0F | 0x10 | 0x11 | 0x12
  *
- * <-----mcu-tc#2-----> <-----sensor#4-----> <-----sensor#5-----> <-----sensor#6-----> <-----sensor#7----->
- *  0x13 | 0x14 | 0x15 | 0x16 | 0x17 | 0x18 | 0x19 | 0x1A | 0x1B | 0x1C | 0x1D | 0x1E | 0x1F | 0x20 | 0x21
+ * <-----sensor#4-----> <-----sensor#5-----> <-----sensor#6-----> <-----sensor#7----->
+ *  0x16 | 0x17 | 0x18 | 0x19 | 0x1A | 0x1B | 0x1C | 0x1D | 0x1E | 0x1F | 0x20 | 0x21
  *
- * stream index map for AP Domain :
+ * Stream index map for AP Domain mt8195 :
  *
- * <-----ap--tc#0-----> <-----sensor#0-----> <-----sensor#1----->
- *  0x22 | 0x23 | 0x24 | 0x25 | 0x26 | 0x27 | 0x28 | 0x29 | 0x2A
+ * <-----sensor#0-----> <-----sensor#1----->
+ *  0x25 | 0x26 | 0x27 | 0x28 | 0x29 | 0x2A
  *
- * <-----ap--tc#1-----> <-----sensor#2-----> <-----sensor#3----->
- *  0x2B | 0x2C | 0x2D | 0x2E | 0x2F | 0x30 | 0x31 | 0x32 | 0x33
+ * <-----sensor#2-----> <-----sensor#3----->
+ *  0x2E | 0x2F | 0x30 | 0x31 | 0x32 | 0x33
  *
- * <-----ap--tc#2-----> <-----sensor#4-----> <-----sensor#5-----> <-----sensor#6----->
- *  0x34 | 0x35 | 0x36 | 0x37 | 0x38 | 0x39 | 0x3A | 0x3B | 0x3C | 0x3D | 0x3E | 0x3F
+ * <-----sensor#4-----> <-----sensor#5-----> <-----sensor#6----->
+ *  0x37 | 0x38 | 0x39 | 0x3A | 0x3B | 0x3C | 0x3D | 0x3E | 0x3F
  *
- * <-----ap--tc#3-----> <-----sensor#7-----> <-----sensor#8----->
- *  0x40 | 0x41 | 0x42 | 0x43 | 0x44 | 0x45 | 0x46 | 0x47 | 0x48
+ * <-----sensor#7-----> <-----sensor#8----->
+ *  0x43 | 0x44 | 0x45 | 0x46 | 0x47 | 0x48
+ *
+ * MT8192 :
+ * Stream index map for MCU Domain mt8192 :
+ *
+ * <--------sensor#0---------> <--------sensor#1--------->
+ *  0x04 | 0x05 | 0x06 | 0x07 | 0x08 | 0x09 | 0x0A | 0x0B
+ *
+ * <--------sensor#2---------> <--------sensor#3--------->
+ *  0x0C | 0x0D | 0x0E | 0x0F | 0x10 | 0x11 | 0x12 | 0x13
+ *
+ * <--------sensor#4---------> <--------sensor#5---------> <--------sensor#6---------> <--------sensor#7--------->
+ *  0x14 | 0x15 | 0x16 | 0x17 | 0x18 | 0x19 | 0x1A | 0x1B | 0x1C | 0x1D | 0x1E | 0x1F | 0x20 | 0x21 | 0x22 | 0x23
+ *
+ * Stream index map for AP Domain mt8192 :
+ *
+ * <--------sensor#0---------> <--------sensor#1--------->
+ *  0x24 | 0x25 | 0x26 | 0x27 | 0x28 | 0x29 | 0x2A | 0x2B
+ *
+ * <--------sensor#2---------> <--------sensor#3--------->
+ *  0x2C | 0x2D | 0x2E | 0x2F | 0x30 | 0x31 | 0x32 | 0x33
+ *
+ * <--------sensor#4---------> <--------sensor#5--------->
+ *  0x34 | 0x35 | 0x36 | 0x37 | 0x38 | 0x39 | 0x3A | 0x3B
+ *
+ * <--------sensor#6---------> <--------sensor#7---------> <--------sensor#8--------->
+ *  0x3C | 0x3D | 0x3E | 0x3F | 0x40 | 0x41 | 0x42 | 0x43 | 0x44 | 0x45 | 0x46 | 0x47
  *
  * The data description gives the offset of the calibration data in
  * this bytes stream for each sensor.