All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/4] iio: ad5755: add support for dt bindings
@ 2016-02-16 14:25 ` Sean Nyekjaer
  0 siblings, 0 replies; 12+ messages in thread
From: Sean Nyekjaer @ 2016-02-16 14:25 UTC (permalink / raw)
  To: linux-iio; +Cc: Sean Nyekjaer, devicetree

Still missing a way to provide default modes and settings
for the driver from dt, but I see this as a start.

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
---
 drivers/iio/dac/ad5755.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
index bfb350a..e1b6e78 100644
--- a/drivers/iio/dac/ad5755.c
+++ b/drivers/iio/dac/ad5755.c
@@ -607,6 +607,16 @@ static const struct spi_device_id ad5755_id[] = {
 };
 MODULE_DEVICE_TABLE(spi, ad5755_id);
 
+static const struct of_device_id ad5755_of_match[] = {
+	{ .compatible = "adi,ad5755" },
+	{ .compatible = "adi,ad5755-1" },
+	{ .compatible = "adi,ad5757" },
+	{ .compatible = "adi,ad5735" },
+	{ .compatible = "adi,ad5737" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, ad5755_of_match);
+
 static struct spi_driver ad5755_driver = {
 	.driver = {
 		.name = "ad5755",
-- 
2.7.1


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

* [PATCH v3 1/4] iio: ad5755: add support for dt bindings
@ 2016-02-16 14:25 ` Sean Nyekjaer
  0 siblings, 0 replies; 12+ messages in thread
From: Sean Nyekjaer @ 2016-02-16 14:25 UTC (permalink / raw)
  To: linux-iio-u79uwXL29TY76Z2rM5mHXA
  Cc: Sean Nyekjaer, devicetree-u79uwXL29TY76Z2rM5mHXA

Still missing a way to provide default modes and settings
for the driver from dt, but I see this as a start.

Signed-off-by: Sean Nyekjaer <sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
---
 drivers/iio/dac/ad5755.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
index bfb350a..e1b6e78 100644
--- a/drivers/iio/dac/ad5755.c
+++ b/drivers/iio/dac/ad5755.c
@@ -607,6 +607,16 @@ static const struct spi_device_id ad5755_id[] = {
 };
 MODULE_DEVICE_TABLE(spi, ad5755_id);
 
