1 #include <linux/module.h>
2 #include <linux/kernel.h>
3 #include <linux/sched.h>
4 #include <linux/string.h>
5 #include <linux/timer.h>
6 #include <linux/delay.h>
7 #include <linux/errno.h>
8 #include <linux/slab.h>
9 #include <linux/poll.h>
10 #include <linux/i2c.h>
11 #include <linux/types.h>
12 #include <linux/videodev2.h>
13 #include <media/v4l2-common.h>
14 #include <linux/init.h>
15 #include <linux/crc32.h>
18 #define MPEG_VIDEO_TARGET_BITRATE_MAX 27000
19 #define MPEG_VIDEO_MAX_BITRATE_MAX 27000
20 #define MPEG_TOTAL_TARGET_BITRATE_MAX 27000
21 #define MPEG_PID_MAX ((1 << 14) - 1)
23 /* Addresses to scan */
24 static unsigned short normal_i2c[] = {0x20, I2C_CLIENT_END};
27 MODULE_DESCRIPTION("device driver for saa6752hs MPEG2 encoder");
28 MODULE_AUTHOR("Andrew de Quincey");
29 MODULE_LICENSE("GPL");
31 static struct i2c_driver driver;
32 static struct i2c_client client_template;
34 enum saa6752hs_videoformat {
35 SAA6752HS_VF_D1 = 0, /* standard D1 video format: 720x576 */
36 SAA6752HS_VF_2_3_D1 = 1,/* 2/3D1 video format: 480x576 */
37 SAA6752HS_VF_1_2_D1 = 2,/* 1/2D1 video format: 352x576 */
38 SAA6752HS_VF_SIF = 3, /* SIF video format: 352x288 */
42 struct saa6752hs_mpeg_params {
43 /* transport streams */
50 enum v4l2_mpeg_audio_l2_bitrate au_l2_bitrate;
53 enum v4l2_mpeg_video_aspect vi_aspect;
54 enum v4l2_mpeg_video_bitrate_mode vi_bitrate_mode;
56 __u32 vi_bitrate_peak;
59 static const struct v4l2_format v4l2_format_table[] =
62 { .fmt = { .pix = { .width = 720, .height = 576 }}},
63 [SAA6752HS_VF_2_3_D1] =
64 { .fmt = { .pix = { .width = 480, .height = 576 }}},
65 [SAA6752HS_VF_1_2_D1] =
66 { .fmt = { .pix = { .width = 352, .height = 576 }}},
68 { .fmt = { .pix = { .width = 352, .height = 288 }}},
69 [SAA6752HS_VF_UNKNOWN] =
70 { .fmt = { .pix = { .width = 0, .height = 0}}},
73 struct saa6752hs_state {
74 struct i2c_client client;
75 struct v4l2_mpeg_compression old_params;
76 struct saa6752hs_mpeg_params params;
77 enum saa6752hs_videoformat video_format;
81 enum saa6752hs_command {
82 SAA6752HS_COMMAND_RESET = 0,
83 SAA6752HS_COMMAND_STOP = 1,
84 SAA6752HS_COMMAND_START = 2,
85 SAA6752HS_COMMAND_PAUSE = 3,
86 SAA6752HS_COMMAND_RECONFIGURE = 4,
87 SAA6752HS_COMMAND_SLEEP = 5,
88 SAA6752HS_COMMAND_RECONFIGURE_FORCE = 6,
93 /* ---------------------------------------------------------------------- */
96 0xc2, /* i2c register */
97 0x00, /* table number for encoder */
100 0x40, 0x00, /* transport_error_indicator(0), payload_unit_start(1), transport_priority(0), pid(0) */
101 0x10, /* transport_scrambling_control(00), adaptation_field_control(01), continuity_counter(0) */
103 0x00, /* PSI pointer to start of table */
106 0xb0, 0x0d, /* section_syntax_indicator(1), section_length(13) */
108 0x00, 0x01, /* transport_stream_id(1) */
110 0xc1, /* version_number(0), current_next_indicator(1) */
112 0x00, 0x00, /* section_number(0), last_section_number(0) */
114 0x00, 0x01, /* program_number(1) */
116 0xe0, 0x00, /* PMT PID */
118 0x00, 0x00, 0x00, 0x00 /* CRC32 */
122 0xc2, /* i2c register */
123 0x01, /* table number for encoder */
126 0x40, 0x00, /* transport_error_indicator(0), payload_unit_start(1), transport_priority(0), pid */
127 0x10, /* transport_scrambling_control(00), adaptation_field_control(01), continuity_counter(0) */
129 0x00, /* PSI pointer to start of table */
132 0xb0, 0x17, /* section_syntax_indicator(1), section_length(23) */
134 0x00, 0x01, /* program_number(1) */
136 0xc1, /* version_number(0), current_next_indicator(1) */
138 0x00, 0x00, /* section_number(0), last_section_number(0) */
140 0xe0, 0x00, /* PCR_PID */
142 0xf0, 0x00, /* program_info_length(0) */
144 0x02, 0xe0, 0x00, 0xf0, 0x00, /* video stream type(2), pid */
145 0x04, 0xe0, 0x00, 0xf0, 0x00, /* audio stream type(4), pid */
147 0x00, 0x00, 0x00, 0x00 /* CRC32 */
150 static struct saa6752hs_mpeg_params param_defaults =
157 .vi_aspect = V4L2_MPEG_VIDEO_ASPECT_4x3,
159 .vi_bitrate_peak = 6000,
160 .vi_bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR,
162 .au_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_256K,
165 static struct v4l2_mpeg_compression old_param_defaults =
167 .st_type = V4L2_MPEG_TS_2,
169 .mode = V4L2_BITRATE_CBR,
178 .vi_type = V4L2_MPEG_VI_2,
179 .vi_aspect_ratio = V4L2_MPEG_ASPECT_4_3,
181 .mode = V4L2_BITRATE_VBR,
186 .au_type = V4L2_MPEG_AU_2_II,
188 .mode = V4L2_BITRATE_CBR,
194 /* ---------------------------------------------------------------------- */
196 static int saa6752hs_chip_command(struct i2c_client* client,
197 enum saa6752hs_command command)
199 unsigned char buf[3];
200 unsigned long timeout;
203 /* execute the command */
205 case SAA6752HS_COMMAND_RESET:
209 case SAA6752HS_COMMAND_STOP:
213 case SAA6752HS_COMMAND_START:
217 case SAA6752HS_COMMAND_PAUSE:
221 case SAA6752HS_COMMAND_RECONFIGURE:
225 case SAA6752HS_COMMAND_SLEEP:
229 case SAA6752HS_COMMAND_RECONFIGURE_FORCE:
237 /* set it and wait for it to be so */
238 i2c_master_send(client, buf, 1);
239 timeout = jiffies + HZ * 3;
241 /* get the current status */
243 i2c_master_send(client, buf, 1);
244 i2c_master_recv(client, buf, 1);
246 if (!(buf[0] & 0x20))
248 if (time_after(jiffies,timeout)) {
256 /* delay a bit to let encoder settle */
263 static int saa6752hs_set_bitrate(struct i2c_client* client,
264 struct v4l2_mpeg_compression* params)
268 /* set the bitrate mode */
270 buf[1] = (params->vi_bitrate.mode == V4L2_BITRATE_VBR) ? 0 : 1;
271 i2c_master_send(client, buf, 2);
273 /* set the video bitrate */
274 if (params->vi_bitrate.mode == V4L2_BITRATE_VBR) {
275 /* set the target bitrate */
277 buf[1] = params->vi_bitrate.target >> 8;
278 buf[2] = params->vi_bitrate.target & 0xff;
279 i2c_master_send(client, buf, 3);
281 /* set the max bitrate */
283 buf[1] = params->vi_bitrate.max >> 8;
284 buf[2] = params->vi_bitrate.max & 0xff;
285 i2c_master_send(client, buf, 3);
287 /* set the target bitrate (no max bitrate for CBR) */
289 buf[1] = params->vi_bitrate.target >> 8;
290 buf[2] = params->vi_bitrate.target & 0xff;
291 i2c_master_send(client, buf, 3);
294 /* set the audio bitrate */
296 buf[1] = (256 == params->au_bitrate.target) ? 0 : 1;
297 i2c_master_send(client, buf, 2);
299 /* set the total bitrate */
301 buf[1] = params->st_bitrate.target >> 8;
302 buf[2] = params->st_bitrate.target & 0xff;
303 i2c_master_send(client, buf, 3);
308 static void saa6752hs_set_subsampling(struct i2c_client* client,
309 struct v4l2_format* f)
311 struct saa6752hs_state *h = i2c_get_clientdata(client);
312 int dist_352, dist_480, dist_720;
315 FIXME: translate and round width/height into EMPRESS
319 ---------------------------
320 SIF | 352x288 | 352x240
321 1/2 D1 | 352x576 | 352x480
322 2/3 D1 | 480x576 | 480x480
323 D1 | 720x576 | 720x480
326 dist_352 = abs(f->fmt.pix.width - 352);
327 dist_480 = abs(f->fmt.pix.width - 480);
328 dist_720 = abs(f->fmt.pix.width - 720);
329 if (dist_720 < dist_480) {
330 f->fmt.pix.width = 720;
331 f->fmt.pix.height = 576;
332 h->video_format = SAA6752HS_VF_D1;
334 else if (dist_480 < dist_352) {
335 f->fmt.pix.width = 480;
336 f->fmt.pix.height = 576;
337 h->video_format = SAA6752HS_VF_2_3_D1;
340 f->fmt.pix.width = 352;
341 if (abs(f->fmt.pix.height - 576) <
342 abs(f->fmt.pix.height - 288)) {
343 f->fmt.pix.height = 576;
344 h->video_format = SAA6752HS_VF_1_2_D1;
347 f->fmt.pix.height = 288;
348 h->video_format = SAA6752HS_VF_SIF;
354 static void saa6752hs_old_set_params(struct i2c_client* client,
355 struct v4l2_mpeg_compression* params)
357 struct saa6752hs_state *h = i2c_get_clientdata(client);
360 if (params->ts_pid_pmt <= MPEG_PID_MAX) {
361 h->old_params.ts_pid_pmt = params->ts_pid_pmt;
362 h->params.ts_pid_pmt = params->ts_pid_pmt;
364 if (params->ts_pid_pcr <= MPEG_PID_MAX) {
365 h->old_params.ts_pid_pcr = params->ts_pid_pcr;
366 h->params.ts_pid_pcr = params->ts_pid_pcr;
368 if (params->ts_pid_video <= MPEG_PID_MAX) {
369 h->old_params.ts_pid_video = params->ts_pid_video;
370 h->params.ts_pid_video = params->ts_pid_video;
372 if (params->ts_pid_audio <= MPEG_PID_MAX) {
373 h->old_params.ts_pid_audio = params->ts_pid_audio;
374 h->params.ts_pid_audio = params->ts_pid_audio;
377 /* check bitrate parameters */
378 if ((params->vi_bitrate.mode == V4L2_BITRATE_CBR) ||
379 (params->vi_bitrate.mode == V4L2_BITRATE_VBR)) {
380 h->old_params.vi_bitrate.mode = params->vi_bitrate.mode;
381 h->params.vi_bitrate_mode = (params->vi_bitrate.mode == V4L2_BITRATE_VBR) ?
382 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR : V4L2_MPEG_VIDEO_BITRATE_MODE_CBR;
384 if (params->vi_bitrate.mode != V4L2_BITRATE_NONE)
385 h->old_params.st_bitrate.target = params->st_bitrate.target;
386 if (params->vi_bitrate.mode != V4L2_BITRATE_NONE)
387 h->old_params.vi_bitrate.target = params->vi_bitrate.target;
388 if (params->vi_bitrate.mode == V4L2_BITRATE_VBR)
389 h->old_params.vi_bitrate.max = params->vi_bitrate.max;
390 if (params->au_bitrate.mode != V4L2_BITRATE_NONE)
391 h->old_params.au_bitrate.target = params->au_bitrate.target;
394 if (params->vi_aspect_ratio == V4L2_MPEG_ASPECT_4_3 ||
395 params->vi_aspect_ratio == V4L2_MPEG_ASPECT_16_9) {
396 h->old_params.vi_aspect_ratio = params->vi_aspect_ratio;
397 if (params->vi_aspect_ratio == V4L2_MPEG_ASPECT_4_3)
398 h->params.vi_aspect = V4L2_MPEG_VIDEO_ASPECT_4x3;
400 h->params.vi_aspect = V4L2_MPEG_VIDEO_ASPECT_16x9;
404 if (h->old_params.st_bitrate.target > MPEG_TOTAL_TARGET_BITRATE_MAX)
405 h->old_params.st_bitrate.target = MPEG_TOTAL_TARGET_BITRATE_MAX;
406 if (h->old_params.vi_bitrate.target > MPEG_VIDEO_TARGET_BITRATE_MAX)
407 h->old_params.vi_bitrate.target = MPEG_VIDEO_TARGET_BITRATE_MAX;
408 if (h->old_params.vi_bitrate.max > MPEG_VIDEO_MAX_BITRATE_MAX)
409 h->old_params.vi_bitrate.max = MPEG_VIDEO_MAX_BITRATE_MAX;
410 h->params.vi_bitrate = params->vi_bitrate.target;
411 h->params.vi_bitrate_peak = params->vi_bitrate.max;
412 if (h->old_params.au_bitrate.target <= 256) {
413 h->old_params.au_bitrate.target = 256;
414 h->params.au_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_256K;
417 h->old_params.au_bitrate.target = 384;
418 h->params.au_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_384K;
422 static int handle_ctrl(struct saa6752hs_mpeg_params *params,
423 struct v4l2_ext_control *ctrl, int cmd)
426 int set = cmd == VIDIOC_S_EXT_CTRLS;
430 case V4L2_CID_MPEG_STREAM_TYPE:
431 old = V4L2_MPEG_STREAM_TYPE_MPEG2_TS;
432 if (set && new != old)
436 case V4L2_CID_MPEG_STREAM_PID_PMT:
437 old = params->ts_pid_pmt;
438 if (set && new > MPEG_PID_MAX)
440 if (new > MPEG_PID_MAX)
442 params->ts_pid_pmt = new;
444 case V4L2_CID_MPEG_STREAM_PID_AUDIO:
445 old = params->ts_pid_audio;
446 if (set && new > MPEG_PID_MAX)
448 if (new > MPEG_PID_MAX)
450 params->ts_pid_audio = new;
452 case V4L2_CID_MPEG_STREAM_PID_VIDEO:
453 old = params->ts_pid_video;
454 if (set && new > MPEG_PID_MAX)
456 if (new > MPEG_PID_MAX)
458 params->ts_pid_video = new;
460 case V4L2_CID_MPEG_STREAM_PID_PCR:
461 old = params->ts_pid_pcr;
462 if (set && new > MPEG_PID_MAX)
464 if (new > MPEG_PID_MAX)
466 params->ts_pid_pcr = new;
468 case V4L2_CID_MPEG_AUDIO_ENCODING:
469 old = V4L2_MPEG_AUDIO_ENCODING_LAYER_2;
470 if (set && new != old)
474 case V4L2_CID_MPEG_AUDIO_L2_BITRATE:
475 old = params->au_l2_bitrate;
476 if (set && new != V4L2_MPEG_AUDIO_L2_BITRATE_256K &&
477 new != V4L2_MPEG_AUDIO_L2_BITRATE_384K)
479 if (new <= V4L2_MPEG_AUDIO_L2_BITRATE_256K)
480 new = V4L2_MPEG_AUDIO_L2_BITRATE_256K;
482 new = V4L2_MPEG_AUDIO_L2_BITRATE_384K;
483 params->au_l2_bitrate = new;
485 case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
486 old = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000;
487 if (set && new != old)
491 case V4L2_CID_MPEG_VIDEO_ENCODING:
492 old = V4L2_MPEG_VIDEO_ENCODING_MPEG_2;
493 if (set && new != old)
497 case V4L2_CID_MPEG_VIDEO_ASPECT:
498 old = params->vi_aspect;
499 if (set && new != V4L2_MPEG_VIDEO_ASPECT_16x9 &&
500 new != V4L2_MPEG_VIDEO_ASPECT_4x3)
502 if (new != V4L2_MPEG_VIDEO_ASPECT_16x9)
503 new = V4L2_MPEG_VIDEO_ASPECT_4x3;
504 params->vi_aspect = new;
506 case V4L2_CID_MPEG_VIDEO_BITRATE:
507 old = params->vi_bitrate * 1000;
508 new = 1000 * (new / 1000);
509 if (set && new > MPEG_VIDEO_TARGET_BITRATE_MAX * 1000)
511 if (new > MPEG_VIDEO_TARGET_BITRATE_MAX * 1000)
512 new = MPEG_VIDEO_TARGET_BITRATE_MAX * 1000;
513 params->vi_bitrate = new / 1000;
515 case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK:
516 old = params->vi_bitrate_peak * 1000;
517 new = 1000 * (new / 1000);
518 if (set && new > MPEG_VIDEO_TARGET_BITRATE_MAX * 1000)
520 if (new > MPEG_VIDEO_TARGET_BITRATE_MAX * 1000)
521 new = MPEG_VIDEO_TARGET_BITRATE_MAX * 1000;
522 params->vi_bitrate_peak = new / 1000;
524 case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
525 old = params->vi_bitrate_mode;
526 params->vi_bitrate_mode = new;
531 if (cmd == VIDIOC_G_EXT_CTRLS)
538 static int saa6752hs_init(struct i2c_client* client)
540 unsigned char buf[9], buf2[4];
541 struct saa6752hs_state *h;
543 unsigned char localPAT[256];
544 unsigned char localPMT[256];
546 h = i2c_get_clientdata(client);
548 /* Set video format - must be done first as it resets other settings */
550 buf[1] = h->video_format;
551 i2c_master_send(client, buf, 2);
553 /* Set number of lines in input signal */
556 if (h->standard & V4L2_STD_525_60)
558 i2c_master_send(client, buf, 2);
561 saa6752hs_set_bitrate(client, &h->params);
563 /* Set GOP structure {3, 13} */
567 i2c_master_send(client,buf,3);
569 /* Set minimum Q-scale {4} */
572 i2c_master_send(client,buf,2);
574 /* Set maximum Q-scale {12} */
577 i2c_master_send(client,buf,2);
579 /* Set Output Protocol */
582 i2c_master_send(client,buf,2);
584 /* Set video output stream format {TS} */
587 i2c_master_send(client,buf,2);
590 memcpy(localPAT, PAT, sizeof(PAT));
591 localPAT[17] = 0xe0 | ((h->params.ts_pid_pmt >> 8) & 0x0f);
592 localPAT[18] = h->params.ts_pid_pmt & 0xff;
593 crc = crc32_be(~0, &localPAT[7], sizeof(PAT) - 7 - 4);
594 localPAT[sizeof(PAT) - 4] = (crc >> 24) & 0xFF;
595 localPAT[sizeof(PAT) - 3] = (crc >> 16) & 0xFF;
596 localPAT[sizeof(PAT) - 2] = (crc >> 8) & 0xFF;
597 localPAT[sizeof(PAT) - 1] = crc & 0xFF;
600 memcpy(localPMT, PMT, sizeof(PMT));
601 localPMT[3] = 0x40 | ((h->params.ts_pid_pmt >> 8) & 0x0f);
602 localPMT[4] = h->params.ts_pid_pmt & 0xff;
603 localPMT[15] = 0xE0 | ((h->params.ts_pid_pcr >> 8) & 0x0F);
604 localPMT[16] = h->params.ts_pid_pcr & 0xFF;
605 localPMT[20] = 0xE0 | ((h->params.ts_pid_video >> 8) & 0x0F);
606 localPMT[21] = h->params.ts_pid_video & 0xFF;
607 localPMT[25] = 0xE0 | ((h->params.ts_pid_audio >> 8) & 0x0F);
608 localPMT[26] = h->params.ts_pid_audio & 0xFF;
609 crc = crc32_be(~0, &localPMT[7], sizeof(PMT) - 7 - 4);
610 localPMT[sizeof(PMT) - 4] = (crc >> 24) & 0xFF;
611 localPMT[sizeof(PMT) - 3] = (crc >> 16) & 0xFF;
612 localPMT[sizeof(PMT) - 2] = (crc >> 8) & 0xFF;
613 localPMT[sizeof(PMT) - 1] = crc & 0xFF;
617 buf[1] = (h->params.ts_pid_audio >> 8) & 0xFF;
618 buf[2] = h->params.ts_pid_audio & 0xFF;
619 i2c_master_send(client,buf,3);
623 buf[1] = (h->params.ts_pid_video >> 8) & 0xFF;
624 buf[2] = h->params.ts_pid_video & 0xFF;
625 i2c_master_send(client,buf,3);
629 buf[1] = (h->params.ts_pid_pcr >> 8) & 0xFF;
630 buf[2] = h->params.ts_pid_pcr & 0xFF;
631 i2c_master_send(client,buf,3);
634 i2c_master_send(client,localPAT,sizeof(PAT));
635 i2c_master_send(client,localPMT,sizeof(PMT));
637 /* mute then unmute audio. This removes buzzing artefacts */
640 i2c_master_send(client, buf, 2);
642 i2c_master_send(client, buf, 2);
645 saa6752hs_chip_command(client, SAA6752HS_COMMAND_START);
647 /* readout current state */
653 i2c_master_send(client, buf, 5);
654 i2c_master_recv(client, buf2, 4);
656 /* change aspect ratio */
663 switch(h->params.vi_aspect) {
664 case V4L2_MPEG_VIDEO_ASPECT_16x9:
665 buf[6] = buf2[1] | 0x40;
667 case V4L2_MPEG_VIDEO_ASPECT_4x3:
669 buf[6] = buf2[1] & 0xBF;
675 i2c_master_send(client, buf, 9);
680 static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind)
682 struct saa6752hs_state *h;
685 if (NULL == (h = kzalloc(sizeof(*h), GFP_KERNEL)))
687 h->client = client_template;
688 h->params = param_defaults;
689 h->old_params = old_param_defaults;
690 h->client.adapter = adap;
691 h->client.addr = addr;
693 /* Assume 625 input lines */
696 i2c_set_clientdata(&h->client, h);
697 i2c_attach_client(&h->client);
699 v4l_info(&h->client,"saa6752hs: chip found @ 0x%x\n", addr<<1);
704 static int saa6752hs_probe(struct i2c_adapter *adap)
706 if (adap->class & I2C_CLASS_TV_ANALOG)
707 return i2c_probe(adap, &addr_data, saa6752hs_attach);
711 static int saa6752hs_detach(struct i2c_client *client)
713 struct saa6752hs_state *h;
715 h = i2c_get_clientdata(client);
716 i2c_detach_client(client);
722 saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg)
724 struct saa6752hs_state *h = i2c_get_clientdata(client);
725 struct v4l2_ext_controls *ctrls = arg;
726 struct v4l2_mpeg_compression *old_params = arg;
727 struct saa6752hs_mpeg_params params;
732 case VIDIOC_S_MPEGCOMP:
733 if (NULL == old_params) {
734 /* apply settings and start encoder */
735 saa6752hs_init(client);
738 saa6752hs_old_set_params(client, old_params);
740 case VIDIOC_G_MPEGCOMP:
741 *old_params = h->old_params;
743 case VIDIOC_S_EXT_CTRLS:
744 if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG)
746 if (ctrls->count == 0) {
747 /* apply settings and start encoder */
748 saa6752hs_init(client);
752 case VIDIOC_TRY_EXT_CTRLS:
753 case VIDIOC_G_EXT_CTRLS:
754 if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG)
757 for (i = 0; i < ctrls->count; i++) {
758 if ((err = handle_ctrl(¶ms, ctrls->controls + i, cmd))) {
759 ctrls->error_idx = i;
767 struct v4l2_format *f = arg;
769 if (h->video_format == SAA6752HS_VF_UNKNOWN)
770 h->video_format = SAA6752HS_VF_D1;
772 v4l2_format_table[h->video_format].fmt.pix.width;
774 v4l2_format_table[h->video_format].fmt.pix.height;
779 struct v4l2_format *f = arg;
781 saa6752hs_set_subsampling(client, f);
785 h->standard = *((v4l2_std_id *) arg);
795 /* ----------------------------------------------------------------------- */
797 static struct i2c_driver driver = {
801 .id = I2C_DRIVERID_SAA6752HS,
802 .attach_adapter = saa6752hs_probe,
803 .detach_client = saa6752hs_detach,
804 .command = saa6752hs_command,
807 static struct i2c_client client_template =
813 static int __init saa6752hs_init_module(void)
815 return i2c_add_driver(&driver);
818 static void __exit saa6752hs_cleanup_module(void)
820 i2c_del_driver(&driver);
823 module_init(saa6752hs_init_module);
824 module_exit(saa6752hs_cleanup_module);
827 * Overrides for Emacs so that we follow Linus's tabbing style.
828 * ---------------------------------------------------------------------------