/* SPDX-License-Identifier: GPL-2.0 */ /* * Support for Intel Camera Imaging ISP subsystem. * Copyright (c) 2015, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. */ #ifndef __IA_CSS_IRQ_H #define __IA_CSS_IRQ_H /* @file * This file contains information for Interrupts/IRQs from CSS */ #include "ia_css_err.h" #include "ia_css_pipe_public.h" #include "ia_css_input_port.h" #include <linux/bits.h> /* Interrupt types, these enumerate all supported interrupt types. */ enum ia_css_irq_type { … }; /* Interrupt request type. * When the CSS hardware generates an interrupt, a function in this API * needs to be called to retrieve information about the interrupt. * This interrupt type is part of this information and indicates what * type of information the interrupt signals. * * Note that one interrupt can carry multiple interrupt types. For * example: the online video ISP will generate only 2 interrupts, one to * signal that the statistics (3a and DIS) are ready and one to signal * that all output frames are done (output and viewfinder). * * DEPRECATED, this interface is not portable it should only define user * (SW) interrupts */ enum ia_css_irq_info { … }; /* CSS receiver error types. Whenever the CSS receiver has encountered * an error, this enumeration is used to indicate which errors have occurred. * * Note that multiple error flags can be enabled at once and that this is in * fact common (whenever an error occurs, it usually results in multiple * errors). * * DEPRECATED: This interface is not portable, different systems have * different receiver types, or possibly none in case of tests systems. */ enum ia_css_rx_irq_info { … }; /* Interrupt info structure. This structure contains information about an * interrupt. This needs to be used after an interrupt is received on the IA * to perform the correct action. */ struct ia_css_irq { … }; /* @brief Obtain interrupt information. * * @param[out] info Pointer to the interrupt info. The interrupt * information wil be written to this info. * @return If an error is encountered during the interrupt info * and no interrupt could be translated successfully, this * will return IA_CSS_INTERNAL_ERROR. Otherwise * 0. * * This function is expected to be executed after an interrupt has been sent * to the IA from the CSS. This function returns information about the interrupt * which is needed by the IA code to properly handle the interrupt. This * information includes the image pipe, buffer type etc. */ int ia_css_irq_translate(unsigned int *info); /* @brief Get CSI receiver error info. * * @param[out] irq_bits Pointer to the interrupt bits. The interrupt * bits will be written this info. * This will be the error bits that are enabled in the CSI * receiver error register. * @return None * * This function should be used whenever a CSI receiver error interrupt is * generated. It provides the detailed information (bits) on the exact error * that occurred. * *@deprecated {this function is DEPRECATED since it only works on CSI port 1. * Use the function below instead and specify the appropriate port.} */ void ia_css_rx_get_irq_info(unsigned int *irq_bits); /* @brief Get CSI receiver error info. * * @param[in] port Input port identifier. * @param[out] irq_bits Pointer to the interrupt bits. The interrupt * bits will be written this info. * This will be the error bits that are enabled in the CSI * receiver error register. * @return None * * This function should be used whenever a CSI receiver error interrupt is * generated. It provides the detailed information (bits) on the exact error * that occurred. */ void ia_css_rx_port_get_irq_info(enum mipi_port_id port, unsigned int *irq_bits); /* @brief Clear CSI receiver error info. * * @param[in] irq_bits The bits that should be cleared from the CSI receiver * interrupt bits register. * @return None * * This function should be called after ia_css_rx_get_irq_info has been called * and the error bits have been interpreted. It is advised to use the return * value of that function as the argument to this function to make sure no new * error bits get overwritten. * * @deprecated{this function is DEPRECATED since it only works on CSI port 1. * Use the function below instead and specify the appropriate port.} */ void ia_css_rx_clear_irq_info(unsigned int irq_bits); /* @brief Clear CSI receiver error info. * * @param[in] port Input port identifier. * @param[in] irq_bits The bits that should be cleared from the CSI receiver * interrupt bits register. * @return None * * This function should be called after ia_css_rx_get_irq_info has been called * and the error bits have been interpreted. It is advised to use the return * value of that function as the argument to this function to make sure no new * error bits get overwritten. */ void ia_css_rx_port_clear_irq_info(enum mipi_port_id port, unsigned int irq_bits); /* @brief Enable or disable specific interrupts. * * @param[in] type The interrupt type that will be enabled/disabled. * @param[in] enable enable or disable. * @return Returns IA_CSS_INTERNAL_ERROR if this interrupt * type cannot be enabled/disabled which is true for * CSS internal interrupts. Otherwise returns * 0. */ int ia_css_irq_enable(enum ia_css_irq_info type, bool enable); #endif /* __IA_CSS_IRQ_H */