Re: [PATCH 3/4] rtc: cros-ec: add cros-ec-rtc driver.

From: Alexandre Belloni
Date: Tue Jan 17 2017 - 21:01:07 EST



Hi,

This seems mostly good to me.

On 11/01/2017 at 17:52:20 +0100, Enric Balletbo i Serra wrote :
> From: Stephen Barber <smbarber@xxxxxxxxxxxx>
>
> On platforms with a Chrome OS EC, the EC can function as a simple RTC.
> Add a basic driver with this functionality.
>
> Signed-off-by: Stephen Barber <smbarber@xxxxxxxxxxxx>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@xxxxxxxxxxxxx>
> ---
> drivers/rtc/Kconfig | 10 ++
> drivers/rtc/Makefile | 1 +
> drivers/rtc/rtc-cros-ec.c | 416 ++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 427 insertions(+)
> create mode 100644 drivers/rtc/rtc-cros-ec.c
>
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index c93c5a8..b58ce06 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -207,6 +207,16 @@ config RTC_DRV_AS3722
> This driver can also be built as a module. If so, the module
> will be called rtc-as3722.
>
> +config RTC_DRV_CROS_EC
> + tristate "Chrome OS EC RTC driver"
> + depends on MFD_CROS_EC
> + help
> + If you say yes here you will get support for the
> + Chrome OS Embedded Controller's RTC.
> +
> + This driver can also be built as a module. If so, the module
> + will be called rtc-cros-ec.
> +

This doesn't look like and i2c RTC, you probably want to put that block
somewhere after "Platform RTC drivers"

> config RTC_DRV_DS1307
> tristate "Dallas/Maxim DS1307/37/38/39/40, ST M41T00, EPSON RX-8025, ISL12057"
> help


> + ret = rtc_valid_tm(&tm);
> + if (ret)
> + dev_err(&pdev->dev, "invalid date/time\n");
> +
nitpick: I'm not sure this is useful. You'll probably know soon enough
that it is invalid as I'm pretty sure something will read the date at
boot time.


--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com