devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 1/2] iio: ad5755: add support for dt bindings
@ 2016-03-11 14:12 Sean Nyekjaer
       [not found] ` <1457705561-12253-1-git-send-email-sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Sean Nyekjaer @ 2016-03-11 14:12 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 v4:
- added lookups tables instead of large switchcases

Changes since v3:
- replaced '_' with '-'
- Now used actual values instead of register values.

Changes since v2:
- removed defines from DT

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

diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
index bfb350a..b380803 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>
@@ -109,6 +110,49 @@ enum ad5755_type {
 	ID_AD5737,
 };
 
+static const int ad5755_dcdc_freq_table[][2] = {
+	{ 250000, AD5755_DC_DC_FREQ_250kHZ },
+	{ 410000, AD5755_DC_DC_FREQ_410kHZ },
+	{ 650000, AD5755_DC_DC_FREQ_650kHZ }
+};
+
+static const int ad5755_dcdc_maxv_table[][2] = {
+	{ 23000000, AD5755_DC_DC_MAXV_23V },
+	{ 24500000, AD5755_DC_DC_MAXV_24V5 },
+	{ 27000000, AD5755_DC_DC_MAXV_27V },
+	{ 29500000, AD5755_DC_DC_MAXV_29V5 },
+};
+
+static const int ad5755_slew_rate_table[][2] = {
+	{ 64000, AD5755_SLEW_RATE_64k },
+	{ 32000, AD5755_SLEW_RATE_32k },
+	{ 16000, AD5755_SLEW_RATE_16k },
+	{ 8000, AD5755_SLEW_RATE_8k },
+	{ 4000, AD5755_SLEW_RATE_4k },
+	{ 2000, AD5755_SLEW_RATE_2k },
+	{ 1000, AD5755_SLEW_RATE_1k },
+	{ 500, AD5755_SLEW_RATE_500 },
+	{ 250, AD5755_SLEW_RATE_250 },
+	{ 125, AD5755_SLEW_RATE_125 },
+	{ 64, AD5755_SLEW_RATE_64 },
+	{ 32, AD5755_SLEW_RATE_32 },
+	{ 16, AD5755_SLEW_RATE_16 },
+	{ 8, AD5755_SLEW_RATE_8 },
+	{ 4, AD5755_SLEW_RATE_4 },
+	{ 0, AD5755_SLEW_RATE_0_5 },
+};
+
+static const int ad5755_slew_step_table[][2] = {
+	{ 256, AD5755_SLEW_STEP_SIZE_256 },
+	{ 128, AD5755_SLEW_STEP_SIZE_128 },
+	{ 64, AD5755_SLEW_STEP_SIZE_64 },
+	{ 32, AD5755_SLEW_STEP_SIZE_32 },
+	{ 16, AD5755_SLEW_STEP_SIZE_16 },
+	{ 4, AD5755_SLEW_STEP_SIZE_4 },
+	{ 2, AD5755_SLEW_STEP_SIZE_2 },
+	{ 1, AD5755_SLEW_STEP_SIZE_1 },
+};
+
 static int ad5755_write_unlocked(struct iio_dev *indio_dev,
 	unsigned int reg, unsigned int val)
 {
@@ -556,6 +600,129 @@ 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, i;
+
+	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;
+
+	pdata->dc_dc_freq = AD5755_DC_DC_FREQ_410kHZ;
+	if (!of_property_read_u32(np, "adi,dc-dc-freq-hz", &tmp)) {
+		for (i = 0; i < ARRAY_SIZE(ad5755_dcdc_freq_table); i++) {
+			if (tmp == ad5755_dcdc_freq_table[i][0]) {
+				pdata->dc_dc_freq = ad5755_dcdc_freq_table[i][1];
+				break;
+			}
+		}
+
+		if (i == ARRAY_SIZE(ad5755_dcdc_freq_table)) {
+			dev_err(dev,
+				"adi,dc-dc-freq out of range selecting 410kHz");
+		}
+	}
+
+	pdata->dc_dc_maxv = AD5755_DC_DC_MAXV_23V;
+	if (!of_property_read_u32(np, "adi,dc-dc-max-microvolt", &tmp)) {
+		for (i = 0; i < ARRAY_SIZE(ad5755_dcdc_maxv_table); i++) {
+			if (tmp == ad5755_dcdc_maxv_table[i][0]) {
+				pdata->dc_dc_maxv = ad5755_dcdc_maxv_table[i][1];
+				break;
+			}
+		}
+		if (i == ARRAY_SIZE(ad5755_dcdc_maxv_table)) {
+				dev_err(dev,
+					"adi,dc-dc-maxv out of range selecting 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 = AD5755_SLEW_RATE_64k;
+			for (i = 0; i < ARRAY_SIZE(ad5755_slew_rate_table); i++) {
+				if (tmparray[1] == ad5755_slew_rate_table[i][0]) {
+					pdata->dac[devnr].slew.rate =
+						ad5755_slew_rate_table[i][1];
+					break;
+				}
+			}
+			if (i == ARRAY_SIZE(ad5755_slew_rate_table)) {
+				dev_err(dev,
+					"channel %d slew rate out of range selecting 64kHz",
+					devnr);
+			}
+
+			pdata->dac[devnr].slew.step_size = AD5755_SLEW_STEP_SIZE_1;
+			for (i = 0; i < ARRAY_SIZE(ad5755_slew_step_table); i++) {
+				if (tmparray[2] == ad5755_slew_step_table[i][0]) {
+					pdata->dac[devnr].slew.step_size =
+						ad5755_slew_step_table[i][1];
+					break;
+				}
+			}
+			if (i == ARRAY_SIZE(ad5755_slew_step_table)) {
+				dev_err(dev,
+					"channel %d slew step size out of range selecting 1 LSB",
+					devnr);
+			}
+		} 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 +750,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)
@@ -607,6 +781,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.2

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

* [PATCH v5 2/2] iio: ad5755: Add DT binding documentation
       [not found] ` <1457705561-12253-1-git-send-email-sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
