1 /* 2 * 3 * SPDX-License-Identifier: GPL-2.0 4 * 5 * Copyright (C) 2011-2018 ARM or its affiliates 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; version 2. 10 * This program is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * for more details. 14 * You should have received a copy of the GNU General Public License along 15 * with this program; if not, write to the Free Software Foundation, Inc., 16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 * 18 */ 19 20 #if !defined( __COLOR_MATRIX_FSM_H__ ) 21 #define __COLOR_MATRIX_FSM_H__ 22 23 24 25 typedef struct _color_matrix_fsm_t color_matrix_fsm_t; 26 typedef struct _color_matrix_fsm_t *color_matrix_fsm_ptr_t; 27 typedef const struct _color_matrix_fsm_t *color_matrix_fsm_const_ptr_t; 28 29 #ifndef AWB_LIGHT_SOURCE_D50 30 #define AWB_LIGHT_SOURCE_D50 0x03 31 #endif 32 uint16_t color_matrix_complement_to_direct( int16_t v ); 33 int16_t color_matrix_direct_to_complement( uint16_t v ); 34 void color_matrix_change_CCMs( color_matrix_fsm_ptr_t p_fsm ); 35 void color_matrix_recalculate( color_matrix_fsm_ptr_t p_fsm ); 36 void color_matrix_initialize( color_matrix_fsm_ptr_t p_fsm ); 37 void color_matrix_update( color_matrix_fsm_ptr_t p_fsm ); 38 void color_matrix_write( color_matrix_fsm_ptr_t p_fsm ); 39 void color_matrix_shading_mesh_reload( color_matrix_fsm_ptr_t p_fsm ); 40 41 42 struct _color_matrix_fsm_t { 43 fsm_common_t cmn; 44 45 acamera_fsm_mgr_t *p_fsm_mgr; 46 fsm_irq_mask_t mask; 47 uint8_t color_matrix_enabled; 48 uint8_t manual_saturation_enabled; 49 uint8_t saturation_target; 50 uint16_t color_wb_matrix[9]; 51 int16_t color_matrix[9]; 52 int16_t color_correction_matrix[9]; 53 int16_t color_saturation_matrix[9]; 54 uint8_t light_source; 55 uint8_t light_source_previous; 56 uint8_t light_source_ccm; 57 uint8_t light_source_ccm_previous; 58 uint8_t light_source_change_frames; 59 uint8_t light_source_change_frames_left; 60 int16_t color_matrix_A[9]; 61 int16_t color_matrix_D40[9]; 62 int16_t color_matrix_D50[9]; 63 int16_t color_matrix_one[9]; 64 int16_t shading_alpha; 65 uint8_t shading_direction; 66 uint8_t shading_source_previous; 67 uint8_t manual_CCM; 68 int16_t manual_color_matrix[9]; 69 int32_t temperature_threshold[8]; 70 }; 71 72 73 void color_matrix_fsm_clear( color_matrix_fsm_ptr_t p_fsm ); 74 75 void color_matrix_fsm_init( void *fsm, fsm_init_param_t *init_param ); 76 int color_matrix_fsm_set_param( void *fsm, uint32_t param_id, void *input, uint32_t input_size ); 77 int color_matrix_fsm_get_param( void *fsm, uint32_t param_id, void *input, uint32_t input_size, void *output, uint32_t output_size ); 78 79 uint8_t color_matrix_fsm_process_event( color_matrix_fsm_ptr_t p_fsm, event_id_t event_id ); 80 81 void color_matrix_fsm_process_interrupt( color_matrix_fsm_const_ptr_t p_fsm, uint8_t irq_event ); 82 83 void color_matrix_request_interrupt( color_matrix_fsm_ptr_t p_fsm, system_fw_interrupt_mask_t mask ); 84 85 #endif /* __COLOR_MATRIX_FSM_H__ */ 86