linux/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * TTUSB DVB driver
 *
 * Copyright (c) 2002 Holger Waechtler <[email protected]>
 * Copyright (c) 2003 Felix Domke <[email protected]>
 */

#define pr_fmt(fmt)

#include <linux/init.h>
#include <linux/slab.h>
#include <linux/wait.h>
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/usb.h>
#include <linux/delay.h>
#include <linux/time.h>
#include <linux/errno.h>
#include <linux/jiffies.h>
#include <linux/mutex.h>
#include <linux/firmware.h>

#include <media/dvb_frontend.h>
#include <media/dmxdev.h>
#include <media/dvb_demux.h>
#include <media/dvb_net.h>
#include "ves1820.h"
#include "cx22700.h"
#include "tda1004x.h"
#include "stv0299.h"
#include "tda8083.h"
#include "stv0297.h"
#include "lnbp21.h"

#include <linux/dvb/frontend.h>
#include <linux/dvb/dmx.h>
#include <linux/pci.h>

/*
  TTUSB_HWSECTIONS:
    the DSP supports filtering in hardware, however, since the "muxstream"
    is a bit braindead (no matching channel masks or no matching filter mask),
    we won't support this - yet. it doesn't event support negative filters,
    so the best way is maybe to keep TTUSB_HWSECTIONS undef'd and just
    parse TS data. USB bandwidth will be a problem when having large
    datastreams, especially for dvb-net, but hey, that's not my problem.

  TTUSB_DISEQC, TTUSB_TONE:
    let the STC do the diseqc/tone stuff. this isn't supported at least with
    my TTUSB, so let it undef'd unless you want to implement another
    frontend. never tested.

  debug:
    define it to > 3 for really hardcore debugging. you probably don't want
    this unless the device doesn't load at all. > 2 for bandwidth statistics.
*/

static int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC();

DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);

#define dprintk(fmt, arg...)


#define ISO_BUF_COUNT
#define FRAMES_PER_ISO_BUF
#define ISO_FRAME_SIZE
#define TTUSB_MAXCHANNEL
#ifdef TTUSB_HWSECTIONS
#define TTUSB_MAXFILTER
#endif

#define TTUSB_REV_2_2
#define TTUSB_BUDGET_NAME

#define MAX_SEND
#define MAX_RCV

/*
 *  since we're casting (struct ttusb*) <-> (struct dvb_demux*) around
 *  the dvb_demux field must be the first in struct!!
 */
struct ttusb {};

static int ttusb_cmd(struct ttusb *ttusb, u8 *data, int len, int len_result)
{}

static int ttusb_i2c_msg(struct ttusb *ttusb,
		  u8 addr, u8 * snd_buf, u8 snd_len, u8 * rcv_buf,
		  u8 rcv_len)
{}

static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num)
{}

static int ttusb_boot_dsp(struct ttusb *ttusb)
{}

static int ttusb_set_channel(struct ttusb *ttusb, int chan_id, int filter_type,
		      int pid)
{}

static int ttusb_del_channel(struct ttusb *ttusb, int channel_id)
{}

#ifdef TTUSB_HWSECTIONS
static int ttusb_set_filter(struct ttusb *ttusb, int filter_id,
		     int associated_chan, u8 filter[8], u8 mask[8])
{
	int err;
	/* SetFilter */
	u8 b[] = { 0xaa, 0, 0x24, 0x1a, filter_id, associated_chan,
		filter[0], filter[1], filter[2], filter[3],
		filter[4], filter[5], filter[6], filter[7],
		filter[8], filter[9], filter[10], filter[11],
		mask[0], mask[1], mask[2], mask[3],
		mask[4], mask[5], mask[6], mask[7],
		mask[8], mask[9], mask[10], mask[11]
	};

	err = ttusb_cmd(ttusb, b, sizeof(b), 0);
	return err;
}

static int ttusb_del_filter(struct ttusb *ttusb, int filter_id)
{
	int err;
	/* DelFilter */
	u8 b[] = { 0xaa, ++ttusb->c, 0x25, 1, filter_id };

	err = ttusb_cmd(ttusb, b, sizeof(b), 0);
	return err;
}
#endif

static int ttusb_init_controller(struct ttusb *ttusb)
{}

#ifdef TTUSB_DISEQC
static int ttusb_send_diseqc(struct dvb_frontend* fe,
			     const struct dvb_diseqc_master_cmd *cmd)
{
	struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv;
	u8 b[12] = { 0xaa, ++ttusb->c, 0x18 };

	int err;

	b[3] = 4 + 2 + cmd->msg_len;
	b[4] = 0xFF;		/* send diseqc master, not burst */
	b[5] = cmd->msg_len;

	memcpy(b + 5, cmd->msg, cmd->msg_len);

	/* Diseqc */
	if ((err = ttusb_cmd(ttusb, b, 4 + b[3], 0))) {
		dprintk("usb_bulk_msg() failed, return value %i!\n", err);
	}

	return err;
}
#endif

static int ttusb_update_lnb(struct ttusb *ttusb)
{}

static int ttusb_set_voltage(struct dvb_frontend *fe,
			     enum fe_sec_voltage voltage)
{}

