From patchwork Wed May 28 23:20:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 4258021 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5F322BF90B for ; Wed, 28 May 2014 23:23:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 78ACB20320 for ; Wed, 28 May 2014 23:23:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B38C20306 for ; Wed, 28 May 2014 23:23:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932431AbaE1XVn (ORCPT ); Wed, 28 May 2014 19:21:43 -0400 Received: from top.free-electrons.com ([176.31.233.9]:47877 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932397AbaE1XVk (ORCPT ); Wed, 28 May 2014 19:21:40 -0400 Received: by mail.free-electrons.com (Postfix, from userid 106) id 04F1F895; Thu, 29 May 2014 01:21:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from localhost (rama.bulix.org [5.39.87.92]) by mail.free-electrons.com (Postfix) with ESMTPSA id 4E859815; Thu, 29 May 2014 01:21:37 +0200 (CEST) From: Alexandre Belloni To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Nicolas Ferre , Jean-Christophe Plagniol-Villard , Haavard Skinnemoen , Hans-Christian Egtvedt , Bryan Wu , Jingoo Han , linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org, Alexandre Belloni Subject: [PATCHv2 11/15] avr32: favr-32: use generic pwm_bl driver Date: Thu, 29 May 2014 01:20:14 +0200 Message-Id: <1401319218-16772-12-git-send-email-alexandre.belloni@free-electrons.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1401319218-16772-1-git-send-email-alexandre.belloni@free-electrons.com> References: <1401319218-16772-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 pwm_bl driver instead of atmel-pwm-bl. Signed-off-by: Alexandre Belloni Acked-by: Hans-Christian Egtvedt --- arch/avr32/boards/favr-32/setup.c | 48 ++++++++++++++++++++++-------------- arch/avr32/configs/favr-32_defconfig | 6 ++--- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c index 1f121497b517..234cb071c601 100644 --- a/arch/avr32/boards/favr-32/setup.c +++ b/arch/avr32/boards/favr-32/setup.c @@ -18,7 +18,10 @@ #include #include #include -#include +#include +#include +#include +#include #include #include @@ -33,6 +36,8 @@ #include #include +#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,36 @@ 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, + 5000, PWM_POLARITY_INVERSED), }; -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), + .max_brightness = 255, + .dft_brightness = 255, + .lth_brightness = 50, +}; + +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 +351,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