+static const struct of_device_id ad5755_of_match[] = {
+	{ .compatible = "adi,ad5755" },
+	{ .compatible = "adi,ad5755-1" },
+	{ .compatible = "adi,ad5757" },
+	{ .compatible = "adi,ad5735" },
+	{ .compatible = "adi,ad5737" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, ad5755_of_match);
+
 static struct spi_driver ad5755_driver = {
 	.driver = {
 		.name = "ad5755",
-- 
2.7.1

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

* [PATCH v3 2/4] iio: ad5755: Add DT binding documentation
@ 2016-02-16 14:25   ` Sean Nyekjaer
  0 siblings, 0 replies; 12+ messages in thread
From: Sean Nyekjaer @ 2016-02-16 14:25 UTC (permalink / raw)
  To: linux-iio; +Cc: Sean Nyekjaer, devicetree

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Acked-by: Rob Herring <robh@kernel.org>
---
 .../devicetree/bindings/iio/dac/ad5755.txt         | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/dac/ad5755.txt

diff --git a/Documentation/devicetree/bindings/iio/dac/ad5755.txt b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
new file mode 100644
index 0000000..4c91583
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
@@ -0,0 +1,24 @@
+* Analog Device AD5755 IIO Multi-Channel DAC Linux Driver
+
+Required properties:
+ - compatible: Has to contain one of the following:
+	adi,ad5755
+	adi,ad5755-1
+	adi,ad5757
+	adi,ad5735
+	adi,ad5737
+
+ - reg: spi chip select number for the device
+ - spi-cpha or spi-cpol: is the only modes that is supported
+
+Recommended properties:
+ - spi-max-frequency: Definition as per
+		Documentation/devicetree/bindings/spi/spi-bus.txt
+
+Example:
+dac@0 {
+	compatible = "adi,ad5755";
+	reg = <0>;
+	spi-max-frequency = <1000000>;
+	spi-cpha;
+};
-- 
2.7.1


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

* [PATCH v3 2/4] iio: ad5755: Add DT binding documentation
@ 2016-02-16 14:25   ` Sean Nyekjaer
  0 siblings, 0 replies; 12+ messages in thread
From: Sean Nyekjaer @ 2016-02-16 14:25 UTC (permalink / raw)
  To: linux-iio-u79uwXL29TY76Z2rM5mHXA
  Cc: Sean Nyekjaer, devicetree-u79uwXL29TY76Z2rM5mHXA

Signed-off-by: Sean Nyekjaer <sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 .../devicetree/bindings/iio/dac/ad5755.txt         | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/dac/ad5755.txt

diff --git a/Documentation/devicetree/bindings/iio/dac/ad5755.txt b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
new file mode 100644
index 0000000..4c91583
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
@@ -0,0 +1,24 @@
+* Analog Device AD5755 IIO Multi-Channel DAC Linux Driver
+
+Required properties:
+ - compatible: Has to contain one of the following:
+	adi,ad5755
+	adi,ad5755-1
+	adi,ad5757
+	adi,ad5735
+	adi,ad5737
+
+ - reg: spi chip select number for the device
+ - spi-cpha or spi-cpol: is the only modes that is supported
+
+Recommended properties:
+ - spi-max-frequency: Definition as per
+		Documentation/devicetree/bindings/spi/spi-bus.txt
+
+Example:
+dac@0 {
+	compatible = "adi,ad5755";
+	reg = <0>;
+	spi-max-frequency = <1000000>;
+	spi-cpha;
+};
-- 
2.7.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v3 3/4] iio: ad5755: added full support for devicetree
@ 2016-02-16 14:25     ` Sean Nyekjaer
  0 siblings, 0 replies; 12+ messages in thread
From: Sean Nyekjaer @ 2016-02-16 14:25 UTC (permalink / raw)
  To: linux-iio; +Cc: Sean Nyekjaer, devicetree

Devicetree can provide platform data

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
---
Changes since v2:
- removed defines from DT

Still missing check of the valid from DT is valid.

 drivers/iio/dac/ad5755.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 85 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
index e1b6e78..8d264f0 100644
--- a/drivers/iio/dac/ad5755.c
+++ b/drivers/iio/dac/ad5755.c
@@ -14,6 +14,7 @@
 #include <linux/slab.h>
 #include <linux/sysfs.h>
 #include <linux/delay.h>
+#include <linux/of.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
 #include <linux/platform_data/ad5755.h>
@@ -556,6 +557,82 @@ static const struct ad5755_platform_data ad5755_default_pdata = {
 	},
 };
 
+#ifdef CONFIG_OF
+static struct ad5755_platform_data *ad5755_parse_dt(struct device *dev)
+{
+	struct device_node *np = dev->of_node;
+	struct device_node *pp;
+	struct ad5755_platform_data *pdata;
+	unsigned int tmp;
+	unsigned int tmparray[3];
+	int devnr;
+
+	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+	if (!pdata)
+		return NULL;
+
+	pdata->ext_dc_dc_compenstation_resistor =
+	       of_property_read_bool(np, "adi,ext_dc_dc_compenstation_resistor");
+
+	if (!of_property_read_u32(np, "adi,dc_dc_phase", &tmp))
+		pdata->dc_dc_phase = tmp;
+	else
+		pdata->dc_dc_phase = AD5755_DC_DC_PHASE_ALL_SAME_EDGE;
+
+	if (!of_property_read_u32(np, "adi,dc_dc_freq", &tmp))
+		pdata->dc_dc_freq = tmp;
+	else
+		pdata->dc_dc_freq = AD5755_DC_DC_FREQ_410kHZ;
+
+	if (!of_property_read_u32(np, "adi,dc_dc_maxv", &tmp))
+		pdata->dc_dc_maxv = tmp;
+	else
+		pdata->dc_dc_maxv = AD5755_DC_DC_MAXV_23V;
+
+	devnr = 0;
+	for_each_child_of_node(np, pp) {
+		if (devnr > AD5755_NUM_CHANNELS) {
+			dev_err(dev, "There is to many channels defined in DT\n");
+			goto error_out;
+		}
+
+		if (!of_property_read_u32(pp, "adi,mode", &tmp))
+			pdata->dac[devnr].mode = tmp;
+		else
+			pdata->dac[devnr].mode = AD5755_MODE_CURRENT_4mA_20mA;
+
+		pdata->dac[devnr].ext_current_sense_resistor =
+		       of_property_read_bool(pp, "adi,ext_current_sense_resistor");
+
+		pdata->dac[devnr].enable_voltage_overrange =
+			of_property_read_bool(pp, "adi,enable_voltage_overrange");
+		if (!of_property_read_u32_array(pp, "adi,slew", tmparray, 3)) {
+			pdata->dac[devnr].slew.enable = tmparray[0];
+			pdata->dac[devnr].slew.rate = tmparray[1];
+			pdata->dac[devnr].slew.step_size = tmparray[2];
+		} else {
+			pdata->dac[devnr].slew.enable = false;
+			pdata->dac[devnr].slew.rate = AD5755_SLEW_RATE_64k;
+			pdata->dac[devnr].slew.step_size = AD5755_SLEW_STEP_SIZE_1;
+		}
+
+		devnr++;
+	}
+
+	return pdata;
+
+error_out:
+	devm_kfree(dev, pdata);
+	return NULL;
+}
+#else
+static
+struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)
+{
+	return NULL;
+}
+#endif
+
 static int ad5755_probe(struct spi_device *spi)
 {
 	enum ad5755_type type = spi_get_device_id(spi)->driver_data;
@@ -583,8 +660,15 @@ static int ad5755_probe(struct spi_device *spi)
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->num_channels = AD5755_NUM_CHANNELS;
 
-	if (!pdata)
+	if (spi->dev.of_node)
+		pdata = ad5755_parse_dt(&spi->dev);
+	else
+		pdata = spi->dev.platform_data;
+
+	if (!pdata) {
+		dev_warn(&spi->dev, "no platform data? using default\n");
 		pdata = &ad5755_default_pdata;
+	}
 
 	ret = ad5755_init_channels(indio_dev, pdata);
 	if (ret)
-- 
2.7.1


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

* [PATCH v3 3/4] iio: ad5755: added full support for devicetree
@ 2016-02-16 14:25     ` Sean Nyekjaer
  0 siblings, 0 replies; 12+ messages in thread
From: Sean Nyekjaer @ 2016-02-16 14:25 UTC (permalink / raw)
  To: linux-iio-u79uwXL29TY76Z2rM5mHXA
  Cc: Sean Nyekjaer, devicetree-u79uwXL29TY76Z2rM5mHXA

Devicetree can provide platform data

Signed-off-by: Sean Nyekjaer <sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
---
Changes since v2:
- removed defines from DT

Still missing check of the valid from DT is valid.

 drivers/iio/dac/ad5755.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 85 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
index e1b6e78..8d264f0 100644
--- a/drivers/iio/dac/ad5755.c
+++ b/drivers/iio/dac/ad5755.c
@@ -14,6 +14,7 @@
 #include <linux/slab.h>
 #include <linux/sysfs.h>
 #include <linux/delay.h>
+#include <linux/of.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
 #include <linux/platform_data/ad5755.h>
@@ -556,6 +557,82 @@ static const struct ad5755_platform_data ad5755_default_pdata = {
 	},
 };
 
+#ifdef CONFIG_OF
+static struct ad5755_platform_data *ad5755_parse_dt(struct device *dev)
+{
+	struct device_node *np = dev->of_node;
+	struct device_node *pp;
+	struct ad5755_platform_data *pdata;
+	unsigned int tmp;
+	unsigned int tmparray[3];
+	int devnr;
+
+	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+	if (!pdata)
+		return NULL;
+
+	pdata->ext_dc_dc_compenstation_resistor =
+	       of_property_read_bool(np, "adi,ext_dc_dc_compenstation_resistor");
+
+	if (!of_property_read_u32(np, "adi,dc_dc_phase", &tmp))
+		pdata->dc_dc_phase = tmp;
+	else
+		pdata->dc_dc_phase = AD5755_DC_DC_PHASE_ALL_SAME_EDGE;
+
+	if (!of_property_read_u32(np, "adi,dc_dc_freq", &tmp))
+		pdata->dc_dc_freq = tmp;
+	else
+		pdata->dc_dc_freq = AD5755_DC_DC_FREQ_410kHZ;
+
+	if (!of_property_read_u32(np, "adi,dc_dc_maxv", &tmp))
+		pdata->dc_dc_maxv = tmp;
+	else
+		pdata->dc_dc_maxv = AD5755_DC_DC_MAXV_23V;
+
+	devnr = 0;
+	for_each_child_of_node(np, pp) {
+		if (devnr > AD5755_NUM_CHANNELS) {
+			dev_err(dev, "There is to many channels defined in DT\n");
+			goto error_out;
+		}
+
+		if (!of_property_read_u32(pp, "adi,mode", &tmp))
+			pdata->dac[devnr].mode = tmp;
+		else
+			pdata->dac[devnr].mode = AD5755_MODE_CURRENT_4mA_20mA;
+
+		pdata->dac[devnr].ext_current_sense_resistor =
+		       of_property_read_bool(pp, "adi,ext_current_sense_resistor");
+
+		pdata->dac[devnr].enable_voltage_overrange =
+			of_property_read_bool(pp, "adi,enable_voltage_overrange");
+		if (!of_property_read_u32_array(pp, "adi,slew", tmparray, 3)) {
+			pdata->dac[devnr].slew.enable = tmparray[0];
+			pdata->dac[devnr].slew.rate = tmparray[1];
+			pdata->dac[devnr].slew.step_size = tmparray[2];
+		} else {
+			pdata->dac[devnr].slew.enable = false;
+			pdata->dac[devnr].slew.rate = AD5755_SLEW_RATE_64k;
+			pdata->dac[devnr].slew.step_size = AD5755_SLEW_STEP_SIZE_1;
+		}
+
+		devnr++;
+	}
+
+	return pdata;
+
+error_out:
+	devm_kfree(dev, pdata);
+	return NULL;
+}
+#else
+static
+struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)
+{
+	return NULL;
+}
+#endif
+
 static int ad5755_probe(struct spi_device *spi)
 {
 	enum ad5755_type type = spi_get_device_id(spi)->driver_data;
@@ -583,8 +660,15 @@ static int ad5755_probe(struct spi_device *spi)
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->num_channels = AD5755_NUM_CHANNELS;
 
-	if (!pdata)
+	if (spi->dev.of_node)
+		pdata = ad5755_parse_dt(&spi->dev);
+	else
+		pdata = spi->dev.platform_data;
+
+	if (!pdata) {
+		dev_warn(&spi->dev, "no platform data? using default\n");
 		pdata = &ad5755_default_pdata;
+	}
 
 	ret = ad5755_init_channels(indio_dev, pdata);
 	if (ret)
-- 
2.7.1

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

* [PATCH v3 4/4] iio: ad5755: Add full DT binding documentation
@ 2016-02-16 14:25       ` Sean Nyekjaer
  0 siblings, 0 replies; 12+ messages in thread
From: Sean Nyekjaer @ 2016-02-16 14:25 UTC (permalink / raw)
  To: linux-iio; +Cc: Sean Nyekjaer, devicetree

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
---
Changes since v2:
 - Removed defines, alot easier to read :-)

 .../devicetree/bindings/iio/dac/ad5755.txt         | 94 ++++++++++++++++++++++
 1 file changed, 94 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/dac/ad5755.txt b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
index 4c91583..751204b 100644
--- a/Documentation/devicetree/bindings/iio/dac/ad5755.txt
+++ b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
@@ -15,10 +15,104 @@ Recommended properties:
  - spi-max-frequency: Definition as per
 		Documentation/devicetree/bindings/spi/spi-bus.txt
 
+Optional properties:
+See include/dt-bindings/iio/ad5755.h
+ - adi,ext_dc_dc_compenstation_resistor: boolean set if the hardware have an
+					 external resistor and thereby bypasses
+					 the internal compensation resistor.
+ - adi,dc_dc_phase:
+	Valid values for DC DC Phase control is:
+	0: All dc-to-dc converters clock on the same edge.
+	1: Channel A and Channel B clock on the same edge,
+	   Channel C and Channel D clock on opposite edges.
+	2: Channel A and Channel C clock on the same edge,
+	   Channel B and Channel D clock on opposite edges.
+	3: Channel A, Channel B, Channel C, and Channel D
+	   clock 90 degrees out of phase from each other.
+ - adi,dc_dc_freq:
+	Valid values for DC DC frequency is:
+	0: 250 kHz.
+	1: 410 kHz.
+	2: 650 kHz.
+ - adi,dc_dc_maxv:
+	Valid values for the maximum allowed Vboost voltage supplied by
+	the dc-to-dc converter is:
+	0: 23 V.
+	1: 24.5 V.
+	2: 27 V.
+	3: 29.5 V.
+
+Optional for every channel:
+ - adi,mode:
+	Valid values for DAC modes is:
+	0: 0 V to 5 V voltage range.
+	1: 0 V to 10 V voltage range.
+	2: Plus minus 5 V voltage range.
+	3: Plus minus 10 V voltage range.
+	4: 4 mA to 20 mA current range.
+	5: 0 mA to 20 mA current range.
+	6: 0 mA to 24 mA current range.
+ - adi,ext_current_sense_resistor: boolean set if the hardware a external
+				   current sense resistor.
+ - adi,enable_voltage_overrange: boolean enable voltage overrange
+ - adi,slew: Array of slewrate settings should contain 3 fields:
+	1: Should be either 0 or 1 in order to enable or disable slewrate.
+	2: Slew rate settings:
+		Valid values for the slew rate update frequency:
+		0: 64 kHz
+		1: 32 kHz
+		2: 16 kHz
+		3: 8 kHz
+		4: 4 kHz
+		5: 2 kHz
+		6: 1 kHz
+		7: 500 Hz
+		8: 250 Hz
+		9: 125 Hz
+		10: 64 Hz
+		11: 32 Hz
+		12: 16 Hz
+		13: 8 Hz
+		14: 4 Hz
+		15: 0.5 Hz
+	3: Slew step size:
+		Valid values for the step size LSBs:
+		0: 1
+		1: 2
+		2: 4
+		3: 16
+		4: 32
+		5: 64
+		6: 128
+		7: 256
+
 Example:
 dac@0 {
 	compatible = "adi,ad5755";
 	reg = <0>;
 	spi-max-frequency = <1000000>;
 	spi-cpha;
+	adi,dc_dc_phase = <0>;
+	adi,dc_dc_freq = <1>;
+	adi,dc_dc_maxv = <0>;
+	channel@0 {
+		adi,mode = <4>;
+		adi,ext_current_sense_resistor;
+		adi,slew = <0 0 0>;
+	};
+	channel@1 {
+		adi,mode = <4>;
+		adi,ext_current_sense_resistor;
+		adi,slew = <0 0 0>;
+	};
+	channel@2 {
+		adi,mode = <4>;
+		adi,ext_current_sense_resistor;
+		adi,slew = <0 0 0>;
+	};
+	channel@3 {
+		adi,mode = <4>;
+		adi,ext_current_sense_resistor;
+		adi,slew = <0 0 0>;
+	};
 };
-- 
2.7.1


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

* [PATCH v3 4/4] iio: ad5755: Add full DT binding documentation
@ 2016-02-16 14:25       ` Sean Nyekjaer
  0 siblings, 0 replies; 12+ messages in thread
From: Sean Nyekjaer @ 2016-02-16 14:25 UTC (permalink / raw)
  To: linux-iio-u79uwXL29TY76Z2rM5mHXA
  Cc: Sean Nyekjaer, devicetree-u79uwXL29TY76Z2rM5mHXA

Signed-off-by: Sean Nyekjaer <sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
---
Changes since v2:
 - Removed defines, alot easier to read :-)

 .../devicetree/bindings/iio/dac/ad5755.txt         | 94 ++++++++++++++++++++++
 1 file changed, 94 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/dac/ad5755.txt b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
