linux/drivers/media/usb/cx231xx/cx231xx-avcore.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
   cx231xx_avcore.c - driver for Conexant Cx23100/101/102
		      USB video capture devices

   Copyright (C) 2008 <srinivasa.deevi at conexant dot com>

   This program contains the specific code to control the avdecoder chip and
   other related usb control functions for cx231xx based chipset.

 */

#include "cx231xx.h"
#include <linux/init.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/bitmap.h>
#include <linux/i2c.h>
#include <linux/mm.h>
#include <linux/mutex.h>
#include <media/tuner.h>

#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>

#include "cx231xx-dif.h"

#define TUNER_MODE_FM_RADIO
/******************************************************************************
			-: BLOCK ARRANGEMENT :-
	I2S block ----------------------|
	[I2S audio]			|
					|
	Analog Front End --> Direct IF -|-> Cx25840 --> Audio
	[video & audio]			|   [Audio]
					|
					|-> Cx25840 --> Video
					    [Video]

*******************************************************************************/
/******************************************************************************
 *                    VERVE REGISTER                                          *
 *									      *
 ******************************************************************************/
static int verve_write_byte(struct cx231xx *dev, u8 saddr, u8 data)
{}

static int verve_read_byte(struct cx231xx *dev, u8 saddr, u8 *data)
{}
void initGPIO(struct cx231xx *dev)
{}
void uninitGPIO(struct cx231xx *dev)
{}

/******************************************************************************
 *                    A F E - B L O C K    C O N T R O L   functions          *
 *				[ANALOG FRONT END]			      *
 ******************************************************************************/
static int afe_write_byte(struct cx231xx *dev, u16 saddr, u8 data)
{}

static int afe_read_byte(struct cx231xx *dev, u16 saddr, u8 *data)
{}

int cx231xx_afe_init_super_block(struct cx231xx *dev, u32 ref_count)
{}

int cx231xx_afe_init_channels(struct cx231xx *dev)
{}

int cx231xx_afe_setup_AFE_for_baseband(struct cx231xx *dev)
{}

/*
	The Analog Front End in Cx231xx has 3 channels. These
	channels are used to share between different inputs
	like tuner, s-video and composite inputs.

	channel 1 ----- pin 1  to pin4(in reg is 1-4)
	channel 2 ----- pin 5  to pin8(in reg is 5-8)
	channel 3 ----- pin 9 to pin 12(in reg is 9-11)
*/
int cx231xx_afe_set_input_mux(struct cx231xx *dev, u32 input_mux)
{}

int cx231xx_afe_set_mode(struct cx231xx *dev, enum AFE_MODE mode)
{}

int cx231xx_afe_update_power_control(struct cx231xx *dev,
					enum AV_MODE avmode)
{}

int cx231xx_afe_adjust_ref_count(struct cx231xx *dev, u32 video_input)
{}

/******************************************************************************
 *     V I D E O / A U D I O    D E C O D E R    C O N T R O L   functions    *
 ******************************************************************************/
static int vid_blk_write_byte(struct cx231xx *dev, u16 saddr, u8 data)
{}

static int vid_blk_read_byte(struct cx231xx *dev, u16 saddr, u8 *data)
{}

static int vid_blk_write_word(struct cx231xx *dev, u16 saddr, u32 data)
{}

static int vid_blk_read_word(struct cx231xx *dev, u16 saddr, u32 *data)
{}
int cx231xx_check_fw(struct cx231xx *dev)
{}

int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input)
{}

int cx231xx_set_decoder_video_input(struct cx231xx *dev,
				u8 pin_type, u8 input)
{}

void cx231xx_enable656(struct cx231xx *dev)
{}
EXPORT_SYMBOL_GPL();

void cx231xx_disable656(struct cx231xx *dev)
{}
EXPORT_SYMBOL_GPL();

/*
 * Handle any video-mode specific overrides that are different
 * on a per video standards basis after touching the MODE_CTRL
 * register which resets many values for autodetect
 */
int cx231xx_do_mode_ctrl_overrides(struct cx231xx *dev)
{}

