Re: Fwd: XC4000: code cleanup

2011-06-04 Thread Mauro Carvalho Chehab
Em 03-06-2011 10:11, Mauro Carvalho Chehab escreveu:
> 
> 
>  Mensagem original 
> Assunto: XC4000: code cleanup
> Data: Fri, 03 Jun 2011 12:02:15 +0200
> De: istva...@mailbox.hu 
> Para: Devin Heitmueller 
> CC: Dmitri Belimov ,Mauro Carvalho Chehab 
> , thunde...@email.cz,linux-...@linuxtv.org
> 
> This is the first of a set of patches that update the original xc4000
> sources to my modified version. It removes some unused code, and makes
> a few minor formatting changes.
> 
> Signed-off-by: Istvan Varga 
> 

This patch broke compilation:

drivers/media/common/tuners/xc4000.c: In function ‘xc_tune_channel’:
drivers/media/common/tuners/xc4000.c:497: error: ‘XC_TUNE_ANALOG’ undeclared 
(first use in this function)
drivers/media/common/tuners/xc4000.c:497: error: (Each undeclared identifier is 
reported only once
drivers/media/common/tuners/xc4000.c:497: error: for each function it appears 
in.)
drivers/media/common/tuners/xc4000.c: In function ‘xc4000_set_params’:
drivers/media/common/tuners/xc4000.c:1232: error: ‘XC_TUNE_DIGITAL’ undeclared 
(first use in this function)
drivers/media/common/tuners/xc4000.c: In function ‘xc4000_set_analog_params’:
drivers/media/common/tuners/xc4000.c:1323: error: ‘XC_TUNE_ANALOG’ undeclared 
(first use in this function)
make[3]: ** [drivers/media/common/tuners/xc4000.o] Erro 1

I've re-added XC_TUNE_ANALOG/XC_TUNE_DIGITAL defines to it.

Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Fwd: XC4000: code cleanup

2011-06-03 Thread Mauro Carvalho Chehab
Em 03-06-2011 10:11, Mauro Carvalho Chehab escreveu:
> 
> 
>  Mensagem original 
> Assunto: XC4000: code cleanup
> Data: Fri, 03 Jun 2011 12:02:15 +0200
> De: istva...@mailbox.hu 
> Para: Devin Heitmueller 
> CC: Dmitri Belimov ,Mauro Carvalho Chehab 
> , thunde...@email.cz,linux-...@linuxtv.org
> 
> This is the first of a set of patches that update the original xc4000
> sources to my modified version. It removes some unused code, and makes
> a few minor formatting changes.
> 
> Signed-off-by: Istvan Varga 
> 

Patch applied at:

git://linuxtv.org/git/mchehab/experimental.git xc4000

Thanks!
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Fwd: XC4000: code cleanup

2011-06-03 Thread Mauro Carvalho Chehab


 Mensagem original 
Assunto: XC4000: code cleanup
Data: Fri, 03 Jun 2011 12:02:15 +0200
De: istva...@mailbox.hu 
Para: Devin Heitmueller 
CC: Dmitri Belimov ,Mauro Carvalho Chehab 
, thunde...@email.cz,linux-...@linuxtv.org

This is the first of a set of patches that update the original xc4000
sources to my modified version. It removes some unused code, and makes
a few minor formatting changes.

Signed-off-by: Istvan Varga 

diff -uNr xc4000_orig/drivers/media/common/tuners/xc4000.c xc4000/drivers/media/common/tuners/xc4000.c
--- xc4000_orig/drivers/media/common/tuners/xc4000.c	2011-06-02 17:36:36.0 +0200
+++ xc4000/drivers/media/common/tuners/xc4000.c	2011-06-03 11:50:53.0 +0200
@@ -55,8 +55,6 @@
 /* Note that the last version digit is my internal build number (so I can
rev the firmware even if the core Xceive firmware was unchanged) */
 #define XC4000_DEFAULT_FIRMWARE "dvb-fe-xc4000-1.4.1.fw"