index 4c91583..751204b 100644
--- a/Documentation/devicetree/bindings/iio/dac/ad5755.txt
+++ b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
@@ -15,10 +15,104 @@ Recommended properties:
  - spi-max-frequency: Definition as per
 		Documentation/devicetree/bindings/spi/spi-bus.txt
 
+Optional properties:
+See include/dt-bindings/iio/ad5755.h
+ - adi,ext_dc_dc_compenstation_resistor: boolean set if the hardware have an
+					 external resistor and thereby bypasses
+					 the internal compensation resistor.
+ - adi,dc_dc_phase:
+	Valid values for DC DC Phase control is:
+	0: All dc-to-dc converters clock on the same edge.
+	1: Channel A and Channel B clock on the same edge,
+	   Channel C and Channel D clock on opposite edges.
+	2: Channel A and Channel C clock on the same edge,
+	   Channel B and Channel D clock on opposite edges.
+	3: Channel A, Channel B, Channel C, and Channel D
+	   clock 90 degrees out of phase from each other.
+ - adi,dc_dc_freq:
+	Valid values for DC DC frequency is:
+	0: 250 kHz.
+	1: 410 kHz.
+	2: 650 kHz.
+ - adi,dc_dc_maxv:
+	Valid values for the maximum allowed Vboost voltage supplied by
+	the dc-to-dc converter is:
+	0: 23 V.
+	1: 24.5 V.
+	2: 27 V.
+	3: 29.5 V.
+
+Optional for every channel:
+ - adi,mode:
+	Valid values for DAC modes is:
+	0: 0 V to 5 V voltage range.
+	1: 0 V to 10 V voltage range.
+	2: Plus minus 5 V voltage range.
+	3: Plus minus 10 V voltage range.
+	4: 4 mA to 20 mA current range.
+	5: 0 mA to 20 mA current range.
+	6: 0 mA to 24 mA current range.
+ - adi,ext_current_sense_resistor: boolean set if the hardware a external
+				   current sense resistor.
+ - adi,enable_voltage_overrange: boolean enable voltage overrange
+ - adi,slew: Array of slewrate settings should contain 3 fields:
+	1: Should be either 0 or 1 in order to enable or disable slewrate.
+	2: Slew rate settings:
+		Valid values for the slew rate update frequency:
+		0: 64 kHz
+		1: 32 kHz
+		2: 16 kHz
+		3: 8 kHz
+		4: 4 kHz
+		5: 2 kHz
+		6: 1 kHz
+		7: 500 Hz
+		8: 250 Hz
+		9: 125 Hz
+		10: 64 Hz
+		11: 32 Hz
+		12: 16 Hz
+		13: 8 Hz
+		14: 4 Hz
+		15: 0.5 Hz
+	3: Slew step size:
+		Valid values for the step size LSBs:
+		0: 1
+		1: 2
+		2: 4
+		3: 16
+		4: 32
+		5: 64
+		6: 128
+		7: 256
+
 Example:
 dac@0 {
 	compatible = "adi,ad5755";
 	reg = <0>;
 	spi-max-frequency = <1000000>;
 	spi-cpha;
+	adi,dc_dc_phase = <0>;
+	adi,dc_dc_freq = <1>;
+	adi,dc_dc_maxv = <0>;
+	channel@0 {
+		adi,mode = <4>;
+		adi,ext_current_sense_resistor;
+		adi,slew = <0 0 0>;
+	};
+	channel@1 {
+		adi,mode = <4>;
+		adi,ext_current_sense_resistor;
+		adi,slew = <0 0 0>;
+	};
+	channel@2 {
+		adi,mode = <4>;
+		adi,ext_current_sense_resistor;
+		adi,slew = <0 0 0>;
+	};
+	channel@3 {
+		adi,mode = <4>;
+		adi,ext_current_sense_resistor;
+		adi,slew = <0 0 0>;
+	};
 };
