linux/drivers/media/pci/cobalt/cobalt-driver.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 *  cobalt driver internal defines and structures
 *
 *  Derived from cx18-driver.h
 *
 *  Copyright 2012-2015 Cisco Systems, Inc. and/or its affiliates.
 *  All rights reserved.
 */

#ifndef COBALT_DRIVER_H
#define COBALT_DRIVER_H

#include <linux/bitops.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/spinlock.h>
#include <linux/i2c.h>
#include <linux/list.h>
#include <linux/workqueue.h>
#include <linux/mutex.h>

#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fh.h>
#include <media/videobuf2-v4l2.h>
#include <media/videobuf2-dma-sg.h>

#include "m00233_video_measure_memmap_package.h"
#include "m00235_fdma_packer_memmap_package.h"
#include "m00389_cvi_memmap_package.h"
#include "m00460_evcnt_memmap_package.h"
#include "m00473_freewheel_memmap_package.h"
#include "m00479_clk_loss_detector_memmap_package.h"
#include "m00514_syncgen_flow_evcnt_memmap_package.h"

/* System device ID */
#define PCI_DEVICE_ID_COBALT

/* Number of cobalt device nodes. */
#define COBALT_NUM_INPUTS
#define COBALT_NUM_NODES

/* Number of cobalt device streams. */
#define COBALT_NUM_STREAMS

#define COBALT_HSMA_IN_NODE
#define COBALT_HSMA_OUT_NODE

/* Cobalt audio streams */
#define COBALT_AUDIO_IN_STREAM
#define COBALT_AUDIO_OUT_STREAM

/* DMA stuff */
#define DMA_CHANNELS_MAX

/* i2c stuff */
#define I2C_CLIENTS_MAX
#define COBALT_NUM_ADAPTERS

#define COBALT_CLK

/* System status register */
#define COBALT_SYSSTAT_DIP0_MSK
#define COBALT_SYSSTAT_DIP1_MSK
#define COBALT_SYSSTAT_HSMA_PRSNTN_MSK
#define COBALT_SYSSTAT_FLASH_RDYBSYN_MSK
#define COBALT_SYSSTAT_VI0_5V_MSK
#define COBALT_SYSSTAT_VI0_INT1_MSK
#define COBALT_SYSSTAT_VI0_INT2_MSK
#define COBALT_SYSSTAT_VI0_LOST_DATA_MSK
#define COBALT_SYSSTAT_VI1_5V_MSK
#define COBALT_SYSSTAT_VI1_INT1_MSK
#define COBALT_SYSSTAT_VI1_INT2_MSK
#define COBALT_SYSSTAT_VI1_LOST_DATA_MSK
#define COBALT_SYSSTAT_VI2_5V_MSK
#define COBALT_SYSSTAT_VI2_INT1_MSK
#define COBALT_SYSSTAT_VI2_INT2_MSK
#define COBALT_SYSSTAT_VI2_LOST_DATA_MSK
#define COBALT_SYSSTAT_VI3_5V_MSK
#define COBALT_SYSSTAT_VI3_INT1_MSK
#define COBALT_SYSSTAT_VI3_INT2_MSK
#define COBALT_SYSSTAT_VI3_LOST_DATA_MSK
#define COBALT_SYSSTAT_VIHSMA_5V_MSK
#define COBALT_SYSSTAT_VIHSMA_INT1_MSK
#define COBALT_SYSSTAT_VIHSMA_INT2_MSK
#define COBALT_SYSSTAT_VIHSMA_LOST_DATA_MSK
#define COBALT_SYSSTAT_VOHSMA_INT1_MSK
#define COBALT_SYSSTAT_VOHSMA_PLL_LOCKED_MSK
#define COBALT_SYSSTAT_VOHSMA_LOST_DATA_MSK
#define COBALT_SYSSTAT_AUD_PLL_LOCKED_MSK
#define COBALT_SYSSTAT_AUD_IN_LOST_DATA_MSK
#define COBALT_SYSSTAT_AUD_OUT_LOST_DATA_MSK
#define COBALT_SYSSTAT_PCIE_SMBCLK_MSK

/* Cobalt memory map */
#define COBALT_I2C_0_BASE
#define COBALT_I2C_1_BASE
#define COBALT_I2C_2_BASE
#define COBALT_I2C_3_BASE
#define COBALT_I2C_HSMA_BASE

