Skip to content

Commit

Permalink
[media] go7007: switch to standard tuner/i2c subdevs
Browse files Browse the repository at this point in the history
Instead of using the wis-* drivers we now use the standard 'proper' subdev
drivers.
The board configuration tables now also list the possible audio inputs,
this will be used later to implement audio inputs.
Special mention deserves a little change in set_capture_size() where the
height passed to s_mbus_fmt is doubled: that is because the saa7115 driver
expects to see the frame height, not the field height as the wis_saa7115
driver did.
Another change is that the tuner input is moved from last to the first
input, which is consistent with the common practice in other video drivers.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Mar 24, 2013
1 parent dcafb6d commit 3acd16a
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 134 deletions.
77 changes: 6 additions & 71 deletions drivers/staging/media/go7007/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ config VIDEO_GO7007
select VIDEO_TVEEPROM
select SND_PCM
select CRC32
select VIDEO_SONY_BTF_MPX if MEDIA_SUBDRV_AUTOSELECT
select VIDEO_SAA711X if MEDIA_SUBDRV_AUTOSELECT
select VIDEO_TW2804 if MEDIA_SUBDRV_AUTOSELECT
select VIDEO_TW9903 if MEDIA_SUBDRV_AUTOSELECT
select VIDEO_OV7640 if MEDIA_SUBDRV_AUTOSELECT
select VIDEO_UDA1342 if MEDIA_SUBDRV_AUTOSELECT
default N
---help---
This is a video4linux driver for the WIS GO7007 MPEG
Expand Down Expand Up @@ -36,74 +42,3 @@ config VIDEO_GO7007_USB_S2250_BOARD

To compile this driver as a module, choose M here: the
module will be called s2250

config VIDEO_GO7007_OV7640
tristate "OV7640 subdev support"
depends on VIDEO_GO7007
default N
---help---
This is a video4linux driver for the OV7640 sub-device.

To compile this driver as a module, choose M here: the
module will be called wis-ov7640

config VIDEO_GO7007_SAA7113
tristate "SAA7113 subdev support"
depends on VIDEO_GO7007
default N
---help---
This is a video4linux driver for the SAA7113 sub-device.

To compile this driver as a module, choose M here: the
module will be called wis-saa7113

config VIDEO_GO7007_SAA7115
tristate "SAA7115 subdev support"
depends on VIDEO_GO7007
default N
---help---
This is a video4linux driver for the SAA7115 sub-device.

To compile this driver as a module, choose M here: the
module will be called wis-saa7115

config VIDEO_GO7007_TW9903
tristate "TW9903 subdev support"
depends on VIDEO_GO7007
default N
---help---
This is a video4linux driver for the TW9903 sub-device.

To compile this driver as a module, choose M here: the
module will be called wis-tw9903

config VIDEO_GO7007_UDA1342
tristate "UDA1342 subdev support"
depends on VIDEO_GO7007
default N
---help---
This is a video4linux driver for the UDA1342 sub-device.

To compile this driver as a module, choose M here: the
module will be called wis-uda1342

config VIDEO_GO7007_SONY_TUNER
tristate "Sony tuner subdev support"
depends on VIDEO_GO7007
default N
---help---
This is a video4linux driver for the Sony Tuner sub-device.

To compile this driver as a module, choose M here: the
module will be called wis-sony-tuner

config VIDEO_GO7007_TW2804
tristate "TW2804 subdev support"
depends on VIDEO_GO7007
default N
---help---
This is a video4linux driver for the TW2804 sub-device.

To compile this driver as a module, choose M here: the
module will be called wis-tw2804

12 changes: 0 additions & 12 deletions drivers/staging/media/go7007/Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
#obj-m += go7007.o go7007-usb.o snd-go7007.o wis-saa7115.o wis-tw9903.o \
wis-uda1342.o wis-sony-tuner.o wis-saa7113.o wis-ov7640.o \
wis-tw2804.o


obj-$(CONFIG_VIDEO_GO7007) += go7007.o
obj-$(CONFIG_VIDEO_GO7007_USB) += go7007-usb.o
obj-$(CONFIG_VIDEO_GO7007_USB_S2250_BOARD) += s2250.o s2250-loader.o
obj-$(CONFIG_VIDEO_GO7007_SAA7113) += wis-saa7113.o
obj-$(CONFIG_VIDEO_GO7007_OV7640) += wis-ov7640.o
obj-$(CONFIG_VIDEO_GO7007_SAA7115) += wis-saa7115.o
obj-$(CONFIG_VIDEO_GO7007_TW9903) += wis-tw9903.o
obj-$(CONFIG_VIDEO_GO7007_UDA1342) += wis-uda1342.o
obj-$(CONFIG_VIDEO_GO7007_SONY_TUNER) += wis-sony-tuner.o
obj-$(CONFIG_VIDEO_GO7007_TW2804) += wis-tw2804.o

