Commit 6246d4e1 authored by Andy Walls's avatar Andy Walls Committed by Mauro Carvalho Chehab

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: default avatarAndy Walls <awalls@radix.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 6da6bf5e
...@@ -247,6 +247,7 @@ static int cx18_av_init(struct v4l2_subdev *sd, u32 val) ...@@ -247,6 +247,7 @@ static int cx18_av_init(struct v4l2_subdev *sd, u32 val)
void cx18_av_std_setup(struct cx18 *cx) void cx18_av_std_setup(struct cx18 *cx)
{ {
struct cx18_av_state *state = &cx->av_state; struct cx18_av_state *state = &cx->av_state;
struct v4l2_subdev *sd = &state->sd;
v4l2_std_id std = state->std; v4l2_std_id std = state->std;
int hblank, hactive, burst, vblank, vactive, sc; int hblank, hactive, burst, vblank, vactive, sc;
int vblank656, src_decimation; int vblank656, src_decimation;
...@@ -334,33 +335,35 @@ void cx18_av_std_setup(struct cx18 *cx) ...@@ -334,33 +335,35 @@ void cx18_av_std_setup(struct cx18 *cx)
pll_int = cx18_av_read(cx, 0x108); pll_int = cx18_av_read(cx, 0x108);
pll_frac = cx18_av_read4(cx, 0x10c) & 0x1ffffff; pll_frac = cx18_av_read4(cx, 0x10c) & 0x1ffffff;
pll_post = cx18_av_read(cx, 0x109); pll_post = cx18_av_read(cx, 0x109);
CX18_DEBUG_INFO("PLL regs = int: %u, frac: %u, post: %u\n", CX18_DEBUG_INFO_DEV(sd, "PLL regs = int: %u, frac: %u, post: %u\n",
pll_int, pll_frac, pll_post); pll_int, pll_frac, pll_post);
if (pll_post) { if (pll_post) {
int fin, fsc, pll; int fin, fsc, pll;
pll = (28636360L * ((((u64)pll_int) << 25) + pll_frac)) >> 25; pll = (28636360L * ((((u64)pll_int) << 25) + pll_frac)) >> 25;
pll /= pll_post; pll /= pll_post;
CX18_DEBUG_INFO("PLL = %d.%06d MHz\n", CX18_DEBUG_INFO_DEV(sd, "PLL = %d.%06d MHz\n",
pll / 1000000, pll % 1000000); pll / 1000000, pll % 1000000);
CX18_DEBUG_INFO("PLL/8 = %d.%06d MHz\n", CX18_DEBUG_INFO_DEV(sd, "PLL/8 = %d.%06d MHz\n",
pll / 8000000, (pll / 8) % 1000000); pll / 8000000, (pll / 8) % 1000000);
fin = ((u64)src_decimation * pll) >> 12; fin = ((u64)src_decimation * pll) >> 12;
CX18_DEBUG_INFO("ADC Sampling freq = %d.%06d MHz\n", CX18_DEBUG_INFO_DEV(sd, "ADC Sampling freq = %d.%06d MHz\n",
fin / 1000000, fin % 1000000); fin / 1000000, fin % 1000000);
fsc = (((u64)sc) * pll) >> 24L; fsc = (((u64)sc) * pll) >> 24L;
CX18_DEBUG_INFO("Chroma sub-carrier freq = %d.%06d MHz\n", CX18_DEBUG_INFO_DEV(sd,
fsc / 1000000, fsc % 1000000); "Chroma sub-carrier freq = %d.%06d MHz\n",
fsc / 1000000, fsc % 1000000);
CX18_DEBUG_INFO("hblank %i, hactive %i, "
"vblank %i , vactive %i, vblank656 %i, src_dec %i," CX18_DEBUG_INFO_DEV(sd, "hblank %i, hactive %i, vblank %i, "
"burst 0x%02x, luma_lpf %i, uv_lpf %i, comb 0x%02x," "vactive %i, vblank656 %i, src_dec %i, "
" sc 0x%06x\n", "burst 0x%02x, luma_lpf %i, uv_lpf %i, "
hblank, hactive, vblank, vactive, vblank656, "comb 0x%02x, sc 0x%06x\n",
src_decimation, burst, luma_lpf, uv_lpf, comb, sc); hblank, hactive, vblank, vactive, vblank656,
src_decimation, burst, luma_lpf, uv_lpf,
comb, sc);
} }
/* Sets horizontal blanking delay and active lines */ /* 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,13 +477,14 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input,
enum cx18_av_audio_input aud_input) enum cx18_av_audio_input aud_input)
{ {
struct cx18_av_state *state = &cx->av_state; struct cx18_av_state *state = &cx->av_state;
struct v4l2_subdev *sd = &state->sd;
u8 is_composite = (vid_input >= CX18_AV_COMPOSITE1 && u8 is_composite = (vid_input >= CX18_AV_COMPOSITE1 &&
vid_input <= CX18_AV_COMPOSITE8); vid_input <= CX18_AV_COMPOSITE8);
u8 reg; u8 reg;
u8 v; u8 v;
CX18_DEBUG_INFO("decoder set video input %d, audio input %d\n", CX18_DEBUG_INFO_DEV(sd, "decoder set video input %d, audio input %d\n",
vid_input, aud_input); vid_input, aud_input);
if (is_composite) { if (is_composite) {
reg = 0xf0 + (vid_input - CX18_AV_COMPOSITE1); 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,8 +497,8 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input,
luma > CX18_AV_SVIDEO_LUMA8 || luma > CX18_AV_SVIDEO_LUMA8 ||
chroma < CX18_AV_SVIDEO_CHROMA4 || chroma < CX18_AV_SVIDEO_CHROMA4 ||
chroma > CX18_AV_SVIDEO_CHROMA8) { chroma > CX18_AV_SVIDEO_CHROMA8) {
CX18_ERR("0x%04x is not a valid video input!\n", CX18_ERR_DEV(sd, "0x%04x is not a valid video input!\n",
vid_input); vid_input);
return -EINVAL; return -EINVAL;
} }
reg = 0xf0 + ((luma - CX18_AV_SVIDEO_LUMA1) >> 4); 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,7 +523,8 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input,
case CX18_AV_AUDIO8: reg &= ~0xc0; reg |= 0x40; break; case CX18_AV_AUDIO8: reg &= ~0xc0; reg |= 0x40; break;
default: default:
CX18_ERR("0x%04x is not a valid audio input!\n", aud_input); CX18_ERR_DEV(sd, "0x%04x is not a valid audio input!\n",
aud_input);
return -EINVAL; return -EINVAL;
} }
...@@ -685,7 +690,7 @@ static int cx18_av_s_std(struct v4l2_subdev *sd, v4l2_std_id norm) ...@@ -685,7 +690,7 @@ static int cx18_av_s_std(struct v4l2_subdev *sd, v4l2_std_id norm)
fmt = 0xc; fmt = 0xc;
} }
CX18_DEBUG_INFO("changing video std to fmt %i\n", fmt); CX18_DEBUG_INFO_DEV(sd, "changing video std to fmt %i\n", fmt);
/* Follow step 9 of section 3.16 in the cx18_av datasheet. /* Follow step 9 of section 3.16 in the cx18_av datasheet.
Without this PAL may display a vertical ghosting effect. 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,8 +722,8 @@ static int cx18_av_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_BRIGHTNESS: case V4L2_CID_BRIGHTNESS:
if (ctrl->value < 0 || ctrl->value > 255) { if (ctrl->value < 0 || ctrl->value > 255) {
CX18_ERR("invalid brightness setting %d\n", CX18_ERR_DEV(sd, "invalid brightness setting %d\n",
ctrl->value); ctrl->value);
return -ERANGE; return -ERANGE;
} }
...@@ -727,8 +732,8 @@ static int cx18_av_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) ...@@ -727,8 +732,8 @@ static int cx18_av_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
case V4L2_CID_CONTRAST: case V4L2_CID_CONTRAST:
if (ctrl->value < 0 || ctrl->value > 127) { if (ctrl->value < 0 || ctrl->value > 127) {
CX18_ERR("invalid contrast setting %d\n", CX18_ERR_DEV(sd, "invalid contrast setting %d\n",
ctrl->value); ctrl->value);
return -ERANGE; return -ERANGE;
} }
...@@ -737,8 +742,8 @@ static int cx18_av_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) ...@@ -737,8 +742,8 @@ static int cx18_av_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
case V4L2_CID_SATURATION: case V4L2_CID_SATURATION:
if (ctrl->value < 0 || ctrl->value > 127) { if (ctrl->value < 0 || ctrl->value > 127) {
CX18_ERR("invalid saturation setting %d\n", CX18_ERR_DEV(sd, "invalid saturation setting %d\n",
ctrl->value); ctrl->value);
return -ERANGE; return -ERANGE;
} }
...@@ -748,7 +753,8 @@ static int cx18_av_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) ...@@ -748,7 +753,8 @@ static int cx18_av_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
case V4L2_CID_HUE: case V4L2_CID_HUE:
if (ctrl->value < -128 || ctrl->value > 127) { if (ctrl->value < -128 || ctrl->value > 127) {
CX18_ERR("invalid hue setting %d\n", ctrl->value); CX18_ERR_DEV(sd, "invalid hue setting %d\n",
ctrl->value);
return -ERANGE; return -ERANGE;
} }
...@@ -865,8 +871,8 @@ static int cx18_av_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) ...@@ -865,8 +871,8 @@ static int cx18_av_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
if ((pix->width * 16 < Hsrc) || (Hsrc < pix->width) || if ((pix->width * 16 < Hsrc) || (Hsrc < pix->width) ||
(Vlines * 8 < Vsrc) || (Vsrc < Vlines)) { (Vlines * 8 < Vsrc) || (Vsrc < Vlines)) {
CX18_ERR("%dx%d is not a valid size!\n", CX18_ERR_DEV(sd, "%dx%d is not a valid size!\n",
pix->width, pix->height); pix->width, pix->height);
return -ERANGE; return -ERANGE;
} }
...@@ -883,8 +889,9 @@ static int cx18_av_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) ...@@ -883,8 +889,9 @@ static int cx18_av_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
else else
filter = 3; filter = 3;
CX18_DEBUG_INFO("decoder set size %dx%d -> scale %ux%u\n", CX18_DEBUG_INFO_DEV(sd,
pix->width, pix->height, HSC, VSC); "decoder set size %dx%d -> scale %ux%u\n",
pix->width, pix->height, HSC, VSC);
/* HSCALE=HSC */ /* HSCALE=HSC */
cx18_av_write(cx, 0x418, HSC & 0xff); cx18_av_write(cx, 0x418, HSC & 0xff);
...@@ -913,7 +920,7 @@ static int cx18_av_s_stream(struct v4l2_subdev *sd, int enable) ...@@ -913,7 +920,7 @@ static int cx18_av_s_stream(struct v4l2_subdev *sd, int enable)
{ {
struct cx18 *cx = v4l2_get_subdevdata(sd); struct cx18 *cx = v4l2_get_subdevdata(sd);
CX18_DEBUG_INFO("%s output\n", enable ? "enable" : "disable"); CX18_DEBUG_INFO_DEV(sd, "%s output\n", enable ? "enable" : "disable");
if (enable) { if (enable) {
cx18_av_write(cx, 0x115, 0x8c); cx18_av_write(cx, 0x115, 0x8c);
cx18_av_write(cx, 0x116, 0x07); cx18_av_write(cx, 0x116, 0x07);
...@@ -936,34 +943,40 @@ static void log_video_status(struct cx18 *cx) ...@@ -936,34 +943,40 @@ static void log_video_status(struct cx18 *cx)
}; };
struct cx18_av_state *state = &cx->av_state; struct cx18_av_state *state = &cx->av_state;
struct v4l2_subdev *sd = &state->sd;
u8 vidfmt_sel = cx18_av_read(cx, 0x400) & 0xf; u8 vidfmt_sel = cx18_av_read(cx, 0x400) & 0xf;
u8 gen_stat1 = cx18_av_read(cx, 0x40d); u8 gen_stat1 = cx18_av_read(cx, 0x40d);
u8 gen_stat2 = cx18_av_read(cx, 0x40e); u8 gen_stat2 = cx18_av_read(cx, 0x40e);
int vid_input = state->vid_input; int vid_input = state->vid_input;
CX18_INFO("Video signal: %spresent\n", CX18_INFO_DEV(sd, "Video signal: %spresent\n",
(gen_stat2 & 0x20) ? "" : "not "); (gen_stat2 & 0x20) ? "" : "not ");
CX18_INFO("Detected format: %s\n", CX18_INFO_DEV(sd, "Detected format: %s\n",
fmt_strs[gen_stat1 & 0xf]); fmt_strs[gen_stat1 & 0xf]);
CX18_INFO("Specified standard: %s\n", CX18_INFO_DEV(sd, "Specified standard: %s\n",
vidfmt_sel ? fmt_strs[vidfmt_sel] : "automatic detection"); vidfmt_sel ? fmt_strs[vidfmt_sel]
: "automatic detection");
if (vid_input >= CX18_AV_COMPOSITE1 && if (vid_input >= CX18_AV_COMPOSITE1 &&
vid_input <= CX18_AV_COMPOSITE8) { vid_input <= CX18_AV_COMPOSITE8) {
CX18_INFO("Specified video input: Composite %d\n", CX18_INFO_DEV(sd, "Specified video input: Composite %d\n",
vid_input - CX18_AV_COMPOSITE1 + 1); vid_input - CX18_AV_COMPOSITE1 + 1);
} else { } else {
CX18_INFO("Specified video input: S-Video (Luma In%d, Chroma In%d)\n", CX18_INFO_DEV(sd, "Specified video input: "
(vid_input & 0xf0) >> 4, (vid_input & 0xf00) >> 8); "S-Video (Luma In%d, Chroma In%d)\n",
(vid_input & 0xf0) >> 4,
(vid_input & 0xf00) >> 8);
} }
CX18_INFO("Specified audioclock freq: %d Hz\n", state->audclk_freq); CX18_INFO_DEV(sd, "Specified audioclock freq: %d Hz\n",
state->audclk_freq);
} }
static void log_audio_status(struct cx18 *cx) static void log_audio_status(struct cx18 *cx)
{ {
struct cx18_av_state *state = &cx->av_state; struct cx18_av_state *state = &cx->av_state;
struct v4l2_subdev *sd = &state->sd;
u8 download_ctl = cx18_av_read(cx, 0x803); u8 download_ctl = cx18_av_read(cx, 0x803);
u8 mod_det_stat0 = cx18_av_read(cx, 0x804); u8 mod_det_stat0 = cx18_av_read(cx, 0x804);
u8 mod_det_stat1 = cx18_av_read(cx, 0x805); u8 mod_det_stat1 = cx18_av_read(cx, 0x805);
...@@ -986,7 +999,7 @@ static void log_audio_status(struct cx18 *cx) ...@@ -986,7 +999,7 @@ static void log_audio_status(struct cx18 *cx)
case 0xfe: p = "forced mode"; break; case 0xfe: p = "forced mode"; break;
default: p = "not defined"; break; default: p = "not defined"; break;
} }
CX18_INFO("Detected audio mode: %s\n", p); CX18_INFO_DEV(sd, "Detected audio mode: %s\n", p);
switch (mod_det_stat1) { switch (mod_det_stat1) {
case 0x00: p = "not defined"; break; case 0x00: p = "not defined"; break;
...@@ -1011,11 +1024,11 @@ static void log_audio_status(struct cx18 *cx) ...@@ -1011,11 +1024,11 @@ static void log_audio_status(struct cx18 *cx)
case 0xff: p = "no detected audio standard"; break; case 0xff: p = "no detected audio standard"; break;
default: p = "not defined"; break; default: p = "not defined"; break;
} }
CX18_INFO("Detected audio standard: %s\n", p); CX18_INFO_DEV(sd, "Detected audio standard: %s\n", p);
CX18_INFO("Audio muted: %s\n", CX18_INFO_DEV(sd, "Audio muted: %s\n",
(mute_ctl & 0x2) ? "yes" : "no"); (mute_ctl & 0x2) ? "yes" : "no");
CX18_INFO("Audio microcontroller: %s\n", CX18_INFO_DEV(sd, "Audio microcontroller: %s\n",
(download_ctl & 0x10) ? "running" : "stopped"); (download_ctl & 0x10) ? "running" : "stopped");
switch (audio_config >> 4) { switch (audio_config >> 4) {
case 0x00: p = "undefined"; break; case 0x00: p = "undefined"; break;
...@@ -1036,7 +1049,7 @@ static void log_audio_status(struct cx18 *cx) ...@@ -1036,7 +1049,7 @@ static void log_audio_status(struct cx18 *cx)
case 0x0f: p = "automatic detection"; break; case 0x0f: p = "automatic detection"; break;
default: p = "undefined"; break; default: p = "undefined"; break;
} }
CX18_INFO("Configured audio standard: %s\n", p); CX18_INFO_DEV(sd, "Configured audio standard: %s\n", p);
if ((audio_config >> 4) < 0xF) { if ((audio_config >> 4) < 0xF) {
switch (audio_config & 0xF) { switch (audio_config & 0xF) {
...@@ -1050,7 +1063,7 @@ static void log_audio_status(struct cx18 *cx) ...@@ -1050,7 +1063,7 @@ static void log_audio_status(struct cx18 *cx)
case 0x07: p = "DUAL3 (AB)"; break; case 0x07: p = "DUAL3 (AB)"; break;
default: p = "undefined"; default: p = "undefined";
} }
CX18_INFO("Configured audio mode: %s\n", p); CX18_INFO_DEV(sd, "Configured audio mode: %s\n", p);
} else { } else {
switch (audio_config & 0xF) { switch (audio_config & 0xF) {
case 0x00: p = "BG"; break; case 0x00: p = "BG"; break;
...@@ -1068,14 +1081,14 @@ static void log_audio_status(struct cx18 *cx) ...@@ -1068,14 +1081,14 @@ static void log_audio_status(struct cx18 *cx)
case 0x0f: p = "automatic standard and mode detection"; break; case 0x0f: p = "automatic standard and mode detection"; break;
default: p = "undefined"; break; default: p = "undefined"; break;
} }
CX18_INFO("Configured audio system: %s\n", p); CX18_INFO_DEV(sd, "Configured audio system: %s\n", p);
} }
if (aud_input) if (aud_input)
CX18_INFO("Specified audio input: Tuner (In%d)\n", CX18_INFO_DEV(sd, "Specified audio input: Tuner (In%d)\n",
aud_input); aud_input);
else else
CX18_INFO("Specified audio input: External\n"); CX18_INFO_DEV(sd, "Specified audio input: External\n");
switch (pref_mode & 0xf) { switch (pref_mode & 0xf) {
case 0: p = "mono/language A"; break; case 0: p = "mono/language A"; break;
...@@ -1088,14 +1101,14 @@ static void log_audio_status(struct cx18 *cx) ...@@ -1088,14 +1101,14 @@ static void log_audio_status(struct cx18 *cx)
case 7: p = "language AB"; break; case 7: p = "language AB"; break;
default: p = "undefined"; break; default: p = "undefined"; break;
} }
CX18_INFO("Preferred audio mode: %s\n", p); CX18_INFO_DEV(sd, "Preferred audio mode: %s\n", p);
if ((audio_config & 0xf) == 0xf) { if ((audio_config & 0xf) == 0xf) {
switch ((afc0 >> 3) & 0x1) { switch ((afc0 >> 3) & 0x1) {
case 0: p = "system DK"; break; case 0: p = "system DK"; break;
case 1: p = "system L"; break; case 1: p = "system L"; break;
} }
CX18_INFO("Selected 65 MHz format: %s\n", p); CX18_INFO_DEV(sd, "Selected 65 MHz format: %s\n", p);
switch (afc0 & 0x7) { switch (afc0 & 0x7) {
case 0: p = "Chroma"; break; case 0: p = "Chroma"; break;
...@@ -1105,7 +1118,7 @@ static void log_audio_status(struct cx18 *cx) ...@@ -1105,7 +1118,7 @@ static void log_audio_status(struct cx18 *cx)
case 4: p = "autodetect"; break; case 4: p = "autodetect"; break;
default: p = "undefined"; break; default: p = "undefined"; break;
} }
CX18_INFO("Selected 45 MHz format: %s\n", p); CX18_INFO_DEV(sd, "Selected 45 MHz format: %s\n", p);
} }
} }
...@@ -1229,12 +1242,7 @@ int cx18_av_probe(struct cx18 *cx) ...@@ -1229,12 +1242,7 @@ int cx18_av_probe(struct cx18 *cx)
v4l2_subdev_init(sd, &cx18_av_ops); v4l2_subdev_init(sd, &cx18_av_ops);
v4l2_set_subdevdata(sd, cx); v4l2_set_subdevdata(sd, cx);
snprintf(sd->name, sizeof(sd->name), snprintf(sd->name, sizeof(sd->name),
"%s internal A/V decoder", cx->v4l2_dev.name); "%s %03x", cx->v4l2_dev.name, (state->rev >> 4));
sd->grp_id = CX18_HW_418_AV; sd->grp_id = CX18_HW_418_AV;
return v4l2_device_register_subdev(&cx->v4l2_dev, sd); return v4l2_device_register_subdev(&cx->v4l2_dev, sd);
} }
void cx18_av_exit(struct cx18 *cx, struct v4l2_subdev *sd)
{
v4l2_device_unregister_subdev(&cx->av_state.sd);
}
...@@ -343,7 +343,6 @@ int cx18_av_and_or4(struct cx18 *cx, u16 addr, u32 mask, u32 value); ...@@ -343,7 +343,6 @@ int cx18_av_and_or4(struct cx18 *cx, u16 addr, u32 mask, u32 value);
void cx18_av_std_setup(struct cx18 *cx); void cx18_av_std_setup(struct cx18 *cx);
int cx18_av_probe(struct cx18 *cx); int cx18_av_probe(struct cx18 *cx);
void cx18_av_exit(struct cx18 *cx, struct v4l2_subdev *sd);
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
/* cx18_av-firmware.c */ /* cx18_av-firmware.c */
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
int cx18_av_loadfw(struct cx18 *cx) int cx18_av_loadfw(struct cx18 *cx)
{ {
struct v4l2_subdev *sd = &cx->av_state.sd;
const struct firmware *fw = NULL; const struct firmware *fw = NULL;
u32 size; u32 size;
u32 v; u32 v;
...@@ -37,7 +38,7 @@ int cx18_av_loadfw(struct cx18 *cx) ...@@ -37,7 +38,7 @@ int cx18_av_loadfw(struct cx18 *cx)
int retries1 = 0; int retries1 = 0;
if (request_firmware(&fw, FWFILE, &cx->pci_dev->dev) != 0) { if (request_firmware(&fw, FWFILE, &cx->pci_dev->dev) != 0) {
CX18_ERR("unable to open firmware %s\n", FWFILE); CX18_ERR_DEV(sd, "unable to open firmware %s\n", FWFILE);
return -EINVAL; return -EINVAL;
} }
...@@ -88,7 +89,7 @@ int cx18_av_loadfw(struct cx18 *cx) ...@@ -88,7 +89,7 @@ int cx18_av_loadfw(struct cx18 *cx)
retries1++; retries1++;
} }
if (retries1 >= 5) { if (retries1 >= 5) {
CX18_ERR("unable to load firmware %s\n", FWFILE); CX18_ERR_DEV(sd, "unable to load firmware %s\n", FWFILE);
release_firmware(fw); release_firmware(fw);
return -EIO; return -EIO;
} }
...@@ -143,6 +144,6 @@ int cx18_av_loadfw(struct cx18 *cx) ...@@ -143,6 +144,6 @@ int cx18_av_loadfw(struct cx18 *cx)
release_firmware(fw); release_firmware(fw);
CX18_INFO("loaded %s firmware (%d bytes)\n", FWFILE, size); CX18_INFO_DEV(sd, "loaded %s firmware (%d bytes)\n", FWFILE, size);
return 0; return 0;
} }
...@@ -272,6 +272,7 @@ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) ...@@ -272,6 +272,7 @@ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv)
struct i2c_client c; struct i2c_client c;
u8 eedata[256]; u8 eedata[256];
memset(&c, 0, sizeof(c));
strncpy(c.name, "cx18 tveeprom tmp", sizeof(c.name)); strncpy(c.name, "cx18 tveeprom tmp", sizeof(c.name));
c.name[sizeof(c.name)-1] = '\0'; c.name[sizeof(c.name)-1] = '\0';
c.adapter = &cx->i2c_adap[0]; c.adapter = &cx->i2c_adap[0];
......
...@@ -179,6 +179,55 @@ ...@@ -179,6 +179,55 @@
#define CX18_WARN(fmt, args...) v4l2_warn(&cx->v4l2_dev, fmt , ## args) #define CX18_WARN(fmt, args...) v4l2_warn(&cx->v4l2_dev, fmt , ## args)
#define CX18_INFO(fmt, args...) v4l2_info(&cx->v4l2_dev, fmt , ## args) #define CX18_INFO(fmt, args...) v4l2_info(&cx->v4l2_dev, fmt , ## args)
/* Messages for internal subdevs to use */
#define CX18_DEBUG_DEV(x, dev, type, fmt, args...) \
do { \
if ((x) & cx18_debug) \
v4l2_info(dev, " " type ": " fmt , ## args); \
} while (0)
#define CX18_DEBUG_WARN_DEV(dev, fmt, args...) \
CX18_DEBUG_DEV(CX18_DBGFLG_WARN, dev, "warning", fmt , ## args)
#define CX18_DEBUG_INFO_DEV(dev, fmt, args...) \
CX18_DEBUG_DEV(CX18_DBGFLG_INFO, dev, "info", fmt , ## args)
#define CX18_DEBUG_API_DEV(dev, fmt, args...) \
CX18_DEBUG_DEV(CX18_DBGFLG_API, dev, "api", fmt , ## args)
#define CX18_DEBUG_DMA_DEV(dev, fmt, args...) \
CX18_DEBUG_DEV(CX18_DBGFLG_DMA, dev, "dma", fmt , ## args)
#define CX18_DEBUG_IOCTL_DEV(dev, fmt, args...) \
CX18_DEBUG_DEV(CX18_DBGFLG_IOCTL, dev, "ioctl", fmt , ## args)
#define CX18_DEBUG_FILE_DEV(dev, fmt, args...) \
CX18_DEBUG_DEV(CX18_DBGFLG_FILE, dev, "file", fmt , ## args)
#define CX18_DEBUG_I2C_DEV(dev, fmt, args...) \
CX18_DEBUG_DEV(CX18_DBGFLG_I2C, dev, "i2c", fmt , ## args)
#define CX18_DEBUG_IRQ_DEV(dev, fmt, args...) \
CX18_DEBUG_DEV(CX18_DBGFLG_IRQ, dev, "irq", fmt , ## args)
#define CX18_DEBUG_HIGH_VOL_DEV(x, dev, type, fmt, args...) \
do { \
if (((x) & cx18_debug) && (cx18_debug & CX18_DBGFLG_HIGHVOL)) \
v4l2_info(dev, " " type ": " fmt , ## args); \
} while (0)
#define CX18_DEBUG_HI_WARN_DEV(dev, fmt, args...) \
CX18_DEBUG_HIGH_VOL_DEV(CX18_DBGFLG_WARN, dev, "warning", fmt , ## args)
#define CX18_DEBUG_HI_INFO_DEV(dev, fmt, args...) \
CX18_DEBUG_HIGH_VOL_DEV(CX18_DBGFLG_INFO, dev, "info", fmt , ## args)
#define CX18_DEBUG_HI_API_DEV(dev, fmt, args...) \
CX18_DEBUG_HIGH_VOL_DEV(CX18_DBGFLG_API, dev, "api", fmt , ## args)
#define CX18_DEBUG_HI_DMA_DEV(dev, fmt, args...) \
CX18_DEBUG_HIGH_VOL_DEV(CX18_DBGFLG_DMA, dev, "dma", fmt , ## args)
#define CX18_DEBUG_HI_IOCTL_DEV(dev, fmt, args...) \
CX18_DEBUG_HIGH_VOL_DEV(CX18_DBGFLG_IOCTL, dev, "ioctl", fmt , ## args)
#define CX18_DEBUG_HI_FILE_DEV(dev, fmt, args...) \
CX18_DEBUG_HIGH_VOL_DEV(CX18_DBGFLG_FILE, dev, "file", fmt , ## args)
#define CX18_DEBUG_HI_I2C_DEV(dev, fmt, args...) \
CX18_DEBUG_HIGH_VOL_DEV(CX18_DBGFLG_I2C, dev, "i2c", fmt , ## args)
#define CX18_DEBUG_HI_IRQ_DEV(dev, fmt, args...) \
CX18_DEBUG_HIGH_VOL_DEV(CX18_DBGFLG_IRQ, dev, "irq", fmt , ## args)
#define CX18_ERR_DEV(dev, fmt, args...) v4l2_err(dev, fmt , ## args)
#define CX18_WARN_DEV(dev, fmt, args...) v4l2_warn(dev, fmt , ## args)
#define CX18_INFO_DEV(dev, fmt, args...) v4l2_info(dev, fmt , ## args)
/* Values for CX18_API_DEC_PLAYBACK_SPEED mpeg_frame_type_mask parameter: */ /* Values for CX18_API_DEC_PLAYBACK_SPEED mpeg_frame_type_mask parameter: */
#define MPEG_FRAME_TYPE_IFRAME 1 #define MPEG_FRAME_TYPE_IFRAME 1
#define MPEG_FRAME_TYPE_IFRAME_PFRAME 3 #define MPEG_FRAME_TYPE_IFRAME_PFRAME 3
......
...@@ -110,8 +110,8 @@ static int gpiomux_log_status(struct v4l2_subdev *sd) ...@@ -110,8 +110,8 @@ static int gpiomux_log_status(struct v4l2_subdev *sd)
struct cx18 *cx = v4l2_get_subdevdata(sd); struct cx18 *cx = v4l2_get_subdevdata(sd);
mutex_lock(&cx->gpio_lock); mutex_lock(&cx->gpio_lock);
CX18_INFO("GPIO: direction 0x%08x, value 0x%08x\n", CX18_INFO_DEV(sd, "GPIO: direction 0x%08x, value 0x%08x\n",
cx->gpio_dir, cx->gpio_val); cx->gpio_dir, cx->gpio_val);
mutex_unlock(&cx->gpio_lock); mutex_unlock(&cx->gpio_lock);
return 0; return 0;
} }
...@@ -205,8 +205,8 @@ static int resetctrl_log_status(struct v4l2_subdev *sd) ...@@ -205,8 +205,8 @@ static int resetctrl_log_status(struct v4l2_subdev *sd)
struct cx18 *cx = v4l2_get_subdevdata(sd); struct cx18 *cx = v4l2_get_subdevdata(sd);
mutex_lock(&cx->gpio_lock); mutex_lock(&cx->gpio_lock);
CX18_INFO("GPIO: direction 0x%08x, value 0x%08x\n", CX18_INFO_DEV(sd, "GPIO: direction 0x%08x, value 0x%08x\n",
cx->gpio_dir, cx->gpio_val); cx->gpio_dir, cx->gpio_val);
mutex_unlock(&cx->gpio_lock); mutex_unlock(&cx->gpio_lock);
return 0; return 0;
} }
...@@ -297,12 +297,12 @@ int cx18_gpio_register(struct cx18 *cx, u32 hw) ...@@ -297,12 +297,12 @@ int cx18_gpio_register(struct cx18 *cx, u32 hw)
case CX18_HW_GPIO_MUX: case CX18_HW_GPIO_MUX:
sd = &cx->sd_gpiomux; sd = &cx->sd_gpiomux;
ops = &gpiomux_ops; ops = &gpiomux_ops;
str = "gpio mux"; str = "gpio-mux";
break; break;
case CX18_HW_GPIO_RESET_CTRL: case CX18_HW_GPIO_RESET_CTRL:
sd = &cx->sd_resetctrl; sd = &cx->sd_resetctrl;
ops = &resetctrl_ops; ops = &resetctrl_ops;
str = "gpio reset ctrl"; str = "gpio-reset-ctrl";
break; break;
default: default:
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment