module_param_array(card, int, NULL, 0444);
MODULE_PARM_DESC(card, "card type");
-#define MT9V011_VERSION 0x8243
-
/* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS */
static unsigned long em28xx_devused;
version = be16_to_cpu(version_be);
switch (version) {
- case MT9V011_VERSION:
+ case 0x8243: /* mt9v011 640x480 1.3 Mpix sensor */
dev->model = EM2820_BOARD_SILVERCREST_WEBCAM;
sensor_name = "mt9v011";
dev->em28xx_sensor = EM28XX_MT9V011;
+ dev->sensor_xres = 640;
+ dev->sensor_yres = 480;
break;
default:
printk("Unknown Micron Sensor 0x%04x\n", be16_to_cpu(version));
u8 mode;
/* the em2800 scaler only supports scaling down to 50% */
- if (dev->board.is_webcam) {
- /* FIXME: Don't use the scaler yet */
- mode = 0;
- } else if (dev->board.is_em2800) {
+ if (dev->board.is_em2800) {
mode = (v ? 0x20 : 0x00) | (h ? 0x10 : 0x00);
} else {
u8 buf[2];
unsigned int width, unsigned int height,
unsigned int *hscale, unsigned int *vscale)
{
- unsigned int maxw = norm_maxw(dev);
- unsigned int maxh = norm_maxh(dev);
+ unsigned int maxw = norm_maxw(dev);
+ unsigned int maxh = norm_maxh(dev);
*hscale = (((unsigned long)maxw) << 12) / width - 4096L;
if (*hscale >= 0x4000)
return -EINVAL;
}
- if (dev->board.is_webcam) {
- /* FIXME: This is the only supported fmt */
- width = 640;
- height = 480;
- } else if (dev->board.is_em2800) {
+ if (dev->board.is_em2800) {
/* the em2800 can only scale down to 50% */
height = height > (3 * maxh / 4) ? maxh : maxh / 2;
width = width > (3 * maxw / 4) ? maxw : maxw / 2;
{
struct em28xx_fmt *fmt;
- /* FIXME: This is the only supported fmt */
- if (dev->board.is_webcam) {
- width = 640;
- height = 480;
- }
-
fmt = format_by_fourcc(fourcc);
if (!fmt)
return -EINVAL;
struct em28xx_board board;
enum em28xx_sensor em28xx_sensor;
+ int sensor_xres, sensor_yres;
unsigned int stream_on:1; /* Locks streams */
unsigned int has_audio_class:1;
/*FIXME: maxw should be dependent of alt mode */
static inline unsigned int norm_maxw(struct em28xx *dev)
{
+ if (dev->board.is_webcam)
+ return dev->sensor_xres;
+
if (dev->board.max_range_640_480)
return 640;
- else
- return 720;
+
+ return 720;
}
static inline unsigned int norm_maxh(struct em28xx *dev)
{
+ if (dev->board.is_webcam)
+ return dev->sensor_yres;
+
if (dev->board.max_range_640_480)
return 480;
- else
- return (dev->norm & V4L2_STD_625_50) ? 576 : 480;
+
+ return (dev->norm & V4L2_STD_625_50) ? 576 : 480;
}
#endif