Commit 39bc26e4 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

media: atomisp: unify INPUT error return type



There is a typedef for INPUT errors. This is different between
ISP2401 and ISP2400. Place both at the same struct, at the
global header file.

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 9842fa16
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@
#define _IBUF_CNTRL_DMA_SYNC_WAIT_FOR_SYNC		1
#define _IBUF_CNTRL_DMA_SYNC_FSM_WAIT_FOR_ACK		(0x3 << 1)

typedef struct ib_buffer_s	ib_buffer_t;
struct	ib_buffer_s {
	u32	start_addr;	/* start address of the buffer in the
					 * "input-buffer hardware block"
@@ -42,6 +41,7 @@ struct ib_buffer_s {
	u32	stride;		/* stride per buffer line (in bytes) */
	u32	lines;		/* lines in the buffer */
};
typedef struct ib_buffer_s	ib_buffer_t;

typedef struct ibuf_ctrl_cfg_s ibuf_ctrl_cfg_t;
struct ibuf_ctrl_cfg_s {
+28 −28
Original line number Diff line number Diff line
@@ -32,15 +32,15 @@

static const ib_buffer_t   IB_BUFFER_NULL = {0, 0, 0 };

static input_system_error_t input_system_configure_channel(
static input_system_err_t input_system_configure_channel(
    const channel_cfg_t		channel);

static input_system_error_t input_system_configure_channel_sensor(
static input_system_err_t input_system_configure_channel_sensor(
    const channel_cfg_t		channel);

static input_system_error_t input_buffer_configuration(void);
static input_system_err_t input_buffer_configuration(void);

static input_system_error_t configuration_to_registers(void);
static input_system_err_t configuration_to_registers(void);

static void receiver_rst(const rx_ID_t ID);
static void input_system_network_rst(const input_system_ID_t ID);
@@ -65,17 +65,17 @@ static void input_system_network_configure(
    const input_system_network_cfg_t *const cfg);

// MW: CSI is previously named as "rx" short for "receiver"
static input_system_error_t set_csi_cfg(
static input_system_err_t set_csi_cfg(
    csi_cfg_t *const lhs,
    const csi_cfg_t *const rhs,
    input_system_config_flags_t *const flags);

static input_system_error_t set_source_type(
static input_system_err_t set_source_type(
    input_system_source_t *const lhs,
    const input_system_source_t				rhs,
    input_system_config_flags_t *const flags);

static input_system_error_t input_system_multiplexer_cfg(
static input_system_err_t input_system_multiplexer_cfg(
    input_system_multiplex_t *const lhs,
    const input_system_multiplex_t			rhs,
    input_system_config_flags_t *const flags);
@@ -848,7 +848,7 @@ static void input_system_network_rst(const input_system_ID_t ID)
}

// Function that resets current configuration.
input_system_error_t input_system_configuration_reset(void)
input_system_err_t input_system_configuration_reset(void)
{
	unsigned int i;

@@ -890,10 +890,10 @@ input_system_error_t input_system_configuration_reset(void)

// MW: Comments are good, but doxygen is required, place it at the declaration
// Function that appends the channel to current configuration.
static input_system_error_t input_system_configure_channel(
static input_system_err_t input_system_configure_channel(
    const channel_cfg_t		channel)
{
	input_system_error_t error = INPUT_SYSTEM_ERR_NO_ERROR;
	input_system_err_t error = INPUT_SYSTEM_ERR_NO_ERROR;
	// Check if channel is not already configured.
	if (config.ch_flags[channel.ch_id] & INPUT_SYSTEM_CFG_FLAG_SET) {
		return INPUT_SYSTEM_ERR_CHANNEL_ALREADY_SET;
@@ -948,7 +948,7 @@ static input_system_error_t input_system_configure_channel(
}

// Function that partitions input buffer space with determining addresses.
static input_system_error_t input_buffer_configuration(void)
static input_system_err_t input_buffer_configuration(void)
{
	u32 current_address    = 0;
	u32 unallocated_memory = IB_CAPACITY_IN_WORDS;
@@ -1236,7 +1236,7 @@ static void input_system_network_configure(
	return;
}

static input_system_error_t configuration_to_registers(void)
static input_system_err_t configuration_to_registers(void)
{
	input_system_network_cfg_t input_system_network_cfg;
	int i;
@@ -1335,10 +1335,10 @@ static input_system_error_t configuration_to_registers(void)
}

// Function that applies the whole configuration.
input_system_error_t input_system_configuration_commit(void)
input_system_err_t input_system_configuration_commit(void)
{
	// The last configuration step is to configure the input buffer.
	input_system_error_t error = input_buffer_configuration();
	input_system_err_t error = input_buffer_configuration();

	if (error != INPUT_SYSTEM_ERR_NO_ERROR) {
		return error;
@@ -1357,7 +1357,7 @@ input_system_error_t input_system_configuration_commit(void)

// FIFO

input_system_error_t	input_system_csi_fifo_channel_cfg(
input_system_err_t	input_system_csi_fifo_channel_cfg(
    u32		ch_id,
    input_system_csi_port_t	port,
    backend_channel_cfg_t	backend_ch,
@@ -1380,7 +1380,7 @@ input_system_error_t input_system_csi_fifo_channel_cfg(
	return input_system_configure_channel(channel);
}

input_system_error_t	input_system_csi_fifo_channel_with_counting_cfg(
input_system_err_t	input_system_csi_fifo_channel_with_counting_cfg(
    u32				ch_id,
    u32				nof_frames,
    input_system_csi_port_t			port,
@@ -1411,7 +1411,7 @@ input_system_error_t input_system_csi_fifo_channel_with_counting_cfg(

// SRAM

input_system_error_t	input_system_csi_sram_channel_cfg(
input_system_err_t	input_system_csi_sram_channel_cfg(
    u32				ch_id,
    input_system_csi_port_t			port,
    backend_channel_cfg_t			backend_ch,
@@ -1443,7 +1443,7 @@ input_system_error_t input_system_csi_sram_channel_cfg(
//XMEM

// Collects all parameters and puts them in channel_cfg_t.
input_system_error_t	input_system_csi_xmem_channel_cfg(
input_system_err_t	input_system_csi_xmem_channel_cfg(
    u32				ch_id,
    input_system_csi_port_t			port,
    backend_channel_cfg_t			backend_ch,
@@ -1475,7 +1475,7 @@ input_system_error_t input_system_csi_xmem_channel_cfg(
	return input_system_configure_channel(channel);
}

input_system_error_t	input_system_csi_xmem_acquire_only_channel_cfg(
input_system_err_t	input_system_csi_xmem_acquire_only_channel_cfg(
    u32				ch_id,
    u32				nof_frames,
    input_system_csi_port_t			port,
@@ -1502,7 +1502,7 @@ input_system_error_t input_system_csi_xmem_acquire_only_channel_cfg(
	return input_system_configure_channel(channel);
}

input_system_error_t	input_system_csi_xmem_capture_only_channel_cfg(
input_system_err_t	input_system_csi_xmem_capture_only_channel_cfg(
    u32				ch_id,
    u32				nof_frames,
    input_system_csi_port_t			port,
@@ -1535,7 +1535,7 @@ input_system_error_t input_system_csi_xmem_capture_only_channel_cfg(

// Non - CSI

input_system_error_t	input_system_prbs_channel_cfg(
input_system_err_t	input_system_prbs_channel_cfg(
    u32		ch_id,
    u32		nof_frames,//not used yet
    u32		seed,
@@ -1564,7 +1564,7 @@ input_system_error_t input_system_prbs_channel_cfg(
	return input_system_configure_channel(channel);
}

input_system_error_t	input_system_tpg_channel_cfg(
input_system_err_t	input_system_tpg_channel_cfg(
    u32		ch_id,
    u32		nof_frames,//not used yet
    u32		x_mask,
@@ -1601,7 +1601,7 @@ input_system_error_t input_system_tpg_channel_cfg(
}

// MW: Don't use system specific names, (even in system specific files) "cfg2400" -> cfg
input_system_error_t	input_system_gpfifo_channel_cfg(
input_system_err_t	input_system_gpfifo_channel_cfg(
    u32		ch_id,
    u32		nof_frames, //not used yet

@@ -1625,11 +1625,11 @@ input_system_error_t input_system_gpfifo_channel_cfg(
///////////////////////////////////////////////////////////////////////////

// Fills the parameters to config.csi_value[port]
static input_system_error_t input_system_configure_channel_sensor(
static input_system_err_t input_system_configure_channel_sensor(
    const channel_cfg_t channel)
{
	const u32 port = channel.source_cfg.csi_cfg.csi_port;
	input_system_error_t status = INPUT_SYSTEM_ERR_NO_ERROR;
	input_system_err_t status = INPUT_SYSTEM_ERR_NO_ERROR;

	input_system_multiplex_t mux;

@@ -1711,7 +1711,7 @@ static input_system_error_t input_system_configure_channel_sensor(
}

// Test flags and set structure.
static input_system_error_t set_source_type(
static input_system_err_t set_source_type(
    input_system_source_t *const lhs,
    const input_system_source_t			rhs,
    input_system_config_flags_t *const flags)
@@ -1747,7 +1747,7 @@ static input_system_error_t set_source_type(
}

// Test flags and set structure.
static input_system_error_t set_csi_cfg(
static input_system_err_t set_csi_cfg(
    csi_cfg_t *const lhs,
    const csi_cfg_t *const rhs,
    input_system_config_flags_t *const flags)
@@ -1814,7 +1814,7 @@ static input_system_error_t set_csi_cfg(
}

// Test flags and set structure.
static input_system_error_t input_system_multiplexer_cfg(
static input_system_err_t input_system_multiplexer_cfg(
    input_system_multiplex_t *const lhs,
    const input_system_multiplex_t		rhs,
    input_system_config_flags_t *const flags)
+22 −0
Original line number Diff line number Diff line
@@ -4,8 +4,30 @@
 *    (c) 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
 */


#ifndef __INPUT_SYSTEM_GLOBAL_H_INCLUDED__
#define __INPUT_SYSTEM_GLOBAL_H_INCLUDED__
typedef enum {
	INPUT_SYSTEM_ERR_NO_ERROR = 0,
	/* ISP2401 */
	INPUT_SYSTEM_ERR_CREATE_CHANNEL_FAIL,
	INPUT_SYSTEM_ERR_CONFIGURE_CHANNEL_FAIL,
	INPUT_SYSTEM_ERR_OPEN_CHANNEL_FAIL,
	INPUT_SYSTEM_ERR_TRANSFER_FAIL,
	INPUT_SYSTEM_ERR_CREATE_INPUT_PORT_FAIL,
	INPUT_SYSTEM_ERR_CONFIGURE_INPUT_PORT_FAIL,
	INPUT_SYSTEM_ERR_OPEN_INPUT_PORT_FAIL,
	/* ISP2400 */
	INPUT_SYSTEM_ERR_GENERIC,
	INPUT_SYSTEM_ERR_CHANNEL_ALREADY_SET,
	INPUT_SYSTEM_ERR_CONFLICT_ON_RESOURCE,
	INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED,
} input_system_err_t;

#ifdef ISP2401
#  include "isp2401_input_system_global.h"
#else
#  include "isp2400_input_system_global.h"
#endif

#endif /* __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ */
+0 −7
Original line number Diff line number Diff line
@@ -13,11 +13,6 @@
 * more details.
 */

#ifndef __INPUT_SYSTEM_GLOBAL_H_INCLUDED__
#define __INPUT_SYSTEM_GLOBAL_H_INCLUDED__

#define IS_INPUT_SYSTEM_VERSION_2

#include <type_support.h>

//CSI reveiver has 3 ports.
@@ -152,5 +147,3 @@ typedef enum {
} input_system_cfg_flag_t;

typedef u32 input_system_config_flags_t;

#endif /* __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ */
+0 −9
Original line number Diff line number Diff line
@@ -33,15 +33,6 @@
#include "isp_acquisition_defs.h"
#include "input_system_ctrl_defs.h"

typedef enum {
	INPUT_SYSTEM_ERR_NO_ERROR = 0,
	INPUT_SYSTEM_ERR_GENERIC,
	INPUT_SYSTEM_ERR_CHANNEL_ALREADY_SET,
	INPUT_SYSTEM_ERR_CONFLICT_ON_RESOURCE,
	INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED,
	N_INPUT_SYSTEM_ERR
} input_system_error_t;

typedef enum {
	INPUT_SYSTEM_PORT_A = 0,
	INPUT_SYSTEM_PORT_B,
Loading