Commit 12b9d5bf authored by Michael Hennerich's avatar Michael Hennerich Committed by Greg Kroah-Hartman

Staging: IIO: DDS: AD9833 / AD9834 driver

Changes since RFC/v1:
IIO: Apply list review feedback

Apply list review feedback:
	Rename attributes to fit IIO convention used in other drivers.
	Fix typos.
	Provide ddsX_out_enable as opposed to ddsX_out_disable.
	Use proper __devexit marking.
	Use strict_strtoul() to avoid negatives.

Changes since v2:
IIO: ad9834.c: Apply more list review feedback

	Update use of dds convenience macros.
	Fix tabbing.
	Remove superfluous brackets.
	Keep output disabled after probe.
	Remove unnecessary code.
Signed-off-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Reviewed-by: default avatarDatta Shubhrajyoti <shubhrajyoti@ti.com>
Acked-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 4851d97d
......@@ -17,6 +17,16 @@ config AD9832
Say yes here to build support for Analog Devices DDS chip
ad9832 and ad9835, provides direct access via sysfs.
config AD9834
tristate "Analog Devices ad9833/4/ driver"
depends on SPI
help
Say yes here to build support for Analog Devices DDS chip
AD9833 and AD9834, provides direct access via sysfs.
To compile this driver as a module, choose M here: the
module will be called ad9834.
config AD9850
tristate "Analog Devices ad9850/1 driver"
depends on SPI
......
......@@ -4,6 +4,7 @@
obj-$(CONFIG_AD5930) += ad5930.o
obj-$(CONFIG_AD9832) += ad9832.o
obj-$(CONFIG_AD9834) += ad9834.o
obj-$(CONFIG_AD9850) += ad9850.o
obj-$(CONFIG_AD9852) += ad9852.o
obj-$(CONFIG_AD9910) += ad9910.o
......
This diff is collapsed.
/*
* AD9834 SPI DDS driver
*
* Copyright 2010 Analog Devices Inc.
*
* Licensed under the GPL-2 or later.
*/
#ifndef IIO_DDS_AD9834_H_
#define IIO_DDS_AD9834_H_
/* Registers */
#define AD9834_REG_CMD (0 << 14)
#define AD9834_REG_FREQ0 (1 << 14)
#define AD9834_REG_FREQ1 (2 << 14)
#define AD9834_REG_PHASE0 (6 << 13)
#define AD9834_REG_PHASE1 (7 << 13)
/* Command Control Bits */
#define AD9834_B28 (1 << 13)
#define AD9834_HLB (1 << 12)
#define AD9834_FSEL (1 << 11)
#define AD9834_PSEL (1 << 10)
#define AD9834_PIN_SW (1 << 9)
#define AD9834_RESET (1 << 8)
#define AD9834_SLEEP1 (1 << 7)
#define AD9834_SLEEP12 (1 << 6)
#define AD9834_OPBITEN (1 << 5)
#define AD9834_SIGN_PIB (1 << 4)
#define AD9834_DIV2 (1 << 3)
#define AD9834_MODE (1 << 1)
#define AD9834_FREQ_BITS 28
#define AD9834_PHASE_BITS 12
#define RES_MASK(bits) ((1 << (bits)) - 1)
/**
* struct ad9834_state - driver instance specific data
* @indio_dev: the industrial I/O device
* @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 iio_dev *indio_dev;
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.
*/
unsigned short data ____cacheline_aligned;
unsigned short 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,
};
#endif /* IIO_DDS_AD9834_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment