xref: /linux/drivers/media/usb/as102/as102_drv.h (revision fada1935590f66dc6784981e0d557ca09013c847)
1d6317c68SMauro Carvalho Chehab /*
2d6317c68SMauro Carvalho Chehab  * Abilis Systems Single DVB-T Receiver
3d6317c68SMauro Carvalho Chehab  * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com>
4d6317c68SMauro Carvalho Chehab  *
5d6317c68SMauro Carvalho Chehab  * This program is free software; you can redistribute it and/or modify
6d6317c68SMauro Carvalho Chehab  * it under the terms of the GNU General Public License as published by
7d6317c68SMauro Carvalho Chehab  * the Free Software Foundation; either version 2, or (at your option)
8d6317c68SMauro Carvalho Chehab  * any later version.
9d6317c68SMauro Carvalho Chehab  *
10d6317c68SMauro Carvalho Chehab  * This program is distributed in the hope that it will be useful,
11d6317c68SMauro Carvalho Chehab  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12d6317c68SMauro Carvalho Chehab  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13d6317c68SMauro Carvalho Chehab  * GNU General Public License for more details.
14d6317c68SMauro Carvalho Chehab  */
15d6317c68SMauro Carvalho Chehab 
1647f79129SMauro Carvalho Chehab #ifndef _AS102_DRV_H
1747f79129SMauro Carvalho Chehab #define _AS102_DRV_H
18d6317c68SMauro Carvalho Chehab #include <linux/usb.h>
19*fada1935SMauro Carvalho Chehab #include <media/dvb_demux.h>
20*fada1935SMauro Carvalho Chehab #include <media/dvb_frontend.h>
21*fada1935SMauro Carvalho Chehab #include <media/dmxdev.h>
2247f79129SMauro Carvalho Chehab #include "as10x_handle.h"
23d6317c68SMauro Carvalho Chehab #include "as10x_cmd.h"
24d6317c68SMauro Carvalho Chehab #include "as102_usb_drv.h"
25d6317c68SMauro Carvalho Chehab 
26d6317c68SMauro Carvalho Chehab #define DRIVER_FULL_NAME "Abilis Systems as10x usb driver"
27d6317c68SMauro Carvalho Chehab #define DRIVER_NAME "as10x_usb"
28d6317c68SMauro Carvalho Chehab 
29d6317c68SMauro Carvalho Chehab #define debug	as102_debug
30d6317c68SMauro Carvalho Chehab extern struct usb_driver as102_usb_driver;
31d6317c68SMauro Carvalho Chehab extern int elna_enable;
32d6317c68SMauro Carvalho Chehab 
33d6317c68SMauro Carvalho Chehab #define AS102_DEVICE_MAJOR	192
34d6317c68SMauro Carvalho Chehab 
35d6317c68SMauro Carvalho Chehab #define AS102_USB_BUF_SIZE	512
36d6317c68SMauro Carvalho Chehab #define MAX_STREAM_URB		32
37d6317c68SMauro Carvalho Chehab 
38d6317c68SMauro Carvalho Chehab struct as10x_bus_adapter_t {
39d6317c68SMauro Carvalho Chehab 	struct usb_device *usb_dev;
40d6317c68SMauro Carvalho Chehab 	/* bus token lock */
41d6317c68SMauro Carvalho Chehab 	struct mutex lock;
42d6317c68SMauro Carvalho Chehab 	/* low level interface for bus adapter */
43d6317c68SMauro Carvalho Chehab 	union as10x_bus_token_t {
44d6317c68SMauro Carvalho Chehab 		/* usb token */
45d6317c68SMauro Carvalho Chehab 		struct as10x_usb_token_cmd_t usb;
46d6317c68SMauro Carvalho Chehab 	} token;
47d6317c68SMauro Carvalho Chehab 
48d6317c68SMauro Carvalho Chehab 	/* token cmd xfer id */
49d6317c68SMauro Carvalho Chehab 	uint16_t cmd_xid;
50d6317c68SMauro Carvalho Chehab 
51d6317c68SMauro Carvalho Chehab 	/* as10x command and response for dvb interface*/
52d6317c68SMauro Carvalho Chehab 	struct as10x_cmd_t *cmd, *rsp;
53d6317c68SMauro Carvalho Chehab 
54d6317c68SMauro Carvalho Chehab 	/* bus adapter private ops callback */
55f691ba98SJulia Lawall 	const struct as102_priv_ops_t *ops;
56d6317c68SMauro Carvalho Chehab };
57d6317c68SMauro Carvalho Chehab 
58d6317c68SMauro Carvalho Chehab struct as102_dev_t {
59d6317c68SMauro Carvalho Chehab 	const char *name;
60d6317c68SMauro Carvalho Chehab 	struct as10x_bus_adapter_t bus_adap;
61d6317c68SMauro Carvalho Chehab 	struct list_head device_entry;
62d6317c68SMauro Carvalho Chehab 	struct kref kref;
63d6317c68SMauro Carvalho Chehab 	uint8_t elna_cfg;
64d6317c68SMauro Carvalho Chehab 
65d6317c68SMauro Carvalho Chehab 	struct dvb_adapter dvb_adap;
66b601d9a5SMauro Carvalho Chehab 	struct dvb_frontend *dvb_fe;
67d6317c68SMauro Carvalho Chehab 	struct dvb_demux dvb_dmx;
68d6317c68SMauro Carvalho Chehab 	struct dmxdev dvb_dmxdev;
69d6317c68SMauro Carvalho Chehab 
70d6317c68SMauro Carvalho Chehab 	/* timer handle to trig ts stream download */
71d6317c68SMauro Carvalho Chehab 	struct timer_list timer_handle;
72d6317c68SMauro Carvalho Chehab 
73d6317c68SMauro Carvalho Chehab 	struct mutex sem;
74d6317c68SMauro Carvalho Chehab 	dma_addr_t dma_addr;
75d6317c68SMauro Carvalho Chehab 	void *stream;
76d6317c68SMauro Carvalho Chehab 	int streaming;
77d6317c68SMauro Carvalho Chehab 	struct urb *stream_urb[MAX_STREAM_URB];
78d6317c68SMauro Carvalho Chehab };
79d6317c68SMauro Carvalho Chehab 
80d6317c68SMauro Carvalho Chehab int as102_dvb_register(struct as102_dev_t *dev);
81d6317c68SMauro Carvalho Chehab void as102_dvb_unregister(struct as102_dev_t *dev);
82d6317c68SMauro Carvalho Chehab 
8347f79129SMauro Carvalho Chehab #endif
84