From patchwork Sun Oct 28 16:24:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Couret Charles-Antoine X-Patchwork-Id: 10658675 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E99114E2 for ; Sun, 28 Oct 2018 16:24:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4042A299D7 for ; Sun, 28 Oct 2018 16:24:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32D86299D9; Sun, 28 Oct 2018 16:24:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54D92299D7 for ; Sun, 28 Oct 2018 16:24:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727837AbeJ2BJP (ORCPT ); Sun, 28 Oct 2018 21:09:15 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:33861 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727589AbeJ2BJP (ORCPT ); Sun, 28 Oct 2018 21:09:15 -0400 Received: by mail-ed1-f66.google.com with SMTP id w19-v6so5237113eds.1 for ; Sun, 28 Oct 2018 09:24:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=essensium-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bITw1XgRBrOvjK7MD4ho1fW1nmnsLqFcQkk4OPg9a2U=; b=mvec4V0Oqy5lYw6qxuugEwVth55xSXIi7qbnY2limCE+UFVjrO34ne3xXB+dcCbHZR PSR7CttVfihQXJxoKNjItfTltVejKlUz/l22PV44ANk2Sn9/J0/c+yn37wz+vCg9yYTw fh9X2+19GFBSJw3LMeoj+/XIOkWphnpiIpqAYkg1sj5XCYnD1+ijgGEbB4wIQeb9K05J R+xITROydYIgeny5xy4OyAMmlncmVDalVEk/avixzis4XJZRz/YZZYj/XvhUTgXotAcg michLKt1udOMYWQwL7nAlFp1uImZl+7m0GIiizV4RIDMnV9WbHMexu2mhTKabxSAsCrU 3XZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bITw1XgRBrOvjK7MD4ho1fW1nmnsLqFcQkk4OPg9a2U=; b=lPWhswBfmi+kCpcI3y+ZHeA4eDD0hctMhctmZXnTescs6Bj7zNCQxteogUvC8FuLSR 5zYgdA+imagJKo80rArGQ2ZtHzop8p7W8gVm226CkPkqImQ6MOEwKHh6azn2xXVhovv9 ImEPj4v0fgAE0FSq+v6lL8mFAKGcE2qseYX0ICTYZgOracYfze+9j7MhHR53B4zFORVh zktybOm9yqh3zPgeI8nOMLZWWv9AmOZQoSD8ZJYuJYWPL31XjjdDeWEl2fiOYJtlI/H8 vOjjBisoCmyxReWNaDf4DQ2OMzbBobChNtn7Z9IluBxcnnZmbyS+vu+2Opt6u/L+mobT i+rg== X-Gm-Message-State: AGRZ1gIjvSdHDgjxp3/FJReiLINASrFN1Kzx0yrgkAWDz9d9ZWXHVyxR R4C0+yc27rYF5hnomWsf9kseg15wuD4= X-Google-Smtp-Source: AJdET5dPpuqFFhKHAigktKBr58hV9kVIN2D4ey6KZZqkZFmqmbQ7qSEZkYP06GH2k1JYNp6RM9vhKw== X-Received: by 2002:a17:906:2e5b:: with SMTP id r27-v6mr7461486eji.0.1540743848092; Sun, 28 Oct 2018 09:24:08 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:449e:5e00:b591:a63f:9b33:d18d]) by smtp.gmail.com with ESMTPSA id f22-v6sm5390143eda.9.2018.10.28.09.24.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Oct 2018 09:24:07 -0700 (PDT) From: Charles-Antoine Couret To: linux-iio@vger.kernel.org Cc: Charles-Antoine Couret Subject: [PATCH v4 1/2] iio:dac:ti-dac7311 Add driver for Texas Instrument DAC7311 Date: Sun, 28 Oct 2018 17:24:01 +0100 Message-Id: <20181028162402.16182-1-charles-antoine.couret@essensium.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It is a driver for Texas Instruments 8/10/12-bit 1-channel compatible with DAC6311 and DAC5311 chips. Datasheet of this chip: http://www.ti.com/lit/ds/symlink/dac7311.pdf Signed-off-by: Charles-Antoine Couret --- drivers/iio/dac/Kconfig | 9 + drivers/iio/dac/Makefile | 1 + drivers/iio/dac/ti-dac7311.c | 338 +++++++++++++++++++++++++++++++++++ 3 files changed, 348 insertions(+) create mode 100644 drivers/iio/dac/ti-dac7311.c diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig index 80beb64e9e0c..ac205c8f5de0 100644 --- a/drivers/iio/dac/Kconfig +++ b/drivers/iio/dac/Kconfig @@ -356,6 +356,15 @@ config TI_DAC5571 If compiled as a module, it will be called ti-dac5571. +config TI_DAC7311 + tristate "Texas Instruments 8/10/12-bit 1-channel DAC driver" + depends on SPI + help + Driver for the Texas Instruments + DAC7311, DAC6311, DAC5311. + + If compiled as a module, it will be called ti-dac7311. + config VF610_DAC tristate "Vybrid vf610 DAC driver" depends on OF diff --git a/drivers/iio/dac/Makefile b/drivers/iio/dac/Makefile index a1b37cf99441..4b02021cc30f 100644 --- a/drivers/iio/dac/Makefile +++ b/drivers/iio/dac/Makefile @@ -39,4 +39,5 @@ obj-$(CONFIG_STM32_DAC_CORE) += stm32-dac-core.o obj-$(CONFIG_STM32_DAC) += stm32-dac.o obj-$(CONFIG_TI_DAC082S085) += ti-dac082s085.o obj-$(CONFIG_TI_DAC5571) += ti-dac5571.o +obj-$(CONFIG_TI_DAC7311) += ti-dac7311.o obj-$(CONFIG_VF610_DAC) += vf610_dac.o diff --git a/drivers/iio/dac/ti-dac7311.c b/drivers/iio/dac/ti-dac7311.c new file mode 100644 index 000000000000..6f5df1a30a1c --- /dev/null +++ b/drivers/iio/dac/ti-dac7311.c @@ -0,0 +1,338 @@ +// SPDX-License-Identifier: GPL-2.0 +/* ti-dac7311.c - Texas Instruments 8/10/12-bit 1-channel DAC driver + * + * Copyright (C) 2018 CMC NV + * + * http://www.ti.com/lit/ds/symlink/dac7311.pdf + */ + +#include +#include +#include +#include + +enum { + ID_DAC5311 = 0, + ID_DAC6311, + ID_DAC7311, +}; + +enum { + POWER_1KOHM_TO_GND = 0, + POWER_100KOHM_TO_GND, + POWER_TRI_STATE, +}; + +struct ti_dac_spec { + u8 resolution; +}; + +static const struct ti_dac_spec ti_dac_spec[] = { + [ID_DAC5311] = { .resolution = 8 }, + [ID_DAC6311] = { .resolution = 10 }, + [ID_DAC7311] = { .resolution = 12 }, +}; + +/** + * struct ti_dac_chip - TI DAC chip + * @lock: protects write sequences + * @vref: regulator generating Vref + * @spi: SPI device to send data to the device + * @val: cached value + * @powerdown: whether the chip is powered down + * @powerdown_mode: selected by the user + * @resolution: resolution of the chip + * @buf: buffer for transfer data + */ +struct ti_dac_chip { + struct mutex lock; + struct regulator *vref; + struct spi_device *spi; + u16 val; + bool powerdown; + u8 powerdown_mode; + u8 resolution; + u8 buf[2] ____cacheline_aligned; +}; + +static u8 ti_dac_get_power(struct ti_dac_chip *ti_dac, bool powerdown) +{ + if (powerdown) + return ti_dac->powerdown_mode + 1; + + return 0; +} + +static int ti_dac_cmd(struct ti_dac_chip *ti_dac, u8 power, u16 val) +{ + u8 shift = 14 - ti_dac->resolution; + + ti_dac->buf[0] = (val << shift) & 0xFF; + ti_dac->buf[1] = (power << 6) | (val >> (8 - shift)); + return spi_write(ti_dac->spi, ti_dac->buf, 2); +} + +static const char * const ti_dac_powerdown_modes[] = { + "1kohm_to_gnd", + "100kohm_to_gnd", + "three_state", +}; + +static int ti_dac_get_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan) +{ + struct ti_dac_chip *ti_dac = iio_priv(indio_dev); + + return ti_dac->powerdown_mode; +} + +static int ti_dac_set_powerdown_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, + unsigned int mode) +{ + struct ti_dac_chip *ti_dac = iio_priv(indio_dev); + + ti_dac->powerdown_mode = mode; + return 0; +} + +static const struct iio_enum ti_dac_powerdown_mode = { + .items = ti_dac_powerdown_modes, + .num_items = ARRAY_SIZE(ti_dac_powerdown_modes), + .get = ti_dac_get_powerdown_mode, + .set = ti_dac_set_powerdown_mode, +}; + +static ssize_t ti_dac_read_powerdown(struct iio_dev *indio_dev, + uintptr_t private, + const struct iio_chan_spec *chan, + char *buf) +{ + struct ti_dac_chip *ti_dac = iio_priv(indio_dev); + + return sprintf(buf, "%d\n", ti_dac->powerdown); +} + +static ssize_t ti_dac_write_powerdown(struct iio_dev *indio_dev, + uintptr_t private, + const struct iio_chan_spec *chan, + const char *buf, size_t len) +{ + struct ti_dac_chip *ti_dac = iio_priv(indio_dev); + bool powerdown; + u8 power; + int ret; + + ret = strtobool(buf, &powerdown); + if (ret) + return ret; + + power = ti_dac_get_power(ti_dac, powerdown); + + mutex_lock(&ti_dac->lock); + ret = ti_dac_cmd(ti_dac, power, 0); + if (!ret) + ti_dac->powerdown = powerdown; + mutex_unlock(&ti_dac->lock); + + return ret ? ret : len; +} + +static const struct iio_chan_spec_ext_info ti_dac_ext_info[] = { + { + .name = "powerdown", + .read = ti_dac_read_powerdown, + .write = ti_dac_write_powerdown, + .shared = IIO_SHARED_BY_TYPE, + }, + IIO_ENUM("powerdown_mode", IIO_SHARED_BY_TYPE, &ti_dac_powerdown_mode), + IIO_ENUM_AVAILABLE("powerdown_mode", &ti_dac_powerdown_mode), + { }, +}; + +#define TI_DAC_CHANNEL(chan) { \ + .type = IIO_VOLTAGE, \ + .channel = (chan), \ + .output = true, \ + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ + .ext_info = ti_dac_ext_info, \ +} + +static const struct iio_chan_spec ti_dac_channels[] = { + TI_DAC_CHANNEL(0), +}; + +static int ti_dac_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int *val, int *val2, long mask) +{ + struct ti_dac_chip *ti_dac = iio_priv(indio_dev); + int ret; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + *val = ti_dac->val; + return IIO_VAL_INT; + + case IIO_CHAN_INFO_SCALE: + ret = regulator_get_voltage(ti_dac->vref); + if (ret < 0) + return ret; + + *val = ret / 1000; + *val2 = ti_dac->resolution; + return IIO_VAL_FRACTIONAL_LOG2; + } + + return -EINVAL; +} + +static int ti_dac_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, int val2, long mask) +{ + struct ti_dac_chip *ti_dac = iio_priv(indio_dev); + u8 power = ti_dac_get_power(ti_dac, ti_dac->powerdown); + int ret; + + switch (mask) { + case IIO_CHAN_INFO_RAW: + if (ti_dac->val == val) + return 0; + + if (val >= (1 << ti_dac->resolution) || val < 0) + return -EINVAL; + + if (ti_dac->powerdown) + return -EBUSY; + + mutex_lock(&ti_dac->lock); + ret = ti_dac_cmd(ti_dac, power, val); + if (!ret) + ti_dac->val = val; + mutex_unlock(&ti_dac->lock); + break; + + default: + ret = -EINVAL; + } + + return ret; +} + +static int ti_dac_write_raw_get_fmt(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, long mask) +{ + return IIO_VAL_INT; +} + +static const struct iio_info ti_dac_info = { + .read_raw = ti_dac_read_raw, + .write_raw = ti_dac_write_raw, + .write_raw_get_fmt = ti_dac_write_raw_get_fmt, +}; + +static int ti_dac_probe(struct spi_device *spi) +{ + struct device *dev = &spi->dev; + const struct ti_dac_spec *spec; + struct ti_dac_chip *ti_dac; + struct iio_dev *indio_dev; + int ret; + + indio_dev = devm_iio_device_alloc(dev, sizeof(*ti_dac)); + if (!indio_dev) { + dev_err(dev, "can not allocate iio device\n"); + return -ENOMEM; + } + + spi->mode = SPI_MODE_1; + spi->bits_per_word = 16; + spi_setup(spi); + + indio_dev->dev.parent = dev; + indio_dev->dev.of_node = spi->dev.of_node; + indio_dev->info = &ti_dac_info; + indio_dev->name = spi_get_device_id(spi)->name; + indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->channels = ti_dac_channels; + spi_set_drvdata(spi, indio_dev); + + ti_dac = iio_priv(indio_dev); + ti_dac->powerdown = false; + ti_dac->spi = spi; + + spec = &ti_dac_spec[spi_get_device_id(spi)->driver_data]; + indio_dev->num_channels = 1; + ti_dac->resolution = spec->resolution; + + ti_dac->vref = devm_regulator_get(dev, "vref"); + if (IS_ERR(ti_dac->vref)) { + dev_err(dev, "error to get regulator\n"); + return PTR_ERR(ti_dac->vref); + } + + ret = regulator_enable(ti_dac->vref); + if (ret < 0) { + dev_err(dev, "can not enable regulator\n"); + return ret; + } + + mutex_init(&ti_dac->lock); + + ret = iio_device_register(indio_dev); + if (ret) { + dev_err(dev, "fail to register iio device: %d\n", ret); + goto err; + } + + return 0; + +err: + mutex_destroy(&ti_dac->lock); + regulator_disable(ti_dac->vref); + return ret; +} + +static int ti_dac_remove(struct spi_device *spi) +{ + struct iio_dev *indio_dev = spi_get_drvdata(spi); + struct ti_dac_chip *ti_dac = iio_priv(indio_dev); + + iio_device_unregister(indio_dev); + mutex_destroy(&ti_dac->lock); + regulator_disable(ti_dac->vref); + return 0; +} + +static const struct of_device_id ti_dac_of_id[] = { + { .compatible = "ti,dac5311" }, + { .compatible = "ti,dac6311" }, + { .compatible = "ti,dac7311" }, + { } +}; +MODULE_DEVICE_TABLE(of, ti_dac_of_id); + +static const struct spi_device_id ti_dac_spi_id[] = { + { "dac5311", ID_DAC5311 }, + { "dac6311", ID_DAC6311 }, + { "dac7311", ID_DAC7311 }, + { } +}; +MODULE_DEVICE_TABLE(spi, ti_dac_spi_id); + +static struct spi_driver ti_dac_driver = { + .driver = { + .name = "ti-dac7311", + .of_match_table = ti_dac_of_id, + }, + .probe = ti_dac_probe, + .remove = ti_dac_remove, + .id_table = ti_dac_spi_id, +}; +module_spi_driver(ti_dac_driver); + +MODULE_AUTHOR("Charles-Antoine Couret "); +MODULE_DESCRIPTION("Texas Instruments 8/10/12-bit 1-channel DAC driver"); +MODULE_LICENSE("GPL v2"); From patchwork Sun Oct 28 16:24:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Couret Charles-Antoine X-Patchwork-Id: 10658677 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7E8B113BF for ; Sun, 28 Oct 2018 16:24:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63DEA299D7 for ; Sun, 28 Oct 2018 16:24:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 585D2299D9; Sun, 28 Oct 2018 16:24:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04233299D7 for ; Sun, 28 Oct 2018 16:24:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727828AbeJ2BJR (ORCPT ); Sun, 28 Oct 2018 21:09:17 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:44469 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727589AbeJ2BJQ (ORCPT ); Sun, 28 Oct 2018 21:09:16 -0400 Received: by mail-ed1-f67.google.com with SMTP id z21-v6so5218977edb.11 for ; Sun, 28 Oct 2018 09:24:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=essensium-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pjoIOgwO1aq64CDhYoLjJop5WJZTHeBp2dbePEgtTOI=; b=PqbKuNelWq70PMAH8bJp4FIwc5jdO1UroBcES5Cr7sTBuKy8kRNnRLog8e6D3au2fw mnZ67Fr8nq8CZr4skmz3FX2FZdmg/sTwjBtu2cj1CIFkF+jLe5QP7jhBgyuKcvvigYrw j3ixWhkTWrJVTwEBzYhARyFi7HDIOnwxR7V3jHOwFkiPZLd1xSLfvgkTAL6BpwBvYU2y EBxmm22qCO8DJcgjSO4T2MO1WyneMPqd8/gbCbpvFTwZNMv35vX2Xsr9epzgLu/mjlrb SwRGD44GJ283sR+2+ha7eW5dtLX5SMMKUd+BsvVlVBJTjVBAB3i8EgxY1dAPH4IpIqJD MM/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pjoIOgwO1aq64CDhYoLjJop5WJZTHeBp2dbePEgtTOI=; b=gJA9rVn0vnLx4OW66QF9ranehR9YvD+H5aIp/AJn50FIxTQatzNLf+WDNho1DOxMPb ZySC8smBDU4+QediKqL7eVvVCQMO+4dHxaxc0w5twF+NXS/SzwvgaIZF6zAeR7FQYn+3 16hB4LP1kk/KxKTxGLNCqfhGaqEhXe3wlOc0ymh/DGH6eY/52ed322zj0S0/lloCPvnv BYJjTY9lqAufw8b3jMVyWDMlZKOcgvLZiv2oN3xArcRp5pMLfhSopdDYizo9TgQcfxHC IdQmvX+ooACbJjf2JBz7n1U8XoEhj1jOqdKddRERoBXRvCkBbZdSMofH49Scs1ogK7A1 I9iA== X-Gm-Message-State: AGRZ1gIWvXEa+2BCiPfctDXVaAXQ3BOvVRvvomzTwayyg+bmAwBd7VNK 0mAz0sJLqIZ7TLqf15GjUHyh74VSzv8= X-Google-Smtp-Source: AJdET5fItmqNCccPswgNi5As5+xNomj786L07Cy9DpfsZ1FbN0dn4VWXoLBmmm8R3i+fOgeR1lGXJg== X-Received: by 2002:aa7:ca43:: with SMTP id j3-v6mr10990128edt.258.1540743850945; Sun, 28 Oct 2018 09:24:10 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:449e:5e00:b591:a63f:9b33:d18d]) by smtp.gmail.com with ESMTPSA id f22-v6sm5390143eda.9.2018.10.28.09.24.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Oct 2018 09:24:10 -0700 (PDT) From: Charles-Antoine Couret To: linux-iio@vger.kernel.org Cc: Charles-Antoine Couret , mark.rutland@arm.com, devicetree@vger.kernel.org Subject: [PATCH v4 2/2] dt-bindings: iio: dac: Add ti,dac7311 device tree bindings in documentation Date: Sun, 28 Oct 2018 17:24:02 +0100 Message-Id: <20181028162402.16182-2-charles-antoine.couret@essensium.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181028162402.16182-1-charles-antoine.couret@essensium.com> References: <20181028162402.16182-1-charles-antoine.couret@essensium.com> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Description how to invoke ti-dac7311 driver from device tree file. Signed-off-by: Charles-Antoine Couret Reviewed-by: Rob Herring --- .../bindings/iio/dac/ti,dac7311.txt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/dac/ti,dac7311.txt diff --git a/Documentation/devicetree/bindings/iio/dac/ti,dac7311.txt b/Documentation/devicetree/bindings/iio/dac/ti,dac7311.txt new file mode 100644 index 000000000000..1139e3b743cd --- /dev/null +++ b/Documentation/devicetree/bindings/iio/dac/ti,dac7311.txt @@ -0,0 +1,24 @@ +TI DAC7311 device tree bindings + +Required properties: +- compatible: must be set to: + * "ti,dac7311" + * "ti,dac6311" + * "ti,dac5311" +- reg: spi chip select number for the device +- vref-supply: The regulator supply for ADC reference voltage + +Optional properties: +- spi-max-frequency: Max SPI frequency to use + +Example: + + spi_master { + dac@0 { + compatible = "ti,dac7311"; + reg = <0>; /* CS0 */ + spi-max-frequency = <1000000>; + vref-supply = <&vdd_supply>; + }; + }; +