-#define XC4000_DEFAULT_FIRMWARE_SIZE 18643
-
 
 /* struct for storing firmware table */
 struct firmware_description {
@@ -80,18 +78,18 @@
 	struct tuner_i2c_props i2c_props;
 	struct list_head hybrid_tuner_instance_list;
 	struct firmware_description *firm;
-	int			firm_size;
-	__u16			firm_version;
-	u32 if_khz;
-	u32 freq_hz;
-	u32 bandwidth;
-	u8  video_standard;
-	u8  rf_mode;
-//	struct xc2028_ctrl	ctrl;
+	int	firm_size;
+	__u16	firm_version;
+	u32	if_khz;
+	u32	freq_hz;
+	u32	bandwidth;
+	u8	video_standard;
+	u8	rf_mode;
+	u8	ignore_i2c_write_errors;
+ /*	struct xc2028_ctrl	ctrl; */
 	struct firmware_properties cur_fw;
-	__u16			hwmodel;
-	__u16			hwvers;
-	u8 ignore_i2c_write_errors;
+	__u16	hwmodel;
+	__u16	hwvers;
 };
 
 /* Misc Defines */
@@ -167,12 +165,12 @@
 
For the RESET and WAIT commands, the two following bytes will contain
immediately the length of the following transaction.
-
 */
+
 struct XC_TV_STANDARD {
-	char *Name;
-	u16 AudioMode;
-	u16 VideoMode;
+	const char  *Name;
+	u16	AudioMode;
+	u16	VideoMode;
 };
 
 /* Tuner standards */
@@ -200,33 +198,6 @@
 #define XC4000_FM_Radio_INPUT2		21
 #define XC4000_FM_Radio_INPUT1	22
 
-/* WAS :
-static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = {
-	{"M/N-NTSC/PAL-BTSC", 0x0400, 0x8020},
-	{"M/N-NTSC/PAL-A2",   0x0600, 0x8020},
-	{"M/N-NTSC/PAL-EIAJ", 0x0440, 0x8020},
-	{"M/N-NTSC/PAL-Mono", 0x0478, 0x8020},
-	{"B/G-PAL-A2",0x0A00, 0x8049},
-	{"B/G-PAL-NICAM", 0x0C04, 0x8049},
-	{"B/G-PAL-MONO",  0x0878, 0x8059},
-	{"I-PAL-NICAM",   0x1080, 0x8009},
-	{"I-PAL-NICAM-MONO",  0x0E78, 0x8009},
-	{"D/K-PAL-A2",0x1600, 0x8009},
-	{"D/K-PAL-NICAM", 0x0E80, 0x8009},
-	{"D/K-PAL-MONO",  0x1478, 0x8009},
-	{"D/K-SECAM-A2 DK1",  0x1200, 0x8009},
-	{"D/K-SECAM-A2 L/DK3", 0x0E00, 0x8009},
-	{"D/K-SECAM-A2 MONO", 0x1478, 0x8009},
-	{"L-SECAM-NICAM", 0x8E82, 0x0009},
-	{"L'-SECAM-NICAM",0x8E82, 0x4009},
-	{"DTV6",  0x00C0, 0x8002},
-	{"DTV8",  0x00C0, 0x800B},
-	{"DTV7/8",0x00C0, 0x801B},
-	{"DTV7",  0x00C0, 0x8007},
-	{"FM Radio-INPUT2",   0x9802, 0x9002},
-	{"FM Radio-INPUT1",   0x0208, 0x9002}
-};*/
-
 static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = {
 	{"M/N-NTSC/PAL-BTSC", 0x, 0x8020},
 	{"M/N-NTSC/PAL-A2",   0x, 0x8020},
@@ -253,7 +224,6 @@
 	{"FM Radio-INPUT1",   0x0008, 0x9000}
 };
 
-static int xc4000_is_firmware_loaded(struct dvb_frontend *fe);
 static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val);
 static int xc4000_TunerReset(struct dvb_frontend *fe);
 
@@ -275,10 +245,6 @@
 	return XC_RESULT_SUCCESS;
 }
 
-/* This routine is never used because the only time we read data from the
-   i2c bus is when we read registers, and we want that to be an atomic i2c
-   transaction in case we are on a multi-master bus */
-
 static void xc_wait(int wait_ms)
 {
 	msleep(wait_ms);
@@ -431,7 +397,6 @@
 	return xc_write_reg(priv, XREG_RF_FREQ, freq_code); /* WAS: XREG_FINERFREQ */
 }
 
