Skip to contentSkip to conversation

iio: frequency: New driver for AD9523 SPI Low Jitter Clock Generator

PATCH In review [email protected] 2 participants 2 messages May 29, 2012

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH v3 1/1 iio: frequency: New driver for AD9523 SPI Low Jitter Clock Generator

From: Michael Hennerich <[email protected]>

Changes since V1:

Apply Jonathan's review feedback:
Revise device status attribute names, and split documentation into two sections. Add additional comments, and fix indention issues.
Remove pointless zero initializations.
Revise return value handling.
Simplify some code sections.
Split store_eeprom and sync handling into separate functions.
Use strtobool where applicable.
Document platform data structures using kernel-doc style.

Use dev_to_iio_dev
write_raw IIO_CHAN_INFO_FREQUENCY: Reject values <= 0 Make patch target drivers/iio

Changes since V2:

Use for_each_clear_bit() and __set_bit() where applicable. Add descriptive comment.
Avoid temporary for struct regulator. spi_device_id name use ad9523-1, ad9523 will be added later.

---
 .../ABI/testing/sysfs-bus-iio-frequency-ad9523     |   37 +
 drivers/iio/Kconfig                                |    1 +
 drivers/iio/Makefile                               |    1 +
 drivers/iio/frequency/Kconfig                      |   23 +
 drivers/iio/frequency/Makefile                     |    5 +
 drivers/iio/frequency/ad9523.c                     | 1057 ++++++++++++++++++++
 include/linux/iio/frequency/ad9523.h               |  195 ++++
 7 files changed, 1319 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-frequency-ad9523
 create mode 100644 drivers/iio/frequency/Kconfig
 create mode 100644 drivers/iio/frequency/Makefile
 create mode 100644 drivers/iio/frequency/ad9523.c
 create mode 100644 include/linux/iio/frequency/ad9523.h
Documentation/ABI/testing/sysfs-bus-iio-frequency-ad9523 new file +37 -0
new file mode 100644
index 0000000..2ce9c3f
@@ -0,0 +1,37 @@
+What:		/sys/bus/iio/devices/iio:deviceX/pll2_feedback_clk_present
+What:		/sys/bus/iio/devices/iio:deviceX/pll2_reference_clk_present
+What:		/sys/bus/iio/devices/iio:deviceX/pll1_reference_clk_a_present
+What:		/sys/bus/iio/devices/iio:deviceX/pll1_reference_clk_b_present
+What:		/sys/bus/iio/devices/iio:deviceX/pll1_reference_clk_test_present
+What:		/sys/bus/iio/devices/iio:deviceX/vcxo_clk_present
+KernelVersion:	3.4.0
+Contact:	[email protected]
+Description:
+		Reading returns either '1' or '0'.
+		'1' means that the clock in question is present.
+		'0' means that the clock is missing.
+
+What:		/sys/bus/iio/devices/iio:deviceX/pllY_locked
+KernelVersion:	3.4.0
+Contact:	[email protected]
+Description:
+		Reading returns either '1' or '0'. '1' means that the
+		pllY is locked.
+
+What:		/sys/bus/iio/devices/iio:deviceX/store_eeprom
+KernelVersion:	3.4.0
+Contact:	[email protected]
+Description:
+		Writing '1' stores the current device configuration into
+		on-chip EEPROM. After power-up or chip reset the device will
+		automatically load the saved configuration.
+
+What:		/sys/bus/iio/devices/iio:deviceX/sync_dividers
+KernelVersion:	3.4.0
+Contact:	[email protected]
+Description:
+		Writing '1' triggers the clock distribution synchronization
+		functionality. All dividers are reset and the channels start
+		with their predefined phase offsets (out_altvoltageY_phase).
+		Writing this file has the effect as driving the external
+		/SYNC pin low.
drivers/iio/Kconfig +1 -0
index 56eecef..ad09f67 100644
@@ -50,5 +50,6 @@ config IIO_CONSUMERS_PER_TRIGGER
 
 source "drivers/iio/adc/Kconfig"
 source "drivers/iio/amplifiers/Kconfig"
+source "drivers/iio/frequency/Kconfig"
 
 endif # IIO
drivers/iio/Makefile +1 -0
index e425afd..014e0e4 100644
@@ -11,3 +11,4 @@ obj-$(CONFIG_IIO_KFIFO_BUF) += kfifo_buf.o
 
 obj-y += adc/
 obj-y += amplifiers/
+obj-y += frequency/
drivers/iio/frequency/Kconfig new file +23 -0
new file mode 100644
index 0000000..0458c92
@@ -0,0 +1,23 @@
+#
+# Frequency
+#	Direct Digital Synthesis drivers (DDS)
+#	Clock Distribution device drivers
+#	Phase-Locked Loop (PLL) frequency synthesizers
+#
+
+menu "Frequency Synthesizers DDS/PLL"
+
+menu "Clock Generator/Distribution"
+
+config AD9523
+	tristate "Analog Devices AD9523 Low Jitter Clock Generator"
+	depends on SPI
+	help
+	  Say yes here to build support for Analog Devices AD9523 Low Jitter
+	  Clock Generator. The driver provides direct access via sysfs.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called ad9523.
+
+endmenu
+endmenu
drivers/iio/frequency/Makefile new file +5 -0
new file mode 100644
index 0000000..1b5b224
@@ -0,0 +1,5 @@
+#
+# Makefile iio/frequency
+#
+
+obj-$(CONFIG_AD9523) += ad9523.o
drivers/iio/frequency/ad9523.c new file +1057 -0

1,057 lines not on this page · raw message

include/linux/iio/frequency/ad9523.h new file +195 -0

195 lines not on this page · raw message

--
1.7.0.4

Acked-by on v3 1/1
#1 lore raw
Quoted 18 lines · On 5/29/2012 10:53 AM, [email protected] wrote:

From: Michael Hennerich<[email protected]>

Changes since V1:

Apply Jonathan's review feedback:
Revise device status attribute names, and split documentation into two sections. Add additional comments, and fix indention issues.
Remove pointless zero initializations.
Revise return value handling.
Simplify some code sections.
Split store_eeprom and sync handling into separate functions.
Use strtobool where applicable.
Document platform data structures using kernel-doc style.

Use dev_to_iio_dev
write_raw IIO_CHAN_INFO_FREQUENCY: Reject values<= 0 Make patch target drivers/iio

Quoted 8 lines

Changes since V2:

Use for_each_clear_bit() and __set_bit() where applicable. Add descriptive comment.
Avoid temporary for struct regulator. spi_device_id name use ad9523-1, ad9523 will be added later.

Quoted 15 lines
---
  .../ABI/testing/sysfs-bus-iio-frequency-ad9523     |   37 +
  drivers/iio/Kconfig                                |    1 +
  drivers/iio/Makefile                               |    1 +
  drivers/iio/frequency/Kconfig                      |   23 +
  drivers/iio/frequency/Makefile                     |    5 +
  drivers/iio/frequency/ad9523.c                     | 1057 ++++++++++++++++++++
  include/linux/iio/frequency/ad9523.h               |  195 ++++
  7 files changed, 1319 insertions(+), 0 deletions(-)

create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-frequency-ad9523 create mode 100644 drivers/iio/frequency/Kconfig
create mode 100644 drivers/iio/frequency/Makefile
create mode 100644 drivers/iio/frequency/ad9523.c
create mode 100644 include/linux/iio/frequency/ad9523.h