From patchwork Sat Oct 6 20:31:07 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: 10629311 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 186C1174A for ; Sat, 6 Oct 2018 20:31:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0811328F8F for ; Sat, 6 Oct 2018 20:31:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EEFE128FA3; Sat, 6 Oct 2018 20:31:17 +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 2155328F8F for ; Sat, 6 Oct 2018 20:31:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727835AbeJGDf5 (ORCPT ); Sat, 6 Oct 2018 23:35:57 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:39563 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727771AbeJGDf5 (ORCPT ); Sat, 6 Oct 2018 23:35:57 -0400 Received: by mail-ed1-f68.google.com with SMTP id d15-v6so2236071edq.6 for ; Sat, 06 Oct 2018 13:31:14 -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; bh=N22OsYoJIbz9cq9Ibo1KnOFFIiN62dxKgnsBiQigYRU=; b=wp5UxVGbWkeDULNg0Uvp5yaaPu6579kQRlhrdhgypupRlnFBmwfzyOoZC0BxcpBDef fxnjBnkalZtM1eQRxxe58Xj35wV3SMcHXxCYXwRErOvCek8eDLdcqP1fyhJEE2/xdM2j mSVtLSHcCH3a9kLX2PzJUK3kKPnOak+MzsoCCFSmRSF+moNAo3iSUiszyiLDzrRrZpU3 /BbkJ+x479Yr4Fo49hq6T3y4qx7ZUCmH41FBsMkerAmML2z8bRqKNCXlibeg/egvTueP GV1TjCmv3WN7n+MtWuoKBYu4dqsGk3XI0qUxkxXs5uV2BS0+tWu5AA9a1i1TnByFSBwA N01Q== 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; bh=N22OsYoJIbz9cq9Ibo1KnOFFIiN62dxKgnsBiQigYRU=; b=FSGpBLld/lsX1+XvzHdg1af7pU8VpxzQSbfHUX8+vhhyWi/RdJ4Ymb8OkyP7CTYTGL 9y11CNQIzGl9LCvv5PfPj7pabIv1047AEkpDT5yodqZ2zVOvjEyI6weyqA5/3VPqFeml 57gEiCDh+Q2HhbA/rwJh6r30UkWntDuktXaVKFBIOjEV3ScdDDvCusVfcIzRIky/WUJm ayyh9iXo1TsdUfm8Y1RJ89wcSyGS9pHiGDZAY1dJhHHTzDOEbkcWaY9fi/wvxnfmUAJj yTQ9yLTOAGZnU8d5fClT2bK8CI18sfKBZt353i7hhUElOcs4G8birJRjiOfFldpbHaq1 YS5Q== X-Gm-Message-State: ABuFfoh3rfdWLUMmNelu8gglY3WPhWx0Zx2rrtZ2SA1pxuK3xHhbpWVD ZzN6PxPcl3EMoI22JrgklyzeswKdplo= X-Google-Smtp-Source: ACcGV62KO8NPEMGIlmCnB9ZPFDkjcXDXIoGZILK0THwayCY+FXT0Fj1LmuUw8BtQU/93Eza+jPAcJw== X-Received: by 2002:a50:b5e6:: with SMTP id a93-v6mr21195235ede.279.1538857873528; Sat, 06 Oct 2018 13:31:13 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:4423:3600:9626:d5b7:4a40:9655]) by smtp.gmail.com with ESMTPSA id 9-v6sm873978ejw.46.2018.10.06.13.31.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Oct 2018 13:31:13 -0700 (PDT) From: Charles-Antoine Couret To: linux-iio@vger.kernel.org Cc: Charles-Antoine Couret Subject: [PATCH 1/2] Add driver for Texas Instrument DAC7311 It is a driver for Texas Instruments 8/10/12-bit 1-channel compatible with DAC6311 and DAC5311 chips. Date: Sat, 6 Oct 2018 22:31:07 +0200 Message-Id: <20181006203108.20439-1-charles-antoine.couret@essensium.com> X-Mailer: git-send-email 2.17.1 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 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 | 361 +++++++++++++++++++++++++++++++++++ 3 files changed, 371 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..e7e61a7ce619 --- /dev/null +++ b/drivers/iio/dac/ti-dac7311.c @@ -0,0 +1,361 @@ +// 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 { + SINGLE_8BITS = 0, + SINGLE_10BITS, + SINGLE_12BITS, +}; + +enum { + POWER_RUNNING = 0, + POWER_1KOHM_TO_GND, + POWER_100KOHM_TO_GND, + POWER_TRI_STATE, +}; + +struct ti_dac_spec { + u8 num_channels; + u8 resolution; +}; + +static const struct ti_dac_spec ti_dac_spec[] = { + [SINGLE_8BITS] = { .num_channels = 1, .resolution = 8 }, + [SINGLE_10BITS] = { .num_channels = 1, .resolution = 10 }, + [SINGLE_12BITS] = { .num_channels = 1, .resolution = 12 }, +}; + +/** + * struct ti_dac_chip - TI DAC chip + * @lock: protects write sequences + * @vref: regulator generating Vref + * @mesg: SPI message to perform a write + * @xfer: SPI transfer used by @mesg + * @val: cached value + * @powerdown: whether the chip is powered down + * @powerdown_mode: selected by the user + * @resolution: resolution of the chip + * @buf: buffer for @xfer + */ +struct ti_dac_chip { + struct mutex lock; + struct regulator *vref; + struct spi_message mesg; + struct spi_transfer xfer; + u16 val; + bool powerdown; + u8 powerdown_mode; + u8 resolution; + u8 buf[2] ____cacheline_aligned; +}; + +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_sync(ti_dac->mesg.spi, &ti_dac->mesg); +} + +static const char * const ti_dac_powerdown_modes[] = { + "running", + "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); + int ret = 0; + + if (ti_dac->powerdown_mode == mode) + return ret; + + mutex_lock(&ti_dac->lock); + if (ti_dac->powerdown) { + ret = ti_dac_cmd(ti_dac, ti_dac->powerdown_mode, ti_dac->val); + if (ret) + goto out; + } + ti_dac->powerdown_mode = mode; + +out: + mutex_unlock(&ti_dac->lock); + return ret; +} + +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; + int ret; + + ret = strtobool(buf, &powerdown); + if (ret) + return ret; + + if (ti_dac->powerdown == powerdown) + return len; + + mutex_lock(&ti_dac->lock); + ret = ti_dac_cmd(ti_dac, ti_dac->powerdown_mode, 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), \ + .address = (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; + ret = IIO_VAL_INT; + break; + + case IIO_CHAN_INFO_SCALE: + ret = regulator_get_voltage(ti_dac->vref); + if (ret < 0) + return ret; + + *val = ret / 1000; + *val2 = ti_dac->resolution; + ret = IIO_VAL_FRACTIONAL_LOG2; + break; + + default: + ret = -EINVAL; + } + + return ret; +} + +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); + 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, ti_dac->powerdown_mode, 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->max_speed_hz = 50000000; + spi->mode = SPI_MODE_1; + spi->irq = -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_mode = POWER_RUNNING; + ti_dac->val = 0; + ti_dac->xfer.tx_buf = &ti_dac->buf; + ti_dac->xfer.len = sizeof(ti_dac->buf); + spi_message_init_with_transfers(&ti_dac->mesg, &ti_dac->xfer, 1); + ti_dac->mesg.spi = spi; + + spec = &ti_dac_spec[spi_get_device_id(spi)->driver_data]; + indio_dev->num_channels = spec->num_channels; + 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; +} + +#ifdef CONFIG_OF +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); +#endif + +static const struct spi_device_id ti_dac_spi_id[] = { + { "dac5311", SINGLE_8BITS }, + { "dac6311", SINGLE_10BITS }, + { "dac7311", SINGLE_12BITS }, + { } +}; +MODULE_DEVICE_TABLE(spi, ti_dac_spi_id); + +static struct spi_driver ti_dac_driver = { + .driver = { + .name = "ti-dac7311", + .of_match_table = of_match_ptr(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 Sat Oct 6 20:31:08 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: 10629313 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 2D88B174A for ; Sat, 6 Oct 2018 20:31:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EAD328F8F for ; Sat, 6 Oct 2018 20:31:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 108D028FA3; Sat, 6 Oct 2018 20:31:23 +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 B5D0E28F8F for ; Sat, 6 Oct 2018 20:31:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727856AbeJGDgD (ORCPT ); Sat, 6 Oct 2018 23:36:03 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:39566 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727771AbeJGDgC (ORCPT ); Sat, 6 Oct 2018 23:36:02 -0400 Received: by mail-ed1-f65.google.com with SMTP id d15-v6so2236178edq.6 for ; Sat, 06 Oct 2018 13:31:21 -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; bh=B5qqDCTbWFCNDXlzVDdwslQ7gNoi+D4Yn5sm8TmZEK8=; b=XuKljP+TaVC1+qN8/NsN77VTX3tpW9dd1GpyMkniWqFCEMSOLc3HB02ww1iuchFoVn yX7XZEj49VTdqrkttJR7Q4Xrx88akXLMt8z/FQ3QXI30GPgz4st5xB6jh6EuGTxjniih aJV+8xAd18vDY1S04SGfHtzsCtVOa2zKRvlWzBgAYSTA+XnvnVe2kQhZp6COCfVIpqTM jxnjWuXa/0P6q7B34Vi2/THbUDFoXWsZ/HescKcTTX/clirMIEcgo5Ao0rREGLZiaC9z HhCIVdjSncSANNVOA9OxxDqFGkq4DC5MLa4lt24G+D2cLIHI9WskquGw6HWAWtvO6fNU bhjg== 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; bh=B5qqDCTbWFCNDXlzVDdwslQ7gNoi+D4Yn5sm8TmZEK8=; b=cqCWdOUZKWCbs2cq3a+6R+fK34ns3MXiyO5ataK9Ge6qqhNsg00CsyT50Bg4UztFLp XlS/7CZ21zLUdUSFPVvb6zSmbfmKSfgjN4grsqjZTonsWfJPn1DyakMi8irSX8LWtbKb 7RlVm9xzlyJjRWjwCpQb5PBDkfcJdsFB3oJ7SCH2cBxfsiEvV9SbR/Uflk+dXfZv8UQg /w03aDOaY+AJcGBu4yKqVnA+W0ccgEp9D4PgaIE1HcM0V/lAibCGBCaBXNvKJH6sMM5y MJ9VlUN31CfKyKSMJhaqbjrP/AY+ZjHclIVVx0cV6jt4yQrDDj4pMBmulF0b3y7xBPew d72Q== X-Gm-Message-State: ABuFfoj4ehOXAsVpP0GeoMDwxp1vAiPy/rU+bXqK6mC4MY+OIs9l1us4 L6Vx8s73yvbmKsgBj1+gRO/LQnm5lK4= X-Google-Smtp-Source: ACcGV61efAl7HubMs8xt0gVaQPSnVXEOVQDGyzd8N9gz48baZXC1XV5bWqljUhFZbMNKZbtlMDZh6w== X-Received: by 2002:a17:906:5387:: with SMTP id g7-v6mr16778402ejo.174.1538857880280; Sat, 06 Oct 2018 13:31:20 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:4423:3600:9626:d5b7:4a40:9655]) by smtp.gmail.com with ESMTPSA id 9-v6sm873978ejw.46.2018.10.06.13.31.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Oct 2018 13:31:19 -0700 (PDT) From: Charles-Antoine Couret To: linux-iio@vger.kernel.org Cc: Charles-Antoine Couret Subject: [PATCH 2/2] Add ti,dac7311 device tree bindings in documentation Date: Sat, 6 Oct 2018 22:31:08 +0200 Message-Id: <20181006203108.20439-2-charles-antoine.couret@essensium.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181006203108.20439-1-charles-antoine.couret@essensium.com> References: <20181006203108.20439-1-charles-antoine.couret@essensium.com> 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 Signed-off-by: Charles-Antoine Couret --- .../bindings/iio/dac/ti,dac7311.txt | 20 +++++++++++++++++++ 1 file changed, 20 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..77fd4370f815 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/dac/ti,dac7311.txt @@ -0,0 +1,20 @@ +TI DAC7311 DEVICETREE BINDINGS + +Required properties: + +- compatible: Must be set to "ti,dac7311", "ti,dac6311" or "ti,dac5311" +- reg: spi chip select number for the device +- vref-supply: The regulator supply for ADC reference voltage +- spi-max-frequency: Max SPI frequency to use (< 50000000) + +Example: + + spi_master { + dac7311: dac7311@0 { + compatible = "ti,dac7311"; + reg = <0>; /* CS0 */ + spi-max-frequency = <1000000>; + vref-supply = <&vdd_supply>; + }; + }; +