@@ -43,7 +43,7 @@ MODULE_PARM_DESC(init_fw, "Load firmware during driver initialization.");
43
43
static DEFINE_MUTEX (xc5000_list_mutex );
44
44
static LIST_HEAD (hybrid_tuner_instance_list );
45
45
46
- #define dprintk (level ,fmt , arg ...) if (debug >= level) \
46
+ #define dprintk (level , fmt , arg ...) if (debug >= level) \
47
47
printk(KERN_INFO "%s: " fmt, "xc5000", ## arg)
48
48
49
49
#define XC5000_DEFAULT_FIRMWARE "dvb-fe-xc5000-1.1.fw"
@@ -138,11 +138,11 @@ struct xc5000_priv {
138
138
immediately the length of the following transaction.
139
139
140
140
*/
141
- typedef struct {
141
+ struct XC_TV_STANDARD {
142
142
char * Name ;
143
143
u16 AudioMode ;
144
144
u16 VideoMode ;
145
- } XC_TV_STANDARD ;
145
+ };
146
146
147
147
/* Tuner standards */
148
148
#define MN_NTSC_PAL_BTSC 0
@@ -169,7 +169,7 @@ typedef struct {
169
169
#define FM_Radio_INPUT2 21
170
170
#define FM_Radio_INPUT1 22
171
171
172
- static XC_TV_STANDARD XC5000_Standard [MAX_TV_STANDARD ] = {
172
+ static struct XC_TV_STANDARD XC5000_Standard [MAX_TV_STANDARD ] = {
173
173
{"M/N-NTSC/PAL-BTSC" , 0x0400 , 0x8020 },
174
174
{"M/N-NTSC/PAL-A2" , 0x0600 , 0x8020 },
175
175
{"M/N-NTSC/PAL-EIAJ" , 0x0440 , 0x8020 },
@@ -183,7 +183,7 @@ static XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = {
183
183
{"D/K-PAL-NICAM" , 0x0E80 , 0x8009 },
184
184
{"D/K-PAL-MONO" , 0x1478 , 0x8009 },
185
185
{"D/K-SECAM-A2 DK1" , 0x1200 , 0x8009 },
186
- {"D/K-SECAM-A2 L/DK3" ,0x0E00 , 0x8009 },
186
+ {"D/K-SECAM-A2 L/DK3" , 0x0E00 , 0x8009 },
187
187
{"D/K-SECAM-A2 MONO" , 0x1478 , 0x8009 },
188
188
{"L-SECAM-NICAM" , 0x8E82 , 0x0009 },
189
189
{"L'-SECAM-NICAM" , 0x8E82 , 0x4009 },
@@ -307,9 +307,10 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence)
307
307
unsigned int len , pos , index ;
308
308
u8 buf [XC_MAX_I2C_WRITE_LENGTH ];
309
309
310
- index = 0 ;
311
- while ((i2c_sequence [index ]!= 0xFF ) || (i2c_sequence [index + 1 ]!= 0xFF )) {
312
- len = i2c_sequence [index ]* 256 + i2c_sequence [index + 1 ];
310
+ index = 0 ;
311
+ while ((i2c_sequence [index ] != 0xFF ) ||
312
+ (i2c_sequence [index + 1 ] != 0xFF )) {
313
+ len = i2c_sequence [index ] * 256 + i2c_sequence [index + 1 ];
313
314
if (len == 0x0000 ) {
314
315
/* RESET command */
315
316
result = xc_reset (fe );
@@ -329,15 +330,17 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence)
329
330
buf [1 ] = i2c_sequence [index + 1 ];
330
331
pos = 2 ;
331
332
while (pos < len ) {
332
- if ((len - pos ) > XC_MAX_I2C_WRITE_LENGTH - 2 ) {
333
- nbytes_to_send = XC_MAX_I2C_WRITE_LENGTH ;
334
- } else {
333
+ if ((len - pos ) > XC_MAX_I2C_WRITE_LENGTH - 2 )
334
+ nbytes_to_send =
335
+ XC_MAX_I2C_WRITE_LENGTH ;
336
+ else
335
337
nbytes_to_send = (len - pos + 2 );
338
+ for (i = 2 ; i < nbytes_to_send ; i ++ ) {
339
+ buf [i ] = i2c_sequence [index + pos +
340
+ i - 2 ];
336
341
}
337
- for (i = 2 ; i < nbytes_to_send ; i ++ ) {
338
- buf [i ] = i2c_sequence [index + pos + i - 2 ];
339
- }
340
- result = xc_send_i2c_data (priv , buf , nbytes_to_send );
342
+ result = xc_send_i2c_data (priv , buf ,
343
+ nbytes_to_send );
341
344
342
345
if (result != XC_RESULT_SUCCESS )
343
346
return result ;
@@ -386,8 +389,7 @@ static int xc_SetSignalSource(struct xc5000_priv *priv, u16 rf_mode)
386
389
dprintk (1 , "%s(%d) Source = %s\n" , __func__ , rf_mode ,
387
390
rf_mode == XC_RF_MODE_AIR ? "ANTENNA" : "CABLE" );
388
391
389
- if ((rf_mode != XC_RF_MODE_AIR ) && (rf_mode != XC_RF_MODE_CABLE ))
390
- {
392
+ if ((rf_mode != XC_RF_MODE_AIR ) && (rf_mode != XC_RF_MODE_CABLE )) {
391
393
rf_mode = XC_RF_MODE_CABLE ;
392
394
printk (KERN_ERR
393
395
"%s(), Invalid mode, defaulting to CABLE" ,
@@ -560,13 +562,13 @@ static int xc5000_readregs(struct xc5000_priv *priv, u8 *buf, u8 len)
560
562
.flags = I2C_M_RD , .buf = buf , .len = len };
561
563
562
564
if (i2c_transfer (priv -> i2c_props .adap , & msg , 1 ) != 1 ) {
563
- printk (KERN_ERR "xc5000 I2C read failed (len=%i)\n" ,(int )len );
565
+ printk (KERN_ERR "xc5000 I2C read failed (len=%i)\n" , (int )len );
564
566
return - EREMOTEIO ;
565
567
}
566
568
return 0 ;
567
569
}
568
570
569
- static int xc5000_fwupload (struct dvb_frontend * fe )
571
+ static int xc5000_fwupload (struct dvb_frontend * fe )
570
572
{
571
573
struct xc5000_priv * priv = fe -> tuner_priv ;
572
574
const struct firmware * fw ;
@@ -576,7 +578,8 @@ static int xc5000_fwupload(struct dvb_frontend* fe)
576
578
printk (KERN_INFO "xc5000: waiting for firmware upload (%s)...\n" ,
577
579
XC5000_DEFAULT_FIRMWARE );
578
580
579
- ret = request_firmware (& fw , XC5000_DEFAULT_FIRMWARE , & priv -> i2c_props .adap -> dev );
581
+ ret = request_firmware (& fw , XC5000_DEFAULT_FIRMWARE ,
582
+ & priv -> i2c_props .adap -> dev );
580
583
if (ret ) {
581
584
printk (KERN_ERR "xc5000: Upload failed. (file not found?)\n" );
582
585
ret = XC_RESULT_RESET_FAILURE ;
@@ -592,7 +595,7 @@ static int xc5000_fwupload(struct dvb_frontend* fe)
592
595
ret = XC_RESULT_RESET_FAILURE ;
593
596
} else {
594
597
printk (KERN_INFO "xc5000: firmware upload\n" );
595
- ret = xc_load_i2c_sequence (fe , fw -> data );
598
+ ret = xc_load_i2c_sequence (fe , fw -> data );
596
599
}
597
600
598
601
out :
@@ -651,7 +654,7 @@ static int xc5000_set_params(struct dvb_frontend *fe,
651
654
652
655
dprintk (1 , "%s() frequency=%d (Hz)\n" , __func__ , params -> frequency );
653
656
654
- switch (params -> u .vsb .modulation ) {
657
+ switch (params -> u .vsb .modulation ) {
655
658
case VSB_8 :
656
659
case VSB_16 :
657
660
dprintk (1 , "%s() VSB modulation\n" , __func__ );
@@ -748,50 +751,50 @@ static int xc5000_set_analog_params(struct dvb_frontend *fe,
748
751
/* FIX ME: Some video standards may have several possible audio
749
752
standards. We simply default to one of them here.
750
753
*/
751
- if (params -> std & V4L2_STD_MN ) {
754
+ if (params -> std & V4L2_STD_MN ) {
752
755
/* default to BTSC audio standard */
753
756
priv -> video_standard = MN_NTSC_PAL_BTSC ;
754
757
goto tune_channel ;
755
758
}
756
759
757
- if (params -> std & V4L2_STD_PAL_BG ) {
760
+ if (params -> std & V4L2_STD_PAL_BG ) {
758
761
/* default to NICAM audio standard */
759
762
priv -> video_standard = BG_PAL_NICAM ;
760
763
goto tune_channel ;
761
764
}
762
765
763
- if (params -> std & V4L2_STD_PAL_I ) {
766
+ if (params -> std & V4L2_STD_PAL_I ) {
764
767
/* default to NICAM audio standard */
765
768
priv -> video_standard = I_PAL_NICAM ;
766
769
goto tune_channel ;
767
770
}
768
771
769
- if (params -> std & V4L2_STD_PAL_DK ) {
772
+ if (params -> std & V4L2_STD_PAL_DK ) {
770
773
/* default to NICAM audio standard */
771
774
priv -> video_standard = DK_PAL_NICAM ;
772
775
goto tune_channel ;
773
776
}
774
777
775
- if (params -> std & V4L2_STD_SECAM_DK ) {
778
+ if (params -> std & V4L2_STD_SECAM_DK ) {
776
779
/* default to A2 DK1 audio standard */
777
780
priv -> video_standard = DK_SECAM_A2DK1 ;
778
781
goto tune_channel ;
779
782
}
780
783
781
- if (params -> std & V4L2_STD_SECAM_L ) {
784
+ if (params -> std & V4L2_STD_SECAM_L ) {
782
785
priv -> video_standard = L_SECAM_NICAM ;
783
786
goto tune_channel ;
784
787
}
785
788
786
- if (params -> std & V4L2_STD_SECAM_LC ) {
789
+ if (params -> std & V4L2_STD_SECAM_LC ) {
787
790
priv -> video_standard = LC_SECAM_NICAM ;
788
791
goto tune_channel ;
789
792
}
790
793
791
794
tune_channel :
792
795
ret = xc_SetSignalSource (priv , priv -> rf_mode );
793
796
if (ret != XC_RESULT_SUCCESS ) {
794
- printk (KERN_ERR
797
+ printk (KERN_ERR
795
798
"xc5000: xc_SetSignalSource(%d) failed\n" ,
796
799
priv -> rf_mode );
797
800
return - EREMOTEIO ;
@@ -863,7 +866,7 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe)
863
866
* I2C transactions until calibration is complete. This way we
864
867
* don't have to rely on clock stretching working.
865
868
*/
866
- xc_wait ( 100 );
869
+ xc_wait (100 );
867
870
868
871
/* Default to "CABLE" mode */
869
872
ret |= xc_write_reg (priv , XREG_SIGNALSOURCE , XC_RF_MODE_CABLE );
@@ -885,15 +888,13 @@ static int xc5000_sleep(struct dvb_frontend *fe)
885
888
*/
886
889
887
890
ret = xc_shutdown (priv );
888
- if (ret != XC_RESULT_SUCCESS ) {
891
+ if (ret != XC_RESULT_SUCCESS ) {
889
892
printk (KERN_ERR
890
893
"xc5000: %s() unable to shutdown tuner\n" ,
891
894
__func__ );
892
895
return - EREMOTEIO ;
893
- }
894
- else {
896
+ } else
895
897
return XC_RESULT_SUCCESS ;
896
- }
897
898
}
898
899
899
900
static int xc5000_init (struct dvb_frontend * fe )
@@ -989,7 +990,7 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
989
990
if (xc5000_readreg (priv , XREG_PRODUCT_ID , & id ) != 0 )
990
991
goto fail ;
991
992
992
- switch (id ) {
993
+ switch (id ) {
993
994
case XC_PRODUCT_ID_FW_LOADED :
994
995
printk (KERN_INFO
995
996
"xc5000: Successfully identified at address 0x%02x\n" ,
0 commit comments