diff options
Diffstat (limited to 'drivers/media/video/s2255drv.c')
-rw-r--r-- | drivers/media/video/s2255drv.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index c1bef6187661..4894cbb1c547 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c | |||
@@ -134,7 +134,7 @@ | |||
134 | 134 | ||
135 | /* usb config commands */ | 135 | /* usb config commands */ |
136 | #define IN_DATA_TOKEN cpu_to_le32(0x2255c0de) | 136 | #define IN_DATA_TOKEN cpu_to_le32(0x2255c0de) |
137 | #define CMD_2255 cpu_to_le32(0xc2255000) | 137 | #define CMD_2255 0xc2255000 |
138 | #define CMD_SET_MODE cpu_to_le32((CMD_2255 | 0x10)) | 138 | #define CMD_SET_MODE cpu_to_le32((CMD_2255 | 0x10)) |
139 | #define CMD_START cpu_to_le32((CMD_2255 | 0x20)) | 139 | #define CMD_START cpu_to_le32((CMD_2255 | 0x20)) |
140 | #define CMD_STOP cpu_to_le32((CMD_2255 | 0x30)) | 140 | #define CMD_STOP cpu_to_le32((CMD_2255 | 0x30)) |
@@ -852,15 +852,13 @@ static int vidioc_querycap(struct file *file, void *priv, | |||
852 | static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, | 852 | static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, |
853 | struct v4l2_fmtdesc *f) | 853 | struct v4l2_fmtdesc *f) |
854 | { | 854 | { |
855 | int index = 0; | 855 | int index = f->index; |
856 | if (f) | ||
857 | index = f->index; | ||
858 | 856 | ||
859 | if (index >= ARRAY_SIZE(formats)) | 857 | if (index >= ARRAY_SIZE(formats)) |
860 | return -EINVAL; | 858 | return -EINVAL; |
861 | if (!jpeg_enable && ((formats[index].fourcc == V4L2_PIX_FMT_JPEG) || | 859 | if (!jpeg_enable && ((formats[index].fourcc == V4L2_PIX_FMT_JPEG) || |
862 | (formats[index].fourcc == V4L2_PIX_FMT_MJPEG))) | 860 | (formats[index].fourcc == V4L2_PIX_FMT_MJPEG))) |
863 | return -EINVAL; | 861 | return -EINVAL; |
864 | dprintk(4, "name %s\n", formats[index].name); | 862 | dprintk(4, "name %s\n", formats[index].name); |
865 | strlcpy(f->description, formats[index].name, sizeof(f->description)); | 863 | strlcpy(f->description, formats[index].name, sizeof(f->description)); |
866 | f->pixelformat = formats[index].fourcc; | 864 | f->pixelformat = formats[index].fourcc; |
@@ -2027,7 +2025,7 @@ static int save_frame(struct s2255_dev *dev, struct s2255_pipeinfo *pipe_info) | |||
2027 | pdata[1]); | 2025 | pdata[1]); |
2028 | offset = jj + PREFIX_SIZE; | 2026 | offset = jj + PREFIX_SIZE; |
2029 | bframe = 1; | 2027 | bframe = 1; |
2030 | cc = pdword[1]; | 2028 | cc = le32_to_cpu(pdword[1]); |
2031 | if (cc >= MAX_CHANNELS) { | 2029 | if (cc >= MAX_CHANNELS) { |
2032 | printk(KERN_ERR | 2030 | printk(KERN_ERR |
2033 | "bad channel\n"); | 2031 | "bad channel\n"); |
@@ -2036,22 +2034,22 @@ static int save_frame(struct s2255_dev *dev, struct s2255_pipeinfo *pipe_info) | |||
2036 | /* reverse it */ | 2034 | /* reverse it */ |
2037 | dev->cc = G_chnmap[cc]; | 2035 | dev->cc = G_chnmap[cc]; |
2038 | channel = &dev->channel[dev->cc]; | 2036 | channel = &dev->channel[dev->cc]; |
2039 | payload = pdword[3]; | 2037 | payload = le32_to_cpu(pdword[3]); |
2040 | if (payload > channel->req_image_size) { | 2038 | if (payload > channel->req_image_size) { |
2041 | channel->bad_payload++; | 2039 | channel->bad_payload++; |
2042 | /* discard the bad frame */ | 2040 | /* discard the bad frame */ |
2043 | return -EINVAL; | 2041 | return -EINVAL; |
2044 | } | 2042 | } |
2045 | channel->pkt_size = payload; | 2043 | channel->pkt_size = payload; |
2046 | channel->jpg_size = pdword[4]; | 2044 | channel->jpg_size = le32_to_cpu(pdword[4]); |
2047 | break; | 2045 | break; |
2048 | case S2255_MARKER_RESPONSE: | 2046 | case S2255_MARKER_RESPONSE: |
2049 | 2047 | ||
2050 | pdata += DEF_USB_BLOCK; | 2048 | pdata += DEF_USB_BLOCK; |
2051 | jj += DEF_USB_BLOCK; | 2049 | jj += DEF_USB_BLOCK; |
2052 | if (pdword[1] >= MAX_CHANNELS) | 2050 | if (le32_to_cpu(pdword[1]) >= MAX_CHANNELS) |
2053 | break; | 2051 | break; |
2054 | cc = G_chnmap[pdword[1]]; | 2052 | cc = G_chnmap[le32_to_cpu(pdword[1])]; |
2055 | if (cc >= MAX_CHANNELS) | 2053 | if (cc >= MAX_CHANNELS) |
2056 | break; | 2054 | break; |
2057 | channel = &dev->channel[cc]; | 2055 | channel = &dev->channel[cc]; |
@@ -2074,11 +2072,11 @@ static int save_frame(struct s2255_dev *dev, struct s2255_pipeinfo *pipe_info) | |||
2074 | wake_up(&dev->fw_data->wait_fw); | 2072 | wake_up(&dev->fw_data->wait_fw); |
2075 | break; | 2073 | break; |
2076 | case S2255_RESPONSE_STATUS: | 2074 | case S2255_RESPONSE_STATUS: |
2077 | channel->vidstatus = pdword[3]; | 2075 | channel->vidstatus = le32_to_cpu(pdword[3]); |
2078 | channel->vidstatus_ready = 1; | 2076 | channel->vidstatus_ready = 1; |
2079 | wake_up(&channel->wait_vidstatus); | 2077 | wake_up(&channel->wait_vidstatus); |
2080 | dprintk(5, "got vidstatus %x chan %d\n", | 2078 | dprintk(5, "got vidstatus %x chan %d\n", |
2081 | pdword[3], cc); | 2079 | le32_to_cpu(pdword[3]), cc); |
2082 | break; | 2080 | break; |
2083 | default: | 2081 | default: |
2084 | printk(KERN_INFO "s2255 unknown resp\n"); | 2082 | printk(KERN_INFO "s2255 unknown resp\n"); |
@@ -2605,10 +2603,11 @@ static int s2255_probe(struct usb_interface *interface, | |||
2605 | __le32 *pRel; | 2603 | __le32 *pRel; |
2606 | pRel = (__le32 *) &dev->fw_data->fw->data[fw_size - 4]; | 2604 | pRel = (__le32 *) &dev->fw_data->fw->data[fw_size - 4]; |
2607 | printk(KERN_INFO "s2255 dsp fw version %x\n", *pRel); | 2605 | printk(KERN_INFO "s2255 dsp fw version %x\n", *pRel); |
2608 | dev->dsp_fw_ver = *pRel; | 2606 | dev->dsp_fw_ver = le32_to_cpu(*pRel); |
2609 | if (*pRel < S2255_CUR_DSP_FWVER) | 2607 | if (dev->dsp_fw_ver < S2255_CUR_DSP_FWVER) |
2610 | printk(KERN_INFO "s2255: f2255usb.bin out of date.\n"); | 2608 | printk(KERN_INFO "s2255: f2255usb.bin out of date.\n"); |
2611 | if (dev->pid == 0x2257 && *pRel < S2255_MIN_DSP_COLORFILTER) | 2609 | if (dev->pid == 0x2257 && |
2610 | dev->dsp_fw_ver < S2255_MIN_DSP_COLORFILTER) | ||
2612 | printk(KERN_WARNING "s2255: 2257 requires firmware %d" | 2611 | printk(KERN_WARNING "s2255: 2257 requires firmware %d" |
2613 | " or above.\n", S2255_MIN_DSP_COLORFILTER); | 2612 | " or above.\n", S2255_MIN_DSP_COLORFILTER); |
2614 | } | 2613 | } |