summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoses Christopher Bollavarapu <mosescb.dev@gmail.com>2022-04-19 22:20:50 +0200
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-05-17 09:16:31 +0200
commitf0de79f6b78a233b39cc90ede59d829df350d735 (patch)
tree2c1a21c4e095a7791308f71d8f42bb0c4baa1c82
parentmedia: i2c: video-i2c: Move defines to the top of the file (diff)
downloadlinux-f0de79f6b78a233b39cc90ede59d829df350d735.tar.xz
linux-f0de79f6b78a233b39cc90ede59d829df350d735.zip
media: i2c: video-i2c: Replace constants with proper names
Acc to MLX90640 datasheet: - 0x0400 represents the start of RAM address - 0x2400 represents the start of EEPROM address Reference: https://www.melexis.com/-/media/files/documents\ /datasheets/mlx90640-datasheet-melexis.pdf Signed-off-by: Moses Christopher Bollavarapu <mosescb.dev@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
-rw-r--r--drivers/media/i2c/video-i2c.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c
index b3fe9a507f7f..1d5f48329cb2 100644
--- a/drivers/media/i2c/video-i2c.c
+++ b/drivers/media/i2c/video-i2c.c
@@ -54,6 +54,12 @@
/* Temperature register */
#define AMG88XX_REG_T01L 0x80
+/* RAM */
+#define MLX90640_RAM_START_ADDR 0x0400
+
+/* EEPROM */
+#define MLX90640_EEPROM_START_ADDR 0x2400
+
/* Control register */
#define MLX90640_REG_CTL1 0x800d
#define MLX90640_REG_CTL1_MASK 0x0380
@@ -149,7 +155,7 @@ static int mlx90640_nvram_read(void *priv, unsigned int offset, void *val,
{
struct video_i2c_data *data = priv;
- return regmap_bulk_read(data->regmap, 0x2400 + offset, val, bytes);
+ return regmap_bulk_read(data->regmap, MLX90640_EEPROM_START_ADDR + offset, val, bytes);
}
static struct nvmem_config mlx90640_nvram_config = {
@@ -168,7 +174,7 @@ static int amg88xx_xfer(struct video_i2c_data *data, char *buf)
static int mlx90640_xfer(struct video_i2c_data *data, char *buf)
{
- return regmap_bulk_read(data->regmap, 0x400, buf,
+ return regmap_bulk_read(data->regmap, MLX90640_RAM_START_ADDR, buf,
data->chip->buffer_size);
}