saa7134-dvb.c (a00e68888d5d2b583b13d7d58204a27207af95fd) | saa7134-dvb.c (2ada815fc48bb0267876c2c24b275bd06485f746) |
---|---|
1/* 2 * 3 * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] 4 * 5 * Extended 3 / 2005 by Hartmut Hackmann to support various 6 * cards with the tda10046 DVB-T channel decoder 7 * 8 * This program is free software; you can redistribute it and/or modify --- 588 unchanged lines hidden (view full) --- 597 } 598 return 0; 599} 600 601static int configure_tda827x_fe(struct saa7134_dev *dev, 602 struct tda1004x_config *cdec_conf, 603 struct tda827x_config *tuner_conf) 604{ | 1/* 2 * 3 * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] 4 * 5 * Extended 3 / 2005 by Hartmut Hackmann to support various 6 * cards with the tda10046 DVB-T channel decoder 7 * 8 * This program is free software; you can redistribute it and/or modify --- 588 unchanged lines hidden (view full) --- 597 } 598 return 0; 599} 600 601static int configure_tda827x_fe(struct saa7134_dev *dev, 602 struct tda1004x_config *cdec_conf, 603 struct tda827x_config *tuner_conf) 604{ |
605 struct videobuf_dvb_frontend *fe0; | 605 struct vb2_dvb_frontend *fe0; |
606 607 /* Get the first frontend */ | 606 607 /* Get the first frontend */ |
608 fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); | 608 fe0 = vb2_dvb_get_frontend(&dev->frontends, 1); |
609 610 if (!fe0) 611 return -EINVAL; 612 613 fe0->dvb.frontend = dvb_attach(tda10046_attach, cdec_conf, &dev->i2c_adap); 614 if (fe0->dvb.frontend) { 615 if (cdec_conf->i2c_gate) 616 fe0->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; --- 593 unchanged lines hidden (view full) --- 1210/* ================================================================== 1211 * Core code 1212 */ 1213 1214static int dvb_init(struct saa7134_dev *dev) 1215{ 1216 int ret; 1217 int attach_xc3028 = 0; | 609 610 if (!fe0) 611 return -EINVAL; 612 613 fe0->dvb.frontend = dvb_attach(tda10046_attach, cdec_conf, &dev->i2c_adap); 614 if (fe0->dvb.frontend) { 615 if (cdec_conf->i2c_gate) 616 fe0->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; --- 593 unchanged lines hidden (view full) --- 1210/* ================================================================== 1211 * Core code 1212 */ 1213 1214static int dvb_init(struct saa7134_dev *dev) 1215{ 1216 int ret; 1217 int attach_xc3028 = 0; |
1218 struct videobuf_dvb_frontend *fe0; | 1218 struct vb2_dvb_frontend *fe0; 1219 struct vb2_queue *q; |
1219 1220 /* FIXME: add support for multi-frontend */ 1221 mutex_init(&dev->frontends.lock); 1222 INIT_LIST_HEAD(&dev->frontends.felist); 1223 1224 printk(KERN_INFO "%s() allocating 1 frontend\n", __func__); | 1220 1221 /* FIXME: add support for multi-frontend */ 1222 mutex_init(&dev->frontends.lock); 1223 INIT_LIST_HEAD(&dev->frontends.felist); 1224 1225 printk(KERN_INFO "%s() allocating 1 frontend\n", __func__); |
1225 fe0 = videobuf_dvb_alloc_frontend(&dev->frontends, 1); | 1226 fe0 = vb2_dvb_alloc_frontend(&dev->frontends, 1); |
1226 if (!fe0) { 1227 printk(KERN_ERR "%s() failed to alloc\n", __func__); 1228 return -ENOMEM; 1229 } 1230 | 1227 if (!fe0) { 1228 printk(KERN_ERR "%s() failed to alloc\n", __func__); 1229 return -ENOMEM; 1230 } 1231 |
1231 /* init struct videobuf_dvb */ | 1232 /* init struct vb2_dvb */ |
1232 dev->ts.nr_bufs = 32; 1233 dev->ts.nr_packets = 32*4; 1234 fe0->dvb.name = dev->name; | 1233 dev->ts.nr_bufs = 32; 1234 dev->ts.nr_packets = 32*4; 1235 fe0->dvb.name = dev->name; |
1235 videobuf_queue_sg_init(&fe0->dvb.dvbq, &saa7134_ts_qops, 1236 &dev->pci->dev, &dev->slock, 1237 V4L2_BUF_TYPE_VIDEO_CAPTURE, 1238 V4L2_FIELD_ALTERNATE, 1239 sizeof(struct saa7134_buf), 1240 &dev->ts_q, NULL); | 1236 q = &fe0->dvb.dvbq; 1237 q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1238 q->io_modes = VB2_MMAP | VB2_READ; 1239 q->drv_priv = &dev->ts_q; 1240 q->ops = &saa7134_ts_qops; 1241 q->mem_ops = &vb2_dma_sg_memops; 1242 q->buf_struct_size = sizeof(struct saa7134_buf); 1243 q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; 1244 q->lock = &dev->lock; 1245 ret = vb2_queue_init(q); 1246 if (ret) { 1247 vb2_dvb_dealloc_frontends(&dev->frontends); 1248 return ret; 1249 } |
1241 1242 switch (dev->board) { 1243 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: 1244 dprintk("pinnacle 300i dvb setup\n"); 1245 fe0->dvb.frontend = dvb_attach(mt352_attach, &pinnacle_300i, 1246 &dev->i2c_adap); 1247 if (fe0->dvb.frontend) { 1248 fe0->dvb.frontend->ops.tuner_ops.set_params = mt352_pinnacle_tuner_set_params; --- 622 unchanged lines hidden (view full) --- 1871 if (NULL == fe0->dvb.frontend) { 1872 printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name); 1873 goto detach_frontend; 1874 } 1875 /* define general-purpose callback pointer */ 1876 fe0->dvb.frontend->callback = saa7134_tuner_callback; 1877 1878 /* register everything else */ | 1250 1251 switch (dev->board) { 1252 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: 1253 dprintk("pinnacle 300i dvb setup\n"); 1254 fe0->dvb.frontend = dvb_attach(mt352_attach, &pinnacle_300i, 1255 &dev->i2c_adap); 1256 if (fe0->dvb.frontend) { 1257 fe0->dvb.frontend->ops.tuner_ops.set_params = mt352_pinnacle_tuner_set_params; --- 622 unchanged lines hidden (view full) --- 1880 if (NULL == fe0->dvb.frontend) { 1881 printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name); 1882 goto detach_frontend; 1883 } 1884 /* define general-purpose callback pointer */ 1885 fe0->dvb.frontend->callback = saa7134_tuner_callback; 1886 1887 /* register everything else */ |
1879 ret = videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev, | 1888 ret = vb2_dvb_register_bus(&dev->frontends, THIS_MODULE, dev, |
1880 &dev->pci->dev, adapter_nr, 0); 1881 1882 /* this sequence is necessary to make the tda1004x load its firmware 1883 * and to enter analog mode of hybrid boards 1884 */ 1885 if (!ret) { 1886 if (fe0->dvb.frontend->ops.init) 1887 fe0->dvb.frontend->ops.init(fe0->dvb.frontend); 1888 if (fe0->dvb.frontend->ops.sleep) 1889 fe0->dvb.frontend->ops.sleep(fe0->dvb.frontend); 1890 if (fe0->dvb.frontend->ops.tuner_ops.sleep) 1891 fe0->dvb.frontend->ops.tuner_ops.sleep(fe0->dvb.frontend); 1892 } 1893 return ret; 1894 1895detach_frontend: | 1889 &dev->pci->dev, adapter_nr, 0); 1890 1891 /* this sequence is necessary to make the tda1004x load its firmware 1892 * and to enter analog mode of hybrid boards 1893 */ 1894 if (!ret) { 1895 if (fe0->dvb.frontend->ops.init) 1896 fe0->dvb.frontend->ops.init(fe0->dvb.frontend); 1897 if (fe0->dvb.frontend->ops.sleep) 1898 fe0->dvb.frontend->ops.sleep(fe0->dvb.frontend); 1899 if (fe0->dvb.frontend->ops.tuner_ops.sleep) 1900 fe0->dvb.frontend->ops.tuner_ops.sleep(fe0->dvb.frontend); 1901 } 1902 return ret; 1903 1904detach_frontend: |
1896 videobuf_dvb_dealloc_frontends(&dev->frontends); | 1905 vb2_dvb_dealloc_frontends(&dev->frontends); 1906 vb2_queue_release(&fe0->dvb.dvbq); |
1897 return -EINVAL; 1898} 1899 1900static int dvb_fini(struct saa7134_dev *dev) 1901{ | 1907 return -EINVAL; 1908} 1909 1910static int dvb_fini(struct saa7134_dev *dev) 1911{ |
1902 struct videobuf_dvb_frontend *fe0; | 1912 struct vb2_dvb_frontend *fe0; |
1903 1904 /* Get the first frontend */ | 1913 1914 /* Get the first frontend */ |
1905 fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); | 1915 fe0 = vb2_dvb_get_frontend(&dev->frontends, 1); |
1906 if (!fe0) 1907 return -EINVAL; 1908 1909 /* FIXME: I suspect that this code is bogus, since the entry for 1910 Pinnacle 300I DVB-T PAL already defines the proper init to allow 1911 the detection of mt2032 (TDA9887_PORT2_INACTIVE) 1912 */ 1913 if (dev->board == SAA7134_BOARD_PINNACLE_300I_DVBT_PAL) { --- 14 unchanged lines hidden (view full) --- 1928 fe = fe0->dvb.frontend; 1929 if (fe->ops.i2c_gate_ctrl) { 1930 fe->ops.i2c_gate_ctrl(fe, 1); 1931 i2c_transfer(&dev->i2c_adap, &msg, 1); 1932 fe->ops.i2c_gate_ctrl(fe, 0); 1933 } 1934 } 1935 } | 1916 if (!fe0) 1917 return -EINVAL; 1918 1919 /* FIXME: I suspect that this code is bogus, since the entry for 1920 Pinnacle 300I DVB-T PAL already defines the proper init to allow 1921 the detection of mt2032 (TDA9887_PORT2_INACTIVE) 1922 */ 1923 if (dev->board == SAA7134_BOARD_PINNACLE_300I_DVBT_PAL) { --- 14 unchanged lines hidden (view full) --- 1938 fe = fe0->dvb.frontend; 1939 if (fe->ops.i2c_gate_ctrl) { 1940 fe->ops.i2c_gate_ctrl(fe, 1); 1941 i2c_transfer(&dev->i2c_adap, &msg, 1); 1942 fe->ops.i2c_gate_ctrl(fe, 0); 1943 } 1944 } 1945 } |
1936 videobuf_dvb_unregister_bus(&dev->frontends); | 1946 vb2_dvb_unregister_bus(&dev->frontends); 1947 vb2_queue_release(&fe0->dvb.dvbq); |
1937 return 0; 1938} 1939 1940static struct saa7134_mpeg_ops dvb_ops = { 1941 .type = SAA7134_MPEG_DVB, 1942 .init = dvb_init, 1943 .fini = dvb_fini, 1944}; --- 13 unchanged lines hidden --- | 1948 return 0; 1949} 1950 1951static struct saa7134_mpeg_ops dvb_ops = { 1952 .type = SAA7134_MPEG_DVB, 1953 .init = dvb_init, 1954 .fini = dvb_fini, 1955}; --- 13 unchanged lines hidden --- |