linux/drivers/media/pci/cx23885/cx23885-core.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  Driver for the Conexant CX23885 PCIe bridge
 *
 *  Copyright (c) 2006 Steven Toth <[email protected]>
 */

#include "cx23885.h"

#include <linux/init.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kmod.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <asm/div64.h>
#include <linux/firmware.h>

#include "cimax2.h"
#include "altera-ci.h"
#include "cx23888-ir.h"
#include "cx23885-ir.h"
#include "cx23885-av.h"
#include "cx23885-input.h"

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();
MODULE_VERSION();

/*
 * Some platforms have been found to require periodic resetting of the DMA
 * engine. Ryzen and XEON platforms are known to be affected. The symptom
 * encountered is "mpeg risc op code error". Only Ryzen platforms employ
 * this workaround if the option equals 1. The workaround can be explicitly
 * disabled for all platforms by setting to 0, the workaround can be forced
 * on for any platform by setting to 2.
 */
static unsigned int dma_reset_workaround =;
module_param(dma_reset_workaround, int, 0644);
MODULE_PARM_DESC();

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

static unsigned int card[]  =;
module_param_array();
MODULE_PARM_DESC();

#define dprintk(level, fmt, arg...)

static unsigned int cx23885_devcount;

#define NO_SYNC_LINE

/* FIXME, these allocations will change when
 * analog arrives. The be reviewed.
 * CX23887 Assumptions
 * 1 line = 16 bytes of CDT
 * cmds size = 80
 * cdt size = 16 * linesize
 * iqsize = 64
 * maxlines = 6
 *
 * Address Space:
 * 0x00000000 0x00008fff FIFO clusters
 * 0x00010000 0x000104af Channel Management Data Structures
 * 0x000104b0 0x000104ff Free
 * 0x00010500 0x000108bf 15 channels * iqsize
 * 0x000108c0 0x000108ff Free
 * 0x00010900 0x00010e9f IQ's + Cluster Descriptor Tables
 *                       15 channels * (iqsize + (maxlines * linesize))
 * 0x00010ea0 0x00010xxx Free
 */

static struct sram_channel cx23885_sram_channels[] =;

static struct sram_channel cx23887_sram_channels[] =;

static void cx23885_irq_add(struct cx23885_dev *dev, u32 mask)
{}

void cx23885_irq_add_enable(struct cx23885_dev *dev, u32 mask)
{}

void cx23885_irq_enable(struct cx23885_dev *dev, u32 mask)
{}

static inline void cx23885_irq_enable_all(struct cx23885_dev *dev)
{}

void cx23885_irq_disable(struct cx23885_dev *dev, u32 mask)
{}

static inline void cx23885_irq_disable_all(struct cx23885_dev *dev)
{}

void cx23885_irq_remove(struct cx23885_dev *dev, u32 mask)
{}

static u32 cx23885_irq_get_mask(struct cx23885_dev *dev)
{}

static int cx23885_risc_decode(u32 risc)
{}

static void cx23885_wakeup(struct cx23885_tsport *port,
			   struct cx23885_dmaqueue *q, u32 count)
{}

int cx23885_sram_channel_setup(struct cx23885_dev *dev,
				      struct sram_channel *ch,
				      unsigned int bpl, u32 risc)
{}

void cx23885_sram_channel_dump(struct cx23885_dev *dev,
				      struct sram_channel *ch)
{}

static void cx23885_risc_disasm(struct cx23885_tsport *port,
				struct cx23885_riscmem *risc)
{}

static void cx23885_clear_bridge_error(struct cx23885_dev *dev)
{}

static void cx23885_shutdown(struct cx23885_dev *dev)
{}

static void cx23885_reset(struct cx23885_dev *dev)
{}


static int cx23885_pci_quirks(struct cx23885_dev *dev)
{}

static int get_resources(struct cx23885_dev *dev)
{}

static int cx23885_init_tsport(struct cx23885_dev *dev,
	struct cx23885_tsport *port, int portno)
{}

static void cx23885_dev_checkrevision(struct cx23885_dev *dev)
{}

/* Find the first v4l2_subdev member of the group id in hw */
struct v4l2_subdev *cx23885_find_hw(struct cx23885_dev *dev, u32 hw)
{}

static int cx23885_dev_setup(struct cx23885_dev *dev)
{}

static void cx23885_dev_unregister(struct cx23885_dev *dev)
{}

static __le32 *cx23885_risc_field(__le32 *rp, struct scatterlist *sglist,
			       unsigned int offset, u32 sync_line,
			       unsigned int bpl, unsigned int padding,
			       unsigned int lines,  unsigned int lpi, bool jump)
{}

