Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 367177
b: refs/heads/master
c: 7704cfb
h: refs/heads/master
i:
  367175: 3543ac9
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Apr 16, 2013
1 parent 254b461 commit 8009127
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 144 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 988f7b80ab6e541aef5972d347d6cc7d905abd21
refs/heads/master: 7704cfb9cde649d514029a180cdfb7ccf0a36032
128 changes: 6 additions & 122 deletions trunk/drivers/media/pci/cx25821/cx25821-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,134 +1038,18 @@ static long video_ioctl_upstream11(struct file *file, unsigned int cmd,
return 0;
}

static long video_ioctl_set(struct file *file, unsigned int cmd,
unsigned long arg)
{
struct cx25821_channel *chan = video_drvdata(file);
struct cx25821_dev *dev = chan->dev;
struct downstream_user_struct *data_from_user;
int command;
int width = 720;
int selected_channel = 0;
int pix_format = 0;
int i = 0;
int cif_enable = 0;
int cif_width = 0;

data_from_user = (struct downstream_user_struct *)arg;

if (!data_from_user) {
pr_err("%s(): User data is INVALID. Returning\n", __func__);
return 0;
}

command = data_from_user->command;

if (command != SET_VIDEO_STD && command != SET_PIXEL_FORMAT
&& command != ENABLE_CIF_RESOLUTION && command != REG_READ
&& command != REG_WRITE && command != MEDUSA_READ
&& command != MEDUSA_WRITE) {
return 0;
}

switch (command) {
case SET_VIDEO_STD:
if (!strcmp(data_from_user->vid_stdname, "PAL"))
dev->tvnorm = V4L2_STD_PAL_BG;
else
dev->tvnorm = V4L2_STD_NTSC_M;
medusa_set_videostandard(dev);
break;

case SET_PIXEL_FORMAT:
selected_channel = data_from_user->decoder_select;
pix_format = data_from_user->pixel_format;

if (!(selected_channel <= 7 && selected_channel >= 0)) {
selected_channel -= 4;
selected_channel = selected_channel % 8;
}

if (selected_channel >= 0)
cx25821_set_pixel_format(dev, selected_channel,
pix_format);

break;

case ENABLE_CIF_RESOLUTION:
selected_channel = data_from_user->decoder_select;
cif_enable = data_from_user->cif_resolution_enable;
cif_width = data_from_user->cif_width;

if (cif_enable) {
if (dev->tvnorm & V4L2_STD_PAL_BG
|| dev->tvnorm & V4L2_STD_PAL_DK) {
width = 352;
} else {
width = cif_width;
if (cif_width != 320 && cif_width != 352)
width = 320;
}
}

if (!(selected_channel <= 7 && selected_channel >= 0)) {
selected_channel -= 4;
selected_channel = selected_channel % 8;
}

if (selected_channel <= 7 && selected_channel >= 0) {
dev->channels[selected_channel].use_cif_resolution =
cif_enable;
dev->channels[selected_channel].cif_width = width;
} else {
for (i = 0; i < VID_CHANNEL_NUM; i++) {
dev->channels[i].use_cif_resolution =
cif_enable;
dev->channels[i].cif_width = width;
}
}

medusa_set_resolution(dev, width, selected_channel);
break;
case REG_READ:
data_from_user->reg_data = cx_read(data_from_user->reg_address);
break;
case REG_WRITE:
cx_write(data_from_user->reg_address, data_from_user->reg_data);
break;
case MEDUSA_READ:
cx25821_i2c_read(&dev->i2c_bus[0],
(u16) data_from_user->reg_address,
&data_from_user->reg_data);
break;
case MEDUSA_WRITE:
cx25821_i2c_write(&dev->i2c_bus[0],
(u16) data_from_user->reg_address,
data_from_user->reg_data);
break;
}

return 0;
}

static long cx25821_video_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
struct cx25821_channel *chan = video_drvdata(file);
int ret = 0;

/* check to see if it's the video upstream */
if (chan->id == SRAM_CH09) {
ret = video_ioctl_upstream9(file, cmd, arg);
return ret;
} else if (chan->id == SRAM_CH10) {
ret = video_ioctl_upstream10(file, cmd, arg);
return ret;
} else if (chan->id == SRAM_CH11) {
ret = video_ioctl_upstream11(file, cmd, arg);
ret = video_ioctl_set(file, cmd, arg);
return ret;
}
if (chan->id == SRAM_CH09)
return video_ioctl_upstream9(file, cmd, arg);
if (chan->id == SRAM_CH10)
return video_ioctl_upstream10(file, cmd, arg);
if (chan->id == SRAM_CH11)
return video_ioctl_upstream11(file, cmd, arg);

return video_ioctl2(file, cmd, arg);
}
Expand Down
8 changes: 0 additions & 8 deletions trunk/drivers/media/pci/cx25821/cx25821-video.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ do { \
#define UPSTREAM_START_AUDIO 702
#define UPSTREAM_STOP_AUDIO 703
#define UPSTREAM_DUMP_REGISTERS 702
#define SET_VIDEO_STD 800
#define SET_PIXEL_FORMAT 1000
#define ENABLE_CIF_RESOLUTION 1001

#define REG_READ 900
#define REG_WRITE 901
#define MEDUSA_READ 910
#define MEDUSA_WRITE 911

#define FORMAT_FLAGS_PACKED 0x01
extern void cx25821_video_wakeup(struct cx25821_dev *dev,
Expand Down
13 changes: 0 additions & 13 deletions trunk/drivers/media/pci/cx25821/cx25821.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,19 +360,6 @@ struct upstream_user_struct {
int command;
};

struct downstream_user_struct {
char *vid_stdname;
int pixel_format;
int cif_resolution_enable;
int cif_width;
int decoder_select;
int command;
int reg_address;
int reg_data;
};

extern struct upstream_user_struct *up_data;

static inline struct cx25821_dev *get_cx25821(struct v4l2_device *v4l2_dev)
{
return container_of(v4l2_dev, struct cx25821_dev, v4l2_dev);
Expand Down

0 comments on commit 8009127

Please sign in to comment.