All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Javier Martinez Canillas <javier@osg.samsung.com>,
	linux-kernel@vger.kernel.org
Cc: Kukjin Kim <kgene@kernel.org>,
	rtc-linux@googlegroups.com, Andi Shyti <andi.shyti@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	Laxman Dewangan <ldewangan@nvidia.com>,
	linux-samsung-soc@vger.kernel.org
Subject: [rtc-linux] Re: [PATCH v4 06/10] rtc: max77686: Add max77802 support
Date: Wed, 27 Jan 2016 13:23:18 +0900	[thread overview]
Message-ID: <56A84636.2000107@samsung.com> (raw)
In-Reply-To: <1453865806-4661-7-git-send-email-javier@osg.samsung.com>

On 27.01.2016 12:36, Javier Martinez Canillas wrote:
> The MAX77686 and MAX77802 RTC IP blocks are very similar with only
> these differences:
> 
> 0) The RTC registers layout and addresses are different.
> 
> 1) The MAX77686 use 1 bit of the sec/min/hour/etc registers as the
>    alarm enable while MAX77802 has a separate register for that.
> 
> 2) The MAX77686 RTCYEAR register valid values range is 0..99 while
>    for MAX77802 is 0..199.
> 
> 3) The MAX77686 has a separate I2C address for the RTC registers
>    while the MAX77802 uses the same I2C address as the PMIC regs.
> 
> 5) The minimum delay before a RTC update (16 msecs vs 200 usecs).
> 
> There are separate drivers for MAX77686 and MAX77802 RTC IP blocks
> but the differences are not that big so the driver can be extended
> to support both instead of duplicating a lot of code in 2 drivers.
> 
> Suggested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
> Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
> Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Reviewed-by: Andi Shyti <andi.shyti@samsung.com>
> 
> ---
> 
> Changes in v4:
> - Add Krzysztof Kozlowski's Tested-by tag to patch #6.
> - Add Andi Shyti's Reviewed-by tag to patch #6.
> - Reverse alarm enable reg check logic. Suggeted by Krzysztof Kozlowski.
> - Return early to avoid an else statement. Suggested by Andi Shyti.
> 
> Changes in v3:
> - Add Laxman Dewangan's Acked-by tag to patch #6.
> 
> Changes in v2:
> - Add a MAX77802 prefix to ALARM_ENABLE_VALUE. Suggested by Krzysztof Kozlowski.
> - Rename .rtcae to .alarm_enable_reg and .rtcrm to .separate_i2c_addr.
>   Suggested by Krzysztof Kozlowski.
> - Don't use func and LINE in error messages. Suggested by Krzysztof Kozlowski.
> - Remove REG_RTC_AE2 since is not used by neither max77686 nor max77802.
> - Check if REG_RTC_AE1 has a valid address before accessing it.
> 
>  drivers/rtc/rtc-max77686.c | 196 ++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 156 insertions(+), 40 deletions(-)
> 

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

One comment at the end...

[...]


> @@ -524,6 +636,9 @@ static int max77686_rtc_probe(struct platform_device *pdev)
>  	info->drv_data = (const struct max77686_rtc_driver_data *)
>  		id->driver_data;
>  
> +	if (!info->drv_data->separate_i2c_addr)
> +		info->max77686->rtc_regmap = info->max77686->regmap;
> +

At this stage I don't like the idea of messing with parent's state
structure. The driver should not modify any of parents data (the best
way would be to take a pointer to const). In this patch this looks like
breaking the encapsulation. If the parent is responsible for regmaps,
then the parent should set rtc_regmap for children (parent also knows
what type device it is working on).

...but I am assuming that a new patch will be following this one - the
patch moving ownership of i2c dummy and regmap to the RTC driver. In
that case this code makes a lot more sense. Am I thinking correctly?

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.

WARNING: multiple messages have this Message-ID (diff)
From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Javier Martinez Canillas <javier@osg.samsung.com>,
	linux-kernel@vger.kernel.org
Cc: Kukjin Kim <kgene@kernel.org>,
	rtc-linux@googlegroups.com, Andi Shyti <andi.shyti@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	Laxman Dewangan <ldewangan@nvidia.com>,
	linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH v4 06/10] rtc: max77686: Add max77802 support
Date: Wed, 27 Jan 2016 13:23:18 +0900	[thread overview]
Message-ID: <56A84636.2000107@samsung.com> (raw)
In-Reply-To: <1453865806-4661-7-git-send-email-javier@osg.samsung.com>

On 27.01.2016 12:36, Javier Martinez Canillas wrote:
> The MAX77686 and MAX77802 RTC IP blocks are very similar with only
> these differences:
> 
> 0) The RTC registers layout and addresses are different.
> 
> 1) The MAX77686 use 1 bit of the sec/min/hour/etc registers as the
>    alarm enable while MAX77802 has a separate register for that.
> 
> 2) The MAX77686 RTCYEAR register valid values range is 0..99 while
>    for MAX77802 is 0..199.
> 
> 3) The MAX77686 has a separate I2C address for the RTC registers
>    while the MAX77802 uses the same I2C address as the PMIC regs.
> 
> 5) The minimum delay before a RTC update (16 msecs vs 200 usecs).
> 
> There are separate drivers for MAX77686 and MAX77802 RTC IP blocks
> but the differences are not that big so the driver can be extended
> to support both instead of duplicating a lot of code in 2 drivers.
> 
> Suggested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
> Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
> Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Reviewed-by: Andi Shyti <andi.shyti@samsung.com>
> 
> ---
> 
> Changes in v4:
> - Add Krzysztof Kozlowski's Tested-by tag to patch #6.
> - Add Andi Shyti's Reviewed-by tag to patch #6.
> - Reverse alarm enable reg check logic. Suggeted by Krzysztof Kozlowski.
> - Return early to avoid an else statement. Suggested by Andi Shyti.
> 
> Changes in v3:
> - Add Laxman Dewangan's Acked-by tag to patch #6.
> 
> Changes in v2:
> - Add a MAX77802 prefix to ALARM_ENABLE_VALUE. Suggested by Krzysztof Kozlowski.
> - Rename .rtcae to .alarm_enable_reg and .rtcrm to .separate_i2c_addr.
>   Suggested by Krzysztof Kozlowski.
> - Don't use func and LINE in error messages. Suggested by Krzysztof Kozlowski.
> - Remove REG_RTC_AE2 since is not used by neither max77686 nor max77802.
> - Check if REG_RTC_AE1 has a valid address before accessing it.
> 
>  drivers/rtc/rtc-max77686.c | 196 ++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 156 insertions(+), 40 deletions(-)
> 

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

One comment at the end...

[...]


> @@ -524,6 +636,9 @@ static int max77686_rtc_probe(struct platform_device *pdev)
>  	info->drv_data = (const struct max77686_rtc_driver_data *)
>  		id->driver_data;
>  
> +	if (!info->drv_data->separate_i2c_addr)
> +		info->max77686->rtc_regmap = info->max77686->regmap;
> +

At this stage I don't like the idea of messing with parent's state
structure. The driver should not modify any of parents data (the best
way would be to take a pointer to const). In this patch this looks like
breaking the encapsulation. If the parent is responsible for regmaps,
then the parent should set rtc_regmap for children (parent also knows
what type device it is working on).

...but I am assuming that a new patch will be following this one - the
patch moving ownership of i2c dummy and regmap to the RTC driver. In
that case this code makes a lot more sense. Am I thinking correctly?