int cx231xx_unmute_audio(struct cx231xx *dev)
{}
EXPORT_SYMBOL_GPL();

static int stopAudioFirmware(struct cx231xx *dev)
{}

static int restartAudioFirmware(struct cx231xx *dev)
{}

int cx231xx_set_audio_input(struct cx231xx *dev, u8 input)
{}

int cx231xx_set_audio_decoder_input(struct cx231xx *dev,
				    enum AUDIO_INPUT audio_input)
{}

/******************************************************************************
 *                    C H I P Specific  C O N T R O L   functions             *
 ******************************************************************************/
int cx231xx_init_ctrl_pin_status(struct cx231xx *dev)
{}

int cx231xx_set_agc_analog_digital_mux_select(struct cx231xx *dev,
					      u8 analog_or_digital)
{}

int cx231xx_enable_i2c_port_3(struct cx231xx *dev, bool is_port_3)
{}
EXPORT_SYMBOL_GPL();

void update_HH_register_after_set_DIF(struct cx231xx *dev)
{}

void cx231xx_dump_HH_reg(struct cx231xx *dev)
{}

#if 0
static void cx231xx_dump_SC_reg(struct cx231xx *dev)
{
	u8 value[4] = { 0, 0, 0, 0 };
	dev_dbg(dev->dev, "%s!\n", __func__);

	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, BOARD_CFG_STAT,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", BOARD_CFG_STAT, value[0],
		value[1], value[2], value[3]);
	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, TS_MODE_REG,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", TS_MODE_REG, value[0],
		 value[1], value[2], value[3]);
	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, TS1_CFG_REG,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", TS1_CFG_REG, value[0],
		 value[1], value[2], value[3]);
	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, TS1_LENGTH_REG,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", TS1_LENGTH_REG, value[0],
		value[1], value[2], value[3]);

	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, TS2_CFG_REG,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", TS2_CFG_REG, value[0],
		value[1], value[2], value[3]);
	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, TS2_LENGTH_REG,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", TS2_LENGTH_REG, value[0],
		value[1], value[2], value[3]);
	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, EP_MODE_SET,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", EP_MODE_SET, value[0],
		 value[1], value[2], value[3]);
	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_PTN1,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_PTN1, value[0],
		value[1], value[2], value[3]);

	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_PTN2,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_PTN2, value[0],
		value[1], value[2], value[3]);
	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_PTN3,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_PTN3, value[0],
		value[1], value[2], value[3]);
	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_MASK0,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_MASK0, value[0],
		value[1], value[2], value[3]);
	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_MASK1,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_MASK1, value[0],
		value[1], value[2], value[3]);

	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_PWR_MASK2,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_PWR_MASK2, value[0],
		value[1], value[2], value[3]);
	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_GAIN,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_GAIN, value[0],
		value[1], value[2], value[3]);
	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_CAR_REG,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_CAR_REG, value[0],
		value[1], value[2], value[3]);
	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_OT_CFG1,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_OT_CFG1, value[0],
		value[1], value[2], value[3]);

	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, CIR_OT_CFG2,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", CIR_OT_CFG2, value[0],
		value[1], value[2], value[3]);
	cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, PWR_CTL_EN,
				 value, 4);
	dev_dbg(dev->dev,
		"reg0x%x=0x%x 0x%x 0x%x 0x%x\n", PWR_CTL_EN, value[0],
		value[1], value[2], value[3]);
}
#endif

void cx231xx_Setup_AFE_for_LowIF(struct cx231xx *dev)

{}

void cx231xx_set_Colibri_For_LowIF(struct cx231xx *dev, u32 if_freq,
		 u8 spectral_invert, u32 mode)
{}

u32 cx231xx_Get_Colibri_CarrierOffset(u32 mode, u32 standerd)
{}

void cx231xx_set_DIF_bandpass(struct cx231xx *dev, u32 if_freq,
		 u8 spectral_invert, u32 mode)
{}

/******************************************************************************
 *                 D I F - B L O C K    C O N T R O L   functions             *
 ******************************************************************************/