int cx23885_risc_buffer(struct pci_dev *pci, struct cx23885_riscmem *risc,
			struct scatterlist *sglist, unsigned int top_offset,
			unsigned int bottom_offset, unsigned int bpl,
			unsigned int padding, unsigned int lines)
{}

int cx23885_risc_databuffer(struct pci_dev *pci,
				   struct cx23885_riscmem *risc,
				   struct scatterlist *sglist,
				   unsigned int bpl,
				   unsigned int lines, unsigned int lpi)
{}

int cx23885_risc_vbibuffer(struct pci_dev *pci, struct cx23885_riscmem *risc,
			struct scatterlist *sglist, unsigned int top_offset,
			unsigned int bottom_offset, unsigned int bpl,
			unsigned int padding, unsigned int lines)
{}


void cx23885_free_buffer(struct cx23885_dev *dev, struct cx23885_buffer *buf)
{}

static void cx23885_tsport_reg_dump(struct cx23885_tsport *port)
{}

int cx23885_start_dma(struct cx23885_tsport *port,
			     struct cx23885_dmaqueue *q,
			     struct cx23885_buffer   *buf)
{}

static int cx23885_stop_dma(struct cx23885_tsport *port)
{}

/* ------------------------------------------------------------------ */

int cx23885_buf_prepare(struct cx23885_buffer *buf, struct cx23885_tsport *port)
{}

/*
 * The risc program for each buffer works as follows: it starts with a simple
 * 'JUMP to addr + 12', which is effectively a NOP. Then the code to DMA the
 * buffer follows and at the end we have a JUMP back to the start + 12 (skipping
 * the initial JUMP).
 *
 * This is the risc program of the first buffer to be queued if the active list
 * is empty and it just keeps DMAing this buffer without generating any
 * interrupts.
 *
 * If a new buffer is added then the initial JUMP in the code for that buffer
 * will generate an interrupt which signals that the previous buffer has been
 * DMAed successfully and that it can be returned to userspace.
 *
 * It also sets the final jump of the previous buffer to the start of the new
 * buffer, thus chaining the new buffer into the DMA chain. This is a single
 * atomic u32 write, so there is no race condition.
 *
 * The end-result of all this that you only get an interrupt when a buffer
 * is ready, so the control flow is very easy.
 */
void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf)
{}

/* ----------------------------------------------------------- */

static void do_cancel_buffers(struct cx23885_tsport *port, char *reason)
{}

void cx23885_cancel_buffers(struct cx23885_tsport *port)
{}

int cx23885_irq_417(struct cx23885_dev *dev, u32 status)
{}

static int cx23885_irq_ts(struct cx23885_tsport *port, u32 status)
{}

static irqreturn_t cx23885_irq(int irq, void *dev_id)
{}

static void cx23885_v4l2_dev_notify(struct v4l2_subdev *sd,
				    unsigned int notification, void *arg)
{}

static void cx23885_v4l2_dev_notify_init(struct cx23885_dev *dev)
{}

static inline int encoder_on_portb(struct cx23885_dev *dev)
{}

static inline int encoder_on_portc(struct cx23885_dev *dev)
{}

/* Mask represents 32 different GPIOs, GPIO's are split into multiple
 * registers depending on the board configuration (and whether the
 * 417 encoder (wi it's own GPIO's) are present. Each GPIO bit will
 * be pushed into the correct hardware register, regardless of the
 * physical location. Certain registers are shared so we sanity check
 * and report errors if we think we're tampering with a GPIo that might
 * be assigned to the encoder (and used for the host bus).
 *
 * GPIO  2 through  0 - On the cx23885 bridge
 * GPIO 18 through  3 - On the cx23417 host bus interface
 * GPIO 23 through 19 - On the cx25840 a/v core
 */
void cx23885_gpio_set(struct cx23885_dev *dev, u32 mask)
{}

void cx23885_gpio_clear(struct cx23885_dev *dev, u32 mask)
{}

u32 cx23885_gpio_get(struct cx23885_dev *dev, u32 mask)
{}

void cx23885_gpio_enable(struct cx23885_dev *dev, u32 mask, int asoutput)
{}

static struct {} const broken_dev_id[] =;

static bool cx23885_does_need_dma_reset(void)
{}

static int cx23885_initdev(struct pci_dev *pci_dev,
			   const struct pci_device_id *pci_id)
{}

static void cx23885_finidev(struct pci_dev *pci_dev)
{}

static const struct pci_device_id cx23885_pci_tbl[] =;
MODULE_DEVICE_TABLE(pci, cx23885_pci_tbl);

static struct pci_driver cx23885_pci_driver =;

static int __init cx23885_init(void)
{}

static void __exit cx23885_fini(void)
{}

module_init();
module_exit(cx23885_fini);