174ba9207SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
225aee3deSMauro Carvalho Chehab /*
325aee3deSMauro Carvalho Chehab Hopper VP-3028 driver
425aee3deSMauro Carvalho Chehab
525aee3deSMauro Carvalho Chehab Copyright (C) Manu Abraham (abraham.manu@gmail.com)
625aee3deSMauro Carvalho Chehab
725aee3deSMauro Carvalho Chehab */
825aee3deSMauro Carvalho Chehab
925aee3deSMauro Carvalho Chehab #include <linux/signal.h>
1025aee3deSMauro Carvalho Chehab #include <linux/sched.h>
1125aee3deSMauro Carvalho Chehab #include <linux/interrupt.h>
1225aee3deSMauro Carvalho Chehab
13fada1935SMauro Carvalho Chehab #include <media/dmxdev.h>
14fada1935SMauro Carvalho Chehab #include <media/dvbdev.h>
15fada1935SMauro Carvalho Chehab #include <media/dvb_demux.h>
16fada1935SMauro Carvalho Chehab #include <media/dvb_frontend.h>
17fada1935SMauro Carvalho Chehab #include <media/dvb_net.h>
1825aee3deSMauro Carvalho Chehab
1925aee3deSMauro Carvalho Chehab #include "zl10353.h"
2025aee3deSMauro Carvalho Chehab #include "mantis_common.h"
2125aee3deSMauro Carvalho Chehab #include "mantis_ioc.h"
2225aee3deSMauro Carvalho Chehab #include "mantis_dvb.h"
2325aee3deSMauro Carvalho Chehab #include "hopper_vp3028.h"
2425aee3deSMauro Carvalho Chehab
25967a3783SHans Verkuil static struct zl10353_config hopper_vp3028_config = {
2625aee3deSMauro Carvalho Chehab .demod_address = 0x0f,
2725aee3deSMauro Carvalho Chehab };
2825aee3deSMauro Carvalho Chehab
2925aee3deSMauro Carvalho Chehab #define MANTIS_MODEL_NAME "VP-3028"
3025aee3deSMauro Carvalho Chehab #define MANTIS_DEV_TYPE "DVB-T"
3125aee3deSMauro Carvalho Chehab
vp3028_frontend_init(struct mantis_pci * mantis,struct dvb_frontend * fe)3225aee3deSMauro Carvalho Chehab static int vp3028_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
3325aee3deSMauro Carvalho Chehab {
3425aee3deSMauro Carvalho Chehab struct i2c_adapter *adapter = &mantis->adapter;
3525aee3deSMauro Carvalho Chehab struct mantis_hwconfig *config = mantis->hwconfig;
36*6814e218SColin Ian King int err;
3725aee3deSMauro Carvalho Chehab
3825aee3deSMauro Carvalho Chehab mantis_gpio_set_bits(mantis, config->reset, 0);
3925aee3deSMauro Carvalho Chehab msleep(100);
4025aee3deSMauro Carvalho Chehab err = mantis_frontend_power(mantis, POWER_ON);
4125aee3deSMauro Carvalho Chehab msleep(100);
4225aee3deSMauro Carvalho Chehab mantis_gpio_set_bits(mantis, config->reset, 1);
4325aee3deSMauro Carvalho Chehab
4425aee3deSMauro Carvalho Chehab err = mantis_frontend_power(mantis, POWER_ON);
4525aee3deSMauro Carvalho Chehab if (err == 0) {
4625aee3deSMauro Carvalho Chehab msleep(250);
4725aee3deSMauro Carvalho Chehab dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");
4825aee3deSMauro Carvalho Chehab fe = dvb_attach(zl10353_attach, &hopper_vp3028_config, adapter);
4925aee3deSMauro Carvalho Chehab
5025aee3deSMauro Carvalho Chehab if (!fe)
5125aee3deSMauro Carvalho Chehab return -1;
5225aee3deSMauro Carvalho Chehab } else {
5325aee3deSMauro Carvalho Chehab dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
5425aee3deSMauro Carvalho Chehab adapter->name,
5525aee3deSMauro Carvalho Chehab err);
5625aee3deSMauro Carvalho Chehab
5725aee3deSMauro Carvalho Chehab return -EIO;
5825aee3deSMauro Carvalho Chehab }
5925aee3deSMauro Carvalho Chehab dprintk(MANTIS_ERROR, 1, "Done!");
6025aee3deSMauro Carvalho Chehab
6125aee3deSMauro Carvalho Chehab return 0;
6225aee3deSMauro Carvalho Chehab }
6325aee3deSMauro Carvalho Chehab
6425aee3deSMauro Carvalho Chehab struct mantis_hwconfig vp3028_config = {
6525aee3deSMauro Carvalho Chehab .model_name = MANTIS_MODEL_NAME,
6625aee3deSMauro Carvalho Chehab .dev_type = MANTIS_DEV_TYPE,
6725aee3deSMauro Carvalho Chehab .ts_size = MANTIS_TS_188,
6825aee3deSMauro Carvalho Chehab
6925aee3deSMauro Carvalho Chehab .baud_rate = MANTIS_BAUD_9600,
7025aee3deSMauro Carvalho Chehab .parity = MANTIS_PARITY_NONE,
7125aee3deSMauro Carvalho Chehab .bytes = 0,
7225aee3deSMauro Carvalho Chehab
7325aee3deSMauro Carvalho Chehab .frontend_init = vp3028_frontend_init,
7425aee3deSMauro Carvalho Chehab .power = GPIF_A00,
7525aee3deSMauro Carvalho Chehab .reset = GPIF_A03,
7625aee3deSMauro Carvalho Chehab };
77