1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Driver for the s5k4aa sensor 4 * 5 * Copyright (C) 2008 Erik Andrén 6 * Copyright (C) 2007 Ilyes Gouta. Based on the m5603x Linux Driver Project. 7 * Copyright (C) 2005 m5603x Linux Driver Project <m5602@x3ng.com.br> 8 * 9 * Portions of code to USB interface and ALi driver software, 10 * Copyright (c) 2006 Willem Duinker 11 * v4l2 interface modeled after the V4L2 driver 12 * for SN9C10x PC Camera Controllers 13 */ 14 15 #ifndef M5602_S5K4AA_H_ 16 #define M5602_S5K4AA_H_ 17 18 #include <linux/dmi.h> 19 20 #include "m5602_sensor.h" 21 22 /*****************************************************************************/ 23 24 #define S5K4AA_PAGE_MAP 0xec 25 26 #define S5K4AA_PAGE_MAP_0 0x00 27 #define S5K4AA_PAGE_MAP_1 0x01 28 #define S5K4AA_PAGE_MAP_2 0x02 29 30 /* Sensor register definitions for page 0x02 */ 31 #define S5K4AA_READ_MODE 0x03 32 #define S5K4AA_ROWSTART_HI 0x04 33 #define S5K4AA_ROWSTART_LO 0x05 34 #define S5K4AA_COLSTART_HI 0x06 35 #define S5K4AA_COLSTART_LO 0x07 36 #define S5K4AA_WINDOW_HEIGHT_HI 0x08 37 #define S5K4AA_WINDOW_HEIGHT_LO 0x09 38 #define S5K4AA_WINDOW_WIDTH_HI 0x0a 39 #define S5K4AA_WINDOW_WIDTH_LO 0x0b 40 #define S5K4AA_GLOBAL_GAIN__ 0x0f 41 /* sync lost, if too low, reduces frame rate if too high */ 42 #define S5K4AA_H_BLANK_HI__ 0x1d 43 #define S5K4AA_H_BLANK_LO__ 0x1e 44 #define S5K4AA_EXPOSURE_HI 0x17 45 #define S5K4AA_EXPOSURE_LO 0x18 46 #define S5K4AA_BRIGHTNESS 0x1f /* (digital?) gain : 5 bits */ 47 #define S5K4AA_GAIN 0x20 /* (analogue?) gain : 7 bits */ 48 #define S5K4AA_NOISE_SUPP 0x37 49 50 #define S5K4AA_RM_ROW_SKIP_4X 0x08 51 #define S5K4AA_RM_ROW_SKIP_2X 0x04 52 #define S5K4AA_RM_COL_SKIP_4X 0x02 53 #define S5K4AA_RM_COL_SKIP_2X 0x01 54 #define S5K4AA_RM_H_FLIP 0x40 55 #define S5K4AA_RM_V_FLIP 0x80 56 57 #define S5K4AA_DEFAULT_GAIN 0x5f 58 #define S5K4AA_DEFAULT_BRIGHTNESS 0x10 59 60 /*****************************************************************************/ 61 62 /* Kernel module parameters */ 63 extern int force_sensor; 64 extern bool dump_sensor; 65 66 int s5k4aa_probe(struct sd *sd); 67 int s5k4aa_init(struct sd *sd); 68 int s5k4aa_init_controls(struct sd *sd); 69 int s5k4aa_start(struct sd *sd); 70 void s5k4aa_disconnect(struct sd *sd); 71 72 static const struct m5602_sensor s5k4aa = { 73 .name = "S5K4AA", 74 .i2c_slave_id = 0x5a, 75 .i2c_regW = 2, 76 77 .probe = s5k4aa_probe, 78 .init = s5k4aa_init, 79 .init_controls = s5k4aa_init_controls, 80 .start = s5k4aa_start, 81 .disconnect = s5k4aa_disconnect, 82 }; 83 84 #endif 85