-
 static int xc_get_ADC_Envelope(struct xc4000_priv *priv, u16 *adc_envelope)
 {
 	return xc4000_readreg(priv, XREG_ADC_ENV, adc_envelope);
@@ -476,12 +441,6 @@
 	return 0;
 }
 
-/* WAS THERE
-static int xc_get_buildversion(struct xc4000_priv *priv, u16 *buildrev)
-{
-	return xc4000_readreg(priv, XREG_BUILD, buildrev);
-}*/
-
 static int xc_get_hsync_freq(struct xc4000_priv *priv, u32 *hsync_freq_hz)
 {
 	u16 regData;
@@ -520,12 +479,10 @@
 	return lockState;
 }
 
-#define XC_TUNE_ANALOG  0
-#define XC_TUNE_DIGITAL 1
 static int xc_tune_channel(struct xc4000_priv *priv, u32 freq_hz, int mode)
 {
-	int found = 0;
-	int result = 0;
+	int	found = 0;
+	int	result = 0;
 
 	dprintk(1, "%s(%u)\n", __func__, freq_hz);
 
@@ -694,7 +651,6 @@
 	if (best_nr_matches > 0) {
 		printk("Selecting best matching firmware (%d bits) for "
 			  "type=", best_nr_matches);
-//		dump_firm_type(type);
 		printk("(%x), id %016llx:\n", type, (unsigned long long)*id);
 		i = best_i;
 		goto found;
@@ -7

Fwd: XC4000: code cleanup

2011-06-03 Thread Mauro Carvalho Chehab


 Mensagem original 
Assunto: XC4000: code cleanup
Data: Fri, 03 Jun 2011 12:02:15 +0200
De: istva...@mailbox.hu 
Para: Devin Heitmueller 
CC: Dmitri Belimov ,Mauro Carvalho Chehab 
, thunde...@email.cz,linux-...@linuxtv.org

This is the first of a set of patches that update the original xc4000
sources to my modified version. It removes some unused code, and makes
a few minor formatting changes.

Signed-off-by: Istvan Varga 

diff -uNr xc4000_orig/drivers/media/common/tuners/xc4000.c xc4000/drivers/media/common/tuners/xc4000.c
--- xc4000_orig/drivers/media/common/tuners/xc4000.c	2011-06-02 17:36:36.0 +0200
+++ xc4000/drivers/media/common/tuners/xc4000.c	2011-06-03 11:50:53.0 +0200
@@ -55,8 +55,6 @@
 /* Note that the last version digit is my internal build number (so I can
rev the firmware even if the core Xceive firmware was unchanged) */
 #define XC4000_DEFAULT_FIRMWARE "dvb-fe-xc4000-1.4.1.fw"
-#define XC4000_DEFAULT_FIRMWARE_SIZE 18643
-
 
 /* struct for storing firmware table */
 struct firmware_description {
@@ -80,18 +78,18 @@
 	struct tuner_i2c_props i2c_props;
 	struct list_head hybrid_tuner_instance_list;
 	struct firmware_description *firm;
-	int			firm_size;
-	__u16			firm_version;
-	u32 if_khz;
-	u32 freq_hz;
-	u32 bandwidth;
-	u8  video_standard;
-	u8  rf_mode;
-//	struct xc2028_ctrl	ctrl;
+	int	firm_size;
+	__u16	firm_version;
+	u32	if_khz;
+	u32	freq_hz;
+	u32	bandwidth;
+	u8	video_standard;
+	u8	rf_mode;
+	u8	ignore_i2c_write_errors;
+ /*	struct xc2028_ctrl	ctrl; */
 	struct firmware_properties cur_fw;
-	__u16			hwmodel;
-	__u16			hwvers;
-	u8 ignore_i2c_write_errors;
+	__u16	hwmodel;
+	__u16	hwvers;
 };
 
 /* Misc Defines */
@@ -167,12 +165,12 @@
 
For the RESET and WAIT commands, the two following bytes will contain
immediately the length of the following transaction.
-
 */
+
 struct XC_TV_STANDARD {
-	char *Name;
-	u16 AudioMode;
-	u16 VideoMode;
+	const char  *Name;
+	u16	AudioMode;
+	u16	VideoMode;
 };
 
 /* Tuner standards */
@@ -200,33 +198,6 @@
 #define XC4000_FM_Radio_INPUT2		21
 #define XC4000_FM_Radio_INPUT1	22
 
-/* WAS :
-static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = {
-	{"M/N-NTSC/PAL-BTSC", 0x0400, 0x8020},
-	{"M/N-NTSC/PAL-A2",   0x0600, 0x8020},
-	{"M/N-NTSC/PAL-EIAJ", 0x0440, 0x8020},
-	{"M/N-NTSC/PAL-Mono", 0x0478, 0x8020},
-	{"B/G-PAL-A2",0x0A00, 0x8049},
-	{"B/G-PAL-NICAM", 0x0C04, 0x8049},
-	{"B/G-PAL-MONO",  0x0878, 0x8059},
-	{"I-PAL-NICAM",   0x1080, 0x8009},
-	{"I-PAL-NICAM-MONO",  0x0E78, 0x8009},
-	{"D/K-PAL-A2",0x1600, 0x8009},
-	{"D/K-PAL-NICAM", 0x0E80, 0x8009},
-	{"D/K-PAL-MONO",  0x1478, 0x8009},
-	{"D/K-SECAM-A2 DK1",  0x1200, 0x8009},
-	{"D/K-SECAM-A2 L/DK3", 0x0E00, 0x8009},
-	{"D/K-SECAM-A2 MONO", 0x1478, 0x8009},
-	{"L-SECAM-NICAM", 0x8E82, 0x0009},
-	{"L'-SECAM-NICAM",0x8E82, 0x4009},
-	{"DTV6",  0x00C0, 0x8002},
-	{"DTV8",  0x00C0, 0x800B},
-	{"DTV7/8",0x00C0, 0x801B},
-	{"DTV7",  0x00C0, 0x8007},
-	{"FM Radio-INPUT2",   0x9802, 0x9002},
-	{"FM Radio-INPUT1",   0x0208, 0x9002}
-};*/
-
 static struct XC_TV_STANDARD XC4000_Standard[MAX_TV_STANDARD] = {
 	{"M/N-NTSC/PAL-BTSC", 0x, 0x8020},
 	{"M/N-NTSC/PAL-A2",   0x, 0x8020},
@@ -253,7 +224,6 @@
 	{"FM Radio-INPUT1",   0x0008, 0x9000}
 };
 
-static int xc4000_is_firmware_loaded(struct dvb_frontend *fe);
 static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val);
 static int xc4000_TunerReset(struct dvb_frontend *fe);
 
@@ -275,10 +245,6 @@
 	return XC_RESULT_SUCCESS;
 }
 
