diff mbox

[1/3] Documentation: ad5064: Added devicetree bindings documentation

Message ID 1443789702-24945-1-git-send-email-paul.cercueil@analog.com
State Superseded, archived
Headers show

Commit Message

Paul Cercueil Oct. 2, 2015, 12:41 p.m. UTC
Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
---
 .../devicetree/bindings/iio/dac/ad5064.txt         | 48 ++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/dac/ad5064.txt

Comments

Jonathan Cameron Oct. 4, 2015, 1:52 p.m. UTC | #1
On 02/10/15 13:41, Paul Cercueil wrote:
> If the device does not have an internal reference, there is no
> other choice but to use the external reference. In that case,
> it does not make much sense to have to specify it.
> 
> This patch ensures that the external reference is used if the
> device does not feature an internal reference.
> 
> Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Other than the issue the autobuilder found I'm happy enough
with the series.

Given it is Lars' driver I'd like him to take a look as well
before I apply it.

Thanks,

Jonathan
> ---
>  drivers/iio/dac/ad5064.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
> index 7146f42..daee39e 100644
> --- a/drivers/iio/dac/ad5064.c
> +++ b/drivers/iio/dac/ad5064.c
> @@ -464,7 +464,9 @@ static int ad5064_probe(struct device *dev, enum ad5064_type type,
>  	for (i = 0; i < ad5064_num_vref(st); ++i)
>  		st->vref_reg[i].supply = ad5064_vref_name(st, i);
>  
> -	if (dev->of_node) {
> +	if (!st->chip_info->internal_vref) {
> +		ext_vref = true;
> +	} else if (dev->of_node) {
>  		for (i = 0; ext_vref && i < ad5064_num_vref(st); ++i)
>  			ext_vref = of_property_read_bool(dev->of_node,
>  					ad5064_vref_name(st, i));
> @@ -483,11 +485,6 @@ static int ad5064_probe(struct device *dev, enum ad5064_type type,
>  		if (ret)
>  			return ret;
>  	} else {
> -		if (!st->chip_info->internal_vref) {
> -			dev_err(dev, "No vref available\n");
> -			return -ENXIO;
> -		}
> -
>  		st->use_internal_vref = true;
>  		ret = ad5064_write(st, AD5064_CMD_CONFIG, 0,
>  			AD5064_CONFIG_INT_VREF_ENABLE, 0);
> 

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

Patch

diff --git a/Documentation/devicetree/bindings/iio/dac/ad5064.txt b/Documentation/devicetree/bindings/iio/dac/ad5064.txt
new file mode 100644
index 0000000..fa2d328
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/dac/ad5064.txt
@@ -0,0 +1,48 @@ 
+Analog Devices AD5064 DAC device driver
+
+Required properties:
+	- compatible: Must be one of:
+		* "adi,ad5024"
+		* "adi,ad5025"
+		* "adi,ad5044"
+		* "adi,ad5045"
+		* "adi,ad5064"
+		* "adi,ad5064-1"
+		* "adi,ad5065"
+		* "adi,ad5628-1"
+		* "adi,ad5628-2"
+		* "adi,ad5648-1"
+		* "adi,ad5648-2"
+		* "adi,ad5666-1"
+		* "adi,ad5666-2"
+		* "adi,ad5668-1"
+		* "adi,ad5668-2"
+		* "adi,ad5668-3"
+	- reg: SPI chip select number for the device
+	- spi-max-frequency: Max SPI frequency to use (< 30000000)
+	- vrefA-supply, vrefB-supply: phandles to external reference voltage
+	  supplies for channels 0 and 1 respectively.
+	  This property must be present for ad5024, ad5025, ad5044, ad5045,
+	  ad5064, ad5065.
+	- vrefC-supply, vrefD-supply: phandles to external reference voltage
+	  supplies for channels 2 and 3 respectively.
+	  This property must be present for ad5024, ad5044, ad5064.
+
+Optional properties:
+	- vref-supply: phandle to the external reference voltage supply.
+	  This should only be set if there is an external reference voltage
+	  connected to the vref or vref[A-D] pins.
+	  If the property is not set, the internal reference voltage supply
+	  is used if present.
+	  This property can be used with ad5064-1, ad5628-1, ad5628-2, ad5648-1,
+	  ad5648-2, ad5666-1, ad5666-2, ad5668-1, ad5668-2, ad5668-3.
+
+Example:
+
+		ad5668-2@4 {
+			compatible = "adi,ad5668-2";
+			reg = <4>;
+			spi-max-frequency = <10000000>;
+			adi,use-external-reference;
+			vref-supply = <&vref_supply>;
+		};