From patchwork Wed Mar 19 13:03:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 331721 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 330FC2C009C for ; Thu, 20 Mar 2014 00:19:43 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933883AbaCSNEB (ORCPT ); Wed, 19 Mar 2014 09:04:01 -0400 Received: from top.free-electrons.com ([176.31.233.9]:42085 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933813AbaCSND7 (ORCPT ); Wed, 19 Mar 2014 09:03:59 -0400 Received: by mail.free-electrons.com (Postfix, from userid 106) id D01CDB01; Wed, 19 Mar 2014 14:04:00 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.3.2 Received: from localhost (128-79-216-6.hfc.dyn.abo.bbox.fr [128.79.216.6]) by mail.free-electrons.com (Postfix) with ESMTPSA id 8890C7B8; Wed, 19 Mar 2014 14:04:00 +0100 (CET) From: Alexandre Belloni To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Nicolas Ferre , Jean-Christophe Plagniol-Villard , Haavard Skinnemoen , Hans-Christian Egtvedt , Bryan Wu , Richard Purdie , Greg Kroah-Hartman , Thierry Reding , Jingoo Han , linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org, Alexandre Belloni Subject: [PATCH 02/16] ARM: at91: sam9m10g45ek: use generic leds_pwm driver Date: Wed, 19 Mar 2014 14:03:15 +0100 Message-Id: <1395234209-15546-3-git-send-email-alexandre.belloni@free-electrons.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1395234209-15546-1-git-send-email-alexandre.belloni@free-electrons.com> References: <1395234209-15546-1-git-send-email-alexandre.belloni@free-electrons.com> Sender: linux-pwm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pwm@vger.kernel.org Switch to the generic leds_pwm driver instead of leds-atmel-pwm. Signed-off-by: Alexandre Belloni --- 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 #include #include +#include +#include #include @@ -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)); }