diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-15 20:30:12 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-15 20:30:12 -0800 |
commit | 5d352e69c60e54b5f04d6e337a1d2bf0dbf3d94a (patch) | |
tree | 214e6b190715267ed02b6d415396c2bbcf2eaace /drivers/staging/media/atomisp/i2c/imx/dw9719.c | |
parent | Merge tag 'leaks-4.15-rc1' of git://github.com/tcharding/linux (diff) | |
parent | Merge tag 'staging-4.15-rc1' into v4l_for_linus (diff) | |
download | linux-dev-5d352e69c60e54b5f04d6e337a1d2bf0dbf3d94a.tar.xz linux-dev-5d352e69c60e54b5f04d6e337a1d2bf0dbf3d94a.zip |
Merge tag 'media/v4.15-1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab:
- Documentation for digital TV (both kAPI and uAPI) are now in sync
with the implementation (except for legacy/deprecated ioctls). This
is a major step, as there were always a gap there
- New sensor driver: imx274
- New cec driver: cec-gpio
- New platform driver for rockship rga and tegra CEC
- New RC driver: tango-ir
- Several cleanups at atomisp driver
- Core improvements for RC, CEC, V4L2 async probing support and DVB
- Lots of drivers cleanup, fixes and improvements.
* tag 'media/v4.15-1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (332 commits)
dvb_frontend: don't use-after-free the frontend struct
media: dib0700: fix invalid dvb_detach argument
media: v4l2-ctrls: Don't validate BITMASK twice
media: s5p-mfc: fix lockdep warning
media: dvb-core: always call invoke_release() in fe_free()
media: usb: dvb-usb-v2: dvb_usb_core: remove redundant code in dvb_usb_fe_sleep
media: au0828: make const array addr_list static
media: cx88: make const arrays default_addr_list and pvr2000_addr_list static
media: drxd: make const array fastIncrDecLUT static
media: usb: fix spelling mistake: "synchronuously" -> "synchronously"
media: ddbridge: fix build warnings
media: av7110: avoid 2038 overflow in debug print
media: Don't do DMA on stack for firmware upload in the AS102 driver
media: v4l: async: fix unregister for implicitly registered sub-device notifiers
media: v4l: async: fix return of unitialized variable ret
media: imx274: fix missing return assignment from call to imx274_mode_regs
media: camss-vfe: always initialize reg at vfe_set_xbar_cfg()
media: atomisp: make function calls cleaner
media: atomisp: get rid of storage_class.h
media: atomisp: get rid of wrong stddef.h include
...
Diffstat (limited to 'drivers/staging/media/atomisp/i2c/imx/dw9719.c')
-rw-r--r-- | drivers/staging/media/atomisp/i2c/imx/dw9719.c | 198 |
1 files changed, 0 insertions, 198 deletions
diff --git a/drivers/staging/media/atomisp/i2c/imx/dw9719.c b/drivers/staging/media/atomisp/i2c/imx/dw9719.c deleted file mode 100644 index 565237796bb4..000000000000 --- a/drivers/staging/media/atomisp/i2c/imx/dw9719.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Support for dw9719 vcm driver. - * - * Copyright (c) 2012 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - * - */ - -#include <linux/delay.h> -#include "dw9719.h" - -static struct dw9719_device dw9719_dev; - -static int dw9719_i2c_rd8(struct i2c_client *client, u8 reg, u8 *val) -{ - struct i2c_msg msg[2]; - u8 buf[2] = { reg }; - - msg[0].addr = DW9719_VCM_ADDR; - msg[0].flags = 0; - msg[0].len = 1; - msg[0].buf = buf; - - msg[1].addr = DW9719_VCM_ADDR; - msg[1].flags = I2C_M_RD; - msg[1].len = 1; - msg[1].buf = &buf[1]; - *val = 0; - - if (i2c_transfer(client->adapter, msg, 2) != 2) - return -EIO; - *val = buf[1]; - - return 0; -} - -static int dw9719_i2c_wr8(struct i2c_client *client, u8 reg, u8 val) -{ - struct i2c_msg msg; - u8 buf[2] = { reg, val }; - - msg.addr = DW9719_VCM_ADDR; - msg.flags = 0; - msg.len = sizeof(buf); - msg.buf = buf; - - if (i2c_transfer(client->adapter, &msg, 1) != 1) - return -EIO; - - return 0; -} - -static int dw9719_i2c_wr16(struct i2c_client *client, u8 reg, u16 val) -{ - struct i2c_msg msg; - u8 buf[3] = { reg, (u8)(val >> 8), (u8)(val & 0xff)}; - - msg.addr = DW9719_VCM_ADDR; - msg.flags = 0; - msg.len = sizeof(buf); - msg.buf = buf; - - if (i2c_transfer(client->adapter, &msg, 1) != 1) - return -EIO; - - return 0; -} - -int dw9719_vcm_power_up(struct v4l2_subdev *sd) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - u8 value; - - /* Enable power */ - ret = dw9719_dev.platform_data->power_ctrl(sd, 1); - /* waiting time requested by DW9714A(vcm) */ - if (ret) - return ret; - /* Wait for VBAT to stabilize */ - udelay(1); - - /* - * Jiggle SCL pin to wake up device. - */ - ret = dw9719_i2c_wr8(client, DW9719_CONTROL, 1); - /* Need 100us to transit from SHUTDOWN to STANDBY*/ - usleep_range(100, 1000); - - /* Enable the ringing compensation */ - ret = dw9719_i2c_wr8(client, DW9719_CONTROL, DW9719_ENABLE_RINGING); - if (ret < 0) - goto fail_powerdown; - - /* Use SAC3 mode */ - ret = dw9719_i2c_wr8(client, DW9719_MODE, DW9719_MODE_SAC3); - if (ret < 0) - goto fail_powerdown; - - /* Set the resonance frequency */ - ret = dw9719_i2c_wr8(client, DW9719_VCM_FREQ, DW9719_DEFAULT_VCM_FREQ); - if (ret < 0) - goto fail_powerdown; - - /* Detect device */ - ret = dw9719_i2c_rd8(client, DW9719_INFO, &value); - if (ret < 0) - goto fail_powerdown; - if (value != DW9719_ID) { - ret = -ENXIO; - goto fail_powerdown; - } - dw9719_dev.focus = 0; - dw9719_dev.initialized = true; - - return 0; - -fail_powerdown: - dw9719_dev.platform_data->power_ctrl(sd, 0); - return ret; -} - -int dw9719_vcm_power_down(struct v4l2_subdev *sd) -{ - return dw9719_dev.platform_data->power_ctrl(sd, 0); -} - -int dw9719_q_focus_status(struct v4l2_subdev *sd, s32 *value) -{ - static const struct timespec move_time = { - - .tv_sec = 0, - .tv_nsec = 60000000 - }; - struct timespec current_time, finish_time, delta_time; - - getnstimeofday(¤t_time); - finish_time = timespec_add(dw9719_dev.focus_time, move_time); - delta_time = timespec_sub(current_time, finish_time); - if (delta_time.tv_sec >= 0 && delta_time.tv_nsec >= 0) { - *value = ATOMISP_FOCUS_HP_COMPLETE | - ATOMISP_FOCUS_STATUS_ACCEPTS_NEW_MOVE; - } else { - *value = ATOMISP_FOCUS_STATUS_MOVING | - ATOMISP_FOCUS_HP_IN_PROGRESS; - } - - return 0; -} - -int dw9719_t_focus_abs(struct v4l2_subdev *sd, s32 value) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret; - - value = clamp(value, 0, DW9719_MAX_FOCUS_POS); - ret = dw9719_i2c_wr16(client, DW9719_VCM_CURRENT, value); - if (ret < 0) - return ret; - - getnstimeofday(&dw9719_dev.focus_time); - dw9719_dev.focus = value; - - return 0; -} - -int dw9719_t_focus_rel(struct v4l2_subdev *sd, s32 value) -{ - return dw9719_t_focus_abs(sd, dw9719_dev.focus + value); -} - -int dw9719_q_focus_abs(struct v4l2_subdev *sd, s32 *value) -{ - *value = dw9719_dev.focus; - return 0; -} -int dw9719_t_vcm_slew(struct v4l2_subdev *sd, s32 value) -{ - return 0; -} - -int dw9719_t_vcm_timing(struct v4l2_subdev *sd, s32 value) -{ - return 0; -} |