/* * FireDTV driver (formerly known as FireSAT) * * Copyright (C) 2004 Andreas Monitzer <andy@monitzer.com> * Copyright (C) 2008 Ben Backx <ben@bbackx.com> * Copyright (C) 2008 Henrik Kurelid <henrik@kurelid.se> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. */#include<linux/bug.h>#include<linux/crc32.h>#include<linux/delay.h>#include<linux/device.h>#include<linux/jiffies.h>#include<linux/kernel.h>#include<linux/moduleparam.h>#include<linux/mutex.h>#include<linux/string.h>#include<linux/stringify.h>#include<linux/wait.h>#include<linux/workqueue.h>#include"firedtv.h"#define FCP_COMMAND_REGISTER 0xfffff0000b00ULL#define AVC_CTYPE_CONTROL 0x0#define AVC_CTYPE_STATUS 0x1#define AVC_CTYPE_NOTIFY 0x3#define AVC_RESPONSE_ACCEPTED 0x9#define AVC_RESPONSE_STABLE 0xc#define AVC_RESPONSE_CHANGED 0xd#define AVC_RESPONSE_INTERIM 0xf#define AVC_SUBUNIT_TYPE_TUNER (0x05 << 3)#define AVC_SUBUNIT_TYPE_UNIT (0x1f << 3)#define AVC_OPCODE_VENDOR 0x00#define AVC_OPCODE_READ_DESCRIPTOR 0x09#define AVC_OPCODE_DSIT 0xc8#define AVC_OPCODE_DSD 0xcb#define DESCRIPTOR_TUNER_STATUS 0x80#define DESCRIPTOR_SUBUNIT_IDENTIFIER 0x00#define SFE_VENDOR_DE_COMPANYID_0 0x00 /* OUI of Digital Everywhere */#define SFE_VENDOR_DE_COMPANYID_1 0x12#define SFE_VENDOR_DE_COMPANYID_2 0x87#define SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL 0x0a#define SFE_VENDOR_OPCODE_LNB_CONTROL 0x52#define SFE_VENDOR_OPCODE_TUNE_QPSK 0x58 /* for DVB-S */#define SFE_VENDOR_OPCODE_GET_FIRMWARE_VERSION 0x00#define SFE_VENDOR_OPCODE_HOST2CA 0x56#define SFE_VENDOR_OPCODE_CA2HOST 0x57#define SFE_VENDOR_OPCODE_CISTATUS 0x59#define SFE_VENDOR_OPCODE_TUNE_QPSK2 0x60 /* for DVB-S2 */#define SFE_VENDOR_TAG_CA_RESET 0x00#define SFE_VENDOR_TAG_CA_APPLICATION_INFO 0x01#define SFE_VENDOR_TAG_CA_PMT 0x02#define SFE_VENDOR_TAG_CA_DATE_TIME 0x04#define SFE_VENDOR_TAG_CA_MMI 0x05#define SFE_VENDOR_TAG_CA_ENTER_MENU 0x07#define EN50221_LIST_MANAGEMENT_ONLY 0x03#define EN50221_TAG_APP_INFO 0x9f8021#define EN50221_TAG_CA_INFO 0x9f8031structavc_command_frame{u8ctype;u8subunit;u8opcode;u8operand[509];};structavc_response_frame{u8response;u8subunit;u8opcode;u8operand[509];};#define LAST_OPERAND (509 - 1)staticinlinevoidclear_operands(structavc_command_frame*c,intfrom,intto){memset(&c