Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / media / pci / mantis / hopper_vp3028.c
blobce1e8737b14b523472e305881db8a1c1681ce9ae
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 Hopper VP-3028 driver
5 Copyright (C) Manu Abraham (abraham.manu@gmail.com)
7 */
9 #include <linux/signal.h>
10 #include <linux/sched.h>
11 #include <linux/interrupt.h>
13 #include <media/dmxdev.h>
14 #include <media/dvbdev.h>
15 #include <media/dvb_demux.h>
16 #include <media/dvb_frontend.h>
17 #include <media/dvb_net.h>
19 #include "zl10353.h"
20 #include "mantis_common.h"
21 #include "mantis_ioc.h"
22 #include "mantis_dvb.h"
23 #include "hopper_vp3028.h"
25 static struct zl10353_config hopper_vp3028_config = {
26 .demod_address = 0x0f,
29 #define MANTIS_MODEL_NAME "VP-3028"
30 #define MANTIS_DEV_TYPE "DVB-T"
32 static int vp3028_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
34 struct i2c_adapter *adapter = &mantis->adapter;
35 struct mantis_hwconfig *config = mantis->hwconfig;
36 int err;
38 mantis_gpio_set_bits(mantis, config->reset, 0);
39 msleep(100);
40 err = mantis_frontend_power(mantis, POWER_ON);
41 msleep(100);
42 mantis_gpio_set_bits(mantis, config->reset, 1);
44 err = mantis_frontend_power(mantis, POWER_ON);
45 if (err == 0) {
46 msleep(250);
47 dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");
48 fe = dvb_attach(zl10353_attach, &hopper_vp3028_config, adapter);
50 if (!fe)
51 return -1;
52 } else {
53 dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
54 adapter->name,
55 err);
57 return -EIO;
59 dprintk(MANTIS_ERROR, 1, "Done!");
61 return 0;
64 struct mantis_hwconfig vp3028_config = {
65 .model_name = MANTIS_MODEL_NAME,
66 .dev_type = MANTIS_DEV_TYPE,
67 .ts_size = MANTIS_TS_188,
69 .baud_rate = MANTIS_BAUD_9600,
70 .parity = MANTIS_PARITY_NONE,
71 .bytes = 0,
73 .frontend_init = vp3028_frontend_init,
74 .power = GPIF_A00,
75 .reset = GPIF_A03,