From patchwork Fri Jan 12 20:38:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Stevanovic X-Patchwork-Id: 10161621 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 05B86602B3 for ; Fri, 12 Jan 2018 20:39:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E801D1FE82 for ; Fri, 12 Jan 2018 20:39:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D913B28A9D; Fri, 12 Jan 2018 20:39:02 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 6380E1FE82 for ; Fri, 12 Jan 2018 20:39:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964945AbeALUjB (ORCPT ); Fri, 12 Jan 2018 15:39:01 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:44761 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965004AbeALUjA (ORCPT ); Fri, 12 Jan 2018 15:39:00 -0500 Received: by mail-wm0-f67.google.com with SMTP id t8so14433666wmc.3; Fri, 12 Jan 2018 12:39:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=6X95d+MlIT0UTbNOSVZ6RA6ZTAbKSYtKv+cYxgdl1qo=; b=PqQs1hR41SG7ZaeHPYGHam656P41qT3tzm42BUehWyc8wIfCkGQwHrJIMQF1WtHoR2 +uL4IVvNAHchS0yrt+/dUflQRE2LDhgSmwmJa5cv2oYl1NTxizlDx0Hz6HXsTCLI8qKp GqZLAk/Exi2cZTmCFZjp1WuXDOpCK7+kkN1TR06JzeDdvKwA2P68o9M+OXybYaXLx39n Qi+dO7MKaeBLXN7Rv2qSdZILGdyrIiwoVX44wct7cWO+sgykD0OoqmhUGGQwPpAqaqYc 2agkwON+tukRtarnVeLCm6wmU0Anyksp/J3SjqT9r9S7tB7NwQ1zWKg7ikfWEoqB9R5f 4pHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=6X95d+MlIT0UTbNOSVZ6RA6ZTAbKSYtKv+cYxgdl1qo=; b=YLsy+Rhw1/CT1tU3YJqDQ3K67X0Bxbu7H0nSmqnNyLfaBtzW23HsfuQVYego7x4DVH LvBK2vGb9heSZ1y96ThZwv8AKJkivJxWNxGxECw74LXZs97MvRBr6mnnnOxg7ofIH+iG 5epnQ5pqbWzncex2LE3bDZofWcOFtJsxBSDdMwBeN8MddB7gO2zZnQwhDCqEtWYM7vDB /moHISJKNxQjwpklxSm42uuS0s2Cj3XGkOdKVhvrTak+ngbdgEDHSV4opnAFXPklrDuA bDDlbUvRa4qm/Y06rLp36zFJL0CzA4yNZLmt1QmCmjKcBsUnQDNx6eBwyzGJjSGFola3 gm3A== X-Gm-Message-State: AKwxytcr8lMCD69NJ59OQ9mAH5fE8A0gAOK7rY8vahiSuZbHnRa9pKx8 lC5piNHy52aD29a3LmFCdWKDZg== X-Google-Smtp-Source: ACJfBos3d/QuTOLJrJkR6ftyKIFRPIId/TaCOLKK56/XBCJ1mpyPmPp2Cn/3HTTPuv5RqCvRSU1Xlg== X-Received: by 10.28.126.87 with SMTP id z84mr4619115wmc.105.1515789539342; Fri, 12 Jan 2018 12:38:59 -0800 (PST) Received: from [192.168.102.128] (LFbn-1-8169-84.w90-112.abo.wanadoo.fr. [90.112.78.84]) by smtp.gmail.com with ESMTPSA id v75sm4183496wrc.45.2018.01.12.12.38.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jan 2018 12:38:58 -0800 (PST) To: Jonathan Cameron Cc: linux-iio@vger.kernel.org, LKML , knaack.h@gmx.de, pmeerw@pmeerw.net, Michael.Hennerich@analog.com, "lars@metafoo.de >> Lars-Peter Clausen" From: Milan Stevanovic Subject: [PATCH] iio: adc: driver for ti adc081s/adc101s/adc121s Message-ID: <23df1de6-dd7e-5c45-9634-1a3ec2e9687b@gmail.com> Date: Fri, 12 Jan 2018 21:38:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 Content-Language: en-US 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 From cb437dd49444fb12897f88ccf485369e6ed3184e Mon Sep 17 00:00:00 2001 From: Milan Stevanovic Date: Sun, 7 Jan 2018 21:44:33 +0100 Subject: [PATCH] iio: adc: driver for ti adc081s/adc101s/adc121s Add Linux device driver for TI single-channel CMOS 8/10/12-bit analog-to-digital converter with a high-speed serial interface. Signed-off-by: Milan Stevanovic --- drivers/iio/adc/ad7476.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index b7706bf..e872081 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -1,9 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 /* - * AD7466/7/8 AD7476/5/7/8 (A) SPI ADC driver * - * Copyright 2010 Analog Devices Inc. + * Analog Device AD7466/7/8 AD7476/5/7/8 (A) SPI ADC driver + * TI ADC081S/ADC101S/ADC121S 8/10/12-bit SPI ADC driver * - * Licensed under the GPL-2 or later. */ #include @@ -56,6 +56,9 @@ enum ad7476_supported_device_ids { ID_AD7468, ID_AD7495, ID_AD7940, + ID_ADC081S, + ID_ADC101S, + ID_ADC121S, }; static irqreturn_t ad7476_trigger_handler(int irq, void *p) @@ -147,6 +150,8 @@ static int ad7476_read_raw(struct iio_dev *indio_dev, }, \ } +#define ADC081S_CHAN(bits) _AD7476_CHAN((bits), 12 - (bits), \ + BIT(IIO_CHAN_INFO_RAW)) #define AD7476_CHAN(bits) _AD7476_CHAN((bits), 13 - (bits), \ BIT(IIO_CHAN_INFO_RAW)) #define AD7940_CHAN(bits) _AD7476_CHAN((bits), 15 - (bits), \ @@ -192,6 +197,18 @@ static const struct ad7476_chip_info ad7476_chip_info_tbl[] = { .channel[0] = AD7940_CHAN(14), .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), }, + [ID_ADC081S] = { + .channel[0] = ADC081S_CHAN(8), + .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), + }, + [ID_ADC101S] = { + .channel[0] = ADC081S_CHAN(10), + .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), + }, + [ID_ADC121S] = { + .channel[0] = ADC081S_CHAN(12), + .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), + }, }; static const struct iio_info ad7476_info = { @@ -294,6 +311,9 @@ static const struct spi_device_id ad7476_id[] = { {"ad7910", ID_AD7467}, {"ad7920", ID_AD7466}, {"ad7940", ID_AD7940}, + {"adc081s", ID_ADC081S}, + {"adc101s", ID_ADC101S}, + {"adc121s", ID_ADC121S}, {} }; MODULE_DEVICE_TABLE(spi, ad7476_id);