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: 3858831 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E410D9F44E for ; Wed, 19 Mar 2014 18:13:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 27B2220173 for ; Wed, 19 Mar 2014 18:13:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 497F720117 for ; Wed, 19 Mar 2014 18:13:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933889AbaCSNEB (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.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 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-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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)); }