All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] media: ov5640: initialize mode data structs by name
@ 2018-04-20  9:44 Daniel Mack
  2018-04-20  9:44 ` [PATCH 2/3] media: ov5640: add PIXEL_RATE and LINK_FREQ controls Daniel Mack
  2018-04-20  9:44 ` [PATCH 3/3] media: ov5640: add support for xclk frequency control Daniel Mack
  0 siblings, 2 replies; 11+ messages in thread
From: Daniel Mack @ 2018-04-20  9:44 UTC (permalink / raw)
  To: linux-media; +Cc: slongerbeam, mchehab, Daniel Mack

This patch initializes the members of struct ov5640_mode_info by name for
better readability. This makes later additions to this struct easier.

No functional change intended.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 drivers/media/i2c/ov5640.c | 207 +++++++++++++++++++++++++++++++++------------
 1 file changed, 152 insertions(+), 55 deletions(-)

diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index 852026baa2e7..96f1564abdf5 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -728,67 +728,164 @@ static const struct reg_value ov5640_setting_15fps_QSXGA_2592_1944[] = {
 
 /* power-on sensor init reg table */
 static const struct ov5640_mode_info ov5640_mode_init_data = {
-	0, SUBSAMPLING, 640, 480, ov5640_init_setting_30fps_VGA,
-	ARRAY_SIZE(ov5640_init_setting_30fps_VGA),
+	.id		= 0,
+	.dn_mode	= SUBSAMPLING,
+	.width		= 640,
+	.height		= 480,
+	.reg_data	= ov5640_init_setting_30fps_VGA,
+	.reg_data_size	= ARRAY_SIZE(ov5640_init_setting_30fps_VGA),
 };
 
 static const struct ov5640_mode_info
 ov5640_mode_data[OV5640_NUM_FRAMERATES][OV5640_NUM_MODES] = {
+{
+	{
+		.id		= OV5640_MODE_QCIF_176_144,
+		.dn_mode	= SUBSAMPLING,
+		.width		= 176,
+		.height		= 144,
+		.reg_data	= ov5640_setting_15fps_QCIF_176_144,
+		.reg_data_size	= ARRAY_SIZE(ov5640_setting_15fps_QCIF_176_144),
+	},
+	{
+		.id		= OV5640_MODE_QVGA_320_240,
+		.dn_mode	= SUBSAMPLING,
+		.width		= 320,
+		.height		= 240,
+		.reg_data	= ov5640_setting_15fps_QVGA_320_240,
+		.reg_data_size	= ARRAY_SIZE(ov5640_setting_15fps_QVGA_320_240),
+	},
 	{
-		{OV5640_MODE_QCIF_176_144, SUBSAMPLING, 176, 144,
-		 ov5640_setting_15fps_QCIF_176_144,
-		 ARRAY_SIZE(ov5640_setting_15fps_QCIF_176_144)},
-		{OV5640_MODE_QVGA_320_240, SUBSAMPLING, 320,  240,
-		 ov5640_setting_15fps_QVGA_320_240,
-		 ARRAY_SIZE(ov5640_setting_15fps_QVGA_320_240)},
-		{OV5640_MODE_VGA_640_480, SUBSAMPLING, 640,  480,
-		 ov5640_setting_15fps_VGA_640_480,
-		 ARRAY_SIZE(ov5640_setting_15fps_VGA_640_480)},
-		{OV5640_MODE_NTSC_720_480, SUBSAMPLING, 720, 480,
-		 ov5640_setting_15fps_NTSC_720_480,
-		 ARRAY_SIZE(ov5640_setting_15fps_NTSC_720_480)},
-		{OV5640_MODE_PAL_720_576, SUBSAMPLING, 720, 576,
-		 ov5640_setting_15fps_PAL_720_576,
-		 ARRAY_SIZE(ov5640_setting_15fps_PAL_720_576)},
-		{OV5640_MODE_XGA_1024_768, SUBSAMPLING, 1024, 768,
-		 ov5640_setting_15fps_XGA_1024_768,
-		 ARRAY_SIZE(ov5640_setting_15fps_XGA_1024_768)},
-		{OV5640_MODE_720P_1280_720, SUBSAMPLING, 1280, 720,
-		 ov5640_setting_15fps_720P_1280_720,
-		 ARRAY_SIZE(ov5640_setting_15fps_720P_1280_720)},
-		{OV5640_MODE_1080P_1920_1080, SCALING, 1920, 1080,
-		 ov5640_setting_15fps_1080P_1920_1080,
-		 ARRAY_SIZE(ov5640_setting_15fps_1080P_1920_1080)},
-		{OV5640_MODE_QSXGA_2592_1944, SCALING, 2592, 1944,
-		 ov5640_setting_15fps_QSXGA_2592_1944,
-		 ARRAY_SIZE(ov5640_setting_15fps_QSXGA_2592_1944)},
-	}, {
-		{OV5640_MODE_QCIF_176_144, SUBSAMPLING, 176, 144,
-		 ov5640_setting_30fps_QCIF_176_144,
-		 ARRAY_SIZE(ov5640_setting_30fps_QCIF_176_144)},
-		{OV5640_MODE_QVGA_320_240, SUBSAMPLING, 320,  240,
-		 ov5640_setting_30fps_QVGA_320_240,
-		 ARRAY_SIZE(ov5640_setting_30fps_QVGA_320_240)},
-		{OV5640_MODE_VGA_640_480, SUBSAMPLING, 640,  480,
-		 ov5640_setting_30fps_VGA_640_480,
-		 ARRAY_SIZE(ov5640_setting_30fps_VGA_640_480)},
-		{OV5640_MODE_NTSC_720_480, SUBSAMPLING, 720, 480,
-		 ov5640_setting_30fps_NTSC_720_480,
-		 ARRAY_SIZE(ov5640_setting_30fps_NTSC_720_480)},
-		{OV5640_MODE_PAL_720_576, SUBSAMPLING, 720, 576,
-		 ov5640_setting_30fps_PAL_720_576,
-		 ARRAY_SIZE(ov5640_setting_30fps_PAL_720_576)},
-		{OV5640_MODE_XGA_1024_768, SUBSAMPLING, 1024, 768,
-		 ov5640_setting_30fps_XGA_1024_768,
-		 ARRAY_SIZE(ov5640_setting_30fps_XGA_1024_768)},
-		{OV5640_MODE_720P_1280_720, SUBSAMPLING, 1280, 720,
-		 ov5640_setting_30fps_720P_1280_720,
-		 ARRAY_SIZE(ov5640_setting_30fps_720P_1280_720)},
-		{OV5640_MODE_1080P_1920_1080, SCALING, 1920, 1080,
-		 ov5640_setting_30fps_1080P_1920_1080,
-		 ARRAY_SIZE(ov5640_setting_30fps_1080P_1920_1080)},
-		{OV5640_MODE_QSXGA_2592_1944, -1, 0, 0, NULL, 0},
+		.id		= OV5640_MODE_VGA_640_480,
+		.dn_mode	= SUBSAMPLING,
+		.width		= 640,
+		.height		= 480,
+		.reg_data	= ov5640_setting_15fps_VGA_640_480,
+		.reg_data_size	= ARRAY_SIZE(ov5640_setting_15fps_VGA_640_480)
 	},
+	{
+		.id		= OV5640_MODE_NTSC_720_480,
+		.dn_mode	= SUBSAMPLING,
+		.width		= 720,
+		.height		= 480,
+		.reg_data	= ov5640_setting_15fps_NTSC_720_480,
+		.reg_data_size	= ARRAY_SIZE(ov5640_setting_15fps_NTSC_720_480),
+	},
+	{
+		.id		= OV5640_MODE_PAL_720_576,
+		.dn_mode	= SUBSAMPLING,
+		.width		= 720,
+		.height		= 576,
+		.reg_data	= ov5640_setting_15fps_PAL_720_576,
+		.reg_data_size	= ARRAY_SIZE(ov5640_setting_15fps_PAL_720_576),
+	},
+	{
+		.id		= OV5640_MODE_XGA_1024_768,
+		.dn_mode	= SUBSAMPLING,
+		.width		= 1024,
+		.height		= 768,
+		.reg_data	= ov5640_setting_15fps_XGA_1024_768,
+		.reg_data_size	= ARRAY_SIZE(ov5640_setting_15fps_XGA_1024_768),
+	},
+	{
+		.id		= OV5640_MODE_720P_1280_720,
+		.dn_mode	= SUBSAMPLING,
+		.width		= 1280,
+		.height		= 720,
+		.reg_data	= ov5640_setting_15fps_720P_1280_720,
+		.reg_data_size	= ARRAY_SIZE(ov5640_setting_15fps_720P_1280_720),
+	},
+	{
+		.id		= OV5640_MODE_1080P_1920_1080,
+		.dn_mode	= SCALING,
+		.width		= 1920,
+		.height		= 1080,
+		.reg_data	= ov5640_setting_15fps_1080P_1920_1080,
+		.reg_data_size	= ARRAY_SIZE(ov5640_setting_15fps_1080P_1920_1080),
+	},
+	{
+		.id		= OV5640_MODE_QSXGA_2592_1944,
+		.dn_mode	= SCALING,
+		.width		= 2592,
+		.height		= 1944,
+		.reg_data	= ov5640_setting_15fps_QSXGA_2592_1944,
+		.reg_data_size	= ARRAY_SIZE(ov5640_setting_15fps_QSXGA_2592_1944),
+	},
+},
+{
+	{
+		.id		= OV5640_MODE_QCIF_176_144,
+		.dn_mode	= SUBSAMPLING,
+		.width		= 176,
+		.height		= 144,
+		.reg_data	= ov5640_setting_30fps_QCIF_176_144,
+		.reg_data_size	= ARRAY_SIZE(ov5640_setting_30fps_QCIF_176_144),
+	},
+	{
+		.id		= OV5640_MODE_QVGA_320_240,
+		.dn_mode	= SUBSAMPLING,
+		.width		= 320,
+		.height		= 240,
+		.reg_data	= ov5640_setting_30fps_QVGA_320_240,
+		.reg_data_size	= ARRAY_SIZE(ov5640_setting_30fps_QVGA_320_240),
+	},
+	{
+		.id		= OV5640_MODE_VGA_640_480,
+		.dn_mode	= SUBSAMPLING,
+		.width		= 640,
+		.height		= 480,
+		.reg_data	= ov5640_setting_30fps_VGA_640_480,
+		.reg_data_size	= ARRAY_SIZE(ov5640_setting_30fps_VGA_640_480),
+	},
+	{
+		.id		= OV5640_MODE_NTSC_720_480,
+		.dn_mode	= SUBSAMPLING,
+		.width		= 720,
+		.height		= 480,
+		.reg_data	= ov5640_setting_30fps_NTSC_720_480,
+		.reg_data_size	= ARRAY_SIZE(ov5640_setting_30fps_NTSC_720_480),
+	},
+	{
+		.id		= OV5640_MODE_PAL_720_576,
+		.dn_mode	= SUBSAMPLING,
+		.width		= 720,
+		.height		= 576,
+		.reg_data	= ov5640_setting_30fps_PAL_720_576,
+		.reg_data_size	= ARRAY_SIZE(ov5640_setting_30fps_PAL_720_576),
+	},
+	{
+		.id		= OV5640_MODE_XGA_1024_768,
+		.dn_mode	= SUBSAMPLING,
+		.width		= 1024,
+		.height		= 768,
+		.reg_data	= ov5640_setting_30fps_XGA_1024_768,
+		.reg_data_size	= ARRAY_SIZE(ov5640_setting_30fps_XGA_1024_768),
+	},
+	{
+		.id		= OV5640_MODE_720P_1280_720,
+		.dn_mode	= SUBSAMPLING,
+		.width		= 1280,
+		.height		= 720,
+		.reg_data	= ov5640_setting_30fps_720P_1280_720,
+		.reg_data_size	= ARRAY_SIZE(ov5640_setting_30fps_720P_1280_720),
+	},
+	{
+		.id		= OV5640_MODE_1080P_1920_1080,
+		.dn_mode	= SCALING,
+		.width		= 1920,
+		.height		= 1080,
+		.reg_data	= ov5640_setting_30fps_1080P_1920_1080,
+		.reg_data_size	= ARRAY_SIZE(ov5640_setting_30fps_1080P_1920_1080),
+	},
+	{
+		.id		= OV5640_MODE_QSXGA_2592_1944,
+		.dn_mode	= -1,
+		.width		= 0,
+		.height		= 0,
+		.reg_data	= NULL,
+		.reg_data_size	= 0,
+	}
+}
 };
 
 static int ov5640_init_slave_id(struct ov5640_dev *sensor)
-- 
2.14.3

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

end of thread, other threads:[~2018-04-26  8:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-20  9:44 [PATCH 1/3] media: ov5640: initialize mode data structs by name Daniel Mack
2018-04-20  9:44 ` [PATCH 2/3] media: ov5640: add PIXEL_RATE and LINK_FREQ controls Daniel Mack
2018-04-20 14:15   ` Maxime Ripard
2018-04-20 14:29     ` Daniel Mack
2018-04-20 19:00       ` Maxime Ripard
2018-04-24 10:22   ` Sakari Ailus
2018-04-24 12:03     ` Daniel Mack
2018-04-26  8:31       ` Sakari Ailus
2018-04-20  9:44 ` [PATCH 3/3] media: ov5640: add support for xclk frequency control Daniel Mack
2018-04-20 14:07   ` Maxime Ripard
2018-04-24 10:24   ` Sakari Ailus

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.