aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/firewire/firedtv-fe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/firewire/firedtv-fe.c')
-rw-r--r--drivers/media/dvb/firewire/firedtv-fe.c61
1 files changed, 31 insertions, 30 deletions
diff --git a/drivers/media/dvb/firewire/firedtv-fe.c b/drivers/media/dvb/firewire/firedtv-fe.c
index f8150f402bb6..9b9539c800f8 100644
--- a/drivers/media/dvb/firewire/firedtv-fe.c
+++ b/drivers/media/dvb/firewire/firedtv-fe.c
@@ -10,6 +10,7 @@
10 * the License, or (at your option) any later version. 10 * the License, or (at your option) any later version.
11 */ 11 */
12 12
13#include <linux/device.h>
13#include <linux/errno.h> 14#include <linux/errno.h>
14#include <linux/kernel.h> 15#include <linux/kernel.h>
15#include <linux/string.h> 16#include <linux/string.h>
@@ -17,8 +18,6 @@
17 18
18#include <dvb_frontend.h> 19#include <dvb_frontend.h>
19 20
20#include "avc.h"
21#include "cmp.h"
22#include "firedtv.h" 21#include "firedtv.h"
23 22
24static int fdtv_dvb_init(struct dvb_frontend *fe) 23static int fdtv_dvb_init(struct dvb_frontend *fe)
@@ -32,35 +31,37 @@ static int fdtv_dvb_init(struct dvb_frontend *fe)
32 err = cmp_establish_pp_connection(fdtv, fdtv->subunit, 31 err = cmp_establish_pp_connection(fdtv, fdtv->subunit,
33 fdtv->isochannel); 32 fdtv->isochannel);
34 if (err) { 33 if (err) {
35 printk(KERN_ERR "Could not establish point to point " 34 dev_err(fdtv->device,
36 "connection.\n"); 35 "could not establish point to point connection\n");
37 return err; 36 return err;
38 } 37 }
39 38
40 return setup_iso_channel(fdtv); 39 return fdtv->backend->start_iso(fdtv);
41} 40}
42 41
43static int fdtv_sleep(struct dvb_frontend *fe) 42static int fdtv_sleep(struct dvb_frontend *fe)
44{ 43{
45 struct firedtv *fdtv = fe->sec_priv; 44 struct firedtv *fdtv = fe->sec_priv;
46 45
47 tear_down_iso_channel(fdtv); 46 fdtv->backend->stop_iso(fdtv);
48 cmp_break_pp_connection(fdtv, fdtv->subunit, fdtv->isochannel); 47 cmp_break_pp_connection(fdtv, fdtv->subunit, fdtv->isochannel);
49 fdtv->isochannel = -1; 48 fdtv->isochannel = -1;
50 return 0; 49 return 0;
51} 50}
52 51
52#define LNBCONTROL_DONTCARE 0xff
53
53static int fdtv_diseqc_send_master_cmd(struct dvb_frontend *fe, 54static int fdtv_diseqc_send_master_cmd(struct dvb_frontend *fe,
54 struct dvb_diseqc_master_cmd *cmd) 55 struct dvb_diseqc_master_cmd *cmd)
55{ 56{
56 struct firedtv *fdtv = fe->sec_priv; 57 struct firedtv *fdtv = fe->sec_priv;
57 58
58 return avc_lnb_control(fdtv, LNBCONTROL_DONTCARE, 59 return avc_lnb_control(fdtv, LNBCONTROL_DONTCARE, LNBCONTROL_DONTCARE,
59 LNBCONTROL_DONTCARE, LNBCONTROL_DONTCARE, 1, cmd); 60 LNBCONTROL_DONTCARE, 1, cmd);
60} 61}
61 62
62static int fdtv_diseqc_send_burst(struct dvb_frontend *fe, 63static int fdtv_diseqc_send_burst(struct dvb_frontend *fe,
63 fe_sec_mini_cmd_t minicmd) 64 fe_sec_mini_cmd_t minicmd)
64{ 65{
65 return 0; 66 return 0;
66} 67}
@@ -74,7 +75,7 @@ static int fdtv_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone)
74} 75}
75 76
76static int fdtv_set_voltage(struct dvb_frontend *fe, 77static int fdtv_set_voltage(struct dvb_frontend *fe,
77 fe_sec_voltage_t voltage) 78 fe_sec_voltage_t voltage)
78{ 79{
79 struct firedtv *fdtv = fe->sec_priv; 80 struct firedtv *fdtv = fe->sec_priv;
80 81
@@ -85,12 +86,12 @@ static int fdtv_set_voltage(struct dvb_frontend *fe,
85static int fdtv_read_status(struct dvb_frontend *fe, fe_status_t *status) 86static int fdtv_read_status(struct dvb_frontend *fe, fe_status_t *status)
86{ 87{
87 struct firedtv *fdtv = fe->sec_priv; 88 struct firedtv *fdtv = fe->sec_priv;
88 ANTENNA_INPUT_INFO info; 89 struct firedtv_tuner_status stat;
89 90
90 if (avc_tuner_status(fdtv, &info)) 91 if (avc_tuner_status(fdtv, &stat))
91 return -EINVAL; 92 return -EINVAL;
92 93
93 if (info.NoRF) 94 if (stat.no_rf)
94 *status = 0; 95 *status = 0;
95 else 96 else
96 *status = FE_HAS_SIGNAL | FE_HAS_VITERBI | FE_HAS_SYNC | 97 *status = FE_HAS_SIGNAL | FE_HAS_VITERBI | FE_HAS_SYNC |
@@ -101,39 +102,37 @@ static int fdtv_read_status(struct dvb_frontend *fe, fe_status_t *status)
101static int fdtv_read_ber(struct dvb_frontend *fe, u32 *ber) 102static int fdtv_read_ber(struct dvb_frontend *fe, u32 *ber)
102{ 103{
103 struct firedtv *fdtv = fe->sec_priv; 104 struct firedtv *fdtv = fe->sec_priv;
104 ANTENNA_INPUT_INFO info; 105 struct firedtv_tuner_status stat;
105 106
106 if (avc_tuner_status(fdtv, &info)) 107 if (avc_tuner_status(fdtv, &stat))
107 return -EINVAL; 108 return -EINVAL;
108 109
109 *ber = info.BER[0] << 24 | info.BER[1] << 16 | 110 *ber = stat.ber;
110 info.BER[2] << 8 | info.BER[3];
111 return 0; 111 return 0;
112} 112}
113 113
114static int fdtv_read_signal_strength (struct dvb_frontend *fe, u16 *strength) 114static int fdtv_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
115{ 115{
116 struct firedtv *fdtv = fe->sec_priv; 116 struct firedtv *fdtv = fe->sec_priv;
117 ANTENNA_INPUT_INFO info; 117 struct firedtv_tuner_status stat;
118 118
119 if (avc_tuner_status(fdtv, &info)) 119 if (avc_tuner_status(fdtv, &stat))
120 return -EINVAL; 120 return -EINVAL;
121 121
122 *strength = info.SignalStrength << 8; 122 *strength = stat.signal_strength << 8;
123 return 0; 123 return 0;
124} 124}
125 125
126static int fdtv_read_snr(struct dvb_frontend *fe, u16 *snr) 126static int fdtv_read_snr(struct dvb_frontend *fe, u16 *snr)
127{ 127{
128 struct firedtv *fdtv = fe->sec_priv; 128 struct firedtv *fdtv = fe->sec_priv;
129 ANTENNA_INPUT_INFO info; 129 struct firedtv_tuner_status stat;
130 130
131 if (avc_tuner_status(fdtv, &info)) 131 if (avc_tuner_status(fdtv, &stat))
132 return -EINVAL; 132 return -EINVAL;
133 133
134 /* C/N[dB] = -10 * log10(snr / 65535) */ 134 /* C/N[dB] = -10 * log10(snr / 65535) */
135 *snr = (info.CarrierNoiseRatio[0] << 8) + info.CarrierNoiseRatio[1]; 135 *snr = stat.carrier_noise_ratio * 257;
136 *snr *= 257;
137 return 0; 136 return 0;
138} 137}
139 138
@@ -142,8 +141,10 @@ static int fdtv_read_uncorrected_blocks(struct dvb_frontend *fe, u32 *ucblocks)
142 return -EOPNOTSUPP; 141 return -EOPNOTSUPP;
143} 142}
144 143
144#define ACCEPTED 0x9
145
145static int fdtv_set_frontend(struct dvb_frontend *fe, 146static int fdtv_set_frontend(struct dvb_frontend *fe,
146 struct dvb_frontend_parameters *params) 147 struct dvb_frontend_parameters *params)
147{ 148{
148 struct firedtv *fdtv = fe->sec_priv; 149 struct firedtv *fdtv = fe->sec_priv;
149 150
@@ -155,7 +156,7 @@ static int fdtv_set_frontend(struct dvb_frontend *fe,
155} 156}
156 157
157static int fdtv_get_frontend(struct dvb_frontend *fe, 158static int fdtv_get_frontend(struct dvb_frontend *fe,
158 struct dvb_frontend_parameters *params) 159 struct dvb_frontend_parameters *params)
159{ 160{
160 return -EOPNOTSUPP; 161 return -EOPNOTSUPP;
161} 162}
@@ -235,8 +236,8 @@ void fdtv_frontend_init(struct firedtv *fdtv)
235 break; 236 break;
236 237
237 default: 238 default:
238 printk(KERN_ERR "FireDTV: no frontend for model type %d\n", 239 dev_err(fdtv->device, "no frontend for model type %d\n",
239 fdtv->type); 240 fdtv->type);
240 } 241 }
241 strcpy(fi->name, fdtv_model_names[fdtv->type]); 242 strcpy(fi->name, fdtv_model_names[fdtv->type]);
242 243