* [PATCH 01/16] ARM: at91: at91sam9g45: switch to generic PWM framework
2014-03-19 13:03 [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Alexandre Belloni
@ 2014-03-19 13:03 ` Alexandre Belloni
2014-03-19 13:03 ` [PATCH 02/16] ARM: at91: sam9m10g45ek: use generic leds_pwm driver Alexandre Belloni
` (15 subsequent siblings)
16 siblings, 0 replies; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-19 13:03 UTC (permalink / raw)
To: linux-arm-kernel
Switch to the pwm/pwm-atmel driver instead of misc/atmel_pwm
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/at91sam9g45.c | 1 +
arch/arm/mach-at91/at91sam9g45_devices.c | 11 ++---------
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 3c519a7a938f..2d3c6e1ac158 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -250,6 +250,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
CLKDEV_CON_DEV_ID(NULL, "atmel_sha", &aestdessha_clk),
CLKDEV_CON_DEV_ID(NULL, "atmel_tdes", &aestdessha_clk),
CLKDEV_CON_DEV_ID(NULL, "atmel_aes", &aestdessha_clk),
+ CLKDEV_CON_DEV_ID(NULL, "at91sam9rl-pwm", &pwm_clk),
/* more usart lookup table for DT entries */
CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck),
CLKDEV_CON_DEV_ID("usart", "fff8c000.serial", &usart0_clk),
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 87135a61357d..25ba920cbe84 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -1332,9 +1332,7 @@ static void __init at91_add_device_watchdog(void) {}
* PWM
* --------------------------------------------------------------------*/
-#if defined(CONFIG_ATMEL_PWM) || defined(CONFIG_ATMEL_PWM_MODULE)
-static u32 pwm_mask;
-
+#if IS_ENABLED(CONFIG_PWM_ATMEL)
static struct resource pwm_resources[] = {
[0] = {
.start = AT91SAM9G45_BASE_PWMC,
@@ -1349,11 +1347,8 @@ static struct resource pwm_resources[] = {
};
static struct platform_device at91sam9g45_pwm0_device = {
- .name = "atmel_pwm",
+ .name = "at91sam9rl-pwm",
.id = -1,
- .dev = {
- .platform_data = &pwm_mask,
- },
.resource = pwm_resources,
.num_resources = ARRAY_SIZE(pwm_resources),
};
@@ -1372,8 +1367,6 @@ void __init at91_add_device_pwm(u32 mask)
if (mask & (1 << AT91_PWM3))
at91_set_B_periph(AT91_PIN_PD0, 1); /* enable PWM3 */
- pwm_mask = mask;
-
platform_device_register(&at91sam9g45_pwm0_device);
}
#else
--
1.8.3.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 02/16] ARM: at91: sam9m10g45ek: use generic leds_pwm driver
2014-03-19 13:03 [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Alexandre Belloni
2014-03-19 13:03 ` [PATCH 01/16] ARM: at91: at91sam9g45: switch to generic PWM framework Alexandre Belloni
@ 2014-03-19 13:03 ` Alexandre Belloni
2014-03-19 13:03 ` [PATCH 03/16] ARM: at91: at91sam9263: switch to generic PWM framework Alexandre Belloni
` (14 subsequent siblings)
16 siblings, 0 replies; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-19 13:03 UTC (permalink / raw)
To: linux-arm-kernel
Switch to the generic leds_pwm driver instead of leds-atmel-pwm.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/board-sam9m10g45ek.c | 43 ++++++++++++++++++++++++++-------
1 file changed, 34 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index f2f7ce9643ce..a98e92525fdb 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -26,6 +26,8 @@
#include <linux/leds.h>
#include <linux/atmel-mci.h>
#include <linux/delay.h>
+#include <linux/pwm.h>
+#include <linux/leds_pwm.h>
#include <linux/platform_data/at91_adc.h>
@@ -415,7 +417,7 @@ static struct gpio_led ek_leds[] = {
.active_low = 1,
.default_trigger = "nand-disk",
},
-#if !(defined(CONFIG_LEDS_ATMEL_PWM) || defined(CONFIG_LEDS_ATMEL_PWM_MODULE))
+#if !IS_ENABLED(CONFIG_LEDS_PWM)
{ /* "right" led, green, userled1, pwm1 */
.name = "d7",
.gpio = AT91_PIN_PD31,
@@ -429,22 +431,42 @@ static struct gpio_led ek_leds[] = {
/*
* PWM Leds
*/
-static struct gpio_led ek_pwm_led[] = {
-#if defined(CONFIG_LEDS_ATMEL_PWM) || defined(CONFIG_LEDS_ATMEL_PWM_MODULE)
+static struct pwm_lookup pwm_lookup[] = {
+ PWM_LOOKUP("at91sam9rl-pwm", 1, "leds_pwm", "d7"),
+};
+
+#if IS_ENABLED(CONFIG_LEDS_PWM)
+static struct led_pwm pwm_leds[] = {
{ /* "right" led, green, userled1, pwm1 */
- .name = "d7",
- .gpio = 1, /* is PWM channel number */
- .active_low = 1,
- .default_trigger = "none",
+ .name = "d7",
+ .max_brightness = 255,
+ .pwm_period_ns = 5000,
+ .active_low = 1,
},
-#endif
};
+static struct led_pwm_platform_data pwm_data = {
+ .num_leds = ARRAY_SIZE(pwm_leds),
+ .leds = pwm_leds,
+};
+
+static struct platform_device leds_pwm = {
+ .name = "leds_pwm",
+ .id = -1,
+ .dev = {
+ .platform_data = &pwm_data,
+ },
+};
+#endif
+
static struct platform_device *devices[] __initdata = {
#if defined(CONFIG_SOC_CAMERA_OV2640) || \
defined(CONFIG_SOC_CAMERA_OV2640_MODULE)
&isi_ov2640,
#endif
+#if IS_ENABLED(CONFIG_LEDS_PWM)
+ &leds_pwm,
+#endif
};
static void __init ek_board_init(void)
@@ -485,7 +507,10 @@ static void __init ek_board_init(void)
at91_add_device_ac97(&ek_ac97_data);
/* LEDs */
at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
- at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led));
+ pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
+#if IS_ENABLED(CONFIG_LEDS_PWM)
+ at91_add_device_pwm(1 << AT91_PWM1);
+#endif
/* Other platform devices */
platform_add_devices(devices, ARRAY_SIZE(devices));
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 03/16] ARM: at91: at91sam9263: switch to generic PWM framework
2014-03-19 13:03 [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Alexandre Belloni
2014-03-19 13:03 ` [PATCH 01/16] ARM: at91: at91sam9g45: switch to generic PWM framework Alexandre Belloni
2014-03-19 13:03 ` [PATCH 02/16] ARM: at91: sam9m10g45ek: use generic leds_pwm driver Alexandre Belloni
@ 2014-03-19 13:03 ` Alexandre Belloni
2014-03-19 13:03 ` [PATCH 04/16] ARM: at91: sam9263ek: use generic leds_pwm driver Alexandre Belloni
` (13 subsequent siblings)
16 siblings, 0 replies; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-19 13:03 UTC (permalink / raw)
To: linux-arm-kernel
Switch to the pwm/pwm-atmel driver instead of misc/atmel_pwm
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/at91sam9263.c | 1 +
arch/arm/mach-at91/at91sam9263_devices.c | 11 ++---------
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 37b90f4b990c..d0c2d4955cd7 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -198,6 +198,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9260.0", &twi_clk),
+ CLKDEV_CON_DEV_ID(NULL, "at91sam9rl-pwm", &pwm_clk),
/* fake hclk clock */
CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
CLKDEV_CON_ID("pioA", &pioA_clk),
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 4aeadddbc181..160acd96cdda 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -1129,9 +1129,7 @@ static void __init at91_add_device_watchdog(void) {}
* PWM
* --------------------------------------------------------------------*/
-#if defined(CONFIG_ATMEL_PWM)
-static u32 pwm_mask;
-
+#if IS_ENABLED(CONFIG_PWM_ATMEL)
static struct resource pwm_resources[] = {
[0] = {
.start = AT91SAM9263_BASE_PWMC,
@@ -1146,11 +1144,8 @@ static struct resource pwm_resources[] = {
};
static struct platform_device at91sam9263_pwm0_device = {
- .name = "atmel_pwm",
+ .name = "at91sam9rl-pwm",
.id = -1,
- .dev = {
- .platform_data = &pwm_mask,
- },
.resource = pwm_resources,
.num_resources = ARRAY_SIZE(pwm_resources),
};
@@ -1169,8 +1164,6 @@ void __init at91_add_device_pwm(u32 mask)
if (mask & (1 << AT91_PWM3))
at91_set_B_periph(AT91_PIN_PB29, 1); /* enable PWM3 */
- pwm_mask = mask;
-
platform_device_register(&at91sam9263_pwm0_device);
}
#else
--
1.8.3.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 04/16] ARM: at91: sam9263ek: use generic leds_pwm driver
2014-03-19 13:03 [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Alexandre Belloni
` (2 preceding siblings ...)
2014-03-19 13:03 ` [PATCH 03/16] ARM: at91: at91sam9263: switch to generic PWM framework Alexandre Belloni
@ 2014-03-19 13:03 ` Alexandre Belloni
2014-03-19 13:03 ` [PATCH 05/16] ARM: at91: at91sam9rl: switch to generic PWM framework Alexandre Belloni
` (12 subsequent siblings)
16 siblings, 0 replies; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-19 13:03 UTC (permalink / raw)
To: linux-arm-kernel
Switch to the generic leds_pwm driver instead of leds-atmel-pwm.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/board-sam9263ek.c | 56 ++++++++++++++++++++++++++++++------
1 file changed, 48 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 2f931915c80c..f8496868d9ba 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -32,6 +32,8 @@
#include <linux/gpio_keys.h>
#include <linux/input.h>
#include <linux/leds.h>
+#include <linux/pwm.h>
+#include <linux/leds_pwm.h>
#include <video/atmel_lcdc.h>
@@ -368,21 +370,48 @@ static struct gpio_led ek_leds[] = {
.name = "ds3",
.gpio = AT91_PIN_PB7,
.default_trigger = "heartbeat",
+ },
+#if !IS_ENABLED(CONFIG_LEDS_PWM)
+ {
+ .name = "ds1",
+ .gpio = AT91_PIN_PB8,
+ .active_low = 1,
+ .default_trigger = "none",
}
+#endif
};
/*
* PWM Leds
*/
-static struct gpio_led ek_pwm_led[] = {
- /* For now only DS1 is PWM-driven (by pwm1) */
+static struct pwm_lookup pwm_lookup[] = {
+ PWM_LOOKUP("at91sam9rl-pwm", 1, "leds_pwm", "ds1"),
+};
+
+#if IS_ENABLED(CONFIG_LEDS_PWM)
+static struct led_pwm pwm_leds[] = {
{
- .name = "ds1",
- .gpio = 1, /* is PWM channel number */
- .active_low = 1,
- .default_trigger = "none",
- }
+ .name = "ds1",
+ .max_brightness = 255,
+ .pwm_period_ns = 5000,
+ .active_low = 1,
+ },
+};
+
+static struct led_pwm_platform_data pwm_data = {
+ .num_leds = ARRAY_SIZE(pwm_leds),
+ .leds = pwm_leds,
+};
+
+static struct platform_device leds_pwm = {
+ .name = "leds_pwm",
+ .id = -1,
+ .dev = {
+ .platform_data = &pwm_data,
+ },
};
+#endif
+
/*
* CAN
@@ -402,6 +431,12 @@ static struct at91_can_data ek_can_data = {
.transceiver_switch = sam9263ek_transceiver_switch,
};
+static struct platform_device *devices[] __initdata = {
+#if IS_ENABLED(CONFIG_LEDS_PWM)
+ &leds_pwm,
+#endif
+};
+
static void __init ek_board_init(void)
{
/* Serial */
@@ -436,9 +471,14 @@ static void __init ek_board_init(void)
at91_add_device_ac97(&ek_ac97_data);
/* LEDs */
at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
- at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led));
+ pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
+#if IS_ENABLED(CONFIG_LEDS_PWM)
+ at91_add_device_pwm(1 << AT91_PWM1);
+#endif
/* CAN */
at91_add_device_can(&ek_can_data);
+ /* Other platform devices */
+ platform_add_devices(devices, ARRAY_SIZE(devices));
}
MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK")
--
1.8.3.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 05/16] ARM: at91: at91sam9rl: switch to generic PWM framework
2014-03-19 13:03 [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Alexandre Belloni
` (3 preceding siblings ...)
2014-03-19 13:03 ` [PATCH 04/16] ARM: at91: sam9263ek: use generic leds_pwm driver Alexandre Belloni
@ 2014-03-19 13:03 ` Alexandre Belloni
2014-03-19 13:03 ` [PATCH 06/16] ARM: at91: remove useless at91_pwm_leds() Alexandre Belloni
` (11 subsequent siblings)
16 siblings, 0 replies; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-19 13:03 UTC (permalink / raw)
To: linux-arm-kernel
Switch to the pwm/pwm-atmel driver instead of misc/atmel_pwm
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/at91sam9rl.c | 1 +
arch/arm/mach-at91/at91sam9rl_devices.c | 11 ++---------
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index 4d2006351d1d..bc035a9ff53c 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -199,6 +199,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
CLKDEV_CON_DEV_ID("pclk", "fffc4000.ssc", &ssc1_clk),
CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.0", &twi0_clk),
CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.1", &twi1_clk),
+ CLKDEV_CON_DEV_ID(NULL, "at91sam9rl-pwm", &pwm_clk),
CLKDEV_CON_ID("pioA", &pioA_clk),
CLKDEV_CON_ID("pioB", &pioB_clk),
CLKDEV_CON_ID("pioC", &pioC_clk),
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 9ccae034119c..a396d6d56ffe 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -797,9 +797,7 @@ static void __init at91_add_device_watchdog(void) {}
* PWM
* --------------------------------------------------------------------*/
-#if defined(CONFIG_ATMEL_PWM)
-static u32 pwm_mask;
-
+#if IS_ENABLED(CONFIG_PWM_ATMEL)
static struct resource pwm_resources[] = {
[0] = {
.start = AT91SAM9RL_BASE_PWMC,
@@ -814,11 +812,8 @@ static struct resource pwm_resources[] = {
};
static struct platform_device at91sam9rl_pwm0_device = {
- .name = "atmel_pwm",
+ .name = "at91sam9rl-pwm",
.id = -1,
- .dev = {
- .platform_data = &pwm_mask,
- },
.resource = pwm_resources,
.num_resources = ARRAY_SIZE(pwm_resources),
};
@@ -837,8 +832,6 @@ void __init at91_add_device_pwm(u32 mask)
if (mask & (1 << AT91_PWM3))
at91_set_B_periph(AT91_PIN_PD8, 1); /* enable PWM3 */
- pwm_mask = mask;
-
platform_device_register(&at91sam9rl_pwm0_device);
}
#else
--
1.8.3.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 06/16] ARM: at91: remove useless at91_pwm_leds()
2014-03-19 13:03 [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Alexandre Belloni
` (4 preceding siblings ...)
2014-03-19 13:03 ` [PATCH 05/16] ARM: at91: at91sam9rl: switch to generic PWM framework Alexandre Belloni
@ 2014-03-19 13:03 ` Alexandre Belloni
2014-03-19 13:03 ` [PATCH 07/16] PWM: atmel: allow building for AVR32 Alexandre Belloni
` (10 subsequent siblings)
16 siblings, 0 replies; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-19 13:03 UTC (permalink / raw)
To: linux-arm-kernel
Now that all at91 boards using leds-atmel-pwm switched to leds-pwm, the
at91_pwm_leds() function is not used anymore.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/board.h | 1 -
arch/arm/mach-at91/leds.c | 37 -------------------------------------
2 files changed, 38 deletions(-)
diff --git a/arch/arm/mach-at91/board.h b/arch/arm/mach-at91/board.h
index 4e773b55bc2d..836e9a537e0c 100644
--- a/arch/arm/mach-at91/board.h
+++ b/arch/arm/mach-at91/board.h
@@ -123,6 +123,5 @@ extern void __init at91_add_device_can(struct at91_can_data *data);
/* LEDs */
extern void __init at91_gpio_leds(struct gpio_led *leds, int nr);
-extern void __init at91_pwm_leds(struct gpio_led *leds, int nr);
#endif
diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c
index 3e22978b5547..684723ba24f3 100644
--- a/arch/arm/mach-at91/leds.c
+++ b/arch/arm/mach-at91/leds.c
@@ -53,40 +53,3 @@ void __init at91_gpio_leds(struct gpio_led *leds, int nr)
void __init at91_gpio_leds(struct gpio_led *leds, int nr) {}
#endif
-
-/* ------------------------------------------------------------------------- */
-
-#if defined (CONFIG_LEDS_ATMEL_PWM)
-
-/*
- * PWM Leds
- */
-
-static struct gpio_led_platform_data pwm_led_data;
-
-static struct platform_device at91_pwm_leds_device = {
- .name = "leds-atmel-pwm",
- .id = -1,
- .dev.platform_data = &pwm_led_data,
-};
-
-void __init at91_pwm_leds(struct gpio_led *leds, int nr)
-{
- int i;
- u32 pwm_mask = 0;
-
- if (!nr)
- return;
-
- for (i = 0; i < nr; i++)
- pwm_mask |= (1 << leds[i].gpio);
-
- pwm_led_data.leds = leds;
- pwm_led_data.num_leds = nr;
-
- at91_add_device_pwm(pwm_mask);
- platform_device_register(&at91_pwm_leds_device);
-}
-#else
-void __init at91_pwm_leds(struct gpio_led *leds, int nr){}
-#endif
--
1.8.3.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 07/16] PWM: atmel: allow building for AVR32
2014-03-19 13:03 [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Alexandre Belloni
` (5 preceding siblings ...)
2014-03-19 13:03 ` [PATCH 06/16] ARM: at91: remove useless at91_pwm_leds() Alexandre Belloni
@ 2014-03-19 13:03 ` Alexandre Belloni
2014-03-19 13:03 ` [PATCH 08/16] backlight: pwm_bl: set pwm polarity when using platform data Alexandre Belloni
` (9 subsequent siblings)
16 siblings, 0 replies; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-19 13:03 UTC (permalink / raw)
To: linux-arm-kernel
The Atmel PWM IP can be found on avr32 chips. This allows selecting and building
the driver on avr32.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/pwm/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index 22f2f2857b82..892dd1ab4134 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -43,7 +43,7 @@ config PWM_AB8500
config PWM_ATMEL
tristate "Atmel PWM support"
- depends on ARCH_AT91
+ depends on ARCH_AT91 || AVR32
help
Generic PWM framework driver for Atmel SoC.
--
1.8.3.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH 08/16] backlight: pwm_bl: set pwm polarity when using platform data
2014-03-19 13:03 [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Alexandre Belloni
` (6 preceding siblings ...)
2014-03-19 13:03 ` [PATCH 07/16] PWM: atmel: allow building for AVR32 Alexandre Belloni
@ 2014-03-19 13:03 ` Alexandre Belloni
2014-04-07 11:16 ` Thierry Reding
2014-03-19 13:03 ` [PATCH 09/16] avr32/at32ap: switch to the generic PWM framework Alexandre Belloni
` (8 subsequent siblings)
16 siblings, 1 reply; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-19 13:03 UTC (permalink / raw)
To: linux-arm-kernel
Set inversed polarity when .pwm_active_low is set in the platform_data. With
device tree, this is taken care of by of_pwm_xlate_with_flags(), called from
of_pwm_get().
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/video/backlight/pwm_bl.c | 8 ++++++++
include/linux/pwm_backlight.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index b75201ff46f6..ffdd3b2b2742 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -309,6 +309,14 @@ static int pwm_backlight_probe(struct platform_device *pdev)
if (data->pwm_period_ns > 0)
pwm_set_period(pb->pwm, data->pwm_period_ns);
+ /*
+ * The DT case is taking care of polarity in of_pwm_get(). For the
+ * non-DT case, set the polarity from platform data.
+ */
+ if (data->pwm_active_low)
+ if (pwm_set_polarity(pb->pwm, PWM_POLARITY_INVERSED))
+ dev_err(&pdev->dev, "impossible to invert polarity\n");
+
pb->period = pwm_get_period(pb->pwm);
pb->lth_brightness = data->lth_brightness * (pb->period / pb->scale);
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h
index 2de2e275b2cb..b924fce5c97a 100644
--- a/include/linux/pwm_backlight.h
+++ b/include/linux/pwm_backlight.h
@@ -15,6 +15,7 @@ struct platform_pwm_backlight_data {
unsigned int dft_brightness;
unsigned int lth_brightness;
unsigned int pwm_period_ns;
+ bool pwm_active_low;
unsigned int *levels;
int enable_gpio;
unsigned long enable_gpio_flags;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [PATCH 08/16] backlight: pwm_bl: set pwm polarity when using platform data
2014-03-19 13:03 ` [PATCH 08/16] backlight: pwm_bl: set pwm polarity when using platform data Alexandre Belloni
@ 2014-04-07 11:16 ` Thierry Reding
0 siblings, 0 replies; 31+ messages in thread
From: Thierry Reding @ 2014-04-07 11:16 UTC (permalink / raw)
To: linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 1410 bytes --]
On Wed, Mar 19, 2014 at 02:03:21PM +0100, Alexandre Belloni wrote:
> Set inversed polarity when .pwm_active_low is set in the platform_data. With
> device tree, this is taken care of by of_pwm_xlate_with_flags(), called from
> of_pwm_get().
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
> drivers/video/backlight/pwm_bl.c | 8 ++++++++
> include/linux/pwm_backlight.h | 1 +
> 2 files changed, 9 insertions(+)
>
> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index b75201ff46f6..ffdd3b2b2742 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -309,6 +309,14 @@ static int pwm_backlight_probe(struct platform_device *pdev)
> if (data->pwm_period_ns > 0)
> pwm_set_period(pb->pwm, data->pwm_period_ns);
>
> + /*
> + * The DT case is taking care of polarity in of_pwm_get(). For the
> + * non-DT case, set the polarity from platform data.
> + */
> + if (data->pwm_active_low)
> + if (pwm_set_polarity(pb->pwm, PWM_POLARITY_INVERSED))
> + dev_err(&pdev->dev, "impossible to invert polarity\n");
Could this perhaps be solved by adding a field to the PWM lookup table
that's used for non-DT cases? The idea being that we can use the same
interfaces for DT and non-DT cases, so we should try to move both
towards the same representation.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH 09/16] avr32/at32ap: switch to the generic PWM framework
2014-03-19 13:03 [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Alexandre Belloni
` (7 preceding siblings ...)
2014-03-19 13:03 ` [PATCH 08/16] backlight: pwm_bl: set pwm polarity when using platform data Alexandre Belloni
@ 2014-03-19 13:03 ` Alexandre Belloni
2014-03-19 14:18 ` Hans-Christian Egtvedt
2014-03-19 13:03 ` [PATCH 10/16] avr32: MRMT: use generic leds_pwm driver Alexandre Belloni
` (7 subsequent siblings)
16 siblings, 1 reply; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-19 13:03 UTC (permalink / raw)
To: linux-arm-kernel
Switch to the pwm/pwm-atmel driver instead of misc/atmel_pwm
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/avr32/mach-at32ap/at32ap700x.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index a1f4d1e91b52..db85b5ec3351 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1553,7 +1553,7 @@ static struct resource atmel_pwm0_resource[] __initdata = {
IRQ(24),
};
static struct clk atmel_pwm0_mck = {
- .name = "pwm_clk",
+ .name = "at91sam9rl-pwm",
.parent = &pbb_clk,
.mode = pbb_clk_mode,
.get_rate = pbb_clk_get_rate,
@@ -1568,7 +1568,7 @@ struct platform_device *__init at32_add_device_pwm(u32 mask)
if (!mask)
return NULL;
- pdev = platform_device_alloc("atmel_pwm", 0);
+ pdev = platform_device_alloc("at91sam9rl-pwm", 0);
if (!pdev)
return NULL;
@@ -1576,9 +1576,6 @@ struct platform_device *__init at32_add_device_pwm(u32 mask)
ARRAY_SIZE(atmel_pwm0_resource)))
goto out_free_pdev;
- if (platform_device_add_data(pdev, &mask, sizeof(mask)))
- goto out_free_pdev;
-
pin_mask = 0;
if (mask & (1 << 0))
pin_mask |= (1 << 28);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [PATCH 09/16] avr32/at32ap: switch to the generic PWM framework
2014-03-19 13:03 ` [PATCH 09/16] avr32/at32ap: switch to the generic PWM framework Alexandre Belloni
@ 2014-03-19 14:18 ` Hans-Christian Egtvedt
2014-04-07 11:28 ` Thierry Reding
0 siblings, 1 reply; 31+ messages in thread
From: Hans-Christian Egtvedt @ 2014-03-19 14:18 UTC (permalink / raw)
To: linux-arm-kernel
Around Wed 19 Mar 2014 14:03:22 +0100 or thereabout, Alexandre Belloni wrote:
> Switch to the pwm/pwm-atmel driver instead of misc/atmel_pwm
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> ---
> arch/avr32/mach-at32ap/at32ap700x.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
> index a1f4d1e91b52..db85b5ec3351 100644
> --- a/arch/avr32/mach-at32ap/at32ap700x.c
> +++ b/arch/avr32/mach-at32ap/at32ap700x.c
> @@ -1553,7 +1553,7 @@ static struct resource atmel_pwm0_resource[] __initdata = {
> IRQ(24),
> };
> static struct clk atmel_pwm0_mck = {
> - .name = "pwm_clk",
> + .name = "at91sam9rl-pwm",
I found this a tiny bit weird, but found the matching instance in
drivers/pwm/pwm-atmel.c
IMHO it would initially have been better to call it atpwm_v1 or something
similar, more generic. But I guess that is too late to change at this point.
> .parent = &pbb_clk,
> .mode = pbb_clk_mode,
> .get_rate = pbb_clk_get_rate,
> @@ -1568,7 +1568,7 @@ struct platform_device *__init at32_add_device_pwm(u32 mask)
> if (!mask)
> return NULL;
>
> - pdev = platform_device_alloc("atmel_pwm", 0);
> + pdev = platform_device_alloc("at91sam9rl-pwm", 0);
> if (!pdev)
> return NULL;
>
> @@ -1576,9 +1576,6 @@ struct platform_device *__init at32_add_device_pwm(u32 mask)
> ARRAY_SIZE(atmel_pwm0_resource)))
> goto out_free_pdev;
>
> - if (platform_device_add_data(pdev, &mask, sizeof(mask)))
> - goto out_free_pdev;
> -
> pin_mask = 0;
> if (mask & (1 << 0))
> pin_mask |= (1 << 28);
--
mvh
Hans-Christian Egtvedt
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 09/16] avr32/at32ap: switch to the generic PWM framework
2014-03-19 14:18 ` Hans-Christian Egtvedt
@ 2014-04-07 11:28 ` Thierry Reding
0 siblings, 0 replies; 31+ messages in thread
From: Thierry Reding @ 2014-04-07 11:28 UTC (permalink / raw)
To: linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 1959 bytes --]
On Wed, Mar 19, 2014 at 03:18:20PM +0100, Hans-Christian Egtvedt wrote:
> Around Wed 19 Mar 2014 14:03:22 +0100 or thereabout, Alexandre Belloni wrote:
> > Switch to the pwm/pwm-atmel driver instead of misc/atmel_pwm
> >
> > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
>
> Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
>
> > ---
> > arch/avr32/mach-at32ap/at32ap700x.c | 7 ++-----
> > 1 file changed, 2 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
> > index a1f4d1e91b52..db85b5ec3351 100644
> > --- a/arch/avr32/mach-at32ap/at32ap700x.c
> > +++ b/arch/avr32/mach-at32ap/at32ap700x.c
> > @@ -1553,7 +1553,7 @@ static struct resource atmel_pwm0_resource[] __initdata = {
> > IRQ(24),
> > };
> > static struct clk atmel_pwm0_mck = {
> > - .name = "pwm_clk",
> > + .name = "at91sam9rl-pwm",
>
> I found this a tiny bit weird, but found the matching instance in
> drivers/pwm/pwm-atmel.c
>
> IMHO it would initially have been better to call it atpwm_v1 or something
> similar, more generic. But I guess that is too late to change at this point.
Generally when you call clk_get(dev, NULL), you'll pass in the consumer
device as "dev". Now the avr32 clock implementation compares that to the
device associated with the clock, which for the case of the PWM pwm0_mck
is the PWM controller (at32_add_device_pwm() for reference). So it seems
to be set up properly (the PWM controller is the consumer).
Also since the consumer ID isn't specified to the clk_get() call, the
name of the clock (what's being changed in the above hunk) shouldn't
matter because it won't match anyway.
Now that I look at it more closely, I wonder how clk_get(dev, NULL) can
even work on avr32, since there's no check for id == NULL and therefore
NULL will be blindly passed into strcmp() and then crash.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH 10/16] avr32: MRMT: use generic leds_pwm driver
2014-03-19 13:03 [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Alexandre Belloni
` (8 preceding siblings ...)
2014-03-19 13:03 ` [PATCH 09/16] avr32/at32ap: switch to the generic PWM framework Alexandre Belloni
@ 2014-03-19 13:03 ` Alexandre Belloni
2014-03-19 14:19 ` Hans-Christian Egtvedt
2014-03-19 13:03 ` [PATCH 11/16] avr32: merisc: " Alexandre Belloni
` (6 subsequent siblings)
16 siblings, 1 reply; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-19 13:03 UTC (permalink / raw)
To: linux-arm-kernel
Switch to the generic leds_pwm driver instead of leds-atmel-pwm.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/avr32/boards/atngw100/mrmt.c | 35 +++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/arch/avr32/boards/atngw100/mrmt.c b/arch/avr32/boards/atngw100/mrmt.c
index 1ba09e4c02b1..134e94c3d504 100644
--- a/arch/avr32/boards/atngw100/mrmt.c
+++ b/arch/avr32/boards/atngw100/mrmt.c
@@ -17,6 +17,8 @@
#include <linux/types.h>
#include <linux/fb.h>
#include <linux/leds.h>
+#include <linux/pwm.h>
+#include <linux/leds_pwm.h>
#include <linux/input.h>
#include <linux/gpio_keys.h>
#include <linux/atmel_serial.h>
@@ -155,21 +157,29 @@ static struct platform_device rmt_ts_device = {
#ifdef CONFIG_BOARD_MRMT_BL_PWM
/* PWM LEDs: LCD Backlight, etc */
-static struct gpio_led rmt_pwm_led[] = {
- /* here the "gpio" is actually a PWM channel */
- { .name = "backlight", .gpio = PWM_CH_BL, },
+static struct pwm_lookup pwm_lookup[] = {
+ PWM_LOOKUP("at91sam9rl-pwm", PWM_CH_BL, "leds_pwm", "ds1"),
};
-static struct gpio_led_platform_data rmt_pwm_led_data = {
- .num_leds = ARRAY_SIZE(rmt_pwm_led),
- .leds = rmt_pwm_led,
+static struct led_pwm pwm_leds[] = {
+ {
+ .name = "backlight",
+ .max_brightness = 255,
+ .pwm_period_ns = 5000,
+ .active_low = 1,
+ },
+};
+
+static struct led_pwm_platform_data pwm_data = {
+ .num_leds = ARRAY_SIZE(pwm_leds),
+ .leds = pwm_leds,
};
-static struct platform_device rmt_pwm_led_dev = {
- .name = "leds-atmel-pwm",
- .id = -1,
- .dev = {
- .platform_data = &rmt_pwm_led_data,
+static struct platform_device leds_pwm = {
+ .name = "leds_pwm",
+ .id = -1,
+ .dev = {
+ .platform_data = &pwm_data,
},
};
#endif
@@ -325,7 +335,8 @@ static int __init mrmt1_init(void)
#ifdef CONFIG_BOARD_MRMT_BL_PWM
/* Use PWM for Backlight controls */
at32_add_device_pwm(1 << PWM_CH_BL);
- platform_device_register(&rmt_pwm_led_dev);
+ pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
+ platform_device_register(&leds_pwm);
#else
/* Backlight always on */
udelay( 1 );
--
1.8.3.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [PATCH 10/16] avr32: MRMT: use generic leds_pwm driver
2014-03-19 13:03 ` [PATCH 10/16] avr32: MRMT: use generic leds_pwm driver Alexandre Belloni
@ 2014-03-19 14:19 ` Hans-Christian Egtvedt
0 siblings, 0 replies; 31+ messages in thread
From: Hans-Christian Egtvedt @ 2014-03-19 14:19 UTC (permalink / raw)
To: linux-arm-kernel
Around Wed 19 Mar 2014 14:03:23 +0100 or thereabout, Alexandre Belloni wrote:
> Switch to the generic leds_pwm driver instead of leds-atmel-pwm.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
I do not have this add-on board either, so I can only provide compile tests
myself.
> ---
> arch/avr32/boards/atngw100/mrmt.c | 35 +++++++++++++++++++++++------------
> 1 file changed, 23 insertions(+), 12 deletions(-)
>
> diff --git a/arch/avr32/boards/atngw100/mrmt.c b/arch/avr32/boards/atngw100/mrmt.c
> index 1ba09e4c02b1..134e94c3d504 100644
> --- a/arch/avr32/boards/atngw100/mrmt.c
> +++ b/arch/avr32/boards/atngw100/mrmt.c
> @@ -17,6 +17,8 @@
> #include <linux/types.h>
> #include <linux/fb.h>
> #include <linux/leds.h>
> +#include <linux/pwm.h>
> +#include <linux/leds_pwm.h>
> #include <linux/input.h>
> #include <linux/gpio_keys.h>
> #include <linux/atmel_serial.h>
> @@ -155,21 +157,29 @@ static struct platform_device rmt_ts_device = {
>
> #ifdef CONFIG_BOARD_MRMT_BL_PWM
> /* PWM LEDs: LCD Backlight, etc */
> -static struct gpio_led rmt_pwm_led[] = {
> - /* here the "gpio" is actually a PWM channel */
> - { .name = "backlight", .gpio = PWM_CH_BL, },
> +static struct pwm_lookup pwm_lookup[] = {
> + PWM_LOOKUP("at91sam9rl-pwm", PWM_CH_BL, "leds_pwm", "ds1"),
> };
>
> -static struct gpio_led_platform_data rmt_pwm_led_data = {
> - .num_leds = ARRAY_SIZE(rmt_pwm_led),
> - .leds = rmt_pwm_led,
> +static struct led_pwm pwm_leds[] = {
> + {
> + .name = "backlight",
> + .max_brightness = 255,
> + .pwm_period_ns = 5000,
> + .active_low = 1,
> + },
> +};
> +
> +static struct led_pwm_platform_data pwm_data = {
> + .num_leds = ARRAY_SIZE(pwm_leds),
> + .leds = pwm_leds,
> };
>
> -static struct platform_device rmt_pwm_led_dev = {
> - .name = "leds-atmel-pwm",
> - .id = -1,
> - .dev = {
> - .platform_data = &rmt_pwm_led_data,
> +static struct platform_device leds_pwm = {
> + .name = "leds_pwm",
> + .id = -1,
> + .dev = {
> + .platform_data = &pwm_data,
> },
> };
> #endif
> @@ -325,7 +335,8 @@ static int __init mrmt1_init(void)
> #ifdef CONFIG_BOARD_MRMT_BL_PWM
> /* Use PWM for Backlight controls */
> at32_add_device_pwm(1 << PWM_CH_BL);
> - platform_device_register(&rmt_pwm_led_dev);
> + pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
> + platform_device_register(&leds_pwm);
> #else
> /* Backlight always on */
> udelay( 1 );
--
mvh
Hans-Christian Egtvedt
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH 11/16] avr32: merisc: use generic leds_pwm driver
2014-03-19 13:03 [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Alexandre Belloni
` (9 preceding siblings ...)
2014-03-19 13:03 ` [PATCH 10/16] avr32: MRMT: use generic leds_pwm driver Alexandre Belloni
@ 2014-03-19 13:03 ` Alexandre Belloni
2014-03-19 14:20 ` Hans-Christian Egtvedt
2014-03-19 13:03 ` [PATCH 12/16] avr32: favr-32: use generic pwm_bl driver Alexandre Belloni
` (5 subsequent siblings)
16 siblings, 1 reply; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-19 13:03 UTC (permalink / raw)
To: linux-arm-kernel
Switch to the generic leds_pwm driver instead of leds-atmel-pwm.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/avr32/boards/merisc/setup.c | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)
diff --git a/arch/avr32/boards/merisc/setup.c b/arch/avr32/boards/merisc/setup.c
index ed137e335796..b0980c1946a7 100644
--- a/arch/avr32/boards/merisc/setup.c
+++ b/arch/avr32/boards/merisc/setup.c
@@ -22,6 +22,8 @@
#include <linux/irq.h>
#include <linux/fb.h>
#include <linux/atmel-mci.h>
+#include <linux/pwm.h>
+#include <linux/leds_pwm.h>
#include <asm/io.h>
#include <asm/setup.h>
@@ -167,24 +169,29 @@ static struct i2c_board_info __initdata i2c_info[] = {
},
};
-#ifdef CONFIG_LEDS_ATMEL_PWM
-static struct gpio_led stk_pwm_led[] = {
+#if IS_ENABLED(CONFIG_LEDS_PWM)
+static struct pwm_lookup pwm_lookup[] = {
+ PWM_LOOKUP("at91sam9rl-pwm", 0, "leds_pwm", "backlight"),
+};
+
+static struct led_pwm pwm_leds[] = {
{
.name = "backlight",
- .gpio = 0, /* PWM channel 0 (LCD backlight) */
+ .max_brightness = 255,
+ .pwm_period_ns = 5000,
},
};
-static struct gpio_led_platform_data stk_pwm_led_data = {
- .num_leds = ARRAY_SIZE(stk_pwm_led),
- .leds = stk_pwm_led,
+static struct led_pwm_platform_data pwm_data = {
+ .num_leds = ARRAY_SIZE(pwm_leds),
+ .leds = pwm_leds,
};
-static struct platform_device stk_pwm_led_dev = {
- .name = "leds-atmel-pwm",
- .id = -1,
- .dev = {
- .platform_data = &stk_pwm_led_data,
+static struct platform_device leds_pwm = {
+ .name = "leds_pwm",
+ .id = -1,
+ .dev = {
+ .platform_data = &pwm_data,
},
};
#endif
@@ -278,9 +285,10 @@ static int __init merisc_init(void)
at32_add_device_mci(0, &mci0_data);
-#ifdef CONFIG_LEDS_ATMEL_PWM
+#if IS_ENABLED(CONFIG_LEDS_PWM)
+ pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
at32_add_device_pwm((1 << 0) | (1 << 2));
- platform_device_register(&stk_pwm_led_dev);
+ platform_device_register(&leds_pwm);
#else
at32_add_device_pwm((1 << 2));
#endif
--
1.8.3.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [PATCH 11/16] avr32: merisc: use generic leds_pwm driver
2014-03-19 13:03 ` [PATCH 11/16] avr32: merisc: " Alexandre Belloni
@ 2014-03-19 14:20 ` Hans-Christian Egtvedt
0 siblings, 0 replies; 31+ messages in thread
From: Hans-Christian Egtvedt @ 2014-03-19 14:20 UTC (permalink / raw)
To: linux-arm-kernel
Around Wed 19 Mar 2014 14:03:24 +0100 or thereabout, Alexandre Belloni wrote:
> Switch to the generic leds_pwm driver instead of leds-atmel-pwm.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
I do not have this board either.
> ---
> arch/avr32/boards/merisc/setup.c | 34 +++++++++++++++++++++-------------
> 1 file changed, 21 insertions(+), 13 deletions(-)
>
> diff --git a/arch/avr32/boards/merisc/setup.c b/arch/avr32/boards/merisc/setup.c
> index ed137e335796..b0980c1946a7 100644
> --- a/arch/avr32/boards/merisc/setup.c
> +++ b/arch/avr32/boards/merisc/setup.c
> @@ -22,6 +22,8 @@
> #include <linux/irq.h>
> #include <linux/fb.h>
> #include <linux/atmel-mci.h>
> +#include <linux/pwm.h>
> +#include <linux/leds_pwm.h>
>
> #include <asm/io.h>
> #include <asm/setup.h>
> @@ -167,24 +169,29 @@ static struct i2c_board_info __initdata i2c_info[] = {
> },
> };
>
> -#ifdef CONFIG_LEDS_ATMEL_PWM
> -static struct gpio_led stk_pwm_led[] = {
> +#if IS_ENABLED(CONFIG_LEDS_PWM)
> +static struct pwm_lookup pwm_lookup[] = {
> + PWM_LOOKUP("at91sam9rl-pwm", 0, "leds_pwm", "backlight"),
> +};
> +
> +static struct led_pwm pwm_leds[] = {
> {
> .name = "backlight",
> - .gpio = 0, /* PWM channel 0 (LCD backlight) */
> + .max_brightness = 255,
> + .pwm_period_ns = 5000,
> },
> };
>
> -static struct gpio_led_platform_data stk_pwm_led_data = {
> - .num_leds = ARRAY_SIZE(stk_pwm_led),
> - .leds = stk_pwm_led,
> +static struct led_pwm_platform_data pwm_data = {
> + .num_leds = ARRAY_SIZE(pwm_leds),
> + .leds = pwm_leds,
> };
>
> -static struct platform_device stk_pwm_led_dev = {
> - .name = "leds-atmel-pwm",
> - .id = -1,
> - .dev = {
> - .platform_data = &stk_pwm_led_data,
> +static struct platform_device leds_pwm = {
> + .name = "leds_pwm",
> + .id = -1,
> + .dev = {
> + .platform_data = &pwm_data,
> },
> };
> #endif
> @@ -278,9 +285,10 @@ static int __init merisc_init(void)
>
> at32_add_device_mci(0, &mci0_data);
>
> -#ifdef CONFIG_LEDS_ATMEL_PWM
> +#if IS_ENABLED(CONFIG_LEDS_PWM)
> + pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
> at32_add_device_pwm((1 << 0) | (1 << 2));
> - platform_device_register(&stk_pwm_led_dev);
> + platform_device_register(&leds_pwm);
> #else
> at32_add_device_pwm((1 << 2));
> #endif
--
mvh
Hans-Christian Egtvedt
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH 12/16] avr32: favr-32: use generic pwm_bl driver
2014-03-19 13:03 [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Alexandre Belloni
` (10 preceding siblings ...)
2014-03-19 13:03 ` [PATCH 11/16] avr32: merisc: " Alexandre Belloni
@ 2014-03-19 13:03 ` Alexandre Belloni
2014-03-19 14:20 ` Hans-Christian Egtvedt
2014-03-19 13:03 ` [PATCH 13/16] avr32: update defconfig to use the generic PWM framework Alexandre Belloni
` (4 subsequent siblings)
16 siblings, 1 reply; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-19 13:03 UTC (permalink / raw)
To: linux-arm-kernel
Switch to the generic pwm_bl driver instead of atmel-pwm-bl.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/avr32/boards/favr-32/setup.c | 49 +++++++++++++++++++++++-------------
arch/avr32/configs/favr-32_defconfig | 6 ++---
2 files changed, 34 insertions(+), 21 deletions(-)
diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c
index 1f121497b517..391f026705a5 100644
--- a/arch/avr32/boards/favr-32/setup.c
+++ b/arch/avr32/boards/favr-32/setup.c
@@ -18,7 +18,10 @@
#include <linux/gpio.h>
#include <linux/leds.h>
#include <linux/atmel-mci.h>
-#include <linux/atmel-pwm-bl.h>
+#include <linux/pwm.h>
+#include <linux/pwm_backlight.h>
+#include <linux/regulator/fixed.h>
+#include <linux/regulator/machine.h>
#include <linux/spi/spi.h>
#include <linux/spi/ads7846.h>
@@ -33,6 +36,8 @@
#include <mach/board.h>
#include <mach/portmux.h>
+#define PWM_BL_CH 2
+
/* Oscillator frequencies. These are board-specific */
unsigned long at32_board_osc_rates[3] = {
[0] = 32768, /* 32.768 kHz on RTC osc */
@@ -227,29 +232,37 @@ void __init favr32_setup_leds(void)
platform_device_register(&favr32_led_dev);
}
-static struct atmel_pwm_bl_platform_data atmel_pwm_bl_pdata = {
- .pwm_channel = 2,
- .pwm_frequency = 200000,
- .pwm_compare_max = 345,
- .pwm_duty_max = 345,
- .pwm_duty_min = 90,
- .pwm_active_low = 1,
- .gpio_on = GPIO_PIN_PA(28),
- .on_active_low = 0,
+static struct pwm_lookup pwm_lookup[] = {
+ PWM_LOOKUP("at91sam9rl-pwm", PWM_BL_CH, "pwm-backlight.0", NULL),
};
-static struct platform_device atmel_pwm_bl_dev = {
- .name = "atmel-pwm-bl",
- .id = 0,
- .dev = {
- .platform_data = &atmel_pwm_bl_pdata,
+static struct regulator_consumer_supply fixed_power_consumers[] = {
+ REGULATOR_SUPPLY("power", "pwm-backlight.0"),
+};
+
+static struct platform_pwm_backlight_data pwm_bl_data = {
+ .enable_gpio = GPIO_PIN_PA(28),
+ .pwm_period_ns = 5000,
+ .max_brightness = 255,
+ .dft_brightness = 255,
+ .lth_brightness = 50,
+ .pwm_active_low = true,
+};
+
+static struct platform_device pwm_bl_device = {
+ .name = "pwm-backlight",
+ .dev = {
+ .platform_data = &pwm_bl_data,
},
};
static void __init favr32_setup_atmel_pwm_bl(void)
{
- platform_device_register(&atmel_pwm_bl_dev);
- at32_select_gpio(atmel_pwm_bl_pdata.gpio_on, 0);
+ pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
+ regulator_register_always_on(0, "fixed", fixed_power_consumers,
+ ARRAY_SIZE(fixed_power_consumers), 3300000);
+ platform_device_register(&pwm_bl_device);
+ at32_select_gpio(pwm_bl_data.enable_gpio, 0);
}
void __init setup_board(void)
@@ -339,7 +352,7 @@ static int __init favr32_init(void)
set_abdac_rate(at32_add_device_abdac(0, &abdac0_data));
- at32_add_device_pwm(1 << atmel_pwm_bl_pdata.pwm_channel);
+ at32_add_device_pwm(1 << PWM_BL_CH);
at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
at32_add_device_mci(0, &mci0_data);
at32_add_device_usba(0, NULL);
diff --git a/arch/avr32/configs/favr-32_defconfig b/arch/avr32/configs/favr-32_defconfig
index 07bed3f7eb5e..b3eb67dc05ac 100644
--- a/arch/avr32/configs/favr-32_defconfig
+++ b/arch/avr32/configs/favr-32_defconfig
@@ -67,7 +67,6 @@ CONFIG_MTD_PHYSMAP=y
CONFIG_BLK_DEV_LOOP=m
CONFIG_BLK_DEV_NBD=m
CONFIG_BLK_DEV_RAM=m
-CONFIG_ATMEL_PWM=m
CONFIG_ATMEL_TCLIB=y
CONFIG_ATMEL_SSC=m
CONFIG_NETDEVICES=y
@@ -108,7 +107,7 @@ CONFIG_FB=y
CONFIG_FB_ATMEL=y
CONFIG_BACKLIGHT_LCD_SUPPORT=y
# CONFIG_LCD_CLASS_DEVICE is not set
-CONFIG_BACKLIGHT_ATMEL_PWM=m
+CONFIG_BACKLIGHT_PWM=m
CONFIG_SOUND=m
CONFIG_SOUND_PRIME=m
# CONFIG_HID_SUPPORT is not set
@@ -123,7 +122,6 @@ CONFIG_MMC=y
CONFIG_MMC_ATMELMCI=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
-CONFIG_LEDS_ATMEL_PWM=m
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=y
@@ -132,6 +130,8 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_AT32AP700X=y
CONFIG_DMADEVICES=y
+CONFIG_PWM=y
+CONFIG_PWM_ATMEL=y
CONFIG_EXT2_FS=y
CONFIG_EXT3_FS=y
# CONFIG_EXT3_FS_XATTR is not set
--
1.8.3.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [PATCH 12/16] avr32: favr-32: use generic pwm_bl driver
2014-03-19 13:03 ` [PATCH 12/16] avr32: favr-32: use generic pwm_bl driver Alexandre Belloni
@ 2014-03-19 14:20 ` Hans-Christian Egtvedt
0 siblings, 0 replies; 31+ messages in thread
From: Hans-Christian Egtvedt @ 2014-03-19 14:20 UTC (permalink / raw)
To: linux-arm-kernel
Around Wed 19 Mar 2014 14:03:25 +0100 or thereabout, Alexandre Belloni wrote:
> Switch to the generic pwm_bl driver instead of atmel-pwm-bl.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
I do not have this board either.
> ---
> arch/avr32/boards/favr-32/setup.c | 49 +++++++++++++++++++++++-------------
> arch/avr32/configs/favr-32_defconfig | 6 ++---
> 2 files changed, 34 insertions(+), 21 deletions(-)
>
> diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c
> index 1f121497b517..391f026705a5 100644
> --- a/arch/avr32/boards/favr-32/setup.c
> +++ b/arch/avr32/boards/favr-32/setup.c
> @@ -18,7 +18,10 @@
> #include <linux/gpio.h>
> #include <linux/leds.h>
> #include <linux/atmel-mci.h>
> -#include <linux/atmel-pwm-bl.h>
> +#include <linux/pwm.h>
> +#include <linux/pwm_backlight.h>
> +#include <linux/regulator/fixed.h>
> +#include <linux/regulator/machine.h>
> #include <linux/spi/spi.h>
> #include <linux/spi/ads7846.h>
>
> @@ -33,6 +36,8 @@
> #include <mach/board.h>
> #include <mach/portmux.h>
>
> +#define PWM_BL_CH 2
> +
> /* Oscillator frequencies. These are board-specific */
> unsigned long at32_board_osc_rates[3] = {
> [0] = 32768, /* 32.768 kHz on RTC osc */
> @@ -227,29 +232,37 @@ void __init favr32_setup_leds(void)
> platform_device_register(&favr32_led_dev);
> }
>
> -static struct atmel_pwm_bl_platform_data atmel_pwm_bl_pdata = {
> - .pwm_channel = 2,
> - .pwm_frequency = 200000,
> - .pwm_compare_max = 345,
> - .pwm_duty_max = 345,
> - .pwm_duty_min = 90,
> - .pwm_active_low = 1,
> - .gpio_on = GPIO_PIN_PA(28),
> - .on_active_low = 0,
> +static struct pwm_lookup pwm_lookup[] = {
> + PWM_LOOKUP("at91sam9rl-pwm", PWM_BL_CH, "pwm-backlight.0", NULL),
> };
>
> -static struct platform_device atmel_pwm_bl_dev = {
> - .name = "atmel-pwm-bl",
> - .id = 0,
> - .dev = {
> - .platform_data = &atmel_pwm_bl_pdata,
> +static struct regulator_consumer_supply fixed_power_consumers[] = {
> + REGULATOR_SUPPLY("power", "pwm-backlight.0"),
> +};
> +
> +static struct platform_pwm_backlight_data pwm_bl_data = {
> + .enable_gpio = GPIO_PIN_PA(28),
> + .pwm_period_ns = 5000,
> + .max_brightness = 255,
> + .dft_brightness = 255,
> + .lth_brightness = 50,
> + .pwm_active_low = true,
> +};
> +
> +static struct platform_device pwm_bl_device = {
> + .name = "pwm-backlight",
> + .dev = {
> + .platform_data = &pwm_bl_data,
> },
> };
>
> static void __init favr32_setup_atmel_pwm_bl(void)
> {
> - platform_device_register(&atmel_pwm_bl_dev);
> - at32_select_gpio(atmel_pwm_bl_pdata.gpio_on, 0);
> + pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
> + regulator_register_always_on(0, "fixed", fixed_power_consumers,
> + ARRAY_SIZE(fixed_power_consumers), 3300000);
> + platform_device_register(&pwm_bl_device);
> + at32_select_gpio(pwm_bl_data.enable_gpio, 0);
> }
>
> void __init setup_board(void)
> @@ -339,7 +352,7 @@ static int __init favr32_init(void)
>
> set_abdac_rate(at32_add_device_abdac(0, &abdac0_data));
>
> - at32_add_device_pwm(1 << atmel_pwm_bl_pdata.pwm_channel);
> + at32_add_device_pwm(1 << PWM_BL_CH);
> at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
> at32_add_device_mci(0, &mci0_data);
> at32_add_device_usba(0, NULL);
> diff --git a/arch/avr32/configs/favr-32_defconfig b/arch/avr32/configs/favr-32_defconfig
> index 07bed3f7eb5e..b3eb67dc05ac 100644
> --- a/arch/avr32/configs/favr-32_defconfig
> +++ b/arch/avr32/configs/favr-32_defconfig
> @@ -67,7 +67,6 @@ CONFIG_MTD_PHYSMAP=y
> CONFIG_BLK_DEV_LOOP=m
> CONFIG_BLK_DEV_NBD=m
> CONFIG_BLK_DEV_RAM=m
> -CONFIG_ATMEL_PWM=m
> CONFIG_ATMEL_TCLIB=y
> CONFIG_ATMEL_SSC=m
> CONFIG_NETDEVICES=y
> @@ -108,7 +107,7 @@ CONFIG_FB=y
> CONFIG_FB_ATMEL=y
> CONFIG_BACKLIGHT_LCD_SUPPORT=y
> # CONFIG_LCD_CLASS_DEVICE is not set
> -CONFIG_BACKLIGHT_ATMEL_PWM=m
> +CONFIG_BACKLIGHT_PWM=m
> CONFIG_SOUND=m
> CONFIG_SOUND_PRIME=m
> # CONFIG_HID_SUPPORT is not set
> @@ -123,7 +122,6 @@ CONFIG_MMC=y
> CONFIG_MMC_ATMELMCI=y
> CONFIG_NEW_LEDS=y
> CONFIG_LEDS_CLASS=y
> -CONFIG_LEDS_ATMEL_PWM=m
> CONFIG_LEDS_GPIO=y
> CONFIG_LEDS_TRIGGERS=y
> CONFIG_LEDS_TRIGGER_TIMER=y
> @@ -132,6 +130,8 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
> CONFIG_RTC_CLASS=y
> CONFIG_RTC_DRV_AT32AP700X=y
> CONFIG_DMADEVICES=y
> +CONFIG_PWM=y
> +CONFIG_PWM_ATMEL=y
> CONFIG_EXT2_FS=y
> CONFIG_EXT3_FS=y
> # CONFIG_EXT3_FS_XATTR is not set
--
mvh
Hans-Christian Egtvedt
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH 13/16] avr32: update defconfig to use the generic PWM framework
2014-03-19 13:03 [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Alexandre Belloni
` (11 preceding siblings ...)
2014-03-19 13:03 ` [PATCH 12/16] avr32: favr-32: use generic pwm_bl driver Alexandre Belloni
@ 2014-03-19 13:03 ` Alexandre Belloni
2014-03-19 14:21 ` Hans-Christian Egtvedt
2014-03-19 13:03 ` [PATCH 14/16] backlight: atmel-pwm-bl: remove obsolete driver Alexandre Belloni
` (3 subsequent siblings)
16 siblings, 1 reply; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-19 13:03 UTC (permalink / raw)
To: linux-arm-kernel
Now that all boards have switch to the generic PWM framework, update the
defconfigs to use it.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/avr32/configs/atngw100_mrmt_defconfig | 5 +++--
arch/avr32/configs/atstk1002_defconfig | 5 +++--
arch/avr32/configs/atstk1003_defconfig | 5 +++--
arch/avr32/configs/atstk1004_defconfig | 5 +++--
arch/avr32/configs/atstk1006_defconfig | 5 +++--
arch/avr32/configs/merisc_defconfig | 5 +++--
6 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/arch/avr32/configs/atngw100_mrmt_defconfig b/arch/avr32/configs/atngw100_mrmt_defconfig
index 9a57da44eb6f..6838781e966f 100644
--- a/arch/avr32/configs/atngw100_mrmt_defconfig
+++ b/arch/avr32/configs/atngw100_mrmt_defconfig
@@ -56,7 +56,6 @@ CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_DATAFLASH=y
CONFIG_BLK_DEV_LOOP=y
-CONFIG_ATMEL_PWM=y
CONFIG_NETDEVICES=y
CONFIG_NET_ETHERNET=y
CONFIG_MACB=y
@@ -104,8 +103,8 @@ CONFIG_MMC=y
CONFIG_MMC_ATMELMCI=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
-CONFIG_LEDS_ATMEL_PWM=y
CONFIG_LEDS_GPIO=y
+CONFIG_LEDS_PWM=y
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
@@ -114,6 +113,8 @@ CONFIG_RTC_DRV_S35390A=m
CONFIG_RTC_DRV_AT32AP700X=m
CONFIG_DMADEVICES=y
CONFIG_UIO=y
+CONFIG_PWM=y
+CONFIG_PWM_ATMEL=y
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT3_FS=y
diff --git a/arch/avr32/configs/atstk1002_defconfig b/arch/avr32/configs/atstk1002_defconfig
index 2813dd2b9138..b056820eef33 100644
--- a/arch/avr32/configs/atstk1002_defconfig
+++ b/arch/avr32/configs/atstk1002_defconfig
@@ -64,7 +64,6 @@ CONFIG_BLK_DEV_LOOP=m
CONFIG_BLK_DEV_NBD=m
CONFIG_BLK_DEV_RAM=m
CONFIG_MISC_DEVICES=y
-CONFIG_ATMEL_PWM=m
CONFIG_ATMEL_TCLIB=y
CONFIG_ATMEL_SSC=m
# CONFIG_SCSI_PROC_FS is not set
@@ -133,14 +132,16 @@ CONFIG_MMC_TEST=m
CONFIG_MMC_ATMELMCI=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
-CONFIG_LEDS_ATMEL_PWM=m
CONFIG_LEDS_GPIO=m
+CONFIG_LEDS_PWM=m
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=m
CONFIG_LEDS_TRIGGER_HEARTBEAT=m
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_AT32AP700X=y
CONFIG_DMADEVICES=y
+CONFIG_PWM=y
+CONFIG_PWM_ATMEL=m
CONFIG_EXT2_FS=y
CONFIG_EXT3_FS=y
# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/avr32/configs/atstk1003_defconfig b/arch/avr32/configs/atstk1003_defconfig
index f8ff3a3baad4..0cd23a303da1 100644
--- a/arch/avr32/configs/atstk1003_defconfig
+++ b/arch/avr32/configs/atstk1003_defconfig
@@ -53,7 +53,6 @@ CONFIG_BLK_DEV_LOOP=m
CONFIG_BLK_DEV_NBD=m
CONFIG_BLK_DEV_RAM=m
CONFIG_MISC_DEVICES=y
-CONFIG_ATMEL_PWM=m
CONFIG_ATMEL_TCLIB=y
CONFIG_ATMEL_SSC=m
# CONFIG_SCSI_PROC_FS is not set
@@ -112,14 +111,16 @@ CONFIG_MMC_TEST=m
CONFIG_MMC_ATMELMCI=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
-CONFIG_LEDS_ATMEL_PWM=m
CONFIG_LEDS_GPIO=m
+CONFIG_LEDS_PWM=m
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=m
CONFIG_LEDS_TRIGGER_HEARTBEAT=m
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_AT32AP700X=y
CONFIG_DMADEVICES=y
+CONFIG_PWM=y
+CONFIG_PWM_ATMEL=m
CONFIG_EXT2_FS=y
CONFIG_EXT3_FS=y
# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/avr32/configs/atstk1004_defconfig b/arch/avr32/configs/atstk1004_defconfig
index 992228e54e38..ac1041f5f85a 100644
--- a/arch/avr32/configs/atstk1004_defconfig
+++ b/arch/avr32/configs/atstk1004_defconfig
@@ -53,7 +53,6 @@ CONFIG_BLK_DEV_LOOP=m
CONFIG_BLK_DEV_NBD=m
CONFIG_BLK_DEV_RAM=m
CONFIG_MISC_DEVICES=y
-CONFIG_ATMEL_PWM=m
CONFIG_ATMEL_TCLIB=y
CONFIG_ATMEL_SSC=m
# CONFIG_SCSI_PROC_FS is not set
@@ -111,14 +110,16 @@ CONFIG_MMC_TEST=m
CONFIG_MMC_ATMELMCI=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
-CONFIG_LEDS_ATMEL_PWM=m
CONFIG_LEDS_GPIO=m
+CONFIG_LEDS_PWM=m
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=m
CONFIG_LEDS_TRIGGER_HEARTBEAT=m
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_AT32AP700X=y
CONFIG_DMADEVICES=y
+CONFIG_PWM=y
+CONFIG_PWM_ATMEL=m
CONFIG_EXT2_FS=y
CONFIG_EXT3_FS=y
# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/avr32/configs/atstk1006_defconfig b/arch/avr32/configs/atstk1006_defconfig
index b8e698b0d1fa..ea4f670cb995 100644
--- a/arch/avr32/configs/atstk1006_defconfig
+++ b/arch/avr32/configs/atstk1006_defconfig
@@ -67,7 +67,6 @@ CONFIG_BLK_DEV_LOOP=m
CONFIG_BLK_DEV_NBD=m
CONFIG_BLK_DEV_RAM=m
CONFIG_MISC_DEVICES=y
-CONFIG_ATMEL_PWM=m
CONFIG_ATMEL_TCLIB=y
CONFIG_ATMEL_SSC=m
# CONFIG_SCSI_PROC_FS is not set
@@ -136,14 +135,16 @@ CONFIG_MMC_TEST=m
CONFIG_MMC_ATMELMCI=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
-CONFIG_LEDS_ATMEL_PWM=m
CONFIG_LEDS_GPIO=m
+CONFIG_LEDS_PWM=m
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=m
CONFIG_LEDS_TRIGGER_HEARTBEAT=m
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_AT32AP700X=y
CONFIG_DMADEVICES=y
+CONFIG_PWM=y
+CONFIG_PWM_ATMEL=m
CONFIG_EXT2_FS=y
CONFIG_EXT3_FS=y
# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/avr32/configs/merisc_defconfig b/arch/avr32/configs/merisc_defconfig
index 91df6b2986be..b9ef4cc85d08 100644
--- a/arch/avr32/configs/merisc_defconfig
+++ b/arch/avr32/configs/merisc_defconfig
@@ -55,7 +55,6 @@ CONFIG_MTD_ABSENT=y
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_BLOCK2MTD=y
CONFIG_BLK_DEV_LOOP=y
-CONFIG_ATMEL_PWM=y
CONFIG_ATMEL_SSC=y
CONFIG_SCSI=y
CONFIG_BLK_DEV_SD=y
@@ -103,12 +102,14 @@ CONFIG_MMC=y
CONFIG_MMC_ATMELMCI=y
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
-CONFIG_LEDS_ATMEL_PWM=y
+CONFIG_LEDS_PWM=y
CONFIG_RTC_CLASS=y
# CONFIG_RTC_HCTOSYS is not set
CONFIG_RTC_DRV_PCF8563=y
CONFIG_DMADEVICES=y
CONFIG_UIO=y
+CONFIG_PWM=y
+CONFIG_PWM_ATMEL=m
CONFIG_EXT2_FS=y
# CONFIG_DNOTIFY is not set
CONFIG_FUSE_FS=y
--
1.8.3.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [PATCH 13/16] avr32: update defconfig to use the generic PWM framework
2014-03-19 13:03 ` [PATCH 13/16] avr32: update defconfig to use the generic PWM framework Alexandre Belloni
@ 2014-03-19 14:21 ` Hans-Christian Egtvedt
0 siblings, 0 replies; 31+ messages in thread
From: Hans-Christian Egtvedt @ 2014-03-19 14:21 UTC (permalink / raw)
To: linux-arm-kernel
Around Wed 19 Mar 2014 14:03:26 +0100 or thereabout, Alexandre Belloni wrote:
> Now that all boards have switch to the generic PWM framework, update the
> defconfigs to use it.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> ---
> arch/avr32/configs/atngw100_mrmt_defconfig | 5 +++--
> arch/avr32/configs/atstk1002_defconfig | 5 +++--
> arch/avr32/configs/atstk1003_defconfig | 5 +++--
> arch/avr32/configs/atstk1004_defconfig | 5 +++--
> arch/avr32/configs/atstk1006_defconfig | 5 +++--
> arch/avr32/configs/merisc_defconfig | 5 +++--
> 6 files changed, 18 insertions(+), 12 deletions(-)
<snipp diff>
--
mvh
Hans-Christian Egtvedt
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH 14/16] backlight: atmel-pwm-bl: remove obsolete driver
2014-03-19 13:03 [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Alexandre Belloni
` (12 preceding siblings ...)
2014-03-19 13:03 ` [PATCH 13/16] avr32: update defconfig to use the generic PWM framework Alexandre Belloni
@ 2014-03-19 13:03 ` Alexandre Belloni
2014-03-19 14:22 ` Hans-Christian Egtvedt
2014-03-19 13:03 ` [PATCH 15/16] leds: atmel-pwm: " Alexandre Belloni
` (2 subsequent siblings)
16 siblings, 1 reply; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-19 13:03 UTC (permalink / raw)
To: linux-arm-kernel
The atmel-pwm-bl driver is now obsolete. It is not used by any mainlined boards
and is replaced by the generic pwm_bl with the pawm-atmel driver using the
generic PWM framework.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/video/backlight/Kconfig | 11 --
drivers/video/backlight/Makefile | 1 -
drivers/video/backlight/atmel-pwm-bl.c | 223 ---------------------------------
include/linux/atmel-pwm-bl.h | 43 -------
4 files changed, 278 deletions(-)
delete mode 100644 drivers/video/backlight/atmel-pwm-bl.c
delete mode 100644 include/linux/atmel-pwm-bl.h
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2ecb525..9bd32b7a7561 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -178,17 +178,6 @@ config BACKLIGHT_ATMEL_LCDC
If in doubt, it's safe to enable this option; it doesn't kick
in unless the board's description says it's wired that way.
-config BACKLIGHT_ATMEL_PWM
- tristate "Atmel PWM backlight control"
- depends on ATMEL_PWM
- help
- Say Y here if you want to use the PWM peripheral in Atmel AT91 and
- AVR32 devices. This driver will need additional platform data to know
- which PWM instance to use and how to configure it.
-
- To compile this driver as a module, choose M here: the module will be
- called atmel-pwm-bl.
-
config BACKLIGHT_EP93XX
tristate "Cirrus EP93xx Backlight Driver"
depends on FB_EP93XX
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb820024f346..351451dbb607 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -25,7 +25,6 @@ obj-$(CONFIG_BACKLIGHT_ADP8860) += adp8860_bl.o
obj-$(CONFIG_BACKLIGHT_ADP8870) += adp8870_bl.o
obj-$(CONFIG_BACKLIGHT_APPLE) += apple_bl.o
obj-$(CONFIG_BACKLIGHT_AS3711) += as3711_bl.o
-obj-$(CONFIG_BACKLIGHT_ATMEL_PWM) += atmel-pwm-bl.o
obj-$(CONFIG_BACKLIGHT_BD6107) += bd6107.o
obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o
obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o
diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c
deleted file mode 100644
index 261b1a4ec3d8..000000000000
--- a/drivers/video/backlight/atmel-pwm-bl.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (C) 2008 Atmel Corporation
- *
- * Backlight driver using Atmel PWM peripheral.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/fb.h>
-#include <linux/gpio.h>
-#include <linux/backlight.h>
-#include <linux/atmel_pwm.h>
-#include <linux/atmel-pwm-bl.h>
-#include <linux/slab.h>
-
-struct atmel_pwm_bl {
- const struct atmel_pwm_bl_platform_data *pdata;
- struct backlight_device *bldev;
- struct platform_device *pdev;
- struct pwm_channel pwmc;
- int gpio_on;
-};
-
-static void atmel_pwm_bl_set_gpio_on(struct atmel_pwm_bl *pwmbl, int on)
-{
- if (!gpio_is_valid(pwmbl->gpio_on))
- return;
-
- gpio_set_value(pwmbl->gpio_on, on ^ pwmbl->pdata->on_active_low);
-}
-
-static int atmel_pwm_bl_set_intensity(struct backlight_device *bd)
-{
- struct atmel_pwm_bl *pwmbl = bl_get_data(bd);
- int intensity = bd->props.brightness;
- int pwm_duty;
-
- if (bd->props.power != FB_BLANK_UNBLANK)
- intensity = 0;
- if (bd->props.fb_blank != FB_BLANK_UNBLANK)
- intensity = 0;
-
- if (pwmbl->pdata->pwm_active_low)
- pwm_duty = pwmbl->pdata->pwm_duty_min + intensity;
- else
- pwm_duty = pwmbl->pdata->pwm_duty_max - intensity;
-
- if (pwm_duty > pwmbl->pdata->pwm_duty_max)
- pwm_duty = pwmbl->pdata->pwm_duty_max;
- if (pwm_duty < pwmbl->pdata->pwm_duty_min)
- pwm_duty = pwmbl->pdata->pwm_duty_min;
-
- if (!intensity) {
- atmel_pwm_bl_set_gpio_on(pwmbl, 0);
- pwm_channel_writel(&pwmbl->pwmc, PWM_CUPD, pwm_duty);
- pwm_channel_disable(&pwmbl->pwmc);
- } else {
- pwm_channel_enable(&pwmbl->pwmc);
- pwm_channel_writel(&pwmbl->pwmc, PWM_CUPD, pwm_duty);
- atmel_pwm_bl_set_gpio_on(pwmbl, 1);
- }
-
- return 0;
-}
-
-static int atmel_pwm_bl_get_intensity(struct backlight_device *bd)
-{
- struct atmel_pwm_bl *pwmbl = bl_get_data(bd);
- u32 cdty;
- u32 intensity;
-
- cdty = pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY);
- if (pwmbl->pdata->pwm_active_low)
- intensity = cdty - pwmbl->pdata->pwm_duty_min;
- else
- intensity = pwmbl->pdata->pwm_duty_max - cdty;
-
- return intensity & 0xffff;
-}
-
-static int atmel_pwm_bl_init_pwm(struct atmel_pwm_bl *pwmbl)
-{
- unsigned long pwm_rate = pwmbl->pwmc.mck;
- unsigned long prescale = DIV_ROUND_UP(pwm_rate,
- (pwmbl->pdata->pwm_frequency *
- pwmbl->pdata->pwm_compare_max)) - 1;
-
- /*
- * Prescale must be power of two and maximum 0xf in size because of
- * hardware limit. PWM speed will be:
- * PWM module clock speed / (2 ^ prescale).
- */
- prescale = fls(prescale);
- if (prescale > 0xf)
- prescale = 0xf;
-
- pwm_channel_writel(&pwmbl->pwmc, PWM_CMR, prescale);
- pwm_channel_writel(&pwmbl->pwmc, PWM_CDTY,
- pwmbl->pdata->pwm_duty_min +
- pwmbl->bldev->props.brightness);
- pwm_channel_writel(&pwmbl->pwmc, PWM_CPRD,
- pwmbl->pdata->pwm_compare_max);
-
- dev_info(&pwmbl->pdev->dev, "Atmel PWM backlight driver (%lu Hz)\n",
- pwmbl->pwmc.mck / pwmbl->pdata->pwm_compare_max /
- (1 << prescale));
-
- return pwm_channel_enable(&pwmbl->pwmc);
-}
-
-static const struct backlight_ops atmel_pwm_bl_ops = {
- .get_brightness = atmel_pwm_bl_get_intensity,
- .update_status = atmel_pwm_bl_set_intensity,
-};
-
-static int atmel_pwm_bl_probe(struct platform_device *pdev)
-{
- struct backlight_properties props;
- const struct atmel_pwm_bl_platform_data *pdata;
- struct backlight_device *bldev;
- struct atmel_pwm_bl *pwmbl;
- unsigned long flags;
- int retval;
-
- pdata = dev_get_platdata(&pdev->dev);
- if (!pdata)
- return -ENODEV;
-
- if (pdata->pwm_compare_max < pdata->pwm_duty_max ||
- pdata->pwm_duty_min > pdata->pwm_duty_max ||
- pdata->pwm_frequency = 0)
- return -EINVAL;
-
- pwmbl = devm_kzalloc(&pdev->dev, sizeof(struct atmel_pwm_bl),
- GFP_KERNEL);
- if (!pwmbl)
- return -ENOMEM;
-
- pwmbl->pdev = pdev;
- pwmbl->pdata = pdata;
- pwmbl->gpio_on = pdata->gpio_on;
-
- retval = pwm_channel_alloc(pdata->pwm_channel, &pwmbl->pwmc);
- if (retval)
- return retval;
-
- if (gpio_is_valid(pwmbl->gpio_on)) {
- /* Turn display off by default. */
- if (pdata->on_active_low)
- flags = GPIOF_OUT_INIT_HIGH;
- else
- flags = GPIOF_OUT_INIT_LOW;
-
- retval = devm_gpio_request_one(&pdev->dev, pwmbl->gpio_on,
- flags, "gpio_atmel_pwm_bl");
- if (retval)
- goto err_free_pwm;
- }
-
- memset(&props, 0, sizeof(struct backlight_properties));
- props.type = BACKLIGHT_RAW;
- props.max_brightness = pdata->pwm_duty_max - pdata->pwm_duty_min;
- bldev = devm_backlight_device_register(&pdev->dev, "atmel-pwm-bl",
- &pdev->dev, pwmbl, &atmel_pwm_bl_ops,
- &props);
- if (IS_ERR(bldev)) {
- retval = PTR_ERR(bldev);
- goto err_free_pwm;
- }
-
- pwmbl->bldev = bldev;
-
- platform_set_drvdata(pdev, pwmbl);
-
- /* Power up the backlight by default at middle intesity. */
- bldev->props.power = FB_BLANK_UNBLANK;
- bldev->props.brightness = bldev->props.max_brightness / 2;
-
- retval = atmel_pwm_bl_init_pwm(pwmbl);
- if (retval)
- goto err_free_pwm;
-
- atmel_pwm_bl_set_intensity(bldev);
-
- return 0;
-
-err_free_pwm:
- pwm_channel_free(&pwmbl->pwmc);
-
- return retval;
-}
-
-static int atmel_pwm_bl_remove(struct platform_device *pdev)
-{
- struct atmel_pwm_bl *pwmbl = platform_get_drvdata(pdev);
-
- atmel_pwm_bl_set_gpio_on(pwmbl, 0);
- pwm_channel_disable(&pwmbl->pwmc);
- pwm_channel_free(&pwmbl->pwmc);
-
- return 0;
-}
-
-static struct platform_driver atmel_pwm_bl_driver = {
- .driver = {
- .name = "atmel-pwm-bl",
- },
- /* REVISIT add suspend() and resume() */
- .probe = atmel_pwm_bl_probe,
- .remove = atmel_pwm_bl_remove,
-};
-
-module_platform_driver(atmel_pwm_bl_driver);
-
-MODULE_AUTHOR("Hans-Christian egtvedt <hans-christian.egtvedt@atmel.com>");
-MODULE_DESCRIPTION("Atmel PWM backlight driver");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:atmel-pwm-bl");
diff --git a/include/linux/atmel-pwm-bl.h b/include/linux/atmel-pwm-bl.h
deleted file mode 100644
index 0153a47806c2..000000000000
--- a/include/linux/atmel-pwm-bl.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2007 Atmel Corporation
- *
- * Driver for the AT32AP700X PS/2 controller (PSIF).
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- */
-
-#ifndef __INCLUDE_ATMEL_PWM_BL_H
-#define __INCLUDE_ATMEL_PWM_BL_H
-
-/**
- * struct atmel_pwm_bl_platform_data
- * @pwm_channel: which PWM channel in the PWM module to use.
- * @pwm_frequency: PWM frequency to generate, the driver will try to be as
- * close as the prescaler allows.
- * @pwm_compare_max: value to use in the PWM channel compare register.
- * @pwm_duty_max: maximum duty cycle value, must be less than or equal to
- * pwm_compare_max.
- * @pwm_duty_min: minimum duty cycle value, must be less than pwm_duty_max.
- * @pwm_active_low: set to one if the low part of the PWM signal increases the
- * brightness of the backlight.
- * @gpio_on: GPIO line to control the backlight on/off, set to -1 if not used.
- * @on_active_low: set to one if the on/off signal is on when GPIO is low.
- *
- * This struct must be added to the platform device in the board code. It is
- * used by the atmel-pwm-bl driver to setup the GPIO to control on/off and the
- * PWM device.
- */
-struct atmel_pwm_bl_platform_data {
- unsigned int pwm_channel;
- unsigned int pwm_frequency;
- unsigned int pwm_compare_max;
- unsigned int pwm_duty_max;
- unsigned int pwm_duty_min;
- unsigned int pwm_active_low;
- int gpio_on;
- unsigned int on_active_low;
-};
-
-#endif /* __INCLUDE_ATMEL_PWM_BL_H */
--
1.8.3.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [PATCH 14/16] backlight: atmel-pwm-bl: remove obsolete driver
2014-03-19 13:03 ` [PATCH 14/16] backlight: atmel-pwm-bl: remove obsolete driver Alexandre Belloni
@ 2014-03-19 14:22 ` Hans-Christian Egtvedt
2014-03-21 0:51 ` Jingoo Han
0 siblings, 1 reply; 31+ messages in thread
From: Hans-Christian Egtvedt @ 2014-03-19 14:22 UTC (permalink / raw)
To: linux-arm-kernel
Around Wed 19 Mar 2014 14:03:27 +0100 or thereabout, Alexandre Belloni wrote:
> The atmel-pwm-bl driver is now obsolete. It is not used by any mainlined boards
> and is replaced by the generic pwm_bl with the pawm-atmel driver using the
> generic PWM framework.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> ---
> drivers/video/backlight/Kconfig | 11 --
> drivers/video/backlight/Makefile | 1 -
> drivers/video/backlight/atmel-pwm-bl.c | 223 ---------------------------------
> include/linux/atmel-pwm-bl.h | 43 -------
> 4 files changed, 278 deletions(-)
> delete mode 100644 drivers/video/backlight/atmel-pwm-bl.c
> delete mode 100644 include/linux/atmel-pwm-bl.h
<snipp diff>
> -MODULE_AUTHOR("Hans-Christian egtvedt <hans-christian.egtvedt@atmel.com>");
>
sob )':
Great cleanup though.
<snipp diff>
--
mvh
Hans-Christian Egtvedt
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 14/16] backlight: atmel-pwm-bl: remove obsolete driver
2014-03-19 14:22 ` Hans-Christian Egtvedt
@ 2014-03-21 0:51 ` Jingoo Han
2014-03-24 15:54 ` Alexandre Belloni
0 siblings, 1 reply; 31+ messages in thread
From: Jingoo Han @ 2014-03-21 0:51 UTC (permalink / raw)
To: linux-arm-kernel
On Wednesday, March 19, 2014 11:23 PM, Hans-Christian Egtvedt wrote:
> Around Wed 19 Mar 2014 14:03:27 +0100 or thereabout, Alexandre Belloni wrote:
> > The atmel-pwm-bl driver is now obsolete. It is not used by any mainlined boards
> > and is replaced by the generic pwm_bl with the pawm-atmel driver using the
> > generic PWM framework.
> >
> > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
>
> Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Best regards,
Jingoo Han
>
> > ---
> > drivers/video/backlight/Kconfig | 11 --
> > drivers/video/backlight/Makefile | 1 -
> > drivers/video/backlight/atmel-pwm-bl.c | 223 ---------------------------------
> > include/linux/atmel-pwm-bl.h | 43 -------
> > 4 files changed, 278 deletions(-)
> > delete mode 100644 drivers/video/backlight/atmel-pwm-bl.c
> > delete mode 100644 include/linux/atmel-pwm-bl.h
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 14/16] backlight: atmel-pwm-bl: remove obsolete driver
2014-03-21 0:51 ` Jingoo Han
@ 2014-03-24 15:54 ` Alexandre Belloni
2014-03-25 0:15 ` Jingoo Han
0 siblings, 1 reply; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-24 15:54 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On 21/03/2014 at 09:51:16 +0900, Jingoo Han wrote :
> On Wednesday, March 19, 2014 11:23 PM, Hans-Christian Egtvedt wrote:
> > Around Wed 19 Mar 2014 14:03:27 +0100 or thereabout, Alexandre Belloni wrote:
> > > The atmel-pwm-bl driver is now obsolete. It is not used by any mainlined boards
> > > and is replaced by the generic pwm_bl with the pawm-atmel driver using the
> > > generic PWM framework.
> > >
> > > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> >
> > Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
>
> Acked-by: Jingoo Han <jg1.han@samsung.com>
>
You didn't comment on patch 08/16, are you fine with it ? I guess this
is the only one holding back the full series.
Regards,
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 14/16] backlight: atmel-pwm-bl: remove obsolete driver
2014-03-24 15:54 ` Alexandre Belloni
@ 2014-03-25 0:15 ` Jingoo Han
0 siblings, 0 replies; 31+ messages in thread
From: Jingoo Han @ 2014-03-25 0:15 UTC (permalink / raw)
To: linux-arm-kernel
On Tuesday, March 25, 2014 12:54 AM, Alexandre Belloni wrote:
> On 21/03/2014 at 09:51:16 +0900, Jingoo Han wrote :
> > On Wednesday, March 19, 2014 11:23 PM, Hans-Christian Egtvedt wrote:
> > > Around Wed 19 Mar 2014 14:03:27 +0100 or thereabout, Alexandre Belloni wrote:
> > > > The atmel-pwm-bl driver is now obsolete. It is not used by any mainlined boards
> > > > and is replaced by the generic pwm_bl with the pawm-atmel driver using the
> > > > generic PWM framework.
> > > >
> > > > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> > >
> > > Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> >
> > Acked-by: Jingoo Han <jg1.han@samsung.com>
> >
>
> You didn't comment on patch 08/16, are you fine with it ? I guess this
> is the only one holding back the full series.
'drivers/video/backlight/pwm_bl.c' is Thierry Reding's domain,
as follows.
PWM SUBSYSTEM
M: Thierry Reding <thierry.reding@gmail.com>
L: linux-pwm@vger.kernel.org
S: Maintained
.....
F: drivers/video/backlight/pwm_bl.c
So, it is required to get Ack from Thierry Reding.
Best regards,
Jingoo Han
>
> Regards,
>
> --
> Alexandre Belloni, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH 15/16] leds: atmel-pwm: remove obsolete driver
2014-03-19 13:03 [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Alexandre Belloni
` (13 preceding siblings ...)
2014-03-19 13:03 ` [PATCH 14/16] backlight: atmel-pwm-bl: remove obsolete driver Alexandre Belloni
@ 2014-03-19 13:03 ` Alexandre Belloni
2014-03-27 17:27 ` Bryan Wu
2014-03-19 13:03 ` [PATCH 16/16] misc: atmel_pwm: " Alexandre Belloni
2014-03-27 17:43 ` [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Nicolas Ferre
16 siblings, 1 reply; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-19 13:03 UTC (permalink / raw)
To: linux-arm-kernel
The leds-atmel-pwmdriver is now obsolete. It is not used by any mainlined boards
and is replaced by the generic leds_pwm with the pawm-atmel driver using the
generic PWM framework.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/leds/Kconfig | 8 ---
drivers/leds/Makefile | 1 -
drivers/leds/leds-atmel-pwm.c | 149 ------------------------------------------
3 files changed, 158 deletions(-)
delete mode 100644 drivers/leds/leds-atmel-pwm.c
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 72156c123033..e7aca5f1e396 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -32,14 +32,6 @@ config LEDS_88PM860X
This option enables support for on-chip LED drivers found on Marvell
Semiconductor 88PM8606 PMIC.
-config LEDS_ATMEL_PWM
- tristate "LED Support using Atmel PWM outputs"
- depends on LEDS_CLASS
- depends on ATMEL_PWM
- help
- This option enables support for LEDs driven using outputs
- of the dedicated PWM controller found on newer Atmel SOCs.
-
config LEDS_LM3530
tristate "LCD Backlight driver for LM3530"
depends on LEDS_CLASS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 3cd76dbd9be2..6ee06559db45 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -6,7 +6,6 @@ obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o
# LED Platform Drivers
obj-$(CONFIG_LEDS_88PM860X) += leds-88pm860x.o
-obj-$(CONFIG_LEDS_ATMEL_PWM) += leds-atmel-pwm.o
obj-$(CONFIG_LEDS_BD2802) += leds-bd2802.o
obj-$(CONFIG_LEDS_LOCOMO) += leds-locomo.o
obj-$(CONFIG_LEDS_LM3530) += leds-lm3530.o
diff --git a/drivers/leds/leds-atmel-pwm.c b/drivers/leds/leds-atmel-pwm.c
deleted file mode 100644
index 56cec8d6a2ac..000000000000
--- a/drivers/leds/leds-atmel-pwm.c
+++ /dev/null
@@ -1,149 +0,0 @@
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <linux/leds.h>
-#include <linux/io.h>
-#include <linux/atmel_pwm.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-
-
-struct pwmled {
- struct led_classdev cdev;
- struct pwm_channel pwmc;
- struct gpio_led *desc;
- u32 mult;
- u8 active_low;
-};
-
-
-/*
- * For simplicity, we use "brightness" as if it were a linear function
- * of PWM duty cycle. However, a logarithmic function of duty cycle is
- * probably a better match for perceived brightness: two is half as bright
- * as four, four is half as bright as eight, etc
- */
-static void pwmled_brightness(struct led_classdev *cdev, enum led_brightness b)
-{
- struct pwmled *led;
-
- /* update the duty cycle for the *next* period */
- led = container_of(cdev, struct pwmled, cdev);
- pwm_channel_writel(&led->pwmc, PWM_CUPD, led->mult * (unsigned) b);
-}
-
-/*
- * NOTE: we reuse the platform_data structure of GPIO leds,
- * but repurpose its "gpio" number as a PWM channel number.
- */
-static int pwmled_probe(struct platform_device *pdev)
-{
- const struct gpio_led_platform_data *pdata;
- struct pwmled *leds;
- int i;
- int status;
-
- pdata = dev_get_platdata(&pdev->dev);
- if (!pdata || pdata->num_leds < 1)
- return -ENODEV;
-
- leds = devm_kzalloc(&pdev->dev, pdata->num_leds * sizeof(*leds),
- GFP_KERNEL);
- if (!leds)
- return -ENOMEM;
-
- for (i = 0; i < pdata->num_leds; i++) {
- struct pwmled *led = leds + i;
- const struct gpio_led *dat = pdata->leds + i;
- u32 tmp;
-
- led->cdev.name = dat->name;
- led->cdev.brightness = LED_OFF;
- led->cdev.brightness_set = pwmled_brightness;
- led->cdev.default_trigger = dat->default_trigger;
-
- led->active_low = dat->active_low;
-
- status = pwm_channel_alloc(dat->gpio, &led->pwmc);
- if (status < 0)
- goto err;
-
- /*
- * Prescale clock by 2^x, so PWM counts in low MHz.
- * Start each cycle with the LED active, so increasing
- * the duty cycle gives us more time on (= brighter).
- */
- tmp = 5;
- if (!led->active_low)
- tmp |= PWM_CPR_CPOL;
- pwm_channel_writel(&led->pwmc, PWM_CMR, tmp);
-
- /*
- * Pick a period so PWM cycles at 100+ Hz; and a multiplier
- * for scaling duty cycle: brightness * mult.
- */
- tmp = (led->pwmc.mck / (1 << 5)) / 100;
- tmp /= 255;
- led->mult = tmp;
- pwm_channel_writel(&led->pwmc, PWM_CDTY,
- led->cdev.brightness * 255);
- pwm_channel_writel(&led->pwmc, PWM_CPRD,
- LED_FULL * tmp);
-
- pwm_channel_enable(&led->pwmc);
-
- /* Hand it over to the LED framework */
- status = led_classdev_register(&pdev->dev, &led->cdev);
- if (status < 0) {
- pwm_channel_free(&led->pwmc);
- goto err;
- }
- }
-
- platform_set_drvdata(pdev, leds);
- return 0;
-
-err:
- if (i > 0) {
- for (i = i - 1; i >= 0; i--) {
- led_classdev_unregister(&leds[i].cdev);
- pwm_channel_free(&leds[i].pwmc);
- }
- }
-
- return status;
-}
-
-static int pwmled_remove(struct platform_device *pdev)
-{
- const struct gpio_led_platform_data *pdata;
- struct pwmled *leds;
- unsigned i;
-
- pdata = dev_get_platdata(&pdev->dev);
- leds = platform_get_drvdata(pdev);
-
- for (i = 0; i < pdata->num_leds; i++) {
- struct pwmled *led = leds + i;
-
- led_classdev_unregister(&led->cdev);
- pwm_channel_free(&led->pwmc);
- }
-
- return 0;
-}
-
-static struct platform_driver pwmled_driver = {
- .driver = {
- .name = "leds-atmel-pwm",
- .owner = THIS_MODULE,
- },
- /* REVISIT add suspend() and resume() methods */
- .probe = pwmled_probe,
- .remove = pwmled_remove,
-};
-
-module_platform_driver(pwmled_driver);
-
-MODULE_DESCRIPTION("Driver for LEDs with PWM-controlled brightness");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:leds-atmel-pwm");
--
1.8.3.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [PATCH 15/16] leds: atmel-pwm: remove obsolete driver
2014-03-19 13:03 ` [PATCH 15/16] leds: atmel-pwm: " Alexandre Belloni
@ 2014-03-27 17:27 ` Bryan Wu
0 siblings, 0 replies; 31+ messages in thread
From: Bryan Wu @ 2014-03-27 17:27 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Mar 19, 2014 at 6:03 AM, Alexandre Belloni
<alexandre.belloni@free-electrons.com> wrote:
> The leds-atmel-pwmdriver is now obsolete. It is not used by any mainlined boards
> and is replaced by the generic leds_pwm with the pawm-atmel driver using the
> generic PWM framework.
>
Good to remove.
Acked-by: Bryan Wu <cooloney@gmail.com>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
> drivers/leds/Kconfig | 8 ---
> drivers/leds/Makefile | 1 -
> drivers/leds/leds-atmel-pwm.c | 149 ------------------------------------------
> 3 files changed, 158 deletions(-)
> delete mode 100644 drivers/leds/leds-atmel-pwm.c
>
> diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
> index 72156c123033..e7aca5f1e396 100644
> --- a/drivers/leds/Kconfig
> +++ b/drivers/leds/Kconfig
> @@ -32,14 +32,6 @@ config LEDS_88PM860X
> This option enables support for on-chip LED drivers found on Marvell
> Semiconductor 88PM8606 PMIC.
>
> -config LEDS_ATMEL_PWM
> - tristate "LED Support using Atmel PWM outputs"
> - depends on LEDS_CLASS
> - depends on ATMEL_PWM
> - help
> - This option enables support for LEDs driven using outputs
> - of the dedicated PWM controller found on newer Atmel SOCs.
> -
> config LEDS_LM3530
> tristate "LCD Backlight driver for LM3530"
> depends on LEDS_CLASS
> diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
> index 3cd76dbd9be2..6ee06559db45 100644
> --- a/drivers/leds/Makefile
> +++ b/drivers/leds/Makefile
> @@ -6,7 +6,6 @@ obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o
>
> # LED Platform Drivers
> obj-$(CONFIG_LEDS_88PM860X) += leds-88pm860x.o
> -obj-$(CONFIG_LEDS_ATMEL_PWM) += leds-atmel-pwm.o
> obj-$(CONFIG_LEDS_BD2802) += leds-bd2802.o
> obj-$(CONFIG_LEDS_LOCOMO) += leds-locomo.o
> obj-$(CONFIG_LEDS_LM3530) += leds-lm3530.o
> diff --git a/drivers/leds/leds-atmel-pwm.c b/drivers/leds/leds-atmel-pwm.c
> deleted file mode 100644
> index 56cec8d6a2ac..000000000000
> --- a/drivers/leds/leds-atmel-pwm.c
> +++ /dev/null
> @@ -1,149 +0,0 @@
> -#include <linux/kernel.h>
> -#include <linux/platform_device.h>
> -#include <linux/leds.h>
> -#include <linux/io.h>
> -#include <linux/atmel_pwm.h>
> -#include <linux/slab.h>
> -#include <linux/module.h>
> -
> -
> -struct pwmled {
> - struct led_classdev cdev;
> - struct pwm_channel pwmc;
> - struct gpio_led *desc;
> - u32 mult;
> - u8 active_low;
> -};
> -
> -
> -/*
> - * For simplicity, we use "brightness" as if it were a linear function
> - * of PWM duty cycle. However, a logarithmic function of duty cycle is
> - * probably a better match for perceived brightness: two is half as bright
> - * as four, four is half as bright as eight, etc
> - */
> -static void pwmled_brightness(struct led_classdev *cdev, enum led_brightness b)
> -{
> - struct pwmled *led;
> -
> - /* update the duty cycle for the *next* period */
> - led = container_of(cdev, struct pwmled, cdev);
> - pwm_channel_writel(&led->pwmc, PWM_CUPD, led->mult * (unsigned) b);
> -}
> -
> -/*
> - * NOTE: we reuse the platform_data structure of GPIO leds,
> - * but repurpose its "gpio" number as a PWM channel number.
> - */
> -static int pwmled_probe(struct platform_device *pdev)
> -{
> - const struct gpio_led_platform_data *pdata;
> - struct pwmled *leds;
> - int i;
> - int status;
> -
> - pdata = dev_get_platdata(&pdev->dev);
> - if (!pdata || pdata->num_leds < 1)
> - return -ENODEV;
> -
> - leds = devm_kzalloc(&pdev->dev, pdata->num_leds * sizeof(*leds),
> - GFP_KERNEL);
> - if (!leds)
> - return -ENOMEM;
> -
> - for (i = 0; i < pdata->num_leds; i++) {
> - struct pwmled *led = leds + i;
> - const struct gpio_led *dat = pdata->leds + i;
> - u32 tmp;
> -
> - led->cdev.name = dat->name;
> - led->cdev.brightness = LED_OFF;
> - led->cdev.brightness_set = pwmled_brightness;
> - led->cdev.default_trigger = dat->default_trigger;
> -
> - led->active_low = dat->active_low;
> -
> - status = pwm_channel_alloc(dat->gpio, &led->pwmc);
> - if (status < 0)
> - goto err;
> -
> - /*
> - * Prescale clock by 2^x, so PWM counts in low MHz.
> - * Start each cycle with the LED active, so increasing
> - * the duty cycle gives us more time on (= brighter).
> - */
> - tmp = 5;
> - if (!led->active_low)
> - tmp |= PWM_CPR_CPOL;
> - pwm_channel_writel(&led->pwmc, PWM_CMR, tmp);
> -
> - /*
> - * Pick a period so PWM cycles at 100+ Hz; and a multiplier
> - * for scaling duty cycle: brightness * mult.
> - */
> - tmp = (led->pwmc.mck / (1 << 5)) / 100;
> - tmp /= 255;
> - led->mult = tmp;
> - pwm_channel_writel(&led->pwmc, PWM_CDTY,
> - led->cdev.brightness * 255);
> - pwm_channel_writel(&led->pwmc, PWM_CPRD,
> - LED_FULL * tmp);
> -
> - pwm_channel_enable(&led->pwmc);
> -
> - /* Hand it over to the LED framework */
> - status = led_classdev_register(&pdev->dev, &led->cdev);
> - if (status < 0) {
> - pwm_channel_free(&led->pwmc);
> - goto err;
> - }
> - }
> -
> - platform_set_drvdata(pdev, leds);
> - return 0;
> -
> -err:
> - if (i > 0) {
> - for (i = i - 1; i >= 0; i--) {
> - led_classdev_unregister(&leds[i].cdev);
> - pwm_channel_free(&leds[i].pwmc);
> - }
> - }
> -
> - return status;
> -}
> -
> -static int pwmled_remove(struct platform_device *pdev)
> -{
> - const struct gpio_led_platform_data *pdata;
> - struct pwmled *leds;
> - unsigned i;
> -
> - pdata = dev_get_platdata(&pdev->dev);
> - leds = platform_get_drvdata(pdev);
> -
> - for (i = 0; i < pdata->num_leds; i++) {
> - struct pwmled *led = leds + i;
> -
> - led_classdev_unregister(&led->cdev);
> - pwm_channel_free(&led->pwmc);
> - }
> -
> - return 0;
> -}
> -
> -static struct platform_driver pwmled_driver = {
> - .driver = {
> - .name = "leds-atmel-pwm",
> - .owner = THIS_MODULE,
> - },
> - /* REVISIT add suspend() and resume() methods */
> - .probe = pwmled_probe,
> - .remove = pwmled_remove,
> -};
> -
> -module_platform_driver(pwmled_driver);
> -
> -MODULE_DESCRIPTION("Driver for LEDs with PWM-controlled brightness");
> -MODULE_LICENSE("GPL");
> -MODULE_ALIAS("platform:leds-atmel-pwm");
> --
> 1.8.3.2
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH 16/16] misc: atmel_pwm: remove obsolete driver
2014-03-19 13:03 [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Alexandre Belloni
` (14 preceding siblings ...)
2014-03-19 13:03 ` [PATCH 15/16] leds: atmel-pwm: " Alexandre Belloni
@ 2014-03-19 13:03 ` Alexandre Belloni
2014-03-27 17:43 ` [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Nicolas Ferre
16 siblings, 0 replies; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-19 13:03 UTC (permalink / raw)
To: linux-arm-kernel
The misc/atmel_pwm is not used by any mainlined boards and has been replaced by
the pwm-driver using the generic PWM framework.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/misc/Kconfig | 9 --
drivers/misc/Makefile | 1 -
drivers/misc/atmel_pwm.c | 402 ----------------------------------------------
include/linux/atmel_pwm.h | 70 --------
4 files changed, 482 deletions(-)
delete mode 100644 drivers/misc/atmel_pwm.c
delete mode 100644 include/linux/atmel_pwm.h
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 6cb388e8fb7d..64ab12b8de9e 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -51,15 +51,6 @@ config AD525X_DPOT_SPI
To compile this driver as a module, choose M here: the
module will be called ad525x_dpot-spi.
-config ATMEL_PWM
- tristate "Atmel AT32/AT91 PWM support"
- depends on HAVE_CLK
- help
- This option enables device driver support for the PWM channels
- on certain Atmel processors. Pulse Width Modulation is used for
- purposes including software controlled power-efficient backlights
- on LCD displays, motor control, and waveform generation.
-
config ATMEL_TCLIB
bool "Atmel AT32/AT91 Timer/Counter Library"
depends on (AVR32 || ARCH_AT91)
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 99b9424ce31d..8dd44f924cb0 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -7,7 +7,6 @@ obj-$(CONFIG_AD525X_DPOT) += ad525x_dpot.o
obj-$(CONFIG_AD525X_DPOT_I2C) += ad525x_dpot-i2c.o
obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_dpot-spi.o
obj-$(CONFIG_INTEL_MID_PTI) += pti.o
-obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o
obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o
obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o
obj-$(CONFIG_BMP085) += bmp085.o
diff --git a/drivers/misc/atmel_pwm.c b/drivers/misc/atmel_pwm.c
deleted file mode 100644
index a6dc56e1bc58..000000000000
--- a/drivers/misc/atmel_pwm.c
+++ /dev/null
@@ -1,402 +0,0 @@
-#include <linux/module.h>
-#include <linux/clk.h>
-#include <linux/err.h>
-#include <linux/slab.h>
-#include <linux/io.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/atmel_pwm.h>
-
-
-/*
- * This is a simple driver for the PWM controller found in various newer
- * Atmel SOCs, including the AVR32 series and the AT91sam9263.
- *
- * Chips with current Linux ports have only 4 PWM channels, out of max 32.
- * AT32UC3A and AT32UC3B chips have 7 channels (but currently no Linux).
- * Docs are inconsistent about the width of the channel counter registers;
- * it's at least 16 bits, but several places say 20 bits.
- */
-#define PWM_NCHAN 4 /* max 32 */
-
-struct pwm {
- spinlock_t lock;
- struct platform_device *pdev;
- u32 mask;
- int irq;
- void __iomem *base;
- struct clk *clk;
- struct pwm_channel *channel[PWM_NCHAN];
- void (*handler[PWM_NCHAN])(struct pwm_channel *);
-};
-
-
-/* global PWM controller registers */
-#define PWM_MR 0x00
-#define PWM_ENA 0x04
-#define PWM_DIS 0x08
-#define PWM_SR 0x0c
-#define PWM_IER 0x10
-#define PWM_IDR 0x14
-#define PWM_IMR 0x18
-#define PWM_ISR 0x1c
-
-static inline void pwm_writel(const struct pwm *p, unsigned offset, u32 val)
-{
- __raw_writel(val, p->base + offset);
-}
-
-static inline u32 pwm_readl(const struct pwm *p, unsigned offset)
-{
- return __raw_readl(p->base + offset);
-}
-
-static inline void __iomem *pwmc_regs(const struct pwm *p, int index)
-{
- return p->base + 0x200 + index * 0x20;
-}
-
-static struct pwm *pwm;
-
-static void pwm_dumpregs(struct pwm_channel *ch, char *tag)
-{
- struct device *dev = &pwm->pdev->dev;
-
- dev_dbg(dev, "%s: mr %08x, sr %08x, imr %08x\n",
- tag,
- pwm_readl(pwm, PWM_MR),
- pwm_readl(pwm, PWM_SR),
- pwm_readl(pwm, PWM_IMR));
- dev_dbg(dev,
- "pwm ch%d - mr %08x, dty %u, prd %u, cnt %u\n",
- ch->index,
- pwm_channel_readl(ch, PWM_CMR),
- pwm_channel_readl(ch, PWM_CDTY),
- pwm_channel_readl(ch, PWM_CPRD),
- pwm_channel_readl(ch, PWM_CCNT));
-}
-
-
-/**
- * pwm_channel_alloc - allocate an unused PWM channel
- * @index: identifies the channel
- * @ch: structure to be initialized
- *
- * Drivers allocate PWM channels according to the board's wiring, and
- * matching board-specific setup code. Returns zero or negative errno.
- */
-int pwm_channel_alloc(int index, struct pwm_channel *ch)
-{
- unsigned long flags;
- int status = 0;
-
- if (!pwm)
- return -EPROBE_DEFER;
-
- if (!(pwm->mask & 1 << index))
- return -ENODEV;
-
- if (index < 0 || index >= PWM_NCHAN || !ch)
- return -EINVAL;
- memset(ch, 0, sizeof *ch);
-
- spin_lock_irqsave(&pwm->lock, flags);
- if (pwm->channel[index])
- status = -EBUSY;
- else {
- clk_enable(pwm->clk);
-
- ch->regs = pwmc_regs(pwm, index);
- ch->index = index;
-
- /* REVISIT: ap7000 seems to go 2x as fast as we expect!! */
- ch->mck = clk_get_rate(pwm->clk);
-
- pwm->channel[index] = ch;
- pwm->handler[index] = NULL;
-
- /* channel and irq are always disabled when we return */
- pwm_writel(pwm, PWM_DIS, 1 << index);
- pwm_writel(pwm, PWM_IDR, 1 << index);
- }
- spin_unlock_irqrestore(&pwm->lock, flags);
- return status;
-}
-EXPORT_SYMBOL(pwm_channel_alloc);
-
-static int pwmcheck(struct pwm_channel *ch)
-{
- int index;
-
- if (!pwm)
- return -ENODEV;
- if (!ch)
- return -EINVAL;
- index = ch->index;
- if (index < 0 || index >= PWM_NCHAN || pwm->channel[index] != ch)
- return -EINVAL;
-
- return index;
-}
-
-/**
- * pwm_channel_free - release a previously allocated channel
- * @ch: the channel being released
- *
- * The channel is completely shut down (counter and IRQ disabled),
- * and made available for re-use. Returns zero, or negative errno.
- */
-int pwm_channel_free(struct pwm_channel *ch)
-{
- unsigned long flags;
- int t;
-
- spin_lock_irqsave(&pwm->lock, flags);
- t = pwmcheck(ch);
- if (t >= 0) {
- pwm->channel[t] = NULL;
- pwm->handler[t] = NULL;
-
- /* channel and irq are always disabled when we return */
- pwm_writel(pwm, PWM_DIS, 1 << t);
- pwm_writel(pwm, PWM_IDR, 1 << t);
-
- clk_disable(pwm->clk);
- t = 0;
- }
- spin_unlock_irqrestore(&pwm->lock, flags);
- return t;
-}
-EXPORT_SYMBOL(pwm_channel_free);
-
-int __pwm_channel_onoff(struct pwm_channel *ch, int enabled)
-{
- unsigned long flags;
- int t;
-
- /* OMITTED FUNCTIONALITY: starting several channels in synch */
-
- spin_lock_irqsave(&pwm->lock, flags);
- t = pwmcheck(ch);
- if (t >= 0) {
- pwm_writel(pwm, enabled ? PWM_ENA : PWM_DIS, 1 << t);
- t = 0;
- pwm_dumpregs(ch, enabled ? "enable" : "disable");
- }
- spin_unlock_irqrestore(&pwm->lock, flags);
-
- return t;
-}
-EXPORT_SYMBOL(__pwm_channel_onoff);
-
-/**
- * pwm_clk_alloc - allocate and configure CLKA or CLKB
- * @prescale: from 0..10, the power of two used to divide MCK
- * @div: from 1..255, the linear divisor to use
- *
- * Returns PWM_CPR_CLKA, PWM_CPR_CLKB, or negative errno. The allocated
- * clock will run with a period of (2^prescale * div) / MCK, or twice as
- * long if center aligned PWM output is used. The clock must later be
- * deconfigured using pwm_clk_free().
- */
-int pwm_clk_alloc(unsigned prescale, unsigned div)
-{
- unsigned long flags;
- u32 mr;
- u32 val = (prescale << 8) | div;
- int ret = -EBUSY;
-
- if (prescale >= 10 || div = 0 || div > 255)
- return -EINVAL;
-
- spin_lock_irqsave(&pwm->lock, flags);
- mr = pwm_readl(pwm, PWM_MR);
- if ((mr & 0xffff) = 0) {
- mr |= val;
- ret = PWM_CPR_CLKA;
- } else if ((mr & (0xffff << 16)) = 0) {
- mr |= val << 16;
- ret = PWM_CPR_CLKB;
- }
- if (ret > 0)
- pwm_writel(pwm, PWM_MR, mr);
- spin_unlock_irqrestore(&pwm->lock, flags);
- return ret;
-}
-EXPORT_SYMBOL(pwm_clk_alloc);
-
-/**
- * pwm_clk_free - deconfigure and release CLKA or CLKB
- *
- * Reverses the effect of pwm_clk_alloc().
- */
-void pwm_clk_free(unsigned clk)
-{
- unsigned long flags;
- u32 mr;
-
- spin_lock_irqsave(&pwm->lock, flags);
- mr = pwm_readl(pwm, PWM_MR);
- if (clk = PWM_CPR_CLKA)
- pwm_writel(pwm, PWM_MR, mr & ~(0xffff << 0));
- if (clk = PWM_CPR_CLKB)
- pwm_writel(pwm, PWM_MR, mr & ~(0xffff << 16));
- spin_unlock_irqrestore(&pwm->lock, flags);
-}
-EXPORT_SYMBOL(pwm_clk_free);
-
-/**
- * pwm_channel_handler - manage channel's IRQ handler
- * @ch: the channel
- * @handler: the handler to use, possibly NULL
- *
- * If the handler is non-null, the handler will be called after every
- * period of this PWM channel. If the handler is null, this channel
- * won't generate an IRQ.
- */
-int pwm_channel_handler(struct pwm_channel *ch,
- void (*handler)(struct pwm_channel *ch))
-{
- unsigned long flags;
- int t;
-
- spin_lock_irqsave(&pwm->lock, flags);
- t = pwmcheck(ch);
- if (t >= 0) {
- pwm->handler[t] = handler;
- pwm_writel(pwm, handler ? PWM_IER : PWM_IDR, 1 << t);
- t = 0;
- }
- spin_unlock_irqrestore(&pwm->lock, flags);
-
- return t;
-}
-EXPORT_SYMBOL(pwm_channel_handler);
-
-static irqreturn_t pwm_irq(int id, void *_pwm)
-{
- struct pwm *p = _pwm;
- irqreturn_t handled = IRQ_NONE;
- u32 irqstat;
- int index;
-
- spin_lock(&p->lock);
-
- /* ack irqs, then handle them */
- irqstat = pwm_readl(pwm, PWM_ISR);
-
- while (irqstat) {
- struct pwm_channel *ch;
- void (*handler)(struct pwm_channel *ch);
-
- index = ffs(irqstat) - 1;
- irqstat &= ~(1 << index);
- ch = pwm->channel[index];
- handler = pwm->handler[index];
- if (handler && ch) {
- spin_unlock(&p->lock);
- handler(ch);
- spin_lock(&p->lock);
- handled = IRQ_HANDLED;
- }
- }
-
- spin_unlock(&p->lock);
- return handled;
-}
-
-static int __init pwm_probe(struct platform_device *pdev)
-{
- struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- int irq = platform_get_irq(pdev, 0);
- u32 *mp = pdev->dev.platform_data;
- struct pwm *p;
- int status = -EIO;
-
- if (pwm)
- return -EBUSY;
- if (!r || irq < 0 || !mp || !*mp)
- return -ENODEV;
- if (*mp & ~((1<<PWM_NCHAN)-1)) {
- dev_warn(&pdev->dev, "mask 0x%x ... more than %d channels\n",
- *mp, PWM_NCHAN);
- return -EINVAL;
- }
-
- p = kzalloc(sizeof(*p), GFP_KERNEL);
- if (!p)
- return -ENOMEM;
-
- spin_lock_init(&p->lock);
- p->pdev = pdev;
- p->mask = *mp;
- p->irq = irq;
- p->base = ioremap(r->start, resource_size(r));
- if (!p->base)
- goto fail;
- p->clk = clk_get(&pdev->dev, "pwm_clk");
- if (IS_ERR(p->clk)) {
- status = PTR_ERR(p->clk);
- p->clk = NULL;
- goto fail;
- }
-
- status = request_irq(irq, pwm_irq, 0, pdev->name, p);
- if (status < 0)
- goto fail;
-
- pwm = p;
- platform_set_drvdata(pdev, p);
-
- return 0;
-
-fail:
- if (p->clk)
- clk_put(p->clk);
- if (p->base)
- iounmap(p->base);
-
- kfree(p);
- return status;
-}
-
-static int __exit pwm_remove(struct platform_device *pdev)
-{
- struct pwm *p = platform_get_drvdata(pdev);
-
- if (p != pwm)
- return -EINVAL;
-
- clk_enable(pwm->clk);
- pwm_writel(pwm, PWM_DIS, (1 << PWM_NCHAN) - 1);
- pwm_writel(pwm, PWM_IDR, (1 << PWM_NCHAN) - 1);
- clk_disable(pwm->clk);
-
- pwm = NULL;
-
- free_irq(p->irq, p);
- clk_put(p->clk);
- iounmap(p->base);
- kfree(p);
-
- return 0;
-}
-
-static struct platform_driver atmel_pwm_driver = {
- .driver = {
- .name = "atmel_pwm",
- .owner = THIS_MODULE,
- },
- .remove = __exit_p(pwm_remove),
-
- /* NOTE: PWM can keep running in AVR32 "idle" and "frozen" states;
- * and all AT91sam9263 states, albeit at reduced clock rate if
- * MCK becomes the slow clock (i.e. what Linux labels STR).
- */
-};
-
-module_platform_driver_probe(atmel_pwm_driver, pwm_probe);
-
-MODULE_DESCRIPTION("Driver for AT32/AT91 PWM module");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:atmel_pwm");
diff --git a/include/linux/atmel_pwm.h b/include/linux/atmel_pwm.h
deleted file mode 100644
index ea04abb3db8e..000000000000
--- a/include/linux/atmel_pwm.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef __LINUX_ATMEL_PWM_H
-#define __LINUX_ATMEL_PWM_H
-
-/**
- * struct pwm_channel - driver handle to a PWM channel
- * @regs: base of this channel's registers
- * @index: number of this channel (0..31)
- * @mck: base clock rate, which can be prescaled and maybe subdivided
- *
- * Drivers initialize a pwm_channel structure using pwm_channel_alloc().
- * Then they configure its clock rate (derived from MCK), alignment,
- * polarity, and duty cycle by writing directly to the channel registers,
- * before enabling the channel by calling pwm_channel_enable().
- *
- * After emitting a PWM signal for the desired length of time, drivers
- * may then pwm_channel_disable() or pwm_channel_free(). Both of these
- * disable the channel, but when it's freed the IRQ is deconfigured and
- * the channel must later be re-allocated and reconfigured.
- *
- * Note that if the period or duty cycle need to be changed while the
- * PWM channel is operating, drivers must use the PWM_CUPD double buffer
- * mechanism, either polling until they change or getting implicitly
- * notified through a once-per-period interrupt handler.
- */
-struct pwm_channel {
- void __iomem *regs;
- unsigned index;
- unsigned long mck;
-};
-
-extern int pwm_channel_alloc(int index, struct pwm_channel *ch);
-extern int pwm_channel_free(struct pwm_channel *ch);
-
-extern int pwm_clk_alloc(unsigned prescale, unsigned div);
-extern void pwm_clk_free(unsigned clk);
-
-extern int __pwm_channel_onoff(struct pwm_channel *ch, int enabled);
-
-#define pwm_channel_enable(ch) __pwm_channel_onoff((ch), 1)
-#define pwm_channel_disable(ch) __pwm_channel_onoff((ch), 0)
-
-/* periodic interrupts, mostly for CUPD changes to period or cycle */
-extern int pwm_channel_handler(struct pwm_channel *ch,
- void (*handler)(struct pwm_channel *ch));
-
-/* per-channel registers (banked at pwm_channel->regs) */
-#define PWM_CMR 0x00 /* mode register */
-#define PWM_CPR_CPD (1 << 10) /* set: CUPD modifies period */
-#define PWM_CPR_CPOL (1 << 9) /* set: idle high */
-#define PWM_CPR_CALG (1 << 8) /* set: center align */
-#define PWM_CPR_CPRE (0xf << 0) /* mask: rate is mck/(2^pre) */
-#define PWM_CPR_CLKA (0xb << 0) /* rate CLKA */
-#define PWM_CPR_CLKB (0xc << 0) /* rate CLKB */
-#define PWM_CDTY 0x04 /* duty cycle (max of CPRD) */
-#define PWM_CPRD 0x08 /* period (count up from zero) */
-#define PWM_CCNT 0x0c /* counter (20 bits?) */
-#define PWM_CUPD 0x10 /* update CPRD (or CDTY) next period */
-
-static inline void
-pwm_channel_writel(struct pwm_channel *pwmc, unsigned offset, u32 val)
-{
- __raw_writel(val, pwmc->regs + offset);
-}
-
-static inline u32 pwm_channel_readl(struct pwm_channel *pwmc, unsigned offset)
-{
- return __raw_readl(pwmc->regs + offset);
-}
-
-#endif /* __LINUX_ATMEL_PWM_H */
--
1.8.3.2
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers
2014-03-19 13:03 [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Alexandre Belloni
` (15 preceding siblings ...)
2014-03-19 13:03 ` [PATCH 16/16] misc: atmel_pwm: " Alexandre Belloni
@ 2014-03-27 17:43 ` Nicolas Ferre
2014-03-27 18:21 ` Alexandre Belloni
16 siblings, 1 reply; 31+ messages in thread
From: Nicolas Ferre @ 2014-03-27 17:43 UTC (permalink / raw)
To: linux-arm-kernel
On 19/03/2014 14:03, Alexandre Belloni :
> Hi,
>
> This patch set swtiches the at91 and avr32 SoCs and board to the generic PWM
> framework. This allows to remove the obsolete leds-atmel-pwm, atmel-pwm-bl and
> atmel_pwm drivers.
>
> The first 6 patches take care of the AT91 boards and removes a useless function
> in the process.
>
> Patch 7 makes pwm-ateml buildable for AVR32
>
> Patch 8 allows setting the pwm polarity for pwm_bl when using platform data.
> This is required afterwards for the favr-32
>
> Patches 9-13 take care of the AVR32 boards. This has only been compile tested as
> I don't own any of those boards.
>
> And the last 3 patches are removing the now obsolete drivers.
>
> As a note, the atmel_pwm driver has two features not yet available through
> pwm-atmel:
> - it is possible to pass an IRQ handler that will get called each time one of
> the channel period has been acheived.
> - it was possible to set clka and clkb, two clock that divided mck before
> feeding the pwm controller.
>
> Those features are not used by anything in the mainline. I'm not sure we can
> implement the first one. We'll get back the second one once all the boards have
> swtiched to the common clock framework.
>
>
> Alexandre Belloni (16):
> ARM: at91: at91sam9g45: switch to generic PWM framework
> ARM: at91: sam9m10g45ek: use generic leds_pwm driver
> ARM: at91: at91sam9263: switch to generic PWM framework
> ARM: at91: sam9263ek: use generic leds_pwm driver
> ARM: at91: at91sam9rl: switch to generic PWM framework
> ARM: at91: remove useless at91_pwm_leds()
> PWM: atmel: allow building for AVR32
> backlight: pwm_bl: set pwm polarity when using platform data
> avr32/at32ap: switch to the generic PWM framework
> avr32: MRMT: use generic leds_pwm driver
> avr32: merisc: use generic leds_pwm driver
> avr32: favr-32: use generic pwm_bl driver
> avr32: update defconfig to use the generic PWM framework
> backlight: atmel-pwm-bl: remove obsolete driver
> leds: atmel-pwm: remove obsolete driver
> misc: atmel_pwm: remove obsolete driver
I am fine with the whole series. For the AT91 specific bits, you can add my:
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
It is a very nice cleanup and I can take the series with me in the AT91
git tree (likely the at91-3.16-cleanup or at91-3.16-drivers branch) if
everybody agree.
Bye,
> arch/arm/mach-at91/at91sam9263.c | 1 +
> arch/arm/mach-at91/at91sam9263_devices.c | 11 +-
> arch/arm/mach-at91/at91sam9g45.c | 1 +
> arch/arm/mach-at91/at91sam9g45_devices.c | 11 +-
> arch/arm/mach-at91/at91sam9rl.c | 1 +
> arch/arm/mach-at91/at91sam9rl_devices.c | 11 +-
> arch/arm/mach-at91/board-sam9263ek.c | 56 +++-
> arch/arm/mach-at91/board-sam9m10g45ek.c | 43 ++-
> arch/arm/mach-at91/board.h | 1 -
> arch/arm/mach-at91/leds.c | 37 ---
> arch/avr32/boards/atngw100/mrmt.c | 35 ++-
> arch/avr32/boards/favr-32/setup.c | 49 ++--
> arch/avr32/boards/merisc/setup.c | 34 ++-
> arch/avr32/configs/atngw100_mrmt_defconfig | 5 +-
> arch/avr32/configs/atstk1002_defconfig | 5 +-
> arch/avr32/configs/atstk1003_defconfig | 5 +-
> arch/avr32/configs/atstk1004_defconfig | 5 +-
> arch/avr32/configs/atstk1006_defconfig | 5 +-
> arch/avr32/configs/favr-32_defconfig | 6 +-
> arch/avr32/configs/merisc_defconfig | 5 +-
> arch/avr32/mach-at32ap/at32ap700x.c | 7 +-
> drivers/leds/Kconfig | 8 -
> drivers/leds/Makefile | 1 -
> drivers/leds/leds-atmel-pwm.c | 149 -----------
> drivers/misc/Kconfig | 9 -
> drivers/misc/Makefile | 1 -
> drivers/misc/atmel_pwm.c | 402 -----------------------------
> drivers/pwm/Kconfig | 2 +-
> drivers/video/backlight/Kconfig | 11 -
> drivers/video/backlight/Makefile | 1 -
> drivers/video/backlight/atmel-pwm-bl.c | 223 ----------------
> drivers/video/backlight/pwm_bl.c | 8 +
> include/linux/atmel-pwm-bl.h | 43 ---
> include/linux/atmel_pwm.h | 70 -----
> include/linux/pwm_backlight.h | 1 +
> 35 files changed, 199 insertions(+), 1064 deletions(-)
> delete mode 100644 drivers/leds/leds-atmel-pwm.c
> delete mode 100644 drivers/misc/atmel_pwm.c
> delete mode 100644 drivers/video/backlight/atmel-pwm-bl.c
> delete mode 100644 include/linux/atmel-pwm-bl.h
> delete mode 100644 include/linux/atmel_pwm.h
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers
2014-03-27 17:43 ` [PATCH 00/16] move at91 and avr32 to the PWM framework, remove obsolete drivers Nicolas Ferre
@ 2014-03-27 18:21 ` Alexandre Belloni
0 siblings, 0 replies; 31+ messages in thread
From: Alexandre Belloni @ 2014-03-27 18:21 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On 27/03/2014 at 18:43:26 +0100, Nicolas Ferre wrote :
> On 19/03/2014 14:03, Alexandre Belloni :
> > Alexandre Belloni (16):
> > ARM: at91: at91sam9g45: switch to generic PWM framework
> > ARM: at91: sam9m10g45ek: use generic leds_pwm driver
> > ARM: at91: at91sam9263: switch to generic PWM framework
> > ARM: at91: sam9263ek: use generic leds_pwm driver
> > ARM: at91: at91sam9rl: switch to generic PWM framework
> > ARM: at91: remove useless at91_pwm_leds()
> > PWM: atmel: allow building for AVR32
> > backlight: pwm_bl: set pwm polarity when using platform data
Please wait for Thierry Reding to comment on this one...
> > avr32/at32ap: switch to the generic PWM framework
> > avr32: MRMT: use generic leds_pwm driver
> > avr32: merisc: use generic leds_pwm driver
> > avr32: favr-32: use generic pwm_bl driver
> > avr32: update defconfig to use the generic PWM framework
> > backlight: atmel-pwm-bl: remove obsolete driver
> > leds: atmel-pwm: remove obsolete driver
...watch out for the small typo (pawm-atmel) I made there...
> > misc: atmel_pwm: remove obsolete driver
>
> I am fine with the whole series. For the AT91 specific bits, you can add my:
>
> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>
> It is a very nice cleanup and I can take the series with me in the AT91
> git tree (likely the at91-3.16-cleanup or at91-3.16-drivers branch) if
> everybody agree.
>
... but I believe you can take it through your tree as it mostly depends
on AT91 and Hans-Christian seemed fine with the modifications on avr32.
Regards,
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 31+ messages in thread