-- 
2.7.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v3 4/4] iio: ad5755: Add full DT binding documentation
@ 2016-02-18 14:37         ` Rob Herring
  0 siblings, 0 replies; 12+ messages in thread
From: Rob Herring @ 2016-02-18 14:37 UTC (permalink / raw)
  To: Sean Nyekjaer; +Cc: linux-iio, devicetree

On Tue, Feb 16, 2016 at 03:25:57PM +0100, Sean Nyekjaer wrote:
> Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
> ---
> Changes since v2:
>  - Removed defines, alot easier to read :-)
> 
>  .../devicetree/bindings/iio/dac/ad5755.txt         | 94 ++++++++++++++++++++++
>  1 file changed, 94 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/iio/dac/ad5755.txt b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
> index 4c91583..751204b 100644
> --- a/Documentation/devicetree/bindings/iio/dac/ad5755.txt
> +++ b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
> @@ -15,10 +15,104 @@ Recommended properties:
>   - spi-max-frequency: Definition as per
>  		Documentation/devicetree/bindings/spi/spi-bus.txt
>  
> +Optional properties:
> +See include/dt-bindings/iio/ad5755.h
> + - adi,ext_dc_dc_compenstation_resistor: boolean set if the hardware have an

Use - instead of _ in property names.

> +					 external resistor and thereby bypasses
> +					 the internal compensation resistor.
> + - adi,dc_dc_phase:
> +	Valid values for DC DC Phase control is:
> +	0: All dc-to-dc converters clock on the same edge.
> +	1: Channel A and Channel B clock on the same edge,
> +	   Channel C and Channel D clock on opposite edges.
> +	2: Channel A and Channel C clock on the same edge,
> +	   Channel B and Channel D clock on opposite edges.
> +	3: Channel A, Channel B, Channel C, and Channel D
> +	   clock 90 degrees out of phase from each other.
> + - adi,dc_dc_freq:
> +	Valid values for DC DC frequency is:
> +	0: 250 kHz.
> +	1: 410 kHz.
> +	2: 650 kHz.

It is preferrable to make the values the actual units rather than 
register values. Then we can have common properties. Is this a common 
property of a DAC?

> + - adi,dc_dc_maxv:
> +	Valid values for the maximum allowed Vboost voltage supplied by
> +	the dc-to-dc converter is:
> +	0: 23 V.
> +	1: 24.5 V.
> +	2: 27 V.
> +	3: 29.5 V.

Same here.

Rob


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

* Re: [PATCH v3 4/4] iio: ad5755: Add full DT binding documentation
@ 2016-02-18 14:37         ` Rob Herring
  0 siblings, 0 replies; 12+ messages in thread
