mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alessandro Zummo <alessandro.zummo@towertech.it>
To: rtc-linux@googlegroups.com
Cc: hpa@zytor.com, Jan Engelhardt <jengelh@computergmbh.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Eugene Teo <eugeneteo@kernel.sg>
Subject: Re: [rtc-linux] Re: rtc max frequency setting
Date: Mon, 6 Aug 2007 21:01:54 +0200	[thread overview]
Message-ID: <20070806210154.45ca4570@i1501.lan.towertech.it> (raw)
In-Reply-To: <46B5148E.50302@zytor.com>

On Sat, 04 Aug 2007 17:06:38 -0700
"H. Peter Anvin" <hpa@zytor.com> wrote:

> 
> Jan Engelhardt wrote:
> > Hi,
> > 
> > with the old rtc.ko module, there was a /proc/sys/dev/rtc/max-user-freq 
> > that could be set. With rtc_cmos.ko (or the new rtc infrastructure in 
> > general), I am missing this file. Where can I set the max-user-freq now, 
> > or is this obsolete now? (mplayer prefers to have user-freq to be >= 1024.)
> > 

 quick hack to set the maximum freq. I haven't tested t, just compiled.
 I'm not sure about simple_strtoul.

 please provide feedback ;)

---
 drivers/rtc/rtc-sysfs.c |   27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

--- linux-2.6.orig/drivers/rtc/rtc-sysfs.c	2007-08-06 20:34:12.000000000 +0200
+++ linux-2.6/drivers/rtc/rtc-sysfs.c	2007-08-06 20:50:03.000000000 +0200
@@ -73,11 +73,37 @@ rtc_sysfs_show_since_epoch(struct device
 	return retval;
 }
 
+static ssize_t
+rtc_sysfs_show_max_user_freq(struct device *dev, struct device_attribute *attr,
+		char *buf)
+{
+	struct rtc_device *rtc = to_rtc_device(dev);
+	return sprintf(buf, "%d\n", rtc->max_user_freq);
+}
+
+static ssize_t
+rtc_sysfs_set_max_user_freq(struct device *dev, struct device_attribute *attr,
+		const char *buf, size_t n)
+{
+	unsigned long w;
+	struct rtc_device *rtc = to_rtc_device(dev);
+
+	w = simple_strtoul(buf, NULL, 0);
+	if (is_power_of_2(w)) {
+		rtc->max_user_freq = w;
+		return n;
+	}
+
+	return -EINVAL;
+}
+
 static struct device_attribute rtc_attrs[] = {
 	__ATTR(name, S_IRUGO, rtc_sysfs_show_name, NULL),
 	__ATTR(date, S_IRUGO, rtc_sysfs_show_date, NULL),
 	__ATTR(time, S_IRUGO, rtc_sysfs_show_time, NULL),
 	__ATTR(since_epoch, S_IRUGO, rtc_sysfs_show_since_epoch, NULL),
+	__ATTR(max_user_freq, S_IRUGO | S_IWUSR, rtc_sysfs_show_max_user_freq,
+					rtc_sysfs_set_max_user_freq),
 	{ },
 };
 


-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Torino, Italy

  http://www.towertech.it


  parent reply	other threads:[~2007-08-06 19:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-04 22:44 Jan Engelhardt
2007-08-05  0:06 ` H. Peter Anvin
2007-08-05  0:41   ` [rtc-linux] " Alessandro Zummo
2007-08-05  8:05   ` Jan Engelhardt
2007-08-05 23:40   ` Michael Chang
2007-08-06 19:01   ` Alessandro Zummo [this message]
2007-08-10  4:40   ` Bill Davidsen

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=20070806210154.45ca4570@i1501.lan.towertech.it \
    --to=alessandro.zummo@towertech.it \
    --cc=eugeneteo@kernel.sg \
    --cc=hpa@zytor.com \
    --cc=jengelh@computergmbh.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    /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®