Commit 50deb749 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] go7007: tuner/std related fixes

- The Adlink is initially detected as a sensor board, so the driver config
  is set up as if it was a sensor. Later the driver discovers that it really
  is a video capture card and that means that the driver configuration has
  to be updated for a PAL/NTSC capture card.
- Setup the correct initial std based on the TV tuner type.
- Remember the exact std the user selected, don't map it to STD_PAL or NTSC.
- Use v4l2_disable_ioctl to disable ioctls based on the board config and
  drop a lot of checking code in each of those ioctls since that is no longer
  needed.
- enum_input should use tvnorms to fill its std field.
- configure the input, std and initial tuner frequency at driver initialization.
- fix std handling in the s2250 driver.
- the code handling scaling for devices without a scaler was broken. This is
  now fixed.
- correctly set readbuffers and capability in g/s_parm.
- remove the bogus test for capturemode in s_parm.
- correctly implement enum_framesizes/intervals.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 59d7b91a
......@@ -650,19 +650,7 @@ struct go7007 *go7007_alloc(struct go7007_board_info *board, struct device *dev)
init_waitqueue_head(&go->interrupt_waitq);
go->in_use = 0;
go->input = 0;
if (board->sensor_flags & GO7007_SENSOR_TV) {
go->standard = GO7007_STD_NTSC;
go->width = 720;
go->height = 480;
go->sensor_framerate = 30000;
} else {
go->standard = GO7007_STD_OTHER;
go->width = board->sensor_width;
go->height = board->sensor_height;
go->sensor_framerate = board->sensor_framerate;
}
go->encoder_v_offset = board->sensor_v_offset;
go->encoder_h_offset = board->sensor_h_offset;
go7007_update_board(go);
go->encoder_h_halve = 0;
go->encoder_v_halve = 0;
go->encoder_subsample = 0;
......@@ -692,4 +680,25 @@ struct go7007 *go7007_alloc(struct go7007_board_info *board, struct device *dev)
}
EXPORT_SYMBOL(go7007_alloc);
void go7007_update_board(struct go7007 *go)
{
struct go7007_board_info *board = go->board_info;
if (board->sensor_flags & GO7007_SENSOR_TV) {
go->standard = GO7007_STD_NTSC;
go->std = V4L2_STD_NTSC_M;
go->width = 720;
go->height = 480;
go->sensor_framerate = 30000;
} else {
go->standard = GO7007_STD_OTHER;
go->width = board->sensor_width;
go->height = board->sensor_height;
go->sensor_framerate = board->sensor_framerate;
}
go->encoder_v_offset = board->sensor_v_offset;
go->encoder_h_offset = board->sensor_h_offset;
}
EXPORT_SYMBOL(go7007_update_board);
MODULE_LICENSE("GPL v2");
......@@ -200,6 +200,7 @@ struct go7007 {
int input;
int aud_input;
enum { GO7007_STD_NTSC, GO7007_STD_PAL, GO7007_STD_OTHER } standard;
v4l2_std_id std;
int sensor_framerate;
int width;
int height;
......@@ -291,6 +292,8 @@ int go7007_start_encoder(struct go7007 *go);
void go7007_parse_video_stream(struct go7007 *go, u8 *buf, int length);
struct go7007 *go7007_alloc(struct go7007_board_info *board,
struct device *dev);
void go7007_update_board(struct go7007 *go);
/* go7007-fw.c */
int go7007_construct_fw_image(struct go7007 *go, u8 **fw, int *fwlen);
......
......@@ -1193,6 +1193,7 @@ static int go7007_usb_probe(struct usb_interface *intf,
"Adlink PCI-MPG24, channel #%d",
channel);
}
go7007_update_board(go);
}
}
......@@ -1209,12 +1210,14 @@ static int go7007_usb_probe(struct usb_interface *intf,
case 1:
go->board_id = GO7007_BOARDID_PX_TV402U_EU;
go->tuner_type = TUNER_SONY_BTF_PG472Z;
go->std = V4L2_STD_PAL;
strncpy(go->name, "Plextor PX-TV402U-EU",
sizeof(go->name));
break;
case 2:
go->board_id = GO7007_BOARDID_PX_TV402U_JP;
go->tuner_type = TUNER_SONY_BTF_PK467Z;
go->std = V4L2_STD_NTSC_M_JP;
num_i2c_devs -= 2;
strncpy(go->name, "Plextor PX-TV402U-JP",
sizeof(go->name));
......
This diff is collapsed.
......@@ -354,18 +354,13 @@ static int s2250_s_std(struct v4l2_subdev *sd, v4l2_std_id norm)
u16 vidsource;
vidsource = (state->input == 1) ? 0x040 : 0x020;
switch (norm) {
case V4L2_STD_NTSC:
write_regs_fp(client, vid_regs_fp);
write_reg_fp(client, 0x20, vidsource | 1);
break;
case V4L2_STD_PAL:
if (norm & V4L2_STD_625_50) {
write_regs_fp(client, vid_regs_fp);
write_regs_fp(client, vid_regs_fp_pal);
write_reg_fp(client, 0x20, vidsource);
break;
default:
return -EINVAL;
} else {
write_regs_fp(client, vid_regs_fp);
write_reg_fp(client, 0x20, vidsource | 1);
}
state->std = norm;
return 0;
......
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