@ 2016-03-11 14:12   ` Sean Nyekjaer
       [not found]     ` <1457705561-12253-2-git-send-email-sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
  2016-03-12  9:25   ` [PATCH v5 1/2] iio: ad5755: add support for dt bindings Jonathan Cameron
  1 sibling, 1 reply; 10+ messages in thread
From: Sean Nyekjaer @ 2016-03-11 14:12 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 v4:
- Appended -hz to dc-dc-freq
- Added adi,dc-dc-max-microvolt
- Added reg property

Changes since v3:
- replaced '_' with '-'
- Now used actual values instead of register values.

Changes since v2:
 - Removed defines, alot easier to read

 .../devicetree/bindings/iio/dac/ad5755.txt         | 124 +++++++++++++++++++++
 1 file changed, 124 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..f0bbd7e
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
@@ -0,0 +1,124 @@
+* 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
+
+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-hz:
+	Valid values for DC DC frequency is [Hz]:
+	250000
+	410000
+	650000
+ - adi,dc-dc-max-microvolt:
+	Valid values for the maximum allowed Vboost voltage supplied by
+	the dc-to-dc converter is:
+	23000000
+	24500000
+	27000000
+	29500000
+
+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:
+		64000
+		32000
+		16000
+		8000
+		4000
+		2000
+		1000
+		500
+		250
+		125
+		64
+		32
+		16
+		8
+		4
+		0
+	3: Slew step size:
+		Valid values for the step size LSBs:
+		1
+		2
+		4
+		16
+		32
+		64
+		128
+		256
+
+Example:
+dac@0 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	compatible = "adi,ad5755";
+	reg = <0>;
+	spi-max-frequency = <1000000>;
+	spi-cpha;
+	adi,dc-dc-phase = <0>;
+	adi,dc-dc-freq-hz = <410000>;
+	adi,dc-dc-max-microvolt = <23000000>;
+	channel@0 {
+		reg = <0>;
+		adi,mode = <4>;
+		adi,ext-current-sense-resistor;
+		adi,slew = <0 64000 1>;
+	};
+	channel@1 {
+		reg = <1>;
+		adi,mode = <4>;
+		adi,ext-current-sense-resistor;
+		adi,slew = <0 64000 1>;
+	};
+	channel@2 {
+		reg = <2>;
+		adi,mode = <4>;
+		adi,ext-current-sense-resistor;
+		adi,slew = <0 64000 1>;
+	};
+	channel@3 {
+		reg = <3>;
+		adi,mode = <4>;
+		adi,ext-current-sense-resistor;
+		adi,slew = <0 64000 1>;
+	};
+};
-- 
2.7.2

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

* Re: [PATCH v5 1/2] iio: ad5755: add support for dt bindings
       [not found] ` <1457705561-12253-1-git-send-email-sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
  2016-03-11 14:12   ` [PATCH v5 2/2] iio: ad5755: Add DT binding documentation Sean Nyekjaer
@ 2016-03-12  9:25   ` Jonathan Cameron
  1 sibling, 0 replies; 10+ messages in thread
From: Jonathan Cameron @ 2016-03-12  9:25 UTC (permalink / raw)
  To: Sean Nyekjaer, linux-iio-u79uwXL29TY76Z2rM5mHXA
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Lars-Peter Clausen

On 11/03/16 14:12, Sean Nyekjaer wrote:
> Devicetree can provide platform data
> 
> Signed-off-by: Sean Nyekjaer <sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
Looks good to me. Would like an Ack / reviewed by from Lars
and a device tree ack for the bindings.  No particular rush
though given it has missed the current merge window now anyway.

