linux/drivers/media/firewire/firedtv-avc.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * FireDTV driver (formerly known as FireSAT)
 *
 * Copyright (C) 2004 Andreas Monitzer <[email protected]>
 * Copyright (C) 2008 Ben Backx <[email protected]>
 * Copyright (C) 2008 Henrik Kurelid <[email protected]>
 */

#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 <media/dvb_frontend.h>

#include "firedtv.h"

#define FCP_COMMAND_REGISTER

#define AVC_CTYPE_CONTROL
#define AVC_CTYPE_STATUS
#define AVC_CTYPE_NOTIFY

#define AVC_RESPONSE_ACCEPTED
#define AVC_RESPONSE_STABLE
#define AVC_RESPONSE_CHANGED
#define AVC_RESPONSE_INTERIM

#define AVC_SUBUNIT_TYPE_TUNER
#define AVC_SUBUNIT_TYPE_UNIT

#define AVC_OPCODE_VENDOR
#define AVC_OPCODE_READ_DESCRIPTOR
#define AVC_OPCODE_DSIT
#define AVC_OPCODE_DSD

#define DESCRIPTOR_TUNER_STATUS
#define DESCRIPTOR_SUBUNIT_IDENTIFIER

#define SFE_VENDOR_DE_COMPANYID_0
#define SFE_VENDOR_DE_COMPANYID_1
#define SFE_VENDOR_DE_COMPANYID_2

#define SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL
#define SFE_VENDOR_OPCODE_LNB_CONTROL
#define SFE_VENDOR_OPCODE_TUNE_QPSK

#define SFE_VENDOR_OPCODE_GET_FIRMWARE_VERSION
#define SFE_VENDOR_OPCODE_HOST2CA
#define SFE_VENDOR_OPCODE_CA2HOST
#define SFE_VENDOR_OPCODE_CISTATUS
#define SFE_VENDOR_OPCODE_TUNE_QPSK2

#define SFE_VENDOR_TAG_CA_RESET
#define SFE_VENDOR_TAG_CA_APPLICATION_INFO
#define SFE_VENDOR_TAG_CA_PMT
#define SFE_VENDOR_TAG_CA_DATE_TIME
#define SFE_VENDOR_TAG_CA_MMI
#define SFE_VENDOR_TAG_CA_ENTER_MENU

#define EN50221_LIST_MANAGEMENT_ONLY
#define EN50221_TAG_APP_INFO
#define EN50221_TAG_CA_INFO

struct avc_command_frame {};

struct avc_response_frame {};

#define LAST_OPERAND

static inline void clear_operands(struct avc_command_frame *c, int from, int to)
{}

static void pad_operands(struct avc_command_frame *c, int from)
{}

#define AVC_DEBUG_READ_DESCRIPTOR
#define AVC_DEBUG_DSIT
#define AVC_DEBUG_DSD
#define AVC_DEBUG_REGISTER_REMOTE_CONTROL
#define AVC_DEBUG_LNB_CONTROL
#define AVC_DEBUG_TUNE_QPSK
#define AVC_DEBUG_TUNE_QPSK2
#define AVC_DEBUG_HOST2CA
#define AVC_DEBUG_CA2HOST
#define AVC_DEBUG_APPLICATION_PMT
#define AVC_DEBUG_FCP_PAYLOADS

static int avc_debug;
module_param_named(debug, avc_debug, int, 0644);
MODULE_PARM_DESC();

/*
 * This is a workaround since there is no vendor specific command to retrieve
 * ca_info using AVC. If this parameter is not used, ca_system_id will be
 * filled with application_manufacturer from ca_app_info.
 * Digital Everywhere have said that adding ca_info is on their TODO list.
 */
static unsigned int num_fake_ca_system_ids;
static int fake_ca_system_ids[4] =;
module_param_array();
MODULE_PARM_DESC();

static const char *debug_fcp_ctype(unsigned int ctype)
{}

static const char *debug_fcp_opcode(unsigned int opcode,
				    const u8 *data, int length)
{}

static void debug_fcp(const u8 *data, int length)
{}

static void debug_pmt(char *msg, int length)
{}

