From patchwork Tue Aug 19 12:31:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 4742531 Return-Path: X-Original-To: patchwork-linux-arm@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 449E69F377 for ; Tue, 19 Aug 2014 12:37:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6082520123 for ; Tue, 19 Aug 2014 12:37:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6420A2012E for ; Tue, 19 Aug 2014 12:37:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XJia8-0002b3-Mh; Tue, 19 Aug 2014 12:32:08 +0000 Received: from smtp24.mail.ru ([94.100.181.179]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XJiZq-0002FX-0Z for linux-arm-kernel@lists.infradead.org; Tue, 19 Aug 2014 12:31:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=k01OJcZAcMNtE5qoq6//LKnmB64s9R21TbSgl0oiICE=; b=GespS6DAcLkjcHCbzRjjVLzZ786pJ1PZe05S/M74lUVA3VpVwNAJTlZZzspDcw9zuTrDM9GcMhA1P0kOx2pXebeg+/jrMBCeGvwX49UJ52LaFkreMMSHZjjv2K5uZoB1epsdDoi2nA4/nZI45V3tCzjzWpFqkAUa8VLMWgwY19I=; Received: from [5.18.98.7] (port=42778 helo=shc.zet) by smtp24.mail.ru with esmtpa (envelope-from ) id 1XJiZS-00010S-NZ; Tue, 19 Aug 2014 16:31:26 +0400 From: Alexander Shiyan To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/3] ARM: clps711x: edb7211: Use new PWM driver for backlight Date: Tue, 19 Aug 2014 16:31:14 +0400 Message-Id: <1408451475-1140-2-git-send-email-shc_work@mail.ru> X-Mailer: git-send-email 1.8.5.5 In-Reply-To: <1408451475-1140-1-git-send-email-shc_work@mail.ru> References: <1408451475-1140-1-git-send-email-shc_work@mail.ru> X-Mras: Ok X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140819_053150_678081_9573ACA1 X-CRM114-Status: GOOD ( 14.05 ) X-Spam-Score: -0.1 (/) Cc: Olof Johansson , Kevin Hilman , Russell King , Alexander Shiyan , Arnd Bergmann X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Remove existing tricks for handling PWM and use CLPS711X PWM driver. Signed-off-by: Alexander Shiyan --- arch/arm/configs/clps711x_defconfig | 4 +++- arch/arm/mach-clps711x/board-edb7211.c | 37 ++++++++++++++++++++-------------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/arch/arm/configs/clps711x_defconfig b/arch/arm/configs/clps711x_defconfig index 0facf9d..fc105c9 100644 --- a/arch/arm/configs/clps711x_defconfig +++ b/arch/arm/configs/clps711x_defconfig @@ -68,8 +68,8 @@ CONFIG_GPIO_GENERIC_PLATFORM=y # CONFIG_HWMON is not set CONFIG_FB=y CONFIG_FB_CLPS711X=y -CONFIG_BACKLIGHT_LCD_SUPPORT=y CONFIG_LCD_PLATFORM=y +CONFIG_BACKLIGHT_PWM=y # CONFIG_USB_SUPPORT is not set CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y @@ -77,6 +77,8 @@ CONFIG_LEDS_GPIO=y CONFIG_LEDS_TRIGGERS=y CONFIG_LEDS_TRIGGER_HEARTBEAT=y # CONFIG_IOMMU_SUPPORT is not set +CONFIG_PWM=y +CONFIG_PWM_CLPS711X=y CONFIG_EXT2_FS=y CONFIG_CRAMFS=y CONFIG_MINIX_FS=y diff --git a/arch/arm/mach-clps711x/board-edb7211.c b/arch/arm/mach-clps711x/board-edb7211.c index fdf54d4..f339797 100644 --- a/arch/arm/mach-clps711x/board-edb7211.c +++ b/arch/arm/mach-clps711x/board-edb7211.c @@ -14,8 +14,9 @@ #include #include #include -#include #include +#include +#include #include #include @@ -108,23 +109,23 @@ static struct plat_lcd_data edb7211_lcd_power_pdata = { .set_power = edb7211_lcd_power_set, }; -static void edb7211_lcd_backlight_set_intensity(int intensity) -{ - gpio_set_value(EDB7211_LCDBL, !!intensity); - clps_writel((clps_readl(PMPCON) & 0xf0ff) | (intensity << 8), PMPCON); -} +static struct pwm_lookup edb7211_pwm_lookup[] = { + PWM_LOOKUP("clps711x-pwm", 0, "pwm-backlight.0", NULL, + 0, PWM_POLARITY_NORMAL), +}; -static struct generic_bl_info edb7211_lcd_backlight_pdata = { - .name = "lcd-backlight.0", - .default_intensity = 0x01, - .max_intensity = 0x0f, - .set_bl_intensity = edb7211_lcd_backlight_set_intensity, +static struct platform_pwm_backlight_data pwm_bl_pdata = { + .dft_brightness = 0x01, + .max_brightness = 0x0f, + .enable_gpio = EDB7211_LCDBL, }; +static struct resource clps711x_pwm_res = + DEFINE_RES_MEM(CLPS711X_PHYS_BASE + PMPCON, SZ_4); + static struct gpio edb7211_gpios[] __initconst = { { EDB7211_LCD_DC_DC_EN, GPIOF_OUT_INIT_LOW, "LCD DC-DC" }, { EDB7211_LCDEN, GPIOF_OUT_INIT_LOW, "LCD POWER" }, - { EDB7211_LCDBL, GPIOF_OUT_INIT_LOW, "LCD BACKLIGHT" }, }; /* Reserve screen memory region at the start of main system memory. */ @@ -153,12 +154,18 @@ static void __init edb7211_init_late(void) gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios)); platform_device_register(&edb7211_flash_pdev); + platform_device_register_data(NULL, "platform-lcd", 0, &edb7211_lcd_power_pdata, sizeof(edb7211_lcd_power_pdata)); - platform_device_register_data(NULL, "generic-bl", 0, - &edb7211_lcd_backlight_pdata, - sizeof(edb7211_lcd_backlight_pdata)); + + platform_device_register_simple("clps711x-pwm", PLATFORM_DEVID_NONE, + &clps711x_pwm_res, 1); + pwm_add_table(edb7211_pwm_lookup, ARRAY_SIZE(edb7211_pwm_lookup)); + + platform_device_register_data(&platform_bus, "pwm-backlight", 0, + &pwm_bl_pdata, sizeof(pwm_bl_pdata)); + platform_device_register_simple("video-clps711x", 0, NULL, 0); platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource, ARRAY_SIZE(edb7211_cs8900_resource));