From 7b0ac9cdd42b254ae2ec0f6c1cc6389655e4ba96 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Fri, 13 Jan 2006 14:10:25 -0200 Subject: V4L/DVB (3359): Redesign tuners struct for maximum flexibility - Tunertype struct redefined to allow one or more tuner_params structs per tuner definition, one for each video standard. - Each tuner_params struct has an element containing an arbitrary amount of tuner_ranges. (this is needed for dvb tuners - to be handled later) - A tuner_range may be referenced by multiple tuner_params structs. There are many duplicates in here. Reusing tuner_range structs, rather than defining new ones for each tuner, will cut down on memory usage, and is preferred when possible. - tunertype struct contains an element, has_tda988x. We must set this for all tunertypes that contain a tda988x chip, and then we can remove this setting from the various card structs. - Improves tuners array memory usage efficiency. - Right now, all tuners are using the first tuner_params[] array element for analog mode. In the future, we will be merging similar tuner definitions together, such that each tuner definition will have a tuner_params struct for each available video standard. At that point, the tuner_params[] array element will be chosen based on the video standard in use. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- include/media/tuner-types.h | 41 +++++++++++++++++++++++++++++++++++++++++ include/media/tuner.h | 1 + 2 files changed, 42 insertions(+) create mode 100644 include/media/tuner-types.h (limited to 'include') diff --git a/include/media/tuner-types.h b/include/media/tuner-types.h new file mode 100644 index 00000000000..9f6e4a98c40 --- /dev/null +++ b/include/media/tuner-types.h @@ -0,0 +1,41 @@ +/* + * descriptions for simple tuners. + */ + +#ifndef __TUNER_TYPES_H__ +#define __TUNER_TYPES_H__ + +enum param_type { + TUNER_PARAM_TYPE_RADIO, \ + TUNER_PARAM_TYPE_PAL, \ + TUNER_PARAM_TYPE_SECAM, \ + TUNER_PARAM_TYPE_NTSC, \ + TUNER_PARAM_TYPE_ATSC, \ + TUNER_PARAM_TYPE_DVBT, \ + TUNER_PARAM_TYPE_DVBS, \ + TUNER_PARAM_TYPE_DVBC +}; + +struct tuner_range { + unsigned short limit; + unsigned char cb; +}; + +struct tuner_params { + enum param_type type; + unsigned char config; /* to be moved into struct tuner_range for dvb-pll merge */ + + unsigned int count; + struct tuner_range *ranges; +}; + +struct tunertype { + char *name; + unsigned int has_tda988x:1; + struct tuner_params *params; +}; + +extern struct tunertype tuners[]; +extern unsigned const int tuner_count; + +#endif diff --git a/include/media/tuner.h b/include/media/tuner.h index 27cbf08c931..c88b506971c 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h @@ -23,6 +23,7 @@ #define _TUNER_H #include +#include #define ADDR_UNSET (255) -- cgit v1.2.3 From b3d37042d7d33baf0247d1df31031e64427f39b3 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 13 Jan 2006 14:10:25 -0200 Subject: V4L/DVB (3363): Add support for Samsung tuner TCPN 2121P30A - Add support for Samsung tuner TCPN 2121P30A, used in Hauppauge PVR-500 cards. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/tuner.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/media/tuner.h b/include/media/tuner.h index c88b506971c..a1d63787bc0 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h @@ -115,6 +115,7 @@ #define TUNER_PHILIPS_TUV1236D 68 /* ATI HDTV Wonder */ #define TUNER_TNF_5335MF 69 /* Sabrent Bt848 */ +#define TUNER_SAMSUNG_TCPN_2121P30A 70 /* Hauppauge PVR-500MCE NTSC */ /* tv card specific */ #define TDA9887_PRESENT (1<<0) -- cgit v1.2.3 From c943aa859c392eb4cc76d911daa1f261555075b2 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Fri, 13 Jan 2006 14:10:26 -0200 Subject: V4L/DVB (3364): disable all dvb tuner param_types until we need them - Add param_type dvbs2 - disable all dvb param_types, which will not be needed until we merge dvb-pll. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- include/media/tuner-types.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'include') diff --git a/include/media/tuner-types.h b/include/media/tuner-types.h index 9f6e4a98c40..64b16b1f192 100644 --- a/include/media/tuner-types.h +++ b/include/media/tuner-types.h @@ -9,11 +9,7 @@ enum param_type { TUNER_PARAM_TYPE_RADIO, \ TUNER_PARAM_TYPE_PAL, \ TUNER_PARAM_TYPE_SECAM, \ - TUNER_PARAM_TYPE_NTSC, \ - TUNER_PARAM_TYPE_ATSC, \ - TUNER_PARAM_TYPE_DVBT, \ - TUNER_PARAM_TYPE_DVBS, \ - TUNER_PARAM_TYPE_DVBC + TUNER_PARAM_TYPE_NTSC }; struct tuner_range { -- cgit v1.2.3 From 436eddd035c0ff807f4c64551a5a6edc7fb299d0 Mon Sep 17 00:00:00 2001 From: Tyler Trafford Date: Fri, 13 Jan 2006 14:38:18 -0200 Subject: V4L/DVB (3365): i2c ids for upd64031a saa717x upd64083 wm8739 - Add i2c ids for drivers: upd64031a saa717x upd64083 wm8739 Signed-off-by: Tyler Trafford Signed-off-by: Mauro Carvalho Chehab --- include/linux/i2c-id.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index 6ff2d365895..474c8f4f5d4 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h @@ -104,6 +104,10 @@ #define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */ #define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */ #define I2C_DRIVERID_TVP5150 76 /* TVP5150 video decoder */ +#define I2C_DRIVERID_WM8739 77 /* wm8739 audio processor */ +#define I2C_DRIVERID_UPD64083 78 /* upd64083 video processor */ +#define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */ +#define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */ #define I2C_DRIVERID_I2CDEV 900 #define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ -- cgit v1.2.3 From 8f0bb9c069fc487dadebe4cdd1e03f0df5ebf0e6 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 15 Jan 2006 12:46:18 -0200 Subject: V4L/DVB (3383): Move tda988x options into tuner_params struct. - Tda988x parameters should be defined per tuner_param_type, for each tuner_params array member. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- include/media/tuner-types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/media/tuner-types.h b/include/media/tuner-types.h index 64b16b1f192..75669318899 100644 --- a/include/media/tuner-types.h +++ b/include/media/tuner-types.h @@ -19,6 +19,7 @@ struct tuner_range { struct tuner_params { enum param_type type; + unsigned int tda988x; unsigned char config; /* to be moved into struct tuner_range for dvb-pll merge */ unsigned int count; @@ -27,7 +28,6 @@ struct tuner_params { struct tunertype { char *name; - unsigned int has_tda988x:1; struct tuner_params *params; }; -- cgit v1.2.3 From 27487d44712aaa37710cc508d5bd6119f5e9f976 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 15 Jan 2006 15:04:52 -0200 Subject: V4L/DVB (3384): Separate tv & radio freqs, fix cb/freq transmit order for tuners that need this. - Moved MSP_SET_MATRIX to v4l2-common.h - Fix typos and integer overflows in tea5767.c - Split old freq field into a tv_freq and a radio_freq. Prevents that a radio tuner is initialized with a tv frequency or vice versa. - When switching to radio mode initialize the tuner with the last used radio frequency (this was already done for the TV mode). As a result of these changes the tuner module now remembers the last set radio and TV frequencies, which is what you would expect to happen. - Move out of range frequencies to the closest valid frequency as per v4l2 API spec. - Fix incorrect initial radio frequency (multiplier is 16000, not 16) - Add boundary check for out of range frequencies. - Use new flag to check if the order of the CB and freq. depends on the last set frequency. That is needed for some tuners or you can get static as a result. The flag is added for those tuners where I know that the datasheet indicates that this is necessary. - For this new check use the last set div value, not the last frequency as radio frequencies are always much higher due to the 16000 multiplier. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/tuner-types.h | 18 ++++++++++++++++++ include/media/tuner.h | 8 +++++--- include/media/v4l2-common.h | 7 +++++++ 3 files changed, 30 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/media/tuner-types.h b/include/media/tuner-types.h index 75669318899..b37d59d5a10 100644 --- a/include/media/tuner-types.h +++ b/include/media/tuner-types.h @@ -20,6 +20,24 @@ struct tuner_range { struct tuner_params { enum param_type type; unsigned int tda988x; + /* Many Philips based tuners have a comment like this in their + * datasheet: + * + * For channel selection involving band switching, and to ensure + * smooth tuning to the desired channel without causing + * unnecessary charge pump action, it is recommended to consider + * the difference between wanted channel frequency and the + * current channel frequency. Unnecessary charge pump action + * will result in very low tuning voltage which may drive the + * oscillator to extreme conditions. + * + * Set this flag to 1 if this tuner needs this check. + * + * I tested this for PAL by first setting the TV frequency to + * 203 MHz and then switching to 96.6 MHz FM radio. The result was + * static unless the control byte was sent first. + */ + unsigned int cb_first_if_lower_freq:1; unsigned char config; /* to be moved into struct tuner_range for dvb-pll merge */ unsigned int count; diff --git a/include/media/tuner.h b/include/media/tuner.h index a1d63787bc0..a5beeac495c 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h @@ -179,7 +179,9 @@ struct tuner { unsigned int mode; unsigned int mode_mask; /* Combination of allowable modes */ - unsigned int freq; /* keep track of the current settings */ + unsigned int tv_freq; /* keep track of the current settings */ + unsigned int radio_freq; + u16 last_div; unsigned int audmode; v4l2_std_id std; @@ -197,8 +199,8 @@ struct tuner { unsigned int sgIF; /* function ptrs */ - void (*tv_freq)(struct i2c_client *c, unsigned int freq); - void (*radio_freq)(struct i2c_client *c, unsigned int freq); + void (*set_tv_freq)(struct i2c_client *c, unsigned int freq); + void (*set_radio_freq)(struct i2c_client *c, unsigned int freq); int (*has_signal)(struct i2c_client *c); int (*is_stereo)(struct i2c_client *c); void (*standby)(struct i2c_client *c); diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index c74052abb18..d4030a7e16e 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -120,6 +120,13 @@ enum v4l2_chip_ident { /* select from TV,radio,extern,MUTE */ #define AUDC_SET_INPUT _IOW('d',89,int) +/* msp3400 ioctl: will be removed in the near future */ +struct msp_matrix { + int input; + int output; +}; +#define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix) + /* tuner ioctls */ /* Sets tuner type and its I2C addr */ #define TUNER_SET_TYPE_ADDR _IOW('d',90,int) -- cgit v1.2.3 From 01872c5d253298b9f360c7c9b9f33504b6ad5469 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 15 Jan 2006 15:47:02 -0200 Subject: V4L/DVB (3387): clean up some comments - clean up some comments Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- include/media/tuner-types.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/media/tuner-types.h b/include/media/tuner-types.h index b37d59d5a10..9f0e9c1cb6f 100644 --- a/include/media/tuner-types.h +++ b/include/media/tuner-types.h @@ -31,7 +31,8 @@ struct tuner_params { * will result in very low tuning voltage which may drive the * oscillator to extreme conditions. * - * Set this flag to 1 if this tuner needs this check. + * Set cb_first_if_lower_freq to 1, if this check is + * required for this tuner. * * I tested this for PAL by first setting the TV frequency to * 203 MHz and then switching to 96.6 MHz FM radio. The result was -- cgit v1.2.3 From de03d21b908bd4c49f1fe7b0c4dc5876551cf819 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 15 Jan 2006 16:04:04 -0200 Subject: V4L/DVB (3388): tuner_params->tda988x is currently unused, so disable - Tuner_params->tda988x is unused right now, so let's disable it for 2.6.16 - This is currently happening at the card level, but the plan is to move this configuration into the tuner_params configuration. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- include/media/tuner-types.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include') diff --git a/include/media/tuner-types.h b/include/media/tuner-types.h index 9f0e9c1cb6f..15821ab14a9 100644 --- a/include/media/tuner-types.h +++ b/include/media/tuner-types.h @@ -19,7 +19,6 @@ struct tuner_range { struct tuner_params { enum param_type type; - unsigned int tda988x; /* Many Philips based tuners have a comment like this in their * datasheet: * @@ -31,7 +30,7 @@ struct tuner_params { * will result in very low tuning voltage which may drive the * oscillator to extreme conditions. * - * Set cb_first_if_lower_freq to 1, if this check is + * Set cb_first_if_lower_freq to 1, if this check is * required for this tuner. * * I tested this for PAL by first setting the TV frequency to -- cgit v1.2.3