Please do cc the driver author and maintainers for the device tree
bindings on relevant patches.  Both will probably pick it up from
the list, but they may well read emails addressed directly to
them earlier!
I'll add cc's for the binding in a mo.

Jonathan
> ---
> Changes since v4:
> - added lookups tables instead of large switchcases
> 
> Changes since v3:
> - replaced '_' with '-'
> - Now used actual values instead of register values.
> 
> Changes since v2:
> - removed defines from DT
> 
>  drivers/iio/dac/ad5755.c | 186 ++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 185 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
> index bfb350a..b380803 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>
> @@ -109,6 +110,49 @@ enum ad5755_type {
>  	ID_AD5737,
>  };
>  
> +static const int ad5755_dcdc_freq_table[][2] = {
> +	{ 250000, AD5755_DC_DC_FREQ_250kHZ },
> +	{ 410000, AD5755_DC_DC_FREQ_410kHZ },
> +	{ 650000, AD5755_DC_DC_FREQ_650kHZ }
> +};
> +
> +static const int ad5755_dcdc_maxv_table[][2] = {
> +	{ 23000000, AD5755_DC_DC_MAXV_23V },
> +	{ 24500000, AD5755_DC_DC_MAXV_24V5 },
> +	{ 27000000, AD5755_DC_DC_MAXV_27V },
> +	{ 29500000, AD5755_DC_DC_MAXV_29V5 },
> +};
> +
> +static const int ad5755_slew_rate_table[][2] = {
> +	{ 64000, AD5755_SLEW_RATE_64k },
> +	{ 32000, AD5755_SLEW_RATE_32k },
> +	{ 16000, AD5755_SLEW_RATE_16k },
> +	{ 8000, AD5755_SLEW_RATE_8k },
> +	{ 4000, AD5755_SLEW_RATE_4k },
> +	{ 2000, AD5755_SLEW_RATE_2k },
> +	{ 1000, AD5755_SLEW_RATE_1k },
> +	{ 500, AD5755_SLEW_RATE_500 },
> +	{ 250, AD5755_SLEW_RATE_250 },
> +	{ 125, AD5755_SLEW_RATE_125 },
> +	{ 64, AD5755_SLEW_RATE_64 },
> +	{ 32, AD5755_SLEW_RATE_32 },
> +	{ 16, AD5755_SLEW_RATE_16 },
> +	{ 8, AD5755_SLEW_RATE_8 },
> +	{ 4, AD5755_SLEW_RATE_4 },
> +	{ 0, AD5755_SLEW_RATE_0_5 },
> +};
> +
> +static const int ad5755_slew_step_table[][2] = {
> +	{ 256, AD5755_SLEW_STEP_SIZE_256 },
> +	{ 128, AD5755_SLEW_STEP_SIZE_128 },
> +	{ 64, AD5755_SLEW_STEP_SIZE_64 },
> +	{ 32, AD5755_SLEW_STEP_SIZE_32 },
> +	{ 16, AD5755_SLEW_STEP_SIZE_16 },
> +	{ 4, AD5755_SLEW_STEP_SIZE_4 },
> +	{ 2, AD5755_SLEW_STEP_SIZE_2 },
> +	{ 1, AD5755_SLEW_STEP_SIZE_1 },
> +};
> +
>  static int ad5755_write_unlocked(struct iio_dev *indio_dev,
>  	unsigned int reg, unsigned int val)
>  {
> @@ -556,6 +600,129 @@ 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, i;
> +
> +	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;
> +
> +	pdata->dc_dc_freq = AD5755_DC_DC_FREQ_410kHZ;
> +	if (!of_property_read_u32(np, "adi,dc-dc-freq-hz", &tmp)) {
> +		for (i = 0; i < ARRAY_SIZE(ad5755_dcdc_freq_table); i++) {
> +			if (tmp == ad5755_dcdc_freq_table[i][0]) {
> +				pdata->dc_dc_freq = ad5755_dcdc_freq_table[i][1];
> +				break;
> +			}
> +		}
> +
> +		if (i == ARRAY_SIZE(ad5755_dcdc_freq_table)) {
> +			dev_err(dev,
> +				"adi,dc-dc-freq out of range selecting 410kHz");
> +		}
> +	}
> +
> +	pdata->dc_dc_maxv = AD5755_DC_DC_MAXV_23V;
> +	if (!of_property_read_u32(np, "adi,dc-dc-max-microvolt", &tmp)) {
> +		for (i = 0; i < ARRAY_SIZE(ad5755_dcdc_maxv_table); i++) {
> +			if (tmp == ad5755_dcdc_maxv_table[i][0]) {
> +				pdata->dc_dc_maxv = ad5755_dcdc_maxv_table[i][1];
> +				break;
> +			}
> +		}
> +		if (i == ARRAY_SIZE(ad5755_dcdc_maxv_table)) {
> +				dev_err(dev,
> +					"adi,dc-dc-maxv out of range selecting 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 = AD5755_SLEW_RATE_64k;
> +			for (i = 0; i < ARRAY_SIZE(ad5755_slew_rate_table); i++) {
> +				if (tmparray[1] == ad5755_slew_rate_table[i][0]) {
> +					pdata->dac[devnr].slew.rate =
> +						ad5755_slew_rate_table[i][1];
> +					break;
> +				}
> +			}
> +			if (i == ARRAY_SIZE(ad5755_slew_rate_table)) {
> +				dev_err(dev,
> +					"channel %d slew rate out of range selecting 64kHz",
> +					devnr);
> +			}
> +
> +			pdata->dac[devnr].slew.step_size = AD5755_SLEW_STEP_SIZE_1;
> +			for (i = 0; i < ARRAY_SIZE(ad5755_slew_step_table); i++) {
> +				if (tmparray[2] == ad5755_slew_step_table[i][0]) {
> +					pdata->dac[devnr].slew.step_size =
> +						ad5755_slew_step_table[i][1];
> +					break;
> +				}
> +			}
> +			if (i == ARRAY_SIZE(ad5755_slew_step_table)) {
> +				dev_err(dev,
> +					"channel %d slew step size out of range selecting 1 LSB",
> +					devnr);
> +			}
> +		} 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 +750,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)
> @@ -607,6 +781,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",
> 

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

* Re: [PATCH v5 2/2] iio: ad5755: Add DT binding documentation
       [not found]     ` <1457705561-12253-2-git-send-email-sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
@ 2016-03-12  9:28       ` Jonathan Cameron
       [not found]         ` <56E3E121.9030400-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2016-03-18 19:51       ` Rob Herring
  1 sibling, 1 reply; 10+ messages in thread
From: Jonathan Cameron @ 2016-03-12  9:28 UTC (permalink / raw)
  To: Sean Nyekjaer, linux-iio-u79uwXL29TY76Z2rM5mHXA
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Pawel Moll, Rob Herring,
	Mark Rutland, Ian Campbell, Kumar Gala, Lars-Peter Clausen

On 11/03/16 14:12, Sean Nyekjaer wrote:
> Signed-off-by: Sean Nyekjaer <sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
Looks much better to me.

Looking for Acks from Lars and a device tree binding maintainer
on this one though.
(added CCs)

As an aside Device Tree bindings maintainers, do you prefer a personal cc
or just getting them directly from the devicetree list?

Jonthan
> ---
> Changes since v4:
> - Appended -hz to dc-dc-freq
> - Added adi,dc-dc-max-microvolt
> - Added reg property
> 
> Changes since v3:
> - replaced '_' with '-'
> - Now used actual values instead of register values.
> 
> Changes since v2:
>  - Removed defines, alot easier to read
> 
>  .../devicetree/bindings/iio/dac/ad5755.txt         | 124 +++++++++++++++++++++
>  1 file changed, 124 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..f0bbd7e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
> @@ -0,0 +1,124 @@
> +* 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
> +
> +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-hz:
> +	Valid values for DC DC frequency is [Hz]:
> +	250000
> +	410000
> +	650000
> + - adi,dc-dc-max-microvolt:
> +	Valid values for the maximum allowed Vboost voltage supplied by
> +	the dc-to-dc converter is:
> +	23000000
> +	24500000
> +	27000000
> +	29500000
> +
> +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:
> +		64000
> +		32000
> +		16000
> +		8000
> +		4000
> +		2000
> +		1000
> +		500
> +		250
> +		125
> +		64
> +		32
> +		16
> +		8
> +		4
> +		0
> +	3: Slew step size:
> +		Valid values for the step size LSBs:
> +		1
> +		2
> +		4
> +		16
> +		32
> +		64
> +		128
> +		256
> +
> +Example:
> +dac@0 {
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +	compatible = "adi,ad5755";
> +	reg = <0>;
> +	spi-max-frequency = <1000000>;
> +	spi-cpha;
> +	adi,dc-dc-phase = <0>;
> +	adi,dc-dc-freq-hz = <410000>;
> +	adi,dc-dc-max-microvolt = <23000000>;
> +	channel@0 {
> +		reg = <0>;
> +		adi,mode = <4>;
> +		adi,ext-current-sense-resistor;
> +		adi,slew = <0 64000 1>;
> +	};
> +	channel@1 {
> +		reg = <1>;
> +		adi,mode = <4>;
> +		adi,ext-current-sense-resistor;
> +		adi,slew = <0 64000 1>;
> +	};
> +	channel@2 {
> +		reg = <2>;
> +		adi,mode = <4>;
> +		adi,ext-current-sense-resistor;
> +		adi,slew = <0 64000 1>;
> +	};
> +	channel@3 {
> +		reg = <3>;
> +		adi,mode = <4>;
> +		adi,ext-current-sense-resistor;
> +		adi,slew = <0 64000 1>;
> +	};
> +};
> 

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

* Re: [PATCH v5 2/2] iio: ad5755: Add DT binding documentation
       [not found]     ` <1457705561-12253-2-git-send-email-sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
  2016-03-12  9:28       ` Jonathan Cameron
@ 2016-03-18 19:51       ` Rob Herring
  1 sibling, 0 replies; 10+ messages in thread
From: Rob Herring @ 2016-03-18 19:51 UTC (permalink / raw)
  To: Sean Nyekjaer
  Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA

On Fri, Mar 11, 2016 at 03:12:41PM +0100, Sean Nyekjaer wrote:
> Signed-off-by: Sean Nyekjaer <sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
> ---
> Changes since v4:
> - Appended -hz to dc-dc-freq
> - Added adi,dc-dc-max-microvolt
> - Added reg property
> 
> Changes since v3:
> - replaced '_' with '-'
> - Now used actual values instead of register values.
> 
> Changes since v2:
>  - Removed defines, alot easier to read
> 
>  .../devicetree/bindings/iio/dac/ad5755.txt         | 124 +++++++++++++++++++++
>  1 file changed, 124 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/dac/ad5755.txt

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
--
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] 10+ messages in thread

* Re: [PATCH v5 2/2] iio: ad5755: Add DT binding documentation
       [not found]         ` <56E3E121.9030400-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2016-03-28 15:13           ` Jonathan Cameron
       [not found]             ` <56F94A21.6070804-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Jonathan Cameron @ 2016-03-28 15:13 UTC (permalink / raw)
  To: Sean Nyekjaer, linux-iio-u79uwXL29TY76Z2rM5mHXA
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Pawel Moll, Rob Herring,
	Mark Rutland, Ian Campbell, Kumar Gala, Lars-Peter Clausen

On 12/03/16 09:28, Jonathan Cameron wrote:
> On 11/03/16 14:12, Sean Nyekjaer wrote:
>> Signed-off-by: Sean Nyekjaer <sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
> Looks much better to me.
> 
> Looking for Acks from Lars and a device tree binding maintainer
> on this one though.
> (added CCs)
Lars?
> 
> As an aside Device Tree bindings maintainers, do you prefer a personal cc
> or just getting them directly from the devicetree list?
> 
> Jonthan
>> ---
>> Changes since v4:
>> - Appended -hz to dc-dc-freq
>> - Added adi,dc-dc-max-microvolt
>> - Added reg property
>>
>> Changes since v3:
>> - replaced '_' with '-'
>> - Now used actual values instead of register values.
>>
>> Changes since v2:
>>  - Removed defines, alot easier to read
>>
>>  .../devicetree/bindings/iio/dac/ad5755.txt         | 124 +++++++++++++++++++++
>>  1 file changed, 124 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..f0bbd7e
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
>> @@ -0,0 +1,124 @@
>> +* 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
>> +
>> +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-hz:
>> +	Valid values for DC DC frequency is [Hz]:
>> +	250000
>> +	410000
>> +	650000
>> + - adi,dc-dc-max-microvolt:
>> +	Valid values for the maximum allowed Vboost voltage supplied by
>> +	the dc-to-dc converter is:
>> +	23000000
>> +	24500000
>> +	27000000
>> +	29500000
>> +
>> +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:
>> +		64000
>> +		32000
>> +		16000
>> +		8000
>> +		4000
>> +		2000
>> +		1000
>> +		500
>> +		250
>> +		125
>> +		64
>> +		32
>> +		16
>> +		8
>> +		4
>> +		0
>> +	3: Slew step size:
>> +		Valid values for the step size LSBs:
>> +		1
>> +		2
>> +		4
>> +		16
>> +		32
>> +		64
>> +		128
>> +		256
>> +
>> +Example:
>> +dac@0 {
>> +	#address-cells = <1>;
>> +	#size-cells = <0>;
>> +	compatible = "adi,ad5755";
>> +	reg = <0>;
>> +	spi-max-frequency = <1000000>;
>> +	spi-cpha;
>> +	adi,dc-dc-phase = <0>;
>> +	adi,dc-dc-freq-hz = <410000>;
>> +	adi,dc-dc-max-microvolt = <23000000>;
>> +	channel@0 {
>> +		reg = <0>;
>> +		adi,mode = <4>;
>> +		adi,ext-current-sense-resistor;
>> +		adi,slew = <0 64000 1>;
>> +	};
>> +	channel@1 {
>> +		reg = <1>;
>> +		adi,mode = <4>;
>> +		adi,ext-current-sense-resistor;
>> +		adi,slew = <0 64000 1>;
>> +	};
>> +	channel@2 {
>> +		reg = <2>;
>> +		adi,mode = <4>;
>> +		adi,ext-current-sense-resistor;
>> +		adi,slew = <0 64000 1>;
>> +	};
>> +	channel@3 {
>> +		reg = <3>;
>> +		adi,mode = <4>;
>> +		adi,ext-current-sense-resistor;
>> +		adi,slew = <0 64000 1>;
>> +	};
>> +};
>>
> 
> --
> 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] 10+ messages in thread

* Re: [PATCH v5 2/2] iio: ad5755: Add DT binding documentation
       [not found]             ` <56F94A21.6070804-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2016-05-09  8:16               ` Sean Nyekjær
       [not found]                 ` <8a7b1dcb-205a-8801-737f-6aa1c39f6605-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Sean Nyekjær @ 2016-05-09  8:16 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio-u79uwXL29TY76Z2rM5mHXA
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Pawel Moll, Rob Herring,
	Mark Rutland, Ian Campbell, Kumar Gala, Lars-Peter Clausen



On 2016-03-28 17:13, Jonathan Cameron wrote:
> On 12/03/16 09:28, Jonathan Cameron wrote:
>> On 11/03/16 14:12, Sean Nyekjaer wrote:
>>> Signed-off-by: Sean Nyekjaer <sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
>> Looks much better to me.
>>
>> Looking for Acks from Lars and a device tree binding maintainer
>> on this one though.
>> (added CCs)
> Lars?
No response...
Is there anything wrong with this?
>> As an aside Device Tree bindings maintainers, do you prefer a personal cc
>> or just getting them directly from the devicetree list?
>>
>> Jonthan
>>> ---
>>> Changes since v4:
>>> - Appended -hz to dc-dc-freq
>>> - Added adi,dc-dc-max-microvolt
>>> - Added reg property
>>>
>>> Changes since v3:
>>> - replaced '_' with '-'
>>> - Now used actual values instead of register values.
>>>
>>> Changes since v2:
>>>   - Removed defines, alot easier to read
>>>
>>>   .../devicetree/bindings/iio/dac/ad5755.txt         | 124 +++++++++++++++++++++
>>>   1 file changed, 124 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..f0bbd7e
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
>>> @@ -0,0 +1,124 @@
>>> +* 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
>>> +
>>> +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-hz:
>>> +	Valid values for DC DC frequency is [Hz]:
>>> +	250000
>>> +	410000
>>> +	650000
>>> + - adi,dc-dc-max-microvolt:
>>> +	Valid values for the maximum allowed Vboost voltage supplied by
>>> +	the dc-to-dc converter is:
>>> +	23000000
>>> +	24500000
>>> +	27000000
>>> +	29500000
>>> +
>>> +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:
>>> +		64000
>>> +		32000
>>> +		16000
>>> +		8000
>>> +		4000
>>> +		2000
>>> +		1000
>>> +		500
>>> +		250
>>> +		125
>>> +		64
>>> +		32
>>> +		16
>>> +		8
>>> +		4
>>> +		0
>>> +	3: Slew step size:
>>> +		Valid values for the step size LSBs:
>>> +		1
>>> +		2
>>> +		4
>>> +		16
>>> +		32
>>> +		64
>>> +		128
>>> +		256
>>> +
>>> +Example:
>>> +dac@0 {
>>> +	#address-cells = <1>;
>>> +	#size-cells = <0>;
>>> +	compatible = "adi,ad5755";
>>> +	reg = <0>;
>>> +	spi-max-frequency = <1000000>;
>>> +	spi-cpha;
>>> +	adi,dc-dc-phase = <0>;
>>> +	adi,dc-dc-freq-hz = <410000>;
>>> +	adi,dc-dc-max-microvolt = <23000000>;
>>> +	channel@0 {
>>> +		reg = <0>;
>>> +		adi,mode = <4>;
>>> +		adi,ext-current-sense-resistor;
>>> +		adi,slew = <0 64000 1>;
>>> +	};
>>> +	channel@1 {
>>> +		reg = <1>;
>>> +		adi,mode = <4>;
>>> +		adi,ext-current-sense-resistor;
>>> +		adi,slew = <0 64000 1>;
>>> +	};
>>> +	channel@2 {
>>> +		reg = <2>;
>>> +		adi,mode = <4>;
>>> +		adi,ext-current-sense-resistor;
>>> +		adi,slew = <0 64000 1>;
>>> +	};
>>> +	channel@3 {
>>> +		reg = <3>;
>>> +		adi,mode = <4>;
>>> +		adi,ext-current-sense-resistor;
>>> +		adi,slew = <0 64000 1>;
>>> +	};
>>> +};
>>>
>> --
>> 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] 10+ messages in thread

* Re: [PATCH v5 2/2] iio: ad5755: Add DT binding documentation
       [not found]                 ` <8a7b1dcb-205a-8801-737f-6aa1c39f6605-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
@ 2016-05-29 13:57                   ` Jonathan Cameron
       [not found]                     ` <8e62350f-ec4c-cba4-fa46-95549a89e720-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Jonathan Cameron @ 2016-05-29 13:57 UTC (permalink / raw)
  To: Sean Nyekjær, linux-iio-u79uwXL29TY76Z2rM5mHXA
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Pawel Moll, Rob Herring,
	Mark Rutland, Ian Campbell, Kumar Gala, Lars-Peter Clausen

On 09/05/16 09:16, Sean Nyekjær wrote:
> 
> 
> On 2016-03-28 17:13, Jonathan Cameron wrote:
>> On 12/03/16 09:28, Jonathan Cameron wrote:
>>> On 11/03/16 14:12, Sean Nyekjaer wrote:
>>>> Signed-off-by: Sean Nyekjaer <sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
>>> Looks much better to me.
>>>
>>> Looking for Acks from Lars and a device tree binding maintainer
>>> on this one though.
>>> (added CCs)
>> Lars?
> No response...
> Is there anything wrong with this?
Given we are early in cycle there is no real rush for this...

Lars, let me know if you are going to a while getting to this / any other
patches I want responses on from you.

Thanks,

Jonathan

>>> As an aside Device Tree bindings maintainers, do you prefer a personal cc
>>> or just getting them directly from the devicetree list?
>>>
>>> Jonthan
>>>> ---
>>>> Changes since v4:
>>>> - Appended -hz to dc-dc-freq
>>>> - Added adi,dc-dc-max-microvolt
>>>> - Added reg property
>>>>
>>>> Changes since v3:
>>>> - replaced '_' with '-'
>>>> - Now used actual values instead of register values.
>>>>
>>>> Changes since v2:
>>>>   - Removed defines, alot easier to read
>>>>
>>>>   .../devicetree/bindings/iio/dac/ad5755.txt         | 124 +++++++++++++++++++++
>>>>   1 file changed, 124 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..f0bbd7e
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/iio/dac/ad5755.txt
>>>> @@ -0,0 +1,124 @@
>>>> +* 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
>>>> +
>>>> +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-hz:
>>>> +    Valid values for DC DC frequency is [Hz]:
>>>> +    250000
>>>> +    410000
>>>> +    650000
>>>> + - adi,dc-dc-max-microvolt:
>>>> +    Valid values for the maximum allowed Vboost voltage supplied by
>>>> +    the dc-to-dc converter is:
>>>> +    23000000
>>>> +    24500000
>>>> +    27000000
>>>> +    29500000
>>>> +
>>>> +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:
>>>> +        64000
>>>> +        32000
>>>> +        16000
>>>> +        8000
>>>> +        4000
>>>> +        2000
>>>> +        1000
>>>> +        500
>>>> +        250
>>>> +        125
>>>> +        64
>>>> +        32
>>>> +        16
>>>> +        8
>>>> +        4
>>>> +        0
>>>> +    3: Slew step size:
>>>> +        Valid values for the step size LSBs:
>>>> +        1
>>>> +        2
>>>> +        4
>>>> +        16
>>>> +        32
>>>> +        64
>>>> +        128
>>>> +        256
>>>> +
>>>> +Example:
>>>> +dac@0 {
>>>> +    #address-cells = <1>;
>>>> +    #size-cells = <0>;
>>>> +    compatible = "adi,ad5755";
>>>> +    reg = <0>;
>>>> +    spi-max-frequency = <1000000>;
>>>> +    spi-cpha;
>>>> +    adi,dc-dc-phase = <0>;
>>>> +    adi,dc-dc-freq-hz = <410000>;
>>>> +    adi,dc-dc-max-microvolt = <23000000>;
>>>> +    channel@0 {
>>>> +        reg = <0>;
>>>> +        adi,mode = <4>;
>>>> +        adi,ext-current-sense-resistor;
>>>> +        adi,slew = <0 64000 1>;
>>>> +    };
>>>> +    channel@1 {
>>>> +        reg = <1>;
>>>> +        adi,mode = <4>;
>>>> +        adi,ext-current-sense-resistor;
>>>> +        adi,slew = <0 64000 1>;
>>>> +    };
>>>> +    channel@2 {
>>>> +        reg = <2>;
>>>> +        adi,mode = <4>;
>>>> +        adi,ext-current-sense-resistor;
>>>> +        adi,slew = <0 64000 1>;
>>>> +    };
>>>> +    channel@3 {
>>>> +        reg = <3>;
>>>> +        adi,mode = <4>;
>>>> +        adi,ext-current-sense-resistor;
>>>> +        adi,slew = <0 64000 1>;
>>>> +    };
>>>> +};
>>>>
>>> -- 
>>> 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
>>>
> 
> -- 
> 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] 10+ messages in thread