From: Rob Herring @ 2016-02-18 14:37 UTC (permalink / raw)
  To: Sean Nyekjaer
  Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Tue, Feb 16, 2016 at 03:25:57PM +0100, Sean Nyekjaer wrote:
> Signed-off-by: Sean Nyekjaer <sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
> ---
> Changes since v2:
>  - Removed defines, alot easier to read :-)
> 
>  .../devicetree/bindings/iio/dac/ad5755.txt         | 94 ++++++++++++++++++++++
>  1 file changed, 94 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/iio/dac/ad5755.txt b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
> index 4c91583..751204b 100644
> --- a/Documentation/devicetree/bindings/iio/dac/ad5755.txt
> +++ b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
> @@ -15,10 +15,104 @@ Recommended properties:
>   - spi-max-frequency: Definition as per
>  		Documentation/devicetree/bindings/spi/spi-bus.txt
>  
> +Optional properties:
> +See include/dt-bindings/iio/ad5755.h
> + - adi,ext_dc_dc_compenstation_resistor: boolean set if the hardware have an

Use - instead of _ in property names.

> +					 external resistor and thereby bypasses
> +					 the internal compensation resistor.
> + - adi,dc_dc_phase:
> +	Valid values for DC DC Phase control is:
> +	0: All dc-to-dc converters clock on the same edge.
> +	1: Channel A and Channel B clock on the same edge,
> +	   Channel C and Channel D clock on opposite edges.
> +	2: Channel A and Channel C clock on the same edge,
> +	   Channel B and Channel D clock on opposite edges.
> +	3: Channel A, Channel B, Channel C, and Channel D
> +	   clock 90 degrees out of phase from each other.
> + - adi,dc_dc_freq:
> +	Valid values for DC DC frequency is:
> +	0: 250 kHz.
> +	1: 410 kHz.
> +	2: 650 kHz.

