1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Support for Intel Camera Imaging ISP subsystem. 4 * Copyright (c) 2015, Intel Corporation. 5 */ 6 7 #ifndef __IA_CSS_SC_TYPES_H 8 #define __IA_CSS_SC_TYPES_H 9 10 /* @file 11 * CSS-API header file for Lens Shading Correction (SC) parameters. 12 */ 13 14 /* Number of color planes in the shading table. */ 15 #define IA_CSS_SC_NUM_COLORS 4 16 17 /* The 4 colors that a shading table consists of. 18 * For each color we store a grid of values. 19 */ 20 enum ia_css_sc_color { 21 IA_CSS_SC_COLOR_GR, /** Green on a green-red line */ 22 IA_CSS_SC_COLOR_R, /** Red */ 23 IA_CSS_SC_COLOR_B, /** Blue */ 24 IA_CSS_SC_COLOR_GB /** Green on a green-blue line */ 25 }; 26 27 /* Lens Shading Correction table. 28 * 29 * This describes the color shading artefacts 30 * introduced by lens imperfections. To correct artefacts, 31 * bayer values should be multiplied by gains in this table. 32 * 33 *------------ deprecated(bz675) : from --------------------------- 34 * When shading_settings.enable_shading_table_conversion is set as 0, 35 * this shading table is directly sent to the isp. This table should contain 36 * the data based on the ia_css_shading_info information filled in the css. 37 * So, the driver needs to get the ia_css_shading_info information 38 * from the css, prior to generating the shading table. 39 * 40 * When shading_settings.enable_shading_table_conversion is set as 1, 41 * this shading table is converted in the legacy way in the css 42 * before it is sent to the isp. 43 * The driver does not need to get the ia_css_shading_info information. 44 * 45 * NOTE: 46 * The shading table conversion will be removed from the css in the near future, 47 * because it does not support the bayer scaling by sensor. 48 * Also, we had better generate the shading table only in one place(AIC). 49 * At the moment, to support the old driver which assumes the conversion is done in the css, 50 * shading_settings.enable_shading_table_conversion is set as 1 by default. 51 *------------ deprecated(bz675) : to --------------------------- 52 * 53 * ISP block: SC1 54 * ISP1: SC1 is used. 55 * ISP2: SC1 is used. 56 */ 57 struct ia_css_shading_table { 58 u32 enable; /** Set to false for no shading correction. 59 The data field can be NULL when enable == true */ 60 /* ------ deprecated(bz675) : from ------ */ 61 u32 sensor_width; /** Native sensor width in pixels. */ 62 u32 sensor_height; /** Native sensor height in lines. 63 When shading_settings.enable_shading_table_conversion is set 64 as 0, sensor_width and sensor_height are NOT used. 65 These are used only in the legacy shading table conversion 66 in the css, when shading_settings. 67 enable_shading_table_conversion is set as 1. */ 68 /* ------ deprecated(bz675) : to ------ */ 69 u32 width; /** Number of data points per line per color. 70 u8.0, [0,81] */ 71 u32 height; /** Number of lines of data points per color. 72 u8.0, [0,61] */ 73 u32 fraction_bits; /** Bits of fractional part in the data 74 points. 75 u8.0, [0,13] */ 76 u16 *data[IA_CSS_SC_NUM_COLORS]; 77 /** Table data, one array for each color. 78 Use ia_css_sc_color to index this array. 79 u[13-fraction_bits].[fraction_bits], [0,8191] */ 80 }; 81 82 /* ------ deprecated(bz675) : from ------ */ 83 /* Shading Correction settings. 84 * 85 * NOTE: 86 * This structure should be removed when the shading table conversion is 87 * removed from the css. 88 */ 89 struct ia_css_shading_settings { 90 u32 enable_shading_table_conversion; /** Set to 0, 91 if the conversion of the shading table should be disabled 92 in the css. (default 1) 93 0: The shading table is directly sent to the isp. 94 The shading table should contain the data based on the 95 ia_css_shading_info information filled in the css. 96 1: The shading table is converted in the css, to be fitted 97 to the shading table definition required in the isp. 98 NOTE: 99 Previously, the shading table was always converted in the css 100 before it was sent to the isp, and this config was not defined. 101 Currently, the driver is supposed to pass the shading table 102 which should be directly sent to the isp. 103 However, some drivers may still pass the shading table which 104 needs the conversion without setting this config as 1. 105 To support such an unexpected case for the time being, 106 enable_shading_table_conversion is set as 1 by default 107 in the css. */ 108 }; 109 110 /* ------ deprecated(bz675) : to ------ */ 111 112 #endif /* __IA_CSS_SC_TYPES_H */ 113