drivers/staging/media/atomisp/pci/runtime/inputfifo/src/inputfifo.c

Source file repositories/reference/linux-study-clean/drivers/staging/media/atomisp/pci/runtime/inputfifo/src/inputfifo.c

File Facts

System
Linux kernel
Corpus path
drivers/staging/media/atomisp/pci/runtime/inputfifo/src/inputfifo.c
Extension
.c
Size
14034 bytes
Lines
521
Domain
Driver Families
Bucket
drivers/staging
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct inputfifo_instance {
	unsigned int				ch_id;
	enum atomisp_input_format	input_format;
	bool						two_ppc;
	bool						streaming;
	unsigned int				hblank_cycles;
	unsigned int				marker_cycles;
	unsigned int				fmt_type;
	enum inputfifo_mipi_data_type	type;
};

/*
 * Maintain a basic streaming to Mipi administration with ch_id as index
 * ch_id maps on the "Mipi virtual channel ID" and can have value 0..3
 */
#define INPUTFIFO_NR_OF_S2M_CHANNELS	(4)
static struct inputfifo_instance
	inputfifo_inst_admin[INPUTFIFO_NR_OF_S2M_CHANNELS];

/* Streaming to MIPI */
static unsigned int inputfifo_wrap_marker(
    /* static inline unsigned inputfifo_wrap_marker( */
    unsigned int marker)
{
	return marker |
	       (inputfifo_curr_ch_id << HIVE_STR_TO_MIPI_CH_ID_LSB) |
	       (inputfifo_curr_fmt_type << _HIVE_STR_TO_MIPI_FMT_TYPE_LSB);
}

static inline void
_sh_css_fifo_snd(unsigned int token)
{
	while (!can_event_send_token(STR2MIPI_EVENT_ID))
		udelay(1);
	event_send_token(STR2MIPI_EVENT_ID, token);
	return;
}

static void inputfifo_send_data_a(
    /* static inline void inputfifo_send_data_a( */
    unsigned int data)
{
	unsigned int token = (1 << HIVE_STR_TO_MIPI_VALID_A_BIT) |
			     (data << HIVE_STR_TO_MIPI_DATA_A_LSB);
	_sh_css_fifo_snd(token);
	return;
}

static void inputfifo_send_data_b(
    /* static inline void inputfifo_send_data_b( */
    unsigned int data)
{
	unsigned int token = (1 << HIVE_STR_TO_MIPI_VALID_B_BIT) |
			     (data << _HIVE_STR_TO_MIPI_DATA_B_LSB);
	_sh_css_fifo_snd(token);
	return;
}

static void inputfifo_send_data(
    /* static inline void inputfifo_send_data( */
    unsigned int a,
    unsigned int b)
{
	unsigned int token = ((1 << HIVE_STR_TO_MIPI_VALID_A_BIT) |
			      (1 << HIVE_STR_TO_MIPI_VALID_B_BIT) |
			      (a << HIVE_STR_TO_MIPI_DATA_A_LSB) |
			      (b << _HIVE_STR_TO_MIPI_DATA_B_LSB));
	_sh_css_fifo_snd(token);
	return;
}

static void inputfifo_send_sol(void)
/* static inline void inputfifo_send_sol(void) */
{
	hrt_data	token = inputfifo_wrap_marker(
				1 << HIVE_STR_TO_MIPI_SOL_BIT);

	_sh_css_fifo_snd(token);
	return;
}

static void inputfifo_send_eol(void)
/* static inline void inputfifo_send_eol(void) */
{
	hrt_data	token = inputfifo_wrap_marker(
				1 << HIVE_STR_TO_MIPI_EOL_BIT);
	_sh_css_fifo_snd(token);
	return;
}

Annotation

Implementation Notes