It is preferrable to make the values the actual units rather than 
register values. Then we can have common properties. Is this a common 
property of a DAC?

> + - adi,dc_dc_maxv:
> +	Valid values for the maximum allowed Vboost voltage supplied by
> +	the dc-to-dc converter is:
> +	0: 23 V.
> +	1: 24.5 V.
> +	2: 27 V.
> +	3: 29.5 V.

Same here.

Rob

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v3 4/4] iio: ad5755: Add full DT binding documentation
  2016-02-18 14:37         ` Rob Herring
@ 2016-02-21 20:12           ` Jonathan Cameron
  -1 siblings, 0 replies; 12+ messages in thread
From: Jonathan Cameron @ 2016-02-21 20:12 UTC (permalink / raw)
  To: Rob Herring, Sean Nyekjaer; +Cc: linux-iio, devicetree

On 18/02/16 14:37, Rob Herring wrote:
> On Tue, Feb 16, 2016 at 03:25:57PM +0100, Sean Nyekjaer wrote:
>> Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
>> ---
>> Changes since v2:
>>  - Removed defines, alot easier to read :-)
>>
>>  .../devicetree/bindings/iio/dac/ad5755.txt         | 94 ++++++++++++++++++++++
>>  1 file changed, 94 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/iio/dac/ad5755.txt b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
>> index 4c91583..751204b 100644
>> --- a/Documentation/devicetree/bindings/iio/dac/ad5755.txt
>> +++ b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
>> @@ -15,10 +15,104 @@ Recommended properties:
>>   - spi-max-frequency: Definition as per
>>  		Documentation/devicetree/bindings/spi/spi-bus.txt
>>  
>> +Optional properties:
>> +See include/dt-bindings/iio/ad5755.h
>> + - adi,ext_dc_dc_compenstation_resistor: boolean set if the hardware have an
> 
> Use - instead of _ in property names.
> 
>> +					 external resistor and thereby bypasses
>> +					 the internal compensation resistor.
>> + - adi,dc_dc_phase:
>> +	Valid values for DC DC Phase control is:
>> +	0: All dc-to-dc converters clock on the same edge.
>> +	1: Channel A and Channel B clock on the same edge,
>> +	   Channel C and Channel D clock on opposite edges.
>> +	2: Channel A and Channel C clock on the same edge,
>> +	   Channel B and Channel D clock on opposite edges.
>> +	3: Channel A, Channel B, Channel C, and Channel D
>> +	   clock 90 degrees out of phase from each other.
>> + - adi,dc_dc_freq:
>> +	Valid values for DC DC frequency is:
>> +	0: 250 kHz.
>> +	1: 410 kHz.
>> +	2: 650 kHz.
> 
> It is preferrable to make the values the actual units rather than 
> register values. Then we can have common properties. Is this a common 
> property of a DAC?
Not overly common (in the parts we have seen in IIO so far),
but best to allow for it becoming a general property in the future
and actual units definitely the way to go. 
> 
>> + - adi,dc_dc_maxv:
>> +	Valid values for the maximum allowed Vboost voltage supplied by
>> +	the dc-to-dc converter is:
>> +	0: 23 V.
>> +	1: 24.5 V.
>> +	2: 27 V.
>> +	3: 29.5 V.
> 
> Same here.
> 
> Rob
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


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

