162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Driver for the s5k4aa sensor 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2008 Erik Andrén 662306a36Sopenharmony_ci * Copyright (C) 2007 Ilyes Gouta. Based on the m5603x Linux Driver Project. 762306a36Sopenharmony_ci * Copyright (C) 2005 m5603x Linux Driver Project <m5602@x3ng.com.br> 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * Portions of code to USB interface and ALi driver software, 1062306a36Sopenharmony_ci * Copyright (c) 2006 Willem Duinker 1162306a36Sopenharmony_ci * v4l2 interface modeled after the V4L2 driver 1262306a36Sopenharmony_ci * for SN9C10x PC Camera Controllers 1362306a36Sopenharmony_ci */ 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#ifndef M5602_S5K4AA_H_ 1662306a36Sopenharmony_ci#define M5602_S5K4AA_H_ 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#include <linux/dmi.h> 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci#include "m5602_sensor.h" 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci/*****************************************************************************/ 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci#define S5K4AA_PAGE_MAP 0xec 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci#define S5K4AA_PAGE_MAP_0 0x00 2762306a36Sopenharmony_ci#define S5K4AA_PAGE_MAP_1 0x01 2862306a36Sopenharmony_ci#define S5K4AA_PAGE_MAP_2 0x02 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci/* Sensor register definitions for page 0x02 */ 3162306a36Sopenharmony_ci#define S5K4AA_READ_MODE 0x03 3262306a36Sopenharmony_ci#define S5K4AA_ROWSTART_HI 0x04 3362306a36Sopenharmony_ci#define S5K4AA_ROWSTART_LO 0x05 3462306a36Sopenharmony_ci#define S5K4AA_COLSTART_HI 0x06 3562306a36Sopenharmony_ci#define S5K4AA_COLSTART_LO 0x07 3662306a36Sopenharmony_ci#define S5K4AA_WINDOW_HEIGHT_HI 0x08 3762306a36Sopenharmony_ci#define S5K4AA_WINDOW_HEIGHT_LO 0x09 3862306a36Sopenharmony_ci#define S5K4AA_WINDOW_WIDTH_HI 0x0a 3962306a36Sopenharmony_ci#define S5K4AA_WINDOW_WIDTH_LO 0x0b 4062306a36Sopenharmony_ci#define S5K4AA_GLOBAL_GAIN__ 0x0f 4162306a36Sopenharmony_ci/* sync lost, if too low, reduces frame rate if too high */ 4262306a36Sopenharmony_ci#define S5K4AA_H_BLANK_HI__ 0x1d 4362306a36Sopenharmony_ci#define S5K4AA_H_BLANK_LO__ 0x1e 4462306a36Sopenharmony_ci#define S5K4AA_EXPOSURE_HI 0x17 4562306a36Sopenharmony_ci#define S5K4AA_EXPOSURE_LO 0x18 4662306a36Sopenharmony_ci#define S5K4AA_BRIGHTNESS 0x1f /* (digital?) gain : 5 bits */ 4762306a36Sopenharmony_ci#define S5K4AA_GAIN 0x20 /* (analogue?) gain : 7 bits */ 4862306a36Sopenharmony_ci#define S5K4AA_NOISE_SUPP 0x37 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci#define S5K4AA_RM_ROW_SKIP_4X 0x08 5162306a36Sopenharmony_ci#define S5K4AA_RM_ROW_SKIP_2X 0x04 5262306a36Sopenharmony_ci#define S5K4AA_RM_COL_SKIP_4X 0x02 5362306a36Sopenharmony_ci#define S5K4AA_RM_COL_SKIP_2X 0x01 5462306a36Sopenharmony_ci#define S5K4AA_RM_H_FLIP 0x40 5562306a36Sopenharmony_ci#define S5K4AA_RM_V_FLIP 0x80 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci#define S5K4AA_DEFAULT_GAIN 0x5f 5862306a36Sopenharmony_ci#define S5K4AA_DEFAULT_BRIGHTNESS 0x10 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci/*****************************************************************************/ 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci/* Kernel module parameters */ 6362306a36Sopenharmony_ciextern int force_sensor; 6462306a36Sopenharmony_ciextern bool dump_sensor; 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ciint s5k4aa_probe(struct sd *sd); 6762306a36Sopenharmony_ciint s5k4aa_init(struct sd *sd); 6862306a36Sopenharmony_ciint s5k4aa_init_controls(struct sd *sd); 6962306a36Sopenharmony_ciint s5k4aa_start(struct sd *sd); 7062306a36Sopenharmony_civoid s5k4aa_disconnect(struct sd *sd); 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_cistatic const struct m5602_sensor s5k4aa = { 7362306a36Sopenharmony_ci .name = "S5K4AA", 7462306a36Sopenharmony_ci .i2c_slave_id = 0x5a, 7562306a36Sopenharmony_ci .i2c_regW = 2, 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci .probe = s5k4aa_probe, 7862306a36Sopenharmony_ci .init = s5k4aa_init, 7962306a36Sopenharmony_ci .init_controls = s5k4aa_init_controls, 8062306a36Sopenharmony_ci .start = s5k4aa_start, 8162306a36Sopenharmony_ci .disconnect = s5k4aa_disconnect, 8262306a36Sopenharmony_ci}; 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci#endif 85