int cx231xx_dif_configure_C2HH_for_low_IF(struct cx231xx *dev, u32 mode,
					  u32 function_mode, u32 standard)
{}

int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard)
{}

int cx231xx_tuner_pre_channel_change(struct cx231xx *dev)
{}

int cx231xx_tuner_post_channel_change(struct cx231xx *dev)
{}

/******************************************************************************
 *		    I 2 S - B L O C K    C O N T R O L   functions            *
 ******************************************************************************/
int cx231xx_i2s_blk_initialize(struct cx231xx *dev)
{}

int cx231xx_i2s_blk_update_power_control(struct cx231xx *dev,
					enum AV_MODE avmode)
{}

/* set i2s_blk for audio input types */
int cx231xx_i2s_blk_set_audio_input(struct cx231xx *dev, u8 audio_input)
{}

/******************************************************************************
 *                  P O W E R      C O N T R O L   functions                  *
 ******************************************************************************/
int cx231xx_set_power_mode(struct cx231xx *dev, enum AV_MODE mode)
{}

int cx231xx_power_suspend(struct cx231xx *dev)
{}

/******************************************************************************
 *                  S T R E A M    C O N T R O L   functions                  *
 ******************************************************************************/
int cx231xx_start_stream(struct cx231xx *dev, u32 ep_mask)
{}

int cx231xx_stop_stream(struct cx231xx *dev, u32 ep_mask)
{}

int cx231xx_initialize_stream_xfer(struct cx231xx *dev, u32 media_type)
{}

int cx231xx_capture_start(struct cx231xx *dev, int start, u8 media_type)
{}
EXPORT_SYMBOL_GPL();

/*****************************************************************************
*                   G P I O   B I T control functions                        *
******************************************************************************/
static int cx231xx_set_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u32 gpio_val)
{}

static int cx231xx_get_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u32 *gpio_val)
{}

/*
* cx231xx_set_gpio_direction
*      Sets the direction of the GPIO pin to input or output
*
* Parameters :
*      pin_number : The GPIO Pin number to program the direction for
*                   from 0 to 31
*      pin_value : The Direction of the GPIO Pin under reference.
*                      0 = Input direction
*                      1 = Output direction
*/
int cx231xx_set_gpio_direction(struct cx231xx *dev,
			       int pin_number, int pin_value)
{}

/*
* cx231xx_set_gpio_value
*      Sets the value of the GPIO pin to Logic high or low. The Pin under
*      reference should ALREADY BE SET IN OUTPUT MODE !!!!!!!!!
*
* Parameters :
*      pin_number : The GPIO Pin number to program the direction for
*      pin_value : The value of the GPIO Pin under reference.
*                      0 = set it to 0
*                      1 = set it to 1
*/
int cx231xx_set_gpio_value(struct cx231xx *dev, int pin_number, int pin_value)
{}

/*****************************************************************************
*                      G P I O I2C related functions                         *
******************************************************************************/
int cx231xx_gpio_i2c_start(struct cx231xx *dev)
{}

int cx231xx_gpio_i2c_end(struct cx231xx *dev)
{}

int cx231xx_gpio_i2c_write_byte(struct cx231xx *dev, u8 data)
{}

int cx231xx_gpio_i2c_read_byte(struct cx231xx *dev, u8 *buf)
{}

int cx231xx_gpio_i2c_read_ack(struct cx231xx *dev)
{}

int cx231xx_gpio_i2c_write_ack(struct cx231xx *dev)
{}

int cx231xx_gpio_i2c_write_nak(struct cx231xx *dev)
{}

/*****************************************************************************
*                      G P I O I2C related functions                         *
******************************************************************************/
/* cx231xx_gpio_i2c_read
 * Function to read data from gpio based I2C interface
 */
int cx231xx_gpio_i2c_read(struct cx231xx *dev, u8 dev_addr, u8 *buf, u8 len)
{}

/* cx231xx_gpio_i2c_write
 * Function to write data to gpio based I2C interface
 */
int cx231xx_gpio_i2c_write(struct cx231xx *dev, u8 dev_addr, u8 *buf, u8 len)
{}