blob: 4fdcd8cb753010416bbbf1d7c271208541b4b157 [file] [log] [blame]
Henrik Kureliddf4846c2008-08-01 10:00:45 +02001/*
Stefan Richter612262a2008-08-26 00:17:30 +02002 * FireDTV driver (formerly known as FireSAT)
Henrik Kureliddf4846c2008-08-01 10:00:45 +02003 *
Stefan Richter612262a2008-08-26 00:17:30 +02004 * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com>
5 * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se>
Henrik Kureliddf4846c2008-08-01 10:00:45 +02006 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
11 */
12
Stefan Richter612262a2008-08-26 00:17:30 +020013#ifndef _FIREDTV_H
14#define _FIREDTV_H
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -080015
Stefan Richter612262a2008-08-26 00:17:30 +020016#include <linux/dvb/dmx.h>
17#include <linux/dvb/frontend.h>
18#include <linux/list.h>
Stefan Richter87918332009-11-08 18:30:54 -030019#include <linux/mod_devicetable.h>
Stefan Richter612262a2008-08-26 00:17:30 +020020#include <linux/mutex.h>
21#include <linux/spinlock_types.h>
22#include <linux/types.h>
23#include <linux/wait.h>
24#include <linux/workqueue.h>
Stefan Richter612262a2008-08-26 00:17:30 +020025
26#include <demux.h>
27#include <dmxdev.h>
28#include <dvb_demux.h>
Stefan Richter8ae83cd2008-11-02 13:45:00 +010029#include <dvb_frontend.h>
Stefan Richter612262a2008-08-26 00:17:30 +020030#include <dvb_net.h>
31#include <dvbdev.h>
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -080032
Stefan Richter15490792009-02-23 14:21:10 +010033struct firedtv_tuner_status {
34 unsigned active_system:8;
35 unsigned searching:1;
36 unsigned moving:1;
37 unsigned no_rf:1;
38 unsigned input:1;
39 unsigned selected_antenna:7;
40 unsigned ber:32;
41 unsigned signal_strength:8;
42 unsigned raster_frequency:2;
43 unsigned rf_frequency:22;
44 unsigned man_dep_info_length:8;
45 unsigned front_end_error:1;
46 unsigned antenna_error:1;
47 unsigned front_end_power_status:1;
48 unsigned power_supply:1;
49 unsigned carrier_noise_ratio:16;
50 unsigned power_supply_voltage:8;
51 unsigned antenna_voltage:8;
52 unsigned firewire_bus_voltage:8;
53 unsigned ca_mmi:1;
54 unsigned ca_pmt_reply:1;
55 unsigned ca_date_time_request:1;
56 unsigned ca_application_info:1;
57 unsigned ca_module_present_status:1;
58 unsigned ca_dvb_flag:1;
59 unsigned ca_error_flag:1;
60 unsigned ca_initialization_status:1;
61};
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -080062
63enum model_type {
Rambaldia70f81c2009-01-17 14:47:34 +010064 FIREDTV_UNKNOWN = 0,
65 FIREDTV_DVB_S = 1,
66 FIREDTV_DVB_C = 2,
67 FIREDTV_DVB_T = 3,
68 FIREDTV_DVB_S2 = 4,
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -080069};
70
Stefan Richter15490792009-02-23 14:21:10 +010071struct device;
Stefan Richter8ae83cd2008-11-02 13:45:00 +010072struct input_dev;
Stefan Richter92374e82011-02-06 11:41:44 -030073struct fdtv_ir_context;
Stefan Richter612262a2008-08-26 00:17:30 +020074
Rambaldia70f81c2009-01-17 14:47:34 +010075struct firedtv {
Stefan Richter15490792009-02-23 14:21:10 +010076 struct device *device;
77 struct list_head list;
78
Stefan Richter8ae83cd2008-11-02 13:45:00 +010079 struct dvb_adapter adapter;
80 struct dmxdev dmxdev;
81 struct dvb_demux demux;
82 struct dmx_frontend frontend;
83 struct dvb_net dvbnet;
84 struct dvb_frontend fe;
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -080085
Stefan Richter8ae83cd2008-11-02 13:45:00 +010086 struct dvb_device *cadev;
87 int ca_last_command;
88 int ca_time_interval;
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -080089
Stefan Richter8ae83cd2008-11-02 13:45:00 +010090 struct mutex avc_mutex;
91 wait_queue_head_t avc_wait;
92 bool avc_reply_received;
93 struct work_struct remote_ctrl_work;
94 struct input_dev *remote_ctrl_dev;
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -080095
Stefan Richter15490792009-02-23 14:21:10 +010096 enum model_type type;
97 char subunit;
98 char isochannel;
Stefan Richter92374e82011-02-06 11:41:44 -030099 struct fdtv_ir_context *ir_context;
100
Stefan Richter15490792009-02-23 14:21:10 +0100101 fe_sec_voltage_t voltage;
102 fe_sec_tone_mode_t tone;
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800103
Stefan Richter15490792009-02-23 14:21:10 +0100104 struct mutex demux_mutex;
105 unsigned long channel_active;
106 u16 channel_pid[16];
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800107
Stefan Richter3fb80ef2009-11-18 16:02:01 -0300108 int avc_data_length;
109 u8 avc_data[512];
Henrik Kureliddf4846c2008-08-01 10:00:45 +0200110};
111
Stefan Richter15490792009-02-23 14:21:10 +0100112/* firedtv-avc.c */
113int avc_recv(struct firedtv *fdtv, void *data, size_t length);
114int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat);
Mauro Carvalho Chehabe11eb282011-12-26 16:12:40 -0300115struct dtv_frontend_properties;
116int avc_tuner_dsd(struct firedtv *fdtv, struct dtv_frontend_properties *params);
Stefan Richter15490792009-02-23 14:21:10 +0100117int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[]);
118int avc_tuner_get_ts(struct firedtv *fdtv);
119int avc_identify_subunit(struct firedtv *fdtv);
120struct dvb_diseqc_master_cmd;
121int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst,
122 char conttone, char nrdiseq,
123 struct dvb_diseqc_master_cmd *diseqcmd);
124void avc_remote_ctrl_work(struct work_struct *work);
125int avc_register_remote_control(struct firedtv *fdtv);
126int avc_ca_app_info(struct firedtv *fdtv, char *app_info, unsigned int *len);
127int avc_ca_info(struct firedtv *fdtv, char *app_info, unsigned int *len);
128int avc_ca_reset(struct firedtv *fdtv);
129int avc_ca_pmt(struct firedtv *fdtv, char *app_info, int length);
130int avc_ca_get_time_date(struct firedtv *fdtv, int *interval);
131int avc_ca_enter_menu(struct firedtv *fdtv);
132int avc_ca_get_mmi(struct firedtv *fdtv, char *mmi_object, unsigned int *len);
133int cmp_establish_pp_connection(struct firedtv *fdtv, int plug, int channel);
134void cmp_break_pp_connection(struct firedtv *fdtv, int plug, int channel);
Henrik Kureliddf4846c2008-08-01 10:00:45 +0200135
Stefan Richter15490792009-02-23 14:21:10 +0100136/* firedtv-ci.c */
137int fdtv_ca_register(struct firedtv *fdtv);
138void fdtv_ca_release(struct firedtv *fdtv);
Stefan Richter612262a2008-08-26 00:17:30 +0200139
Rambaldia70f81c2009-01-17 14:47:34 +0100140/* firedtv-dvb.c */
141int fdtv_start_feed(struct dvb_demux_feed *dvbdmxfeed);
142int fdtv_stop_feed(struct dvb_demux_feed *dvbdmxfeed);
Stefan Richter92374e82011-02-06 11:41:44 -0300143int fdtv_dvb_register(struct firedtv *fdtv, const char *name);
Stefan Richter15490792009-02-23 14:21:10 +0100144void fdtv_dvb_unregister(struct firedtv *fdtv);
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800145
Rambaldia70f81c2009-01-17 14:47:34 +0100146/* firedtv-fe.c */
Stefan Richter92374e82011-02-06 11:41:44 -0300147void fdtv_frontend_init(struct firedtv *fdtv, const char *name);
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800148
Stefan Richter87918332009-11-08 18:30:54 -0300149/* firedtv-fw.c */
Stefan Richter92374e82011-02-06 11:41:44 -0300150int fdtv_lock(struct firedtv *fdtv, u64 addr, void *data);
151int fdtv_read(struct firedtv *fdtv, u64 addr, void *data);
152int fdtv_write(struct firedtv *fdtv, u64 addr, void *data, size_t len);
153int fdtv_start_iso(struct firedtv *fdtv);
154void fdtv_stop_iso(struct firedtv *fdtv);
Stefan Richter87918332009-11-08 18:30:54 -0300155
Stefan Richter15490792009-02-23 14:21:10 +0100156/* firedtv-rc.c */
157#ifdef CONFIG_DVB_FIREDTV_INPUT
158int fdtv_register_rc(struct firedtv *fdtv, struct device *dev);
159void fdtv_unregister_rc(struct firedtv *fdtv);
160void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code);
161#else
162static inline int fdtv_register_rc(struct firedtv *fdtv,
163 struct device *dev) { return 0; }
164static inline void fdtv_unregister_rc(struct firedtv *fdtv) {}
165static inline void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code) {}
166#endif
Greg Kroah-Hartmanc81c8b62008-03-06 21:30:23 -0800167
Stefan Richter612262a2008-08-26 00:17:30 +0200168#endif /* _FIREDTV_H */