Commit d7dc18da authored by Frank Schaefer's avatar Frank Schaefer Committed by Mauro Carvalho Chehab

[media] em28xx: move sensor parameter fields from struct em28xx to struct v4l2

Move camera sensor resolution and xtal out of em28xx common struct,
as thore are used only by the em28xx v4l2 submodule.
Signed-off-by: default avatarFrank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 58159171
...@@ -349,8 +349,8 @@ int em28xx_init_camera(struct em28xx *dev) ...@@ -349,8 +349,8 @@ int em28xx_init_camera(struct em28xx *dev)
.platform_data = &pdata, .platform_data = &pdata,
}; };
dev->sensor_xres = 640; v4l2->sensor_xres = 640;
dev->sensor_yres = 480; v4l2->sensor_yres = 480;
/* /*
* FIXME: mt9v011 uses I2S speed as xtal clk - at least with * FIXME: mt9v011 uses I2S speed as xtal clk - at least with
...@@ -363,8 +363,8 @@ int em28xx_init_camera(struct em28xx *dev) ...@@ -363,8 +363,8 @@ int em28xx_init_camera(struct em28xx *dev)
*/ */
dev->board.xclk = EM28XX_XCLK_FREQUENCY_4_3MHZ; dev->board.xclk = EM28XX_XCLK_FREQUENCY_4_3MHZ;
em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk); em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk);
dev->sensor_xtal = 4300000; v4l2->sensor_xtal = 4300000;
pdata.xtal = dev->sensor_xtal; pdata.xtal = v4l2->sensor_xtal;
if (NULL == if (NULL ==
v4l2_i2c_new_subdev_board(&dev->v4l2->v4l2_dev, adap, v4l2_i2c_new_subdev_board(&dev->v4l2->v4l2_dev, adap,
&mt9v011_info, NULL)) { &mt9v011_info, NULL)) {
...@@ -378,8 +378,8 @@ int em28xx_init_camera(struct em28xx *dev) ...@@ -378,8 +378,8 @@ int em28xx_init_camera(struct em28xx *dev)
break; break;
} }
case EM28XX_MT9M001: case EM28XX_MT9M001:
dev->sensor_xres = 1280; v4l2->sensor_xres = 1280;
dev->sensor_yres = 1024; v4l2->sensor_yres = 1024;
em28xx_initialize_mt9m001(dev); em28xx_initialize_mt9m001(dev);
...@@ -389,8 +389,8 @@ int em28xx_init_camera(struct em28xx *dev) ...@@ -389,8 +389,8 @@ int em28xx_init_camera(struct em28xx *dev)
break; break;
case EM28XX_MT9M111: case EM28XX_MT9M111:
dev->sensor_xres = 640; v4l2->sensor_xres = 640;
dev->sensor_yres = 512; v4l2->sensor_yres = 512;
dev->board.xclk = EM28XX_XCLK_FREQUENCY_48MHZ; dev->board.xclk = EM28XX_XCLK_FREQUENCY_48MHZ;
em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk); em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk);
...@@ -419,8 +419,8 @@ int em28xx_init_camera(struct em28xx *dev) ...@@ -419,8 +419,8 @@ int em28xx_init_camera(struct em28xx *dev)
* - adjust bridge xclk * - adjust bridge xclk
* - disable 16 bit (12 bit) output formats on high resolutions * - disable 16 bit (12 bit) output formats on high resolutions
*/ */
dev->sensor_xres = 640; v4l2->sensor_xres = 640;
dev->sensor_yres = 480; v4l2->sensor_yres = 480;
subdev = subdev =
v4l2_i2c_new_subdev_board(&dev->v4l2->v4l2_dev, adap, v4l2_i2c_new_subdev_board(&dev->v4l2->v4l2_dev, adap,
......
...@@ -144,8 +144,10 @@ static struct em28xx_fmt format[] = { ...@@ -144,8 +144,10 @@ static struct em28xx_fmt format[] = {
/*FIXME: maxw should be dependent of alt mode */ /*FIXME: maxw should be dependent of alt mode */
static inline unsigned int norm_maxw(struct em28xx *dev) static inline unsigned int norm_maxw(struct em28xx *dev)
{ {
struct em28xx_v4l2 *v4l2 = dev->v4l2;
if (dev->board.is_webcam) if (dev->board.is_webcam)
return dev->sensor_xres; return v4l2->sensor_xres;
if (dev->board.max_range_640_480) if (dev->board.max_range_640_480)
return 640; return 640;
...@@ -158,7 +160,7 @@ static inline unsigned int norm_maxh(struct em28xx *dev) ...@@ -158,7 +160,7 @@ static inline unsigned int norm_maxh(struct em28xx *dev)
struct em28xx_v4l2 *v4l2 = dev->v4l2; struct em28xx_v4l2 *v4l2 = dev->v4l2;
if (dev->board.is_webcam) if (dev->board.is_webcam)
return dev->sensor_yres; return v4l2->sensor_yres;
if (dev->board.max_range_640_480) if (dev->board.max_range_640_480)
return 480; return 480;
......
...@@ -519,6 +519,11 @@ struct em28xx_v4l2 { ...@@ -519,6 +519,11 @@ struct em28xx_v4l2 {
u8 vinmode; u8 vinmode;
u8 vinctl; u8 vinctl;
/* Camera specific fields */
int sensor_xres;
int sensor_yres;
int sensor_xtal;
struct em28xx_fmt *format; struct em28xx_fmt *format;
v4l2_std_id norm; /* selected tv norm */ v4l2_std_id norm; /* selected tv norm */
...@@ -601,10 +606,7 @@ struct em28xx { ...@@ -601,10 +606,7 @@ struct em28xx {
struct em28xx_board board; struct em28xx_board board;
/* Webcam specific fields */ enum em28xx_sensor em28xx_sensor; /* camera specific */
enum em28xx_sensor em28xx_sensor;
int sensor_xres, sensor_yres;
int sensor_xtal;
/* Controls audio streaming */ /* Controls audio streaming */
struct work_struct wq_trigger; /* Trigger to start/stop audio for alsa module */ struct work_struct wq_trigger; /* Trigger to start/stop audio for alsa module */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment