aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-04-22 13:45:14 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:07:45 -0400
commitc2cb8fcc006ce59255de67e3fe9f65fb79db633b (patch)
tree336e6e5e22688032249500d04327f527d1d1a94f /drivers
parent8efd2e28265ca031072d8d94cdbdd53904ce9b2d (diff)
V4L/DVB (7256): cx88: Add support for tuner-xc3028
Callback gpio's based on Markus Rechberger, Christopher Pascoe and Steven Toth patches. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/cx88/cx88-cards.c91
-rw-r--r--drivers/media/video/cx88/cx88-mpeg.c2
2 files changed, 79 insertions, 14 deletions
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index a1756c6c6dca..3e07fbe4c843 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -27,6 +27,7 @@
27 27
28#include "cx88.h" 28#include "cx88.h"
29#include "tea5767.h" 29#include "tea5767.h"
30#include "tuner-xc2028.h"
30 31
31static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; 32static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
32static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; 33static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
@@ -1908,26 +1909,63 @@ static void dvico_fusionhdtv_hybrid_init(struct cx88_core *core)
1908 } 1909 }
1909} 1910}
1910 1911
1912static int cx88_xc2028_tuner_callback(void *priv, int command, int arg)
1913{
1914 struct i2c_algo_bit_data *i2c_algo = priv;
1915 struct cx88_core *core = i2c_algo->data;
1916
1917 switch (command) {
1918 case XC2028_TUNER_RESET:
1919 {
1920 switch (INPUT(core->input).type) {
1921 case CX88_RADIO:
1922 printk(KERN_INFO "setting GPIO to radio!\n");
1923 cx_write(MO_GP0_IO, 0x4ff);
1924 mdelay(250);
1925 cx_write(MO_GP2_IO, 0xff);
1926 mdelay(250);
1927 cx_write(MO_GP1_IO, 0x101010);
1928 mdelay(250);
1929 cx_write(MO_GP1_IO, 0x101000);
1930 mdelay(250);
1931 cx_write(MO_GP1_IO, 0x101010);
1932 mdelay(250);
1933 return 0;
1934 case CX88_VMUX_DVB: /* Digital TV*/
1935 default: /* Analog TV */
1936 printk(KERN_INFO "setting GPIO to TV!\n");
1937 cx_write(MO_GP1_IO, 0x101010);
1938 mdelay(250);
1939 cx_write(MO_GP1_IO, 0x101000);
1940 mdelay(250);
1941 cx_write(MO_GP1_IO, 0x101010);
1942 mdelay(250);
1943 return 0;
1944 }
1945 }
1946 }
1947 return -EINVAL;
1948}
1949
1911/* ----------------------------------------------------------------------- */ 1950/* ----------------------------------------------------------------------- */
1912/* Tuner callback function. Currently only needed for the Pinnacle * 1951/* Tuner callback function. Currently only needed for the Pinnacle *
1913 * PCTV HD 800i with an xc5000 sillicon tuner. This is used for both * 1952 * PCTV HD 800i with an xc5000 sillicon tuner. This is used for both *
1914 * analog tuner attach (tuner-core.c) and dvb tuner attach (cx88-dvb.c) */ 1953 * analog tuner attach (tuner-core.c) and dvb tuner attach (cx88-dvb.c) */
1915 1954
1916int cx88_tuner_callback(void *priv, int command, int arg) 1955static int cx88_xc5000_tuner_callback(void *priv, int command, int arg)
1917{ 1956{
1918 struct i2c_algo_bit_data *i2c_algo = priv; 1957 struct i2c_algo_bit_data *i2c_algo = priv;
1919 struct cx88_core *core = i2c_algo->data; 1958 struct cx88_core *core = i2c_algo->data;
1920 1959
1921 switch(core->boardnr) { 1960 switch (core->boardnr) {
1922 case CX88_BOARD_PINNACLE_PCTV_HD_800i: 1961 case CX88_BOARD_PINNACLE_PCTV_HD_800i:
1923 if(command == 0) { /* This is the reset command from xc5000 */ 1962 if (command == 0) { /* This is the reset command from xc5000 */
1924 /* Reset XC5000 tuner via SYS_RSTO_pin */ 1963 /* Reset XC5000 tuner via SYS_RSTO_pin */
1925 cx_write(MO_SRST_IO, 0); 1964 cx_write(MO_SRST_IO, 0);
1926 msleep(10); 1965 msleep(10);
1927 cx_write(MO_SRST_IO, 1); 1966 cx_write(MO_SRST_IO, 1);
1928 return 0; 1967 return 0;
1929 } 1968 } else {
1930 else {
1931 printk(KERN_ERR 1969 printk(KERN_ERR
1932 "xc5000: unknown tuner callback command.\n"); 1970 "xc5000: unknown tuner callback command.\n");
1933 return -EINVAL; 1971 return -EINVAL;
@@ -1936,6 +1974,20 @@ int cx88_tuner_callback(void *priv, int command, int arg)
1936 } 1974 }
1937 return 0; /* Should never be here */ 1975 return 0; /* Should never be here */
1938} 1976}
1977
1978int cx88_tuner_callback(void *priv, int command, int arg)
1979{
1980 struct i2c_algo_bit_data *i2c_algo = priv;
1981 struct cx88_core *core = i2c_algo->data;
1982
1983 switch (core->board.tuner_type) {
1984 case TUNER_XC2028:
1985 return cx88_xc2028_tuner_callback(priv, command, arg);
1986 case TUNER_XC5000:
1987 return cx88_xc5000_tuner_callback(priv, command, arg);
1988 }
1989 return -EINVAL;
1990}
1939EXPORT_SYMBOL(cx88_tuner_callback); 1991EXPORT_SYMBOL(cx88_tuner_callback);
1940 1992
1941/* ----------------------------------------------------------------------- */ 1993/* ----------------------------------------------------------------------- */
@@ -2090,6 +2142,26 @@ static void cx88_card_setup(struct cx88_core *core)
2090 cx88_call_i2c_clients(core, TUNER_SET_CONFIG, &tea5767_cfg); 2142 cx88_call_i2c_clients(core, TUNER_SET_CONFIG, &tea5767_cfg);
2091 } 2143 }
2092 } 2144 }
2145
2146 if (core->board.tuner_type == TUNER_XC2028) {
2147 struct v4l2_priv_tun_config xc2028_cfg;
2148 struct xc2028_ctrl ctl;
2149
2150 memset(&xc2028_cfg, 0, sizeof(ctl));
2151 memset(&ctl, 0, sizeof(ctl));
2152
2153 ctl.fname = XC2028_DEFAULT_FIRMWARE;
2154 ctl.max_len = 64;
2155 /* FIXME: Those should be device-dependent */
2156 ctl.demod = XC3028_FE_OREN538;
2157 ctl.mts = 1;
2158
2159 xc2028_cfg.tuner = TUNER_XC2028;
2160 xc2028_cfg.priv = &ctl;
2161
2162 cx88_call_i2c_clients(core, TUNER_SET_CONFIG, &xc2028_cfg);
2163 }
2164
2093} 2165}
2094 2166
2095/* ------------------------------------------------------------------ */ 2167/* ------------------------------------------------------------------ */
@@ -2235,12 +2307,3 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
2235 2307
2236 return core; 2308 return core;
2237} 2309}
2238
2239/* ------------------------------------------------------------------ */
2240
2241/*
2242 * Local variables:
2243 * c-basic-offset: 8
2244 * End:
2245 * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off
2246 */
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index a02cabbab778..6467ca336142 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -613,6 +613,8 @@ static int cx8802_request_acquire(struct cx8802_driver *drv)
613 core->active_type_id != drv->type_id) 613 core->active_type_id != drv->type_id)
614 return -EBUSY; 614 return -EBUSY;
615 615
616 core->input = CX88_VMUX_DVB;
617
616 if (drv->advise_acquire) 618 if (drv->advise_acquire)
617 { 619 {
618 mutex_lock(&drv->core->lock); 620 mutex_lock(&drv->core->lock);