diff options
author | Andy Walls <awalls@radix.net> | 2009-02-21 20:27:37 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:02 -0400 |
commit | 6246d4e1b30aa9404d2603dc09a823aba36d9c13 (patch) | |
tree | 92c25cbb0626a1d92a8a5cf1d417d2b662271c9d /drivers/media | |
parent | 6da6bf5e43f409672f5525657ff59282e160c59f (diff) |
V4L/DVB (10761): cx18: Change log lines for internal subdevs and fix tveeprom reads
Give messages originating from internal subdevs a header using the subdev's
name. Fixed an uninitialized variable problem with reading the EEPROM, noticed
from log output. Got rid of the unused cx18_av_exit() function.
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/cx18/cx18-av-core.c | 142 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-av-core.h | 1 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-av-firmware.c | 7 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-driver.c | 1 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-driver.h | 49 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-gpio.c | 12 |
6 files changed, 135 insertions, 77 deletions
diff --git a/drivers/media/video/cx18/cx18-av-core.c b/drivers/media/video/cx18/cx18-av-core.c index 2128070154d3..cf256a999bd4 100644 --- a/drivers/media/video/cx18/cx18-av-core.c +++ b/drivers/media/video/cx18/cx18-av-core.c | |||
@@ -247,6 +247,7 @@ static int cx18_av_init(struct v4l2_subdev *sd, u32 val) | |||
247 | void cx18_av_std_setup(struct cx18 *cx) | 247 | void cx18_av_std_setup(struct cx18 *cx) |
248 | { | 248 | { |
249 | struct cx18_av_state *state = &cx->av_state; | 249 | struct cx18_av_state *state = &cx->av_state; |
250 | struct v4l2_subdev *sd = &state->sd; | ||
250 | v4l2_std_id std = state->std; | 251 | v4l2_std_id std = state->std; |
251 | int hblank, hactive, burst, vblank, vactive, sc; | 252 | int hblank, hactive, burst, vblank, vactive, sc; |
252 | int vblank656, src_decimation; | 253 | int vblank656, src_decimation; |
@@ -334,33 +335,35 @@ void cx18_av_std_setup(struct cx18 *cx) | |||
334 | pll_int = cx18_av_read(cx, 0x108); | 335 | pll_int = cx18_av_read(cx, 0x108); |
335 | pll_frac = cx18_av_read4(cx, 0x10c) & 0x1ffffff; | 336 | pll_frac = cx18_av_read4(cx, 0x10c) & 0x1ffffff; |
336 | pll_post = cx18_av_read(cx, 0x109); | 337 | pll_post = cx18_av_read(cx, 0x109); |
337 | CX18_DEBUG_INFO("PLL regs = int: %u, frac: %u, post: %u\n", | 338 | CX18_DEBUG_INFO_DEV(sd, "PLL regs = int: %u, frac: %u, post: %u\n", |
338 | pll_int, pll_frac, pll_post); | 339 | pll_int, pll_frac, pll_post); |
339 | 340 | ||
340 | if (pll_post) { | 341 | if (pll_post) { |
341 | int fin, fsc, pll; | 342 | int fin, fsc, pll; |
342 | 343 | ||
343 | pll = (28636360L * ((((u64)pll_int) << 25) + pll_frac)) >> 25; | 344 | pll = (28636360L * ((((u64)pll_int) << 25) + pll_frac)) >> 25; |
344 | pll /= pll_post; | 345 | pll /= pll_post; |
345 | CX18_DEBUG_INFO("PLL = %d.%06d MHz\n", | 346 | CX18_DEBUG_INFO_DEV(sd, "PLL = %d.%06d MHz\n", |
346 | pll / 1000000, pll % 1000000); | 347 | pll / 1000000, pll % 1000000); |
347 | CX18_DEBUG_INFO("PLL/8 = %d.%06d MHz\n", | 348 | CX18_DEBUG_INFO_DEV(sd, "PLL/8 = %d.%06d MHz\n", |
348 | pll / 8000000, (pll / 8) % 1000000); | 349 | pll / 8000000, (pll / 8) % 1000000); |
349 | 350 | ||
350 | fin = ((u64)src_decimation * pll) >> 12; | 351 | fin = ((u64)src_decimation * pll) >> 12; |
351 | CX18_DEBUG_INFO("ADC Sampling freq = %d.%06d MHz\n", | 352 | CX18_DEBUG_INFO_DEV(sd, "ADC Sampling freq = %d.%06d MHz\n", |
352 | fin / 1000000, fin % 1000000); | 353 | fin / 1000000, fin % 1000000); |
353 | 354 | ||
354 | fsc = (((u64)sc) * pll) >> 24L; | 355 | fsc = (((u64)sc) * pll) >> 24L; |
355 | CX18_DEBUG_INFO("Chroma sub-carrier freq = %d.%06d MHz\n", | 356 | CX18_DEBUG_INFO_DEV(sd, |
356 | fsc / 1000000, fsc % 1000000); | 357 | "Chroma sub-carrier freq = %d.%06d MHz\n", |
357 | 358 | fsc / 1000000, fsc % 1000000); | |
358 | CX18_DEBUG_INFO("hblank %i, hactive %i, " | 359 | |
359 | "vblank %i , vactive %i, vblank656 %i, src_dec %i," | 360 | CX18_DEBUG_INFO_DEV(sd, "hblank %i, hactive %i, vblank %i, " |
360 | "burst 0x%02x, luma_lpf %i, uv_lpf %i, comb 0x%02x," | 361 | "vactive %i, vblank656 %i, src_dec %i, " |
361 | " sc 0x%06x\n", | 362 | "burst 0x%02x, luma_lpf %i, uv_lpf %i, " |
362 | hblank, hactive, vblank, vactive, vblank656, | 363 | "comb 0x%02x, sc 0x%06x\n", |
363 | src_decimation, burst, luma_lpf, uv_lpf, comb, sc); | 364 | hblank, hactive, vblank, vactive, vblank656, |
365 | src_decimation, burst, luma_lpf, uv_lpf, | ||
366 | comb, sc); | ||
364 | } | 367 | } |
365 | 368 | ||
366 | /* Sets horizontal blanking delay and active lines */ | 369 | /* Sets horizontal blanking delay and active lines */ |
@@ -474,13 +477,14 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input, | |||
474 | enum cx18_av_audio_input aud_input) | 477 | enum cx18_av_audio_input aud_input) |
475 | { | 478 | { |
476 | struct cx18_av_state *state = &cx->av_state; | 479 | struct cx18_av_state *state = &cx->av_state; |
480 | struct v4l2_subdev *sd = &state->sd; | ||
477 | u8 is_composite = (vid_input >= CX18_AV_COMPOSITE1 && | 481 | u8 is_composite = (vid_input >= CX18_AV_COMPOSITE1 && |
478 | vid_input <= CX18_AV_COMPOSITE8); | 482 | vid_input <= CX18_AV_COMPOSITE8); |
479 | u8 reg; | 483 | u8 reg; |
480 | u8 v; | 484 | u8 v; |
481 | 485 | ||
482 | CX18_DEBUG_INFO("decoder set video input %d, audio input %d\n", | 486 | CX18_DEBUG_INFO_DEV(sd, "decoder set video input %d, audio input %d\n", |
483 | vid_input, aud_input); | 487 | vid_input, aud_input); |
484 | 488 | ||
485 | if (is_composite) { | 489 | if (is_composite) { |
486 | reg = 0xf0 + (vid_input - CX18_AV_COMPOSITE1); | 490 | reg = 0xf0 + (vid_input - CX18_AV_COMPOSITE1); |
@@ -493,8 +497,8 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input, | |||
493 | luma > CX18_AV_SVIDEO_LUMA8 || | 497 | luma > CX18_AV_SVIDEO_LUMA8 || |
494 | chroma < CX18_AV_SVIDEO_CHROMA4 || | 498 | chroma < CX18_AV_SVIDEO_CHROMA4 || |
495 | chroma > CX18_AV_SVIDEO_CHROMA8) { | 499 | chroma > CX18_AV_SVIDEO_CHROMA8) { |
496 | CX18_ERR("0x%04x is not a valid video input!\n", | 500 | CX18_ERR_DEV(sd, "0x%04x is not a valid video input!\n", |
497 | vid_input); | 501 | vid_input); |
498 | return -EINVAL; | 502 | return -EINVAL; |
499 | } | 503 | } |
500 | reg = 0xf0 + ((luma - CX18_AV_SVIDEO_LUMA1) >> 4); | 504 | reg = 0xf0 + ((luma - CX18_AV_SVIDEO_LUMA1) >> 4); |
@@ -519,7 +523,8 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input, | |||
519 | case CX18_AV_AUDIO8: reg &= ~0xc0; reg |= 0x40; break; | 523 | case CX18_AV_AUDIO8: reg &= ~0xc0; reg |= 0x40; break; |
520 | 524 | ||
521 | default: | 525 | default: |
522 | CX18_ERR("0x%04x is not a valid audio input!\n", aud_input); | 526 | CX18_ERR_DEV(sd, "0x%04x is not a valid audio input!\n", |
527 | aud_input); | ||
523 | return -EINVAL; | 528 | return -EINVAL; |
524 | } | 529 | } |
525 | 530 | ||
@@ -685,7 +690,7 @@ static int cx18_av_s_std(struct v4l2_subdev *sd, v4l2_std_id norm) | |||
685 | fmt = 0xc; | 690 | fmt = 0xc; |
686 | } | 691 | } |
687 | 692 | ||
688 | CX18_DEBUG_INFO("changing video std to fmt %i\n", fmt); | 693 | CX18_DEBUG_INFO_DEV(sd, "changing video std to fmt %i\n", fmt); |
689 | 694 | ||
690 | /* Follow step 9 of section 3.16 in the cx18_av datasheet. | 695 | /* Follow step 9 of section 3.16 in the cx18_av datasheet. |
691 | Without this PAL may display a vertical ghosting effect. | 696 | Without this PAL may display a vertical ghosting effect. |
@@ -717,8 +722,8 @@ static int cx18_av_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | |||
717 | switch (ctrl->id) { | 722 | switch (ctrl->id) { |
718 | case V4L2_CID_BRIGHTNESS: | 723 | case V4L2_CID_BRIGHTNESS: |
719 | if (ctrl->value < 0 || ctrl->value > 255) { | 724 | if (ctrl->value < 0 || ctrl->value > 255) { |
720 | CX18_ERR("invalid brightness setting %d\n", | 725 | CX18_ERR_DEV(sd, "invalid brightness setting %d\n", |
721 | ctrl->value); | 726 | ctrl->value); |
722 | return -ERANGE; | 727 | return -ERANGE; |
723 | } | 728 | } |
724 | 729 | ||
@@ -727,8 +732,8 @@ static int cx18_av_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | |||
727 | 732 | ||
728 | case V4L2_CID_CONTRAST: | 733 | case V4L2_CID_CONTRAST: |
729 | if (ctrl->value < 0 || ctrl->value > 127) { | 734 | if (ctrl->value < 0 || ctrl->value > 127) { |
730 | CX18_ERR("invalid contrast setting %d\n", | 735 | CX18_ERR_DEV(sd, "invalid contrast setting %d\n", |
731 | ctrl->value); | 736 | ctrl->value); |
732 | return -ERANGE; | 737 | return -ERANGE; |
733 | } | 738 | } |
734 | 739 | ||
@@ -737,8 +742,8 @@ static int cx18_av_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | |||
737 | 742 | ||
738 | case V4L2_CID_SATURATION: | 743 | case V4L2_CID_SATURATION: |
739 | if (ctrl->value < 0 || ctrl->value > 127) { | 744 | if (ctrl->value < 0 || ctrl->value > 127) { |
740 | CX18_ERR("invalid saturation setting %d\n", | 745 | CX18_ERR_DEV(sd, "invalid saturation setting %d\n", |
741 | ctrl->value); | 746 | ctrl->value); |
742 | return -ERANGE; | 747 | return -ERANGE; |
743 | } | 748 | } |
744 | 749 | ||
@@ -748,7 +753,8 @@ static int cx18_av_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | |||
748 | 753 | ||
749 | case V4L2_CID_HUE: | 754 | case V4L2_CID_HUE: |
750 | if (ctrl->value < -128 || ctrl->value > 127) { | 755 | if (ctrl->value < -128 || ctrl->value > 127) { |
751 | CX18_ERR("invalid hue setting %d\n", ctrl->value); | 756 | CX18_ERR_DEV(sd, "invalid hue setting %d\n", |
757 | ctrl->value); | ||
752 | return -ERANGE; | 758 | return -ERANGE; |
753 | } | 759 | } |
754 | 760 | ||
@@ -865,8 +871,8 @@ static int cx18_av_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | |||
865 | 871 | ||
866 | if ((pix->width * 16 < Hsrc) || (Hsrc < pix->width) || | 872 | if ((pix->width * 16 < Hsrc) || (Hsrc < pix->width) || |
867 | (Vlines * 8 < Vsrc) || (Vsrc < Vlines)) { | 873 | (Vlines * 8 < Vsrc) || (Vsrc < Vlines)) { |
868 | CX18_ERR("%dx%d is not a valid size!\n", | 874 | CX18_ERR_DEV(sd, "%dx%d is not a valid size!\n", |
869 | pix->width, pix->height); | 875 | pix->width, pix->height); |
870 | return -ERANGE; | 876 | return -ERANGE; |
871 | } | 877 | } |
872 | 878 | ||
@@ -883,8 +889,9 @@ static int cx18_av_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | |||
883 | else | 889 | else |
884 | filter = 3; | 890 | filter = 3; |
885 | 891 | ||
886 | CX18_DEBUG_INFO("decoder set size %dx%d -> scale %ux%u\n", | 892 | CX18_DEBUG_INFO_DEV(sd, |
887 | pix->width, pix->height, HSC, VSC); | 893 | "decoder set size %dx%d -> scale %ux%u\n", |
894 | pix->width, pix->height, HSC, VSC); | ||
888 | 895 | ||
889 | /* HSCALE=HSC */ | 896 | /* HSCALE=HSC */ |
890 | cx18_av_write(cx, 0x418, HSC & 0xff); | 897 | cx18_av_write(cx, 0x418, HSC & 0xff); |
@@ -913,7 +920,7 @@ static int cx18_av_s_stream(struct v4l2_subdev *sd, int enable) | |||
913 | { | 920 | { |
914 | struct cx18 *cx = v4l2_get_subdevdata(sd); | 921 | struct cx18 *cx = v4l2_get_subdevdata(sd); |
915 | 922 | ||
916 | CX18_DEBUG_INFO("%s output\n", enable ? "enable" : "disable"); | 923 | CX18_DEBUG_INFO_DEV(sd, "%s output\n", enable ? "enable" : "disable"); |
917 | if (enable) { | 924 | if (enable) { |
918 | cx18_av_write(cx, 0x115, 0x8c); | 925 | cx18_av_write(cx, 0x115, 0x8c); |
919 | cx18_av_write(cx, 0x116, 0x07); | 926 | cx18_av_write(cx, 0x116, 0x07); |
@@ -936,34 +943,40 @@ static void log_video_status(struct cx18 *cx) | |||
936 | }; | 943 | }; |
937 | 944 | ||
938 | struct cx18_av_state *state = &cx->av_state; | 945 | struct cx18_av_state *state = &cx->av_state; |
946 | struct v4l2_subdev *sd = &state->sd; | ||
939 | u8 vidfmt_sel = cx18_av_read(cx, 0x400) & 0xf; | 947 | u8 vidfmt_sel = cx18_av_read(cx, 0x400) & 0xf; |
940 | u8 gen_stat1 = cx18_av_read(cx, 0x40d); | 948 | u8 gen_stat1 = cx18_av_read(cx, 0x40d); |
941 | u8 gen_stat2 = cx18_av_read(cx, 0x40e); | 949 | u8 gen_stat2 = cx18_av_read(cx, 0x40e); |
942 | int vid_input = state->vid_input; | 950 | int vid_input = state->vid_input; |
943 | 951 | ||
944 | CX18_INFO("Video signal: %spresent\n", | 952 | CX18_INFO_DEV(sd, "Video signal: %spresent\n", |
945 | (gen_stat2 & 0x20) ? "" : "not "); | 953 | (gen_stat2 & 0x20) ? "" : "not "); |
946 | CX18_INFO("Detected format: %s\n", | 954 | CX18_INFO_DEV(sd, "Detected format: %s\n", |
947 | fmt_strs[gen_stat1 & 0xf]); | 955 | fmt_strs[gen_stat1 & 0xf]); |
948 | 956 | ||
949 | CX18_INFO("Specified standard: %s\n", | 957 | CX18_INFO_DEV(sd, "Specified standard: %s\n", |
950 | vidfmt_sel ? fmt_strs[vidfmt_sel] : "automatic detection"); | 958 | vidfmt_sel ? fmt_strs[vidfmt_sel] |
959 | : "automatic detection"); | ||
951 | 960 | ||
952 | if (vid_input >= CX18_AV_COMPOSITE1 && | 961 | if (vid_input >= CX18_AV_COMPOSITE1 && |
953 | vid_input <= CX18_AV_COMPOSITE8) { | 962 | vid_input <= CX18_AV_COMPOSITE8) { |
954 | CX18_INFO("Specified video input: Composite %d\n", | 963 | CX18_INFO_DEV(sd, "Specified video input: Composite %d\n", |
955 | vid_input - CX18_AV_COMPOSITE1 + 1); | 964 | vid_input - CX18_AV_COMPOSITE1 + 1); |
956 | } else { | 965 | } else { |
957 | CX18_INFO("Specified video input: S-Video (Luma In%d, Chroma In%d)\n", | 966 | CX18_INFO_DEV(sd, "Specified video input: " |
958 | (vid_input & 0xf0) >> 4, (vid_input & 0xf00) >> 8); | 967 | "S-Video (Luma In%d, Chroma In%d)\n", |
968 | (vid_input & 0xf0) >> 4, | ||
969 | (vid_input & 0xf00) >> 8); | ||
959 | } | 970 | } |
960 | 971 | ||
961 | CX18_INFO("Specified audioclock freq: %d Hz\n", state->audclk_freq); | 972 | CX18_INFO_DEV(sd, "Specified audioclock freq: %d Hz\n", |
973 | state->audclk_freq); | ||
962 | } | 974 | } |
963 | 975 | ||
964 | static void log_audio_status(struct cx18 *cx) | 976 | static void log_audio_status(struct cx18 *cx) |
965 | { | 977 | { |
966 | struct cx18_av_state *state = &cx->av_state; | 978 | struct cx18_av_state *state = &cx->av_state; |
979 | struct v4l2_subdev *sd = &state->sd; | ||
967 | u8 download_ctl = cx18_av_read(cx, 0x803); | 980 | u8 download_ctl = cx18_av_read(cx, 0x803); |
968 | u8 mod_det_stat0 = cx18_av_read(cx, 0x804); | 981 | u8 mod_det_stat0 = cx18_av_read(cx, 0x804); |
969 | u8 mod_det_stat1 = cx18_av_read(cx, 0x805); | 982 | u8 mod_det_stat1 = cx18_av_read(cx, 0x805); |
@@ -986,7 +999,7 @@ static void log_audio_status(struct cx18 *cx) | |||
986 | case 0xfe: p = "forced mode"; break; | 999 | case 0xfe: p = "forced mode"; break; |
987 | default: p = "not defined"; break; | 1000 | default: p = "not defined"; break; |
988 | } | 1001 | } |
989 | CX18_INFO("Detected audio mode: %s\n", p); | 1002 | CX18_INFO_DEV(sd, "Detected audio mode: %s\n", p); |
990 | 1003 | ||
991 | switch (mod_det_stat1) { | 1004 | switch (mod_det_stat1) { |
992 | case 0x00: p = "not defined"; break; | 1005 | case 0x00: p = "not defined"; break; |
@@ -1011,11 +1024,11 @@ static void log_audio_status(struct cx18 *cx) | |||
1011 | case 0xff: p = "no detected audio standard"; break; | 1024 | case 0xff: p = "no detected audio standard"; break; |
1012 | default: p = "not defined"; break; | 1025 | default: p = "not defined"; break; |
1013 | } | 1026 | } |
1014 | CX18_INFO("Detected audio standard: %s\n", p); | 1027 | CX18_INFO_DEV(sd, "Detected audio standard: %s\n", p); |
1015 | CX18_INFO("Audio muted: %s\n", | 1028 | CX18_INFO_DEV(sd, "Audio muted: %s\n", |
1016 | (mute_ctl & 0x2) ? "yes" : "no"); | 1029 | (mute_ctl & 0x2) ? "yes" : "no"); |
1017 | CX18_INFO("Audio microcontroller: %s\n", | 1030 | CX18_INFO_DEV(sd, "Audio microcontroller: %s\n", |
1018 | (download_ctl & 0x10) ? "running" : "stopped"); | 1031 | (download_ctl & 0x10) ? "running" : "stopped"); |
1019 | 1032 | ||
1020 | switch (audio_config >> 4) { | 1033 | switch (audio_config >> 4) { |
1021 | case 0x00: p = "undefined"; break; | 1034 | case 0x00: p = "undefined"; break; |
@@ -1036,7 +1049,7 @@ static void log_audio_status(struct cx18 *cx) | |||
1036 | case 0x0f: p = "automatic detection"; break; | 1049 | case 0x0f: p = "automatic detection"; break; |
1037 | default: p = "undefined"; break; | 1050 | default: p = "undefined"; break; |
1038 | } | 1051 | } |
1039 | CX18_INFO("Configured audio standard: %s\n", p); | 1052 | CX18_INFO_DEV(sd, "Configured audio standard: %s\n", p); |
1040 | 1053 | ||
1041 | if ((audio_config >> 4) < 0xF) { | 1054 | if ((audio_config >> 4) < 0xF) { |
1042 | switch (audio_config & 0xF) { | 1055 | switch (audio_config & 0xF) { |
@@ -1050,7 +1063,7 @@ static void log_audio_status(struct cx18 *cx) | |||
1050 | case 0x07: p = "DUAL3 (AB)"; break; | 1063 | case 0x07: p = "DUAL3 (AB)"; break; |
1051 | default: p = "undefined"; | 1064 | default: p = "undefined"; |
1052 | } | 1065 | } |
1053 | CX18_INFO("Configured audio mode: %s\n", p); | 1066 | CX18_INFO_DEV(sd, "Configured audio mode: %s\n", p); |
1054 | } else { | 1067 | } else { |
1055 | switch (audio_config & 0xF) { | 1068 | switch (audio_config & 0xF) { |
1056 | case 0x00: p = "BG"; break; | 1069 | case 0x00: p = "BG"; break; |
@@ -1068,14 +1081,14 @@ static void log_audio_status(struct cx18 *cx) | |||
1068 | case 0x0f: p = "automatic standard and mode detection"; break; | 1081 | case 0x0f: p = "automatic standard and mode detection"; break; |
1069 | default: p = "undefined"; break; | 1082 | default: p = "undefined"; break; |
1070 | } | 1083 | } |
1071 | CX18_INFO("Configured audio system: %s\n", p); | 1084 | CX18_INFO_DEV(sd, "Configured audio system: %s\n", p); |
1072 | } | 1085 | } |
1073 | 1086 | ||
1074 | if (aud_input) | 1087 | if (aud_input) |
1075 | CX18_INFO("Specified audio input: Tuner (In%d)\n", | 1088 | CX18_INFO_DEV(sd, "Specified audio input: Tuner (In%d)\n", |
1076 | aud_input); | 1089 | aud_input); |
1077 | else | 1090 | else |
1078 | CX18_INFO("Specified audio input: External\n"); | 1091 | CX18_INFO_DEV(sd, "Specified audio input: External\n"); |
1079 | 1092 | ||
1080 | switch (pref_mode & 0xf) { | 1093 | switch (pref_mode & 0xf) { |
1081 | case 0: p = "mono/language A"; break; | 1094 | case 0: p = "mono/language A"; break; |
@@ -1088,14 +1101,14 @@ static void log_audio_status(struct cx18 *cx) | |||
1088 | case 7: p = "language AB"; break; | 1101 | case 7: p = "language AB"; break; |
1089 | default: p = "undefined"; break; | 1102 | default: p = "undefined"; break; |
1090 | } | 1103 | } |
1091 | CX18_INFO("Preferred audio mode: %s\n", p); | 1104 | CX18_INFO_DEV(sd, "Preferred audio mode: %s\n", p); |
1092 | 1105 | ||
1093 | if ((audio_config & 0xf) == 0xf) { | 1106 | if ((audio_config & 0xf) == 0xf) { |
1094 | switch ((afc0 >> 3) & 0x1) { | 1107 | switch ((afc0 >> 3) & 0x1) { |
1095 | case 0: p = "system DK"; break; | 1108 | case 0: p = "system DK"; break; |
1096 | case 1: p = "system L"; break; | 1109 | case 1: p = "system L"; break; |
1097 | } | 1110 | } |
1098 | CX18_INFO("Selected 65 MHz format: %s\n", p); | 1111 | CX18_INFO_DEV(sd, "Selected 65 MHz format: %s\n", p); |
1099 | 1112 | ||
1100 | switch (afc0 & 0x7) { | 1113 | switch (afc0 & 0x7) { |
1101 | case 0: p = "Chroma"; break; | 1114 | case 0: p = "Chroma"; break; |
@@ -1105,7 +1118,7 @@ static void log_audio_status(struct cx18 *cx) | |||
1105 | case 4: p = "autodetect"; break; | 1118 | case 4: p = "autodetect"; break; |
1106 | default: p = "undefined"; break; | 1119 | default: p = "undefined"; break; |
1107 | } | 1120 | } |
1108 | CX18_INFO("Selected 45 MHz format: %s\n", p); | 1121 | CX18_INFO_DEV(sd, "Selected 45 MHz format: %s\n", p); |
1109 | } | 1122 | } |
1110 | } | 1123 | } |
1111 | 1124 | ||
@@ -1229,12 +1242,7 @@ int cx18_av_probe(struct cx18 *cx) | |||
1229 | v4l2_subdev_init(sd, &cx18_av_ops); | 1242 | v4l2_subdev_init(sd, &cx18_av_ops); |
1230 | v4l2_set_subdevdata(sd, cx); | 1243 | v4l2_set_subdevdata(sd, cx); |
1231 | snprintf(sd->name, sizeof(sd->name), | 1244 | snprintf(sd->name, sizeof(sd->name), |
1232 | "%s internal A/V decoder", cx->v4l2_dev.name); | 1245 | "%s %03x", cx->v4l2_dev.name, (state->rev >> 4)); |
1233 | sd->grp_id = CX18_HW_418_AV; | 1246 | sd->grp_id = CX18_HW_418_AV; |
1234 | return v4l2_device_register_subdev(&cx->v4l2_dev, sd); | 1247 | return v4l2_device_register_subdev(&cx->v4l2_dev, sd); |
1235 | } | 1248 | } |
1236 | |||
1237 | void cx18_av_exit(struct cx18 *cx, struct v4l2_subdev *sd) | ||
1238 | { | ||
1239 | v4l2_device_unregister_subdev(&cx->av_state.sd); | ||
1240 | } | ||
diff --git a/drivers/media/video/cx18/cx18-av-core.h b/drivers/media/video/cx18/cx18-av-core.h index cd9c0e70f1fc..fd0df4151211 100644 --- a/drivers/media/video/cx18/cx18-av-core.h +++ b/drivers/media/video/cx18/cx18-av-core.h | |||
@@ -343,7 +343,6 @@ int cx18_av_and_or4(struct cx18 *cx, u16 addr, u32 mask, u32 value); | |||
343 | void cx18_av_std_setup(struct cx18 *cx); | 343 | void cx18_av_std_setup(struct cx18 *cx); |
344 | 344 | ||
345 | int cx18_av_probe(struct cx18 *cx); | 345 | int cx18_av_probe(struct cx18 *cx); |
346 | void cx18_av_exit(struct cx18 *cx, struct v4l2_subdev *sd); | ||
347 | 346 | ||
348 | /* ----------------------------------------------------------------------- */ | 347 | /* ----------------------------------------------------------------------- */ |
349 | /* cx18_av-firmware.c */ | 348 | /* cx18_av-firmware.c */ |
diff --git a/drivers/media/video/cx18/cx18-av-firmware.c b/drivers/media/video/cx18/cx18-av-firmware.c index 940ea9352115..49a55cc8d839 100644 --- a/drivers/media/video/cx18/cx18-av-firmware.c +++ b/drivers/media/video/cx18/cx18-av-firmware.c | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | int cx18_av_loadfw(struct cx18 *cx) | 30 | int cx18_av_loadfw(struct cx18 *cx) |
31 | { | 31 | { |
32 | struct v4l2_subdev *sd = &cx->av_state.sd; | ||
32 | const struct firmware *fw = NULL; | 33 | const struct firmware *fw = NULL; |
33 | u32 size; | 34 | u32 size; |
34 | u32 v; | 35 | u32 v; |
@@ -37,7 +38,7 @@ int cx18_av_loadfw(struct cx18 *cx) | |||
37 | int retries1 = 0; | 38 | int retries1 = 0; |
38 | 39 | ||
39 | if (request_firmware(&fw, FWFILE, &cx->pci_dev->dev) != 0) { | 40 | if (request_firmware(&fw, FWFILE, &cx->pci_dev->dev) != 0) { |
40 | CX18_ERR("unable to open firmware %s\n", FWFILE); | 41 | CX18_ERR_DEV(sd, "unable to open firmware %s\n", FWFILE); |
41 | return -EINVAL; | 42 | return -EINVAL; |
42 | } | 43 | } |
43 | 44 | ||
@@ -88,7 +89,7 @@ int cx18_av_loadfw(struct cx18 *cx) | |||
88 | retries1++; | 89 | retries1++; |
89 | } | 90 | } |
90 | if (retries1 >= 5) { | 91 | if (retries1 >= 5) { |
91 | CX18_ERR("unable to load firmware %s\n", FWFILE); | 92 | CX18_ERR_DEV(sd, "unable to load firmware %s\n", FWFILE); |
92 | release_firmware(fw); | 93 | release_firmware(fw); |
93 | return -EIO; | 94 | return -EIO; |
94 | } | 95 | } |
@@ -143,6 +144,6 @@ int cx18_av_loadfw(struct cx18 *cx) | |||
143 | 144 | ||
144 | release_firmware(fw); | 145 | release_firmware(fw); |
145 | 146 | ||
146 | CX18_INFO("loaded %s firmware (%d bytes)\n", FWFILE, size); | 147 | CX18_INFO_DEV(sd, "loaded %s firmware (%d bytes)\n", FWFILE, size); |
147 | return 0; | 148 | return 0; |
148 | } | 149 | } |
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c index 544abbfb843e..fcc40bf37f2f 100644 --- a/drivers/media/video/cx18/cx18-driver.c +++ b/drivers/media/video/cx18/cx18-driver.c | |||
@@ -272,6 +272,7 @@ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) | |||
272 | struct i2c_client c; | 272 | struct i2c_client c; |
273 | u8 eedata[256]; | 273 | u8 eedata[256]; |
274 | 274 | ||
275 | memset(&c, 0, sizeof(c)); | ||
275 | strncpy(c.name, "cx18 tveeprom tmp", sizeof(c.name)); | 276 | strncpy(c.name, "cx18 tveeprom tmp", sizeof(c.name)); |
276 | c.name[sizeof(c.name)-1] = '\0'; | 277 | c.name[sizeof(c.name)-1] = '\0'; |
277 | c.adapter = &cx->i2c_adap[0]; | 278 | c.adapter = &cx->i2c_adap[0]; |
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h index 9ee608063b49..5e1ae91d5325 100644 --- a/drivers/media/video/cx18/cx18-driver.h +++ b/drivers/media/video/cx18/cx18-driver.h | |||
@@ -179,6 +179,55 @@ | |||
179 | #define CX18_WARN(fmt, args...) v4l2_warn(&cx->v4l2_dev, fmt , ## args) | 179 | #define CX18_WARN(fmt, args...) v4l2_warn(&cx->v4l2_dev, fmt , ## args) |
180 | #define CX18_INFO(fmt, args...) v4l2_info(&cx->v4l2_dev, fmt , ## args) | 180 | #define CX18_INFO(fmt, args...) v4l2_info(&cx->v4l2_dev, fmt , ## args) |
181 | 181 | ||
182 | /* Messages for internal subdevs to use */ | ||
183 | #define CX18_DEBUG_DEV(x, dev, type, fmt, args...) \ | ||
184 | do { \ | ||
185 | if ((x) & cx18_debug) \ | ||
186 | v4l2_info(dev, " " type ": " fmt , ## args); \ | ||
187 | } while (0) | ||
188 | #define CX18_DEBUG_WARN_DEV(dev, fmt, args...) \ | ||
189 | CX18_DEBUG_DEV(CX18_DBGFLG_WARN, dev, "warning", fmt , ## args) | ||
190 | #define CX18_DEBUG_INFO_DEV(dev, fmt, args...) \ | ||
191 | CX18_DEBUG_DEV(CX18_DBGFLG_INFO, dev, "info", fmt , ## args) | ||
192 | #define CX18_DEBUG_API_DEV(dev, fmt, args...) \ | ||
193 | CX18_DEBUG_DEV(CX18_DBGFLG_API, dev, "api", fmt , ## args) | ||
194 | #define CX18_DEBUG_DMA_DEV(dev, fmt, args...) \ | ||
195 | CX18_DEBUG_DEV(CX18_DBGFLG_DMA, dev, "dma", fmt , ## args) | ||
196 | #define CX18_DEBUG_IOCTL_DEV(dev, fmt, args...) \ | ||
197 | CX18_DEBUG_DEV(CX18_DBGFLG_IOCTL, dev, "ioctl", fmt , ## args) | ||
198 | #define CX18_DEBUG_FILE_DEV(dev, fmt, args...) \ | ||
199 | CX18_DEBUG_DEV(CX18_DBGFLG_FILE, dev, "file", fmt , ## args) | ||
200 | #define CX18_DEBUG_I2C_DEV(dev, fmt, args...) \ | ||
201 | CX18_DEBUG_DEV(CX18_DBGFLG_I2C, dev, "i2c", fmt , ## args) | ||
202 | #define CX18_DEBUG_IRQ_DEV(dev, fmt, args...) \ | ||
203 | CX18_DEBUG_DEV(CX18_DBGFLG_IRQ, dev, "irq", fmt , ## args) | ||
204 | |||
205 | #define CX18_DEBUG_HIGH_VOL_DEV(x, dev, type, fmt, args...) \ | ||
206 | do { \ | ||
207 | if (((x) & cx18_debug) && (cx18_debug & CX18_DBGFLG_HIGHVOL)) \ | ||
208 | v4l2_info(dev, " " type ": " fmt , ## args); \ | ||
209 | } while (0) | ||
210 | #define CX18_DEBUG_HI_WARN_DEV(dev, fmt, args...) \ | ||
211 | CX18_DEBUG_HIGH_VOL_DEV(CX18_DBGFLG_WARN, dev, "warning", fmt , ## args) | ||
212 | #define CX18_DEBUG_HI_INFO_DEV(dev, fmt, args...) \ | ||
213 | CX18_DEBUG_HIGH_VOL_DEV(CX18_DBGFLG_INFO, dev, "info", fmt , ## args) | ||
214 | #define CX18_DEBUG_HI_API_DEV(dev, fmt, args...) \ | ||
215 | CX18_DEBUG_HIGH_VOL_DEV(CX18_DBGFLG_API, dev, "api", fmt , ## args) | ||
216 | #define CX18_DEBUG_HI_DMA_DEV(dev, fmt, args...) \ | ||
217 | CX18_DEBUG_HIGH_VOL_DEV(CX18_DBGFLG_DMA, dev, "dma", fmt , ## args) | ||
218 | #define CX18_DEBUG_HI_IOCTL_DEV(dev, fmt, args...) \ | ||
219 | CX18_DEBUG_HIGH_VOL_DEV(CX18_DBGFLG_IOCTL, dev, "ioctl", fmt , ## args) | ||
220 | #define CX18_DEBUG_HI_FILE_DEV(dev, fmt, args...) \ | ||
221 | CX18_DEBUG_HIGH_VOL_DEV(CX18_DBGFLG_FILE, dev, "file", fmt , ## args) | ||
222 | #define CX18_DEBUG_HI_I2C_DEV(dev, fmt, args...) \ | ||
223 | CX18_DEBUG_HIGH_VOL_DEV(CX18_DBGFLG_I2C, dev, "i2c", fmt , ## args) | ||
224 | #define CX18_DEBUG_HI_IRQ_DEV(dev, fmt, args...) \ | ||
225 | CX18_DEBUG_HIGH_VOL_DEV(CX18_DBGFLG_IRQ, dev, "irq", fmt , ## args) | ||
226 | |||
227 | #define CX18_ERR_DEV(dev, fmt, args...) v4l2_err(dev, fmt , ## args) | ||
228 | #define CX18_WARN_DEV(dev, fmt, args...) v4l2_warn(dev, fmt , ## args) | ||
229 | #define CX18_INFO_DEV(dev, fmt, args...) v4l2_info(dev, fmt , ## args) | ||
230 | |||
182 | /* Values for CX18_API_DEC_PLAYBACK_SPEED mpeg_frame_type_mask parameter: */ | 231 | /* Values for CX18_API_DEC_PLAYBACK_SPEED mpeg_frame_type_mask parameter: */ |
183 | #define MPEG_FRAME_TYPE_IFRAME 1 | 232 | #define MPEG_FRAME_TYPE_IFRAME 1 |
184 | #define MPEG_FRAME_TYPE_IFRAME_PFRAME 3 | 233 | #define MPEG_FRAME_TYPE_IFRAME_PFRAME 3 |
diff --git a/drivers/media/video/cx18/cx18-gpio.c b/drivers/media/video/cx18/cx18-gpio.c index dcc19b1c541d..5518d1424f8f 100644 --- a/drivers/media/video/cx18/cx18-gpio.c +++ b/drivers/media/video/cx18/cx18-gpio.c | |||
@@ -110,8 +110,8 @@ static int gpiomux_log_status(struct v4l2_subdev *sd) | |||
110 | struct cx18 *cx = v4l2_get_subdevdata(sd); | 110 | struct cx18 *cx = v4l2_get_subdevdata(sd); |
111 | 111 | ||
112 | mutex_lock(&cx->gpio_lock); | 112 | mutex_lock(&cx->gpio_lock); |
113 | CX18_INFO("GPIO: direction 0x%08x, value 0x%08x\n", | 113 | CX18_INFO_DEV(sd, "GPIO: direction 0x%08x, value 0x%08x\n", |
114 | cx->gpio_dir, cx->gpio_val); | 114 | cx->gpio_dir, cx->gpio_val); |
115 | mutex_unlock(&cx->gpio_lock); | 115 | mutex_unlock(&cx->gpio_lock); |
116 | return 0; | 116 | return 0; |
117 | } | 117 | } |
@@ -205,8 +205,8 @@ static int resetctrl_log_status(struct v4l2_subdev *sd) | |||
205 | struct cx18 *cx = v4l2_get_subdevdata(sd); | 205 | struct cx18 *cx = v4l2_get_subdevdata(sd); |
206 | 206 | ||
207 | mutex_lock(&cx->gpio_lock); | 207 | mutex_lock(&cx->gpio_lock); |
208 | CX18_INFO("GPIO: direction 0x%08x, value 0x%08x\n", | 208 | CX18_INFO_DEV(sd, "GPIO: direction 0x%08x, value 0x%08x\n", |
209 | cx->gpio_dir, cx->gpio_val); | 209 | cx->gpio_dir, cx->gpio_val); |
210 | mutex_unlock(&cx->gpio_lock); | 210 | mutex_unlock(&cx->gpio_lock); |
211 | return 0; | 211 | return 0; |
212 | } | 212 | } |
@@ -297,12 +297,12 @@ int cx18_gpio_register(struct cx18 *cx, u32 hw) | |||
297 | case CX18_HW_GPIO_MUX: | 297 | case CX18_HW_GPIO_MUX: |
298 | sd = &cx->sd_gpiomux; | 298 | sd = &cx->sd_gpiomux; |
299 | ops = &gpiomux_ops; | 299 | ops = &gpiomux_ops; |
300 | str = "gpio mux"; | 300 | str = "gpio-mux"; |
301 | break; | 301 | break; |
302 | case CX18_HW_GPIO_RESET_CTRL: | 302 | case CX18_HW_GPIO_RESET_CTRL: |
303 | sd = &cx->sd_resetctrl; | 303 | sd = &cx->sd_resetctrl; |
304 | ops = &resetctrl_ops; | 304 | ops = &resetctrl_ops; |
305 | str = "gpio reset ctrl"; | 305 | str = "gpio-reset-ctrl"; |
306 | break; | 306 | break; |
307 | default: | 307 | default: |
308 | return -EINVAL; | 308 | return -EINVAL; |