18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Driver for the s5k4aa 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 158c2ecf20Sopenharmony_ci#ifndef M5602_S5K4AA_H_ 168c2ecf20Sopenharmony_ci#define M5602_S5K4AA_H_ 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#include <linux/dmi.h> 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#include "m5602_sensor.h" 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/*****************************************************************************/ 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#define S5K4AA_PAGE_MAP 0xec 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#define S5K4AA_PAGE_MAP_0 0x00 278c2ecf20Sopenharmony_ci#define S5K4AA_PAGE_MAP_1 0x01 288c2ecf20Sopenharmony_ci#define S5K4AA_PAGE_MAP_2 0x02 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci/* Sensor register definitions for page 0x02 */ 318c2ecf20Sopenharmony_ci#define S5K4AA_READ_MODE 0x03 328c2ecf20Sopenharmony_ci#define S5K4AA_ROWSTART_HI 0x04 338c2ecf20Sopenharmony_ci#define S5K4AA_ROWSTART_LO 0x05 348c2ecf20Sopenharmony_ci#define S5K4AA_COLSTART_HI 0x06 358c2ecf20Sopenharmony_ci#define S5K4AA_COLSTART_LO 0x07 368c2ecf20Sopenharmony_ci#define S5K4AA_WINDOW_HEIGHT_HI 0x08 378c2ecf20Sopenharmony_ci#define S5K4AA_WINDOW_HEIGHT_LO 0x09 388c2ecf20Sopenharmony_ci#define S5K4AA_WINDOW_WIDTH_HI 0x0a 398c2ecf20Sopenharmony_ci#define S5K4AA_WINDOW_WIDTH_LO 0x0b 408c2ecf20Sopenharmony_ci#define S5K4AA_GLOBAL_GAIN__ 0x0f 418c2ecf20Sopenharmony_ci/* sync lost, if too low, reduces frame rate if too high */ 428c2ecf20Sopenharmony_ci#define S5K4AA_H_BLANK_HI__ 0x1d 438c2ecf20Sopenharmony_ci#define S5K4AA_H_BLANK_LO__ 0x1e 448c2ecf20Sopenharmony_ci#define S5K4AA_EXPOSURE_HI 0x17 458c2ecf20Sopenharmony_ci#define S5K4AA_EXPOSURE_LO 0x18 468c2ecf20Sopenharmony_ci#define S5K4AA_BRIGHTNESS 0x1f /* (digital?) gain : 5 bits */ 478c2ecf20Sopenharmony_ci#define S5K4AA_GAIN 0x20 /* (analogue?) gain : 7 bits */ 488c2ecf20Sopenharmony_ci#define S5K4AA_NOISE_SUPP 0x37 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#define S5K4AA_RM_ROW_SKIP_4X 0x08 518c2ecf20Sopenharmony_ci#define S5K4AA_RM_ROW_SKIP_2X 0x04 528c2ecf20Sopenharmony_ci#define S5K4AA_RM_COL_SKIP_4X 0x02 538c2ecf20Sopenharmony_ci#define S5K4AA_RM_COL_SKIP_2X 0x01 548c2ecf20Sopenharmony_ci#define S5K4AA_RM_H_FLIP 0x40 558c2ecf20Sopenharmony_ci#define S5K4AA_RM_V_FLIP 0x80 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define S5K4AA_DEFAULT_GAIN 0x5f 588c2ecf20Sopenharmony_ci#define S5K4AA_DEFAULT_BRIGHTNESS 0x10 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci/*****************************************************************************/ 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci/* Kernel module parameters */ 638c2ecf20Sopenharmony_ciextern int force_sensor; 648c2ecf20Sopenharmony_ciextern bool dump_sensor; 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ciint s5k4aa_probe(struct sd *sd); 678c2ecf20Sopenharmony_ciint s5k4aa_init(struct sd *sd); 688c2ecf20Sopenharmony_ciint s5k4aa_init_controls(struct sd *sd); 698c2ecf20Sopenharmony_ciint s5k4aa_start(struct sd *sd); 708c2ecf20Sopenharmony_civoid s5k4aa_disconnect(struct sd *sd); 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_cistatic const struct m5602_sensor s5k4aa = { 738c2ecf20Sopenharmony_ci .name = "S5K4AA", 748c2ecf20Sopenharmony_ci .i2c_slave_id = 0x5a, 758c2ecf20Sopenharmony_ci .i2c_regW = 2, 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci .probe = s5k4aa_probe, 788c2ecf20Sopenharmony_ci .init = s5k4aa_init, 798c2ecf20Sopenharmony_ci .init_controls = s5k4aa_init_controls, 808c2ecf20Sopenharmony_ci .start = s5k4aa_start, 818c2ecf20Sopenharmony_ci .disconnect = s5k4aa_disconnect, 828c2ecf20Sopenharmony_ci}; 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci#endif 85