All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: iio: ad9834: Moved contents of header file to source file
@ 2017-02-26 21:59 Narcisa Ana Maria Vasile
  2017-02-27  9:21 ` Lars-Peter Clausen
  2017-02-27 22:15 ` [PATCH v2] staging: iio: ad9834: Moved contents of the header to the " Narcisa Ana Maria Vasile
  0 siblings, 2 replies; 6+ messages in thread
From: Narcisa Ana Maria Vasile @ 2017-02-26 21:59 UTC (permalink / raw)
  To: lars, Michael.Hennerich, jic23, knaack.h, pmeerw, gregkh
  Cc: outreachy-kernel, linux-iio, Narcisa Ana Maria Vasile

The contents of the header file are used only by this single source file

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
---
 drivers/staging/iio/frequency/ad9834.c | 100 ++++++++++++++++++++++++++++-
 drivers/staging/iio/frequency/ad9834.h | 111 ---------------------------------
 2 files changed, 99 insertions(+), 112 deletions(-)
 delete mode 100644 drivers/staging/iio/frequency/ad9834.h

diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c
index 19216af..931feb2 100644
--- a/drivers/staging/iio/frequency/ad9834.c
+++ b/drivers/staging/iio/frequency/ad9834.c
@@ -23,7 +23,105 @@
 #include <linux/iio/sysfs.h>
 #include "dds.h"
 