Best regards,
Krzysztof

  reply	other threads:[~2016-01-27  4:23 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-27  3:36 [rtc-linux] [PATCH v4 00/10] rtc: max77686: Extend driver and add max77802 support Javier Martinez Canillas
2016-01-27  3:36 ` Javier Martinez Canillas
2016-01-27  3:36 ` Javier Martinez Canillas
2016-01-27  3:36 ` [rtc-linux] [PATCH v4 01/10] rtc: max77686: Fix max77686_rtc_read_alarm() return value Javier Martinez Canillas
2016-01-27  3:36   ` Javier Martinez Canillas
2016-01-27  3:36 ` [rtc-linux] [PATCH v4 02/10] rtc: max77686: Use ARRAY_SIZE() instead of current array length Javier Martinez Canillas
2016-01-27  3:36   ` Javier Martinez Canillas
2016-01-27  5:57   ` [rtc-linux] " Laxman Dewangan
2016-01-27  5:57     ` Laxman Dewangan
2016-01-27  5:57     ` Laxman Dewangan
2016-01-27  3:36 ` [rtc-linux] [PATCH v4 03/10] rtc: max77686: Use usleep_range() instead of msleep() Javier Martinez Canillas
2016-01-27  3:36   ` Javier Martinez Canillas
2016-01-27  3:36 ` [rtc-linux] [PATCH v4 04/10] rtc: max77686: Use a driver data struct instead hard-coded values Javier Martinez Canillas
2016-01-27  3:36   ` Javier Martinez Canillas
2016-01-27  3:36 ` [rtc-linux] [PATCH v4 05/10] rtc: max77686: Add an indirection level to access RTC registers Javier Martinez Canillas
2016-01-27  3:36   ` Javier Martinez Canillas
2016-01-27  3:36 ` [rtc-linux] [PATCH v4 06/10] rtc: max77686: Add max77802 support Javier Martinez Canillas
2016-01-27  3:36   ` Javier Martinez Canillas
2016-01-27  4:23   ` Krzysztof Kozlowski [this message]
2016-01-27  4:23     ` Krzysztof Kozlowski
2016-01-27  4:37     ` [rtc-linux] " Javier Martinez Canillas
2016-01-27  4:37       ` Javier Martinez Canillas
2016-01-27  3:36 ` [rtc-linux] [PATCH v4 07/10] rtc: max77686: Fix unsupported year message Javier Martinez Canillas
2016-01-27  3:36   ` Javier Martinez Canillas
2016-01-27  4:24   ` [rtc-linux] " Krzysztof Kozlowski
2016-01-27  4:24     ` Krzysztof Kozlowski
2016-01-27  3:36 ` [rtc-linux] [PATCH v4 08/10] rtc: Remove Maxim 77802 driver Javier Martinez Canillas
2016-01-27  3:36   ` Javier Martinez Canillas
2016-01-27  3:36 ` [rtc-linux] [PATCH v4 09/10] ARM: exynos_defconfig: Remove MAX77802 RTC Kconfig symbol Javier Martinez Canillas
2016-01-27  3:36   ` Javier Martinez Canillas
2016-01-27  3:36 ` [rtc-linux] [PATCH v4 10/10] ARM: multi_v7_defconfig: " Javier Martinez Canillas
2016-01-27  3:36   ` Javier Martinez Canillas
2016-01-27  3:36   ` Javier Martinez Canillas
2016-01-28  1:14 ` [rtc-linux] Re: [PATCH v4 00/10] rtc: max77686: Extend driver and add max77802 support Andi Shyti
2016-01-28  1:14   ` Andi Shyti
2016-01-28  1:14   ` Andi Shyti
2016-01-31 12:05 ` Alexandre Belloni
2016-01-31 12:05   ` Alexandre Belloni
2016-01-31 12:11   ` [rtc-linux] " Krzysztof Kozlowski
2016-01-31 12:11     ` Krzysztof Kozlowski
2016-01-31 12:11     ` Krzysztof Kozlowski
2016-02-04 22:56     ` Alexandre Belloni
2016-02-04 22:56       ` Alexandre Belloni
2016-02-04 22:56       ` Alexandre Belloni
2016-02-05  0:18       ` Krzysztof Kozlowski
2016-02-05  0:18         ` Krzysztof Kozlowski
2016-02-05  0:18         ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56A84636.2000107@samsung.com \
    --to=k.kozlowski@samsung.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=andi.shyti@samsung.com \
    --cc=cw00.choi@samsung.com \
    --cc=javier@osg.samsung.com \
    --cc=kgene@kernel.org \
    --cc=ldewangan@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.