linux/drivers/staging/media/atomisp/pci/sh_css_sp.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2/*
   3 * Support for Intel Camera Imaging ISP subsystem.
   4 * Copyright (c) 2015, Intel Corporation.
   5 *
   6 * This program is free software; you can redistribute it and/or modify it
   7 * under the terms and conditions of the GNU General Public License,
   8 * version 2, as published by the Free Software Foundation.
   9 *
  10 * This program is distributed in the hope it will be useful, but WITHOUT
  11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  13 * more details.
  14 */
  15
  16#ifndef _SH_CSS_SP_H_
  17#define _SH_CSS_SP_H_
  18
  19#include <system_global.h>
  20#include <type_support.h>
  21#if !defined(ISP2401)
  22#include "input_formatter.h"
  23#endif
  24
  25#include "ia_css_binary.h"
  26#include "ia_css_types.h"
  27#include "ia_css_pipeline.h"
  28
  29/* Function to initialize the data and bss section descr of the binary */
  30void
  31sh_css_sp_store_init_dmem(const struct ia_css_fw_info *fw);
  32
  33void
  34store_sp_stage_data(enum ia_css_pipe_id id, unsigned int pipe_num,
  35                    unsigned int stage);
  36
  37void
  38sh_css_stage_write_binary_info(struct ia_css_binary_info *info);
  39
  40void
  41store_sp_group_data(void);
  42
  43/* Start binary (jpeg) copy on the SP */
  44void
  45sh_css_sp_start_binary_copy(unsigned int pipe_num,
  46                            struct ia_css_frame *out_frame,
  47                            unsigned int two_ppc);
  48
  49unsigned int
  50sh_css_sp_get_binary_copy_size(void);
  51
  52/* Return the value of a SW interrupt */
  53unsigned int
  54sh_css_sp_get_sw_interrupt_value(unsigned int irq);
  55
  56void
  57sh_css_sp_init_pipeline(struct ia_css_pipeline *me,
  58                        enum ia_css_pipe_id id,
  59                        u8 pipe_num,
  60                        bool xnr,
  61                        bool two_ppc,
  62                        bool continuous,
  63                        bool offline,
  64                        unsigned int required_bds_factor,
  65                        enum sh_css_pipe_config_override copy_ovrd,
  66                        enum ia_css_input_mode input_mode,
  67                        const struct ia_css_metadata_config *md_config,
  68                        const struct ia_css_metadata_info *md_info,
  69                        const enum mipi_port_id port_id,
  70                        const struct ia_css_coordinate
  71                        *internal_frame_origin_bqs_on_sctbl, /* Origin of internal frame
  72                                                        positioned on shading table at shading correction in ISP. */
  73                        const struct ia_css_isp_parameters *params
  74                       );
  75
  76void
  77sh_css_sp_uninit_pipeline(unsigned int pipe_num);
  78
  79bool sh_css_write_host2sp_command(enum host2sp_commands host2sp_command);
  80
  81enum host2sp_commands
  82sh_css_read_host2sp_command(void);
  83
  84void
  85sh_css_init_host2sp_frame_data(void);
  86
  87/**
  88 * @brief Update the offline frame information in host_sp_communication.
  89 *
  90 * @param[in] frame_num The offline frame number.
  91 * @param[in] frame The pointer to the offline frame.
  92 */
  93void
  94sh_css_update_host2sp_offline_frame(
  95    unsigned int frame_num,
  96    struct ia_css_frame *frame,
  97    struct ia_css_metadata *metadata);
  98
  99/**
 100 * @brief Update the mipi frame information in host_sp_communication.
 101 *
 102 * @param[in] frame_num The mipi frame number.
 103 * @param[in] frame The pointer to the mipi frame.
 104 */
 105void
 106sh_css_update_host2sp_mipi_frame(
 107    unsigned int frame_num,
 108    struct ia_css_frame *frame);
 109
 110/**
 111 * @brief Update the mipi metadata information in host_sp_communication.
 112 *
 113 * @param[in] frame_num The mipi frame number.
 114 * @param[in] metadata The pointer to the mipi metadata.
 115 */
 116void
 117sh_css_update_host2sp_mipi_metadata(
 118    unsigned int frame_num,
 119    struct ia_css_metadata *metadata);
 120
 121/**
 122 * @brief Update the nr of mipi frames to use in host_sp_communication.
 123 *
 124 * @param[in] num_frames The number of mipi frames to use.
 125 */
 126void
 127sh_css_update_host2sp_num_mipi_frames(unsigned int num_frames);
 128
 129/**
 130 * @brief Update the nr of offline frames to use in host_sp_communication.
 131 *
 132 * @param[in] num_frames The number of raw frames to use.
 133 */
 134void
 135sh_css_update_host2sp_cont_num_raw_frames(unsigned int num_frames,
 136        bool set_avail);
 137
 138void
 139sh_css_event_init_irq_mask(void);
 140
 141void
 142sh_css_sp_start_isp(void);
 143
 144void
 145sh_css_sp_set_sp_running(bool flag);
 146
 147bool
 148sh_css_sp_is_running(void);
 149
 150#if SP_DEBUG != SP_DEBUG_NONE
 151
 152void
 153sh_css_sp_get_debug_state(struct sh_css_sp_debug_state *state);
 154
 155#endif
 156
 157#if !defined(ISP2401)
 158void
 159sh_css_sp_set_if_configs(
 160    const input_formatter_cfg_t *config_a,
 161    const input_formatter_cfg_t *config_b,
 162    const uint8_t               if_config_index);
 163#endif
 164
 165void
 166sh_css_sp_program_input_circuit(int fmt_type,
 167                                int ch_id,
 168                                enum ia_css_input_mode input_mode);
 169
 170void
 171sh_css_sp_configure_sync_gen(int width,
 172                             int height,
 173                             int hblank_cycles,
 174                             int vblank_cycles);
 175
 176void
 177sh_css_sp_configure_tpg(int x_mask,
 178                        int y_mask,
 179                        int x_delta,
 180                        int y_delta,
 181                        int xy_mask);
 182
 183void
 184sh_css_sp_configure_prbs(int seed);
 185
 186void
 187sh_css_sp_configure_enable_raw_pool_locking(bool lock_all);
 188
 189void
 190sh_css_sp_enable_isys_event_queue(bool enable);
 191
 192void
 193sh_css_sp_set_disable_continuous_viewfinder(bool flag);
 194
 195void
 196sh_css_sp_reset_global_vars(void);
 197
 198/**
 199 * @brief Initialize the DMA software-mask in the debug mode.
 200 * This API should be ONLY called in the debugging mode.
 201 * And it should be always called before the first call of
 202 * "sh_css_set_dma_sw_reg(...)".
 203 *
 204 * @param[in]   dma_id          The ID of the target DMA.
 205 *
 206 * @return
 207 *      - true, if it is successful.
 208 *      - false, otherwise.
 209 */
 210bool
 211sh_css_sp_init_dma_sw_reg(int dma_id);
 212
 213/**
 214 * @brief Set the DMA software-mask in the debug mode.
 215 * This API should be ONLYL called in the debugging mode. Must
 216 * call "sh_css_set_dma_sw_reg(...)" before this
 217 * API is called for the first time.
 218 *
 219 * @param[in]   dma_id          The ID of the target DMA.
 220 * @param[in]   channel_id      The ID of the target DMA channel.
 221 * @param[in]   request_type    The type of the DMA request.
 222 *                              For example:
 223 *                              - "0" indicates the writing request.
 224 *                              - "1" indicates the reading request.
 225 *
 226 * @param[in]   enable          If it is "true", the target DMA
 227 *                              channel is enabled in the software.
 228 *                              Otherwise, the target DMA channel
 229 *                              is disabled in the software.
 230 *
 231 * @return
 232 *      - true, if it is successful.
 233 *      - false, otherwise.
 234 */
 235bool
 236sh_css_sp_set_dma_sw_reg(int dma_id,
 237                         int channel_id,
 238                         int request_type,
 239                         bool enable);
 240
 241extern struct sh_css_sp_group sh_css_sp_group;
 242extern struct sh_css_sp_stage sh_css_sp_stage;
 243extern struct sh_css_isp_stage sh_css_isp_stage;
 244
 245#endif /* _SH_CSS_SP_H_ */
 246