All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: glasveze@delta.nl
Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org,
	a.zummo@towertech.it, robh+dt@kernel.org,
	linux-kernel@vger.kernel.org,
	Mike Looijmans <mike.looijmans@topic.nl>
Subject: Re: [PATCH 2/2] rtc: ds1307: Add support for Epson RX8111
Date: Mon, 14 Nov 2022 23:17:30 +0100	[thread overview]
Message-ID: <Y3K+ehjZAA4AIXie@mail.local> (raw)
In-Reply-To: <20221028144041.11067-2-glasveze@delta.nl>

Hello,

On 28/10/2022 16:40:41+0200, glasveze@delta.nl wrote:
> +static u8 do_trickle_setup_rx8111(struct ds1307 *ds1307, u32 ohms, bool diode)
> +{
> +	/* make sure that the backup battery is enabled */
> +	u8 setup = RX8111_PSC_SMP_INIEN;

You can't do that, else it will never be possible to remove that without
breaking existing users. Instead, you should use
RTC_PARAM_BACKUP_SWITCH_MODE. Honestly, I would really like stopping
adding support for more RTCs in this driver and instead split them all
out.

> +
> +	if (diode)
> +		setup |= RX8111_PSC_SMP_CHGEN;
> +
> +	return setup;
> +}
> +
>  static u8 do_trickle_setup_rx8130(struct ds1307 *ds1307, u32 ohms, bool diode)
>  {
>  	/* make sure that the backup battery is enabled */
> @@ -1012,6 +1078,16 @@ static const struct chip_desc chips[last_ds_type] = {
>  		.century_bit	= DS1337_BIT_CENTURY,
>  		.bbsqi_bit	= DS3231_BIT_BBSQW,
>  	},
> +	[rx_8111] = {
> +		.alarm		= 1,
> +		.nvram_offset	= 0x40,
> +		.nvram_size	= 0x40,	/* 0x40 .. 0x7F is user RAM */
> +		.offset		= 0x10,
> +		.irq_handler = rx8130_irq,
> +		.rtc_ops = &rx8130_rtc_ops,
> +		.trickle_charger_reg = RX8111_PWR_SWITCH_CTRL,
> +		.do_trickle_setup = &do_trickle_setup_rx8111,
> +	},
>  	[rx_8130] = {
>  		.alarm		= 1,
>  		/* this is battery backed SRAM */
> @@ -1063,6 +1139,7 @@ static const struct i2c_device_id ds1307_id[] = {
>  	{ "pt7c4338", ds_1307 },
>  	{ "rx8025", rx_8025 },
>  	{ "isl12057", ds_1337 },
> +	{ "rx8111", rx_8111 },
>  	{ "rx8130", rx_8130 },
>  	{ }
>  };
> @@ -1137,6 +1214,10 @@ static const struct of_device_id ds1307_of_match[] = {
>  		.compatible = "isil,isl12057",
>  		.data = (void *)ds_1337
>  	},
> +	{
> +		.compatible = "epson,rx8111",
> +		.data = (void *)rx_8111
> +	},
>  	{
>  		.compatible = "epson,rx8130",
>  		.data = (void *)rx_8130
> @@ -1880,6 +1961,10 @@ static int ds1307_probe(struct i2c_client *client,
>  				     DS1307_REG_HOUR << 4 | 0x08, hour);
>  		}
>  		break;
> +	case rx_8111:
> +		/* Use memory as user RAM */
> +		regmap_write(ds1307->regmap, RX8111_TIME_STAMP_BUF_CTRL, 0);
> +		break;
>  	case ds_1388:
>  		err = regmap_read(ds1307->regmap, DS1388_REG_CONTROL, &tmp);
>  		if (err) {
> -- 
> 2.17.1
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2022-11-14 22:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 14:40 [PATCH 1/2] dt-bindings: rtc: ds1307: Add support for Epson RX8111 glasveze
2022-10-28 14:40 ` [PATCH 2/2] " glasveze
2022-11-14 22:17   ` Alexandre Belloni [this message]
2022-10-28 17:38 ` [PATCH 1/2] dt-bindings: " Krzysztof Kozlowski
  -- strict thread matches above, loose matches on Subject: below --
2022-10-31  6:54 [PATCH 2/2] " glasveze
2022-10-28 14:19 [PATCH 1/2] dt-bindings: " glasveze
2022-10-28 14:19 ` [PATCH 2/2] " glasveze

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=Y3K+ehjZAA4AIXie@mail.local \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=devicetree@vger.kernel.org \
    --cc=glasveze@delta.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=mike.looijmans@topic.nl \
    --cc=robh+dt@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 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.