CINXE.COM
LKML: Ladislav Michl: Re: [PATCH] ds1337 4/4
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>LKML: Ladislav Michl: Re: [PATCH] ds1337 4/4</title><link href="/css/message.css" rel="stylesheet" type="text/css" /><link href="/css/wrap.css" rel="alternate stylesheet" type="text/css" title="wrap" /><link href="/css/nowrap.css" rel="stylesheet" type="text/css" title="nowrap" /><link href="/favicon.ico" rel="shortcut icon" /><script src="/js/simple-calendar.js" type="text/javascript"></script><script src="/js/styleswitcher.js" type="text/javascript"></script><link rel="alternate" type="application/rss+xml" title="lkml.org : last 100 messages" href="/rss.php" /><link rel="alternate" type="application/rss+xml" title="lkml.org : last messages by Ladislav Michl" href="/groupie.php?aid=21763" /><!--Matomo--><script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(["setDoNotTrack", true]); _paq.push(["disableCookies"]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//m.lkml.org/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '1']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script><!--End Matomo Code--></head><body onload="es.jasper.simpleCalendar.init();" itemscope="itemscope" itemtype="http://schema.org/BlogPosting"><table border="0" cellpadding="0" cellspacing="0"><tr><td width="180" align="center"><a href="/"><img style="border:0;width:135px;height:32px" src="/images/toprowlk.gif" alt="lkml.org" /></a></td><td width="32">聽</td><td class="nb"><div><a class="nb" href="/lkml"> [lkml]</a> 聽 <a class="nb" href="/lkml/2005"> [2005]</a> 聽 <a class="nb" href="/lkml/2005/4"> [Apr]</a> 聽 <a class="nb" href="/lkml/2005/4/10"> [10]</a> 聽 <a class="nb" href="/lkml/last100"> [last100]</a> 聽 <a href="/rss.php"><img src="/images/rss-or.gif" border="0" alt="RSS Feed" /></a></div><div>Views: <a href="#" class="nowrap" onclick="setActiveStyleSheet('wrap');return false;">[wrap]</a><a href="#" class="wrap" onclick="setActiveStyleSheet('nowrap');return false;">[no wrap]</a> 聽 <a class="nb" href="/lkml/mheaders/2005/4/10/130" onclick="this.href='/lkml/headers'+'/2005/4/10/130';">[headers]</a>聽 <a href="/lkml/bounce/2005/4/10/130">[forward]</a>聽 </div></td><td width="32">聽</td></tr><tr><td valign="top"><div class="es-jasper-simpleCalendar" baseurl="/lkml/"></div><div class="threadlist">Messages in this thread</div><ul class="threadlist"><li class="root"><a href="/lkml/2005/3/31/279">First message in thread</a></li><li><a href="/lkml/2005/4/8/124">Ladislav Michl</a><ul><li><a href="/lkml/2005/4/8/182">"Jean Delvare"</a></li><li><a href="/lkml/2005/4/8/206">James Chapman</a><ul><li class="origin"><a href="/lkml/2005/4/10/143">Ladislav Michl</a><ul><li><a href="/lkml/2005/4/10/143">Jean Delvare</a><ul><li><a href="/lkml/2005/4/12/352">James Chapman</a></li></ul></li></ul></li></ul></li></ul></li></ul></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerl.gif" width="32" height="32" alt="/" /></td><td class="c" rowspan="2" valign="top" style="padding-top: 1em"><table><tr><td><table><tr><td class="lp">Date</td><td class="rp" itemprop="datePublished">Sun, 10 Apr 2005 20:51:20 +0100</td></tr><tr><td class="lp">From</td><td class="rp" itemprop="author">Ladislav Michl <></td></tr><tr><td class="lp">Subject</td><td class="rp" itemprop="name">Re: [PATCH] ds1337 4/4</td></tr></table></td><td></td></tr></table><pre itemprop="articleBody">On Fri, Apr 08, 2005 at 06:44:53PM +0100, James Chapman wrote:<br />> > The only reason I can think<br />> >about is when suspending device, so it is likely pm job. /sys entry<br />> >might help as well, but I do not see any point making driver more<br />> >complicated and bigger just to make someone else happy.<br />> <br />> Why not add a new /sys entry for it? Is there a generic battery charge <br />> control /sys API?<br /><br />I do not know about any and I do not think it would be usefull here. How<br />would you convert value passed by API into register value? Driver has no<br />chance to know about hardware design.<br /><br />> >Golden rule is: implement features as needed :)<br />> <br />> But when adding code, try to cover all reasonable cases, otherwise we'll <br />> see patches from people trying to add platform specific ifdefs in here.<br /><br />I'd like to, but simply do not have enough informations to do it. In other<br />worlds I still do not know what is reasonable here.<br /><br />> >>Also, arbitrarily picking one of the 6 possible charging modes just<br />> >>because it matches your board is a bad idea. It looks like a value which<br />> >>should be set on a per-board basis, rather than picked randomly by the<br />> >>user, so as to avoid accidental hardware breakage.<br />> ><br />> ><br />> >Well free to provide that way, so far I'm the only user so I did what is<br />> >usefull for me [*]. Everyone is welcome to change it to more generic<br />> >way.<br />> <br />> I agree with Jean. You should provide an API for this. Don't take <br />> shortcuts just because you were the first to support the chip. It'll be <br />> more useful to others if you provide a way to set a value per platform.<br /><br />That's not about taking any shortcuts, that's about finding sane API. When<br />time shows it wrong and it will need change people will complain about<br />compatibility. See my questions about API bellow [*].<br /><br />Based on your and Jean's input, following so far sounds reasonable:<br />Create "charge" sysfs entry for ds1339 when it is detected. Do not write<br />any value to Trickle Charge register, until its value is written to this<br />entry.<br /><br />> >I was running test overnight and didn't meet any single case when this<br />> >happen. Perhaps device also needs to see start condition?<br />> <br />> Just because it runs overnight doesn't mean there's no bug.<br /><br />Agree, but with probability near the certainty I can tell that device works<br />a bit differently than described in datasheet. Anyway, new 100% reliable<br />test is done, so it could be eventually used if ds1339 support finds its<br />way into driver.<br /><br />> >>Also, 0x00 is a possible value for both the seconds count and the battery<br />> >>register, so you could miss a DS1339 at times.<br />> >><br />> >>One possible check to start with would be on the value of the additional<br />> >>register itself. It has only 7 possible values. (...) <br />> ><br />> ><br />> >Eh? Register is 8bit, that's 256 combinations.<br />> <br />> Reserved bits have fixed values that you can test for.<br /><br />Think about this register as about NVRAM address. It can have any value,<br />but only certain values will enable charge.<br /><br />[*] Now lets forget ds1339, there are few things I'd like to know about<br />this driver.<br /><br />How are you using this driver? There is non-static function<br />ds1337_do_command which expects id. How do you know which id belongs<br />to which chip? Do you actually have machine with more than one ds1337?<br />Chip has fixed address, so only one can hang on one bus (am I right?)<br />Also it is unlikely that machine will have more that one RTC. The only<br />exception which comes on mind are NUMA systems which have one RTC per<br />node. Anything else? Why date format returned/expected by this driver<br />differs from other drivers?<br /><br />Thanks in advance,<br /> ladis<br /><br />PS. I'm sorry about some formulations I used in earlier mails. I was<br />overworked and tired and that affected my otherwise (hopefully) good<br />decorum :)<br />-<br />To unsubscribe from this list: send the line "unsubscribe linux-kernel" in<br />the body of a message to majordomo@vger.kernel.org<br />More majordomo info at <a href="http://vger.kernel.org/majordomo-info.html">http://vger.kernel.org/majordomo-info.html</a><br />Please read the FAQ at <a href="http://www.tux.org/lkml/">http://www.tux.org/lkml/</a><br /><br /></pre></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerr.gif" width="32" height="32" alt="\" /></td></tr><tr><td align="right" valign="bottom"> 聽 </td></tr><tr><td align="right" valign="bottom">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerl.gif" width="32" height="32" alt="\" /></td><td class="c">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerr.gif" width="32" height="32" alt="/" /></td></tr><tr><td align="right" valign="top" colspan="2"> 聽 </td><td class="lm">Last update: 2005-04-10 21:55 聽聽 [from the cache]<br />漏2003-2020 <a href="http://blog.jasper.es/"><span itemprop="editor">Jasper Spaans</span></a>|hosted at <a href="https://www.digitalocean.com/?refcode=9a8e99d24cf9">Digital Ocean</a> and my Meterkast|<a href="http://blog.jasper.es/categories.html#lkml-ref">Read the blog</a></td><td>聽</td></tr></table><script language="javascript" src="/js/styleswitcher.js" type="text/javascript"></script></body></html>