/* * imx204.c - imx204 sensor driver * * Copyright (c) 2017-2018, NVIDIA CORPORATION, All Rights Reserved. * * 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. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #ifndef __IMX204_I2C_TABLES__ #define __IMX204_I2C_TABLES__ #define IMX204_TABLE_WAIT_MS 0xFFFF #define IMX204_TABLE_END 0xFFFA #define IMX204_TABLE_ENABLE_GTX 0xFFFB #define IMX204_MAX_RETRIES 3 #define IMX204_WAIT_MS 2 struct reg_24_8 { u32 addr; u8 val; }; #define imx204_reg struct reg_24_8 static imx204_reg mode_table_common[] = { {IMX204_TABLE_END, 0x00}, }; static const imx204_reg imx204_start[] = { {IMX204_TABLE_WAIT_MS, 7}, {0x810000, 0x00}, {IMX204_TABLE_WAIT_MS, 14}, {0x810001, 0x18}, {IMX204_TABLE_END, 0x00}, }; static const imx204_reg imx204_stop[] = { {0x810000, 0x01}, {IMX204_TABLE_WAIT_MS, 7}, {IMX204_TABLE_END, 0x00}, }; static const imx204_reg tp_colorbars[] = { {IMX204_TABLE_END, 0x00}, }; static const imx204_reg mode_5352x3950[] = { {0x8100ed, 0x03}, {0x8100e0, 0x60}, {0x8100de, 0xaa}, {0x8100da, 0xff}, {0x8100db, 0xff}, {0x810000, 0x02}, {0x8102eb, 0x03}, {0x810063, 0x18}, {0x810073, 0x1F}, {0x81021A, 0xFF}, {0x81021B, 0x01}, {0x8102D2, 0x00}, {0x810322, 0x0F}, {0x810323, 0x00}, {0x810396, 0x01}, {0x8103C6, 0x00}, {0x8103E7, 0x00}, {0x810414, 0x2C}, {0x810415, 0x00}, {0x810416, 0x45}, {0x810417, 0x00}, {0x81041C, 0x28}, {0x81041D, 0x00}, {0x81041E, 0x30}, {0x81041F, 0x00}, {0x810430, 0x41}, {0x810431, 0x00}, {0x810432, 0x45}, {0x810433, 0x00}, {0x81043C, 0x41}, {0x81043D, 0x00}, {0x81043E, 0x44}, {0x81043F, 0x00}, {0x810479, 0x5B}, {0x81047A, 0x00}, {0x81047B, 0x59}, {0x81047C, 0x00}, {0x81047D, 0x53}, {0x81047E, 0x00}, {0x81048D, 0x04}, {0x810490, 0x35}, {0x810491, 0x00}, {0x810492, 0x40}, {0x810493, 0x00}, {0x810494, 0x35}, {0x810495, 0x00}, {0x810496, 0x40}, {0x810497, 0x00}, {0x8104A0, 0x44}, {0x8104A1, 0x00}, {0x8104A2, 0x41}, {0x8104A3, 0x00}, {0x8104A4, 0x33}, {0x8104A5, 0x00}, {0x8104A6, 0x33}, {0x8104A7, 0x00}, {0x8104B4, 0x48}, {0x8104B5, 0x00}, {0x8104D1, 0x44}, {0x8104D2, 0x00}, {0x8104D3, 0x42}, {0x8104D4, 0x00}, {0x8104D5, 0x48}, {0x8104D6, 0x00}, {0x8104E3, 0x44}, {0x8104E4, 0x00}, {0x8104E5, 0x41}, {0x8104E6, 0x00}, {0x8104E7, 0x33}, {0x8104E8, 0x00}, {0x8104E9, 0x33}, {0x8104EA, 0x00}, {0x8104F1, 0x44}, {0x8104F2, 0x00}, {0x8104F3, 0x42}, {0x8104F4, 0x00}, {0x8104F5, 0x48}, {0x8104F6, 0x00}, {0x81052C, 0x0F}, {0x81054F, 0x06}, {0x810582, 0x04}, {0x8107CA, 0x3A}, {IMX204_TABLE_WAIT_MS, 20}, {0x8102eb, 0x00}, {0x810013, 0x82}, {0x810113, 0x82}, {0x810009, 0x00}, {0x81000a, 0x00}, {0x810011, 0x03}, {0x81001a, 0x01}, {0x810012, 0x00}, // 2.304G {0x810003, 0x00}, {0x810004, 0x00}, {0x810005, 0x01}, {0x810006, 0x00}, {0x810007, 0x50}, {0x810008, 0x00}, {0x81000d, 0x00}, // SVR {0x81000e, 0x00}, // SVR {0x81001a, 0x00}, {0x81001c, 0x00}, {0x810036, 0x00}, {0x810062, 0x0a}, {0x81007e, 0x00}, {0x81007f, 0x00}, {0x810103, 0x00}, {0x810115, 0x01}, {0x81059d, 0x00}, {0x8106f8, 0x00}, {0x8106f8, 0x00}, {IMX204_TABLE_END, 0x00}, }; enum { IMX204_MODE_5352x3950, IMX204_MODE_COMMON, IMX204_MODE_START_STREAM, IMX204_MODE_STOP_STREAM, IMX204_MODE_TEST_PATTERN, }; static const imx204_reg *mode_table[] = { [IMX204_MODE_5352x3950] = mode_5352x3950, [IMX204_MODE_COMMON] = mode_table_common, [IMX204_MODE_START_STREAM] = imx204_start, [IMX204_MODE_STOP_STREAM] = imx204_stop, [IMX204_MODE_TEST_PATTERN] = tp_colorbars, }; static const int imx204_60_fr[] = { 60, }; static const struct camera_common_frmfmt imx204_frmfmt[] = { {{5352, 3950}, imx204_60_fr, 1, 0, IMX204_MODE_5352x3950}, }; #endif /* __IMX204_I2C_TABLES__ */