* [PATCH 1/4] iio: frequency: ad4350: Fix bug / typo in mask
@ 2013-05-23 15:00 michael.hennerich
2013-05-23 15:00 ` [PATCH 2/4] iio: frequency: adf4350: cast value to unsigned to make code checkers happy michael.hennerich
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: michael.hennerich @ 2013-05-23 15:00 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, dan.carpenter, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
---
drivers/iio/frequency/adf4350.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
index a884252..e76d4ac 100644
--- a/drivers/iio/frequency/adf4350.c
+++ b/drivers/iio/frequency/adf4350.c
@@ -212,7 +212,7 @@ static int adf4350_set_freq(struct adf4350_state *st, unsigned long long freq)
(pdata->r2_user_settings & (ADF4350_REG2_PD_POLARITY_POS |
ADF4350_REG2_LDP_6ns | ADF4350_REG2_LDF_INT_N |
ADF4350_REG2_CHARGE_PUMP_CURR_uA(5000) |
- ADF4350_REG2_MUXOUT(0x7) | ADF4350_REG2_NOISE_MODE(0x9)));
+ ADF4350_REG2_MUXOUT(0x7) | ADF4350_REG2_NOISE_MODE(0x3)));
st->regs[ADF4350_REG3] = pdata->r3_user_settings &
(ADF4350_REG3_12BIT_CLKDIV(0xFFF) |
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] iio: frequency: adf4350: cast value to unsigned to make code checkers happy
2013-05-23 15:00 [PATCH 1/4] iio: frequency: ad4350: Fix bug / typo in mask michael.hennerich
@ 2013-05-23 15:00 ` michael.hennerich
2013-05-23 15:00 ` [PATCH 3/4] iio: frequency: adf4350: Add support for clock consumer framework michael.hennerich
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: michael.hennerich @ 2013-05-23 15:00 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, dan.carpenter, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
---
include/linux/iio/frequency/adf4350.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/iio/frequency/adf4350.h b/include/linux/iio/frequency/adf4350.h
index be91f34..ffd8c8f 100644
--- a/include/linux/iio/frequency/adf4350.h
+++ b/include/linux/iio/frequency/adf4350.h
@@ -1,7 +1,7 @@
/*
* ADF4350/ADF4351 SPI PLL driver
*
- * Copyright 2012 Analog Devices Inc.
+ * Copyright 2012-2013 Analog Devices Inc.
*
* Licensed under the GPL-2.
*/
@@ -41,7 +41,7 @@
#define ADF4350_REG2_RDIV2_EN (1 << 24)
#define ADF4350_REG2_RMULT2_EN (1 << 25)
#define ADF4350_REG2_MUXOUT(x) ((x) << 26)
-#define ADF4350_REG2_NOISE_MODE(x) ((x) << 29)
+#define ADF4350_REG2_NOISE_MODE(x) (((unsigned)(x)) << 29)
#define ADF4350_MUXOUT_THREESTATE 0
#define ADF4350_MUXOUT_DVDD 1
#define ADF4350_MUXOUT_GND 2
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] iio: frequency: adf4350: Add support for clock consumer framework
2013-05-23 15:00 [PATCH 1/4] iio: frequency: ad4350: Fix bug / typo in mask michael.hennerich
2013-05-23 15:00 ` [PATCH 2/4] iio: frequency: adf4350: cast value to unsigned to make code checkers happy michael.hennerich
@ 2013-05-23 15:00 ` michael.hennerich
2013-05-23 15:00 ` [PATCH 4/4] iio: frequency: adf4350: Add support for dt bindings michael.hennerich
2013-06-02 16:10 ` [PATCH 1/4] iio: frequency: ad4350: Fix bug / typo in mask Jonathan Cameron
3 siblings, 0 replies; 8+ messages in thread
From: michael.hennerich @ 2013-05-23 15:00 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, dan.carpenter, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
Preferably get clkin (PLL reference clock) from clock framework
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
---
drivers/iio/frequency/adf4350.c | 58 +++++++++++++++++++++++++++++++++------
1 file changed, 49 insertions(+), 9 deletions(-)
diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
index e76d4ac..f6849c8 100644
--- a/drivers/iio/frequency/adf4350.c
+++ b/drivers/iio/frequency/adf4350.c
@@ -1,7 +1,7 @@
/*
* ADF4350/ADF4351 SPI Wideband Synthesizer driver
*
- * Copyright 2012 Analog Devices Inc.
+ * Copyright 2012-2013 Analog Devices Inc.
*
* Licensed under the GPL-2.
*/
@@ -17,6 +17,7 @@
#include <linux/gcd.h>
#include <linux/gpio.h>
#include <asm/div64.h>
+#include <linux/clk.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
@@ -33,6 +34,7 @@ struct adf4350_state {
struct spi_device *spi;
struct regulator *reg;
struct adf4350_platform_data *pdata;
+ struct clk *clk;
unsigned long clkin;
unsigned long chspc; /* Channel Spacing */
unsigned long fpfd; /* Phase Frequency Detector */
@@ -43,7 +45,7 @@ struct adf4350_state {
unsigned r4_rf_div_sel;
unsigned long regs[6];
unsigned long regs_hw[6];
-
+ unsigned long long freq_req;
/*
* DMA (thus cache coherency maintenance) requires the
* transfer buffers to live in their own cache lines.
@@ -52,7 +54,6 @@ struct adf4350_state {
};
static struct adf4350_platform_data default_pdata = {
- .clkin = 122880000,
.channel_spacing = 10000,
.r2_user_settings = ADF4350_REG2_PD_POLARITY_POS |
ADF4350_REG2_CHARGE_PUMP_CURR_uA(2500),
@@ -235,6 +236,7 @@ static int adf4350_set_freq(struct adf4350_state *st, unsigned long long freq)
ADF4350_REG4_MUTE_TILL_LOCK_EN));
st->regs[ADF4350_REG5] = ADF4350_REG5_LD_PIN_MODE_DIGITAL;
+ st->freq_req = freq;
return adf4350_sync_config(st);
}
@@ -246,6 +248,7 @@ static ssize_t adf4350_write(struct iio_dev *indio_dev,
{
struct adf4350_state *st = iio_priv(indio_dev);
unsigned long long readin;
+ unsigned long tmp;
int ret;
ret = kstrtoull(buf, 10, &readin);
@@ -258,10 +261,23 @@ static ssize_t adf4350_write(struct iio_dev *indio_dev,
ret = adf4350_set_freq(st, readin);
break;
case ADF4350_FREQ_REFIN:
- if (readin > ADF4350_MAX_FREQ_REFIN)
+ if (readin > ADF4350_MAX_FREQ_REFIN) {
ret = -EINVAL;
- else
- st->clkin = readin;
+ break;
+ }
+
+ if (st->clk) {
+ tmp = clk_round_rate(st->clk, readin);
+ if (tmp != readin) {
+ ret = -EINVAL;
+ break;
+ }
+ ret = clk_set_rate(st->clk, tmp);
+ if (ret < 0)
+ break;
+ }
+ st->clkin = readin;
+ ret = adf4350_set_freq(st, st->freq_req);
break;
case ADF4350_FREQ_RESOLUTION:
if (readin == 0)
@@ -308,6 +324,9 @@ static ssize_t adf4350_read(struct iio_dev *indio_dev,
}
break;
case ADF4350_FREQ_REFIN:
+ if (st->clk)
+ st->clkin = clk_get_rate(st->clk);
+
val = st->clkin;
break;
case ADF4350_FREQ_RESOLUTION:
@@ -318,6 +337,7 @@ static ssize_t adf4350_read(struct iio_dev *indio_dev,
break;
default:
ret = -EINVAL;
+ val = 0;
}
mutex_unlock(&indio_dev->mlock);
@@ -360,14 +380,24 @@ static int adf4350_probe(struct spi_device *spi)
struct adf4350_platform_data *pdata = spi->dev.platform_data;
struct iio_dev *indio_dev;
struct adf4350_state *st;
+ struct clk *clk = NULL;
int ret;
if (!pdata) {
dev_warn(&spi->dev, "no platform data? using default\n");
-
pdata = &default_pdata;
}
+ if (!pdata->clkin) {
+ clk = clk_get(&spi->dev, "clkin");
+ if (IS_ERR(clk))
+ return -EPROBE_DEFER;
+
+ ret = clk_prepare_enable(clk);
+ if (ret < 0)
+ return ret;
+ }
+
indio_dev = iio_device_alloc(sizeof(*st));
if (indio_dev == NULL)
return -ENOMEM;
@@ -395,7 +425,12 @@ static int adf4350_probe(struct spi_device *spi)
indio_dev->num_channels = 1;
st->chspc = pdata->channel_spacing;
- st->clkin = pdata->clkin;
+ if (clk) {
+ st->clk = clk;
+ st->clkin = clk_get_rate(clk);
+ } else {
+ st->clkin = pdata->clkin;
+ }
st->min_out_freq = spi_get_device_id(spi)->driver_data == 4351 ?
ADF4351_MIN_OUT_FREQ : ADF4350_MIN_OUT_FREQ;
@@ -435,6 +470,8 @@ error_put_reg:
if (!IS_ERR(st->reg))
regulator_put(st->reg);
+ if (clk)
+ clk_disable_unprepare(clk);
iio_device_free(indio_dev);
return ret;
@@ -451,6 +488,9 @@ static int adf4350_remove(struct spi_device *spi)
iio_device_unregister(indio_dev);
+ if (st->clk)
+ clk_disable_unprepare(st->clk);
+
if (!IS_ERR(reg)) {
regulator_disable(reg);
regulator_put(reg);
@@ -481,6 +521,6 @@ static struct spi_driver adf4350_driver = {
};
module_spi_driver(adf4350_driver);
-MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
+MODULE_AUTHOR("Michael Hennerich <michael.hennerich@analog.com>");
MODULE_DESCRIPTION("Analog Devices ADF4350/ADF4351 PLL");
MODULE_LICENSE("GPL v2");
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] iio: frequency: adf4350: Add support for dt bindings
2013-05-23 15:00 [PATCH 1/4] iio: frequency: ad4350: Fix bug / typo in mask michael.hennerich
2013-05-23 15:00 ` [PATCH 2/4] iio: frequency: adf4350: cast value to unsigned to make code checkers happy michael.hennerich
2013-05-23 15:00 ` [PATCH 3/4] iio: frequency: adf4350: Add support for clock consumer framework michael.hennerich
@ 2013-05-23 15:00 ` michael.hennerich
2013-05-23 16:45 ` Lars-Peter Clausen
2013-06-02 16:10 ` [PATCH 1/4] iio: frequency: ad4350: Fix bug / typo in mask Jonathan Cameron
3 siblings, 1 reply; 8+ messages in thread
From: michael.hennerich @ 2013-05-23 15:00 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, dan.carpenter, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
---
.../devicetree/bindings/iio/frequency/adf4350.txt | 84 ++++++++++++++
drivers/iio/frequency/adf4350.c | 122 +++++++++++++++++++-
2 files changed, 205 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/iio/frequency/adf4350.txt
diff --git a/Documentation/devicetree/bindings/iio/frequency/adf4350.txt b/Documentation/devicetree/bindings/iio/frequency/adf4350.txt
new file mode 100644
index 0000000..ab99cfd
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/frequency/adf4350.txt
@@ -0,0 +1,84 @@
+Analog Devices ADF4350/ADF4351 device driver
+
+Required properties:
+ - compatible: Should be one of
+ * "adi,adf4350": When using the ADF4350 device
+ * "adi,adf4351": When using the ADF4351 device
+ - reg: SPI chip select numbert for the device
+ - spi-max-frequency: Max SPI frequency to use (< 20000000)
+ - clocks: From common clock binding. Clock is phandle to clock for
+ ADF435x Reference Clock (CLKIN).
+
+Optional properties:
+ - adi,channel-spacing: Channel spacing in Hz (influences MODULUS).
+ - adi,power-up-frequency: If set in Hz the PLL tunes to
+ the desired frequency on probe.
+ - adi,ref-div-factor: If set the driver skips dynamic calculation
+ and uses this default value instead.
+ - adi,ref-doubler-en: Enables reference doubler.
+ - adi,ref-div2-en: Enables reference divider.
+ - adi,gpio-lock-detect: If set with a valid GPIO number, pll lock state
+ is tested upon read.
+ - adi,reg2-pd-polarity-pos-en: Enables positive phase
+ detector polarity. Default = negative.
+ - adi,reg2-ldp-6ns-en: Enables 6ns lock detect precision.
+ Default = 10ns.
+ - adi,reg2-ldf-int-n-en: Enables lock detect for integer-N mode.
+ Default = factional-N mode.
+ - adi,reg2-charge-pump-curr-ua: Charge pump current in mA.
+ Default = 2500mA.
+ - adi,reg2-muxout: On chip multiplexer output selection.
+ Valid values for the multiplexer output are:
+ 0: Three-State Output (default)
+ 1: DVDD
+ 2: DGND
+ 3: R-Counter output
+ 4: N-Divider output
+ 5: Analog lock detect
+ 6: Digital lock detect
+ - adi,reg2-noise-mode: Enables low noise mode. Default = Low spur mode.
+ - adi,reg3-csr-en: Enables cycle slip reduction.
+ - adi,reg3-charge-cancellation-en: Enabled charge pump
+ charge cancellation for integer-N modes.
+ - adi,reg3-anti-backlash-3ns-en: Enables 3ns antibacklash pulse width
+ for integer-N modes.
+ - adi,reg3-band-sel-clock-mode-high-en: Enables faster band selection logic.
+ - adi,reg3-12bit-clkdiv: Clock divider value used when
+ adi,reg3-12bit-clkdiv-mode != 0
+ - adi,reg3-12bit-clkdiv-mode:
+ Valid values for the clkdiv mode are:
+ 0: Clock divider off (default)
+ 1: Fast lock enable
+ 2: Phase resync enable
+ - adi,reg4-aux-output-en: Enables auxiliary RF output.
+ - adi,reg4-aux-output-fund-en: Selects fundamental VCO output on the
+ auxiliary RF output. Default = Output of RF dividers.
+ - adi,reg4-mute-till-lock-en: Enables Mute-Till-Lock-Detect function.
+ - adi,reg4-output-pwr: Output power selection.
+ Valid values for the power mode are:
+ 0: -4dBM (default)
+ 1: -1dBM
+ 2: +2dBM
+ 3: +5dBM
+ - adi,reg4-aux-output-pwr: Auxiliary output power selection.
+ Valid values for the power mode are:
+ 0: -4dBM (default)
+ 1: -1dBM
+ 2: +2dBM
+ 3: +5dBM
+
+
+Example:
+ lo_pll0_rx_adf4351: adf4351-rx-lpc@4 {
+ compatible = "adi,adf4351";
+ reg = <4>;
+ spi-max-frequency = <10000000>;
+ clocks = <&clk0_ad9523 9>;
+ clock-names = "clkin";
+ adi,channel-spacing = <10000>;
+ adi,power-up-frequency = <2400000000>;
+ adi,reg2-pd-polarity-pos-en;
+ adi,reg2-charge-pump-curr-ua = <2500>;
+ adi,reg4-output-pwr = <3>;
+ adi,reg4-mute-till-lock-en;
+ };
diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
index f6849c8..828ce3e1 100644
--- a/drivers/iio/frequency/adf4350.c
+++ b/drivers/iio/frequency/adf4350.c
@@ -18,6 +18,7 @@
#include <linux/gpio.h>
#include <asm/div64.h>
#include <linux/clk.h>
+#include <linux/of.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
@@ -375,14 +376,133 @@ static const struct iio_info adf4350_info = {
.driver_module = THIS_MODULE,
};
+#ifdef CONFIG_OF
+static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)
+{
+ struct device_node *np = dev->of_node;
+ struct adf4350_platform_data *pdata;
+ unsigned int tmp;
+ int ret;
+
+ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata) {
+ dev_err(dev, "could not allocate memory for platform data\n");
+ return NULL;
+ }
+
+ strncpy(&pdata->name[0], np->name, SPI_NAME_SIZE - 1);
+
+ tmp = 10000;
+ of_property_read_u32(np, "adi,channel-spacing", &tmp);
+ pdata->channel_spacing = tmp;
+
+ tmp = 0;
+ of_property_read_u32(np, "adi,power-up-frequency", &tmp);
+ pdata->power_up_frequency = tmp;
+
+ tmp = 0;
+ of_property_read_u32(np, "adi,ref-div-factor", &tmp);
+ pdata->ref_div_factor = tmp;
+
+ ret = of_property_read_u32(np, "adi,gpio-lock-detect",
+ &pdata->gpio_lock_detect);
+ if (ret < 0)
+ pdata->gpio_lock_detect = -1;
+
+ pdata->ref_doubler_en = of_property_read_bool(np, "adi,ref-doubler-en");
+ pdata->ref_div2_en = of_property_read_bool(np, "adi,ref-div2-en");
+
+ /* r2_user_settings */
+ pdata->r2_user_settings =
+ of_property_read_bool(np, "adi,reg2-pd-polarity-pos-en") ?
+ ADF4350_REG2_PD_POLARITY_POS : 0;
+ pdata->r2_user_settings |=
+ of_property_read_bool(np, "adi,reg2-ldp-6ns-en") ?
+ ADF4350_REG2_LDP_6ns : 0;
+ pdata->r2_user_settings |=
+ of_property_read_bool(np, "adi,reg2-ldf-int-n-en") ?
+ ADF4350_REG2_LDF_INT_N : 0;
+ tmp = 2500;
+ of_property_read_u32(np, "adi,reg2-charge-pump-curr-ua", &tmp);
+ pdata->r2_user_settings |= ADF4350_REG2_CHARGE_PUMP_CURR_uA(tmp);
+
+ tmp = 0;
+ of_property_read_u32(np, "adi,reg2-muxout", &tmp);
+ pdata->r2_user_settings |= ADF4350_REG2_MUXOUT(tmp);
+
+ tmp = 0;
+ of_property_read_u32(np, "adi,reg2-noise-mode", &tmp);
+ pdata->r2_user_settings |= ADF4350_REG2_NOISE_MODE(tmp);
+
+ /* r3_user_settings */
+
+ pdata->r3_user_settings =
+ of_property_read_bool(np, "adi,reg3-csr-en") ?
+ ADF4350_REG3_12BIT_CSR_EN : 0;
+ pdata->r3_user_settings |=
+ of_property_read_bool(np, "adi,reg3-charge-cancellation-en") ?
+ ADF4351_REG3_CHARGE_CANCELLATION_EN : 0;
+ pdata->r3_user_settings |=
+ of_property_read_bool(np, "adi,reg3-anti-backlash-3ns-en") ?
+ ADF4351_REG3_ANTI_BACKLASH_3ns_EN : 0;
+ pdata->r3_user_settings |=
+ of_property_read_bool(np,
+ "adi,reg3-band-sel-clock-mode-high-en") ?
+ ADF4351_REG3_BAND_SEL_CLOCK_MODE_HIGH : 0;
+
+ tmp = 0;
+ of_property_read_u32(np, "adi,reg3-12bit-clkdiv", &tmp);
+ pdata->r3_user_settings |= ADF4350_REG3_12BIT_CLKDIV(tmp);
+
+ tmp = 0;
+ of_property_read_u32(np, "adi,reg3-12bit-clkdiv-mode", &tmp);
+ pdata->r3_user_settings |= ADF4350_REG3_12BIT_CLKDIV_MODE(tmp);
+
+ /* r4_user_settings */
+
+ pdata->r4_user_settings =
+ of_property_read_bool(np, "adi,reg4-aux-output-en") ?
+ ADF4350_REG4_AUX_OUTPUT_EN : 0;
+ pdata->r4_user_settings |=
+ of_property_read_bool(np, "adi,reg4-aux-output-fund-en") ?
+ ADF4350_REG4_AUX_OUTPUT_FUND : 0;
+ pdata->r4_user_settings |=
+ of_property_read_bool(np, "adi,reg4-mute-till-lock-en") ?
+ ADF4350_REG4_MUTE_TILL_LOCK_EN : 0;
+ tmp = 0;
+ of_property_read_u32(np, "adi,reg4-output-pwr", &tmp);
+ pdata->r4_user_settings |= ADF4350_REG4_OUTPUT_PWR(tmp);
+
+ tmp = 0;
+ of_property_read_u32(np, "adi,reg4-aux-output-pwr", &tmp);
+ pdata->r4_user_settings |= ADF4350_REG4_AUX_OUTPUT_PWR(tmp);
+
+ return pdata;
+}
+#else
+static
+struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)
+{
+ return NULL;
+}
+#endif
+
static int adf4350_probe(struct spi_device *spi)
{
- struct adf4350_platform_data *pdata = spi->dev.platform_data;
+ struct adf4350_platform_data *pdata;
struct iio_dev *indio_dev;
struct adf4350_state *st;
struct clk *clk = NULL;
int ret;
+ if (spi->dev.of_node) {
+ pdata = adf4350_parse_dt(&spi->dev);
+ if (IS_ERR(pdata))
+ return PTR_ERR(pdata);
+ } else {
+ pdata = spi->dev.platform_data;
+ }
+
if (!pdata) {
dev_warn(&spi->dev, "no platform data? using default\n");
pdata = &default_pdata;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 4/4] iio: frequency: adf4350: Add support for dt bindings
2013-05-23 15:00 ` [PATCH 4/4] iio: frequency: adf4350: Add support for dt bindings michael.hennerich
@ 2013-05-23 16:45 ` Lars-Peter Clausen
2013-05-27 11:28 ` Michael Hennerich
0 siblings, 1 reply; 8+ messages in thread
From: Lars-Peter Clausen @ 2013-05-23 16:45 UTC (permalink / raw)
To: michael.hennerich; +Cc: jic23, linux-iio, dan.carpenter
On 05/23/2013 05:00 PM, michael.hennerich@analog.com wrote:
> From: Michael Hennerich <michael.hennerich@analog.com>
>
> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
> ---
> .../devicetree/bindings/iio/frequency/adf4350.txt | 84 ++++++++++++++
> drivers/iio/frequency/adf4350.c | 122 +++++++++++++++++++-
> 2 files changed, 205 insertions(+), 1 deletion(-)
> create mode 100644 Documentation/devicetree/bindings/iio/frequency/adf4350.txt
>
> diff --git a/Documentation/devicetree/bindings/iio/frequency/adf4350.txt b/Documentation/devicetree/bindings/iio/frequency/adf4350.txt
> new file mode 100644
> index 0000000..ab99cfd
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/frequency/adf4350.txt
> @@ -0,0 +1,84 @@
> +Analog Devices ADF4350/ADF4351 device driver
> +
> +Required properties:
> + - compatible: Should be one of
> + * "adi,adf4350": When using the ADF4350 device
> + * "adi,adf4351": When using the ADF4351 device
> + - reg: SPI chip select numbert for the device
typo: number
> + - spi-max-frequency: Max SPI frequency to use (< 20000000)
> + - clocks: From common clock binding. Clock is phandle to clock for
> + ADF435x Reference Clock (CLKIN).
> +
> +Optional properties:
> + - adi,channel-spacing: Channel spacing in Hz (influences MODULUS).
> + - adi,power-up-frequency: If set in Hz the PLL tunes to
> + the desired frequency on probe.
> + - adi,ref-div-factor: If set the driver skips dynamic calculation
> + and uses this default value instead.
> + - adi,ref-doubler-en: Enables reference doubler.
> + - adi,ref-div2-en: Enables reference divider.
> + - adi,gpio-lock-detect: If set with a valid GPIO number, pll lock state
> + is tested upon read.
GPIOs are referenced by phandle plus parameter, not by GPIO number.
> + - adi,reg2-pd-polarity-pos-en: Enables positive phase
> + detector polarity. Default = negative.
> + - adi,reg2-ldp-6ns-en: Enables 6ns lock detect precision.
> + Default = 10ns.
> + - adi,reg2-ldf-int-n-en: Enables lock detect for integer-N mode.
> + Default = factional-N mode.
> + - adi,reg2-charge-pump-curr-ua: Charge pump current in mA.
> + Default = 2500mA.
> + - adi,reg2-muxout: On chip multiplexer output selection.
> + Valid values for the multiplexer output are:
> + 0: Three-State Output (default)
> + 1: DVDD
> + 2: DGND
> + 3: R-Counter output
> + 4: N-Divider output
> + 5: Analog lock detect
> + 6: Digital lock detect
> + - adi,reg2-noise-mode: Enables low noise mode. Default = Low spur mode.
> + - adi,reg3-csr-en: Enables cycle slip reduction.
> + - adi,reg3-charge-cancellation-en: Enabled charge pump
> + charge cancellation for integer-N modes.
> + - adi,reg3-anti-backlash-3ns-en: Enables 3ns antibacklash pulse width
> + for integer-N modes.
> + - adi,reg3-band-sel-clock-mode-high-en: Enables faster band selection logic.
> + - adi,reg3-12bit-clkdiv: Clock divider value used when
> + adi,reg3-12bit-clkdiv-mode != 0
> + - adi,reg3-12bit-clkdiv-mode:
> + Valid values for the clkdiv mode are:
> + 0: Clock divider off (default)
> + 1: Fast lock enable
> + 2: Phase resync enable
> + - adi,reg4-aux-output-en: Enables auxiliary RF output.
> + - adi,reg4-aux-output-fund-en: Selects fundamental VCO output on the
> + auxiliary RF output. Default = Output of RF dividers.
> + - adi,reg4-mute-till-lock-en: Enables Mute-Till-Lock-Detect function.
> + - adi,reg4-output-pwr: Output power selection.
> + Valid values for the power mode are:
> + 0: -4dBM (default)
> + 1: -1dBM
> + 2: +2dBM
> + 3: +5dBM
> + - adi,reg4-aux-output-pwr: Auxiliary output power selection.
> + Valid values for the power mode are:
> + 0: -4dBM (default)
> + 1: -1dBM
> + 2: +2dBM
> + 3: +5dBM
As I said before abbreviations in devicetree property names are kind of
frowned upon. There are a lot of abbreviations used for these properties.
Also I'm not sure whether it makes sense to include the register number in
the property name.
> +
> +
> +Example:
> + lo_pll0_rx_adf4351: adf4351-rx-lpc@4 {
> + compatible = "adi,adf4351";
> + reg = <4>;
> + spi-max-frequency = <10000000>;
> + clocks = <&clk0_ad9523 9>;
> + clock-names = "clkin";
> + adi,channel-spacing = <10000>;
> + adi,power-up-frequency = <2400000000>;
> + adi,reg2-pd-polarity-pos-en;
> + adi,reg2-charge-pump-curr-ua = <2500>;
> + adi,reg4-output-pwr = <3>;
> + adi,reg4-mute-till-lock-en;
> + };
> diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
> index f6849c8..828ce3e1 100644
> --- a/drivers/iio/frequency/adf4350.c
> +++ b/drivers/iio/frequency/adf4350.c
> @@ -18,6 +18,7 @@
> #include <linux/gpio.h>
> #include <asm/div64.h>
> #include <linux/clk.h>
> +#include <linux/of.h>
>
> #include <linux/iio/iio.h>
> #include <linux/iio/sysfs.h>
> @@ -375,14 +376,133 @@ static const struct iio_info adf4350_info = {
> .driver_module = THIS_MODULE,
> };
>
> +#ifdef CONFIG_OF
> +static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)
> +{
> + struct device_node *np = dev->of_node;
> + struct adf4350_platform_data *pdata;
> + unsigned int tmp;
> + int ret;
> +
> + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> + if (!pdata) {
> + dev_err(dev, "could not allocate memory for platform data\n");
> + return NULL;
> + }
> +
> + strncpy(&pdata->name[0], np->name, SPI_NAME_SIZE - 1);
> +
> + tmp = 10000;
> + of_property_read_u32(np, "adi,channel-spacing", &tmp);
> + pdata->channel_spacing = tmp;
> +
> + tmp = 0;
> + of_property_read_u32(np, "adi,power-up-frequency", &tmp);
> + pdata->power_up_frequency = tmp;
> +
> + tmp = 0;
> + of_property_read_u32(np, "adi,ref-div-factor", &tmp);
> + pdata->ref_div_factor = tmp;
> +
> + ret = of_property_read_u32(np, "adi,gpio-lock-detect",
> + &pdata->gpio_lock_detect);
> + if (ret < 0)
> + pdata->gpio_lock_detect = -1;
> +
> + pdata->ref_doubler_en = of_property_read_bool(np, "adi,ref-doubler-en");
> + pdata->ref_div2_en = of_property_read_bool(np, "adi,ref-div2-en");
> +
> + /* r2_user_settings */
> + pdata->r2_user_settings =
> + of_property_read_bool(np, "adi,reg2-pd-polarity-pos-en") ?
> + ADF4350_REG2_PD_POLARITY_POS : 0;
> + pdata->r2_user_settings |=
> + of_property_read_bool(np, "adi,reg2-ldp-6ns-en") ?
> + ADF4350_REG2_LDP_6ns : 0;
> + pdata->r2_user_settings |=
> + of_property_read_bool(np, "adi,reg2-ldf-int-n-en") ?
> + ADF4350_REG2_LDF_INT_N : 0;
> + tmp = 2500;
> + of_property_read_u32(np, "adi,reg2-charge-pump-curr-ua", &tmp);
> + pdata->r2_user_settings |= ADF4350_REG2_CHARGE_PUMP_CURR_uA(tmp);
> +
> + tmp = 0;
> + of_property_read_u32(np, "adi,reg2-muxout", &tmp);
> + pdata->r2_user_settings |= ADF4350_REG2_MUXOUT(tmp);
> +
> + tmp = 0;
> + of_property_read_u32(np, "adi,reg2-noise-mode", &tmp);
> + pdata->r2_user_settings |= ADF4350_REG2_NOISE_MODE(tmp);
> +
> + /* r3_user_settings */
> +
> + pdata->r3_user_settings =
> + of_property_read_bool(np, "adi,reg3-csr-en") ?
> + ADF4350_REG3_12BIT_CSR_EN : 0;
> + pdata->r3_user_settings |=
> + of_property_read_bool(np, "adi,reg3-charge-cancellation-en") ?
> + ADF4351_REG3_CHARGE_CANCELLATION_EN : 0;
> + pdata->r3_user_settings |=
> + of_property_read_bool(np, "adi,reg3-anti-backlash-3ns-en") ?
> + ADF4351_REG3_ANTI_BACKLASH_3ns_EN : 0;
> + pdata->r3_user_settings |=
> + of_property_read_bool(np,
> + "adi,reg3-band-sel-clock-mode-high-en") ?
> + ADF4351_REG3_BAND_SEL_CLOCK_MODE_HIGH : 0;
> +
> + tmp = 0;
> + of_property_read_u32(np, "adi,reg3-12bit-clkdiv", &tmp);
> + pdata->r3_user_settings |= ADF4350_REG3_12BIT_CLKDIV(tmp);
> +
> + tmp = 0;
> + of_property_read_u32(np, "adi,reg3-12bit-clkdiv-mode", &tmp);
> + pdata->r3_user_settings |= ADF4350_REG3_12BIT_CLKDIV_MODE(tmp);
> +
> + /* r4_user_settings */
> +
> + pdata->r4_user_settings =
> + of_property_read_bool(np, "adi,reg4-aux-output-en") ?
> + ADF4350_REG4_AUX_OUTPUT_EN : 0;
> + pdata->r4_user_settings |=
> + of_property_read_bool(np, "adi,reg4-aux-output-fund-en") ?
> + ADF4350_REG4_AUX_OUTPUT_FUND : 0;
> + pdata->r4_user_settings |=
> + of_property_read_bool(np, "adi,reg4-mute-till-lock-en") ?
> + ADF4350_REG4_MUTE_TILL_LOCK_EN : 0;
> + tmp = 0;
> + of_property_read_u32(np, "adi,reg4-output-pwr", &tmp);
> + pdata->r4_user_settings |= ADF4350_REG4_OUTPUT_PWR(tmp);
> +
> + tmp = 0;
> + of_property_read_u32(np, "adi,reg4-aux-output-pwr", &tmp);
> + pdata->r4_user_settings |= ADF4350_REG4_AUX_OUTPUT_PWR(tmp);
> +
> + return pdata;
> +}
> +#else
> +static
> +struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)
> +{
> + return NULL;
> +}
> +#endif
> +
> static int adf4350_probe(struct spi_device *spi)
> {
> - struct adf4350_platform_data *pdata = spi->dev.platform_data;
> + struct adf4350_platform_data *pdata;
> struct iio_dev *indio_dev;
> struct adf4350_state *st;
> struct clk *clk = NULL;
> int ret;
>
> + if (spi->dev.of_node) {
> + pdata = adf4350_parse_dt(&spi->dev);
> + if (IS_ERR(pdata))
> + return PTR_ERR(pdata);
adf4350_parse_dt() returns either NULL or a valid struct.
> + } else {
> + pdata = spi->dev.platform_data;
> + }
> +
> if (!pdata) {
> dev_warn(&spi->dev, "no platform data? using default\n");
> pdata = &default_pdata;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 4/4] iio: frequency: adf4350: Add support for dt bindings
2013-05-23 16:45 ` Lars-Peter Clausen
@ 2013-05-27 11:28 ` Michael Hennerich
0 siblings, 0 replies; 8+ messages in thread
From: Michael Hennerich @ 2013-05-27 11:28 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: jic23, linux-iio, dan.carpenter
On 05/23/2013 06:45 PM, Lars-Peter Clausen wrote:
> On 05/23/2013 05:00 PM, michael.hennerich@analog.com wrote:
>> From: Michael Hennerich <michael.hennerich@analog.com>
>>
>> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
>> ---
>> .../devicetree/bindings/iio/frequency/adf4350.txt | 84 ++++++++++++++
>> drivers/iio/frequency/adf4350.c | 122 +++++++++++++++++++-
>> 2 files changed, 205 insertions(+), 1 deletion(-)
>> create mode 100644 Documentation/devicetree/bindings/iio/frequency/adf4350.txt
>>
>> diff --git a/Documentation/devicetree/bindings/iio/frequency/adf4350.txt b/Documentation/devicetree/bindings/iio/frequency/adf4350.txt
>> new file mode 100644
>> index 0000000..ab99cfd
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/iio/frequency/adf4350.txt
>> @@ -0,0 +1,84 @@
>> +Analog Devices ADF4350/ADF4351 device driver
>> +
>> +Required properties:
>> + - compatible: Should be one of
>> + * "adi,adf4350": When using the ADF4350 device
>> + * "adi,adf4351": When using the ADF4351 device
>> + - reg: SPI chip select numbert for the device
> typo: number
Oops!
>
>> + - spi-max-frequency: Max SPI frequency to use (< 20000000)
>> + - clocks: From common clock binding. Clock is phandle to clock for
>> + ADF435x Reference Clock (CLKIN).
>> +
>> +Optional properties:
>> + - adi,channel-spacing: Channel spacing in Hz (influences MODULUS).
>> + - adi,power-up-frequency: If set in Hz the PLL tunes to
>> + the desired frequency on probe.
>> + - adi,ref-div-factor: If set the driver skips dynamic calculation
>> + and uses this default value instead.
>> + - adi,ref-doubler-en: Enables reference doubler.
>> + - adi,ref-div2-en: Enables reference divider.
>> + - adi,gpio-lock-detect: If set with a valid GPIO number, pll lock state
>> + is tested upon read.
> GPIOs are referenced by phandle plus parameter, not by GPIO number.
This slipped out - it was originally on my to-do list -
Thanks.
>
>> + - adi,reg2-pd-polarity-pos-en: Enables positive phase
>> + detector polarity. Default = negative.
>> + - adi,reg2-ldp-6ns-en: Enables 6ns lock detect precision.
>> + Default = 10ns.
>> + - adi,reg2-ldf-int-n-en: Enables lock detect for integer-N mode.
>> + Default = factional-N mode.
>> + - adi,reg2-charge-pump-curr-ua: Charge pump current in mA.
>> + Default = 2500mA.
>> + - adi,reg2-muxout: On chip multiplexer output selection.
>> + Valid values for the multiplexer output are:
>> + 0: Three-State Output (default)
>> + 1: DVDD
>> + 2: DGND
>> + 3: R-Counter output
>> + 4: N-Divider output
>> + 5: Analog lock detect
>> + 6: Digital lock detect
>> + - adi,reg2-noise-mode: Enables low noise mode. Default = Low spur mode.
>> + - adi,reg3-csr-en: Enables cycle slip reduction.
>> + - adi,reg3-charge-cancellation-en: Enabled charge pump
>> + charge cancellation for integer-N modes.
>> + - adi,reg3-anti-backlash-3ns-en: Enables 3ns antibacklash pulse width
>> + for integer-N modes.
>> + - adi,reg3-band-sel-clock-mode-high-en: Enables faster band selection logic.
>> + - adi,reg3-12bit-clkdiv: Clock divider value used when
>> + adi,reg3-12bit-clkdiv-mode != 0
>> + - adi,reg3-12bit-clkdiv-mode:
>> + Valid values for the clkdiv mode are:
>> + 0: Clock divider off (default)
>> + 1: Fast lock enable
>> + 2: Phase resync enable
>> + - adi,reg4-aux-output-en: Enables auxiliary RF output.
>> + - adi,reg4-aux-output-fund-en: Selects fundamental VCO output on the
>> + auxiliary RF output. Default = Output of RF dividers.
>> + - adi,reg4-mute-till-lock-en: Enables Mute-Till-Lock-Detect function.
>> + - adi,reg4-output-pwr: Output power selection.
>> + Valid values for the power mode are:
>> + 0: -4dBM (default)
>> + 1: -1dBM
>> + 2: +2dBM
>> + 3: +5dBM
>> + - adi,reg4-aux-output-pwr: Auxiliary output power selection.
>> + Valid values for the power mode are:
>> + 0: -4dBM (default)
>> + 1: -1dBM
>> + 2: +2dBM
>> + 3: +5dBM
>
> As I said before abbreviations in devicetree property names are kind of
> frowned upon.
I guess they are frowned upon, because they tend to confuse and makes
life harder?
> There are a lot of abbreviations used for these properties.
> Also I'm not sure whether it makes sense to include the register number in
> the property name.
The properties are optional - they are there to fine tune application
and board specific analog performance.
It is my understanding that people must read the datasheet and product
collaterals in order to use them.
Apart from the _en (enable) usage the abbreviations are mostly the ones
that the datasheet uses.
The register names are included for the same purpose - to help
identifying the property that needs to be set or not.
Thoughts?
>
>> +
>> +
>> +Example:
>> + lo_pll0_rx_adf4351: adf4351-rx-lpc@4 {
>> + compatible = "adi,adf4351";
>> + reg = <4>;
>> + spi-max-frequency = <10000000>;
>> + clocks = <&clk0_ad9523 9>;
>> + clock-names = "clkin";
>> + adi,channel-spacing = <10000>;
>> + adi,power-up-frequency = <2400000000>;
>> + adi,reg2-pd-polarity-pos-en;
>> + adi,reg2-charge-pump-curr-ua = <2500>;
>> + adi,reg4-output-pwr = <3>;
>> + adi,reg4-mute-till-lock-en;
>> + };
>> diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
>> index f6849c8..828ce3e1 100644
>> --- a/drivers/iio/frequency/adf4350.c
>> +++ b/drivers/iio/frequency/adf4350.c
>> @@ -18,6 +18,7 @@
>> #include <linux/gpio.h>
>> #include <asm/div64.h>
>> #include <linux/clk.h>
>> +#include <linux/of.h>
>>
>> #include <linux/iio/iio.h>
>> #include <linux/iio/sysfs.h>
>> @@ -375,14 +376,133 @@ static const struct iio_info adf4350_info = {
>> .driver_module = THIS_MODULE,
>> };
>>
>> +#ifdef CONFIG_OF
>> +static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)
>> +{
>> + struct device_node *np = dev->of_node;
>> + struct adf4350_platform_data *pdata;
>> + unsigned int tmp;
>> + int ret;
>> +
>> + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
>> + if (!pdata) {
>> + dev_err(dev, "could not allocate memory for platform data\n");
>> + return NULL;
>> + }
>> +
>> + strncpy(&pdata->name[0], np->name, SPI_NAME_SIZE - 1);
>> +
>> + tmp = 10000;
>> + of_property_read_u32(np, "adi,channel-spacing", &tmp);
>> + pdata->channel_spacing = tmp;
>> +
>> + tmp = 0;
>> + of_property_read_u32(np, "adi,power-up-frequency", &tmp);
>> + pdata->power_up_frequency = tmp;
>> +
>> + tmp = 0;
>> + of_property_read_u32(np, "adi,ref-div-factor", &tmp);
>> + pdata->ref_div_factor = tmp;
>> +
>> + ret = of_property_read_u32(np, "adi,gpio-lock-detect",
>> + &pdata->gpio_lock_detect);
>> + if (ret < 0)
>> + pdata->gpio_lock_detect = -1;
>> +
>> + pdata->ref_doubler_en = of_property_read_bool(np, "adi,ref-doubler-en");
>> + pdata->ref_div2_en = of_property_read_bool(np, "adi,ref-div2-en");
>> +
>> + /* r2_user_settings */
>> + pdata->r2_user_settings =
>> + of_property_read_bool(np, "adi,reg2-pd-polarity-pos-en") ?
>> + ADF4350_REG2_PD_POLARITY_POS : 0;
>> + pdata->r2_user_settings |=
>> + of_property_read_bool(np, "adi,reg2-ldp-6ns-en") ?
>> + ADF4350_REG2_LDP_6ns : 0;
>> + pdata->r2_user_settings |=
>> + of_property_read_bool(np, "adi,reg2-ldf-int-n-en") ?
>> + ADF4350_REG2_LDF_INT_N : 0;
>> + tmp = 2500;
>> + of_property_read_u32(np, "adi,reg2-charge-pump-curr-ua", &tmp);
>> + pdata->r2_user_settings |= ADF4350_REG2_CHARGE_PUMP_CURR_uA(tmp);
>> +
>> + tmp = 0;
>> + of_property_read_u32(np, "adi,reg2-muxout", &tmp);
>> + pdata->r2_user_settings |= ADF4350_REG2_MUXOUT(tmp);
>> +
>> + tmp = 0;
>> + of_property_read_u32(np, "adi,reg2-noise-mode", &tmp);
>> + pdata->r2_user_settings |= ADF4350_REG2_NOISE_MODE(tmp);
>> +
>> + /* r3_user_settings */
>> +
>> + pdata->r3_user_settings =
>> + of_property_read_bool(np, "adi,reg3-csr-en") ?
>> + ADF4350_REG3_12BIT_CSR_EN : 0;
>> + pdata->r3_user_settings |=
>> + of_property_read_bool(np, "adi,reg3-charge-cancellation-en") ?
>> + ADF4351_REG3_CHARGE_CANCELLATION_EN : 0;
>> + pdata->r3_user_settings |=
>> + of_property_read_bool(np, "adi,reg3-anti-backlash-3ns-en") ?
>> + ADF4351_REG3_ANTI_BACKLASH_3ns_EN : 0;
>> + pdata->r3_user_settings |=
>> + of_property_read_bool(np,
>> + "adi,reg3-band-sel-clock-mode-high-en") ?
>> + ADF4351_REG3_BAND_SEL_CLOCK_MODE_HIGH : 0;
>> +
>> + tmp = 0;
>> + of_property_read_u32(np, "adi,reg3-12bit-clkdiv", &tmp);
>> + pdata->r3_user_settings |= ADF4350_REG3_12BIT_CLKDIV(tmp);
>> +
>> + tmp = 0;
>> + of_property_read_u32(np, "adi,reg3-12bit-clkdiv-mode", &tmp);
>> + pdata->r3_user_settings |= ADF4350_REG3_12BIT_CLKDIV_MODE(tmp);
>> +
>> + /* r4_user_settings */
>> +
>> + pdata->r4_user_settings =
>> + of_property_read_bool(np, "adi,reg4-aux-output-en") ?
>> + ADF4350_REG4_AUX_OUTPUT_EN : 0;
>> + pdata->r4_user_settings |=
>> + of_property_read_bool(np, "adi,reg4-aux-output-fund-en") ?
>> + ADF4350_REG4_AUX_OUTPUT_FUND : 0;
>> + pdata->r4_user_settings |=
>> + of_property_read_bool(np, "adi,reg4-mute-till-lock-en") ?
>> + ADF4350_REG4_MUTE_TILL_LOCK_EN : 0;
>> + tmp = 0;
>> + of_property_read_u32(np, "adi,reg4-output-pwr", &tmp);
>> + pdata->r4_user_settings |= ADF4350_REG4_OUTPUT_PWR(tmp);
>> +
>> + tmp = 0;
>> + of_property_read_u32(np, "adi,reg4-aux-output-pwr", &tmp);
>> + pdata->r4_user_settings |= ADF4350_REG4_AUX_OUTPUT_PWR(tmp);
>> +
>> + return pdata;
>> +}
>> +#else
>> +static
>> +struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)
>> +{
>> + return NULL;
>> +}
>> +#endif
>> +
>> static int adf4350_probe(struct spi_device *spi)
>> {
>> - struct adf4350_platform_data *pdata = spi->dev.platform_data;
>> + struct adf4350_platform_data *pdata;
>> struct iio_dev *indio_dev;
>> struct adf4350_state *st;
>> struct clk *clk = NULL;
>> int ret;
>>
>> + if (spi->dev.of_node) {
>> + pdata = adf4350_parse_dt(&spi->dev);
>> + if (IS_ERR(pdata))
>> + return PTR_ERR(pdata);
> adf4350_parse_dt() returns either NULL or a valid struct.
I'll fix that.
>
>> + } else {
>> + pdata = spi->dev.platform_data;
>> + }
>> +
>> if (!pdata) {
>> dev_warn(&spi->dev, "no platform data? using default\n");
>> pdata = &default_pdata;
>
--
Greetings,
Michael
--
Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
Margaret Seif
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] iio: frequency: ad4350: Fix bug / typo in mask
2013-05-23 15:00 [PATCH 1/4] iio: frequency: ad4350: Fix bug / typo in mask michael.hennerich
` (2 preceding siblings ...)
2013-05-23 15:00 ` [PATCH 4/4] iio: frequency: adf4350: Add support for dt bindings michael.hennerich
@ 2013-06-02 16:10 ` Jonathan Cameron
2013-06-03 8:20 ` Michael Hennerich
3 siblings, 1 reply; 8+ messages in thread
From: Jonathan Cameron @ 2013-06-02 16:10 UTC (permalink / raw)
To: michael.hennerich; +Cc: linux-iio, dan.carpenter
On 05/23/2013 04:00 PM, michael.hennerich@analog.com wrote:
> From: Michael Hennerich <michael.hennerich@analog.com>
I got lost in the original discussion.
Is this a fix for the current cycle, or does it want to go with the
rest of the series, for the next one?
I'm guessing you'll do a refreshed version with the bits in patch
4 fixed up so I'll wait for that to apply it.
Jonathan
>
> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
> ---
> drivers/iio/frequency/adf4350.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
> index a884252..e76d4ac 100644
> --- a/drivers/iio/frequency/adf4350.c
> +++ b/drivers/iio/frequency/adf4350.c
> @@ -212,7 +212,7 @@ static int adf4350_set_freq(struct adf4350_state *st, unsigned long long freq)
> (pdata->r2_user_settings & (ADF4350_REG2_PD_POLARITY_POS |
> ADF4350_REG2_LDP_6ns | ADF4350_REG2_LDF_INT_N |
> ADF4350_REG2_CHARGE_PUMP_CURR_uA(5000) |
> - ADF4350_REG2_MUXOUT(0x7) | ADF4350_REG2_NOISE_MODE(0x9)));
> + ADF4350_REG2_MUXOUT(0x7) | ADF4350_REG2_NOISE_MODE(0x3)));
>
> st->regs[ADF4350_REG3] = pdata->r3_user_settings &
> (ADF4350_REG3_12BIT_CLKDIV(0xFFF) |
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] iio: frequency: ad4350: Fix bug / typo in mask
2013-06-02 16:10 ` [PATCH 1/4] iio: frequency: ad4350: Fix bug / typo in mask Jonathan Cameron
@ 2013-06-03 8:20 ` Michael Hennerich
0 siblings, 0 replies; 8+ messages in thread
From: Michael Hennerich @ 2013-06-03 8:20 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-iio, dan.carpenter
On 06/02/2013 06:10 PM, Jonathan Cameron wrote:
> On 05/23/2013 04:00 PM, michael.hennerich@analog.com wrote:
>> From: Michael Hennerich <michael.hennerich@analog.com>
> I got lost in the original discussion.
>
> Is this a fix for the current cycle, or does it want to go with the
> rest of the series, for the next one?
>
> I'm guessing you'll do a refreshed version with the bits in patch
> 4 fixed up so I'll wait for that to apply it.
Hi Jonathan,
I'll send out a new series shortly - 1/4 is fixing a bug -
if it can go into the current cycle that would be good.
>
> Jonathan
>> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
>> ---
>> drivers/iio/frequency/adf4350.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
>> index a884252..e76d4ac 100644
>> --- a/drivers/iio/frequency/adf4350.c
>> +++ b/drivers/iio/frequency/adf4350.c
>> @@ -212,7 +212,7 @@ static int adf4350_set_freq(struct adf4350_state *st, unsigned long long freq)
>> (pdata->r2_user_settings & (ADF4350_REG2_PD_POLARITY_POS |
>> ADF4350_REG2_LDP_6ns | ADF4350_REG2_LDF_INT_N |
>> ADF4350_REG2_CHARGE_PUMP_CURR_uA(5000) |
>> - ADF4350_REG2_MUXOUT(0x7) | ADF4350_REG2_NOISE_MODE(0x9)));
>> + ADF4350_REG2_MUXOUT(0x7) | ADF4350_REG2_NOISE_MODE(0x3)));
>>
>> st->regs[ADF4350_REG3] = pdata->r3_user_settings &
>> (ADF4350_REG3_12BIT_CLKDIV(0xFFF) |
>>
--
Greetings,
Michael
--
Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
Margaret Seif
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-06-03 8:25 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-23 15:00 [PATCH 1/4] iio: frequency: ad4350: Fix bug / typo in mask michael.hennerich
2013-05-23 15:00 ` [PATCH 2/4] iio: frequency: adf4350: cast value to unsigned to make code checkers happy michael.hennerich
2013-05-23 15:00 ` [PATCH 3/4] iio: frequency: adf4350: Add support for clock consumer framework michael.hennerich
2013-05-23 15:00 ` [PATCH 4/4] iio: frequency: adf4350: Add support for dt bindings michael.hennerich
2013-05-23 16:45 ` Lars-Peter Clausen
2013-05-27 11:28 ` Michael Hennerich
2013-06-02 16:10 ` [PATCH 1/4] iio: frequency: ad4350: Fix bug / typo in mask Jonathan Cameron
2013-06-03 8:20 ` Michael Hennerich
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).