1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Support for AD5823 VCM. 4 * 5 * Copyright (c) 2013 Intel Corporation. All Rights Reserved. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License version 9 * 2 as published by the Free Software Foundation. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * 17 */ 18 19 #ifndef __AD5823_H__ 20 #define __AD5823_H__ 21 22 #include <linux/types.h> 23 24 #define AD5823_VCM_ADDR 0x0c 25 26 #define AD5823_REG_RESET 0x01 27 #define AD5823_REG_MODE 0x02 28 #define AD5823_REG_VCM_MOVE_TIME 0x03 29 #define AD5823_REG_VCM_CODE_MSB 0x04 30 #define AD5823_REG_VCM_CODE_LSB 0x05 31 #define AD5823_REG_VCM_THRESHOLD_MSB 0x06 32 #define AD5823_REG_VCM_THRESHOLD_LSB 0x07 33 34 #define AD5823_REG_LENGTH 0x1 35 36 #define AD5823_RING_CTRL_ENABLE 0x04 37 #define AD5823_RING_CTRL_DISABLE 0x00 38 39 #define AD5823_RESONANCE_PERIOD 100000 40 #define AD5823_RESONANCE_COEF 512 41 #define AD5823_HIGH_FREQ_RANGE 0x80 42 43 #define VCM_CODE_MSB_MASK 0xfc 44 #define AD5823_INIT_FOCUS_POS 350 45 46 enum ad5823_tok_type { 47 AD5823_8BIT = 0x1, 48 AD5823_16BIT = 0x2, 49 }; 50 51 enum ad5823_vcm_mode { 52 AD5823_ARC_RES0 = 0x0, /* Actuator response control RES1 */ 53 AD5823_ARC_RES1 = 0x1, /* Actuator response control RES0.5 */ 54 AD5823_ARC_RES2 = 0x2, /* Actuator response control RES2 */ 55 AD5823_ESRC = 0x3, /* Enhanced slew rate control */ 56 AD5823_DIRECT = 0x4, /* Direct control */ 57 }; 58 59 #define AD5823_INVALID_CONFIG 0xffffffff 60 #define AD5823_MAX_FOCUS_POS 1023 61 #define DELAY_PER_STEP_NS 1000000 62 #define DELAY_MAX_PER_STEP_NS (1000000 * 1023) 63 #endif 64