From patchwork Tue Dec 4 05:28:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingoo Han X-Patchwork-Id: 1836081 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 5448FDF23A for ; Tue, 4 Dec 2012 05:30:53 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tfl3R-000070-LR; Tue, 04 Dec 2012 05:28:25 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tfl3M-00005s-88 for linux-arm-kernel@lists.infradead.org; Tue, 04 Dec 2012 05:28:22 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MEH00HDLR6MO130@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 04 Dec 2012 14:28:16 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.48]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id E1.B6.01231.0F98DB05; Tue, 04 Dec 2012 14:28:16 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-e5-50bd89f0457f Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 51.B6.01231.FE98DB05; Tue, 04 Dec 2012 14:28:16 +0900 (KST) Received: from DOJG1HAN02 ([12.23.120.99]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MEH00F05R73F3B0@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 04 Dec 2012 14:28:15 +0900 (KST) From: Jingoo Han To: 'Andrew Morton' , 'LKML' Subject: [PATCH v3] backlight: corgi_lcd: Use gpio_set_value_cansleep() to avoid WARN_ON Date: Tue, 04 Dec 2012 14:28:15 +0900 Message-id: <000b01cdd1e0$293f0d90$7bbd28b0$%han@samsung.com> MIME-version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac3R4CjcxjabLco0SliKJ0TfRLMaJg== Content-language: ko DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAIsWRmVeSWpSXmKPExsVy+t8zA90PnXsDDHb947TY9PgaqwOjx+Yl 9QGMUVw2Kak5mWWpRfp2CVwZB9ZOZC7YpFTx7dcc1gbGo3JdjJwcEgImEv2THzFD2GISF+6t Z+ti5OIQEljGKLHxxQkWmKLOD49YIRKLGCXuXL0O5Sxmkvj6dTNYO5uAmsSXL4fZQWwRgQiJ 5hmzmEGKmAUamSReL5jHCpIQFoiSeDFxNRuIzSKgKtG/bQUjiM0rYCuxfc4ddghbUOLH5Htg q5kFtCTW7zzOBGHLS2xe8xZoKAfQSeoSj/7qQuzSk3i78TEjRImIxL4X7xghxgtIfJt8iAWi XFZi0wGwcyQEutklLs84zw7xmaTEwRU3WCYwis1CsnkWks2zkGyehWTFAkaWVYyiqQXJBcVJ 6bmGesWJucWleel6yfm5mxgh0SK1g3Flg8UhRgEORiUe3hkP9wQIsSaWFVfmHmKU4GBWEuE9 47U3QIg3JbGyKrUoP76oNCe1+BCjD9DlE5mlRJPzgZGcVxJvaGxsYmZiamJuaWpuikNYSZy3 2SMlQEggPbEkNTs1tSC1CGYcEwenVAPjzBMtj+a9LdNR7RXrucRYFrDidPfk/wsnH4thZZHe clb/TqLt9Bk937cumLbDpqn9c26PaORXlkc2pSff5q5fdINjwo/Z++KfFLm3OD00DWq482bl h7dVH0Ulr82ddjOwYKqii8CRim1rvtfq3OTSWKhQIFejaPfm2Y3oVTVJl5+pyZ9MNX7yT4ml OCPRUIu5qDgRAIUvUHnDAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPIsWRmVeSWpSXmKPExsVy+t9jAd0PnXsDDGY0slpsenyN1YHRY/OS +gDGqAZGm4zUxJTUIoXUvOT8lMy8dFsl7+B453hTMwNDXUNLC3MlhbzE3FRbJRefAF23zByg qUoKZYk5pUChgMTiYiV9O0wTQkPcdC1gGiN0fUOC4HqMDNBAwjrGjANrJzIXbFKq+PZrDmsD 41G5LkZODgkBE4nOD49YIWwxiQv31rN1MXJxCAksYpS4c/U6K4SzmEni69fNzCBVbAJqEl++ HGYHsUUEIiSaZ8xiBiliFmhkkni9YB7YKGGBKIkXE1ezgdgsAqoS/dtWMILYvAK2Etvn3GGH sAUlfky+xwJiMwtoSazfeZwJwpaX2LzmLdBQDqCT1CUe/dWF2KUn8XbjY0aIEhGJfS/eMU5g FJiFZNIsJJNmIZk0C0nLAkaWVYyiqQXJBcVJ6bmGesWJucWleel6yfm5mxjBsfhMagfjygaL Q4wCHIxKPLwzHu4JEGJNLCuuzD3EKMHBrCTCe8Zrb4AQb0piZVVqUX58UWlOavEhRh+gRycy S4km5wPTRF5JvKGxiZmRpZGZhZGJuTkOYSVx3maPlAAhgfTEktTs1NSC1CKYcUwcnFINjOV2 18483WP5ZGuhhvE2ve86dybHfkjJNlML33pPaU+Nn4eqm+iEGp7AsDKlFUWm85/ckKuueD5F 9+LeHQ2/A3tmG26KPqv4Rj+X55PabX2NH/Zn1/5KkKkN9py3xZrfb9ZCX7/s+nDbZx+j/0+d k1VUadXxzUa88VihkcTXi7PmJv7+uOTRByWW4oxEQy3mouJEAK5kqeLyAgAA X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121204_002820_857456_4D30CE5D X-CRM114-Status: GOOD ( 11.38 ) X-Spam-Score: -7.5 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.34 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 HDRS_LCASE Odd capitalization of message header 0.0 T_MANY_HDRS_LCASE Odd capitalization of multiple message headers Cc: 'Florian Tobias Schandinat' , 'Marko Katic' , 'Jingoo Han' , 'Grant Likely' , 'Richard Purdie' , linux-arm-kernel@lists.infradead.org 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: , 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) triggers WARN_ON message: 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. In this case, pca953x_gpio_set_value() can be called to control gpio, and pca953x_setup_gpio() sets can_sleep flag. Therefore, gpio_set_value_cansleep() should be used in order to avoid WARN_ON on akita machines. Akita is the only exception in this case since other users of corgi_lcd access backlight gpio controls through a different gpio expander such as max7310 which does not set the can_sleep flag. [jg1.han@samsung.com: used gpio_cansleep()] Signed-off-by: Marko Katic Signed-off-by: Jingoo Han --- drivers/video/backlight/corgi_lcd.c | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c index e2e1b62..e5168f4 100644 --- a/drivers/video/backlight/corgi_lcd.c +++ b/drivers/video/backlight/corgi_lcd.c @@ -408,11 +408,20 @@ 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 (gpio_cansleep(lcd->gpio_backlight_cont)) + 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 (gpio_cansleep(lcd->gpio_backlight_on)) + 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();