* Re: [PATCH v5 2/2] iio: ad5755: Add DT binding documentation
       [not found]                     ` <8e62350f-ec4c-cba4-fa46-95549a89e720-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2016-05-29 14:12                       ` Lars-Peter Clausen
       [not found]                         ` <574AF8EB.9060609-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Lars-Peter Clausen @ 2016-05-29 14:12 UTC (permalink / raw)
  To: Jonathan Cameron, Sean Nyekjær, linux-iio-u79uwXL29TY76Z2rM5mHXA
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Pawel Moll, Rob Herring,
	Mark Rutland, Ian Campbell, Kumar Gala

On 05/29/2016 03:57 PM, Jonathan Cameron wrote:
> On 09/05/16 09:16, Sean Nyekjær wrote:
>>
>>
>> On 2016-03-28 17:13, Jonathan Cameron wrote:
>>> On 12/03/16 09:28, Jonathan Cameron wrote:
>>>> On 11/03/16 14:12, Sean Nyekjaer wrote:
>>>>> Signed-off-by: Sean Nyekjaer <sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
>>>> Looks much better to me.
>>>>
>>>> Looking for Acks from Lars and a device tree binding maintainer
>>>> on this one though.
>>>> (added CCs)
>>> Lars?
>> No response...
>> Is there anything wrong with this?
> Given we are early in cycle there is no real rush for this...
> 
> Lars, let me know if you are going to a while getting to this / any other
> patches I want responses on from you.

I don't think this solution is the correct approach, but since I'm not able
to provide an alternative and everybody else is OK with it, I'm not going to
block it either. So go ahead and apply it.

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

* Re: [PATCH v5 2/2] iio: ad5755: Add DT binding documentation
       [not found]                         ` <574AF8EB.9060609-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
