Re: [PATCH] drivers: rtc: Add driver for SD2405AL.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi János!

On 6/7/24 14:20, Tóth János via B4 Relay wrote:
From: Tóth János <gomba007@xxxxxxxxx>

Add support for the DFRobot SD2405AL I2C RTC Module.

Datasheet:
	https://image.dfrobot.com/image/data/TOY0021/SD2405AL%20datasheet%20(Angelo%20v0.1).pdf

Is there a reason why this can't be a ds1307 variant? The 12/24 bit is in a different place, the day-of-week starts at 0, there's no century bit, but other than that, the first 9 registers are the same as in the DS1339.

If you really need the separate driver, then you can take a feather out of rtc-ds1307's hat and use `dev_set_drvdata()` instead of `i2c_set_clientdata()`, `dev_err()` instead of `printk()`, use the `BIT()` macro etc.

On top of that, a few miscellaneous remarks:
* The name `SD2405AL_REG_CTR` is confusing. There are `SD2405AL_REG_CTR<1-3>` control registers already with a similar name. Use `SD2405AL_REG_CNTDWN` or something like that. * Even though you defined alarm registers, you're not implementing alarm capabilities. This should not be hard, given the datasheet and the drivers of similar RTCs. Plus, there really is no need to #define all alarm registers, the alarm base+offset should suffice. * Also, you're not doing anything with the control & status registers. At the least, in `read_time()` you should check that the RTC is running by checking CTR1.RTCF, and if it's 0, return -EINVAL. Similarly, in `set_time()` you're not checking if the RTC is writable.

Bence





[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux