Received: by 10.192.165.156 with SMTP id m28csp2887051imm; Sun, 15 Apr 2018 11:26:10 -0700 (PDT) X-Google-Smtp-Source: AIpwx49k7OyPR0tCf8CxI3y1jcQZJC690ChGT+2/kfdawnfGDeEUPO74unmAWUm+Us1FhulY6FEk X-Received: by 10.98.69.217 with SMTP id n86mr19004908pfi.41.1523816769972; Sun, 15 Apr 2018 11:26:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523816769; cv=none; d=google.com; s=arc-20160816; b=vQIDB82qlal1MpMIujMXy/GU31IAOn0L7KgwfaG83+rfN9YB/jF6QGfW+b+4AFb/mL Jwy9JaJYt43Tj+YO7gqDrnns0fACLo9IjtuduDwY/KkKQdEF+lZKvGzPw2shaJkPrUpN RxMhv+1CaNwzpKCC4cPVShmQqvHcHm/ReVDgv+gVVhPsfPrWLbGknFtcinEpoYGXcnRU r70/3MqKB6zvO9kRQDcSRnB8LghTbelRykSP8da6kAZUBCEExvcSn585uxAW3Aj1YXUQ cUC7nuaKqwSLc+qcsHBbOrkCx3X+UDflRzf8fDACc4g2uOzdtcPcguQ1/Cbgd2OgJymi EF1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dmarc-filter:arc-authentication-results; bh=sRoIj20bIXoJINwYhk8L8Xy78KQvZ7cyBU6m3zIsd5g=; b=qhtuR1VzmGUlqz6PkMwE4Kf9ENPnLUJmp+04FUVU6rOJpI+5FE5MheySyAzQwmVSp0 NLq64Y14iriVrQJXb4g2S2BwPZJzl0dkPCjL0PIgfx7ck9Hcxumy2BoNwiqZK3Nb/xMh jnIPnNoxQDris+yniXdD3yxwF9ZVBKOlkOlgaWGn3/CtCpcYVExdrKE2ESHHmr1TZkme oX83ptVlN4SUDVBb7Eoow6xK/6Px6KpIU6pXsOaa11ZlOAXNVwD+vkBFWYW0W5NCAKqz g318lM6jZ/0txnwKaZ776zVAq8rltKEuYaZqgKBpb+ReIgmuQM4GJLUZoqnm7TcddCR8 0BOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w16-v6si8023111plq.350.2018.04.15.11.25.56; Sun, 15 Apr 2018 11:26:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753073AbeDOSX4 (ORCPT + 99 others); Sun, 15 Apr 2018 14:23:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:49428 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752669AbeDOSXz (ORCPT ); Sun, 15 Apr 2018 14:23:55 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D3A3C2176F; Sun, 15 Apr 2018 18:23:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3A3C2176F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jic23@kernel.org Date: Sun, 15 Apr 2018 19:23:48 +0100 From: Jonathan Cameron To: Stefan Popa Cc: , , , , , Subject: Re: [PATCH v3 5/7] iio:dac:ad5686: Add AD5672R/76/76R/84R/86R support Message-ID: <20180415192348.16165da9@archlinux> In-Reply-To: <1523447581-13496-1-git-send-email-stefan.popa@analog.com> References: <1523375867-29616-1-git-send-email-stefan.popa@analog.com> <1523447581-13496-1-git-send-email-stefan.popa@analog.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 11 Apr 2018 14:53:01 +0300 Stefan Popa wrote: > The AD5684R/AD5686R are a family of 4 channel DACs with 12-bit, 14-bit and > 16-bit precision respectively. The devices come either with a built-in > reference or no built-in reference. > > The AD5672R/AD5676/AD5676R are similar, except that they have 8 channels > instead of 4. > > Datasheets: > http://www.analog.com/media/en/technical-documentation/data-sheets/AD5672R_5676R.pdf > http://www.analog.com/media/en/technical-documentation/data-sheets/AD5686R_5685R_5684R.pdf > > Signed-off-by: Stefan Popa Applied. My tweak to the previous patch made this fiddly, so please check I didn't mess it up. Thanks, Jonathan > --- > Changes in v2: > - Refactored the patch to add support for new parts > Changes in v3: > - Nothing changed, just to follow the patch set version > > drivers/iio/dac/ad5686.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 46 insertions(+) > > diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c > index a753ffd..54f67d5 100644 > --- a/drivers/iio/dac/ad5686.c > +++ b/drivers/iio/dac/ad5686.c > @@ -87,9 +87,14 @@ struct ad5686_state { > */ > > enum ad5686_supported_device_ids { > + ID_AD5672R, > + ID_AD5676, > + ID_AD5676R, > ID_AD5684, > + ID_AD5684R, > ID_AD5685R, > ID_AD5686, > + ID_AD5686R > }; > static int ad5686_spi_write(struct ad5686_state *st, > u8 cmd, u8 addr, u16 val, u8 shift) > @@ -293,15 +298,47 @@ static struct iio_chan_spec name[] = { \ > AD5868_CHANNEL(3, 8, bits, _shift), \ > } > > +#define DECLARE_AD5676_CHANNELS(name, bits, _shift) \ > +static struct iio_chan_spec name[] = { \ > + AD5868_CHANNEL(0, 0, bits, _shift), \ > + AD5868_CHANNEL(1, 1, bits, _shift), \ > + AD5868_CHANNEL(2, 2, bits, _shift), \ > + AD5868_CHANNEL(3, 3, bits, _shift), \ > + AD5868_CHANNEL(4, 4, bits, _shift), \ > + AD5868_CHANNEL(5, 5, bits, _shift), \ > + AD5868_CHANNEL(6, 6, bits, _shift), \ > + AD5868_CHANNEL(7, 7, bits, _shift), \ > +} > + > +DECLARE_AD5676_CHANNELS(ad5672_channels, 12, 4); > +DECLARE_AD5676_CHANNELS(ad5676_channels, 16, 0); > DECLARE_AD5686_CHANNELS(ad5684_channels, 12, 4); > DECLARE_AD5686_CHANNELS(ad5685r_channels, 14, 2); > DECLARE_AD5686_CHANNELS(ad5686_channels, 16, 0); > > static const struct ad5686_chip_info ad5686_chip_info_tbl[] = { > + [ID_AD5672R] = { > + .channels = ad5672_channels, > + .int_vref_mv = 2500, > + .num_channels = 8, > + }, > + [ID_AD5676] = { > + .channels = ad5676_channels, > + .num_channels = 8, > + }, > + [ID_AD5676R] = { > + .channels = ad5676_channels, > + .int_vref_mv = 2500, > + .num_channels = 8, > + }, > [ID_AD5684] = { > .channels = ad5684_channels, > .num_channels = 4, > + }, > + [ID_AD5684R] = { > + .channels = ad5684_channels, > .int_vref_mv = 2500, > + .num_channels = 4, > }, > [ID_AD5685R] = { > .channels = ad5685r_channels, > @@ -311,7 +348,11 @@ static const struct ad5686_chip_info ad5686_chip_info_tbl[] = { > [ID_AD5686] = { > .channels = ad5686_channels, > .num_channels = 4, > + }, > + [ID_AD5686R] = { > + .channels = ad5686_channels, > .int_vref_mv = 2500, > + .num_channels = 4, > }, > }; > > @@ -391,9 +432,14 @@ static int ad5686_remove(struct spi_device *spi) > } > > static const struct spi_device_id ad5686_id[] = { > + {"ad5672r", ID_AD5672R}, > + {"ad5676", ID_AD5676}, > + {"ad5676r", ID_AD5676R}, > {"ad5684", ID_AD5684}, > + {"ad5684r", ID_AD5684R}, > {"ad5685r", ID_AD5685R}, > {"ad5686", ID_AD5686}, > + {"ad5686r", ID_AD5686R}, > {} > }; > MODULE_DEVICE_TABLE(spi, ad5686_id);