18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Driver for the po1030 sensor. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (c) 2008 Erik Andrén 68c2ecf20Sopenharmony_ci * Copyright (c) 2007 Ilyes Gouta. Based on the m5603x Linux Driver Project. 78c2ecf20Sopenharmony_ci * Copyright (c) 2005 m5603x Linux Driver Project <m5602@x3ng.com.br> 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * Portions of code to USB interface and ALi driver software, 108c2ecf20Sopenharmony_ci * Copyright (c) 2006 Willem Duinker 118c2ecf20Sopenharmony_ci * v4l2 interface modeled after the V4L2 driver 128c2ecf20Sopenharmony_ci * for SN9C10x PC Camera Controllers 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * Register defines taken from Pascal Stangs Procyon Armlib 158c2ecf20Sopenharmony_ci */ 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#ifndef M5602_PO1030_H_ 188c2ecf20Sopenharmony_ci#define M5602_PO1030_H_ 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#include "m5602_sensor.h" 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/*****************************************************************************/ 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#define PO1030_DEVID_H 0x00 258c2ecf20Sopenharmony_ci#define PO1030_DEVID_L 0x01 268c2ecf20Sopenharmony_ci#define PO1030_FRAMEWIDTH_H 0x04 278c2ecf20Sopenharmony_ci#define PO1030_FRAMEWIDTH_L 0x05 288c2ecf20Sopenharmony_ci#define PO1030_FRAMEHEIGHT_H 0x06 298c2ecf20Sopenharmony_ci#define PO1030_FRAMEHEIGHT_L 0x07 308c2ecf20Sopenharmony_ci#define PO1030_WINDOWX_H 0x08 318c2ecf20Sopenharmony_ci#define PO1030_WINDOWX_L 0x09 328c2ecf20Sopenharmony_ci#define PO1030_WINDOWY_H 0x0a 338c2ecf20Sopenharmony_ci#define PO1030_WINDOWY_L 0x0b 348c2ecf20Sopenharmony_ci#define PO1030_WINDOWWIDTH_H 0x0c 358c2ecf20Sopenharmony_ci#define PO1030_WINDOWWIDTH_L 0x0d 368c2ecf20Sopenharmony_ci#define PO1030_WINDOWHEIGHT_H 0x0e 378c2ecf20Sopenharmony_ci#define PO1030_WINDOWHEIGHT_L 0x0f 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define PO1030_GLOBALIBIAS 0x12 408c2ecf20Sopenharmony_ci#define PO1030_PIXELIBIAS 0x13 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define PO1030_GLOBALGAIN 0x15 438c2ecf20Sopenharmony_ci#define PO1030_RED_GAIN 0x16 448c2ecf20Sopenharmony_ci#define PO1030_GREEN_1_GAIN 0x17 458c2ecf20Sopenharmony_ci#define PO1030_BLUE_GAIN 0x18 468c2ecf20Sopenharmony_ci#define PO1030_GREEN_2_GAIN 0x19 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define PO1030_INTEGLINES_H 0x1a 498c2ecf20Sopenharmony_ci#define PO1030_INTEGLINES_M 0x1b 508c2ecf20Sopenharmony_ci#define PO1030_INTEGLINES_L 0x1c 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci#define PO1030_CONTROL1 0x1d 538c2ecf20Sopenharmony_ci#define PO1030_CONTROL2 0x1e 548c2ecf20Sopenharmony_ci#define PO1030_CONTROL3 0x1f 558c2ecf20Sopenharmony_ci#define PO1030_CONTROL4 0x20 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define PO1030_PERIOD50_H 0x23 588c2ecf20Sopenharmony_ci#define PO1030_PERIOD50_L 0x24 598c2ecf20Sopenharmony_ci#define PO1030_PERIOD60_H 0x25 608c2ecf20Sopenharmony_ci#define PO1030_PERIOD60_L 0x26 618c2ecf20Sopenharmony_ci#define PO1030_REGCLK167 0x27 628c2ecf20Sopenharmony_ci#define PO1030_FLICKER_DELTA50 0x28 638c2ecf20Sopenharmony_ci#define PO1030_FLICKERDELTA60 0x29 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci#define PO1030_ADCOFFSET 0x2c 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci/* Gamma Correction Coeffs */ 688c2ecf20Sopenharmony_ci#define PO1030_GC0 0x2d 698c2ecf20Sopenharmony_ci#define PO1030_GC1 0x2e 708c2ecf20Sopenharmony_ci#define PO1030_GC2 0x2f 718c2ecf20Sopenharmony_ci#define PO1030_GC3 0x30 728c2ecf20Sopenharmony_ci#define PO1030_GC4 0x31 738c2ecf20Sopenharmony_ci#define PO1030_GC5 0x32 748c2ecf20Sopenharmony_ci#define PO1030_GC6 0x33 758c2ecf20Sopenharmony_ci#define PO1030_GC7 0x34 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci/* Color Transform Matrix */ 788c2ecf20Sopenharmony_ci#define PO1030_CT0 0x35 798c2ecf20Sopenharmony_ci#define PO1030_CT1 0x36 808c2ecf20Sopenharmony_ci#define PO1030_CT2 0x37 818c2ecf20Sopenharmony_ci#define PO1030_CT3 0x38 828c2ecf20Sopenharmony_ci#define PO1030_CT4 0x39 838c2ecf20Sopenharmony_ci#define PO1030_CT5 0x3a 848c2ecf20Sopenharmony_ci#define PO1030_CT6 0x3b 858c2ecf20Sopenharmony_ci#define PO1030_CT7 0x3c 868c2ecf20Sopenharmony_ci#define PO1030_CT8 0x3d 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci#define PO1030_AUTOCTRL1 0x3e 898c2ecf20Sopenharmony_ci#define PO1030_AUTOCTRL2 0x3f 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci#define PO1030_YTARGET 0x40 928c2ecf20Sopenharmony_ci#define PO1030_GLOBALGAINMIN 0x41 938c2ecf20Sopenharmony_ci#define PO1030_GLOBALGAINMAX 0x42 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci#define PO1030_AWB_RED_TUNING 0x47 968c2ecf20Sopenharmony_ci#define PO1030_AWB_BLUE_TUNING 0x48 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci/* Output format control */ 998c2ecf20Sopenharmony_ci#define PO1030_OUTFORMCTRL1 0x5a 1008c2ecf20Sopenharmony_ci#define PO1030_OUTFORMCTRL2 0x5b 1018c2ecf20Sopenharmony_ci#define PO1030_OUTFORMCTRL3 0x5c 1028c2ecf20Sopenharmony_ci#define PO1030_OUTFORMCTRL4 0x5d 1038c2ecf20Sopenharmony_ci#define PO1030_OUTFORMCTRL5 0x5e 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci#define PO1030_EDGE_ENH_OFF 0x5f 1068c2ecf20Sopenharmony_ci#define PO1030_EGA 0x60 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci#define PO1030_Cb_U_GAIN 0x63 1098c2ecf20Sopenharmony_ci#define PO1030_Cr_V_GAIN 0x64 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci#define PO1030_YCONTRAST 0x74 1128c2ecf20Sopenharmony_ci#define PO1030_YSATURATION 0x75 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci#define PO1030_HFLIP (1 << 7) 1158c2ecf20Sopenharmony_ci#define PO1030_VFLIP (1 << 6) 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci#define PO1030_HREF_ENABLE (1 << 6) 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci#define PO1030_RAW_RGB_BAYER 0x4 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci#define PO1030_FRAME_EQUAL (1 << 3) 1228c2ecf20Sopenharmony_ci#define PO1030_AUTO_SUBSAMPLING (1 << 4) 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ci#define PO1030_WEIGHT_WIN_2X (1 << 3) 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci#define PO1030_SHUTTER_MODE (1 << 6) 1278c2ecf20Sopenharmony_ci#define PO1030_AUTO_SUBSAMPLING (1 << 4) 1288c2ecf20Sopenharmony_ci#define PO1030_FRAME_EQUAL (1 << 3) 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci#define PO1030_SENSOR_RESET (1 << 5) 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci#define PO1030_SUBSAMPLING (1 << 6) 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci/*****************************************************************************/ 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci#define PO1030_GLOBAL_GAIN_DEFAULT 0x12 1378c2ecf20Sopenharmony_ci#define PO1030_EXPOSURE_DEFAULT 0x0085 1388c2ecf20Sopenharmony_ci#define PO1030_BLUE_GAIN_DEFAULT 0x36 1398c2ecf20Sopenharmony_ci#define PO1030_RED_GAIN_DEFAULT 0x36 1408c2ecf20Sopenharmony_ci#define PO1030_GREEN_GAIN_DEFAULT 0x40 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci/*****************************************************************************/ 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci/* Kernel module parameters */ 1458c2ecf20Sopenharmony_ciextern int force_sensor; 1468c2ecf20Sopenharmony_ciextern bool dump_sensor; 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ciint po1030_probe(struct sd *sd); 1498c2ecf20Sopenharmony_ciint po1030_init(struct sd *sd); 1508c2ecf20Sopenharmony_ciint po1030_init_controls(struct sd *sd); 1518c2ecf20Sopenharmony_ciint po1030_start(struct sd *sd); 1528c2ecf20Sopenharmony_civoid po1030_disconnect(struct sd *sd); 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_cistatic const struct m5602_sensor po1030 = { 1558c2ecf20Sopenharmony_ci .name = "PO1030", 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci .i2c_slave_id = 0xdc, 1588c2ecf20Sopenharmony_ci .i2c_regW = 1, 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci .probe = po1030_probe, 1618c2ecf20Sopenharmony_ci .init = po1030_init, 1628c2ecf20Sopenharmony_ci .init_controls = po1030_init_controls, 1638c2ecf20Sopenharmony_ci .start = po1030_start, 1648c2ecf20Sopenharmony_ci .disconnect = po1030_disconnect, 1658c2ecf20Sopenharmony_ci}; 1668c2ecf20Sopenharmony_ci#endif 167