From 62899a28008d635f25c3408b4cc46021f0cb34d3 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Sun, 15 Mar 2009 18:48:52 -0300 Subject: V4L/DVB (11085): au0828/au8522: Codingstyle fixes Take a pass over all of the au0828/au8522 files and cleanup all the codingstyle issues. This patch does not make *any* functional change to the code. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/au8522_decoder.c | 233 ++++++++++++++------------- drivers/media/dvb/frontends/au8522_dig.c | 14 +- drivers/media/video/au0828/au0828-cards.c | 24 ++- drivers/media/video/au0828/au0828-i2c.c | 10 +- drivers/media/video/au0828/au0828-video.c | 175 ++++++++++---------- drivers/media/video/au0828/au0828.h | 6 - 6 files changed, 226 insertions(+), 236 deletions(-) diff --git a/drivers/media/dvb/frontends/au8522_decoder.c b/drivers/media/dvb/frontends/au8522_decoder.c index 564636389ba..2ad84c236ec 100644 --- a/drivers/media/dvb/frontends/au8522_decoder.c +++ b/drivers/media/dvb/frontends/au8522_decoder.c @@ -67,39 +67,40 @@ struct au8522_register_config { 0="ATV RF" 1="ATV RF13" 2="CVBS" 3="S-Video" 4="PAL" 5=CVBS13" 6="SVideo13" */ struct au8522_register_config filter_coef[] = { - {AU8522_FILTER_COEF_R410, {0x25, 0x00, 0x25, 0x25, 0x00, 0x00, 0x00}}, - {AU8522_FILTER_COEF_R411, {0x20, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00}}, - {AU8522_FILTER_COEF_R412, {0x03, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00}}, - {AU8522_FILTER_COEF_R413, {0xe6, 0x00, 0xe6, 0xe6, 0x00, 0x00, 0x00}}, - {AU8522_FILTER_COEF_R414, {0x40, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00}}, - {AU8522_FILTER_COEF_R415, {0x1b, 0x00, 0x1b, 0x1b, 0x00, 0x00, 0x00}}, - {AU8522_FILTER_COEF_R416, {0xc0, 0x00, 0xc0, 0x04, 0x00, 0x00, 0x00}}, - {AU8522_FILTER_COEF_R417, {0x04, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00}}, - {AU8522_FILTER_COEF_R418, {0x8c, 0x00, 0x8c, 0x8c, 0x00, 0x00, 0x00}}, - {AU8522_FILTER_COEF_R419, {0xa0, 0x40, 0xa0, 0xa0, 0x40, 0x40, 0x40}}, - {AU8522_FILTER_COEF_R41A, {0x21, 0x09, 0x21, 0x21, 0x09, 0x09, 0x09}}, - {AU8522_FILTER_COEF_R41B, {0x6c, 0x38, 0x6c, 0x6c, 0x38, 0x38, 0x38}}, - {AU8522_FILTER_COEF_R41C, {0x03, 0xff, 0x03, 0x03, 0xff, 0xff, 0xff}}, - {AU8522_FILTER_COEF_R41D, {0xbf, 0xc7, 0xbf, 0xbf, 0xc7, 0xc7, 0xc7}}, - {AU8522_FILTER_COEF_R41E, {0xa0, 0xdf, 0xa0, 0xa0, 0xdf, 0xdf, 0xdf}}, - {AU8522_FILTER_COEF_R41F, {0x10, 0x06, 0x10, 0x10, 0x06, 0x06, 0x06}}, - {AU8522_FILTER_COEF_R420, {0xae, 0x30, 0xae, 0xae, 0x30, 0x30, 0x30}}, - {AU8522_FILTER_COEF_R421, {0xc4, 0x01, 0xc4, 0xc4, 0x01, 0x01, 0x01}}, - {AU8522_FILTER_COEF_R422, {0x54, 0xdd, 0x54, 0x54, 0xdd, 0xdd, 0xdd}}, - {AU8522_FILTER_COEF_R423, {0xd0, 0xaf, 0xd0, 0xd0, 0xaf, 0xaf, 0xaf}}, - {AU8522_FILTER_COEF_R424, {0x1c, 0xf7, 0x1c, 0x1c, 0xf7, 0xf7, 0xf7}}, - {AU8522_FILTER_COEF_R425, {0x76, 0xdb, 0x76, 0x76, 0xdb, 0xdb, 0xdb}}, - {AU8522_FILTER_COEF_R426, {0x61, 0xc0, 0x61, 0x61, 0xc0, 0xc0, 0xc0}}, - {AU8522_FILTER_COEF_R427, {0xd1, 0x2f, 0xd1, 0xd1, 0x2f, 0x2f, 0x2f}}, - {AU8522_FILTER_COEF_R428, {0x84, 0xd8, 0x84, 0x84, 0xd8, 0xd8, 0xd8}}, - {AU8522_FILTER_COEF_R429, {0x06, 0xfb, 0x06, 0x06, 0xfb, 0xfb, 0xfb}}, - {AU8522_FILTER_COEF_R42A, {0x21, 0xd5, 0x21, 0x21, 0xd5, 0xd5, 0xd5}}, - {AU8522_FILTER_COEF_R42B, {0x0a, 0x3e, 0x0a, 0x0a, 0x3e, 0x3e, 0x3e}}, - {AU8522_FILTER_COEF_R42C, {0xe6, 0x15, 0xe6, 0xe6, 0x15, 0x15, 0x15}}, - {AU8522_FILTER_COEF_R42D, {0x01, 0x34, 0x01, 0x01, 0x34, 0x34, 0x34}}, + {AU8522_FILTER_COEF_R410, {0x25, 0x00, 0x25, 0x25, 0x00, 0x00, 0x00} }, + {AU8522_FILTER_COEF_R411, {0x20, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00} }, + {AU8522_FILTER_COEF_R412, {0x03, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00} }, + {AU8522_FILTER_COEF_R413, {0xe6, 0x00, 0xe6, 0xe6, 0x00, 0x00, 0x00} }, + {AU8522_FILTER_COEF_R414, {0x40, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00} }, + {AU8522_FILTER_COEF_R415, {0x1b, 0x00, 0x1b, 0x1b, 0x00, 0x00, 0x00} }, + {AU8522_FILTER_COEF_R416, {0xc0, 0x00, 0xc0, 0x04, 0x00, 0x00, 0x00} }, + {AU8522_FILTER_COEF_R417, {0x04, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00} }, + {AU8522_FILTER_COEF_R418, {0x8c, 0x00, 0x8c, 0x8c, 0x00, 0x00, 0x00} }, + {AU8522_FILTER_COEF_R419, {0xa0, 0x40, 0xa0, 0xa0, 0x40, 0x40, 0x40} }, + {AU8522_FILTER_COEF_R41A, {0x21, 0x09, 0x21, 0x21, 0x09, 0x09, 0x09} }, + {AU8522_FILTER_COEF_R41B, {0x6c, 0x38, 0x6c, 0x6c, 0x38, 0x38, 0x38} }, + {AU8522_FILTER_COEF_R41C, {0x03, 0xff, 0x03, 0x03, 0xff, 0xff, 0xff} }, + {AU8522_FILTER_COEF_R41D, {0xbf, 0xc7, 0xbf, 0xbf, 0xc7, 0xc7, 0xc7} }, + {AU8522_FILTER_COEF_R41E, {0xa0, 0xdf, 0xa0, 0xa0, 0xdf, 0xdf, 0xdf} }, + {AU8522_FILTER_COEF_R41F, {0x10, 0x06, 0x10, 0x10, 0x06, 0x06, 0x06} }, + {AU8522_FILTER_COEF_R420, {0xae, 0x30, 0xae, 0xae, 0x30, 0x30, 0x30} }, + {AU8522_FILTER_COEF_R421, {0xc4, 0x01, 0xc4, 0xc4, 0x01, 0x01, 0x01} }, + {AU8522_FILTER_COEF_R422, {0x54, 0xdd, 0x54, 0x54, 0xdd, 0xdd, 0xdd} }, + {AU8522_FILTER_COEF_R423, {0xd0, 0xaf, 0xd0, 0xd0, 0xaf, 0xaf, 0xaf} }, + {AU8522_FILTER_COEF_R424, {0x1c, 0xf7, 0x1c, 0x1c, 0xf7, 0xf7, 0xf7} }, + {AU8522_FILTER_COEF_R425, {0x76, 0xdb, 0x76, 0x76, 0xdb, 0xdb, 0xdb} }, + {AU8522_FILTER_COEF_R426, {0x61, 0xc0, 0x61, 0x61, 0xc0, 0xc0, 0xc0} }, + {AU8522_FILTER_COEF_R427, {0xd1, 0x2f, 0xd1, 0xd1, 0x2f, 0x2f, 0x2f} }, + {AU8522_FILTER_COEF_R428, {0x84, 0xd8, 0x84, 0x84, 0xd8, 0xd8, 0xd8} }, + {AU8522_FILTER_COEF_R429, {0x06, 0xfb, 0x06, 0x06, 0xfb, 0xfb, 0xfb} }, + {AU8522_FILTER_COEF_R42A, {0x21, 0xd5, 0x21, 0x21, 0xd5, 0xd5, 0xd5} }, + {AU8522_FILTER_COEF_R42B, {0x0a, 0x3e, 0x0a, 0x0a, 0x3e, 0x3e, 0x3e} }, + {AU8522_FILTER_COEF_R42C, {0xe6, 0x15, 0xe6, 0xe6, 0x15, 0x15, 0x15} }, + {AU8522_FILTER_COEF_R42D, {0x01, 0x34, 0x01, 0x01, 0x34, 0x34, 0x34} }, }; -#define NUM_FILTER_COEF (sizeof (filter_coef) / sizeof(struct au8522_register_config)) +#define NUM_FILTER_COEF (sizeof(filter_coef)\ + / sizeof(struct au8522_register_config)) /* Registers 0x060b through 0x0652 are the LP Filter coefficients @@ -108,80 +109,81 @@ struct au8522_register_config filter_coef[] = { Note: the "ATVRF/ATVRF13" mode has never been tested */ struct au8522_register_config lpfilter_coef[] = { - {0x060b, {0x21, 0x0b}}, - {0x060c, {0xad, 0xad}}, - {0x060d, {0x70, 0xf0}}, - {0x060e, {0xea, 0xe9}}, - {0x060f, {0xdd, 0xdd}}, - {0x0610, {0x08, 0x64}}, - {0x0611, {0x60, 0x60}}, - {0x0612, {0xf8, 0xb2}}, - {0x0613, {0x01, 0x02}}, - {0x0614, {0xe4, 0xb4}}, - {0x0615, {0x19, 0x02}}, - {0x0616, {0xae, 0x2e}}, - {0x0617, {0xee, 0xc5}}, - {0x0618, {0x56, 0x56}}, - {0x0619, {0x30, 0x58}}, - {0x061a, {0xf9, 0xf8}}, - {0x061b, {0x24, 0x64}}, - {0x061c, {0x07, 0x07}}, - {0x061d, {0x30, 0x30}}, - {0x061e, {0xa9, 0xed}}, - {0x061f, {0x09, 0x0b}}, - {0x0620, {0x42, 0xc2}}, - {0x0621, {0x1d, 0x2a}}, - {0x0622, {0xd6, 0x56}}, - {0x0623, {0x95, 0x8b}}, - {0x0624, {0x2b, 0x2b}}, - {0x0625, {0x30, 0x24}}, - {0x0626, {0x3e, 0x3e}}, - {0x0627, {0x62, 0xe2}}, - {0x0628, {0xe9, 0xf5}}, - {0x0629, {0x99, 0x19}}, - {0x062a, {0xd4, 0x11}}, - {0x062b, {0x03, 0x04}}, - {0x062c, {0xb5, 0x85}}, - {0x062d, {0x1e, 0x20}}, - {0x062e, {0x2a, 0xea}}, - {0x062f, {0xd7, 0xd2}}, - {0x0630, {0x15, 0x15}}, - {0x0631, {0xa3, 0xa9}}, - {0x0632, {0x1f, 0x1f}}, - {0x0633, {0xf9, 0xd1}}, - {0x0634, {0xc0, 0xc3}}, - {0x0635, {0x4d, 0x8d}}, - {0x0636, {0x21, 0x31}}, - {0x0637, {0x83, 0x83}}, - {0x0638, {0x08, 0x8c}}, - {0x0639, {0x19, 0x19}}, - {0x063a, {0x45, 0xa5}}, - {0x063b, {0xef, 0xec}}, - {0x063c, {0x8a, 0x8a}}, - {0x063d, {0xf4, 0xf6}}, - {0x063e, {0x8f, 0x8f}}, - {0x063f, {0x44, 0x0c}}, - {0x0640, {0xef, 0xf0}}, - {0x0641, {0x66, 0x66}}, - {0x0642, {0xcc, 0xd2}}, - {0x0643, {0x41, 0x41}}, - {0x0644, {0x63, 0x93}}, - {0x0645, {0x8e, 0x8e}}, - {0x0646, {0xa2, 0x42}}, - {0x0647, {0x7b, 0x7b}}, - {0x0648, {0x04, 0x04}}, - {0x0649, {0x00, 0x00}}, - {0x064a, {0x40, 0x40}}, - {0x064b, {0x8c, 0x98}}, - {0x064c, {0x00, 0x00}}, - {0x064d, {0x63, 0xc3}}, - {0x064e, {0x04, 0x04}}, - {0x064f, {0x20, 0x20}}, - {0x0650, {0x00, 0x00}}, - {0x0651, {0x40 ,0x40}}, - {0x0652, {0x01, 0x01}}, + {0x060b, {0x21, 0x0b} }, + {0x060c, {0xad, 0xad} }, + {0x060d, {0x70, 0xf0} }, + {0x060e, {0xea, 0xe9} }, + {0x060f, {0xdd, 0xdd} }, + {0x0610, {0x08, 0x64} }, + {0x0611, {0x60, 0x60} }, + {0x0612, {0xf8, 0xb2} }, + {0x0613, {0x01, 0x02} }, + {0x0614, {0xe4, 0xb4} }, + {0x0615, {0x19, 0x02} }, + {0x0616, {0xae, 0x2e} }, + {0x0617, {0xee, 0xc5} }, + {0x0618, {0x56, 0x56} }, + {0x0619, {0x30, 0x58} }, + {0x061a, {0xf9, 0xf8} }, + {0x061b, {0x24, 0x64} }, + {0x061c, {0x07, 0x07} }, + {0x061d, {0x30, 0x30} }, + {0x061e, {0xa9, 0xed} }, + {0x061f, {0x09, 0x0b} }, + {0x0620, {0x42, 0xc2} }, + {0x0621, {0x1d, 0x2a} }, + {0x0622, {0xd6, 0x56} }, + {0x0623, {0x95, 0x8b} }, + {0x0624, {0x2b, 0x2b} }, + {0x0625, {0x30, 0x24} }, + {0x0626, {0x3e, 0x3e} }, + {0x0627, {0x62, 0xe2} }, + {0x0628, {0xe9, 0xf5} }, + {0x0629, {0x99, 0x19} }, + {0x062a, {0xd4, 0x11} }, + {0x062b, {0x03, 0x04} }, + {0x062c, {0xb5, 0x85} }, + {0x062d, {0x1e, 0x20} }, + {0x062e, {0x2a, 0xea} }, + {0x062f, {0xd7, 0xd2} }, + {0x0630, {0x15, 0x15} }, + {0x0631, {0xa3, 0xa9} }, + {0x0632, {0x1f, 0x1f} }, + {0x0633, {0xf9, 0xd1} }, + {0x0634, {0xc0, 0xc3} }, + {0x0635, {0x4d, 0x8d} }, + {0x0636, {0x21, 0x31} }, + {0x0637, {0x83, 0x83} }, + {0x0638, {0x08, 0x8c} }, + {0x0639, {0x19, 0x19} }, + {0x063a, {0x45, 0xa5} }, + {0x063b, {0xef, 0xec} }, + {0x063c, {0x8a, 0x8a} }, + {0x063d, {0xf4, 0xf6} }, + {0x063e, {0x8f, 0x8f} }, + {0x063f, {0x44, 0x0c} }, + {0x0640, {0xef, 0xf0} }, + {0x0641, {0x66, 0x66} }, + {0x0642, {0xcc, 0xd2} }, + {0x0643, {0x41, 0x41} }, + {0x0644, {0x63, 0x93} }, + {0x0645, {0x8e, 0x8e} }, + {0x0646, {0xa2, 0x42} }, + {0x0647, {0x7b, 0x7b} }, + {0x0648, {0x04, 0x04} }, + {0x0649, {0x00, 0x00} }, + {0x064a, {0x40, 0x40} }, + {0x064b, {0x8c, 0x98} }, + {0x064c, {0x00, 0x00} }, + {0x064d, {0x63, 0xc3} }, + {0x064e, {0x04, 0x04} }, + {0x064f, {0x20, 0x20} }, + {0x0650, {0x00, 0x00} }, + {0x0651, {0x40, 0x40} }, + {0x0652, {0x01, 0x01} }, }; -#define NUM_LPFILTER_COEF (sizeof (lpfilter_coef) / sizeof(struct au8522_register_config)) +#define NUM_LPFILTER_COEF (sizeof(lpfilter_coef)\ + / sizeof(struct au8522_register_config)) static inline struct au8522_state *to_state(struct v4l2_subdev *sd) { @@ -202,14 +204,17 @@ static void setup_vbi(struct au8522_state *state, int aud_input) au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_PAT2_REG01EH, 0x00); au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_PAT1_REG01FH, 0x00); au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_PAT0_REG020H, 0x00); - au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_MASK2_REG021H,0x00); - au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_MASK1_REG022H,0x00); - au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_MASK0_REG023H,0x00); + au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_MASK2_REG021H, + 0x00); + au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_MASK1_REG022H, + 0x00); + au8522_writereg(state, AU8522_TVDEC_VBI_USER_FRAME_MASK0_REG023H, + 0x00); /* Setup the VBI registers */ - for (i = 0x30; i < 0x60; i++) { + for (i = 0x30; i < 0x60; i++) au8522_writereg(state, i, 0x40); - } + /* For some reason, every register is 0x40 except register 0x44 (confirmed via the HVR-950q USB capture) */ au8522_writereg(state, 0x44, 0x60); @@ -448,7 +453,7 @@ static void set_audio_input(struct au8522_state *state, int aud_input) if (aud_input != AU8522_AUDIO_SIF) { /* The caller asked for a mode we don't currently support */ - printk("Unsupported audio mode requested! mode=%d\n", + printk(KERN_ERR "Unsupported audio mode requested! mode=%d\n", aud_input); return; } @@ -668,7 +673,7 @@ static int au8522_s_video_routing(struct v4l2_subdev *sd, } else if (route->input == AU8522_COMPOSITE_CH4_SIF) { au8522_setup_cvbs_tuner_mode(state); } else { - printk("au8522 mode not currently supported\n"); + printk(KERN_ERR "au8522 mode not currently supported\n"); return -EINVAL; } return 0; @@ -782,15 +787,15 @@ static int au8522_probe(struct i2c_client *client, instance = au8522_get_state(&state, client->adapter, client->addr); switch (instance) { case 0: - printk("au8522_decoder allocation failed\n"); + printk(KERN_ERR "au8522_decoder allocation failed\n"); return -EIO; case 1: /* new demod instance */ - printk("au8522_decoder creating new instance...\n"); + printk(KERN_INFO "au8522_decoder creating new instance...\n"); break; default: /* existing demod instance */ - printk("au8522_decoder attaching to existing instance...\n"); + printk(KERN_INFO "au8522_decoder attach existing instance.\n"); break; } diff --git a/drivers/media/dvb/frontends/au8522_dig.c b/drivers/media/dvb/frontends/au8522_dig.c index 7e24b914dbe..35731258bb0 100644 --- a/drivers/media/dvb/frontends/au8522_dig.c +++ b/drivers/media/dvb/frontends/au8522_dig.c @@ -36,16 +36,16 @@ static int debug; static LIST_HEAD(hybrid_tuner_instance_list); static DEFINE_MUTEX(au8522_list_mutex); -#define dprintk(arg...) do { \ - if (debug) \ - printk(arg); \ +#define dprintk(arg...)\ + do { if (debug)\ + printk(arg);\ } while (0) /* 16 bit registers, 8 bit values */ int au8522_writereg(struct au8522_state *state, u16 reg, u8 data) { int ret; - u8 buf [] = { (reg >> 8) | 0x80, reg & 0xff, data }; + u8 buf[] = { (reg >> 8) | 0x80, reg & 0xff, data }; struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 3 }; @@ -62,10 +62,10 @@ int au8522_writereg(struct au8522_state *state, u16 reg, u8 data) u8 au8522_readreg(struct au8522_state *state, u16 reg) { int ret; - u8 b0 [] = { (reg >> 8) | 0x40, reg & 0xff }; - u8 b1 [] = { 0 }; + u8 b0[] = { (reg >> 8) | 0x40, reg & 0xff }; + u8 b1[] = { 0 }; - struct i2c_msg msg [] = { + struct i2c_msg msg[] = { { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 2 }, { .addr = state->config->demod_address, .flags = I2C_M_RD, diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c index a12c92c0374..1b48eb58a16 100644 --- a/drivers/media/video/au0828/au0828-cards.c +++ b/drivers/media/video/au0828/au0828-cards.c @@ -150,13 +150,13 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data) /* Make sure we support the board model */ switch (tv.model) { case 72000: /* WinTV-HVR950q (Retail, IR, ATSC/QAM */ - case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */ - case 72211: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */ - case 72221: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */ - case 72231: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and basic analog video */ - case 72241: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM and basic analog video */ - case 72251: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and basic analog video */ - case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and basic analog video */ + case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */ + case 72211: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */ + case 72221: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */ + case 72231: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */ + case 72241: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM and analog video */ + case 72251: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */ + case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and analog video */ case 72500: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM */ break; default: @@ -202,9 +202,8 @@ void au0828_card_setup(struct au0828_dev *dev) demod) */ sd = v4l2_i2c_new_subdev(&dev->i2c_adap, "au8522", "au8522", 0x8e >> 1); - if (sd == NULL) { - printk("analog subdev registration failure\n"); - } + if (sd == NULL) + printk(KERN_ERR "analog subdev registration failed\n"); } /* Setup tuners */ @@ -212,9 +211,8 @@ void au0828_card_setup(struct au0828_dev *dev) /* Load the tuner module, which does the attach */ sd = v4l2_i2c_new_subdev(&dev->i2c_adap, "tuner", "tuner", dev->board.tuner_addr); - if (sd == NULL) { - printk("analog tuner subdev registration failure\n"); - } + if (sd == NULL) + printk(KERN_ERR "tuner subdev registration fail\n"); tun_setup.mode_mask = mode_mask; tun_setup.type = dev->board.tuner_type; diff --git a/drivers/media/video/au0828/au0828-i2c.c b/drivers/media/video/au0828/au0828-i2c.c index e841ba5a642..1b110f37b89 100644 --- a/drivers/media/video/au0828/au0828-i2c.c +++ b/drivers/media/video/au0828/au0828-i2c.c @@ -145,11 +145,10 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, requires us to slow down the i2c clock until we have a better strategy (such as using the secondary i2c bus to do firmware loading */ - if ((msg->addr << 1) == 0xc2) { + if ((msg->addr << 1) == 0xc2) au0828_write(dev, REG_202, 0x40); - } else { + else au0828_write(dev, REG_202, 0x07); - } /* Hardware needs 8 bit addresses */ au0828_write(dev, REG_203, msg->addr << 1); @@ -223,11 +222,10 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, requires us to slow down the i2c clock until we have a better strategy (such as using the secondary i2c bus to do firmware loading */ - if ((msg->addr << 1) == 0xc2) { + if ((msg->addr << 1) == 0xc2) au0828_write(dev, REG_202, 0x40); - } else { + else au0828_write(dev, REG_202, 0x07); - } /* Hardware needs 8 bit addresses */ au0828_write(dev, REG_203, msg->addr << 1); diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c index 800345cbe0e..057496414ea 100644 --- a/drivers/media/video/au0828/au0828-video.c +++ b/drivers/media/video/au0828/au0828-video.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -46,9 +45,6 @@ static DEFINE_MUTEX(au0828_sysfs_lock); #define AU0828_VERSION_CODE KERNEL_VERSION(0, 0, 1) -/* Forward declarations */ -void au0828_analog_stream_reset(struct au0828_dev *dev); - /* ------------------------------------------------------------------ Videobuf operations ------------------------------------------------------------------*/ @@ -107,12 +103,12 @@ static inline void print_err_status(struct au0828_dev *dev, static int check_dev(struct au0828_dev *dev) { if (dev->dev_state & DEV_DISCONNECTED) { - printk("v4l2 ioctl: device not present\n"); + printk(KERN_INFO "v4l2 ioctl: device not present\n"); return -ENODEV; } if (dev->dev_state & DEV_MISCONFIGURED) { - printk("v4l2 ioctl: device is misconfigured; " + printk(KERN_INFO "v4l2 ioctl: device is misconfigured; " "close and open it again\n"); return -EIO; } @@ -373,7 +369,7 @@ static void au0828_copy_video(struct au0828_dev *dev, if ((char *)startwrite + lencopy > (char *)outp + buf->vb.size) { - au0828_isocdbg("Overflow of %zi bytes past buffer end (2)\n", + au0828_isocdbg("Overflow %zi bytes past buf end (2)\n", ((char *)startwrite + lencopy) - ((char *)outp + buf->vb.size)); lencopy = remain = (char *)outp + buf->vb.size - @@ -389,9 +385,8 @@ static void au0828_copy_video(struct au0828_dev *dev, if (offset > 1440) { /* We have enough data to check for greenscreen */ - if (outp[0] < 0x60 && outp[1440] < 0x60) { + if (outp[0] < 0x60 && outp[1440] < 0x60) dev->greenscreen_detected = 1; - } } dma_q->pos += len; @@ -457,9 +452,9 @@ static inline int au0828_isoc_copy(struct au0828_dev *dev, struct urb *urb) continue; } - if (urb->iso_frame_desc[i].actual_length <= 0) { + if (urb->iso_frame_desc[i].actual_length <= 0) continue; - } + if (urb->iso_frame_desc[i].actual_length > dev->max_pkt_size) { au0828_isocdbg("packet bigger than packet size"); @@ -480,25 +475,23 @@ static inline int au0828_isoc_copy(struct au0828_dev *dev, struct urb *urb) if (buf != NULL) buffer_filled(dev, dma_q, buf); get_next_buf(dma_q, &buf); - if (buf == NULL) { + if (buf == NULL) outp = NULL; - } else + else outp = videobuf_to_vmalloc(&buf->vb); } if (buf != NULL) { - if (fbyte & 0x40) { + if (fbyte & 0x40) buf->top_field = 1; - } else { + else buf->top_field = 0; - } } dma_q->pos = 0; } - if (buf != NULL) { + if (buf != NULL) au0828_copy_video(dev, dma_q, buf, p, outp, len); - } } return rc; } @@ -566,7 +559,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, if (VIDEOBUF_NEEDS_INIT == buf->vb.state) { rc = videobuf_iolock(vq, &buf->vb, NULL); if (rc < 0) { - printk("videobuf_iolock failed\n"); + printk(KERN_INFO "videobuf_iolock failed\n"); goto fail; } } @@ -579,7 +572,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, AU0828_MAX_ISO_BUFS, dev->max_pkt_size, au0828_isoc_copy); if (rc < 0) { - printk("au0828_init_isoc failed\n"); + printk(KERN_INFO "au0828_init_isoc failed\n"); goto fail; } } @@ -681,11 +674,11 @@ static int au0828_stream_interrupt(struct au0828_dev *dev) int ret = 0; dev->stream_state = STREAM_INTERRUPT; - if(dev->dev_state == DEV_DISCONNECTED) + if (dev->dev_state == DEV_DISCONNECTED) return -ENODEV; - else if(ret) { + else if (ret) { dev->dev_state = DEV_MISCONFIGURED; - dprintk(1, "%s device is misconfigured!\n", __FUNCTION__); + dprintk(1, "%s device is misconfigured!\n", __func__); return ret; } return 0; @@ -753,23 +746,23 @@ static int au0828_v4l2_open(struct file *filp) list_for_each(list, &au0828_devlist) { h = list_entry(list, struct au0828_dev, au0828list); - if(h->vdev->minor == minor) { + if (h->vdev->minor == minor) { dev = h; type = V4L2_BUF_TYPE_VIDEO_CAPTURE; } #ifdef VBI_NOT_YET_WORKING - if(h->vbi_dev->minor == minor) { + if (h->vbi_dev->minor == minor) { dev = h; type = V4L2_BUF_TYPE_VBI_CAPTURE; } #endif } - if(NULL == dev) + if (NULL == dev) return -ENODEV; fh = kzalloc(sizeof(struct au0828_fh), GFP_KERNEL); - if(NULL == fh) { + if (NULL == fh) { dprintk(1, "Failed allocate au0828_fh struct!\n"); return -ENOMEM; } @@ -778,11 +771,11 @@ static int au0828_v4l2_open(struct file *filp) fh->dev = dev; filp->private_data = fh; - if(fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) { + if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) { /* set au0828 interface0 to AS5 here again */ ret = usb_set_interface(dev->usbdev, 0, 5); - if(ret < 0) { - printk("Au0828 can't set alt setting to 5!\n"); + if (ret < 0) { + printk(KERN_INFO "Au0828 can't set alternate to 5!\n"); return -EBUSY; } dev->width = NTSC_STD_W; @@ -821,11 +814,11 @@ static int au0828_v4l2_close(struct file *filp) if (res_check(fh)) res_free(fh); - if(dev->users == 1) { + if (dev->users == 1) { videobuf_stop(&fh->vb_vidq); videobuf_mmap_free(&fh->vb_vidq); - if(dev->dev_state & DEV_DISCONNECTED) { + if (dev->dev_state & DEV_DISCONNECTED) { au0828_analog_unregister(dev); mutex_unlock(&dev->lock); kfree(dev); @@ -839,8 +832,8 @@ static int au0828_v4l2_close(struct file *filp) /* When close the device, set the usb intf0 into alt0 to free USB bandwidth */ ret = usb_set_interface(dev->usbdev, 0, 0); - if(ret < 0) - printk("Au0828 can't set alt setting to 0!\n"); + if (ret < 0) + printk(KERN_INFO "Au0828 can't set alternate to 0!\n"); } kfree(fh); @@ -861,7 +854,7 @@ static ssize_t au0828_v4l2_read(struct file *filp, char __user *buf, if (rc < 0) return rc; - if(fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { + if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { mutex_lock(&dev->lock); rc = res_get(fh); mutex_unlock(&dev->lock); @@ -937,28 +930,25 @@ static int au0828_set_format(struct au0828_dev *dev, unsigned int cmd, maxheight = 480; #ifdef VBI_NOT_YET_WORKING - if(format->type == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) { + if (format->type == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) { dprintk(1, "VBI format set: to be supported!\n"); return 0; } - if(format->type == V4L2_BUF_TYPE_VBI_CAPTURE) { + if (format->type == V4L2_BUF_TYPE_VBI_CAPTURE) return 0; - } #endif - if(format->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { + if (format->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - } /* If they are demanding a format other than the one we support, bail out (tvtime asks for UYVY and then retries with YUYV) */ - if (format->fmt.pix.pixelformat != V4L2_PIX_FMT_UYVY) { + if (format->fmt.pix.pixelformat != V4L2_PIX_FMT_UYVY) return -EINVAL; - } /* format->fmt.pix.width only support 720 and height 480 */ - if(width != 720) + if (width != 720) width = 720; - if(height != 480) + if (height != 480) height = 480; format->fmt.pix.width = width; @@ -969,7 +959,7 @@ static int au0828_set_format(struct au0828_dev *dev, unsigned int cmd, format->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; format->fmt.pix.field = V4L2_FIELD_INTERLACED; - if(cmd == VIDIOC_TRY_FMT) + if (cmd == VIDIOC_TRY_FMT) return 0; /* maybe set new image format, driver current only support 720*480 */ @@ -979,9 +969,10 @@ static int au0828_set_format(struct au0828_dev *dev, unsigned int cmd, dev->field_size = width * height; dev->bytesperline = width * 2; - if(dev->stream_state == STREAM_ON) { + if (dev->stream_state == STREAM_ON) { dprintk(1, "VIDIOC_SET_FMT: interrupting stream!\n"); - if((ret = au0828_stream_interrupt(dev))) { + ret = au0828_stream_interrupt(dev); + if (ret != 0) { dprintk(1, "error interrupting video stream!\n"); return ret; } @@ -989,8 +980,8 @@ static int au0828_set_format(struct au0828_dev *dev, unsigned int cmd, /* set au0828 interface0 to AS5 here again */ ret = usb_set_interface(dev->usbdev, 0, 5); - if(ret < 0) { - printk("Au0828 can't set alt setting to 5!\n"); + if (ret < 0) { + printk(KERN_INFO "Au0828 can't set alt setting to 5!\n"); return -EBUSY; } @@ -1039,7 +1030,7 @@ static int vidioc_querycap(struct file *file, void *priv, static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - if(f->index) + if (f->index) return -EINVAL; f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; @@ -1084,13 +1075,13 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, int rc; if (videobuf_queue_is_busy(&fh->vb_vidq)) { - printk("%s queue busy\n", __func__); + printk(KERN_INFO "%s queue busy\n", __func__); rc = -EBUSY; goto out; } if (dev->stream_on && !fh->stream_on) { - printk("%s device in use by another fh\n", __func__); + printk(KERN_INFO "%s device in use by another fh\n", __func__); rc = -EBUSY; goto out; } @@ -1132,15 +1123,15 @@ static int vidioc_enum_input(struct file *file, void *priv, tmp = input->index; - if(tmp > AU0828_MAX_INPUT) + if (tmp > AU0828_MAX_INPUT) return -EINVAL; - if(AUVI_INPUT(tmp).type == 0) + if (AUVI_INPUT(tmp).type == 0) return -EINVAL; input->index = tmp; strcpy(input->name, inames[AUVI_INPUT(tmp).type]); - if((AUVI_INPUT(tmp).type == AU0828_VMUX_TELEVISION) || - (AUVI_INPUT(tmp).type == AU0828_VMUX_CABLE)) + if ((AUVI_INPUT(tmp).type == AU0828_VMUX_TELEVISION) || + (AUVI_INPUT(tmp).type == AU0828_VMUX_CABLE)) input->type |= V4L2_INPUT_TYPE_TUNER; else input->type |= V4L2_INPUT_TYPE_CAMERA; @@ -1165,15 +1156,15 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index) int i; struct v4l2_routing route; - dprintk(1, "VIDIOC_S_INPUT in function %s, input=%d\n", __FUNCTION__, + dprintk(1, "VIDIOC_S_INPUT in function %s, input=%d\n", __func__, index); - if(index >= AU0828_MAX_INPUT) + if (index >= AU0828_MAX_INPUT) return -EINVAL; - if(AUVI_INPUT(index).type == 0) + if (AUVI_INPUT(index).type == 0) return -EINVAL; dev->ctrl_input = index; - switch(AUVI_INPUT(index).type) { + switch (AUVI_INPUT(index).type) { case AU0828_VMUX_SVIDEO: dev->input_type = AU0828_VMUX_SVIDEO; break; @@ -1195,9 +1186,8 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index) for (i = 0; i < AU0828_MAX_INPUT; i++) { int enable = 0; - if (AUVI_INPUT(i).audio_setup == NULL) { + if (AUVI_INPUT(i).audio_setup == NULL) continue; - } if (i == index) enable = 1; @@ -1227,11 +1217,11 @@ static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a) struct au0828_dev *dev = fh->dev; unsigned int index = a->index; - if(a->index > 1) + if (a->index > 1) return -EINVAL; index = dev->ctrl_ainput; - if(index == 0) + if (index == 0) strcpy(a->name, "Television"); else strcpy(a->name, "Line in"); @@ -1245,7 +1235,7 @@ static int vidioc_s_audio(struct file *file, void *priv, struct v4l2_audio *a) { struct au0828_fh *fh = priv; struct au0828_dev *dev = fh->dev; - if(a->index != dev->ctrl_ainput) + if (a->index != dev->ctrl_ainput) return -EINVAL; return 0; } @@ -1275,7 +1265,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) struct au0828_fh *fh = priv; struct au0828_dev *dev = fh->dev; - if(t->index != 0) + if (t->index != 0) return -EINVAL; strcpy(t->name, "Auvitek tuner"); @@ -1290,7 +1280,7 @@ static int vidioc_s_tuner(struct file *file, void *priv, struct au0828_fh *fh = priv; struct au0828_dev *dev = fh->dev; - if(t->index != 0) + if (t->index != 0) return -EINVAL; t->type = V4L2_TUNER_ANALOG_TV; @@ -1318,9 +1308,9 @@ static int vidioc_s_frequency(struct file *file, void *priv, struct au0828_fh *fh = priv; struct au0828_dev *dev = fh->dev; - if(freq->tuner != 0) + if (freq->tuner != 0) return -EINVAL; - if(freq->type != V4L2_TUNER_ANALOG_TV) + if (freq->type != V4L2_TUNER_ANALOG_TV) return -EINVAL; dev->ctrl_freq = freq->frequency; @@ -1358,7 +1348,7 @@ static int vidioc_cropcap(struct file *file, void *priv, struct au0828_fh *fh = priv; struct au0828_dev *dev = fh->dev; - if(cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + if (cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; cc->bounds.left = 0; @@ -1422,14 +1412,14 @@ static int vidioc_streamoff(struct file *file, void *priv, if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { au0828_call_i2c_clients(dev, VIDIOC_STREAMOFF, &b); - if((ret = au0828_stream_interrupt(dev)) != 0) + ret = au0828_stream_interrupt(dev); + if (ret != 0) return ret; } for (i = 0; i < AU0828_MAX_INPUT; i++) { - if (AUVI_INPUT(i).audio_setup == NULL) { + if (AUVI_INPUT(i).audio_setup == NULL) continue; - } (AUVI_INPUT(i).audio_setup)(dev, 0); } @@ -1622,27 +1612,30 @@ int au0828_analog_register(struct au0828_dev *dev, /* set au0828 usb interface0 to as5 */ retval = usb_set_interface(dev->usbdev, - interface->cur_altsetting->desc.bInterfaceNumber, 5); + interface->cur_altsetting->desc.bInterfaceNumber, 5); if (retval != 0) { - printk("Failure setting usb interface0 to as5\n"); + printk(KERN_INFO "Failure setting usb interface0 to as5\n"); return retval; } /* Figure out which endpoint has the isoc interface */ iface_desc = interface->cur_altsetting; - for(i = 0; i < iface_desc->desc.bNumEndpoints; i++){ + for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) { endpoint = &iface_desc->endpoint[i].desc; - if(((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) && - ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_ISOC)){ + if (((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) + == USB_DIR_IN) && + ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) + == USB_ENDPOINT_XFER_ISOC)) { /* we find our isoc in endpoint */ u16 tmp = le16_to_cpu(endpoint->wMaxPacketSize); - dev->max_pkt_size = (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); + dev->max_pkt_size = (tmp & 0x07ff) * + (((tmp & 0x1800) >> 11) + 1); dev->isoc_in_endpointaddr = endpoint->bEndpointAddress; } } - if(!(dev->isoc_in_endpointaddr)) { - printk("Could not locate isoc endpoint\n"); + if (!(dev->isoc_in_endpointaddr)) { + printk(KERN_INFO "Could not locate isoc endpoint\n"); kfree(dev); return -ENODEV; } @@ -1663,14 +1656,14 @@ int au0828_analog_register(struct au0828_dev *dev, /* allocate and fill v4l2 video struct */ dev->vdev = video_device_alloc(); - if(NULL == dev->vdev) { + if (NULL == dev->vdev) { dprintk(1, "Can't allocate video_device.\n"); return -ENOMEM; } #ifdef VBI_NOT_YET_WORKING dev->vbi_dev = video_device_alloc(); - if(NULL == dev->vbi_dev) { + if (NULL == dev->vbi_dev) { dprintk(1, "Can't allocate vbi_device.\n"); kfree(dev->vdev); return -ENOMEM; @@ -1679,14 +1672,12 @@ int au0828_analog_register(struct au0828_dev *dev, /* Fill the video capture device struct */ *dev->vdev = au0828_video_template; - dev->vdev->vfl_type = VID_TYPE_CAPTURE | VID_TYPE_TUNER; dev->vdev->parent = &dev->usbdev->dev; strcpy(dev->vdev->name, "au0828a video"); #ifdef VBI_NOT_YET_WORKING /* Setup the VBI device */ *dev->vbi_dev = au0828_video_template; - dev->vbi_dev->vfl_type = VFL_TYPE_VBI; dev->vbi_dev->parent = &dev->usbdev->dev; strcpy(dev->vbi_dev->name, "au0828a vbi"); #endif @@ -1694,8 +1685,10 @@ int au0828_analog_register(struct au0828_dev *dev, list_add_tail(&dev->au0828list, &au0828_devlist); /* Register the v4l2 device */ - if((retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, -1)) != 0) { - dprintk(1, "unable to register video device (error = %d).\n", retval); + retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, -1); + if (retval != 0) { + dprintk(1, "unable to register video device (error = %d).\n", + retval); list_del(&dev->au0828list); video_device_release(dev->vdev); return -ENODEV; @@ -1703,8 +1696,10 @@ int au0828_analog_register(struct au0828_dev *dev, #ifdef VBI_NOT_YET_WORKING /* Register the vbi device */ - if((retval = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, -1)) != 0) { - dprintk(1, "unable to register vbi device (error = %d).\n", retval); + retval = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, -1); + if (retval != 0) { + dprintk(1, "unable to register vbi device (error = %d).\n", + retval); list_del(&dev->au0828list); video_device_release(dev->vbi_dev); video_device_release(dev->vdev); @@ -1712,7 +1707,7 @@ int au0828_analog_register(struct au0828_dev *dev, } #endif - dprintk(1, "%s completed!\n", __FUNCTION__); + dprintk(1, "%s completed!\n", __func__); return 0; } diff --git a/drivers/media/video/au0828/au0828.h b/drivers/media/video/au0828/au0828.h index 876b18cfbf5..6d9bd454ea5 100644 --- a/drivers/media/video/au0828/au0828.h +++ b/drivers/media/video/au0828/au0828.h @@ -54,16 +54,10 @@ /* Defination for AU0828 USB transfer */ #define AU0828_MAX_ISO_BUFS 12 /* maybe resize this value in the future */ #define AU0828_ISO_PACKETS_PER_URB 10 -#define AU0828_ISO_MAX_FRAME_SIZE (3 * 1024) -#define AU0828_ISO_BUFFER_SIZE (AU0828_ISO_PACKETS_PER_URB * AU0828_ISO_MAX_FRAME_SIZE) #define AU0828_MIN_BUF 4 #define AU0828_DEF_BUF 8 -#define AU0828_MAX_IMAGES 10 -#define AU0828_FRAME_SIZE (1028 * 1024 * 4) -#define AU0828_URB_TIMEOUT msecs_to_jiffies(AU0828_MAX_ISO_BUFS * AU0828_ISO_PACKETS_PER_URB) - #define AU0828_MAX_INPUT 4 enum au0828_itype { -- cgit v1.2.3