aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew de Quincey <adq_dvb@lidskialf.net>2006-04-18 16:47:09 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 00:58:31 -0400
commit7eef5dd6daecf3ee305116c9cf41ae7166270c4c (patch)
tree0abee619372a014ce4c3ec41a0ed01008c756807
parent7c25039dbb45f3e6a34dabe715107d34d298dc40 (diff)
V4L/DVB (3845): DVB core changes for PLL refactoring
Add tuner_ops structure. Add calls into dvb_frontend to support the new tuner architecture. Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c15
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.h112
2 files changed, 127 insertions, 0 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 889d4a817c88..bbf441215e79 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -215,6 +215,11 @@ static void dvb_frontend_init(struct dvb_frontend *fe)
215 215
216 if (fe->ops->init) 216 if (fe->ops->init)
217 fe->ops->init(fe); 217 fe->ops->init(fe);
218 if (fe->ops->tuner_ops.init) {
219 fe->ops->tuner_ops.init(fe);
220 if (fe->ops->i2c_gate_ctrl)
221 fe->ops->i2c_gate_ctrl(fe, 0);
222 }
218} 223}
219 224
220void dvb_frontend_reinitialise(struct dvb_frontend *fe) 225void dvb_frontend_reinitialise(struct dvb_frontend *fe)
@@ -571,6 +576,11 @@ static int dvb_frontend_thread(void *data)
571 if (dvb_powerdown_on_sleep) 576 if (dvb_powerdown_on_sleep)
572 if (fe->ops->set_voltage) 577 if (fe->ops->set_voltage)
573 fe->ops->set_voltage(fe, SEC_VOLTAGE_OFF); 578 fe->ops->set_voltage(fe, SEC_VOLTAGE_OFF);
579 if (fe->ops->tuner_ops.sleep) {
580 fe->ops->tuner_ops.sleep(fe);
581 if (fe->ops->i2c_gate_ctrl)
582 fe->ops->i2c_gate_ctrl(fe, 0);
583 }
574 if (fe->ops->sleep) 584 if (fe->ops->sleep)
575 fe->ops->sleep(fe); 585 fe->ops->sleep(fe);
576 } 586 }
@@ -1085,6 +1095,11 @@ int dvb_unregister_frontend(struct dvb_frontend* fe)
1085 mutex_lock(&frontend_mutex); 1095 mutex_lock(&frontend_mutex);
1086 dvb_unregister_device (fepriv->dvbdev); 1096 dvb_unregister_device (fepriv->dvbdev);
1087 dvb_frontend_stop (fe); 1097 dvb_frontend_stop (fe);
1098 if (fe->ops->tuner_ops.release) {
1099 fe->ops->tuner_ops.release(fe);
1100 if (fe->ops->i2c_gate_ctrl)
1101 fe->ops->i2c_gate_ctrl(fe, 0);
1102 }
1088 if (fe->ops->release) 1103 if (fe->ops->release)
1089 fe->ops->release(fe); 1104 fe->ops->release(fe);
1090 else 1105 else
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.h b/drivers/media/dvb/dvb-core/dvb_frontend.h
index 5926a3b745c9..e0148a9e6633 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.h
@@ -49,6 +49,115 @@ struct dvb_frontend_tune_settings {
49 49
50struct dvb_frontend; 50struct dvb_frontend;
51 51
52struct dvb_tuner_info {
53 char name[128];
54
55 u32 frequency_min;
56 u32 frequency_max;
57 u32 frequency_step;
58
59 u32 bandwidth_min;
60 u32 bandwidth_max;
61 u32 bandwidth_step;
62};
63
64struct dvb_tuner_ops {
65 /**
66 * Description of the tuner.
67 */
68 struct dvb_tuner_info info;
69
70 /**
71 * Cleanup an attached tuner.
72 *
73 * @param fe dvb_frontend structure to clean it up from.
74 * @return 0 on success, <0 on failure.
75 */
76 int (*release)(struct dvb_frontend *fe);
77
78 /**
79 * Initialise a tuner.
80 *
81 * @param fe dvb_frontend structure.
82 * @return 0 on success, <0 on failure.
83 */
84 int (*init)(struct dvb_frontend *fe);
85
86 /**
87 * Set a tuner into low power mode.
88 *
89 * @param fe dvb_frontend structure.
90 * @return 0 on success, <0 on failure.
91 */
92 int (*sleep)(struct dvb_frontend *fe);
93
94 /**
95 * This is for simple PLLs - set all parameters in one go.
96 *
97 * @param fe The dvb_frontend structure.
98 * @param p The parameters to set.
99 * @return 0 on success, <0 on failure.
100 */
101 int (*set_params)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p);
102
103 /**
104 * This is support for demods like the mt352 - fills out the supplied buffer with what to write.
105 *
106 * @param fe The dvb_frontend structure.
107 * @param p The parameters to set.
108 * @param buf The buffer to fill with data. For an i2c tuner, the first byte should be the tuner i2c address in linux format.
109 * @param buf_len Size of buffer in bytes.
110 * @return Number of bytes used, or <0 on failure.
111 */
112 int (*pllbuf)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p, u8 *buf, int buf_len);
113
114 /**
115 * Get the frequency the tuner was actually set to.
116 *
117 * @param fe The dvb_frontend structure.
118 * @param frequency Where to put it.
119 * @return 0 on success, or <0 on failure.
120 */
121 int (*get_frequency)(struct dvb_frontend *fe, u32 *frequency);
122
123 /**
124 * Get the bandwidth the tuner was actually set to.
125 *
126 * @param fe The dvb_frontend structure.
127 * @param bandwidth Where to put it.
128 * @return 0 on success, or <0 on failure.
129 */
130 int (*get_bandwidth)(struct dvb_frontend *fe, u32 *bandwidth);
131
132 /**
133 * Get the tuner's status.
134 *
135 * @param fe The dvb_frontend structure.
136 * @param status Where to put it.
137 * @return 0 on success, or <0 on failure.
138 */
139#define TUNER_STATUS_LOCKED 1
140 int (*get_status)(struct dvb_frontend *fe, u32 *status);
141
142 /**
143 * Set the frequency of the tuner - for complex tuners.
144 *
145 * @param fe The dvb_frontend structure.
146 * @param frequency What to set.
147 * @return 0 on success, or <0 on failure.
148 */
149 int (*set_frequency)(struct dvb_frontend *fe, u32 frequency);
150
151 /**
152 * Set the bandwidth of the tuner - for complex tuners.
153 *
154 * @param fe The dvb_frontend structure.
155 * @param bandwidth What to set.
156 * @return 0 on success, or <0 on failure.
157 */
158 int (*set_bandwidth)(struct dvb_frontend *fe, u32 bandwidth);
159};
160
52struct dvb_frontend_ops { 161struct dvb_frontend_ops {
53 162
54 struct dvb_frontend_info info; 163 struct dvb_frontend_info info;
@@ -86,6 +195,8 @@ struct dvb_frontend_ops {
86 int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, long arg); 195 int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, long arg);
87 int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd); 196 int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd);
88 int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable); 197 int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable);
198
199 struct dvb_tuner_ops tuner_ops;
89}; 200};
90 201
91#define MAX_EVENT 8 202#define MAX_EVENT 8
@@ -103,6 +214,7 @@ struct dvb_frontend {
103 struct dvb_frontend_ops* ops; 214 struct dvb_frontend_ops* ops;
104 struct dvb_adapter *dvb; 215 struct dvb_adapter *dvb;
105 void* demodulator_priv; 216 void* demodulator_priv;
217 void* tuner_priv;
106 void* frontend_priv; 218 void* frontend_priv;
107 void* misc_priv; 219 void* misc_priv;
108}; 220};