#define COBALT_SYS_CTRL_BASE
#define COBALT_SYS_CTRL_HSMA_TX_ENABLE_BIT
#define COBALT_SYS_CTRL_VIDEO_RX_RESETN_BIT(n)
#define COBALT_SYS_CTRL_NRESET_TO_HDMI_BIT(n)
#define COBALT_SYS_CTRL_HPD_TO_CONNECTOR_BIT(n)
#define COBALT_SYS_CTRL_AUDIO_IPP_RESETN_BIT(n)
#define COBALT_SYS_CTRL_PWRDN0_TO_HSMA_TX_BIT
#define COBALT_SYS_CTRL_VIDEO_TX_RESETN_BIT
#define COBALT_SYS_CTRL_AUDIO_OPP_RESETN_BIT

#define COBALT_SYS_STAT_BASE
#define COBALT_SYS_STAT_MASK
#define COBALT_SYS_STAT_EDGE

#define COBALT_HDL_INFO_BASE
#define COBALT_HDL_INFO_SIZE

#define COBALT_VID_BASE
#define COBALT_VID_SIZE

#define COBALT_CVI(cobalt, c)
#define COBALT_CVI_VMR(cobalt, c)
#define COBALT_CVI_EVCNT(cobalt, c)
#define COBALT_CVI_FREEWHEEL(cobalt, c)
#define COBALT_CVI_CLK_LOSS(cobalt, c)
#define COBALT_CVI_PACKER(cobalt, c)

#define COBALT_TX_BASE(cobalt)

#define DMA_INTERRUPT_STATUS_REG

#define COBALT_HDL_SEARCH_STR

/* Cobalt CPU bus interface */
#define COBALT_BUS_BAR1_BASE
#define COBALT_BUS_SRAM_BASE
#define COBALT_BUS_CPLD_BASE
#define COBALT_BUS_FLASH_BASE

/* FDMA to PCIe packing */
#define COBALT_BYTES_PER_PIXEL_YUYV
#define COBALT_BYTES_PER_PIXEL_RGB24
#define COBALT_BYTES_PER_PIXEL_RGB32

/* debugging */
extern int cobalt_debug;
extern int cobalt_ignore_err;

#define cobalt_err(fmt, arg...)
#define cobalt_warn(fmt, arg...)
#define cobalt_info(fmt, arg...)
#define cobalt_dbg(level, fmt, arg...)

struct cobalt;
struct cobalt_i2c_regs;

/* Per I2C bus private algo callback data */
struct cobalt_i2c_data {};

struct pci_consistent_buffer {};

struct sg_dma_desc_info {};

#define COBALT_MAX_WIDTH
#define COBALT_MAX_HEIGHT
#define COBALT_MAX_BPP
#define COBALT_MAX_FRAMESZ

#define NR_BUFS

#define COBALT_STREAM_FL_DMA_IRQ
#define COBALT_STREAM_FL_ADV_IRQ

struct cobalt_buffer {};

static inline
struct cobalt_buffer *to_cobalt_buffer(struct vb2_v4l2_buffer *vb2)
{}

struct cobalt_stream {};

struct snd_cobalt_card;

/* Struct to hold info about cobalt cards */
struct cobalt {};

static inline struct cobalt *to_cobalt(struct v4l2_device *v4l2_dev)
{}

static inline void cobalt_write_bar0(struct cobalt *cobalt, u32 reg, u32 val)
{}

static inline u32 cobalt_read_bar0(struct cobalt *cobalt, u32 reg)
{}

static inline void cobalt_write_bar1(struct cobalt *cobalt, u32 reg, u32 val)
{}

static inline u32 cobalt_read_bar1(struct cobalt *cobalt, u32 reg)
{}

static inline u32 cobalt_g_sysctrl(struct cobalt *cobalt)
{}

static inline void cobalt_s_bit_sysctrl(struct cobalt *cobalt,
					int bit, int val)
{}

static inline u32 cobalt_g_sysstat(struct cobalt *cobalt)
{}

#define ADRS_REG
#define LOWER_DATA
#define UPPER_DATA

static inline u32 cobalt_bus_read32(void __iomem *bar1, u32 bus_adrs)
{}

static inline void cobalt_bus_write16(void __iomem *bar1,
				      u32 bus_adrs, u16 data)
{}

static inline void cobalt_bus_write32(void __iomem *bar1,
				      u32 bus_adrs, u16 data)
{}

/*==============Prototypes==================*/

void cobalt_pcie_status_show(struct cobalt *cobalt);

#endif