From patchwork Fri Feb 28 15:59:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongchun Zhu X-Patchwork-Id: 210789 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MIME_BASE64_TEXT, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15105C3F2CD for ; Fri, 28 Feb 2020 16:00:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E07B6246AF for ; Fri, 28 Feb 2020 16:00:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="oF3/ZhXT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727124AbgB1QAO (ORCPT ); Fri, 28 Feb 2020 11:00:14 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:50645 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726974AbgB1QAN (ORCPT ); Fri, 28 Feb 2020 11:00:13 -0500 X-UUID: 38d14b891f67470cab55ab539973e9b9-20200229 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=6GQzQmyAP4hZHov0w9Z++EkLKOgmoZgg7oFRSbDV/cs=; b=oF3/ZhXT0lsdOfiwc56cBMF6TTySj1OjKziRwyhm/UW9vtIFAEV+pAD0IUIzgBbyw3uYc+Y61h9pa8vF/pPGJ3qN6ltUfi7LcCIZUFV3dGvB7A+h68GhljnmhKxkFqZVMyUenI/wIMcRx6w1Mjqn8jFRaoGZf9cZZZ3Ng/Kyy4c=; X-UUID: 38d14b891f67470cab55ab539973e9b9-20200229 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 2020456843; Sat, 29 Feb 2020 00:00:09 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs05n1.mediatek.inc (172.21.101.15) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 28 Feb 2020 23:59:03 +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; Fri, 28 Feb 2020 23:59:48 +0800 From: Dongchun Zhu To: , , , , , , , , CC: , , , , , , , , Subject: [V3, 0/2] media: i2c: add support for DW9768 VCM driver Date: Fri, 28 Feb 2020 23:59:56 +0800 Message-ID: <20200228155958.20657-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, Add DT bindings in YAML and v4l2 driver for DW9768 lens voice coil actuator. 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 position. 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] (ADD: 0x03) +---+---+---+---+---+---+---+---+ |---|---|---|---|---|---|D09|D08| +---+---+---+---+---+---+---+---+ DAC_LSB: D[7:0] (ADD: 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 position via V4L2_CID_FOCUS_ABSOLUTE ctrl Changes of v3 are mainly addressing comments from Andy, Rob, Sakari, Tomasz, compared to v2: - Rebase onto 5.6-rc1 - Convert text documentation to YAML schema - Add documents for the register addresses and bits in the registers - Merge _power_off/on with runtime PM suspend/resume function - Drop the I2C ID table - Refine DW9768 power sequencing timing - Use the regulator bulk API to enable/disable regulators - Change i2c_smbus_write_block_data() to i2c_smbus_write_word_data() - Fixup coding style and improve code quality - Fix other reviewed issues in V2 Mainly changes of v2 are addressing the comments from Tomasz, Bingbu, Andy, including, - Use i2c_smbus_write_byte_data to replace of the custom dw9768_i2c_write - Use i2c_smbus_write_block_data to set vcm postion - Use the runtime PM suspend/resume callbacks to power off/on - Check the PM runtime status before powering off in dw9768_remove function - Add one more regulator vin for the I2C interface - Remove or refine log print - Fix other reviewed issues in v1 Dongchun Zhu (2): media: i2c: dw9768: Add DT support and MAINTAINERS entry media: i2c: Add DW9768 VCM driver .../bindings/media/i2c/dongwoon,dw9768.yaml | 55 +++ MAINTAINERS | 8 + drivers/media/i2c/Kconfig | 10 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/dw9768.c | 437 +++++++++++++++++++++ 5 files changed, 511 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.yaml create mode 100644 drivers/media/i2c/dw9768.c -- 2.9.2