diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-07-17 11:26:45 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:28:07 -0400 |
commit | ca130eef2ca185739a440b893e69fe36038b87c9 (patch) | |
tree | e35b288f2a6c1ba816e0ba524ca8966cbab9d147 /drivers/media | |
parent | cb5aa1c62df81ba2cdbae7f7ce469b231d43aba6 (diff) |
V4L/DVB (8377): ivtv/cx18: ensure the default control values are correct
For several MPEG controls and the volume control the default as returned
by VIDIOC_QUERYCTRL was incorrect and did not match the actual initial
value.
This is now fixed for cx18 and ivtv.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/cx18/cx18-av-core.c | 5 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-av-core.h | 1 | ||||
-rw-r--r-- | drivers/media/video/cx2341x.c | 151 | ||||
-rw-r--r-- | drivers/media/video/cx25840/cx25840-core.c | 4 | ||||
-rw-r--r-- | drivers/media/video/cx25840/cx25840-core.h | 1 |
5 files changed, 92 insertions, 70 deletions
diff --git a/drivers/media/video/cx18/cx18-av-core.c b/drivers/media/video/cx18/cx18-av-core.c index 3ccdf613bce0..124014253569 100644 --- a/drivers/media/video/cx18/cx18-av-core.c +++ b/drivers/media/video/cx18/cx18-av-core.c | |||
@@ -80,6 +80,7 @@ static void log_video_status(struct cx18 *cx); | |||
80 | 80 | ||
81 | static void cx18_av_initialize(struct cx18 *cx) | 81 | static void cx18_av_initialize(struct cx18 *cx) |
82 | { | 82 | { |
83 | struct cx18_av_state *state = &cx->av_state; | ||
83 | u32 v; | 84 | u32 v; |
84 | 85 | ||
85 | cx18_av_loadfw(cx); | 86 | cx18_av_loadfw(cx); |
@@ -159,6 +160,8 @@ static void cx18_av_initialize(struct cx18 *cx) | |||
159 | /* CxDevWrReg(CXADEC_SRC_COMB_CFG, 0x6628021F); */ | 160 | /* CxDevWrReg(CXADEC_SRC_COMB_CFG, 0x6628021F); */ |
160 | /* } */ | 161 | /* } */ |
161 | cx18_av_write4(cx, CXADEC_SRC_COMB_CFG, 0x6628021F); | 162 | cx18_av_write4(cx, CXADEC_SRC_COMB_CFG, 0x6628021F); |
163 | state->default_volume = 228 - cx18_av_read(cx, 0x8d4); | ||
164 | state->default_volume = ((state->default_volume / 2) + 23) << 9; | ||
162 | } | 165 | } |
163 | 166 | ||
164 | /* ----------------------------------------------------------------------- */ | 167 | /* ----------------------------------------------------------------------- */ |
@@ -559,6 +562,8 @@ int cx18_av_cmd(struct cx18 *cx, unsigned int cmd, void *arg) | |||
559 | 562 | ||
560 | switch (qc->id) { | 563 | switch (qc->id) { |
561 | case V4L2_CID_AUDIO_VOLUME: | 564 | case V4L2_CID_AUDIO_VOLUME: |
565 | return v4l2_ctrl_query_fill(qc, 0, 65535, | ||
566 | 65535 / 100, state->default_volume); | ||
562 | case V4L2_CID_AUDIO_MUTE: | 567 | case V4L2_CID_AUDIO_MUTE: |
563 | case V4L2_CID_AUDIO_BALANCE: | 568 | case V4L2_CID_AUDIO_BALANCE: |
564 | case V4L2_CID_AUDIO_BASS: | 569 | case V4L2_CID_AUDIO_BASS: |
diff --git a/drivers/media/video/cx18/cx18-av-core.h b/drivers/media/video/cx18/cx18-av-core.h index b54239959a68..49e31bccc557 100644 --- a/drivers/media/video/cx18/cx18-av-core.h +++ b/drivers/media/video/cx18/cx18-av-core.h | |||
@@ -79,6 +79,7 @@ struct cx18_av_state { | |||
79 | u32 audclk_freq; | 79 | u32 audclk_freq; |
80 | int audmode; | 80 | int audmode; |
81 | int vbi_line_offset; | 81 | int vbi_line_offset; |
82 | int default_volume; | ||
82 | u32 id; | 83 | u32 id; |
83 | u32 rev; | 84 | u32 rev; |
84 | int is_initialized; | 85 | int is_initialized; |
diff --git a/drivers/media/video/cx2341x.c b/drivers/media/video/cx2341x.c index 5e40c6bd69b6..22847a0444f5 100644 --- a/drivers/media/video/cx2341x.c +++ b/drivers/media/video/cx2341x.c | |||
@@ -77,6 +77,61 @@ const u32 cx2341x_mpeg_ctrls[] = { | |||
77 | }; | 77 | }; |
78 | EXPORT_SYMBOL(cx2341x_mpeg_ctrls); | 78 | EXPORT_SYMBOL(cx2341x_mpeg_ctrls); |
79 | 79 | ||
80 | static const struct cx2341x_mpeg_params default_params = { | ||
81 | /* misc */ | ||
82 | .capabilities = 0, | ||
83 | .port = CX2341X_PORT_MEMORY, | ||
84 | .width = 720, | ||
85 | .height = 480, | ||
86 | .is_50hz = 0, | ||
87 | |||
88 | /* stream */ | ||
89 | .stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS, | ||
90 | .stream_vbi_fmt = V4L2_MPEG_STREAM_VBI_FMT_NONE, | ||
91 | .stream_insert_nav_packets = 0, | ||
92 | |||
93 | /* audio */ | ||
94 | .audio_sampling_freq = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, | ||
95 | .audio_encoding = V4L2_MPEG_AUDIO_ENCODING_LAYER_2, | ||
96 | .audio_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_224K, | ||
97 | .audio_mode = V4L2_MPEG_AUDIO_MODE_STEREO, | ||
98 | .audio_mode_extension = V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4, | ||
99 | .audio_emphasis = V4L2_MPEG_AUDIO_EMPHASIS_NONE, | ||
100 | .audio_crc = V4L2_MPEG_AUDIO_CRC_NONE, | ||
101 | .audio_mute = 0, | ||
102 | |||
103 | /* video */ | ||
104 | .video_encoding = V4L2_MPEG_VIDEO_ENCODING_MPEG_2, | ||
105 | .video_aspect = V4L2_MPEG_VIDEO_ASPECT_4x3, | ||
106 | .video_b_frames = 2, | ||
107 | .video_gop_size = 12, | ||
108 | .video_gop_closure = 1, | ||
109 | .video_bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR, | ||
110 | .video_bitrate = 6000000, | ||
111 | .video_bitrate_peak = 8000000, | ||
112 | .video_temporal_decimation = 0, | ||
113 | .video_mute = 0, | ||
114 | .video_mute_yuv = 0x008080, /* YCbCr value for black */ | ||
115 | |||
116 | /* encoding filters */ | ||
117 | .video_spatial_filter_mode = | ||
118 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL, | ||
119 | .video_spatial_filter = 0, | ||
120 | .video_luma_spatial_filter_type = | ||
121 | V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR, | ||
122 | .video_chroma_spatial_filter_type = | ||
123 | V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR, | ||
124 | .video_temporal_filter_mode = | ||
125 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL, | ||
126 | .video_temporal_filter = 8, | ||
127 | .video_median_filter_type = | ||
128 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF, | ||
129 | .video_luma_median_filter_top = 255, | ||
130 | .video_luma_median_filter_bottom = 0, | ||
131 | .video_chroma_median_filter_top = 255, | ||
132 | .video_chroma_median_filter_bottom = 0, | ||
133 | }; | ||
134 | |||
80 | 135 | ||
81 | /* Map the control ID to the correct field in the cx2341x_mpeg_params | 136 | /* Map the control ID to the correct field in the cx2341x_mpeg_params |
82 | struct. Return -EINVAL if the ID is unknown, else return 0. */ | 137 | struct. Return -EINVAL if the ID is unknown, else return 0. */ |
@@ -430,13 +485,13 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, | |||
430 | return v4l2_ctrl_query_fill(qctrl, | 485 | return v4l2_ctrl_query_fill(qctrl, |
431 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2, | 486 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2, |
432 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2, 1, | 487 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2, 1, |
433 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2); | 488 | default_params.audio_encoding); |
434 | 489 | ||
435 | case V4L2_CID_MPEG_AUDIO_L2_BITRATE: | 490 | case V4L2_CID_MPEG_AUDIO_L2_BITRATE: |
436 | return v4l2_ctrl_query_fill(qctrl, | 491 | return v4l2_ctrl_query_fill(qctrl, |
437 | V4L2_MPEG_AUDIO_L2_BITRATE_192K, | 492 | V4L2_MPEG_AUDIO_L2_BITRATE_192K, |
438 | V4L2_MPEG_AUDIO_L2_BITRATE_384K, 1, | 493 | V4L2_MPEG_AUDIO_L2_BITRATE_384K, 1, |
439 | V4L2_MPEG_AUDIO_L2_BITRATE_224K); | 494 | default_params.audio_l2_bitrate); |
440 | 495 | ||
441 | case V4L2_CID_MPEG_AUDIO_L1_BITRATE: | 496 | case V4L2_CID_MPEG_AUDIO_L1_BITRATE: |
442 | case V4L2_CID_MPEG_AUDIO_L3_BITRATE: | 497 | case V4L2_CID_MPEG_AUDIO_L3_BITRATE: |
@@ -479,17 +534,22 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, | |||
479 | return cx2341x_ctrl_query_fill(qctrl, | 534 | return cx2341x_ctrl_query_fill(qctrl, |
480 | V4L2_MPEG_STREAM_VBI_FMT_NONE, | 535 | V4L2_MPEG_STREAM_VBI_FMT_NONE, |
481 | V4L2_MPEG_STREAM_VBI_FMT_NONE, 1, | 536 | V4L2_MPEG_STREAM_VBI_FMT_NONE, 1, |
482 | V4L2_MPEG_STREAM_VBI_FMT_NONE); | 537 | default_params.stream_vbi_fmt); |
538 | |||
539 | case V4L2_CID_MPEG_VIDEO_GOP_SIZE: | ||
540 | return v4l2_ctrl_query_fill(qctrl, 1, 34, 1, | ||
541 | params->is_50hz ? 12 : 15); | ||
483 | 542 | ||
484 | /* CX23415/6 specific */ | 543 | /* CX23415/6 specific */ |
485 | case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE: | 544 | case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE: |
486 | return cx2341x_ctrl_query_fill(qctrl, | 545 | return cx2341x_ctrl_query_fill(qctrl, |
487 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL, | 546 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL, |
488 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO, 1, | 547 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO, 1, |
489 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL); | 548 | default_params.video_spatial_filter_mode); |
490 | 549 | ||
491 | case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER: | 550 | case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER: |
492 | cx2341x_ctrl_query_fill(qctrl, 0, 15, 1, 0); | 551 | cx2341x_ctrl_query_fill(qctrl, 0, 15, 1, |
552 | default_params.video_spatial_filter); | ||
493 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; | 553 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; |
494 | if (params->video_spatial_filter_mode == | 554 | if (params->video_spatial_filter_mode == |
495 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO) | 555 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO) |
@@ -501,7 +561,7 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, | |||
501 | V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF, | 561 | V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF, |
502 | V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE, | 562 | V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE, |
503 | 1, | 563 | 1, |
504 | V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF); | 564 | default_params.video_luma_spatial_filter_type); |
505 | if (params->video_spatial_filter_mode == | 565 | if (params->video_spatial_filter_mode == |
506 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO) | 566 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO) |
507 | qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; | 567 | qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; |
@@ -512,7 +572,7 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, | |||
512 | V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF, | 572 | V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF, |
513 | V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR, | 573 | V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR, |
514 | 1, | 574 | 1, |
515 | V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF); | 575 | default_params.video_chroma_spatial_filter_type); |
516 | if (params->video_spatial_filter_mode == | 576 | if (params->video_spatial_filter_mode == |
517 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO) | 577 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO) |
518 | qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; | 578 | qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; |
@@ -522,10 +582,11 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, | |||
522 | return cx2341x_ctrl_query_fill(qctrl, | 582 | return cx2341x_ctrl_query_fill(qctrl, |
523 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL, | 583 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL, |
524 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO, 1, | 584 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO, 1, |
525 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL); | 585 | default_params.video_temporal_filter_mode); |
526 | 586 | ||
527 | case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER: | 587 | case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER: |
528 | cx2341x_ctrl_query_fill(qctrl, 0, 31, 1, 0); | 588 | cx2341x_ctrl_query_fill(qctrl, 0, 31, 1, |
589 | default_params.video_temporal_filter); | ||
529 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; | 590 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; |
530 | if (params->video_temporal_filter_mode == | 591 | if (params->video_temporal_filter_mode == |
531 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO) | 592 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO) |
@@ -536,10 +597,11 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, | |||
536 | return cx2341x_ctrl_query_fill(qctrl, | 597 | return cx2341x_ctrl_query_fill(qctrl, |
537 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF, | 598 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF, |
538 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG, 1, | 599 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG, 1, |
539 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF); | 600 | default_params.video_median_filter_type); |
540 | 601 | ||
541 | case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP: | 602 | case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP: |
542 | cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, 255); | 603 | cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, |
604 | default_params.video_luma_median_filter_top); | ||
543 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; | 605 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; |
544 | if (params->video_median_filter_type == | 606 | if (params->video_median_filter_type == |
545 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) | 607 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) |
@@ -547,7 +609,8 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, | |||
547 | return 0; | 609 | return 0; |
548 | 610 | ||
549 | case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM: | 611 | case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM: |
550 | cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, 0); | 612 | cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, |
613 | default_params.video_luma_median_filter_bottom); | ||
551 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; | 614 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; |
552 | if (params->video_median_filter_type == | 615 | if (params->video_median_filter_type == |
553 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) | 616 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) |
@@ -555,7 +618,8 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, | |||
555 | return 0; | 618 | return 0; |
556 | 619 | ||
557 | case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP: | 620 | case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP: |
558 | cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, 255); | 621 | cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, |
622 | default_params.video_chroma_median_filter_top); | ||
559 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; | 623 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; |
560 | if (params->video_median_filter_type == | 624 | if (params->video_median_filter_type == |
561 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) | 625 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) |
@@ -563,7 +627,8 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, | |||
563 | return 0; | 627 | return 0; |
564 | 628 | ||
565 | case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM: | 629 | case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM: |
566 | cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, 0); | 630 | cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, |
631 | default_params.video_chroma_median_filter_bottom); | ||
567 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; | 632 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; |
568 | if (params->video_median_filter_type == | 633 | if (params->video_median_filter_type == |
569 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) | 634 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) |
@@ -571,7 +636,8 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, | |||
571 | return 0; | 636 | return 0; |
572 | 637 | ||
573 | case V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS: | 638 | case V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS: |
574 | return cx2341x_ctrl_query_fill(qctrl, 0, 1, 1, 0); | 639 | return cx2341x_ctrl_query_fill(qctrl, 0, 1, 1, |
640 | default_params.stream_insert_nav_packets); | ||
575 | 641 | ||
576 | default: | 642 | default: |
577 | return v4l2_ctrl_query_fill_std(qctrl); | 643 | return v4l2_ctrl_query_fill_std(qctrl); |
@@ -725,61 +791,6 @@ EXPORT_SYMBOL(cx2341x_ext_ctrls); | |||
725 | 791 | ||
726 | void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p) | 792 | void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p) |
727 | { | 793 | { |
728 | static struct cx2341x_mpeg_params default_params = { | ||
729 | /* misc */ | ||
730 | .capabilities = 0, | ||
731 | .port = CX2341X_PORT_MEMORY, | ||
732 | .width = 720, | ||
733 | .height = 480, | ||
734 | .is_50hz = 0, | ||
735 | |||
736 | /* stream */ | ||
737 | .stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS, | ||
738 | .stream_vbi_fmt = V4L2_MPEG_STREAM_VBI_FMT_NONE, | ||
739 | .stream_insert_nav_packets = 0, | ||
740 | |||
741 | /* audio */ | ||
742 | .audio_sampling_freq = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, | ||
743 | .audio_encoding = V4L2_MPEG_AUDIO_ENCODING_LAYER_2, | ||
744 | .audio_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_224K, | ||
745 | .audio_mode = V4L2_MPEG_AUDIO_MODE_STEREO, | ||
746 | .audio_mode_extension = V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4, | ||
747 | .audio_emphasis = V4L2_MPEG_AUDIO_EMPHASIS_NONE, | ||
748 | .audio_crc = V4L2_MPEG_AUDIO_CRC_NONE, | ||
749 | .audio_mute = 0, | ||
750 | |||
751 | /* video */ | ||
752 | .video_encoding = V4L2_MPEG_VIDEO_ENCODING_MPEG_2, | ||
753 | .video_aspect = V4L2_MPEG_VIDEO_ASPECT_4x3, | ||
754 | .video_b_frames = 2, | ||
755 | .video_gop_size = 12, | ||
756 | .video_gop_closure = 1, | ||
757 | .video_bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR, | ||
758 | .video_bitrate = 6000000, | ||
759 | .video_bitrate_peak = 8000000, | ||
760 | .video_temporal_decimation = 0, | ||
761 | .video_mute = 0, | ||
762 | .video_mute_yuv = 0x008080, /* YCbCr value for black */ | ||
763 | |||
764 | /* encoding filters */ | ||
765 | .video_spatial_filter_mode = | ||
766 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL, | ||
767 | .video_spatial_filter = 0, | ||
768 | .video_luma_spatial_filter_type = | ||
769 | V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR, | ||
770 | .video_chroma_spatial_filter_type = | ||
771 | V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR, | ||
772 | .video_temporal_filter_mode = | ||
773 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL, | ||
774 | .video_temporal_filter = 8, | ||
775 | .video_median_filter_type = | ||
776 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF, | ||
777 | .video_luma_median_filter_top = 255, | ||
778 | .video_luma_median_filter_bottom = 0, | ||
779 | .video_chroma_median_filter_top = 255, | ||
780 | .video_chroma_median_filter_bottom = 0, | ||
781 | }; | ||
782 | |||
783 | *p = default_params; | 794 | *p = default_params; |
784 | cx2341x_calc_audio_properties(p); | 795 | cx2341x_calc_audio_properties(p); |
785 | } | 796 | } |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 120c498cb60c..e7bf4f4c1319 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -1204,6 +1204,8 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
1204 | 1204 | ||
1205 | switch (qc->id) { | 1205 | switch (qc->id) { |
1206 | case V4L2_CID_AUDIO_VOLUME: | 1206 | case V4L2_CID_AUDIO_VOLUME: |
1207 | return v4l2_ctrl_query_fill(qc, 0, 65535, | ||
1208 | 65535 / 100, state->default_volume); | ||
1207 | case V4L2_CID_AUDIO_MUTE: | 1209 | case V4L2_CID_AUDIO_MUTE: |
1208 | case V4L2_CID_AUDIO_BALANCE: | 1210 | case V4L2_CID_AUDIO_BALANCE: |
1209 | case V4L2_CID_AUDIO_BASS: | 1211 | case V4L2_CID_AUDIO_BASS: |
@@ -1411,6 +1413,8 @@ static int cx25840_probe(struct i2c_client *client, | |||
1411 | state->pvr150_workaround = 0; | 1413 | state->pvr150_workaround = 0; |
1412 | state->audmode = V4L2_TUNER_MODE_LANG1; | 1414 | state->audmode = V4L2_TUNER_MODE_LANG1; |
1413 | state->unmute_volume = -1; | 1415 | state->unmute_volume = -1; |
1416 | state->default_volume = 228 - cx25840_read(client, 0x8d4); | ||
1417 | state->default_volume = ((state->default_volume / 2) + 23) << 9; | ||
1414 | state->vbi_line_offset = 8; | 1418 | state->vbi_line_offset = 8; |
1415 | state->id = id; | 1419 | state->id = id; |
1416 | state->rev = device_id; | 1420 | state->rev = device_id; |
diff --git a/drivers/media/video/cx25840/cx25840-core.h b/drivers/media/video/cx25840/cx25840-core.h index 27d8e52cd67e..72916ba975a8 100644 --- a/drivers/media/video/cx25840/cx25840-core.h +++ b/drivers/media/video/cx25840/cx25840-core.h | |||
@@ -44,6 +44,7 @@ struct cx25840_state { | |||
44 | u32 audclk_freq; | 44 | u32 audclk_freq; |
45 | int audmode; | 45 | int audmode; |
46 | int unmute_volume; /* -1 if not muted */ | 46 | int unmute_volume; /* -1 if not muted */ |
47 | int default_volume; | ||
47 | int vbi_line_offset; | 48 | int vbi_line_offset; |
48 | u32 id; | 49 | u32 id; |
49 | u32 rev; | 50 | u32 rev; |