[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <88021dc4-d131-49f0-9afd-fd11b1a34bc2@wanadoo.fr>
Date: Sun, 8 Sep 2024 17:53:57 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: adureghello@...libre.com
Cc: Michael.Hennerich@...log.com, conor+dt@...nel.org,
devicetree@...r.kernel.org, dlechner@...libre.com, jic23@...nel.org,
krzk+dt@...nel.org, lars@...afoo.de, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, nuno.sa@...log.com,
olivier.moysan@...s.st.com, robh@...nel.org
Subject: Re: [PATCH v2 7/9] iio: dac: ad3552r: extract common code (no changes
in behavior intended)
Le 05/09/2024 à 17:17, Angelo Dureghello a écrit :
> From: Angelo Dureghello <adureghello-rdvid1DuHRBWk0Htik3J/w@...lic.gmane.org>
>
> Extracting common code, to share common code to be used later
> by the AXI driver version (ad3552r-axi.c).
...
> +#include "ad3552r.h"
> +
> +static const s32 ad3552r_ch_ranges[][2] = {
> + [AD3552R_CH_OUTPUT_RANGE_0__2P5V] = {0, 2500},
Maybe add some spaces around { }?
> + [AD3552R_CH_OUTPUT_RANGE_0__5V] = {0, 5000},
> + [AD3552R_CH_OUTPUT_RANGE_0__10V] = {0, 10000},
> + [AD3552R_CH_OUTPUT_RANGE_NEG_5__5V] = {-5000, 5000},
> + [AD3552R_CH_OUTPUT_RANGE_NEG_10__10V] = {-10000, 10000}
> +};
> +
> +static const s32 ad3542r_ch_ranges[][2] = {
> + [AD3542R_CH_OUTPUT_RANGE_0__2P5V] = {0, 2500},
> + [AD3542R_CH_OUTPUT_RANGE_0__3V] = {0, 3000},
> + [AD3542R_CH_OUTPUT_RANGE_0__5V] = {0, 5000},
> + [AD3542R_CH_OUTPUT_RANGE_0__10V] = {0, 10000},
> + [AD3542R_CH_OUTPUT_RANGE_NEG_2P5__7P5V] = {-2500, 7500},
> + [AD3542R_CH_OUTPUT_RANGE_NEG_5__5V] = {-5000, 5000}
> +};
...
> +int ad3552r_get_custom_gain(struct device *dev, struct fwnode_handle *child,
> + u8 *gs_p, u8 *gs_n, u16 *rfb, s16 *goffs)
> +{
> + int err;
> + u32 val;
> + struct fwnode_handle *gain_child __free(fwnode_handle)
> + = fwnode_get_named_child_node(child,
> + "custom-output-range-config");
> +
> + if (!gain_child)
> + return dev_err_probe(dev, -EINVAL,
> + "custom-output-range-config mandatory\n");
> +
> + err = fwnode_property_read_u32(gain_child, "adi,gain-scaling-p", &val);
> + if (err)
> + return dev_err_probe(dev, err,
> + "adi,gain-scaling-p mandatory\n");
> + *gs_p = val;
> +
> + err = fwnode_property_read_u32(gain_child, "adi,gain-scaling-n", &val);
> + if (err)
> + return dev_err_probe(dev, err,
> + "adi,gain-scaling-n property mandatory\n");
> + *gs_n = val;
> +
> + err = fwnode_property_read_u32(gain_child, "adi,rfb-ohms", &val);
> + if (err)
> + return dev_err_probe(dev, err,
> + "adi,rfb-ohms mandatoryn");
Missing \ in the ending \n.
CJ
> + *rfb = val;
> +
> + err = fwnode_property_read_u32(gain_child, "adi,gain-offset", &val);
> + if (err)
> + return dev_err_probe(dev, err,
> + "adi,gain-offset mandatory\n");
> + *goffs = val;
> +
> + return 0;
> +}
...
Powered by blists - more mailing lists