All of lore.kernel.org
 help / color / mirror / Atom feed
From: Seongyong Park <euphoriccatface@gmail.com>
To: linux-media@vger.kernel.org
Cc: Matt Ranostay <matt.ranostay@konsulko.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Seongyong Park <euphoriccatface@gmail.com>
Subject: [PATCH V2 2/2] media: video-i2c: append register data on MLX90640's frame
Date: Sat,  5 Jun 2021 20:54:57 +0900	[thread overview]
Message-ID: <20210605115456.14440-3-euphoriccatface@gmail.com> (raw)
In-Reply-To: <20210516110902.784-1-euphoriccatface@gmail.com>

On MLX90640, Each measurement step updates half of the pixels in the frame
(every other pixel in default "chess mode", and every other row
in "interleave mode"), while additional coefficient data (25th & 26th row)
updates every step. The compensational coefficient data only corresponds
with the pixels updated in the same step.

Only way to know which "subpage" was updated on the last step is to read
"status register" on address 0x8000. Without this data,
compensation calculation may be able to detect which sets of pixels have
been updated, but it will have to make assumptions when frame skip happens,
and there is no way to do it correctly when the host simply cannot
keep up with refresh rate.

Signed-off-by: Seongyong Park <euphoriccatface@gmail.com>
---
 drivers/media/i2c/video-i2c.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c
index 2ccb08335..f2313b446 100644
--- a/drivers/media/i2c/video-i2c.c
+++ b/drivers/media/i2c/video-i2c.c
@@ -74,7 +74,8 @@ static const struct v4l2_fmtdesc mlx90640_format = {
 
 static const struct v4l2_frmsize_discrete mlx90640_size = {
 	.width = 32,
-	.height = 26, /* 24 lines of pixel data + 2 lines of processing data */
+	.height = 27,
+	/* 24 lines of pixel data + 2 lines of processing data + 1 line of registers */
 };
 
 static const struct regmap_config amg88xx_regmap_config = {
@@ -168,8 +169,12 @@ 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,
-				data->chip->buffer_size);
+	int ret = regmap_bulk_read(data->regmap, 0x400, buf,
+				   data->chip->buffer_size - 64);
+	if (ret)
+		return ret;
+	return regmap_bulk_read(data->regmap, 0x8000, buf + (data->chip->buffer_size - 64),
+				64);
 }
 
 static int amg88xx_setup(struct video_i2c_data *data)
@@ -375,7 +380,7 @@ static const struct video_i2c_chip video_i2c_chip[] = {
 		.format		= &mlx90640_format,
 		.frame_intervals	= mlx90640_frame_intervals,
 		.num_frame_intervals	= ARRAY_SIZE(mlx90640_frame_intervals),
-		.buffer_size	= 1664,
+		.buffer_size	= 1728,
 		.bpp		= 16,
 		.regmap_config	= &mlx90640_regmap_config,
 		.nvmem_config	= &mlx90640_nvram_config,
-- 
2.31.1


  parent reply	other threads:[~2021-06-05 11:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-05 11:54 [PATCH V2 0/2] media: video-i2c: additional support for Melexis MLX90640 Seongyong Park
2021-05-16 11:09 ` [PATCH 1/2] media: video-i2c: frame delay based on last frame's end time Seongyong Park
2021-05-16 11:09   ` [PATCH 2/2] media: video-i2c: append register data on MLX90640's frame Seongyong Park
2021-05-16 20:48     ` Matt Ranostay
2021-05-17  1:39       ` Seongyong Park
2021-05-17 23:40         ` Matt Ranostay
2021-05-16 20:13   ` [PATCH 1/2] media: video-i2c: frame delay based on last frame's end time Matt Ranostay
2021-05-19  3:45   ` [PATCH V2 2/2] media: video-i2c: append register data on MLX90640's frame Seongyong Park
2021-06-05 11:54   ` Seongyong Park [this message]
2021-06-05 11:54 ` [PATCH 1/2] media: video-i2c: frame delay based on last frame's end time Seongyong Park
2021-06-05 14:00   ` Mauro Carvalho Chehab
2021-06-05 14:53     ` Mauro Carvalho Chehab
2021-06-06  7:20       ` Seongyong Park
2021-06-06 11:00         ` Mauro Carvalho Chehab
2021-06-06 15:06           ` Seongyong Park
2021-06-06 19:18             ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210605115456.14440-3-euphoriccatface@gmail.com \
    --to=euphoriccatface@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=matt.ranostay@konsulko.com \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.