From patchwork Mon Mar 30 12:36:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongchun Zhu X-Patchwork-Id: 11465449 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 76C3992C for ; Mon, 30 Mar 2020 12:36:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5375920786 for ; Mon, 30 Mar 2020 12:36:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="S36tuLp5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730189AbgC3Mgf (ORCPT ); Mon, 30 Mar 2020 08:36:35 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:31702 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730113AbgC3Mgf (ORCPT ); Mon, 30 Mar 2020 08:36:35 -0400 X-UUID: 83a5ff9aa7904a9e8519baaf0ebf3ca2-20200330 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=5fynngkcfVP3y4nuFrJ+FfItuj0F2ovwQT443e47vAM=; b=S36tuLp5A9vckFlGPARidf9un053JVOXrFCQQFK2npj2KBo+afhhf8Kb3ajMyXf2MvThc9uV9YX6o38N77ucL7YKEAI7zzgr9DxdlUYHMmjhA3P+TBSgvdnRIyuhBFwnYOOFnOb9hGY3MeVgACzohMhcnSuCM89vOzo77uW7TkI=; X-UUID: 83a5ff9aa7904a9e8519baaf0ebf3ca2-20200330 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1354835767; Mon, 30 Mar 2020 20:36:31 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 30 Mar 2020 20:36:27 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 30 Mar 2020 20:36:26 +0800 From: Dongchun Zhu To: , , , , , , , , CC: , , , , , , , , Subject: [V4, 0/2] media: i2c: add support for DW9768 VCM driver Date: Mon, 30 Mar 2020 20:36:32 +0800 Message-ID: <20200330123634.363-1-dongchun.zhu@mediatek.com> X-Mailer: git-send-email 2.9.2 MIME-Version: 1.0 X-MTK: N Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Hello, Here is the updated version of the changes to add DT bindings in YAML and V4L2 driver for the DW9768 lens voicee coil motor. This is a 10-bit DAC with 100mA output current sink capability from Dongwoon, designed for linear control of voice coil motor, and controlled via I2C serial interface to set the desired focus. The DW9768 controls the position with 10-bit DAC data D[9:0] and seperates two 8-bit registers to control the VCM position as belows. DAC_MSB: D[9:8](ADDR: 0x03): +---+---+---+---+---+---+---+---+ |---|---|---|---|---|---|D09|D08| +---+---+---+---+---+---+---+---+ DAC_LSB: D[7:0](ADDR: 0x04): +---+---+---+---+---+---+---+---+ |D07|D06|D05|D04|D03|D02|D01|D00| +---+---+---+---+---+---+---+---+ This driver supports: - set DW9768 to standby mode once suspend and turn it back to active if resume - set the desired focus via V4L2_CID_FOCUS_ABSOLUTE ctrl Previous versions of this patch-set can be found here: v3: https://patchwork.kernel.org/cover/11412719/ v2: https://patchwork.kernel.org/cover/11132299/ v1: https://patchwork.kernel.org/cover/11034797/ Mainly changes of v4 are addressing comments from Rob, Andy, Sakari, Tomasz. Compared to v3: - Fix DT bindings and MAINTAINERS checking errors - Use i2c_smbus_write_word_swapped() to replace of i2c_smbus_write_word_data() - Refine driver more simply and clear - Add a dependency to CONFIG_PM Please review. Thanks. Dongchun Zhu (2): media: i2c: dw9768: Add DT support and MAINTAINERS entry media: i2c: Add DW9768 VCM driver .../bindings/media/i2c/dongwoon,dw9768.yaml | 62 +++ MAINTAINERS | 8 + drivers/media/i2c/Kconfig | 11 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/dw9768.c | 432 +++++++++++++++++++++ 5 files changed, 514 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.yaml create mode 100644 drivers/media/i2c/dw9768.c