-/* This routine is never used because the only time we read data from the
-   i2c bus is when we read registers, and we want that to be an atomic i2c
-   transaction in case we are on a multi-master bus */
-
 static void xc_wait(int wait_ms)
 {
 	msleep(wait_ms);
@@ -431,7 +397,6 @@
 	return xc_write_reg(priv, XREG_RF_FREQ, freq_code); /* WAS: XREG_FINERFREQ */
 }
 
-
 static int xc_get_ADC_Envelope(struct xc4000_priv *priv, u16 *adc_envelope)
 {
 	return xc4000_readreg(priv, XREG_ADC_ENV, adc_envelope);
@@ -476,12 +441,6 @@
 	return 0;
 }
 
-/* WAS THERE
-static int xc_get_buildversion(struct xc4000_priv *priv, u16 *buildrev)
-{
-	return xc4000_readreg(priv, XREG_BUILD, buildrev);
-}*/
-
 static int xc_get_hsync_freq(struct xc4000_priv *priv, u32 *hsync_freq_hz)
 {
 	u16 regData;
@@ -520,12 +479,10 @@
 	return lockState;
 }
 
-#define XC_TUNE_ANALOG  0
-#define XC_TUNE_DIGITAL 1
 static int xc_tune_channel(struct xc4000_priv *priv, u32 freq_hz, int mode)
 {
-	int found = 0;
-	int result = 0;
+	int	found = 0;
+	int	result = 0;
 
 	dprintk(1, "%s(%u)\n", __func__, freq_hz);
 
@@ -694,7 +651,6 @@
 	if (best_nr_matches > 0) {
 		printk("Selecting best matching firmware (%d bits) for "
 			  "type=", best_nr_matches);
-//		dump_firm_type(type);
 		printk("(%x), id %016llx:\n", type, (unsigned long long)*id);
 		i = best_i;
 		goto found;
@@ -7