From patchwork Fri Nov 30 01:06:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dromede@gmail.com X-Patchwork-Id: 1823331 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 57235DF23A for ; Fri, 30 Nov 2012 01:12:42 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TeF6E-0004nI-1b; Fri, 30 Nov 2012 01:09:02 +0000 Received: from mail-ea0-f177.google.com ([209.85.215.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TeF6A-0004mz-3H for linux-arm-kernel@lists.infradead.org; Fri, 30 Nov 2012 01:08:58 +0000 Received: by mail-ea0-f177.google.com with SMTP id c10so4143643eaa.36 for ; Thu, 29 Nov 2012 17:08:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=YQ750WNHAg0z9ukmMwZm6akAEaHWczRK37QDktcRQvs=; b=agjRePEwaXt033Rx4zyKAXMwzF7ReDZUZ/E4s3/OJUAPqFTNmupXrPz2NB+x+SwUXx lbNIV+foFD7MmwRWMo6aO9dLjGDhW4Q+qmWVFDihjkEGFFGeSJv91NhRQmB9eI1sNf4O qOXgEtqe5VcJ6mDXySDsKPQiOOixS5PsXSXu5PeG3046MXB0gldV87dw0wMQJooRW3jy VCW8WbBqSfMJ+WU/KhYMmW42KX4rZRtGcd7zgHIZshxuXlLWHoADgag2Lsz8twCdAkLG DT5IIotzdzXETKSuSeXA6isxnHQI5F9/X8o6GF/IjXVfUB/4m5iVGoqv072q3WMRKND9 wp0w== Received: by 10.14.194.71 with SMTP id l47mr87564670een.6.1354237735809; Thu, 29 Nov 2012 17:08:55 -0800 (PST) Received: from localhost.localdomain (93-136-127-248.adsl.net.t-com.hr. [93.136.127.248]) by mx.google.com with ESMTPS id e1sm7226733eem.3.2012.11.29.17.08.53 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 29 Nov 2012 17:08:54 -0800 (PST) From: dromede@gmail.com To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] backlight: corgi_lcd: Use gpio_set_value_cansleep() for akita machines to avoid WARN_ON trigger Date: Fri, 30 Nov 2012 02:06:17 +0100 Message-Id: <1354237577-4653-1-git-send-email-dromede@gmail.com> X-Mailer: git-send-email 1.7.10.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121129_200858_310140_47289888 X-CRM114-Status: GOOD ( 13.87 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.215.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (dromede[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Marko Katic , akpm@linux-foundation.org, jg1.han@samsung.com, linux@arm.linux.org.uk X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Marko Katic Changing backlight intensity on an Akita (Sharp Zaurus C-1000) will always trigger a WARN_ON: WARNING: at drivers/gpio/gpiolib.c:1672 __gpio_set_value+0x38/0xa4() Modules linked in: Backtrace: [] (dump_backtrace+0x0/0x110) from [] (dump_stack+0x18/0x1c) r6:c0158fc8 r5:00000009 r4:00000000 r3:c03d4f70 [] (dump_stack+0x0/0x1c) from [] (warn_slowpath_common+0x54/0x6c) [] (warn_slowpath_common+0x0/0x6c) from [] (warn_slowpath_null+0x24/0x2c) r8:c38d5c00 r7:c03f82c0 r6:00000000 r5:000000d0 r4:c384e4fc r3:00000009 [] (warn_slowpath_null+0x0/0x2c) from [] (__gpio_set_value+0x38/0xa4) [] (__gpio_set_value+0x0/0xa4) from [] (corgi_bl_set_intensity+0x44/0x74) r7:c3933418 r6:c3933400 r5:c392cdf0 r4:0000002f [] (corgi_bl_set_intensity+0x0/0x74) from [] (corgi_bl_update_status+0x5c/0x64) r5:c03d31f0 r4:c3933400 [] (corgi_bl_update_status+0x0/0x64) from [] (corgi_lcd_probe+0x1a8/0x258) r4:c392cdf0 r3:c0169bc0 [] (corgi_lcd_probe+0x0/0x258) from [] (spi_drv_probe+0x20/0x24) r8:00000052 r7:c0192d9c r6:c03da6e8 r5:c38d5c34 r4:c38d5c00 [] (spi_drv_probe+0x0/0x24) from [] (driver_probe_device+0xb0/0x208) [] (driver_probe_device+0x0/0x208) from [] (__driver_attach+0x70/0x94) r6:c03da6e8 r5:c38d5c34 r4:c38d5c00 r3:00000000 [] (__driver_attach+0x0/0x94) from [] (bus_for_each_dev+0x54/0x90) r6:c03da6e8 r5:c3827e80 r4:00000000 r3:00000000 [] (bus_for_each_dev+0x0/0x90) from [] (driver_attach+0x20/0x28) r7:00000000 r6:c03e29ec r5:c3932980 r4:c03da6e8 [] (driver_attach+0x0/0x28) from [] (bus_add_driver+0xd4/0x22c) [] (bus_add_driver+0x0/0x22c) from [] (driver_register+0xa4/0x134) r8:00000052 r7:c03ea900 r6:c03c32ac r5:c03bdfc8 r4:c03da6e8 [] (driver_register+0x0/0x134) from [] (spi_register_driver+0x4c/0x60) [] (spi_register_driver+0x0/0x60) from [] (corgi_lcd_driver_init+0x14/0x1c) [] (corgi_lcd_driver_init+0x0/0x1c) from [] (do_one_initcall+0x9c/0x174) [] (do_one_initcall+0x0/0x174) from [] (kernel_init+0xf4/0x2a8) [] (kernel_init+0x0/0x2a8) from [] (ret_from_fork+0x14/0x24) ---[ end trace a863a63f242ee38c ]--- Akita machines have backlight controls hooked to a gpio expander chip, max7310. The driver that controls the max7310 sets the cansleep flag and the corgi_lcd driver only uses plain gpio_set_value calls for changing backlight controls. This triggers the WARN_ON on akita machines. Akita is the only exception in this case since other users of corgi_bl access backlight gpio controls through a different gpio expander which does not set the cansleep flag. Fix this by conditionally using gpio_set_value_cansleep() when changing backlight intensity on akita machines. Signed-off-by: Marko Katic --- drivers/video/backlight/corgi_lcd.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c index c781768..f33e26f 100644 --- a/drivers/video/backlight/corgi_lcd.c +++ b/drivers/video/backlight/corgi_lcd.c @@ -26,7 +26,7 @@ #include #include #include - +#include #define POWER_IS_ON(pwr) ((pwr) <= FB_BLANK_NORMAL) /* Register Addresses */ @@ -408,11 +408,19 @@ static int corgi_bl_set_intensity(struct corgi_lcd *lcd, int intensity) /* Bit 5 via GPIO_BACKLIGHT_CONT */ cont = !!(intensity & 0x20) ^ lcd->gpio_backlight_cont_inverted; - if (gpio_is_valid(lcd->gpio_backlight_cont)) - gpio_set_value(lcd->gpio_backlight_cont, cont); + if (gpio_is_valid(lcd->gpio_backlight_cont)) { + if (machine_is_akita()) + gpio_set_value_cansleep(lcd->gpio_backlight_cont, cont); + else + gpio_set_value(lcd->gpio_backlight_cont, cont); + } - if (gpio_is_valid(lcd->gpio_backlight_on)) - gpio_set_value(lcd->gpio_backlight_on, intensity); + if (gpio_is_valid(lcd->gpio_backlight_on)) { + if (machine_is_akita()) + gpio_set_value_cansleep(lcd->gpio_backlight_on, intensity); + else + gpio_set_value(lcd->gpio_backlight_on, intensity); + } if (lcd->kick_battery) lcd->kick_battery();