go7007-y := go7007-v4l2.o go7007-driver.o go7007-i2c.o go7007-fw.o \
snd-go7007.o
Expand Down
29 changes: 23 additions & 6 deletions drivers/staging/media/go7007/go7007-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <media/v4l2-common.h>

#include "go7007-priv.h"
#include "wis-i2c.h"

/*
* Wait for an interrupt to be delivered from the GO7007SB and return
Expand Down Expand Up @@ -200,15 +199,22 @@ static int init_i2c_module(struct i2c_adapter *adapter, const struct go_i2c *con
{
struct go7007 *go = i2c_get_adapdata(adapter);
struct v4l2_device *v4l2_dev = &go->v4l2_dev;
struct v4l2_subdev *sd;
struct i2c_board_info info;

memset(&info, 0, sizeof(info));
strlcpy(info.type, i2c->type, sizeof(info.type));
info.addr = i2c->addr;
info.flags = i2c->flags;

if (v4l2_i2c_new_subdev_board(v4l2_dev, adapter, &info, NULL))
sd = v4l2_i2c_new_subdev_board(v4l2_dev, adapter, &info, NULL);
if (sd) {
if (i2c->is_video)
go->sd_video = sd;
if (i2c->is_audio)
go->sd_audio = sd;
return 0;
}

printk(KERN_INFO "go7007: probing for module i2c:%s failed\n", i2c->type);
return -EINVAL;
Expand All @@ -222,7 +228,7 @@ static int init_i2c_module(struct i2c_adapter *adapter, const struct go_i2c *con
*
* Must NOT be called with the hw_lock held.
*/
int go7007_register_encoder(struct go7007 *go)
int go7007_register_encoder(struct go7007 *go, unsigned num_i2c_devs)
{
int i, ret;

Expand All @@ -246,11 +252,22 @@ int go7007_register_encoder(struct go7007 *go)
go->i2c_adapter_online = 1;
}
if (go->i2c_adapter_online) {
for (i = 0; i < go->board_info->num_i2c_devs; ++i)
for (i = 0; i < num_i2c_devs; ++i)
init_i2c_module(&go->i2c_adapter, &go->board_info->i2c_devs[i]);

if (go->tuner_type >= 0) {
struct tuner_setup setup = {
.addr = ADDR_UNSET,
.type = go->tuner_type,
.mode_mask = T_ANALOG_TV,
};

v4l2_device_call_all(&go->v4l2_dev, 0, tuner,
s_type_addr, &setup);
}
if (go->board_id == GO7007_BOARDID_ADLINK_MPG24)
i2c_clients_command(&go->i2c_adapter,
DECODER_SET_CHANNEL, &go->channel_number);
v4l2_subdev_call(go->sd_video, video, s_routing,
0, 0, go->channel_number + 1);
}
if (go->board_info->flags & GO7007_BOARD_HAS_AUDIO) {
go->audio_enabled = 1;
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/media/go7007/go7007-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <linux/uaccess.h>

#include "go7007-priv.h"
#include "wis-i2c.h"

/********************* Driver for on-board I2C adapter *********************/

Expand Down
18 changes: 14 additions & 4 deletions drivers/staging/media/go7007/go7007-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,23 @@ struct go7007_board_info {
int num_i2c_devs;
struct go_i2c {
const char *type;
int id;
int is_video:1;
int is_audio:1;
int addr;
u32 flags;
} i2c_devs[4];
} i2c_devs[5];
int num_inputs;
struct {
int video_input;
int audio_input;
int audio_index;
char *name;
} inputs[4];
int video_config;
int num_aud_inputs;
struct {
int audio_input;
char *name;
} aud_inputs[3];
};

struct go7007_hpi_ops {
Expand Down Expand Up @@ -178,9 +185,12 @@ struct go7007 {
int streaming;
int in_use;
int audio_enabled;
struct v4l2_subdev *sd_video;
struct v4l2_subdev *sd_audio;

/* Video input */
int input;
int aud_input;
enum { GO7007_STD_NTSC, GO7007_STD_PAL, GO7007_STD_OTHER } standard;
int sensor_framerate;
int width;
Expand Down Expand Up @@ -268,7 +278,7 @@ int go7007_read_addr(struct go7007 *go, u16 addr, u16 *data);
int go7007_read_interrupt(struct go7007 *go, u16 *value, u16 *data);
int go7007_boot_encoder(struct go7007 *go, int init_i2c);
int go7007_reset_encoder(struct go7007 *go);
int go7007_register_encoder(struct go7007 *go);
int go7007_register_encoder(struct go7007 *go, unsigned num_i2c_devs);
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,
Expand Down
Loading

0 comments on commit 3acd16a

Please sign in to comment.