Skip to content

Commit ed777d3

Browse files
naushirpopcornmix
authored andcommitted
drivers: media: imx500: Enable sensor temperature monitoring
The register needs to be disabled before loading any firmware, otherwise the upload fails for unknown reasons. Re-enable before starting the sensor streaming. Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
1 parent 1a396d3 commit ed777d3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/media/i2c/imx500.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
#define IMX500_IMAGE_ONLY_FALSE 0x00
3838
#define IMX500_IMAGE_ONLY_TRUE 0x01
3939

40+
#define IMX500_REG_SENSOR_TEMP_CTRL CCI_REG8(0x0138)
41+
4042
#define IMX500_REG_ORIENTATION CCI_REG8(0x101)
4143

4244
#define IMX500_XCLK_FREQ 24000000
@@ -2505,6 +2507,14 @@ static int imx500_start_streaming(struct imx500 *imx500)
25052507
if (ret < 0)
25062508
return ret;
25072509

2510+
/*
2511+
* Disable the temperature sensor here - must be done else loading any
2512+
* firmware fails...
2513+
*
2514+
* Re-enable before stream-on below.
2515+
*/
2516+
cci_write(imx500->regmap, IMX500_REG_SENSOR_TEMP_CTRL, 0, &ret);
2517+
25082518
ret = cci_write(imx500->regmap, IMX500_REG_IMAGE_ONLY_MODE,
25092519
imx500->fw_network ? IMX500_IMAGE_ONLY_FALSE :
25102520
IMX500_IMAGE_ONLY_TRUE,
@@ -2599,6 +2609,9 @@ static int imx500_start_streaming(struct imx500 *imx500)
25992609
/* Disable any sensor startup frame drops. This must be written here! */
26002610
cci_write(imx500->regmap, CCI_REG8(0xD405), 0, &ret);
26012611

2612+
/* Re-enable the temperature sensor. */
2613+
cci_write(imx500->regmap, IMX500_REG_SENSOR_TEMP_CTRL, 1, &ret);
2614+
26022615
/* set stream on register */
26032616
cci_write(imx500->regmap, IMX500_REG_MODE_SELECT, IMX500_MODE_STREAMING,
26042617
&ret);

0 commit comments

Comments
 (0)