* [PATCH 0/4] Add support for STM32F4 DAC @ 2017-07-10 13:23 Fabrice Gasnier 2017-07-10 13:23 ` [PATCH 1/4] dt-bindings: iio: stm32-dac: add support for STM32F4 Fabrice Gasnier ` (3 more replies) 0 siblings, 4 replies; 11+ messages in thread From: Fabrice Gasnier @ 2017-07-10 13:23 UTC (permalink / raw) To: jic23-DgEjT+Ai2ygdnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A Cc: linux-I+IVW8TIWO2tmTQ+vhA3Yw, mark.rutland-5wv7dgnIgG8, mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, alexandre.torgue-qxv4g6HH51o, lars-Qo5EllUWu/uELgA04lAiVw, knaack.h-Mmb7MZpHnFY, pmeerw-jW+XmwGofnusTnJN9+BGXg, fabrice.gasnier-qxv4g6HH51o, benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A, benjamin.gaignard-qxv4g6HH51o, linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA Add support for STM32F4 Digital to Analog Converter variant into existing STM32 DAC driver. Introduce compatible associated with configuration data. BTW, fix error message in driver probe (minor). Fabrice Gasnier (4): dt-bindings: iio: stm32-dac: add support for STM32F4 iio: dac: stm32: fix error message iio: dac: stm32: add support for stm32f4 ARM: dts: stm32: Add DAC support on stm32f429 .../devicetree/bindings/iio/dac/st,stm32-dac.txt | 4 ++- arch/arm/boot/dts/stm32f429.dtsi | 25 ++++++++++++++ drivers/iio/dac/stm32-dac-core.c | 38 ++++++++++++++++++---- drivers/iio/dac/stm32-dac.c | 2 +- 4 files changed, 60 insertions(+), 9 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/4] dt-bindings: iio: stm32-dac: add support for STM32F4 2017-07-10 13:23 [PATCH 0/4] Add support for STM32F4 DAC Fabrice Gasnier @ 2017-07-10 13:23 ` Fabrice Gasnier [not found] ` <1499693040-12994-2-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> 2017-07-10 13:23 ` [PATCH 2/4] iio: dac: stm32: fix error message Fabrice Gasnier ` (2 subsequent siblings) 3 siblings, 1 reply; 11+ messages in thread From: Fabrice Gasnier @ 2017-07-10 13:23 UTC (permalink / raw) To: jic23, robh+dt Cc: mark.rutland, devicetree, benjamin.gaignard, lars, alexandre.torgue, linux-iio, pmeerw, linux, linux-kernel, mcoquelin.stm32, knaack.h, fabrice.gasnier, linux-arm-kernel, benjamin.gaignard Introduce new compatible to support STM32F4 DAC (Digital-To-Analog converter) variant. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> --- Documentation/devicetree/bindings/iio/dac/st,stm32-dac.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/iio/dac/st,stm32-dac.txt b/Documentation/devicetree/bindings/iio/dac/st,stm32-dac.txt index bcee71f..bf2925c 100644 --- a/Documentation/devicetree/bindings/iio/dac/st,stm32-dac.txt +++ b/Documentation/devicetree/bindings/iio/dac/st,stm32-dac.txt @@ -10,7 +10,9 @@ current. Contents of a stm32 dac root node: ----------------------------------- Required properties: -- compatible: Must be "st,stm32h7-dac-core". +- compatible: Should be one of: + "st,stm32f4-dac-core" + "st,stm32h7-dac-core" - reg: Offset and length of the device's register set. - clocks: Must contain an entry for pclk (which feeds the peripheral bus interface) -- 1.9.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
[parent not found: <1499693040-12994-2-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org>]
* Re: [PATCH 1/4] dt-bindings: iio: stm32-dac: add support for STM32F4 [not found] ` <1499693040-12994-2-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> @ 2017-07-10 20:51 ` Jonathan Cameron 2017-07-14 14:41 ` Rob Herring 1 sibling, 0 replies; 11+ messages in thread From: Jonathan Cameron @ 2017-07-10 20:51 UTC (permalink / raw) To: Fabrice Gasnier Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, linux-I+IVW8TIWO2tmTQ+vhA3Yw, mark.rutland-5wv7dgnIgG8, mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, alexandre.torgue-qxv4g6HH51o, lars-Qo5EllUWu/uELgA04lAiVw, knaack.h-Mmb7MZpHnFY, pmeerw-jW+XmwGofnusTnJN9+BGXg, benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A, benjamin.gaignard-qxv4g6HH51o, linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Mon, 10 Jul 2017 15:23:57 +0200 Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org> wrote: > Introduce new compatible to support STM32F4 DAC (Digital-To-Analog > converter) variant. > > Signed-off-by: Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org> Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to ignore it. Simple addition of a supported part so, whilst welcome review from Rob / Mark isn't really necessary I think. Jonathan > --- > Documentation/devicetree/bindings/iio/dac/st,stm32-dac.txt | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/Documentation/devicetree/bindings/iio/dac/st,stm32-dac.txt b/Documentation/devicetree/bindings/iio/dac/st,stm32-dac.txt > index bcee71f..bf2925c 100644 > --- a/Documentation/devicetree/bindings/iio/dac/st,stm32-dac.txt > +++ b/Documentation/devicetree/bindings/iio/dac/st,stm32-dac.txt > @@ -10,7 +10,9 @@ current. > Contents of a stm32 dac root node: > ----------------------------------- > Required properties: > -- compatible: Must be "st,stm32h7-dac-core". > +- compatible: Should be one of: > + "st,stm32f4-dac-core" > + "st,stm32h7-dac-core" > - reg: Offset and length of the device's register set. > - clocks: Must contain an entry for pclk (which feeds the peripheral bus > interface) ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/4] dt-bindings: iio: stm32-dac: add support for STM32F4 [not found] ` <1499693040-12994-2-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> 2017-07-10 20:51 ` Jonathan Cameron @ 2017-07-14 14:41 ` Rob Herring 1 sibling, 0 replies; 11+ messages in thread From: Rob Herring @ 2017-07-14 14:41 UTC (permalink / raw) To: Fabrice Gasnier Cc: jic23-DgEjT+Ai2ygdnm+yROfE0A, linux-I+IVW8TIWO2tmTQ+vhA3Yw, mark.rutland-5wv7dgnIgG8, mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, alexandre.torgue-qxv4g6HH51o, lars-Qo5EllUWu/uELgA04lAiVw, knaack.h-Mmb7MZpHnFY, pmeerw-jW+XmwGofnusTnJN9+BGXg, benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A, benjamin.gaignard-qxv4g6HH51o, linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Mon, Jul 10, 2017 at 03:23:57PM +0200, Fabrice Gasnier wrote: > Introduce new compatible to support STM32F4 DAC (Digital-To-Analog > converter) variant. > > Signed-off-by: Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org> > --- > Documentation/devicetree/bindings/iio/dac/st,stm32-dac.txt | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) 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] 11+ messages in thread
* [PATCH 2/4] iio: dac: stm32: fix error message 2017-07-10 13:23 [PATCH 0/4] Add support for STM32F4 DAC Fabrice Gasnier 2017-07-10 13:23 ` [PATCH 1/4] dt-bindings: iio: stm32-dac: add support for STM32F4 Fabrice Gasnier @ 2017-07-10 13:23 ` Fabrice Gasnier [not found] ` <1499693040-12994-3-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> [not found] ` <1499693040-12994-1-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> 2017-07-10 13:24 ` [PATCH 4/4] ARM: dts: stm32: Add DAC support on stm32f429 Fabrice Gasnier 3 siblings, 1 reply; 11+ messages in thread From: Fabrice Gasnier @ 2017-07-10 13:23 UTC (permalink / raw) To: jic23, robh+dt Cc: mark.rutland, devicetree, benjamin.gaignard, lars, alexandre.torgue, linux-iio, pmeerw, linux, linux-kernel, mcoquelin.stm32, knaack.h, fabrice.gasnier, linux-arm-kernel, benjamin.gaignard Fix error message, there's no 'st,dac-channel' property, but 'reg' (see https://lkml.org/lkml/2017/4/3/567). Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> --- drivers/iio/dac/stm32-dac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/dac/stm32-dac.c b/drivers/iio/dac/stm32-dac.c index 50f8ec0..c1864e8 100644 --- a/drivers/iio/dac/stm32-dac.c +++ b/drivers/iio/dac/stm32-dac.c @@ -268,7 +268,7 @@ static int stm32_dac_chan_of_init(struct iio_dev *indio_dev) break; } if (i >= ARRAY_SIZE(stm32_dac_channels)) { - dev_err(&indio_dev->dev, "Invalid st,dac-channel\n"); + dev_err(&indio_dev->dev, "Invalid reg property\n"); return -EINVAL; } -- 1.9.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
[parent not found: <1499693040-12994-3-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org>]
* Re: [PATCH 2/4] iio: dac: stm32: fix error message [not found] ` <1499693040-12994-3-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> @ 2017-07-10 20:51 ` Jonathan Cameron 0 siblings, 0 replies; 11+ messages in thread From: Jonathan Cameron @ 2017-07-10 20:51 UTC (permalink / raw) To: Fabrice Gasnier Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, linux-I+IVW8TIWO2tmTQ+vhA3Yw, mark.rutland-5wv7dgnIgG8, mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, alexandre.torgue-qxv4g6HH51o, lars-Qo5EllUWu/uELgA04lAiVw, knaack.h-Mmb7MZpHnFY, pmeerw-jW+XmwGofnusTnJN9+BGXg, benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A, benjamin.gaignard-qxv4g6HH51o, linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Mon, 10 Jul 2017 15:23:58 +0200 Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org> wrote: > Fix error message, there's no 'st,dac-channel' property, but 'reg' > (see https://lkml.org/lkml/2017/4/3/567). > > Signed-off-by: Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org> Applied. Thanks, Joanthan > --- > drivers/iio/dac/stm32-dac.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iio/dac/stm32-dac.c b/drivers/iio/dac/stm32-dac.c > index 50f8ec0..c1864e8 100644 > --- a/drivers/iio/dac/stm32-dac.c > +++ b/drivers/iio/dac/stm32-dac.c > @@ -268,7 +268,7 @@ static int stm32_dac_chan_of_init(struct iio_dev *indio_dev) > break; > } > if (i >= ARRAY_SIZE(stm32_dac_channels)) { > - dev_err(&indio_dev->dev, "Invalid st,dac-channel\n"); > + dev_err(&indio_dev->dev, "Invalid reg property\n"); > return -EINVAL; > } > -- 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] 11+ messages in thread
[parent not found: <1499693040-12994-1-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org>]
* [PATCH 3/4] iio: dac: stm32: add support for stm32f4 [not found] ` <1499693040-12994-1-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> @ 2017-07-10 13:23 ` Fabrice Gasnier [not found] ` <1499693040-12994-4-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Fabrice Gasnier @ 2017-07-10 13:23 UTC (permalink / raw) To: jic23-DgEjT+Ai2ygdnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A Cc: linux-I+IVW8TIWO2tmTQ+vhA3Yw, mark.rutland-5wv7dgnIgG8, mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, alexandre.torgue-qxv4g6HH51o, lars-Qo5EllUWu/uELgA04lAiVw, knaack.h-Mmb7MZpHnFY, pmeerw-jW+XmwGofnusTnJN9+BGXg, fabrice.gasnier-qxv4g6HH51o, benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A, benjamin.gaignard-qxv4g6HH51o, linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA This adds support for STM32F4 Digital-To-Analog converter. Add compatible configuration data to handle hfsel (not present in stm32f4). Signed-off-by: Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org> --- drivers/iio/dac/stm32-dac-core.c | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c index 75e4878..32701be 100644 --- a/drivers/iio/dac/stm32-dac-core.c +++ b/drivers/iio/dac/stm32-dac-core.c @@ -42,6 +42,14 @@ struct stm32_dac_priv { struct stm32_dac_common common; }; +/** + * struct stm32_dac_cfg - DAC configuration + * @has_hfsel: DAC has high frequency control + */ +struct stm32_dac_cfg { + bool has_hfsel; +}; + static struct stm32_dac_priv *to_stm32_dac_priv(struct stm32_dac_common *com) { return container_of(com, struct stm32_dac_priv, common); @@ -57,6 +65,7 @@ static struct stm32_dac_priv *to_stm32_dac_priv(struct stm32_dac_common *com) static int stm32_dac_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + const struct stm32_dac_cfg *cfg; struct stm32_dac_priv *priv; struct regmap *regmap; struct resource *res; @@ -69,6 +78,8 @@ static int stm32_dac_probe(struct platform_device *pdev) priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; + cfg = (const struct stm32_dac_cfg *) + of_match_device(dev->driver->of_match_table, dev)->data; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); mmio = devm_ioremap_resource(dev, res); @@ -121,12 +132,16 @@ static int stm32_dac_probe(struct platform_device *pdev) reset_control_deassert(priv->rst); } - /* When clock speed is higher than 80MHz, set HFSEL */ - priv->common.hfsel = (clk_get_rate(priv->pclk) > 80000000UL); - ret = regmap_update_bits(regmap, STM32_DAC_CR, STM32H7_DAC_CR_HFSEL, - priv->common.hfsel ? STM32H7_DAC_CR_HFSEL : 0); - if (ret) - goto err_pclk; + if (cfg && cfg->has_hfsel) { + /* When clock speed is higher than 80MHz, set HFSEL */ + priv->common.hfsel = (clk_get_rate(priv->pclk) > 80000000UL); + ret = regmap_update_bits(regmap, STM32_DAC_CR, + STM32H7_DAC_CR_HFSEL, + priv->common.hfsel ? + STM32H7_DAC_CR_HFSEL : 0); + if (ret) + goto err_pclk; + } platform_set_drvdata(pdev, &priv->common); @@ -158,8 +173,17 @@ static int stm32_dac_remove(struct platform_device *pdev) return 0; } +static const struct stm32_dac_cfg stm32h7_dac_cfg = { + .has_hfsel = true, +}; + static const struct of_device_id stm32_dac_of_match[] = { - { .compatible = "st,stm32h7-dac-core", }, + { + .compatible = "st,stm32f4-dac-core", + }, { + .compatible = "st,stm32h7-dac-core", + .data = (void *)&stm32h7_dac_cfg, + }, {}, }; MODULE_DEVICE_TABLE(of, stm32_dac_of_match); -- 1.9.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
[parent not found: <1499693040-12994-4-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org>]
* Re: [PATCH 3/4] iio: dac: stm32: add support for stm32f4 [not found] ` <1499693040-12994-4-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> @ 2017-07-10 20:54 ` Jonathan Cameron 0 siblings, 0 replies; 11+ messages in thread From: Jonathan Cameron @ 2017-07-10 20:54 UTC (permalink / raw) To: Fabrice Gasnier Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, linux-I+IVW8TIWO2tmTQ+vhA3Yw, mark.rutland-5wv7dgnIgG8, mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, alexandre.torgue-qxv4g6HH51o, lars-Qo5EllUWu/uELgA04lAiVw, knaack.h-Mmb7MZpHnFY, pmeerw-jW+XmwGofnusTnJN9+BGXg, benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A, benjamin.gaignard-qxv4g6HH51o, linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Mon, 10 Jul 2017 15:23:59 +0200 Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org> wrote: > This adds support for STM32F4 Digital-To-Analog converter. > Add compatible configuration data to handle hfsel (not present > in stm32f4). > > Signed-off-by: Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org> Hmm. I thought for a bit on whether I wanted to see data for the other part as well to act as documentation. Whilst that would have been fine, I came to the conclusion this is fine as well. Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to time out on (not sure what is going on there at the moment but 0day has been struggling for a few days!) Jonathan > --- > drivers/iio/dac/stm32-dac-core.c | 38 +++++++++++++++++++++++++++++++------- > 1 file changed, 31 insertions(+), 7 deletions(-) > > diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c > index 75e4878..32701be 100644 > --- a/drivers/iio/dac/stm32-dac-core.c > +++ b/drivers/iio/dac/stm32-dac-core.c > @@ -42,6 +42,14 @@ struct stm32_dac_priv { > struct stm32_dac_common common; > }; > > +/** > + * struct stm32_dac_cfg - DAC configuration > + * @has_hfsel: DAC has high frequency control > + */ > +struct stm32_dac_cfg { > + bool has_hfsel; > +}; > + > static struct stm32_dac_priv *to_stm32_dac_priv(struct stm32_dac_common *com) > { > return container_of(com, struct stm32_dac_priv, common); > @@ -57,6 +65,7 @@ static struct stm32_dac_priv *to_stm32_dac_priv(struct stm32_dac_common *com) > static int stm32_dac_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > + const struct stm32_dac_cfg *cfg; > struct stm32_dac_priv *priv; > struct regmap *regmap; > struct resource *res; > @@ -69,6 +78,8 @@ static int stm32_dac_probe(struct platform_device *pdev) > priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); > if (!priv) > return -ENOMEM; > + cfg = (const struct stm32_dac_cfg *) > + of_match_device(dev->driver->of_match_table, dev)->data; > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > mmio = devm_ioremap_resource(dev, res); > @@ -121,12 +132,16 @@ static int stm32_dac_probe(struct platform_device *pdev) > reset_control_deassert(priv->rst); > } > > - /* When clock speed is higher than 80MHz, set HFSEL */ > - priv->common.hfsel = (clk_get_rate(priv->pclk) > 80000000UL); > - ret = regmap_update_bits(regmap, STM32_DAC_CR, STM32H7_DAC_CR_HFSEL, > - priv->common.hfsel ? STM32H7_DAC_CR_HFSEL : 0); > - if (ret) > - goto err_pclk; > + if (cfg && cfg->has_hfsel) { > + /* When clock speed is higher than 80MHz, set HFSEL */ > + priv->common.hfsel = (clk_get_rate(priv->pclk) > 80000000UL); > + ret = regmap_update_bits(regmap, STM32_DAC_CR, > + STM32H7_DAC_CR_HFSEL, > + priv->common.hfsel ? > + STM32H7_DAC_CR_HFSEL : 0); > + if (ret) > + goto err_pclk; > + } > > platform_set_drvdata(pdev, &priv->common); > > @@ -158,8 +173,17 @@ static int stm32_dac_remove(struct platform_device *pdev) > return 0; > } > > +static const struct stm32_dac_cfg stm32h7_dac_cfg = { > + .has_hfsel = true, > +}; > + > static const struct of_device_id stm32_dac_of_match[] = { > - { .compatible = "st,stm32h7-dac-core", }, > + { > + .compatible = "st,stm32f4-dac-core", > + }, { > + .compatible = "st,stm32h7-dac-core", > + .data = (void *)&stm32h7_dac_cfg, > + }, > {}, > }; > MODULE_DEVICE_TABLE(of, stm32_dac_of_match); ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 4/4] ARM: dts: stm32: Add DAC support on stm32f429 2017-07-10 13:23 [PATCH 0/4] Add support for STM32F4 DAC Fabrice Gasnier ` (2 preceding siblings ...) [not found] ` <1499693040-12994-1-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> @ 2017-07-10 13:24 ` Fabrice Gasnier [not found] ` <1499693040-12994-5-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> 2017-07-27 7:29 ` Alexandre Torgue 3 siblings, 2 replies; 11+ messages in thread From: Fabrice Gasnier @ 2017-07-10 13:24 UTC (permalink / raw) To: jic23, robh+dt Cc: mark.rutland, devicetree, benjamin.gaignard, lars, alexandre.torgue, linux-iio, pmeerw, linux, linux-kernel, mcoquelin.stm32, knaack.h, fabrice.gasnier, linux-arm-kernel, benjamin.gaignard Add support for DAC (Digital to Analog Converter) to STM32F429. STM32F429 DAC has two output channels. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> --- arch/arm/boot/dts/stm32f429.dtsi | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi index b2a2b5c..f15f633 100644 --- a/arch/arm/boot/dts/stm32f429.dtsi +++ b/arch/arm/boot/dts/stm32f429.dtsi @@ -354,6 +354,31 @@ status = "disabled"; }; + dac: dac@40007400 { + compatible = "st,stm32f4-dac-core"; + reg = <0x40007400 0x400>; + resets = <&rcc STM32F4_APB1_RESET(DAC)>; + clocks = <&rcc 0 STM32F4_APB1_CLOCK(DAC)>; + clock-names = "pclk"; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + + dac1: dac@1 { + compatible = "st,stm32-dac"; + #io-channels-cells = <1>; + reg = <1>; + status = "disabled"; + }; + + dac2: dac@2 { + compatible = "st,stm32-dac"; + #io-channels-cells = <1>; + reg = <2>; + status = "disabled"; + }; + }; + usart7: serial@40007800 { compatible = "st,stm32-usart", "st,stm32-uart"; reg = <0x40007800 0x400>; -- 1.9.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
[parent not found: <1499693040-12994-5-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org>]
* Re: [PATCH 4/4] ARM: dts: stm32: Add DAC support on stm32f429 [not found] ` <1499693040-12994-5-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> @ 2017-07-10 20:56 ` Jonathan Cameron 0 siblings, 0 replies; 11+ messages in thread From: Jonathan Cameron @ 2017-07-10 20:56 UTC (permalink / raw) To: Fabrice Gasnier Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, linux-I+IVW8TIWO2tmTQ+vhA3Yw, mark.rutland-5wv7dgnIgG8, mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w, alexandre.torgue-qxv4g6HH51o, lars-Qo5EllUWu/uELgA04lAiVw, knaack.h-Mmb7MZpHnFY, pmeerw-jW+XmwGofnusTnJN9+BGXg, benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A, benjamin.gaignard-qxv4g6HH51o, linux-iio-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Mon, 10 Jul 2017 15:24:00 +0200 Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org> wrote: > Add support for DAC (Digital to Analog Converter) to STM32F429. > STM32F429 DAC has two output channels. > > Signed-off-by: Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org> Driver support is working it's way towards mainline, though will be next merge window now so no real rush on this one! Acked-by: Joanthan Cameron <Jonathan.Cameron-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> > --- > arch/arm/boot/dts/stm32f429.dtsi | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi > index b2a2b5c..f15f633 100644 > --- a/arch/arm/boot/dts/stm32f429.dtsi > +++ b/arch/arm/boot/dts/stm32f429.dtsi > @@ -354,6 +354,31 @@ > status = "disabled"; > }; > > + dac: dac@40007400 { > + compatible = "st,stm32f4-dac-core"; > + reg = <0x40007400 0x400>; > + resets = <&rcc STM32F4_APB1_RESET(DAC)>; > + clocks = <&rcc 0 STM32F4_APB1_CLOCK(DAC)>; > + clock-names = "pclk"; > + #address-cells = <1>; > + #size-cells = <0>; > + status = "disabled"; > + > + dac1: dac@1 { > + compatible = "st,stm32-dac"; > + #io-channels-cells = <1>; > + reg = <1>; > + status = "disabled"; > + }; > + > + dac2: dac@2 { > + compatible = "st,stm32-dac"; > + #io-channels-cells = <1>; > + reg = <2>; > + status = "disabled"; > + }; > + }; > + > usart7: serial@40007800 { > compatible = "st,stm32-usart", "st,stm32-uart"; > reg = <0x40007800 0x400>; ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/4] ARM: dts: stm32: Add DAC support on stm32f429 2017-07-10 13:24 ` [PATCH 4/4] ARM: dts: stm32: Add DAC support on stm32f429 Fabrice Gasnier [not found] ` <1499693040-12994-5-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> @ 2017-07-27 7:29 ` Alexandre Torgue 1 sibling, 0 replies; 11+ messages in thread From: Alexandre Torgue @ 2017-07-27 7:29 UTC (permalink / raw) To: Fabrice Gasnier, jic23, robh+dt Cc: mark.rutland, devicetree, benjamin.gaignard, lars, mcoquelin.stm32, linux-iio, linux, linux-kernel, pmeerw, knaack.h, linux-arm-kernel, benjamin.gaignard Hi, On 07/10/2017 03:24 PM, Fabrice Gasnier wrote: > Add support for DAC (Digital to Analog Converter) to STM32F429. > STM32F429 DAC has two output channels. > > Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> > --- > arch/arm/boot/dts/stm32f429.dtsi | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi > index b2a2b5c..f15f633 100644 > --- a/arch/arm/boot/dts/stm32f429.dtsi > +++ b/arch/arm/boot/dts/stm32f429.dtsi > @@ -354,6 +354,31 @@ > status = "disabled"; > }; > > + dac: dac@40007400 { > + compatible = "st,stm32f4-dac-core"; > + reg = <0x40007400 0x400>; > + resets = <&rcc STM32F4_APB1_RESET(DAC)>; > + clocks = <&rcc 0 STM32F4_APB1_CLOCK(DAC)>; > + clock-names = "pclk"; > + #address-cells = <1>; > + #size-cells = <0>; > + status = "disabled"; > + > + dac1: dac@1 { > + compatible = "st,stm32-dac"; > + #io-channels-cells = <1>; > + reg = <1>; > + status = "disabled"; > + }; > + > + dac2: dac@2 { > + compatible = "st,stm32-dac"; > + #io-channels-cells = <1>; > + reg = <2>; > + status = "disabled"; > + }; > + }; > + > usart7: serial@40007800 { > compatible = "st,stm32-usart", "st,stm32-uart"; > reg = <0x40007800 0x400>; > Applied on stm32-dt-for-v4.14 branch. Thanks Alex ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-07-27 7:29 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-07-10 13:23 [PATCH 0/4] Add support for STM32F4 DAC Fabrice Gasnier 2017-07-10 13:23 ` [PATCH 1/4] dt-bindings: iio: stm32-dac: add support for STM32F4 Fabrice Gasnier [not found] ` <1499693040-12994-2-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> 2017-07-10 20:51 ` Jonathan Cameron 2017-07-14 14:41 ` Rob Herring 2017-07-10 13:23 ` [PATCH 2/4] iio: dac: stm32: fix error message Fabrice Gasnier [not found] ` <1499693040-12994-3-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> 2017-07-10 20:51 ` Jonathan Cameron [not found] ` <1499693040-12994-1-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> 2017-07-10 13:23 ` [PATCH 3/4] iio: dac: stm32: add support for stm32f4 Fabrice Gasnier [not found] ` <1499693040-12994-4-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> 2017-07-10 20:54 ` Jonathan Cameron 2017-07-10 13:24 ` [PATCH 4/4] ARM: dts: stm32: Add DAC support on stm32f429 Fabrice Gasnier [not found] ` <1499693040-12994-5-git-send-email-fabrice.gasnier-qxv4g6HH51o@public.gmane.org> 2017-07-10 20:56 ` Jonathan Cameron 2017-07-27 7:29 ` Alexandre Torgue
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).