@ 2016-06-11 17:26                           ` Jonathan Cameron
  0 siblings, 0 replies; 10+ messages in thread
From: Jonathan Cameron @ 2016-06-11 17:26 UTC (permalink / raw)
  To: Lars-Peter Clausen, Sean Nyekjær, linux-iio-u79uwXL29TY76Z2rM5mHXA
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Pawel Moll, Rob Herring,
	Mark Rutland, Ian Campbell, Kumar Gala

On 29/05/16 15:12, Lars-Peter Clausen wrote:
> On 05/29/2016 03:57 PM, Jonathan Cameron wrote:
>> On 09/05/16 09:16, Sean Nyekjær wrote:
>>>
>>>
>>> On 2016-03-28 17:13, Jonathan Cameron wrote:
>>>> On 12/03/16 09:28, Jonathan Cameron wrote:
>>>>> On 11/03/16 14:12, Sean Nyekjaer wrote:
>>>>>> Signed-off-by: Sean Nyekjaer <sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
>>>>> Looks much better to me.
>>>>>
>>>>> Looking for Acks from Lars and a device tree binding maintainer
>>>>> on this one though.
>>>>> (added CCs)
>>>> Lars?
>>> No response...
>>> Is there anything wrong with this?
>> Given we are early in cycle there is no real rush for this...
>>
>> Lars, let me know if you are going to a while getting to this / any other
>> patches I want responses on from you.
> 
> I don't think this solution is the correct approach, but since I'm not able
> to provide an alternative and everybody else is OK with it, I'm not going to
> block it either. So go ahead and apply it.

Hmm. I've applied this now.  Perhaps we will revisit in the future and
eventually deprecate this binding in favour of something more generic.

Thanks for your hard work on this Sean. It certainly wasn't a case
with obvious 'right' answers!

Jonathan
> 

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

end of thread, other threads:[~2016-06-11 17:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-11 14:12 [PATCH v5 1/2] iio: ad5755: add support for dt bindings Sean Nyekjaer
     [not found] ` <1457705561-12253-1-git-send-email-sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
2016-03-11 14:12   ` [PATCH v5 2/2] iio: ad5755: Add DT binding documentation Sean Nyekjaer
     [not found]     ` <1457705561-12253-2-git-send-email-sean.nyekjaer-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
2016-03-12  9:28       ` Jonathan Cameron
     [not found]         ` <56E3E121.9030400-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-03-28 15:13           ` Jonathan Cameron
     [not found]             ` <56F94A21.6070804-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-05-09  8:16               ` Sean Nyekjær
     [not found]                 ` <8a7b1dcb-205a-8801-737f-6aa1c39f6605-rjjw5hvvQKZaa/9Udqfwiw@public.gmane.org>
2016-05-29 13:57                   ` Jonathan Cameron
     [not found]                     ` <8e62350f-ec4c-cba4-fa46-95549a89e720-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-05-29 14:12                       ` Lars-Peter Clausen
     [not found]                         ` <574AF8EB.9060609-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2016-06-11 17:26                           ` Jonathan Cameron
2016-03-18 19:51       ` Rob Herring
2016-03-12  9:25   ` [PATCH v5 1/2] iio: ad5755: add support for dt bindings Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).