static int avc_write(struct firedtv *fdtv)
{}

static bool is_register_rc(struct avc_response_frame *r)
{}

int avc_recv(struct firedtv *fdtv, void *data, size_t length)
{}

static int add_pid_filter(struct firedtv *fdtv, u8 *operand)
{}

/*
 * tuning command for setting the relative LNB frequency
 * (not supported by the AVC standard)
 */
static int avc_tuner_tuneqpsk(struct firedtv *fdtv,
			      struct dtv_frontend_properties *p)
{}

static int avc_tuner_dsd_dvb_c(struct firedtv *fdtv,
			       struct dtv_frontend_properties *p)
{}

static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
			       struct dtv_frontend_properties *p)
{}

int avc_tuner_dsd(struct firedtv *fdtv,
		  struct dtv_frontend_properties *p)
{}

int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[])
{}

int avc_tuner_get_ts(struct firedtv *fdtv)
{}

int avc_identify_subunit(struct firedtv *fdtv)
{}

#define SIZEOF_ANTENNA_INPUT_INFO

int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat)
{}

int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst,
		    char conttone, char nrdiseq,
		    struct dvb_diseqc_master_cmd *diseqcmd)
{}

int avc_register_remote_control(struct firedtv *fdtv)
{}

void avc_remote_ctrl_work(struct work_struct *work)
{}

#if 0 /* FIXME: unused */
int avc_tuner_host2ca(struct firedtv *fdtv)
{
	struct avc_command_frame *c = (void *)fdtv->avc_data;
	int ret;

	mutex_lock(&fdtv->avc_mutex);

	c->ctype   = AVC_CTYPE_CONTROL;
	c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
	c->opcode  = AVC_OPCODE_VENDOR;

	c->operand[0] = SFE_VENDOR_DE_COMPANYID_0;
	c->operand[1] = SFE_VENDOR_DE_COMPANYID_1;
	c->operand[2] = SFE_VENDOR_DE_COMPANYID_2;
	c->operand[3] = SFE_VENDOR_OPCODE_HOST2CA;
	c->operand[4] = 0; /* slot */
	c->operand[5] = SFE_VENDOR_TAG_CA_APPLICATION_INFO; /* ca tag */
	clear_operands(c, 6, 8);

	fdtv->avc_data_length = 12;
	ret = avc_write(fdtv);

	/* FIXME: check response code? */

	mutex_unlock(&fdtv->avc_mutex);

	return ret;
}
#endif

static int get_ca_object_pos(struct avc_response_frame *r)
{}

static int get_ca_object_length(struct avc_response_frame *r)
{}

int avc_ca_app_info(struct firedtv *fdtv, unsigned char *app_info,
		    unsigned int *len)
{}

int avc_ca_info(struct firedtv *fdtv, unsigned char *app_info,
		unsigned int *len)
{}

int avc_ca_reset(struct firedtv *fdtv)
{}

int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length)
{}

int avc_ca_get_time_date(struct firedtv *fdtv, int *interval)
{}

int avc_ca_enter_menu(struct firedtv *fdtv)
{}

int avc_ca_get_mmi(struct firedtv *fdtv, char *mmi_object, unsigned int *len)
{}

#define CMP_OUTPUT_PLUG_CONTROL_REG_0

static int cmp_read(struct firedtv *fdtv, u64 addr, __be32 *data)
{}

static int cmp_lock(struct firedtv *fdtv, u64 addr, __be32 data[])
{}

static inline u32 get_opcr(__be32 opcr, u32 mask, u32 shift)
{}

static inline void set_opcr(__be32 *opcr, u32 value, u32 mask, u32 shift)
{}

#define get_opcr_online(v)
#define get_opcr_p2p_connections(v)
#define get_opcr_channel(v)

#define set_opcr_p2p_connections(p, v)
#define set_opcr_channel(p, v)
#define set_opcr_data_rate(p, v)
#define set_opcr_overhead_id(p, v)

int cmp_establish_pp_connection(struct firedtv *fdtv, int plug, int channel)
{}

void cmp_break_pp_connection(struct firedtv *fdtv, int plug, int channel)
{}