mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Csókás Bence" <csokas.bence@prolan.hu>
To: <gomba007@gmail.com>, Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-rtc@vger.kernel.org>
Subject: Re: [PATCH v3] drivers: rtc: Add driver for SD2405AL.
Date: Mon, 24 Jun 2024 10:09:46 +0200	[thread overview]
Message-ID: <21ca87a0-6062-411d-88e4-c644c054e497@prolan.hu> (raw)
In-Reply-To: <20240620-rtc-sd2405al-v3-1-65d5bb01af50@gmail.com>

Hi!

> +static int sd2405al_setup(struct sd2405al *sd2405al)
> +{
> +	unsigned int val;
> +	int ret;

I would still remove `val` and inline everything.

> +static int sd2405al_check_state(struct sd2405al *sd2405al)
> +{
> +	u8 data[2] = { 0 };
> +	int state;
> +	int ret;
> +
> +	ret = regmap_bulk_read(sd2405al->regmap, SD2405AL_REG_CTR1, data, 2);
> +	if (ret < 0) {
> +		dev_err(sd2405al->dev, "read failed: %d\n", ret);
> +		return ret;
> +	}
> +
> +	/* CRT1 */
> +	state = (data[0] & (SD2405AL_BIT_WRTC2 | SD2405AL_BIT_WRTC3)) != 0;
> +
> +	/* CTR2 */
> +	state &= (data[1] & SD2405AL_BIT_WRTC1) != 0;
> +
> +	return state;

Same here.

> +static int sd2405al_read_time(struct device *dev, struct rtc_time *time)
> +{
> +	u8 hour;

This variable could also be inlined.

Other than that, LGTM. Though I don't have this chip, I can only go by 
the linked datasheet.

On 6/20/24 11:55, Tóth János via B4 Relay wrote:
 > From: Tóth János <gomba007@gmail.com>
 >
 > Add support for the DFRobot SD2405AL I2C RTC Module.
 >
 > Datasheet:
 > 
https://image.dfrobot.com/image/data/TOY0021/SD2405AL%20datasheet%20(Angelo%20v0.1).pdf
 >
 > Product:
 > 	https://www.dfrobot.com/product-1600.html
 >
 > To instantiate (assuming device is connected to I2C-1)
 > as root:
 > 	echo sd2405al 0x32 > /sys/bus/i2c/devices/i2c-1/new_device
 > as user:
 > 	echo 'sd2405al 0x32' | sudo tee /sys/class/i2c-adapter/i2c-1/new_device
 >
 > The driver is tested with:
 > 	+ hwclock
 > 	+ tools/testing/selftests/rtc/setdate
 > 	+ tools/testing/selftests/rtc/rtctest
 >
 > Signed-off-by: Tóth János <gomba007@gmail.com>

Reviewed-by: Csókás, Bence <csokas.bence@prolan.hu>


      reply	other threads:[~2024-06-24  8:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-20  9:55 Tóth János via B4 Relay
2024-06-24  8:09 ` Csókás Bence [this message]

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=21ca87a0-6062-411d-88e4-c644c054e497@prolan.hu \
    --to=csokas.bence@prolan.hu \
    --cc=alexandre.belloni@bootlin.com \
    --cc=gomba007@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®