#ifdef TTUSB_TONE
static int ttusb_set_tone(struct dvb_frontend *fe, enum fe_sec_tone_mode tone)
{
	struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv;

	ttusb->tone = tone;
	return ttusb_update_lnb(ttusb);
}
#endif


#if 0
static void ttusb_set_led_freq(struct ttusb *ttusb, u8 freq)
{
	u8 b[] = { 0xaa, ++ttusb->c, 0x19, 1, freq };
	int err, actual_len;

	err = ttusb_cmd(ttusb, b, sizeof(b), 0);
	if (err) {
		dprintk("usb_bulk_msg() failed, return value %i!\n", err);
	}
}
#endif

/*****************************************************************************/

#ifdef TTUSB_HWSECTIONS
static void ttusb_handle_ts_data(struct ttusb_channel *channel,
				 const u8 * data, int len);
static void ttusb_handle_sec_data(struct ttusb_channel *channel,
				  const u8 * data, int len);
#endif

static int numpkt, numts, numstuff, numsec, numinvalid;
static unsigned long lastj;

static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack,
			   int len)
{}

static void ttusb_process_frame(struct ttusb *ttusb, u8 * data, int len)
{}

static void ttusb_iso_irq(struct urb *urb)
{}

static void ttusb_free_iso_urbs(struct ttusb *ttusb)
{}

static int ttusb_alloc_iso_urbs(struct ttusb *ttusb)
{}

static void ttusb_stop_iso_xfer(struct ttusb *ttusb)
{}

static int ttusb_start_iso_xfer(struct ttusb *ttusb)
{}

#ifdef TTUSB_HWSECTIONS
static void ttusb_handle_ts_data(struct dvb_demux_feed *dvbdmxfeed, const u8 * data,
			  int len)
{
	dvbdmxfeed->cb.ts(data, len, 0, 0, &dvbdmxfeed->feed.ts, 0);
}

static void ttusb_handle_sec_data(struct dvb_demux_feed *dvbdmxfeed, const u8 * data,
			   int len)
{
//      struct dvb_demux_feed *dvbdmxfeed = channel->dvbdmxfeed;
#error TODO: handle ugly stuff
//      dvbdmxfeed->cb.sec(data, len, 0, 0, &dvbdmxfeed->feed.sec, 0);
}
#endif

static int ttusb_start_feed(struct dvb_demux_feed *dvbdmxfeed)
{}

static int ttusb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
{}

static int ttusb_setup_interfaces(struct ttusb *ttusb)
{}

#if 0
static u8 stc_firmware[8192];

static int stc_open(struct inode *inode, struct file *file)
{
	struct ttusb *ttusb = file->private_data;
	int addr;

	for (addr = 0; addr < 8192; addr += 16) {
		u8 snd_buf[2] = { addr >> 8, addr & 0xFF };
		ttusb_i2c_msg(ttusb, 0x50, snd_buf, 2, stc_firmware + addr,
			      16);
	}

	return 0;
}

static ssize_t stc_read(struct file *file, char *buf, size_t count,
		 loff_t *offset)
{
	return simple_read_from_buffer(buf, count, offset, stc_firmware, 8192);
}

static int stc_release(struct inode *inode, struct file *file)
{
	return 0;
}

static const struct file_operations stc_fops = {
	.owner = THIS_MODULE,
	.read = stc_read,
	.open = stc_open,
	.release = stc_release,
};
#endif

static u32 functionality(struct i2c_adapter *adapter)
{}



static int alps_tdmb7_tuner_set_params(struct dvb_frontend *fe)
{}

static struct cx22700_config alps_tdmb7_config =;





static int philips_tdm1316l_tuner_init(struct dvb_frontend* fe)
{}

static int philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe)
{}

static int philips_tdm1316l_request_firmware(struct dvb_frontend* fe, const struct firmware **fw, char* name)
{}

static struct tda1004x_config philips_tdm1316l_config =;

static u8 alps_bsbe1_inittab[] =;

static u8 alps_bsru6_inittab[] =;

static int alps_stv0299_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 ratio)
{}

static int philips_tsa5059_tuner_set_params(struct dvb_frontend *fe)
{}

static struct stv0299_config alps_stv0299_config =;

static int ttusb_novas_grundig_29504_491_tuner_set_params(struct dvb_frontend *fe)
{}

static struct tda8083_config ttusb_novas_grundig_29504_491_config =;

static int alps_tdbe2_tuner_set_params(struct dvb_frontend *fe)
{}


static struct ves1820_config alps_tdbe2_config =;

static u8 read_pwm(struct ttusb* ttusb)
{}


static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe)
{}

static u8 dvbc_philips_tdm1316l_inittab[] =;

static struct stv0297_config dvbc_philips_tdm1316l_config =;

static void frontend_init(struct ttusb* ttusb)
{}



static const struct i2c_algorithm ttusb_dec_algo =;

static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *id)
{}

static void ttusb_disconnect(struct usb_interface *intf)
{}

static const struct usb_device_id ttusb_table[] =;

MODULE_DEVICE_TABLE(usb, ttusb_table);

static struct usb_driver ttusb_driver =;

module_usb_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_FIRMWARE();