Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp1183042ybd; Wed, 26 Jun 2019 12:44:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqyG+CrU30DD9Q3wRLYJYUGaPH9eirheyKgtdXW1GRqLWjBNOBRnigsO48L/9quOxkYTR+zg X-Received: by 2002:a17:90a:7d04:: with SMTP id g4mr963838pjl.41.1561578287492; Wed, 26 Jun 2019 12:44:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561578287; cv=none; d=google.com; s=arc-20160816; b=PXenDQ0sZzcQOHsh59+jSx541Ak6Mp1089h47wnv5OenUdE/Cqltl3tSSgz+S78oRl ulzIVEUvJUwAJb98Qkvk4OhKtCDe9wxVWr8CNoVT/E3uHG3qnF3TfqY3jmZQiqnWIx1F baxwquF/QhdtuH6Q9rYSb13PFTHFKSieHZkyOD+PwkI5qejt/TUIV27B35Bt3R5rfnNA uV/aijqDrJwuW6qfhnTrh6/gQDaVNm+8WRjkeMwLVyjpoU0se86Ea0L/++HlbBNo83O/ aDa9i2OU0lntCoZ8cxrpnXrWO7XTDFAITYY5jPikR2xjYY5g39JZkDSin8wmfk+bMoOC 12EQ== 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 :dkim-signature; bh=w2C9UO1VUrnn0q/LiIzw4vr4+WUm0XYRU1xBZ3/l9XQ=; b=SINyMA8QAv2lta41S0vIrsrsrD0SNGQvthOme97ZyN3TVqqa3Xm+AVtSERxk1BCyG4 k3EkL1xB1o3Ush+5HGJXvt4hvdsPlWNGA0NUxLsUgjnzL9KrRFXLFdfHlh15nvECRUh7 zUZ7qDLrS82vEnBh3EkO2k/DP3Hj1Y71AMonoqit01xpxJXVsTLTtKVbz1zrhyEs/f8B RwWLypJRahddb2fKYji/tGbdBStg2JEtkoc6qITr/glIeGPy1j65p7dd2qzXuo9+Y3vN BOGIXPtfMlMzECwAvpjdUijrairphgRa30Vj1bYvJj4ewVMwGc81Wq1BpD2cT1XmjTjK QKfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="r0jTRwG/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m8si17590670pgs.457.2019.06.26.12.44.31; Wed, 26 Jun 2019 12:44:47 -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; dkim=pass header.i=@kernel.org header.s=default header.b="r0jTRwG/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726425AbfFZTnQ (ORCPT + 99 others); Wed, 26 Jun 2019 15:43:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:59260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726227AbfFZTnQ (ORCPT ); Wed, 26 Jun 2019 15:43:16 -0400 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (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 4F31A2085A; Wed, 26 Jun 2019 19:43:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561578194; bh=Fc100cECJjr5SYsyo1x+bSAh9OozTjsFyISKkg06BI8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=r0jTRwG/VgVF5HIa8xdJFmtYFTjwr0HEf+AJg1hAormiJeVRprt46yXEBVy/IiOG2 +tbOcPO/+bc78x8ge7jPLFtYkeKQRJvD6IiCWHgq/yMFvzsLr8OzWOwhonK92BUeMz EozTjTV+VhtUT+YuXPl0QENSEkLKvgxrbjkqi5kU= Date: Wed, 26 Jun 2019 20:43:09 +0100 From: Jonathan Cameron To: Stefan Popa Cc: , , , , , , Subject: Re: [PATCH 2/4] iio: frequency: adf4371: Add support for ADF4372 PLL Message-ID: <20190626204309.723e2f97@archlinux> In-Reply-To: <1561389132-26182-1-git-send-email-stefan.popa@analog.com> References: <1561389132-26182-1-git-send-email-stefan.popa@analog.com> X-Mailer: Claws Mail 3.17.3 (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 Mon, 24 Jun 2019 18:12:12 +0300 Stefan Popa wrote: > The ADF4372 is part of the same family with ADF4371, the main difference > is that it has only 3 channels instead of 4, as the frequency quadrupler > is missing. As a result, the ADF4372 allows frequencies from 62.5 MHz to > 16 GHz to be generated. > > Datasheet: > Link: https://www.analog.com/media/en/technical-documentation/data-sheets/adf4372.pdf > > Signed-off-by: Stefan Popa Straight forward, so applied to the togreg branch of iio.git and pushed out as testing. I'll probably do the pull request tomorrow, so hopefully it will make the merge window. Thanks, Jonathan > --- > drivers/iio/frequency/Kconfig | 6 +++--- > drivers/iio/frequency/adf4371.c | 31 ++++++++++++++++++++++++++++--- > 2 files changed, 31 insertions(+), 6 deletions(-) > > diff --git a/drivers/iio/frequency/Kconfig b/drivers/iio/frequency/Kconfig > index e4a921f..353914b 100644 > --- a/drivers/iio/frequency/Kconfig > +++ b/drivers/iio/frequency/Kconfig > @@ -39,12 +39,12 @@ config ADF4350 > module will be called adf4350. > > config ADF4371 > - tristate "Analog Devices ADF4371 Wideband Synthesizer" > + tristate "Analog Devices ADF4371/ADF4372 Wideband Synthesizers" > depends on SPI > select REGMAP_SPI > help > - Say yes here to build support for Analog Devices ADF4371 > - Wideband Synthesizer. The driver provides direct access via sysfs. > + Say yes here to build support for Analog Devices ADF4371 and ADF4372 > + Wideband Synthesizers. The driver provides direct access via sysfs. > > To compile this driver as a module, choose M here: the > module will be called adf4371. > diff --git a/drivers/iio/frequency/adf4371.c b/drivers/iio/frequency/adf4371.c > index d8c414b..f874219 100644 > --- a/drivers/iio/frequency/adf4371.c > +++ b/drivers/iio/frequency/adf4371.c > @@ -87,6 +87,11 @@ enum { > ADF4371_CH_RF32 > }; > > +enum adf4371_variant { > + ADF4371, > + ADF4372 > +}; > + > struct adf4371_pwrdown { > unsigned int reg; > unsigned int bit; > @@ -140,6 +145,11 @@ static const struct regmap_config adf4371_regmap_config = { > .read_flag_mask = BIT(7), > }; > > +struct adf4371_chip_info { > + unsigned int num_channels; > + const struct iio_chan_spec *channels; > +}; > + > struct adf4371_state { > struct spi_device *spi; > struct regmap *regmap; > @@ -152,6 +162,7 @@ struct adf4371_state { > * writes. > */ > struct mutex lock; > + const struct adf4371_chip_info *chip_info; > unsigned long clkin_freq; > unsigned long fpfd; > unsigned int integer; > @@ -429,6 +440,17 @@ static const struct iio_chan_spec adf4371_chan[] = { > ADF4371_CHANNEL(ADF4371_CH_RF32), > }; > > +static const struct adf4371_chip_info adf4371_chip_info[] = { > + [ADF4371] = { > + .channels = adf4371_chan, > + .num_channels = 4, > + }, > + [ADF4372] = { > + .channels = adf4371_chan, > + .num_channels = 3, > + } > +}; > + > static int adf4371_reg_access(struct iio_dev *indio_dev, > unsigned int reg, > unsigned int writeval, > @@ -537,12 +559,13 @@ static int adf4371_probe(struct spi_device *spi) > st->regmap = regmap; > mutex_init(&st->lock); > > + st->chip_info = &adf4371_chip_info[id->driver_data]; > indio_dev->dev.parent = &spi->dev; > indio_dev->name = id->name; > indio_dev->info = &adf4371_info; > indio_dev->modes = INDIO_DIRECT_MODE; > - indio_dev->channels = adf4371_chan; > - indio_dev->num_channels = ARRAY_SIZE(adf4371_chan); > + indio_dev->channels = st->chip_info->channels; > + indio_dev->num_channels = st->chip_info->num_channels; > > st->clkin = devm_clk_get(&spi->dev, "clkin"); > if (IS_ERR(st->clkin)) > @@ -568,13 +591,15 @@ static int adf4371_probe(struct spi_device *spi) > } > > static const struct spi_device_id adf4371_id_table[] = { > - { "adf4371", 0 }, > + { "adf4371", ADF4371 }, > + { "adf4372", ADF4372 }, > {} > }; > MODULE_DEVICE_TABLE(spi, adf4371_id_table); > > static const struct of_device_id adf4371_of_match[] = { > { .compatible = "adi,adf4371" }, > + { .compatible = "adi,adf4372" }, > { }, > }; > MODULE_DEVICE_TABLE(of, adf4371_of_match);