Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 1 | /* |
| 2 | * FireDTV driver -- firewire I/O backend |
| 3 | */ |
| 4 | |
| 5 | #include <linux/device.h> |
| 6 | #include <linux/errno.h> |
| 7 | #include <linux/firewire.h> |
| 8 | #include <linux/firewire-constants.h> |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 9 | #include <linux/kernel.h> |
| 10 | #include <linux/list.h> |
Stefan Richter | a8aeb78 | 2009-11-18 16:00:55 -0300 | [diff] [blame] | 11 | #include <linux/mm.h> |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 12 | #include <linux/mod_devicetable.h> |
| 13 | #include <linux/module.h> |
| 14 | #include <linux/mutex.h> |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 15 | #include <linux/slab.h> |
| 16 | #include <linux/spinlock.h> |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 17 | #include <linux/string.h> |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 18 | #include <linux/types.h> |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 19 | #include <linux/wait.h> |
| 20 | #include <linux/workqueue.h> |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 21 | |
| 22 | #include <asm/page.h> |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 23 | #include <asm/system.h> |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 24 | |
| 25 | #include <dvb_demux.h> |
| 26 | |
| 27 | #include "firedtv.h" |
| 28 | |
| 29 | static LIST_HEAD(node_list); |
| 30 | static DEFINE_SPINLOCK(node_list_lock); |
| 31 | |
| 32 | static inline struct fw_device *device_of(struct firedtv *fdtv) |
| 33 | { |
| 34 | return fw_device(fdtv->device->parent); |
| 35 | } |
| 36 | |
| 37 | static int node_req(struct firedtv *fdtv, u64 addr, void *data, size_t len, |
| 38 | int tcode) |
| 39 | { |
| 40 | struct fw_device *device = device_of(fdtv); |
| 41 | int rcode, generation = device->generation; |
| 42 | |
| 43 | smp_rmb(); /* node_id vs. generation */ |
| 44 | |
| 45 | rcode = fw_run_transaction(device->card, tcode, device->node_id, |
| 46 | generation, device->max_speed, addr, data, len); |
| 47 | |
| 48 | return rcode != RCODE_COMPLETE ? -EIO : 0; |
| 49 | } |
| 50 | |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 51 | int fdtv_lock(struct firedtv *fdtv, u64 addr, void *data) |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 52 | { |
| 53 | return node_req(fdtv, addr, data, 8, TCODE_LOCK_COMPARE_SWAP); |
| 54 | } |
| 55 | |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 56 | int fdtv_read(struct firedtv *fdtv, u64 addr, void *data) |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 57 | { |
Stefan Richter | 5375659 | 2009-11-18 16:01:34 -0300 | [diff] [blame] | 58 | return node_req(fdtv, addr, data, 4, TCODE_READ_QUADLET_REQUEST); |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 59 | } |
| 60 | |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 61 | int fdtv_write(struct firedtv *fdtv, u64 addr, void *data, size_t len) |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 62 | { |
| 63 | return node_req(fdtv, addr, data, len, TCODE_WRITE_BLOCK_REQUEST); |
| 64 | } |
| 65 | |
| 66 | #define ISO_HEADER_SIZE 4 |
| 67 | #define CIP_HEADER_SIZE 8 |
| 68 | #define MPEG2_TS_HEADER_SIZE 4 |
| 69 | #define MPEG2_TS_SOURCE_PACKET_SIZE (4 + 188) |
| 70 | |
| 71 | #define MAX_PACKET_SIZE 1024 /* 776, rounded up to 2^n */ |
| 72 | #define PACKETS_PER_PAGE (PAGE_SIZE / MAX_PACKET_SIZE) |
| 73 | #define N_PACKETS 64 /* buffer size */ |
| 74 | #define N_PAGES DIV_ROUND_UP(N_PACKETS, PACKETS_PER_PAGE) |
| 75 | #define IRQ_INTERVAL 16 |
| 76 | |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 77 | struct fdtv_ir_context { |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 78 | struct fw_iso_context *context; |
| 79 | struct fw_iso_buffer buffer; |
| 80 | int interrupt_packet; |
| 81 | int current_packet; |
Stefan Richter | a8aeb78 | 2009-11-18 16:00:55 -0300 | [diff] [blame] | 82 | char *pages[N_PAGES]; |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 83 | }; |
| 84 | |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 85 | static int queue_iso(struct fdtv_ir_context *ctx, int index) |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 86 | { |
| 87 | struct fw_iso_packet p; |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 88 | |
| 89 | p.payload_length = MAX_PACKET_SIZE; |
Stefan Richter | b1d33f4 | 2009-11-18 16:01:14 -0300 | [diff] [blame] | 90 | p.interrupt = !(++ctx->interrupt_packet & (IRQ_INTERVAL - 1)); |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 91 | p.skip = 0; |
| 92 | p.header_length = ISO_HEADER_SIZE; |
| 93 | |
Stefan Richter | b1d33f4 | 2009-11-18 16:01:14 -0300 | [diff] [blame] | 94 | return fw_iso_context_queue(ctx->context, &p, &ctx->buffer, |
| 95 | index * MAX_PACKET_SIZE); |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | static void handle_iso(struct fw_iso_context *context, u32 cycle, |
| 99 | size_t header_length, void *header, void *data) |
| 100 | { |
| 101 | struct firedtv *fdtv = data; |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 102 | struct fdtv_ir_context *ctx = fdtv->ir_context; |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 103 | __be32 *h, *h_end; |
Stefan Richter | a8aeb78 | 2009-11-18 16:00:55 -0300 | [diff] [blame] | 104 | int length, err, i = ctx->current_packet; |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 105 | char *p, *p_end; |
| 106 | |
| 107 | for (h = header, h_end = h + header_length / 4; h < h_end; h++) { |
| 108 | length = be32_to_cpup(h) >> 16; |
| 109 | if (unlikely(length > MAX_PACKET_SIZE)) { |
| 110 | dev_err(fdtv->device, "length = %d\n", length); |
| 111 | length = MAX_PACKET_SIZE; |
| 112 | } |
| 113 | |
Stefan Richter | a8aeb78 | 2009-11-18 16:00:55 -0300 | [diff] [blame] | 114 | p = ctx->pages[i / PACKETS_PER_PAGE] |
| 115 | + (i % PACKETS_PER_PAGE) * MAX_PACKET_SIZE; |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 116 | p_end = p + length; |
| 117 | |
| 118 | for (p += CIP_HEADER_SIZE + MPEG2_TS_HEADER_SIZE; p < p_end; |
| 119 | p += MPEG2_TS_SOURCE_PACKET_SIZE) |
| 120 | dvb_dmx_swfilter_packets(&fdtv->demux, p, 1); |
| 121 | |
| 122 | err = queue_iso(ctx, i); |
| 123 | if (unlikely(err)) |
| 124 | dev_err(fdtv->device, "requeue failed\n"); |
| 125 | |
| 126 | i = (i + 1) & (N_PACKETS - 1); |
| 127 | } |
Clemens Ladisch | 13882a8 | 2011-05-02 09:33:56 +0200 | [diff] [blame] | 128 | fw_iso_context_queue_flush(ctx->context); |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 129 | ctx->current_packet = i; |
| 130 | } |
| 131 | |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 132 | int fdtv_start_iso(struct firedtv *fdtv) |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 133 | { |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 134 | struct fdtv_ir_context *ctx; |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 135 | struct fw_device *device = device_of(fdtv); |
Stefan Richter | a8aeb78 | 2009-11-18 16:00:55 -0300 | [diff] [blame] | 136 | int i, err; |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 137 | |
| 138 | ctx = kmalloc(sizeof(*ctx), GFP_KERNEL); |
| 139 | if (!ctx) |
| 140 | return -ENOMEM; |
| 141 | |
| 142 | ctx->context = fw_iso_context_create(device->card, |
| 143 | FW_ISO_CONTEXT_RECEIVE, fdtv->isochannel, |
| 144 | device->max_speed, ISO_HEADER_SIZE, handle_iso, fdtv); |
| 145 | if (IS_ERR(ctx->context)) { |
| 146 | err = PTR_ERR(ctx->context); |
| 147 | goto fail_free; |
| 148 | } |
| 149 | |
| 150 | err = fw_iso_buffer_init(&ctx->buffer, device->card, |
| 151 | N_PAGES, DMA_FROM_DEVICE); |
| 152 | if (err) |
| 153 | goto fail_context_destroy; |
| 154 | |
Stefan Richter | b1d33f4 | 2009-11-18 16:01:14 -0300 | [diff] [blame] | 155 | ctx->interrupt_packet = 0; |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 156 | ctx->current_packet = 0; |
| 157 | |
Stefan Richter | a8aeb78 | 2009-11-18 16:00:55 -0300 | [diff] [blame] | 158 | for (i = 0; i < N_PAGES; i++) |
| 159 | ctx->pages[i] = page_address(ctx->buffer.pages[i]); |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 160 | |
| 161 | for (i = 0; i < N_PACKETS; i++) { |
| 162 | err = queue_iso(ctx, i); |
| 163 | if (err) |
| 164 | goto fail; |
| 165 | } |
| 166 | |
| 167 | err = fw_iso_context_start(ctx->context, -1, 0, |
| 168 | FW_ISO_CONTEXT_MATCH_ALL_TAGS); |
| 169 | if (err) |
| 170 | goto fail; |
| 171 | |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 172 | fdtv->ir_context = ctx; |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 173 | |
| 174 | return 0; |
| 175 | fail: |
| 176 | fw_iso_buffer_destroy(&ctx->buffer, device->card); |
| 177 | fail_context_destroy: |
| 178 | fw_iso_context_destroy(ctx->context); |
| 179 | fail_free: |
| 180 | kfree(ctx); |
| 181 | |
| 182 | return err; |
| 183 | } |
| 184 | |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 185 | void fdtv_stop_iso(struct firedtv *fdtv) |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 186 | { |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 187 | struct fdtv_ir_context *ctx = fdtv->ir_context; |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 188 | |
| 189 | fw_iso_context_stop(ctx->context); |
| 190 | fw_iso_buffer_destroy(&ctx->buffer, device_of(fdtv)->card); |
| 191 | fw_iso_context_destroy(ctx->context); |
| 192 | kfree(ctx); |
| 193 | } |
| 194 | |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 195 | static void handle_fcp(struct fw_card *card, struct fw_request *request, |
| 196 | int tcode, int destination, int source, int generation, |
Stefan Richter | 33e553f | 2010-06-20 22:50:35 +0200 | [diff] [blame] | 197 | unsigned long long offset, void *payload, size_t length, |
| 198 | void *callback_data) |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 199 | { |
| 200 | struct firedtv *f, *fdtv = NULL; |
| 201 | struct fw_device *device; |
| 202 | unsigned long flags; |
| 203 | int su; |
| 204 | |
Clemens Ladisch | db5d247 | 2009-12-24 12:05:58 +0100 | [diff] [blame] | 205 | if (length < 2 || (((u8 *)payload)[0] & 0xf0) != 0) |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 206 | return; |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 207 | |
| 208 | su = ((u8 *)payload)[1] & 0x7; |
| 209 | |
| 210 | spin_lock_irqsave(&node_list_lock, flags); |
| 211 | list_for_each_entry(f, &node_list, list) { |
| 212 | device = device_of(f); |
| 213 | if (device->generation != generation) |
| 214 | continue; |
| 215 | |
| 216 | smp_rmb(); /* node_id vs. generation */ |
| 217 | |
| 218 | if (device->card == card && |
| 219 | device->node_id == source && |
| 220 | (f->subunit == su || (f->subunit == 0 && su == 0x7))) { |
| 221 | fdtv = f; |
| 222 | break; |
| 223 | } |
| 224 | } |
| 225 | spin_unlock_irqrestore(&node_list_lock, flags); |
| 226 | |
Clemens Ladisch | db5d247 | 2009-12-24 12:05:58 +0100 | [diff] [blame] | 227 | if (fdtv) |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 228 | avc_recv(fdtv, payload, length); |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | static struct fw_address_handler fcp_handler = { |
| 232 | .length = CSR_FCP_END - CSR_FCP_RESPONSE, |
| 233 | .address_callback = handle_fcp, |
| 234 | }; |
| 235 | |
| 236 | static const struct fw_address_region fcp_region = { |
| 237 | .start = CSR_REGISTER_BASE + CSR_FCP_RESPONSE, |
| 238 | .end = CSR_REGISTER_BASE + CSR_FCP_END, |
| 239 | }; |
| 240 | |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 241 | static const char * const model_names[] = { |
| 242 | [FIREDTV_UNKNOWN] = "unknown type", |
| 243 | [FIREDTV_DVB_S] = "FireDTV S/CI", |
| 244 | [FIREDTV_DVB_C] = "FireDTV C/CI", |
| 245 | [FIREDTV_DVB_T] = "FireDTV T/CI", |
| 246 | [FIREDTV_DVB_S2] = "FireDTV S2 ", |
| 247 | }; |
| 248 | |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 249 | /* Adjust the template string if models with longer names appear. */ |
Clemens Ladisch | 1f8fef7 | 2009-12-24 11:59:57 +0100 | [diff] [blame] | 250 | #define MAX_MODEL_NAME_LEN sizeof("FireDTV ????") |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 251 | |
| 252 | static int node_probe(struct device *dev) |
| 253 | { |
| 254 | struct firedtv *fdtv; |
Clemens Ladisch | 1f8fef7 | 2009-12-24 11:59:57 +0100 | [diff] [blame] | 255 | char name[MAX_MODEL_NAME_LEN]; |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 256 | int name_len, i, err; |
| 257 | |
| 258 | fdtv = kzalloc(sizeof(*fdtv), GFP_KERNEL); |
| 259 | if (!fdtv) |
| 260 | return -ENOMEM; |
| 261 | |
| 262 | dev_set_drvdata(dev, fdtv); |
| 263 | fdtv->device = dev; |
| 264 | fdtv->isochannel = -1; |
| 265 | fdtv->voltage = 0xff; |
| 266 | fdtv->tone = 0xff; |
| 267 | |
| 268 | mutex_init(&fdtv->avc_mutex); |
| 269 | init_waitqueue_head(&fdtv->avc_wait); |
| 270 | mutex_init(&fdtv->demux_mutex); |
| 271 | INIT_WORK(&fdtv->remote_ctrl_work, avc_remote_ctrl_work); |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 272 | |
Clemens Ladisch | 1f8fef7 | 2009-12-24 11:59:57 +0100 | [diff] [blame] | 273 | name_len = fw_csr_string(fw_unit(dev)->directory, CSR_MODEL, |
| 274 | name, sizeof(name)); |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 275 | for (i = ARRAY_SIZE(model_names); --i; ) |
| 276 | if (strlen(model_names[i]) <= name_len && |
| 277 | strncmp(name, model_names[i], name_len) == 0) |
| 278 | break; |
| 279 | fdtv->type = i; |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 280 | |
| 281 | err = fdtv_register_rc(fdtv, dev); |
| 282 | if (err) |
| 283 | goto fail_free; |
| 284 | |
| 285 | spin_lock_irq(&node_list_lock); |
| 286 | list_add_tail(&fdtv->list, &node_list); |
| 287 | spin_unlock_irq(&node_list_lock); |
| 288 | |
| 289 | err = avc_identify_subunit(fdtv); |
| 290 | if (err) |
| 291 | goto fail; |
| 292 | |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 293 | err = fdtv_dvb_register(fdtv, model_names[fdtv->type]); |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 294 | if (err) |
| 295 | goto fail; |
| 296 | |
| 297 | avc_register_remote_control(fdtv); |
| 298 | |
| 299 | return 0; |
| 300 | fail: |
| 301 | spin_lock_irq(&node_list_lock); |
| 302 | list_del(&fdtv->list); |
| 303 | spin_unlock_irq(&node_list_lock); |
| 304 | fdtv_unregister_rc(fdtv); |
| 305 | fail_free: |
| 306 | kfree(fdtv); |
| 307 | |
| 308 | return err; |
| 309 | } |
| 310 | |
| 311 | static int node_remove(struct device *dev) |
| 312 | { |
| 313 | struct firedtv *fdtv = dev_get_drvdata(dev); |
| 314 | |
| 315 | fdtv_dvb_unregister(fdtv); |
| 316 | |
| 317 | spin_lock_irq(&node_list_lock); |
| 318 | list_del(&fdtv->list); |
| 319 | spin_unlock_irq(&node_list_lock); |
| 320 | |
| 321 | fdtv_unregister_rc(fdtv); |
| 322 | |
| 323 | kfree(fdtv); |
| 324 | return 0; |
| 325 | } |
| 326 | |
| 327 | static void node_update(struct fw_unit *unit) |
| 328 | { |
| 329 | struct firedtv *fdtv = dev_get_drvdata(&unit->device); |
| 330 | |
| 331 | if (fdtv->isochannel >= 0) |
| 332 | cmp_establish_pp_connection(fdtv, fdtv->subunit, |
| 333 | fdtv->isochannel); |
| 334 | } |
| 335 | |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 336 | #define MATCH_FLAGS (IEEE1394_MATCH_VENDOR_ID | IEEE1394_MATCH_MODEL_ID | \ |
| 337 | IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION) |
| 338 | |
| 339 | #define DIGITAL_EVERYWHERE_OUI 0x001287 |
| 340 | #define AVC_UNIT_SPEC_ID_ENTRY 0x00a02d |
| 341 | #define AVC_SW_VERSION_ENTRY 0x010001 |
| 342 | |
| 343 | static const struct ieee1394_device_id fdtv_id_table[] = { |
| 344 | { |
| 345 | /* FloppyDTV S/CI and FloppyDTV S2 */ |
| 346 | .match_flags = MATCH_FLAGS, |
| 347 | .vendor_id = DIGITAL_EVERYWHERE_OUI, |
| 348 | .model_id = 0x000024, |
| 349 | .specifier_id = AVC_UNIT_SPEC_ID_ENTRY, |
| 350 | .version = AVC_SW_VERSION_ENTRY, |
| 351 | }, { |
| 352 | /* FloppyDTV T/CI */ |
| 353 | .match_flags = MATCH_FLAGS, |
| 354 | .vendor_id = DIGITAL_EVERYWHERE_OUI, |
| 355 | .model_id = 0x000025, |
| 356 | .specifier_id = AVC_UNIT_SPEC_ID_ENTRY, |
| 357 | .version = AVC_SW_VERSION_ENTRY, |
| 358 | }, { |
| 359 | /* FloppyDTV C/CI */ |
| 360 | .match_flags = MATCH_FLAGS, |
| 361 | .vendor_id = DIGITAL_EVERYWHERE_OUI, |
| 362 | .model_id = 0x000026, |
| 363 | .specifier_id = AVC_UNIT_SPEC_ID_ENTRY, |
| 364 | .version = AVC_SW_VERSION_ENTRY, |
| 365 | }, { |
| 366 | /* FireDTV S/CI and FloppyDTV S2 */ |
| 367 | .match_flags = MATCH_FLAGS, |
| 368 | .vendor_id = DIGITAL_EVERYWHERE_OUI, |
| 369 | .model_id = 0x000034, |
| 370 | .specifier_id = AVC_UNIT_SPEC_ID_ENTRY, |
| 371 | .version = AVC_SW_VERSION_ENTRY, |
| 372 | }, { |
| 373 | /* FireDTV T/CI */ |
| 374 | .match_flags = MATCH_FLAGS, |
| 375 | .vendor_id = DIGITAL_EVERYWHERE_OUI, |
| 376 | .model_id = 0x000035, |
| 377 | .specifier_id = AVC_UNIT_SPEC_ID_ENTRY, |
| 378 | .version = AVC_SW_VERSION_ENTRY, |
| 379 | }, { |
| 380 | /* FireDTV C/CI */ |
| 381 | .match_flags = MATCH_FLAGS, |
| 382 | .vendor_id = DIGITAL_EVERYWHERE_OUI, |
| 383 | .model_id = 0x000036, |
| 384 | .specifier_id = AVC_UNIT_SPEC_ID_ENTRY, |
| 385 | .version = AVC_SW_VERSION_ENTRY, |
| 386 | }, {} |
| 387 | }; |
| 388 | MODULE_DEVICE_TABLE(ieee1394, fdtv_id_table); |
| 389 | |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 390 | static struct fw_driver fdtv_driver = { |
| 391 | .driver = { |
| 392 | .owner = THIS_MODULE, |
| 393 | .name = "firedtv", |
| 394 | .bus = &fw_bus_type, |
| 395 | .probe = node_probe, |
| 396 | .remove = node_remove, |
| 397 | }, |
| 398 | .update = node_update, |
| 399 | .id_table = fdtv_id_table, |
| 400 | }; |
| 401 | |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 402 | static int __init fdtv_init(void) |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 403 | { |
| 404 | int ret; |
| 405 | |
| 406 | ret = fw_core_add_address_handler(&fcp_handler, &fcp_region); |
| 407 | if (ret < 0) |
| 408 | return ret; |
| 409 | |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 410 | ret = driver_register(&fdtv_driver.driver); |
| 411 | if (ret < 0) |
| 412 | fw_core_remove_address_handler(&fcp_handler); |
| 413 | |
| 414 | return ret; |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 415 | } |
| 416 | |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 417 | static void __exit fdtv_exit(void) |
Stefan Richter | 8791833 | 2009-11-08 18:30:54 -0300 | [diff] [blame] | 418 | { |
| 419 | driver_unregister(&fdtv_driver.driver); |
| 420 | fw_core_remove_address_handler(&fcp_handler); |
| 421 | } |
Stefan Richter | 92374e8 | 2011-02-06 11:41:44 -0300 | [diff] [blame] | 422 | |
| 423 | module_init(fdtv_init); |
| 424 | module_exit(fdtv_exit); |
| 425 | |
| 426 | MODULE_AUTHOR("Andreas Monitzer <andy@monitzer.com>"); |
| 427 | MODULE_AUTHOR("Ben Backx <ben@bbackx.com>"); |
| 428 | MODULE_DESCRIPTION("FireDTV DVB Driver"); |
| 429 | MODULE_LICENSE("GPL"); |
| 430 | MODULE_SUPPORTED_DEVICE("FireDTV DVB"); |