From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com. [210.118.77.12]) by gmr-mx.google.com with ESMTPS id ui7si1169871pab.0.2016.02.03.16.10.34 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 03 Feb 2016 16:10:34 -0800 (PST) Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O1Z008G0XTHNO50@mailout2.w1.samsung.com> for rtc-linux@googlegroups.com; Thu, 04 Feb 2016 00:10:29 +0000 (GMT) Subject: [rtc-linux] Re: [PATCH V3 5/5] rtc: max77686: move initialisation of rtc regmap, irq chip locally To: Laxman Dewangan , lee.jones@linaro.org, alexandre.belloni@free-electrons.com, javier@osg.samsung.com References: <1454507233-9959-1-git-send-email-ldewangan@nvidia.com> <1454507233-9959-6-git-send-email-ldewangan@nvidia.com> Cc: cw00.choi@samsung.com, linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com From: Krzysztof Kozlowski Message-id: <56B296F6.3060002@samsung.com> Date: Thu, 04 Feb 2016 09:10:30 +0900 MIME-version: 1.0 In-reply-to: <1454507233-9959-6-git-send-email-ldewangan@nvidia.com> Content-type: text/plain; charset=UTF-8 Reply-To: rtc-linux@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , On 03.02.2016 22:47, Laxman Dewangan wrote: > To make RTC block of MAX77686/MAX77802 as independent driver, > move the registration of i2c device, regmap for register access > and irq_chip for interrupt support inside the RTC driver. > Removed the same initialisation from MFD driver. > > Having this change will allow to reuse this driver for different > PMIC/devices from Maxim Semiconductor if they kept same RTC IP on > different PMIC. Some of examples as PMIC MAX77620, MAX20024 where > same RTC IP used and hence driver for these chips will use this > driver only for RTC support. > > Suggested-by: Krzysztof Kozlowski > Signed-off-by: Laxman Dewangan > CC: Krzysztof Kozlowski > CC: Javier Martinez Canillas > Reviewed-by: Javier Martinez Canillas > > --- > Changes from V1: > - Remove changes from Kconfig. > - Maintain all register definition in max77686 private header and remove > the movement to rtc driver. > - Taken care of all comments on V1 from Krzysztof and Javier. > > Changes from V2: > - Taken care of missed sequence for removing the resource. > - Fix the crash when doing unbind by using requested_threaded_irq() > instead of demv_requested_threaded_irq(). > > drivers/mfd/max77686.c | 85 +------------------- > drivers/rtc/rtc-max77686.c | 148 ++++++++++++++++++++++++++++++----- > include/linux/mfd/max77686-private.h | 3 - > 3 files changed, 130 insertions(+), 106 deletions(-) > Looks good and works properly (RTC, unbind/rebind, wakealarm again) but... after applying this patch the device cannot suspend to RAM after unbind/rebind. Reproduce path, after booting: $ echo max77686-rtc > /sys/bus/platform/drivers/max77686-rtc/unbind $ echo max77686-rtc > /sys/bus/platform/drivers/max77686-rtc/bind $ rtcwake -d rtc2 -m mem -s 5 -v (or instead of rtcwake: echo mem > /sys/power/state) Proper behaviour: ############################## [ 28.549244] PM: late suspend of devices complete after 2.239 msecs [ 28.556051] PM: noirq suspend of devices complete after 2.078 msecs [ 28.560952] Disabling non-boot CPUs ... [ 28.588392] CPU1: shutdown [ 28.623283] CPU2: shutdown [ 28.653242] CPU3: shutdown Power usage drops. Device wakes up (either from RTC or from manual, e.g. key press) ############################## Behaviour with patch 5/5: [ 67.068586] PM: Syncing filesystems ... done. [ 67.121673] Freezing user space processes ... (elapsed 0.004 seconds) done. [ 67.123457] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 67.182024] wake enabled for irq 125 [ 67.184315] wake enabled for irq 127 [ 67.187829] wake enabled for irq 147 [ 67.191238] wake enabled for irq 148 [ 67.195178] dwc2 12480000.hsotg: suspending usb gadget g_ether [ 67.200647] dwc2 12480000.hsotg: new device is full-speed [ 67.206036] dwc2 12480000.hsotg: dwc2_hsotg_ep_disable: called for ep0 [ 67.212523] dwc2 12480000.hsotg: dwc2_hsotg_ep_disable: called for ep0 [ 67.221742] PM: suspend of devices complete after 93.132 msecs [ 67.226113] VALIVE_1.0V_AP: No configuration [ 67.230399] VCC_1.8V_AP: No configuration [ 67.234385] VCC_2.8V_AP: No configuration [ 67.238373] VCC_1.8V_IO: No configuration [ 67.243130] CAM_ISP_MIPI_1.2V: No configuration [ 67.249142] NFC_AVDD_1.8V: No configuration [ 67.252661] CAM_SENSOR_CORE_1.2V: No configuration [ 67.256648] CAM_ISP_SEN_IO_1.8V: No configuration [ 67.261311] VT_CAM_1.8V: No configuration [ 67.265323] VDDQ_PRE_1.8V: No configuration [ 67.269488] VTF_2.8V: No configuration [ 67.273219] VMEM_VDD_2.8V: No configuration [ 67.277386] TSP_AVDD_3.3V: No configuration [ 67.281553] TSP_VDD_1.8V: No configuration [ 67.285615] LCD_VCC_3.3V: No configuration [ 67.289712] MOTOR_VCC_3.0V: No configuration [ 67.296266] VMEM_1.2V_AP: No configuration [ 67.298902] VCC_SUB_1.35V: No configuration [ 67.303064] VCC_SUB_2.0V: No configuration [ 67.307142] VMEM_VDDF_3.0V: No configuration [ 67.311377] CAM_ISP_CORE_1.2V: No configuration [ 67.318181] PM: late suspend of devices complete after 2.267 msecs [ 67.325046] PM: noirq suspend of devices complete after 2.137 msecs [ 67.329857] Disabling non-boot CPUs ... No CPU shutdown messages. Power usage not decreased, device does not wake up. I don't know yet what is the cause... At first glance it looks okay... Best regards, Krzysztof -- -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756268AbcBDAKe (ORCPT ); Wed, 3 Feb 2016 19:10:34 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:30002 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751494AbcBDAKc (ORCPT ); Wed, 3 Feb 2016 19:10:32 -0500 X-AuditID: cbfec7f5-f79b16d000005389-1b-56b296f5d8a1 Subject: Re: [PATCH V3 5/5] rtc: max77686: move initialisation of rtc regmap, irq chip locally To: Laxman Dewangan , lee.jones@linaro.org, alexandre.belloni@free-electrons.com, javier@osg.samsung.com References: <1454507233-9959-1-git-send-email-ldewangan@nvidia.com> <1454507233-9959-6-git-send-email-ldewangan@nvidia.com> Cc: cw00.choi@samsung.com, linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com From: Krzysztof Kozlowski X-Enigmail-Draft-Status: N1110 Message-id: <56B296F6.3060002@samsung.com> Date: Thu, 04 Feb 2016 09:10:30 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-version: 1.0 In-reply-to: <1454507233-9959-6-git-send-email-ldewangan@nvidia.com> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrKLMWRmVeSWpSXmKPExsVy+t/xa7pfp20KM7g8TdKi49piJovrX56z Wrx5u4bJ4vULQ4ul+1azWNz/epTR4vKuOWwW+zs7GB04PJ5susjosWfiSTaPO9f2sHn0Nr9j 89jSf5fdo2/LKkaPz5vkAtijuGxSUnMyy1KL9O0SuDK+vJzJWNCnUnFvyWK2BsZ9sl2MnBwS AiYSN36dZYawxSQu3FvP1sXIxSEksJRR4sOXmVDOU0aJOW//gVUJCyRIrHp4ix0kISLQwCjx +eZrsISQQK3EkUPz2EBsZoFQiQsvr4PF2QSMJTYvX8IGsUJOord7EguIzSugJdGyZz0riM0i oCpx4ftXsBpRgQiJw51d7BA1ghI/Jt8Dq+cUcJG4s/4iUJwDaL6exP2LWhCr5CU2r3nLPIFR cBaSjlkIVbOQVC1gZF7FKJpamlxQnJSea6RXnJhbXJqXrpecn7uJERIZX3cwLj1mdYhRgINR iYe3wXNTmBBrYllxZe4hRgkOZiUR3p4SoBBvSmJlVWpRfnxRaU5q8SFGaQ4WJXHembvehwgJ pCeWpGanphakFsFkmTg4pRoY92zlZ5z5ft6+CQd+VDTZ9VWUM6Xe3uq7Z87E5/tjtuR+nGLR LrR+s6XUzEU7m44JlVTeZ9QP3W1hlfr5Q5ttRv2k7F/NjyfbZ+3/07HI+lNZ+wFLVu4mbqfJ chM1HbuvN5/Umnaj7XJwyYHD9kKq1mZ7dobe8N7ozHOiZXpvn5uLR72arbmkEktxRqKhFnNR cSIARWyQ34gCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03.02.2016 22:47, Laxman Dewangan wrote: > To make RTC block of MAX77686/MAX77802 as independent driver, > move the registration of i2c device, regmap for register access > and irq_chip for interrupt support inside the RTC driver. > Removed the same initialisation from MFD driver. > > Having this change will allow to reuse this driver for different > PMIC/devices from Maxim Semiconductor if they kept same RTC IP on > different PMIC. Some of examples as PMIC MAX77620, MAX20024 where > same RTC IP used and hence driver for these chips will use this > driver only for RTC support. > > Suggested-by: Krzysztof Kozlowski > Signed-off-by: Laxman Dewangan > CC: Krzysztof Kozlowski > CC: Javier Martinez Canillas > Reviewed-by: Javier Martinez Canillas > > --- > Changes from V1: > - Remove changes from Kconfig. > - Maintain all register definition in max77686 private header and remove > the movement to rtc driver. > - Taken care of all comments on V1 from Krzysztof and Javier. > > Changes from V2: > - Taken care of missed sequence for removing the resource. > - Fix the crash when doing unbind by using requested_threaded_irq() > instead of demv_requested_threaded_irq(). > > drivers/mfd/max77686.c | 85 +------------------- > drivers/rtc/rtc-max77686.c | 148 ++++++++++++++++++++++++++++++----- > include/linux/mfd/max77686-private.h | 3 - > 3 files changed, 130 insertions(+), 106 deletions(-) > Looks good and works properly (RTC, unbind/rebind, wakealarm again) but... after applying this patch the device cannot suspend to RAM after unbind/rebind. Reproduce path, after booting: $ echo max77686-rtc > /sys/bus/platform/drivers/max77686-rtc/unbind $ echo max77686-rtc > /sys/bus/platform/drivers/max77686-rtc/bind $ rtcwake -d rtc2 -m mem -s 5 -v (or instead of rtcwake: echo mem > /sys/power/state) Proper behaviour: ############################## [ 28.549244] PM: late suspend of devices complete after 2.239 msecs [ 28.556051] PM: noirq suspend of devices complete after 2.078 msecs [ 28.560952] Disabling non-boot CPUs ... [ 28.588392] CPU1: shutdown [ 28.623283] CPU2: shutdown [ 28.653242] CPU3: shutdown Power usage drops. Device wakes up (either from RTC or from manual, e.g. key press) ############################## Behaviour with patch 5/5: [ 67.068586] PM: Syncing filesystems ... done. [ 67.121673] Freezing user space processes ... (elapsed 0.004 seconds) done. [ 67.123457] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 67.182024] wake enabled for irq 125 [ 67.184315] wake enabled for irq 127 [ 67.187829] wake enabled for irq 147 [ 67.191238] wake enabled for irq 148 [ 67.195178] dwc2 12480000.hsotg: suspending usb gadget g_ether [ 67.200647] dwc2 12480000.hsotg: new device is full-speed [ 67.206036] dwc2 12480000.hsotg: dwc2_hsotg_ep_disable: called for ep0 [ 67.212523] dwc2 12480000.hsotg: dwc2_hsotg_ep_disable: called for ep0 [ 67.221742] PM: suspend of devices complete after 93.132 msecs [ 67.226113] VALIVE_1.0V_AP: No configuration [ 67.230399] VCC_1.8V_AP: No configuration [ 67.234385] VCC_2.8V_AP: No configuration [ 67.238373] VCC_1.8V_IO: No configuration [ 67.243130] CAM_ISP_MIPI_1.2V: No configuration [ 67.249142] NFC_AVDD_1.8V: No configuration [ 67.252661] CAM_SENSOR_CORE_1.2V: No configuration [ 67.256648] CAM_ISP_SEN_IO_1.8V: No configuration [ 67.261311] VT_CAM_1.8V: No configuration [ 67.265323] VDDQ_PRE_1.8V: No configuration [ 67.269488] VTF_2.8V: No configuration [ 67.273219] VMEM_VDD_2.8V: No configuration [ 67.277386] TSP_AVDD_3.3V: No configuration [ 67.281553] TSP_VDD_1.8V: No configuration [ 67.285615] LCD_VCC_3.3V: No configuration [ 67.289712] MOTOR_VCC_3.0V: No configuration [ 67.296266] VMEM_1.2V_AP: No configuration [ 67.298902] VCC_SUB_1.35V: No configuration [ 67.303064] VCC_SUB_2.0V: No configuration [ 67.307142] VMEM_VDDF_3.0V: No configuration [ 67.311377] CAM_ISP_CORE_1.2V: No configuration [ 67.318181] PM: late suspend of devices complete after 2.267 msecs [ 67.325046] PM: noirq suspend of devices complete after 2.137 msecs [ 67.329857] Disabling non-boot CPUs ... No CPU shutdown messages. Power usage not decreased, device does not wake up. I don't know yet what is the cause... At first glance it looks okay... Best regards, Krzysztof