-#include "ad9834.h"
+/* Registers */
+
+#define AD9834_REG_CMD		0
+#define AD9834_REG_FREQ0	BIT(14)
+#define AD9834_REG_FREQ1	BIT(15)
+#define AD9834_REG_PHASE0	(BIT(15) | BIT(14))
+#define AD9834_REG_PHASE1	(BIT(15) | BIT(14) | BIT(13))
+
+/* Command Control Bits */
+
+#define AD9834_B28		BIT(13)
+#define AD9834_HLB		BIT(12)
+#define AD9834_FSEL		BIT(11)
+#define AD9834_PSEL		BIT(10)
+#define AD9834_PIN_SW		BIT(9)
+#define AD9834_RESET		BIT(8)
+#define AD9834_SLEEP1		BIT(7)
+#define AD9834_SLEEP12		BIT(6)
+#define AD9834_OPBITEN		BIT(5)
+#define AD9834_SIGN_PIB		BIT(4)
+#define AD9834_DIV2		BIT(3)
+#define AD9834_MODE		BIT(1)
+
+#define AD9834_FREQ_BITS	28
+#define AD9834_PHASE_BITS	12
+
+#define RES_MASK(bits)	(BIT(bits) - 1)
+
+/**
+ * struct ad9834_state - driver instance specific data
+ * @spi:		spi_device
+ * @reg:		supply regulator
+ * @mclk:		external master clock
+ * @control:		cached control word
+ * @xfer:		default spi transfer
+ * @msg:		default spi message
+ * @freq_xfer:		tuning word spi transfer
+ * @freq_msg:		tuning word spi message
+ * @data:		spi transmit buffer
+ * @freq_data:		tuning word spi transmit buffer
+ */
+
+struct ad9834_state {
+	struct spi_device		*spi;
+	struct regulator		*reg;
+	unsigned int			mclk;
+	unsigned short			control;
+	unsigned short			devid;
+	struct spi_transfer		xfer;
+	struct spi_message		msg;
+	struct spi_transfer		freq_xfer[2];
+	struct spi_message		freq_msg;
+
+	/*
+	 * DMA (thus cache coherency maintenance) requires the
+	 * transfer buffers to live in their own cache lines.
+	 */
+	__be16				data ____cacheline_aligned;
+	__be16				freq_data[2];
+};
+
+/*
+ * TODO: struct ad7887_platform_data needs to go into include/linux/iio
+ */
+
+/**
+ * struct ad9834_platform_data - platform specific information
+ * @mclk:		master clock in Hz
+ * @freq0:		power up freq0 tuning word in Hz
+ * @freq1:		power up freq1 tuning word in Hz
+ * @phase0:		power up phase0 value [0..4095] correlates with 0..2PI
+ * @phase1:		power up phase1 value [0..4095] correlates with 0..2PI
+ * @en_div2:		digital output/2 is passed to the SIGN BIT OUT pin
+ * @en_signbit_msb_out:	the MSB (or MSB/2) of the DAC data is connected to the
+ *			SIGN BIT OUT pin. en_div2 controls whether it is the MSB
+ *			or MSB/2 that is output. if en_signbit_msb_out=false,
+ *			the on-board comparator is connected to SIGN BIT OUT
+ */
+
+struct ad9834_platform_data {
+	unsigned int		mclk;
+	unsigned int		freq0;
+	unsigned int		freq1;
+	unsigned short		phase0;
+	unsigned short		phase1;
+	bool			en_div2;
+	bool			en_signbit_msb_out;
+};
+
+/**
+ * ad9834_supported_device_ids:
+ */
+
+enum ad9834_supported_device_ids {
+	ID_AD9833,
+	ID_AD9834,
+	ID_AD9837,
+	ID_AD9838,
+};
 
 static unsigned int ad9834_calc_freqreg(unsigned long mclk, unsigned long fout)
 {
diff --git a/drivers/staging/iio/frequency/ad9834.h b/drivers/staging/iio/frequency/ad9834.h
deleted file mode 100644
index 40fdd5d..0000000
--- a/drivers/staging/iio/frequency/ad9834.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * AD9833/AD9834/AD9837/AD9838 SPI DDS driver
- *
- * Copyright 2010-2011 Analog Devices Inc.
- *
- * Licensed under the GPL-2.
- */
-#ifndef IIO_DDS_AD9834_H_
-#define IIO_DDS_AD9834_H_
-
-/* Registers */
-
-#define AD9834_REG_CMD		0
-#define AD9834_REG_FREQ0	BIT(14)
-#define AD9834_REG_FREQ1	BIT(15)
-#define AD9834_REG_PHASE0	(BIT(15) | BIT(14))
-#define AD9834_REG_PHASE1	(BIT(15) | BIT(14) | BIT(13))
-
-/* Command Control Bits */
-
-#define AD9834_B28		BIT(13)
-#define AD9834_HLB		BIT(12)
-#define AD9834_FSEL		BIT(11)
-#define AD9834_PSEL		BIT(10)
-#define AD9834_PIN_SW		BIT(9)
-#define AD9834_RESET		BIT(8)
-#define AD9834_SLEEP1		BIT(7)
-#define AD9834_SLEEP12		BIT(6)
-#define AD9834_OPBITEN		BIT(5)
-#define AD9834_SIGN_PIB		BIT(4)
-#define AD9834_DIV2		BIT(3)
-#define AD9834_MODE		BIT(1)
-
-#define AD9834_FREQ_BITS	28
-#define AD9834_PHASE_BITS	12
-
-#define RES_MASK(bits)	(BIT(bits) - 1)
-
-/**
- * struct ad9834_state - driver instance specific data
- * @spi:		spi_device
- * @reg:		supply regulator
- * @mclk:		external master clock
- * @control:		cached control word
- * @xfer:		default spi transfer
- * @msg:		default spi message
- * @freq_xfer:		tuning word spi transfer
- * @freq_msg:		tuning word spi message
- * @data:		spi transmit buffer
- * @freq_data:		tuning word spi transmit buffer
- */
-
-struct ad9834_state {
-	struct spi_device		*spi;
-	struct regulator		*reg;
-	unsigned int			mclk;
-	unsigned short			control;
-	unsigned short			devid;
-	struct spi_transfer		xfer;
-	struct spi_message		msg;
-	struct spi_transfer		freq_xfer[2];
-	struct spi_message		freq_msg;
-
-	/*
-	 * DMA (thus cache coherency maintenance) requires the
-	 * transfer buffers to live in their own cache lines.
-	 */
-	__be16				data ____cacheline_aligned;
-	__be16				freq_data[2];
-};
-
-/*
- * TODO: struct ad7887_platform_data needs to go into include/linux/iio
- */
-
-/**
- * struct ad9834_platform_data - platform specific information
- * @mclk:		master clock in Hz
- * @freq0:		power up freq0 tuning word in Hz
- * @freq1:		power up freq1 tuning word in Hz
- * @phase0:		power up phase0 value [0..4095] correlates with 0..2PI
- * @phase1:		power up phase1 value [0..4095] correlates with 0..2PI
- * @en_div2:		digital output/2 is passed to the SIGN BIT OUT pin
- * @en_signbit_msb_out:	the MSB (or MSB/2) of the DAC data is connected to the
- *			SIGN BIT OUT pin. en_div2 controls whether it is the MSB
- *			or MSB/2 that is output. if en_signbit_msb_out=false,
- *			the on-board comparator is connected to SIGN BIT OUT
- */
-
-struct ad9834_platform_data {
-	unsigned int		mclk;
-	unsigned int		freq0;
-	unsigned int		freq1;
-	unsigned short		phase0;
-	unsigned short		phase1;
-	bool			en_div2;
-	bool			en_signbit_msb_out;
-};
-
-/**
- * ad9834_supported_device_ids:
- */
-
-enum ad9834_supported_device_ids {
-	ID_AD9833,
-	ID_AD9834,
-	ID_AD9837,
-	ID_AD9838,
-};
-
-#endif /* IIO_DDS_AD9834_H_ */
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: iio: ad9834: Moved contents of header file to source file
  2017-02-26 21:59 [PATCH] staging: iio: ad9834: Moved contents of header file to source file Narcisa Ana Maria Vasile
@ 2017-02-27  9:21 ` Lars-Peter Clausen
  2017-02-27 13:41   ` Narcisa Vasile
  2017-02-27 22:15 ` [PATCH v2] staging: iio: ad9834: Moved contents of the header to the " Narcisa Ana Maria Vasile
  1 sibling, 1 reply; 6+ messages in thread
From: Lars-Peter Clausen @ 2017-02-27  9:21 UTC (permalink / raw)
  To: Narcisa Ana Maria Vasile, Michael.Hennerich, jic23, knaack.h,
	pmeerw, gregkh
  Cc: outreachy-kernel, linux-iio

On 02/26/2017 10:59 PM, Narcisa Ana Maria Vasile wrote:
> The contents of the header file are used only by this single source file

Same here, platform data should stay in its the header file, everything else
can and should be moved.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: iio: ad9834: Moved contents of header file to source file
  2017-02-27  9:21 ` Lars-Peter Clausen
@ 2017-02-27 13:41   ` Narcisa Vasile
  2017-02-27 13:46     ` Lars-Peter Clausen
  0 siblings, 1 reply; 6+ messages in thread
From: Narcisa Vasile @ 2017-02-27 13:41 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: knaack.h, pmeerw, outreachy-kernel, gregkh, Michael.Hennerich,
	linux-iio, jic23

[-- Attachment #1: Type: text/plain, Size: 854 bytes --]

Pe 27 feb. 2017 11:21, "Lars-Peter Clausen" <lars@metafoo.de> a scris:
>
> On 02/26/2017 10:59 PM, Narcisa Ana Maria Vasile wrote:
> > The contents of the header file are used only by this single source file
>
> Same here, platform data should stay in its the header file, everything
else
> can and should be moved.
>
>
I'm attempting to fix this patch and I want to make sure I understood the
right way to do it.
According to the TODO above the platform data struct, this struct should go
to include/linux/iio. So, is it ok to create a new header file with the
original name (ad9834.h), place the platform data struct inside it and put
this header file into include/linux/iio/frequency folder?
Then, in the C file, I will include this new header, remove the platform
data struct, but keep the defines and state struct.
Same for the other file (ad9832).

[-- Attachment #2: Type: text/html, Size: 1044 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: iio: ad9834: Moved contents of header file to source file
  2017-02-27 13:41   ` Narcisa Vasile
@ 2017-02-27 13:46     ` Lars-Peter Clausen
  0 siblings, 0 replies; 6+ messages in thread
From: Lars-Peter Clausen @ 2017-02-27 13:46 UTC (permalink / raw)
  To: Narcisa Vasile
  Cc: knaack.h, pmeerw, outreachy-kernel, gregkh, Michael.Hennerich,
	linux-iio, jic23

On 02/27/2017 02:41 PM, Narcisa Vasile wrote:
> Pe 27 feb. 2017 11:21, "Lars-Peter Clausen" <lars@metafoo.de
> <mailto:lars@metafoo.de>> a scris:
>>
>> On 02/26/2017 10:59 PM, Narcisa Ana Maria Vasile wrote:
>> > The contents of the header file are used only by this single source file
>>
>> Same here, platform data should stay in its the header file, everything else
>> can and should be moved.
>>
>>
> I'm attempting to fix this patch and I want to make sure I understood the
> right way to do it.
> According to the TODO above the platform data struct, this struct should go
> to include/linux/iio. So, is it ok to create a new header file with the
> original name (ad9834.h), place the platform data struct inside it and put
> this header file into include/linux/iio/frequency folder? 
> Then, in the C file, I will include this new header, remove the platform
> data struct, but keep the defines and state struct.
> Same for the other file (ad9832).

Moving this file to the regular include file path will only happen when the
driver as a whole graduates from the staging part of the kernel. For the
time being the file should stay were it is.

So basically the patch is file as it is, except that the platform data
struct should not be moved over to the C file.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] staging: iio: ad9834: Moved contents of the header to the source file
  2017-02-26 21:59 [PATCH] staging: iio: ad9834: Moved contents of header file to source file Narcisa Ana Maria Vasile
  2017-02-27  9:21 ` Lars-Peter Clausen
@ 2017-02-27 22:15 ` Narcisa Ana Maria Vasile
  2017-03-02 19:45   ` Jonathan Cameron
  1 sibling, 1 reply; 6+ messages in thread
From: Narcisa Ana Maria Vasile @ 2017-02-27 22:15 UTC (permalink / raw)
  To: lars, Michael.Hennerich, jic23, knaack.h, pmeerw, gregkh
  Cc: outreachy-kernel, linux-iio, Narcisa Ana Maria Vasile

Moved the contents of the header(ad9834.h) into the corresponding source
file with the exception of the platform data struct which is supposed to be
used from somewhere else other than the driver.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
---
Changes to v2:
    -Removed the platform data structure from the source file
    and inserted it back into the header file(ad9834.h).
---
 drivers/staging/iio/frequency/ad9834.c | 72 ++++++++++++++++++++++++++++++++++
 drivers/staging/iio/frequency/ad9834.h | 72 ----------------------------------
 2 files changed, 72 insertions(+), 72 deletions(-)

diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c
index 19216af..f92ff7f 100644
--- a/drivers/staging/iio/frequency/ad9834.c
+++ b/drivers/staging/iio/frequency/ad9834.c
@@ -25,6 +25,78 @@
 
 #include "ad9834.h"
 
+/* Registers */
+
+#define AD9834_REG_CMD		0
+#define AD9834_REG_FREQ0	BIT(14)
+#define AD9834_REG_FREQ1	BIT(15)
+#define AD9834_REG_PHASE0	(BIT(15) | BIT(14))
+#define AD9834_REG_PHASE1	(BIT(15) | BIT(14) | BIT(13))
+
+/* Command Control Bits */
+
+#define AD9834_B28		BIT(13)
+#define AD9834_HLB		BIT(12)
+#define AD9834_FSEL		BIT(11)
+#define AD9834_PSEL		BIT(10)
+#define AD9834_PIN_SW		BIT(9)
+#define AD9834_RESET		BIT(8)
+#define AD9834_SLEEP1		BIT(7)
+#define AD9834_SLEEP12		BIT(6)
+#define AD9834_OPBITEN		BIT(5)
+#define AD9834_SIGN_PIB		BIT(4)
+#define AD9834_DIV2		BIT(3)
+#define AD9834_MODE		BIT(1)
+
+#define AD9834_FREQ_BITS	28
+#define AD9834_PHASE_BITS	12
+
+#define RES_MASK(bits)	(BIT(bits) - 1)
+
+/**
+ * struct ad9834_state - driver instance specific data
+ * @spi:		spi_device
+ * @reg:		supply regulator
+ * @mclk:		external master clock
+ * @control:		cached control word
+ * @xfer:		default spi transfer
+ * @msg:		default spi message
+ * @freq_xfer:		tuning word spi transfer
+ * @freq_msg:		tuning word spi message
+ * @data:		spi transmit buffer
+ * @freq_data:		tuning word spi transmit buffer
+ */
+
+struct ad9834_state {
+	struct spi_device		*spi;
+	struct regulator		*reg;
+	unsigned int			mclk;
+	unsigned short			control;
+	unsigned short			devid;
+	struct spi_transfer		xfer;
+	struct spi_message		msg;
+	struct spi_transfer		freq_xfer[2];
+	struct spi_message		freq_msg;
+
+	/*
+	 * DMA (thus cache coherency maintenance) requires the
+	 * transfer buffers to live in their own cache lines.
+	 */
+	__be16				data ____cacheline_aligned;
+	__be16				freq_data[2];
+};
+
+/**
+ * ad9834_supported_device_ids:
+ */
+
+enum ad9834_supported_device_ids {
+	ID_AD9833,
+	ID_AD9834,
+	ID_AD9837,
+	ID_AD9838,
+};
+
 static unsigned int ad9834_calc_freqreg(unsigned long mclk, unsigned long fout)
 {
 	unsigned long long freqreg = (u64)fout * (u64)BIT(AD9834_FREQ_BITS);
diff --git a/drivers/staging/iio/frequency/ad9834.h b/drivers/staging/iio/frequency/ad9834.h
index 40fdd5d..ae620f3 100644
--- a/drivers/staging/iio/frequency/ad9834.h
+++ b/drivers/staging/iio/frequency/ad9834.h
@@ -8,67 +8,6 @@
 #ifndef IIO_DDS_AD9834_H_
 #define IIO_DDS_AD9834_H_
 
-/* Registers */
-
-#define AD9834_REG_CMD		0
-#define AD9834_REG_FREQ0	BIT(14)
-#define AD9834_REG_FREQ1	BIT(15)
-#define AD9834_REG_PHASE0	(BIT(15) | BIT(14))
-#define AD9834_REG_PHASE1	(BIT(15) | BIT(14) | BIT(13))
-
-/* Command Control Bits */
-
-#define AD9834_B28		BIT(13)
-#define AD9834_HLB		BIT(12)
-#define AD9834_FSEL		BIT(11)
-#define AD9834_PSEL		BIT(10)
-#define AD9834_PIN_SW		BIT(9)
-#define AD9834_RESET		BIT(8)
-#define AD9834_SLEEP1		BIT(7)
-#define AD9834_SLEEP12		BIT(6)
-#define AD9834_OPBITEN		BIT(5)
-#define AD9834_SIGN_PIB		BIT(4)
-#define AD9834_DIV2		BIT(3)
-#define AD9834_MODE		BIT(1)
-
-#define AD9834_FREQ_BITS	28
-#define AD9834_PHASE_BITS	12
-
-#define RES_MASK(bits)	(BIT(bits) - 1)
-
-/**
- * struct ad9834_state - driver instance specific data
- * @spi:		spi_device
- * @reg:		supply regulator
- * @mclk:		external master clock
- * @control:		cached control word
- * @xfer:		default spi transfer
- * @msg:		default spi message
- * @freq_xfer:		tuning word spi transfer
- * @freq_msg:		tuning word spi message
- * @data:		spi transmit buffer
- * @freq_data:		tuning word spi transmit buffer
- */
-
-struct ad9834_state {
-	struct spi_device		*spi;
-	struct regulator		*reg;
-	unsigned int			mclk;
-	unsigned short			control;
-	unsigned short			devid;
-	struct spi_transfer		xfer;
-	struct spi_message		msg;
-	struct spi_transfer		freq_xfer[2];
-	struct spi_message		freq_msg;
-
-	/*
-	 * DMA (thus cache coherency maintenance) requires the
-	 * transfer buffers to live in their own cache lines.
-	 */
-	__be16				data ____cacheline_aligned;
-	__be16				freq_data[2];
-};
-
 /*
  * TODO: struct ad7887_platform_data needs to go into include/linux/iio
  */
@@ -97,15 +36,4 @@ struct ad9834_platform_data {
 	bool			en_signbit_msb_out;
 };
 
-/**
- * ad9834_supported_device_ids:
- */
-
-enum ad9834_supported_device_ids {
-	ID_AD9833,
-	ID_AD9834,
-	ID_AD9837,
-	ID_AD9838,
-};
-
 #endif /* IIO_DDS_AD9834_H_ */
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] staging: iio: ad9834: Moved contents of the header to the source file
  2017-02-27 22:15 ` [PATCH v2] staging: iio: ad9834: Moved contents of the header to the " Narcisa Ana Maria Vasile
@ 2017-03-02 19:45   ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2017-03-02 19:45 UTC (permalink / raw)
  To: Narcisa Ana Maria Vasile, lars, Michael.Hennerich, knaack.h,
	pmeerw, gregkh
  Cc: outreachy-kernel, linux-iio

On 27/02/17 22:15, Narcisa Ana Maria Vasile wrote:
> Moved the contents of the header(ad9834.h) into the corresponding source
> file with the exception of the platform data struct which is supposed to be
> used from somewhere else other than the driver.
> 
> Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Looks good. Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

A few passing comments inline, perhaps relevant to further tidy up...

Thanks,

Jonathan
> ---
> Changes to v2:
>     -Removed the platform data structure from the source file
>     and inserted it back into the header file(ad9834.h).
> ---
>  drivers/staging/iio/frequency/ad9834.c | 72 ++++++++++++++++++++++++++++++++++
>  drivers/staging/iio/frequency/ad9834.h | 72 ----------------------------------
>  2 files changed, 72 insertions(+), 72 deletions(-)
> 
> diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c
> index 19216af..f92ff7f 100644
> --- a/drivers/staging/iio/frequency/ad9834.c
> +++ b/drivers/staging/iio/frequency/ad9834.c
> @@ -25,6 +25,78 @@
>  
>  #include "ad9834.h"
>  
> +/* Registers */
> +
> +#define AD9834_REG_CMD		0
> +#define AD9834_REG_FREQ0	BIT(14)
> +#define AD9834_REG_FREQ1	BIT(15)
> +#define AD9834_REG_PHASE0	(BIT(15) | BIT(14))
> +#define AD9834_REG_PHASE1	(BIT(15) | BIT(14) | BIT(13))
Quirky way of defining it but does line up with the datasheet description.
+ if we were going to make this more 'normal' we'd do it in a separate
patch anyway...
> +
> +/* Command Control Bits */
> +
> +#define AD9834_B28		BIT(13)
> +#define AD9834_HLB		BIT(12)
> +#define AD9834_FSEL		BIT(11)
> +#define AD9834_PSEL		BIT(10)
> +#define AD9834_PIN_SW		BIT(9)
> +#define AD9834_RESET		BIT(8)
> +#define AD9834_SLEEP1		BIT(7)
> +#define AD9834_SLEEP12		BIT(6)
> +#define AD9834_OPBITEN		BIT(5)
> +#define AD9834_SIGN_PIB		BIT(4)
> +#define AD9834_DIV2		BIT(3)
> +#define AD9834_MODE		BIT(1)
> +
> +#define AD9834_FREQ_BITS	28
> +#define AD9834_PHASE_BITS	12
> +
> +#define RES_MASK(bits)	(BIT(bits) - 1)
> +
> +/**
> + * struct ad9834_state - driver instance specific data
> + * @spi:		spi_device
> + * @reg:		supply regulator
> + * @mclk:		external master clock
> + * @control:		cached control word
> + * @xfer:		default spi transfer
> + * @msg:		default spi message
> + * @freq_xfer:		tuning word spi transfer
> + * @freq_msg:		tuning word spi message
> + * @data:		spi transmit buffer
> + * @freq_data:		tuning word spi transmit buffer
> + */
> +
> +struct ad9834_state {
> +	struct spi_device		*spi;
> +	struct regulator		*reg;
> +	unsigned int			mclk;
> +	unsigned short			control;
> +	unsigned short			devid;
> +	struct spi_transfer		xfer;
> +	struct spi_message		msg;
> +	struct spi_transfer		freq_xfer[2];
> +	struct spi_message		freq_msg;
> +
> +	/*
> +	 * DMA (thus cache coherency maintenance) requires the
> +	 * transfer buffers to live in their own cache lines.
> +	 */
> +	__be16				data ____cacheline_aligned;
> +	__be16				freq_data[2];
> +};
> +
> +/**
> + * ad9834_supported_device_ids:
> + */
As pointless comments go this one is impressive ;)
> +
> +enum ad9834_supported_device_ids {
> +	ID_AD9833,
> +	ID_AD9834,
> +	ID_AD9837,
> +	ID_AD9838,
> +};
> +
>  static unsigned int ad9834_calc_freqreg(unsigned long mclk, unsigned long fout)
>  {
>  	unsigned long long freqreg = (u64)fout * (u64)BIT(AD9834_FREQ_BITS);
> diff --git a/drivers/staging/iio/frequency/ad9834.h b/drivers/staging/iio/frequency/ad9834.h
> index 40fdd5d..ae620f3 100644
> --- a/drivers/staging/iio/frequency/ad9834.h
> +++ b/drivers/staging/iio/frequency/ad9834.h
> @@ -8,67 +8,6 @@
>  #ifndef IIO_DDS_AD9834_H_
>  #define IIO_DDS_AD9834_H_
>  
> -/* Registers */
> -
> -#define AD9834_REG_CMD		0
> -#define AD9834_REG_FREQ0	BIT(14)
> -#define AD9834_REG_FREQ1	BIT(15)
> -#define AD9834_REG_PHASE0	(BIT(15) | BIT(14))
> -#define AD9834_REG_PHASE1	(BIT(15) | BIT(14) | BIT(13))
> -
> -/* Command Control Bits */
> -
> -#define AD9834_B28		BIT(13)
> -#define AD9834_HLB		BIT(12)
> -#define AD9834_FSEL		BIT(11)
> -#define AD9834_PSEL		BIT(10)
> -#define AD9834_PIN_SW		BIT(9)
> -#define AD9834_RESET		BIT(8)
> -#define AD9834_SLEEP1		BIT(7)
> -#define AD9834_SLEEP12		BIT(6)
> -#define AD9834_OPBITEN		BIT(5)
> -#define AD9834_SIGN_PIB		BIT(4)
> -#define AD9834_DIV2		BIT(3)
> -#define AD9834_MODE		BIT(1)
> -
> -#define AD9834_FREQ_BITS	28
> -#define AD9834_PHASE_BITS	12
> -
> -#define RES_MASK(bits)	(BIT(bits) - 1)
> -
> -/**
> - * struct ad9834_state - driver instance specific data
> - * @spi:		spi_device
> - * @reg:		supply regulator
> - * @mclk:		external master clock
> - * @control:		cached control word
> - * @xfer:		default spi transfer
> - * @msg:		default spi message
> - * @freq_xfer:		tuning word spi transfer
> - * @freq_msg:		tuning word spi message
> - * @data:		spi transmit buffer
> - * @freq_data:		tuning word spi transmit buffer
> - */
> -
> -struct ad9834_state {
> -	struct spi_device		*spi;
> -	struct regulator		*reg;
> -	unsigned int			mclk;
> -	unsigned short			control;
> -	unsigned short			devid;
> -	struct spi_transfer		xfer;
> -	struct spi_message		msg;
> -	struct spi_transfer		freq_xfer[2];
> -	struct spi_message		freq_msg;
> -
> -	/*
> -	 * DMA (thus cache coherency maintenance) requires the
> -	 * transfer buffers to live in their own cache lines.
> -	 */
> -	__be16				data ____cacheline_aligned;
> -	__be16				freq_data[2];
> -};
> -
>  /*
>   * TODO: struct ad7887_platform_data needs to go into include/linux/iio
>   */
> @@ -97,15 +36,4 @@ struct ad9834_platform_data {
>  	bool			en_signbit_msb_out;
>  };
>  
> -/**
> - * ad9834_supported_device_ids:
> - */
> -
> -enum ad9834_supported_device_ids {
> -	ID_AD9833,
> -	ID_AD9834,
> -	ID_AD9837,
> -	ID_AD9838,
> -};
> -
>  #endif /* IIO_DDS_AD9834_H_ */
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-03-02 19:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-26 21:59 [PATCH] staging: iio: ad9834: Moved contents of header file to source file Narcisa Ana Maria Vasile
2017-02-27  9:21 ` Lars-Peter Clausen
2017-02-27 13:41   ` Narcisa Vasile
2017-02-27 13:46     ` Lars-Peter Clausen
2017-02-27 22:15 ` [PATCH v2] staging: iio: ad9834: Moved contents of the header to the " Narcisa Ana Maria Vasile
2017-03-02 19:45   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.