Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1586746 > unrolled thread

[PATCH 0/2] drivers: pwm: add pwm support for sama5d2

Started byClaudiu Beznea <claudiu.beznea@microchip.com>
First post2017-02-23 09:50 +0100
Last post2017-02-27 16:30 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] drivers: pwm: add pwm support for sama5d2 Claudiu Beznea <claudiu.beznea@microchip.com> - 2017-02-23 09:50 +0100
    [PATCH 1/2] drivers: pwm: pwm-atmel: add support for pwm on sama5d2 Claudiu Beznea <claudiu.beznea@microchip.com> - 2017-02-23 09:50 +0100
      Re: [PATCH 1/2] drivers: pwm: pwm-atmel: add support for pwm on  sama5d2 Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-02-23 10:20 +0100
        Re: [PATCH 1/2] drivers: pwm: pwm-atmel: add support for pwm on  sama5d2 m18063 <Claudiu.Beznea@microchip.com> - 2017-02-27 16:30 +0100

#1586746 — [PATCH 0/2] drivers: pwm: add pwm support for sama5d2

FromClaudiu Beznea <claudiu.beznea@microchip.com>
Date2017-02-23 09:50 +0100
Subject[PATCH 0/2] drivers: pwm: add pwm support for sama5d2
Message-ID<tdXg6-7i8-25@gated-at.bofh.it>
Extend atmel-pwm driver in order to support sama5d2 pwm
specifics. Since the new SoC supports changing of pwm
parameters (period and duty factor) without need to first
disable/enable the pwm channel this series adapt the
existing code in order to let changing of these parameters
for sama5d2.

Claudiu Beznea (2):
  drivers: pwm: pwm-atmel: add support for pwm on sama5d2
  drivers: pwm: pwm-atmel: add support to allow run time changing of
    pwm parameters

 .../devicetree/bindings/pwm/atmel-pwm.txt          |  1 +
 drivers/pwm/pwm-atmel.c                            | 40 ++++++++++++++++++----
 2 files changed, 35 insertions(+), 6 deletions(-)

-- 
2.7.4

[toc] | [next] | [standalone]


#1586747 — [PATCH 1/2] drivers: pwm: pwm-atmel: add support for pwm on sama5d2

FromClaudiu Beznea <claudiu.beznea@microchip.com>
Date2017-02-23 09:50 +0100
Subject[PATCH 1/2] drivers: pwm: pwm-atmel: add support for pwm on sama5d2
Message-ID<tdXg7-7i8-37@gated-at.bofh.it>
In reply to#1586746
Enable PWM on sama5d2 by adding atmel_pwm_config_v3().
This, simply, sets the period and duty factor registers.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 Documentation/devicetree/bindings/pwm/atmel-pwm.txt |  1 +
 drivers/pwm/pwm-atmel.c                             | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/Documentation/devicetree/bindings/pwm/atmel-pwm.txt b/Documentation/devicetree/bindings/pwm/atmel-pwm.txt
index 02331b9..c8c831d 100644
--- a/Documentation/devicetree/bindings/pwm/atmel-pwm.txt
+++ b/Documentation/devicetree/bindings/pwm/atmel-pwm.txt
@@ -4,6 +4,7 @@ Required properties:
   - compatible: should be one of:
     - "atmel,at91sam9rl-pwm"
     - "atmel,sama5d3-pwm"
+    - "atmel,sama5d2-pwm"
   - reg: physical base address and length of the controller's registers
   - #pwm-cells: Should be 3. See pwm.txt in this directory for a
     description of the cells format.
diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
index 0e4bd4e..4406639 100644
--- a/drivers/pwm/pwm-atmel.c
+++ b/drivers/pwm/pwm-atmel.c
@@ -207,6 +207,15 @@ static void atmel_pwm_config_v2(struct pwm_chip *chip, struct pwm_device *pwm,
 	}
 }
 
