linux/drivers/staging/media/atomisp/i2c/imx/dw9718.h
<<
>>
Prefs
   1/*
   2 * Support for dw9719 vcm driver.
   3 *
   4 * Copyright (c) 2014 Intel Corporation. All Rights Reserved.
   5 *
   6 * This program is free software; you can redistribute it and/or
   7 * modify it under the terms of the GNU General Public License version
   8 * 2 as published by the Free Software Foundation.
   9 *
  10 * This program is distributed in the hope that it will be useful,
  11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13 * GNU General Public License for more details.
  14 *
  15 * You should have received a copy of the GNU General Public License
  16 * along with this program; if not, write to the Free Software
  17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  18 * 02110-1301, USA.
  19 *
  20 */
  21
  22#ifndef __DW9718_H__
  23#define __DW9718_H__
  24
  25#include "../../include/linux/atomisp_platform.h"
  26#include <linux/types.h>
  27
  28#define DW9718_VCM_ADDR  (0x18 >> 1)
  29
  30/* dw9718 device structure */
  31struct dw9718_device {
  32        struct timespec timestamp_t_focus_abs;
  33        s16 number_of_steps;
  34        bool initialized;               /* true if dw9718 is detected */
  35        s32 focus;                      /* Current focus value */
  36        struct timespec focus_time;     /* Time when focus was last time set */
  37        __u8 buffer[4];                 /* Used for i2c transactions */
  38        const struct camera_af_platform_data *platform_data;
  39        __u8 power_on;
  40};
  41
  42#define DW9718_MAX_FOCUS_POS    1023
  43
  44/* Register addresses */
  45#define DW9718_PD                       0x00
  46#define DW9718_CONTROL                  0x01
  47#define DW9718_DATA_M                   0x02
  48#define DW9718_DATA_L                   0x03
  49#define DW9718_SW                       0x04
  50#define DW9718_SACT                     0x05
  51#define DW9718_FLAG                     0x10
  52
  53#define DW9718_CONTROL_SW_LINEAR        BIT(0)
  54#define DW9718_CONTROL_S_SAC4           (BIT(1) | BIT(3))
  55#define DW9718_CONTROL_OCP_DISABLE      BIT(4)
  56#define DW9718_CONTROL_UVLO_DISABLE     BIT(5)
  57
  58#define DW9718_SACT_MULT_TWO            0x00
  59#define DW9718_SACT_PERIOD_8_8MS        0x19
  60#define DW9718_SACT_DEFAULT_VAL         0x60
  61
  62#define DW9718_DEFAULT_FOCUS_POSITION   300
  63
  64#endif /* __DW9718_H__ */
  65