tegrakernel/kernel/nvidia/drivers/media/i2c/imx318_mode_tbls.h

479 lines
8.5 KiB
C
Raw Permalink Normal View History

2022-02-16 09:13:02 -06:00
/*
* imx318_mode_tbls.h - imx318 sensor mode tables
*
* Copyright (c) 2017, 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 <http://www.gnu.org/licenses/>.
*/
#ifndef __IMX318_I2C_TABLES__
#define __IMX318_I2C_TABLES__
#include <media/camera_common.h>
#include <linux/miscdevice.h>
#define IMX318_TABLE_WAIT_MS 0
#define IMX318_TABLE_END 1
#define IMX318_MAX_RETRIES 3
#define imx318_reg struct reg_8
static imx318_reg imx318_start[] = {
{0x0100, 0x01},
{ IMX318_TABLE_END, 0x00 }
};
static imx318_reg imx318_stop[] = {
{0x0100, 0x00 },
{IMX318_TABLE_END, 0x00 }
};
static imx318_reg mode_table_common[] = {
/*External Clock Setting*/
{0x0136, 0x18},
{0x0137, 0x00},
/*Global Setting*/
{0x3067, 0x00},
{0x30F0, 0x02},
{0x31C2, 0x00},
{0x41B6, 0x0A},
{0x4600, 0x1B},
{0x46C2, 0x00},
{0x4877, 0x11},
{0x487B, 0x4D},
{0x487F, 0x27},
{0x4883, 0xB4},
{0x4C6F, 0x5E},
{0x5113, 0xF4},
{0x5115, 0xF6},
{0x5125, 0xF4},
{0x5127, 0xF8},
{0x51CF, 0xF4},
{0x51E9, 0xF4},
{0x5483, 0x7A},
{0x5485, 0x7C},
{0x5495, 0x7A},
{0x5497, 0x7F},
{0x5515, 0xC3},
{0x5517, 0xC7},
{0x552B, 0x7A},
{0x5535, 0x7A},
{0x5A35, 0x1B},
{0x5C13, 0x00},
{0x5C5A, 0x01},
{0x5C5B, 0x01},
{0x5D89, 0x81},
{0x5D8B, 0x2C},
{0x5D8D, 0x61},
{0x5D8F, 0xE1},
{0x5D91, 0x4D},
{0x5D93, 0xB4},
{0x5D95, 0x41},
{0x5D97, 0x96},
{0x5D99, 0x37},
{0x5D9B, 0x81},
{0x5D9D, 0x31},
{0x5D9F, 0x71},
{0x5DA1, 0x2B},
{0x5DA3, 0x64},
{0x5DA5, 0x27},
{0x5DA7, 0x5A},
{0x6008, 0x0A},
{0x6009, 0x03},
{0x613A, 0x05},
{0x613C, 0x23},
{0x613D, 0x0F},
{0x613E, 0xFF},
{0x6142, 0x02},
{0x6143, 0x63},
{0x6144, 0x09},
{0x6145, 0x0B},
{0x6146, 0x24},
{0x6147, 0x30},
{0x6148, 0x90},
{0x6149, 0xB2},
{0x614A, 0x43},
{0x614B, 0x0A},
{0x614C, 0x01},
{0x614D, 0x12},
{0x614E, 0x30},
{0x614F, 0x98},
{0x6150, 0xA2},
{0x6157, 0x1F},
{0x615C, 0x40},
{0x615D, 0x40},
{0x615E, 0x66},
{0x615F, 0xC0},
{0x6160, 0x00},
{0x616C, 0x42},
{0x616D, 0x40},
{0x616E, 0xAC},
{0x616F, 0x4A},
{0x6170, 0x49},
{0x6171, 0x02},
{0x6172, 0xB1},
{0x6173, 0x29},
{0x6176, 0x24},
{0x6177, 0x93},
{0x6178, 0x4B},
{0x6179, 0x45},
{0x617A, 0x48},
{0x617B, 0x14},
{0x617C, 0x26},
{0x617D, 0x94},
{0x617E, 0x5A},
{0x617F, 0x35},
{0x6182, 0x15},
{0x6194, 0xC7},
{0x6195, 0x7E},
{0x6A5F, 0x03},
{0x9002, 0x11},
{0x9200, 0x5D},
{0x9201, 0x49},
{0x9202, 0x5D},
{0x9203, 0x4A},
{0x9204, 0x5D},
{0x9205, 0x4B},
{0x9206, 0x5D},
{0x9207, 0x4D},
{0x9208, 0x5D},
{0x9209, 0x4F},
{0x920A, 0x5D},
{0x920B, 0x51},
{0x920C, 0x5D},
{0x920D, 0x53},
{0x920E, 0x5D},
{0x920F, 0x55},
{0x9210, 0x5D},
{0x9211, 0x57},
{0x9212, 0x5D},
{0x9213, 0x59},
{0x9214, 0x5D},
{0x9215, 0x5B},
{0x9216, 0x5D},
{0x9217, 0x5D},
{0x9218, 0x5D},
{0x9219, 0x5F},
{0x921A, 0x5D},
{0x921B, 0x61},
{0x921C, 0x5D},
{0x921D, 0x63},
{0x921E, 0x5D},
{0x921F, 0x65},
{0x9220, 0x5D},
{0x9221, 0x67},
{0x9300, 0x80},
{0x9301, 0xCD},
{0x9302, 0xFF},
{0x9306, 0x50},
{0x9307, 0x50},
{0x9309, 0x46},
{0x930A, 0x46},
{0x930C, 0x50},
{0x930D, 0x50},
{0x930F, 0x51},
{0x9310, 0x3C},
{0x9312, 0x30},
{0x9313, 0x16},
{0x9324, 0x05},
{0x9327, 0x05},
{0x932A, 0x05},
{0x932D, 0x06},
{0x9330, 0x10},
{0x9331, 0x10},
{0x9332, 0x15},
{0x9333, 0x05},
{0x9334, 0x0C},
{0x9335, 0x10},
{0x9336, 0x05},
{0x9337, 0x0C},
{0x9338, 0x10},
{0x9339, 0x05},
{0x933A, 0x0C},
{0x933B, 0x10},
{0x933C, 0x06},
{0x933D, 0x0C},
{0x933E, 0x10},
{0x933F, 0x1B},
{0x9340, 0x1B},
{0x9341, 0x1B},
{0x9342, 0x1B},
{0x9343, 0x18},
{0x9344, 0x18},
{0x9345, 0x18},
{0x9346, 0x18},
{0xF800, 0xD9},
{0xF801, 0xD9},
{0xF802, 0x41},
{0xF803, 0x00},
{0xF804, 0x55},
{0xF805, 0xE4},
{0xF806, 0xDC},
{0xF807, 0x01},
{0xF808, 0x81},
{0xF809, 0xD1},
{0xF80A, 0x31},
{0xF80B, 0x06},
{0xF80C, 0x00},
{0xF80D, 0xBA},
{0xF80E, 0x70},
{0xF80F, 0x47},
{0xF810, 0xC0},
{0xF811, 0xBA},
{0xF812, 0x70},
{0xF813, 0x47},
/*Load setting*/
{0x3729, 0x01},
/*IMG Quality*/
{IMX318_TABLE_END, 0x00}
};
static imx318_reg imx318_cphy_4k_30fps[] = {
/*MIPI setting*/
{0x0111, 0x03}, /*CPHY*/
{0x0112, 0x0A}, /*RAW10*/
{0x0113, 0x0A}, /*RAW10*/
{0x0114, 0x02}, /*3 trios*/
{0x0601, 0x00}, /*TPG mode*/
/*Frame Horizontal Clock Count*/
{0x0342, 0x17},
{0x0343, 0xB0},
/*Frame Vertical Clock Count*/
{0x0340, 0x11},
{0x0341, 0x28},
/*Visible Size*/
{0x0344, 0x00},
{0x0345, 0x00},
{0x0346, 0x00},
{0x0347, 0x00},
{0x0348, 0x15},
{0x0349, 0x6F},
{0x034A, 0x10},
{0x034B, 0x0F},
{0x31A2, 0x00},
/*Mode Setting*/
{0x0220, 0x00},
{0x0221, 0x11},
{0x0222, 0x01},
{0x0381, 0x01},
{0x0383, 0x01},
{0x0385, 0x01},
{0x0387, 0x01},
{0x0900, 0x00},
{0x0901, 0x11},
{0x0902, 0x00},
{0x3010, 0x65},
{0x3011, 0x11},
{0x301C, 0x00},
{0x3045, 0x01},
{0x3194, 0x01},
{0x31A0, 0x00},
{0x31A1, 0x00},
{0xD5EC, 0x3A},
{0xD5ED, 0x00},
/*Digital Crop & Scaling*/
{0x0401, 0x00},
{0x0404, 0x00},
{0x0405, 0x10},
{0x0408, 0x00},
{0x0409, 0x00},
{0x040A, 0x00},
{0x040B, 0x00},
{0x040C, 0x15},
{0x040D, 0x70},
{0x040E, 0x10},
{0x040F, 0x10},
/*Output Size Settings*/
{0x034C, 0x15}, /*Horizontal size*/
{0x034D, 0x70},
{0x034E, 0x10}, /*Vertical size*/
{0x034F, 0x10},
{0x4041, 0x00}, /*EMBD LINE SIZE*/
/*Clock setting*/
{0x0301, 0x05},
{0x0303, 0x02},
{0x0305, 0x04},
{0x0306, 0x01},
{0x0307, 0x4D},
{0x0309, 0x08},
{0x030B, 0x01},
{0x030D, 0x04},
{0x030E, 0x01},
{0x030F, 0x3C},
{0x0820, 0x32},
{0x0821, 0xC9},
{0x0822, 0x24},
{0x0823, 0x92},
{0x422F, 0x01},
{0x4230, 0x00},
/*Output Data Select Setting*/
{0x3031, 0x00},
{0x3033, 0x00},
{0x3039, 0x00},
{0x303B, 0x00},
/*EIS setting*/
{0x306C, 0x00},
{0x306E, 0x0D},
{0x306F, 0x56},
{0x6636, 0x00},
{0x6637, 0x14},
{0xCA12, 0x2C},
{0xCA13, 0x2C},
{0xCA14, 0x1C},
{0xCA15, 0x1C},
{0xCA16, 0x06},
{0xCA17, 0x06},
{0xCA18, 0x20},
{0xCA19, 0x20},
{0xCA1A, 0x0C},
{0xCA1B, 0x0C},
{0xCA1C, 0x06},
{0xCA1D, 0x06},
{0xCA66, 0x39},
{0xCA67, 0x39},
{0xCA68, 0x39},
{0xCA69, 0x39},
{0xCA6A, 0x13},
{0xCA6B, 0x13},
{0xCA6C, 0x20},
{0xCA6D, 0x20},
{0xCA6E, 0x20},
{0xCA6F, 0x20},
{0xCA70, 0x10},
{0xCA71, 0x10},
/*GYRO setting*/
{0x30AC, 0x00},
{0x3900, 0x00},
{0x3901, 0x00},
{0x31C3, 0x01},
/*DLC setting*/
{0x3066, 0x00},
/*LSC setting*/
{0x7B63, 0x00},
/*Analog setting*/
{0x56FB, 0x50},
{0x56FF, 0x50},
{0x6174, 0x28},
{0x6175, 0xC2},
{0x9323, 0x0C},
/*Other setting*/
{0x30F1, 0x00},
{0x30F4, 0x01},
{0x30F5, 0x54},
{0x30F6, 0x00},
{0x30F7, 0x14},
{0x30FC, 0x01},
{0x30FD, 0x01},
{0x714E, 0x01},
{0x714D, 0x06},
{0x7152, 0x06},
{0x7156, 0x01},
{0x7155, 0x00},
{0x7159, 0x00},
{0x76A3, 0x06},
{0x76A0, 0x01},
{0x76A5, 0x06},
{0x76A9, 0x00},
{0x76AF, 0x00},
{0x76AC, 0x01},
{0x9303, 0x32},
{0xD00C, 0x0C},
{0x3600, 0x4F},
{0x3601, 0x00},
{0x3602, 0xFA},
{0x3603, 0x3B},
{0x3604, 0xBC},
{0x3605, 0x2F},
{0x3606, 0x96},
{0x3607, 0x28},
{0x3608, 0x7D},
{0x3609, 0x22},
{0x360A, 0x6C},
{0x360B, 0x1E},
{0x360C, 0x5E},
{0x360D, 0x1B},
{0x360E, 0x54},
{0x360F, 0x18},
{0x3610, 0x4B},
/*CIT setting*/
{0x0202, 0x11},
{0x0203, 0x14},
{0x0224, 0x01},
{0x0225, 0xF4},
/*Gain setting*/
{0x0204, 0x00},
{0x0205, 0x00},
{0x020E, 0x01},
{0x020F, 0x00},
{0x0210, 0x01},
{0x0211, 0x00},
{0x0212, 0x01},
{0x0213, 0x00},
{0x0214, 0x01},
{0x0215, 0x00},
{0x0216, 0x00},
{0x0217, 0x00},
{0x0218, 0x01},
{0x0219, 0x00},
{IMX318_TABLE_END, 0x00}
};
enum {
IMX318_MODE_CPHY_4k_30FPS,
IMX318_MODE_COMMON,
IMX318_MODE_START_STREAM,
IMX318_MODE_STOP_STREAM
};
static imx318_reg *mode_table[] = {
[IMX318_MODE_CPHY_4k_30FPS] = imx318_cphy_4k_30fps,
[IMX318_MODE_COMMON] = mode_table_common,
[IMX318_MODE_START_STREAM] = imx318_start,
[IMX318_MODE_STOP_STREAM] = imx318_stop
};
static const int imx318_30fps[] = {
30,
};
/*
* WARNING: frmfmt ordering need to match mode definition in
* device tree!
*/
static const struct camera_common_frmfmt imx318_frmfmt[] = {
{{5488, 4112}, imx318_30fps, 1, 0, IMX318_MODE_CPHY_4k_30FPS},
/* Add modes with no device tree support after below */
};
#endif /* __IMX318_I2C_TABLES__ */