+static void atmel_pwm_config_v3(struct pwm_chip *chip, struct pwm_device *pwm,
+				unsigned long dty, unsigned long prd)
+{
+	struct atmel_pwm_chip *atmel_pwm = to_atmel_pwm_chip(chip);
+
+	atmel_pwm_ch_writel(atmel_pwm, pwm->hwpwm, PWMV2_CDTY, dty);
+	atmel_pwm_ch_writel(atmel_pwm, pwm->hwpwm, PWMV2_CPRD, prd);
+}
+
 static int atmel_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm,
 				  enum pwm_polarity polarity)
 {
@@ -295,6 +304,10 @@ static const struct atmel_pwm_data atmel_pwm_data_v2 = {
 	.config = atmel_pwm_config_v2,
 };
 
+static const struct atmel_pwm_data atmel_pwm_data_v3 = {
+	.config = atmel_pwm_config_v3,
+};
+
 static const struct platform_device_id atmel_pwm_devtypes[] = {
 	{
 		.name = "at91sam9rl-pwm",
@@ -316,6 +329,9 @@ static const struct of_device_id atmel_pwm_dt_ids[] = {
 		.compatible = "atmel,sama5d3-pwm",
 		.data = &atmel_pwm_data_v2,
 	}, {
+		.compatible = "atmel,sama5d2-pwm",
+		.data = &atmel_pwm_data_v3,
+	}, {
 		/* sentinel */
 	},
 };
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1586763 — Re: [PATCH 1/2] drivers: pwm: pwm-atmel: add support for pwm on sama5d2

FromAlexandre Belloni <alexandre.belloni@free-electrons.com>
Date2017-02-23 10:20 +0100
SubjectRe: [PATCH 1/2] drivers: pwm: pwm-atmel: add support for pwm on sama5d2
Message-ID<tdXJ7-7Ko-3@gated-at.bofh.it>
In reply to#1586747
On 23/02/2017 at 10:38:39 +0200, Claudiu Beznea wrote:
> Enable PWM on sama5d2 by adding atmel_pwm_config_v3().
> This, simply, sets the period and duty factor registers.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
>  Documentation/devicetree/bindings/pwm/atmel-pwm.txt |  1 +
>  drivers/pwm/pwm-atmel.c                             | 16 ++++++++++++++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/pwm/atmel-pwm.txt b/Documentation/devicetree/bindings/pwm/atmel-pwm.txt
> index 02331b9..c8c831d 100644
> --- a/Documentation/devicetree/bindings/pwm/atmel-pwm.txt
> +++ b/Documentation/devicetree/bindings/pwm/atmel-pwm.txt
> @@ -4,6 +4,7 @@ Required properties:
>    - compatible: should be one of:
>      - "atmel,at91sam9rl-pwm"
>      - "atmel,sama5d3-pwm"
> +    - "atmel,sama5d2-pwm"
>    - reg: physical base address and length of the controller's registers
>    - #pwm-cells: Should be 3. See pwm.txt in this directory for a
>      description of the cells format.
> diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
> index 0e4bd4e..4406639 100644
> --- a/drivers/pwm/pwm-atmel.c
> +++ b/drivers/pwm/pwm-atmel.c
> @@ -207,6 +207,15 @@ static void atmel_pwm_config_v2(struct pwm_chip *chip, struct pwm_device *pwm,
>  	}
>  }
>  
> +static void atmel_pwm_config_v3(struct pwm_chip *chip, struct pwm_device *pwm,
> +				unsigned long dty, unsigned long prd)
> +{
> +	struct atmel_pwm_chip *atmel_pwm = to_atmel_pwm_chip(chip);
> +
> +	atmel_pwm_ch_writel(atmel_pwm, pwm->hwpwm, PWMV2_CDTY, dty);
> +	atmel_pwm_ch_writel(atmel_pwm, pwm->hwpwm, PWMV2_CPRD, prd);
> +}
> +
>  static int atmel_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm,
>  				  enum pwm_polarity polarity)
>  {
> @@ -295,6 +304,10 @@ static const struct atmel_pwm_data atmel_pwm_data_v2 = {
>  	.config = atmel_pwm_config_v2,
>  };
>  
> +static const struct atmel_pwm_data atmel_pwm_data_v3 = {
> +	.config = atmel_pwm_config_v3,
> +};
> +
>  static const struct platform_device_id atmel_pwm_devtypes[] = {
>  	{
>  		.name = "at91sam9rl-pwm",
> @@ -316,6 +329,9 @@ static const struct of_device_id atmel_pwm_dt_ids[] = {
>  		.compatible = "atmel,sama5d3-pwm",
>  		.data = &atmel_pwm_data_v2,
>  	}, {
> +		.compatible = "atmel,sama5d2-pwm",
> +		.data = &atmel_pwm_data_v3,
> +	}, {
>  		/* sentinel */
>  	},
>  };
> -- 
> 2.7.4
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[toc] | [prev] | [next] | [standalone]


#1588757 — Re: [PATCH 1/2] drivers: pwm: pwm-atmel: add support for pwm on sama5d2

Fromm18063 <Claudiu.Beznea@microchip.com>
Date2017-02-27 16:30 +0100
SubjectRe: [PATCH 1/2] drivers: pwm: pwm-atmel: add support for pwm on sama5d2
Message-ID<tfvpp-7rK-49@gated-at.bofh.it>
In reply to#1586763
Hi,
Please ignore this patch also. I will resend it after
switching to atomic PWM.

Thank you,
Claudiu Beznea


On 23.02.2017 11:16, Alexandre Belloni wrote:
> On 23/02/2017 at 10:38:39 +0200, Claudiu Beznea wrote:
>> Enable PWM on sama5d2 by adding atmel_pwm_config_v3().
>> This, simply, sets the period and duty factor registers.
>>
>> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
>
>> ---
>>  Documentation/devicetree/bindings/pwm/atmel-pwm.txt |  1 +
>>  drivers/pwm/pwm-atmel.c                             | 16 ++++++++++++++++
>>  2 files changed, 17 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/pwm/atmel-pwm.txt b/Documentation/devicetree/bindings/pwm/atmel-pwm.txt
>> index 02331b9..c8c831d 100644
>> --- a/Documentation/devicetree/bindings/pwm/atmel-pwm.txt
>> +++ b/Documentation/devicetree/bindings/pwm/atmel-pwm.txt
>> @@ -4,6 +4,7 @@ Required properties:
>>    - compatible: should be one of:
>>      - "atmel,at91sam9rl-pwm"
>>      - "atmel,sama5d3-pwm"
>> +    - "atmel,sama5d2-pwm"
>>    - reg: physical base address and length of the controller's registers
>>    - #pwm-cells: Should be 3. See pwm.txt in this directory for a
>>      description of the cells format.
>> diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
>> index 0e4bd4e..4406639 100644
>> --- a/drivers/pwm/pwm-atmel.c
>> +++ b/drivers/pwm/pwm-atmel.c
>> @@ -207,6 +207,15 @@ static void atmel_pwm_config_v2(struct pwm_chip *chip, struct pwm_device *pwm,
>>  	}
>>  }
>>  
>> +static void atmel_pwm_config_v3(struct pwm_chip *chip, struct pwm_device *pwm,
>> +				unsigned long dty, unsigned long prd)
>> +{
>> +	struct atmel_pwm_chip *atmel_pwm = to_atmel_pwm_chip(chip);
>> +
>> +	atmel_pwm_ch_writel(atmel_pwm, pwm->hwpwm, PWMV2_CDTY, dty);
>> +	atmel_pwm_ch_writel(atmel_pwm, pwm->hwpwm, PWMV2_CPRD, prd);
>> +}
>> +
>>  static int atmel_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm,
>>  				  enum pwm_polarity polarity)
>>  {
>> @@ -295,6 +304,10 @@ static const struct atmel_pwm_data atmel_pwm_data_v2 = {
>>  	.config = atmel_pwm_config_v2,
>>  };
>>  
>> +static const struct atmel_pwm_data atmel_pwm_data_v3 = {
>> +	.config = atmel_pwm_config_v3,
>> +};
>> +
>>  static const struct platform_device_id atmel_pwm_devtypes[] = {
>>  	{
>>  		.name = "at91sam9rl-pwm",
>> @@ -316,6 +329,9 @@ static const struct of_device_id atmel_pwm_dt_ids[] = {
>>  		.compatible = "atmel,sama5d3-pwm",
>>  		.data = &atmel_pwm_data_v2,
>>  	}, {
>> +		.compatible = "atmel,sama5d2-pwm",
>> +		.data = &atmel_pwm_data_v3,
>> +	}, {
>>  		/* sentinel */
>>  	},
>>  };
>> -- 
>> 2.7.4
>>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web