* Re: [PATCH v3 4/4] iio: ad5755: Add full DT binding documentation
@ 2016-02-21 20:12           ` Jonathan Cameron
  0 siblings, 0 replies; 12+ messages in thread
From: Jonathan Cameron @ 2016-02-21 20:12 UTC (permalink / raw)
  To: Rob Herring, Sean Nyekjaer
  Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On 18/02/16 14:37, Rob Herring wrote:
> On Tue, Feb 16, 2016 at 03:25:57PM +0100, Sean Nyekjaer wrote:
>> Signed-off-by: Sean Nyekjaer <sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
>> ---
>> Changes since v2:
>>  - Removed defines, alot easier to read :-)
>>
>>  .../devicetree/bindings/iio/dac/ad5755.txt         | 94 ++++++++++++++++++++++
>>  1 file changed, 94 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/iio/dac/ad5755.txt b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
>> index 4c91583..751204b 100644
>> --- a/Documentation/devicetree/bindings/iio/dac/ad5755.txt
>> +++ b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
>> @@ -15,10 +15,104 @@ Recommended properties:
>>   - spi-max-frequency: Definition as per
>>  		Documentation/devicetree/bindings/spi/spi-bus.txt
>>  
>> +Optional properties:
>> +See include/dt-bindings/iio/ad5755.h
>> + - adi,ext_dc_dc_compenstation_resistor: boolean set if the hardware have an
> 
> Use - instead of _ in property names.
> 
>> +					 external resistor and thereby bypasses
>> +					 the internal compensation resistor.
>> + - adi,dc_dc_phase:
>> +	Valid values for DC DC Phase control is:
>> +	0: All dc-to-dc converters clock on the same edge.
>> +	1: Channel A and Channel B clock on the same edge,
>> +	   Channel C and Channel D clock on opposite edges.
>> +	2: Channel A and Channel C clock on the same edge,
>> +	   Channel B and Channel D clock on opposite edges.
>> +	3: Channel A, Channel B, Channel C, and Channel D
>> +	   clock 90 degrees out of phase from each other.
>> + - adi,dc_dc_freq:
>> +	Valid values for DC DC frequency is:
>> +	0: 250 kHz.
>> +	1: 410 kHz.
>> +	2: 650 kHz.
> 
> It is preferrable to make the values the actual units rather than 
> register values. Then we can have common properties. Is this a common 
> property of a DAC?
Not overly common (in the parts we have seen in IIO so far),
but best to allow for it becoming a general property in the future
and actual units definitely the way to go. 
> 
>> + - adi,dc_dc_maxv:
>> +	Valid values for the maximum allowed Vboost voltage supplied by
>> +	the dc-to-dc converter is:
>> +	0: 23 V.
>> +	1: 24.5 V.
>> +	2: 27 V.
>> +	3: 29.5 V.
> 
> Same here.
> 
> Rob
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

end of thread, other threads:[~2016-02-21 20:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-16 14:25 [PATCH v3 1/4] iio: ad5755: add support for dt bindings Sean Nyekjaer
2016-02-16 14:25 ` Sean Nyekjaer
2016-02-16 14:25 ` [PATCH v3 2/4] iio: ad5755: Add DT binding documentation Sean Nyekjaer
2016-02-16 14:25   ` Sean Nyekjaer
2016-02-16 14:25   ` [PATCH v3 3/4] iio: ad5755: added full support for devicetree Sean Nyekjaer
2016-02-16 14:25     ` Sean Nyekjaer
2016-02-16 14:25     ` [PATCH v3 4/4] iio: ad5755: Add full DT binding documentation Sean Nyekjaer
2016-02-16 14:25       ` Sean Nyekjaer
2016-02-18 14:37       ` Rob Herring
2016-02-18 14:37         ` Rob Herring
2016-02-21 20:12         ` Jonathan Cameron
2016-02-21 20:12           ` 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.