From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754540AbcANAuW (ORCPT ); Wed, 13 Jan 2016 19:50:22 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:63471 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752303AbcANAuS (ORCPT ); Wed, 13 Jan 2016 19:50:18 -0500 X-AuditID: cbfec7f4-f79026d00000418a-29-5696f0c709b7 Subject: Re: [PATCH V2 5/6] rtc: max77xxx: add RTC driver for Maxim MAX77xxx series RTC IP To: Laxman Dewangan , robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, linus.walleij@linaro.org, gnurou@gmail.com, lee.jones@linaro.org, broonie@kernel.org, a.zummo@towertech.it, alexandre.belloni@free-electrons.com References: <1452590273-16421-1-git-send-email-ldewangan@nvidia.com> <1452590273-16421-6-git-send-email-ldewangan@nvidia.com> <569594F0.4020007@samsung.com> <5695CD73.5010709@nvidia.com> <5695D268.3060705@samsung.com> <5695D1AF.9000806@nvidia.com> <5696665A.5030508@nvidia.com> Cc: lgirdwood@gmail.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, rtc-linux@googlegroups.com, swarren@nvidia.com, treding@nvidia.com From: Krzysztof Kozlowski Message-id: <5696F0C4.1060904@samsung.com> Date: Thu, 14 Jan 2016 09:50:12 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-version: 1.0 In-reply-to: <5696665A.5030508@nvidia.com> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsVy+t/xK7rHP0wLM2j5zGKx5OJVdouOa4uZ LKY+fMJmMf/IOVaL/jcLWS3OvXrEAiRWMlq8fmFosXTfahaL+1+PMlp8u9LBZDHlz3Imi83z /zBaXN41h81i6fWLTBYTpq9lsWjde4TdYn9nB6PFjektrBa3f/M5iHismbeG0eNyXy+Tx5NN Fxk9ds66y+6xZ+JJNo+Vy7+weWxa1cnmcefaHjaP3uZ3bB59W1Yxekyf95PJ4/MmuQCeKC6b lNSczLLUIn27BK6MNZ+OshdcEqvYeUqigfGoQBcjJ4eEgInEnUmz2CBsMYkL99YD2VwcQgJL GSWOnN7DDuE8ZZRY8+ofK0iVsECMxIvVc1lAEiIC25kkNt14xgiSEBKYyySxaLMZSIJZYCuj xPetH1lAEmwCxhKbly8B28EroCXxa+NysEksAqoSL1f2A8U5OEQFIiQW7ciEKBGU+DH5Hlgr J1D54aNXWUFKmAX0JO5f1AIJMwvIS2xe85Z5AqPALCQdsxCqZiGpWsDIvIpRNLU0uaA4KT3X UK84Mbe4NC9dLzk/dxMjJE6/7GBcfMzqEKMAB6MSD++Pu9PChFgTy4orcw8xSnAwK4nw3n0L FOJNSaysSi3Kjy8qzUktPsQozcGiJM47d9f7ECGB9MSS1OzU1ILUIpgsEwenVAOjXkHm5v// 529nXfNoL4dixaUlTF6Behcbt+xY15z0zfW3QWfbmTMP91xbvXzrNcd5Mg3TO/huqGrnKn55 wHixSzxPJyTi9FTudOU5TUV3Np6Q+lb8fOHD+tu9Yneu562O9Dh1+dguxeMe4jMCDm5J/Vrz Y3nYur27fyuJ7F+ZdvDbmXUCTHdvmCmxFGckGmoxFxUnAgDm+1OezwIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13.01.2016 23:59, Laxman Dewangan wrote: > > On Wednesday 13 January 2016 09:55 AM, Laxman Dewangan wrote: >> >> On Wednesday 13 January 2016 09:58 AM, Krzysztof Kozlowski wrote: >>> On 13.01.2016 13:07, Laxman Dewangan wrote: >>>> On Wednesday 13 January 2016 05:36 AM, Krzysztof Kozlowski wrote: >>> >>>> That is also fine to me but still I am not comfortable with the config >>>> name and driver file name as this does not suggest the common. >>> The name does not matter. Really. We have a lot of drivers with a >>> specific device-like name and supporting different devices. To point >>> that your argument is invalid - your initial name of driver >>> "rtc-max77620.c" supported totally different "names": the max77620 and >>> max20024. It also wasn't suggesting something "common"... >> In all config string, I have mentioned the MAX20024. >> >> >>> With my approach we are not developing common think neither. We just >>> want to extend/re-use existing max77686 (or max77802) driver for new >>> devices. Just like everywhere else. >> >> OK, fine to me if this is acceptable. >> I will drop this rtc patch form this series and work in max77686 >> driver to modify first and once merged, use this config on my defconfig. >> > > Here, MAX686 RTC driver needs two regmap handle, one for the rtc_regmap > and other for STATUS2 register access. > > ret = regmap_read(info->max77686->regmap, MAX77686_REG_STATUS2, > &val); > if (ret < 0) { > dev_err(info->dev, "%s:%d fail to read status2 reg(%d)\n", > __func__, __LINE__, ret); > goto out; > } > > > We can not have two regmap handle on rtc driver as both regmap (pmic and > rtc) registered with different i2c device. > > Also this register should not be accessed by RTC driver if we want to > decouple as this is very much MAX77686 register set. > Do we need this code? > static int max77686_rtc_read_alarm(struct device *dev, struct rtc_wkalrm > *alrm) > { > struct max77686_rtc_info *info = dev_get_drvdata(dev); > u8 data[RTC_NR_TIME]; > unsigned int val; > int i, ret; > > :::::::: > alrm->pending = 0; > ret = regmap_read(info->max77686->regmap, MAX77686_REG_STATUS2, > &val); > if (ret < 0) { > dev_err(info->dev, "%s:%d fail to read status2 reg(%d)\n", > __func__, __LINE__, ret); > goto out; > } > > if (val & (1 << 4)) /* RTCA1 */ > alrm->pending = 1; > > } Most of the drivers set the 'pending' field when reading alarm. Your original driver did not. The max77802 does exactly the same (BTW, these should be merged as well... I'll add this to the TODO list) so I think this is necessary. BR, Krzysztof