Linux-RTC Archive on lore.kernel.org
 help / color / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Parthiban Nallathambi <pn@denx.de>
Cc: a.zummo@towertech.it, linux-rtc@vger.kernel.org,
	linux-kernel@vger.kernel.org, parthitce@gmail.com
Subject: Re: [PATCH] rtc: rv3028: add clkout support
Date: Fri, 11 Oct 2019 11:17:38 +0200
Message-ID: <20191011091738.GC3125@piout.net> (raw)
In-Reply-To: <20190927141505.640751-1-pn@denx.de>

Hi,

thanks for the patch, minor comments below.

On 27/09/2019 16:15:05+0200, Parthiban Nallathambi wrote:
> +	ret = regmap_update_bits(rv3028->regmap, RV3028_STATUS,
> +				 RV3028_STATUS_CLKF, 0);
> +	if (ret < 0)
> +		return ret;
> +

This is already done earlier and this will not be enabled again unless
CLKIE is set which should not happen. So I don't think it is necessary
to do it once again here.

> +	for (i = 0; i < ARRAY_SIZE(clkout_rates); i++) {
> +		if (clkout_rates[i] == rate) {
> +			ret = regmap_update_bits(rv3028->regmap,
> +						 RV3028_CLKOUT,
> +						 RV3028_CLKOUT_FD_MASK, i);
> +			if (ret < 0)
> +				return ret;
> +
> +			return regmap_write(rv3028->regmap, RV3028_CLKOUT,
> +				RV3028_CLKOUT_CLKSY | RV3028_CLKOUT_CLKOE);
> +		}
> +	}
> +
> +	return -EINVAL;
> +}


> +static int rv3028_clkout_register_clk(struct rv3028_data *rv3028,
> +				      struct i2c_client *client)
> +{
> +	int ret;
> +	struct clk *clk;
> +	struct clk_init_data init;
> +	struct device_node *node = client->dev.of_node;
> +
> +	/* disable the clkout output */
> +	ret = regmap_write(rv3028->regmap, RV3028_CLKOUT, 0x0);
> +	if (ret < 0)
> +		return ret;
> +

This is not what the user would expect and could introduce a glitch in 
the clock output every time the platform is booted. If there are no 
users of the clock, then you should probably let the core disable it 
once the boot has ended.


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

  reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-27 14:15 Parthiban Nallathambi
2019-10-11  9:17 ` Alexandre Belloni [this message]
2019-10-18 10:02   ` Parthiban Nallathambi

Reply instructions:

You may reply publically 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=20191011091738.GC3125@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=parthitce@gmail.com \
    --cc=pn@denx.de \
    /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

Linux-RTC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rtc/0 linux-rtc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rtc linux-rtc/ https://lore.kernel.org/linux-rtc \
		linux-rtc@vger.kernel.org
	public-inbox-index linux-rtc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rtc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git