vapier | 1 Sep 15:40 2009

[7257] trunk/include/linux/spi/ad714x.h: fixup ad714x.h header

<!-- #msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dl.meta dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; } #logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; } #logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; } #logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } #logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; } #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; } #logmsg pre { background: #eee; padding: 1em; } #logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;} #logmsg dl { margin: 0; } #logmsg dt { font-weight: bold; } #logmsg dd { margin: 0; padding: 0 0 0.5em 0; } #logmsg dd:before { content:'\00bb';} #logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; } #logmsg table th.Corner { text-align: left; } #logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} -->
Revision 7257 Author vapier Date 2009-09-01 09:40:30 -0400 (Tue, 01 Sep 2009)

Log Message

fixup ad714x.h header

Modified Paths

Diff

Modified: trunk/include/linux/spi/ad714x.h (7256 => 7257)

--- trunk/include/linux/spi/ad714x.h 2009-08-31 04:56:06 UTC (rev 7256) +++ trunk/include/linux/spi/ad714x.h 2009-09-01 13:40:30 UTC (rev 7257) <at> <at> -5,12 +5,14 <at> <at> * slider, touchpad at the same time. That depends on the boards. * The platform_data for the device's "struct device" holds this * information. + * Copyright 2009 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. */ +#ifndef __LINUX_SPI_AD714X_H__ +#define __LINUX_SPI_AD714X_H__ -#ifndef AD714X_HW_H -#define AD714X_HW_H - #define STAGE_NUM 12 #define STAGE_CFGREG_NUM 8 #define SYS_CFGREG_NUM 8
<div>

&lt;!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg &gt; ul, #logmsg &gt; ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--&gt;<div>
Revision <a href="http://blackfin.uclinux.org/gf/project/linux-kernel/scmsvn/?action=browse&amp;path=/&amp;view=rev&amp;root=linux-kernel&amp;revision=7257">7257</a>
Author <a href="http://blackfin.uclinux.org/gf/user/vapier/">vapier</a>
Date 2009-09-01 09:40:30 -0400 (Tue, 01 Sep 2009)
<h3>Log Message</h3>
fixup ad714x.h header

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkincludelinuxspiad714xh">trunk/include/linux/spi/ad714x.h</a></li>
</ul>
</div>
<div>
<h3>Diff</h3>
<a></a>
<div class="modfile">
<h4>Modified: trunk/include/linux/spi/ad714x.h (7256 =&gt; 7257)</h4>
<span>
<span class="info">--- trunk/include/linux/spi/ad714x.h	2009-08-31 04:56:06 UTC (rev 7256)
+++ trunk/include/linux/spi/ad714x.h	2009-09-01 13:40:30 UTC (rev 7257)
</span><span class="lines"> <at>  <at>  -5,12 +5,14  <at>  <at> 
</span><span class="cx">  * slider, touchpad at the same time. That depends on the boards.
</span><span class="cx">  * The platform_data for the device's "struct device" holds this
</span><span class="cx">  * information.
</span>+ * Copyright 2009 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
<span class="cx">  */
</span><span class="cx"> 
</span>+#ifndef __LINUX_SPI_AD714X_H__
+#define __LINUX_SPI_AD714X_H__
<span class="cx"> 
</span>-#ifndef AD714X_HW_H
-#define AD714X_HW_H
-
<span class="cx"> #define STAGE_NUM              12
</span><span class="cx"> #define STAGE_CFGREG_NUM       8
</span><span class="cx"> #define SYS_CFGREG_NUM         8
</span></span>
</div>
</div>

</div>
vapier | 1 Sep 15:41 2009

[7258] trunk/drivers/input/misc/ad714x.c: use simpler header

<!-- #msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dl.meta dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; } #logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; } #logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; } #logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } #logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; } #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; } #logmsg pre { background: #eee; padding: 1em; } #logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;} #logmsg dl { margin: 0; } #logmsg dt { font-weight: bold; } #logmsg dd { margin: 0; padding: 0 0 0.5em 0; } #logmsg dd:before { content:'\00bb';} #logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; } #logmsg table th.Corner { text-align: left; } #logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} -->
Revision 7258 Author vapier Date 2009-09-01 09:41:50 -0400 (Tue, 01 Sep 2009)

Log Message

use simpler header

Modified Paths

Diff

Modified: trunk/drivers/input/misc/ad714x.c (7257 => 7258)

--- trunk/drivers/input/misc/ad714x.c 2009-09-01 13:40:30 UTC (rev 7257) +++ trunk/drivers/input/misc/ad714x.c 2009-09-01 13:41:50 UTC (rev 7258) <at> <at> -1,20 +1,9 <at> <at> /* - * File: drivers/input/misc/ad714x.c - * Based on: - * Author: Barry Song <Barry.Song-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org> + * AD714X CapTouch Programmable Controller driver * - * Created: - * Description: AD714X CapTouch Programmable Controller driver + * Copyright 2009 Analog Devices Inc. * - * Modified: - * Copyright 2009 Analog Devices Inc. - * - * Bugs: Enter bugs at http://blackfin.uclinux.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Licensed under the GPL-2 or later. */ #include <linux/device.h>
<div>

&lt;!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg &gt; ul, #logmsg &gt; ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--&gt;<div>
Revision <a href="http://blackfin.uclinux.org/gf/project/linux-kernel/scmsvn/?action=browse&amp;path=/&amp;view=rev&amp;root=linux-kernel&amp;revision=7258">7258</a>
Author <a href="http://blackfin.uclinux.org/gf/user/vapier/">vapier</a>
Date 2009-09-01 09:41:50 -0400 (Tue, 01 Sep 2009)
<h3>Log Message</h3>
use simpler header

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdriversinputmiscad714xc">trunk/drivers/input/misc/ad714x.c</a></li>
</ul>
</div>
<div>
<h3>Diff</h3>
<a></a>
<div class="modfile">
<h4>Modified: trunk/drivers/input/misc/ad714x.c (7257 =&gt; 7258)</h4>
<span>
<span class="info">--- trunk/drivers/input/misc/ad714x.c	2009-09-01 13:40:30 UTC (rev 7257)
+++ trunk/drivers/input/misc/ad714x.c	2009-09-01 13:41:50 UTC (rev 7258)
</span><span class="lines"> <at>  <at>  -1,20 +1,9  <at>  <at> 
</span><span class="cx"> /*
</span>- * File:         drivers/input/misc/ad714x.c
- * Based on:
- * Author:       Barry Song &lt;Barry.Song@...&gt;
+ * AD714X CapTouch Programmable Controller driver
<span class="cx">  *
</span>- * Created:
- * Description:  AD714X CapTouch Programmable Controller driver
+ * Copyright 2009 Analog Devices Inc.
<span class="cx">  *
</span>- * Modified:
- *               Copyright 2009 Analog Devices Inc.
- *
- * Bugs:         Enter bugs at http://blackfin.uclinux.org/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * Licensed under the GPL-2 or later.
<span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &lt;linux/device.h&gt;
</span></span>
</div>
</div>

</div>
bernds | 2 Sep 10:14 2009

[7259] trunk: Bug[#4090]

<!-- #msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dl.meta dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; } #logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; } #logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; } #logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } #logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; } #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; } #logmsg pre { background: #eee; padding: 1em; } #logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;} #logmsg dl { margin: 0; } #logmsg dt { font-weight: bold; } #logmsg dd { margin: 0; padding: 0 0 0.5em 0; } #logmsg dd:before { content:'\00bb';} #logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; } #logmsg table th.Corner { text-align: left; } #logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} -->
Revision 7259 Author bernds Date 2009-09-02 04:14:05 -0400 (Wed, 02 Sep 2009)

Log Message

Bug[#4090] This allows us to use a romfs in flash for XIP. The physmap driver is enhanced to add a get_unmapped_area method, and the Blackfin CPLB code is changed to provide ICPLBs for the async banks. This doesn't work with MPU yet, but I'll have patches in the future.

Modified Paths

Diff

Modified: trunk/arch/blackfin/kernel/cplb-nompu/cplbinit.c (7258 => 7259)

--- trunk/arch/blackfin/kernel/cplb-nompu/cplbinit.c 2009-09-01 13:41:50 UTC (rev 7258) +++ trunk/arch/blackfin/kernel/cplb-nompu/cplbinit.c 2009-09-02 08:14:05 UTC (rev 7259) <at> <at> -36,7 +36,7 <at> <at> int first_switched_dcplb PDT_ATTR; struct cplb_boundary dcplb_bounds[9] PDT_ATTR; -struct cplb_boundary icplb_bounds[7] PDT_ATTR; +struct cplb_boundary icplb_bounds[9] PDT_ATTR; int icplb_nr_bounds PDT_ATTR; int dcplb_nr_bounds PDT_ATTR; <at> <at> -167,14 +167,21 <at> <at> icplb_bounds[i_i++].data = (reserved_mem_icache_on ? SDRAM_IGENERIC : SDRAM_INON_CHBL); } + /* Addressing hole up to the async bank. */ + icplb_bounds[i_i].eaddr = ASYNC_BANK0_BASE; + icplb_bounds[i_i++].data = 0; + /* ASYNC banks. */ + icplb_bounds[i_i].eaddr = ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE; + icplb_bounds[i_i++].data = SDRAM_EBIU; /* Addressing hole up to BootROM. */ icplb_bounds[i_i].eaddr = BOOT_ROM_START; icplb_bounds[i_i++].data = 0; /* BootROM -- largest one should be less than 1 meg. */ icplb_bounds[i_i].eaddr = BOOT_ROM_START + (1 * 1024 * 1024); icplb_bounds[i_i++].data = SDRAM_IGENERIC; + if (L2_LENGTH) { - /* Addressing hole up to L2 SRAM, including the async bank. */ + /* Addressing hole up to L2 SRAM. */ icplb_bounds[i_i].eaddr = L2_START; icplb_bounds[i_i++].data = 0; /* L2 SRAM. */

Modified: trunk/drivers/mtd/maps/physmap.c (7258 => 7259)

--- trunk/drivers/mtd/maps/physmap.c 2009-09-01 13:41:50 UTC (rev 7258) +++ trunk/drivers/mtd/maps/physmap.c 2009-09-02 08:14:05 UTC (rev 7259) <at> <at> -73,6 +73,20 <at> <at> return 0; } +/* + * Allow NOMMU mmap() to directly map the device (if not NULL) + * - return the address to which the offset maps + * - return -ENOSYS to indicate refusal to do the mapping + */ +static unsigned long physmap_unmapped_area(struct mtd_info *mtd, + unsigned long len, + unsigned long offset, + unsigned long flags) +{ + struct map_info *map = mtd->priv; + return (unsigned long) map->virt + offset; +} + static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", <at> <at> -146,6 +160,8 <at> <at> } else { devices_found++; } + if (info->mtd[i]->get_unmapped_area == NULL) + info->mtd[i]->get_unmapped_area = physmap_unmapped_area; info->mtd[i]->owner = THIS_MODULE; info->mtd[i]->dev.parent = &dev->dev; }
<div>

&lt;!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg &gt; ul, #logmsg &gt; ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--&gt;<div>
Revision <a href="http://blackfin.uclinux.org/gf/project/linux-kernel/scmsvn/?action=browse&amp;path=/&amp;view=rev&amp;root=linux-kernel&amp;revision=7259">7259</a>
Author <a href="http://blackfin.uclinux.org/gf/user/bernds/">bernds</a>
Date 2009-09-02 04:14:05 -0400 (Wed, 02 Sep 2009)
<h3>Log Message</h3>
Bug<a href="http://blackfin.uclinux.org/gf/tracker/4090">[#4090]</a>
This allows us to use a romfs in flash for XIP.  The physmap driver is
enhanced to add a get_unmapped_area method, and the Blackfin CPLB code is
changed to provide ICPLBs for the async banks.
This doesn't work with MPU yet, but I'll have patches in the future.

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkarchblackfinkernelcplbnompucplbinitc">trunk/arch/blackfin/kernel/cplb-nompu/cplbinit.c</a></li>
<li><a href="#trunkdriversmtdmapsphysmapc">trunk/drivers/mtd/maps/physmap.c</a></li>
</ul>
</div>
<div>
<h3>Diff</h3>
<a></a>
<div class="modfile">
<h4>Modified: trunk/arch/blackfin/kernel/cplb-nompu/cplbinit.c (7258 =&gt; 7259)</h4>
<span>
<span class="info">--- trunk/arch/blackfin/kernel/cplb-nompu/cplbinit.c	2009-09-01 13:41:50 UTC (rev 7258)
+++ trunk/arch/blackfin/kernel/cplb-nompu/cplbinit.c	2009-09-02 08:14:05 UTC (rev 7259)
</span><span class="lines"> <at>  <at>  -36,7 +36,7  <at>  <at> 
</span><span class="cx"> int first_switched_dcplb PDT_ATTR;
</span><span class="cx"> 
</span><span class="cx"> struct cplb_boundary dcplb_bounds[9] PDT_ATTR;
</span>-struct cplb_boundary icplb_bounds[7] PDT_ATTR;
+struct cplb_boundary icplb_bounds[9] PDT_ATTR;
<span class="cx"> 
</span><span class="cx"> int icplb_nr_bounds PDT_ATTR;
</span><span class="cx"> int dcplb_nr_bounds PDT_ATTR;
</span><span class="lines"> <at>  <at>  -167,14 +167,21  <at>  <at> 
</span><span class="cx"> 		icplb_bounds[i_i++].data = (reserved_mem_icache_on ?
</span><span class="cx"> 					    SDRAM_IGENERIC : SDRAM_INON_CHBL);
</span><span class="cx"> 	}
</span>+	/* Addressing hole up to the async bank.  */
+	icplb_bounds[i_i].eaddr = ASYNC_BANK0_BASE;
+	icplb_bounds[i_i++].data = 0;
+	/* ASYNC banks.  */
+	icplb_bounds[i_i].eaddr = ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE;
+	icplb_bounds[i_i++].data = SDRAM_EBIU;
<span class="cx"> 	/* Addressing hole up to BootROM.  */
</span><span class="cx"> 	icplb_bounds[i_i].eaddr = BOOT_ROM_START;
</span><span class="cx"> 	icplb_bounds[i_i++].data = 0;
</span><span class="cx"> 	/* BootROM -- largest one should be less than 1 meg.  */
</span><span class="cx"> 	icplb_bounds[i_i].eaddr = BOOT_ROM_START + (1 * 1024 * 1024);
</span><span class="cx"> 	icplb_bounds[i_i++].data = SDRAM_IGENERIC;
</span>+
<span class="cx"> 	if (L2_LENGTH) {
</span>-		/* Addressing hole up to L2 SRAM, including the async bank.  */
+		/* Addressing hole up to L2 SRAM.  */
<span class="cx"> 		icplb_bounds[i_i].eaddr = L2_START;
</span><span class="cx"> 		icplb_bounds[i_i++].data = 0;
</span><span class="cx"> 		/* L2 SRAM.  */
</span></span>
</div>
<a></a>
<div class="modfile">
<h4>Modified: trunk/drivers/mtd/maps/physmap.c (7258 =&gt; 7259)</h4>
<span>
<span class="info">--- trunk/drivers/mtd/maps/physmap.c	2009-09-01 13:41:50 UTC (rev 7258)
+++ trunk/drivers/mtd/maps/physmap.c	2009-09-02 08:14:05 UTC (rev 7259)
</span><span class="lines"> <at>  <at>  -73,6 +73,20  <at>  <at> 
</span><span class="cx"> 	return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span>+/*
+ * Allow NOMMU mmap() to directly map the device (if not NULL)
+ * - return the address to which the offset maps
+ * - return -ENOSYS to indicate refusal to do the mapping
+ */
+static unsigned long physmap_unmapped_area(struct mtd_info *mtd,
+					   unsigned long len,
+					   unsigned long offset,
+					   unsigned long flags)
+{
+	struct map_info *map = mtd-&gt;priv;
+	return (unsigned long) map-&gt;virt + offset;
+}
+
<span class="cx"> static const char *rom_probe_types[] = {
</span><span class="cx"> 					"cfi_probe",
</span><span class="cx"> 					"jedec_probe",
</span><span class="lines"> <at>  <at>  -146,6 +160,8  <at>  <at> 
</span><span class="cx"> 		} else {
</span><span class="cx"> 			devices_found++;
</span><span class="cx"> 		}
</span>+		if (info-&gt;mtd[i]-&gt;get_unmapped_area == NULL)
+			info-&gt;mtd[i]-&gt;get_unmapped_area = physmap_unmapped_area;
<span class="cx"> 		info-&gt;mtd[i]-&gt;owner = THIS_MODULE;
</span><span class="cx"> 		info-&gt;mtd[i]-&gt;dev.parent = &amp;dev-&gt;dev;
</span><span class="cx"> 	}
</span></span>
</div>
</div>

</div>
bhsong | 2 Sep 23:47 2009

[7260] trunk: update according to the feedback of David Brownell/ Mike Frysinger

<!-- #msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dl.meta dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; } #logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; } #logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; } #logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } #logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; } #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; } #logmsg pre { background: #eee; padding: 1em; } #logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;} #logmsg dl { margin: 0; } #logmsg dt { font-weight: bold; } #logmsg dd { margin: 0; padding: 0 0 0.5em 0; } #logmsg dd:before { content:'\00bb';} #logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; } #logmsg table th.Corner { text-align: left; } #logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} -->
Revision 7260 Author bhsong Date 2009-09-02 17:47:05 -0400 (Wed, 02 Sep 2009)

Log Message

update according to the feedback of David Brownell/Mike Frysinger 1.enable both i2c and spi bus, use bus-match to trigger devices probing 2.move headfile ad714x.h from include/linux/spi to include/linux/input 3.coding style issues

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/arch/blackfin/mach-bf537/boards/stamp.c (7259 => 7260)

--- trunk/arch/blackfin/mach-bf537/boards/stamp.c 2009-09-02 08:14:05 UTC (rev 7259) +++ trunk/arch/blackfin/mach-bf537/boards/stamp.c 2009-09-02 21:47:05 UTC (rev 7260) <at> <at> -553,7 +553,7 <at> <at> #if defined(CONFIG_INPUT_EVAL_AD7147EBZ) #include <linux/input.h> -#include <linux/spi/ad714x.h> +#include <linux/input/ad714x.h> static struct bfin5xx_spi_chip ad7147_spi_chip_info = { .enable_dma = 0, .bits_per_word = 16, <at> <at> -615,9 +615,11 <at> <at> }, .sys_cfg_reg = {0x2B2, 0x0, 0x3233, 0x819, 0x832, 0xCFF, 0xCFF, 0x0}, }; -#elif defined(CONFIG_INPUT_EVAL_AD7142EB) +#endif + +#if defined(CONFIG_INPUT_EVAL_AD7142EB) #include <linux/input.h> -#include <linux/spi/ad714x.h> +#include <linux/input/ad714x.h> static struct ad714x_button_plat button_plat[] = { { .keycode = BTN_1, <at> <at> -1450,7 +1452,7 <at> <at> static struct i2c_board_info __initdata bfin_i2c_board_info[] = { #if defined(CONFIG_INPUT_EVAL_AD7142EB) { - I2C_BOARD_INFO("ad714x_captouch", 0x2C), + I2C_BOARD_INFO("ad7142_captouch", 0x2C), .irq = IRQ_PG5, .platform_data = (void *)&ad7142_platfrom_data, },

Modified: trunk/drivers/input/misc/Kconfig (7259 => 7260)

--- trunk/drivers/input/misc/Kconfig 2009-09-02 08:14:05 UTC (rev 7259) +++ trunk/drivers/input/misc/Kconfig 2009-09-02 21:47:05 UTC (rev 7260) <at> <at> -259,47 +259,19 <at> <at> To compile this driver as a module, choose M here: the module will be called ad714X. -choice - prompt "AD714X Communication Method" - depends on INPUT_AD714X - default INPUT_AD714X_I2C if I2C - default INPUT_AD714X_SPI if (!I2C) && SPI_MASTER - -config INPUT_AD714X_I2C - bool "I2C Interface" - depends on I2C - help - Select this if you have a Capacitance Touch Sensor using the - AD714X controller, and your board-specific initialization - code includes that in its table of I2C devices. - -config INPUT_AD714X_SPI - bool "SPI Interface" - depends on SPI_MASTER - help - Select this if you have a Capacitance Touch Sensor using the - AD714X controller, and your board-specific initialization - code includes that in its table of SPI devices. -endchoice - -choice - prompt "Select a AD7142/AD7147 board you are connecting" - depends on INPUT_AD714X - config INPUT_EVAL_AD7147EBZ bool "ADI EVAL-AD7147EBZ board" - depends on INPUT_AD714X_SPI + depends on INPUT_AD714X && SPI help Select this if you are using ADI EVAL-AD7147EBZ board, there are five buttons and one slider on this board. config INPUT_EVAL_AD7142EB bool "ADI EVAL-AD7142EB board" - depends on INPUT_AD714X_I2C + depends on INPUT_AD714X && I2C help Select this if you are using ADI EVAL-AD7142EB board, there are four buttons and two sliders on this board. -endchoice config INPUT_ADXL34X tristate "ADXL345/346 Three-Axis Digital Accelerometer"

Modified: trunk/drivers/input/misc/ad714x.c (7259 => 7260)

--- trunk/drivers/input/misc/ad714x.c 2009-09-02 08:14:05 UTC (rev 7259) +++ trunk/drivers/input/misc/ad714x.c 2009-09-02 21:47:05 UTC (rev 7260) <at> <at> -5,28 +5,26 <at> <at> * * Licensed under the GPL-2 or later. */ - +#define pr_fmt(fmt) "ad714x: " fmt #include <linux/device.h> #include <linux/init.h> #include <linux/spi/spi.h> #include <linux/i2c.h> #include <linux/input.h> #include <linux/interrupt.h> -#include <linux/spi/ad714x.h> +#include <linux/input/ad714x.h> -#define AD714x_SPI_ADDR 0x1C -#define AD714x_SPI_ADDR_SHFT 11 -#define AD714x_SPI_READ 1 -#define AD714x_SPI_READ_SHFT 10 +#define AD714x_SPI_CMD_PREFIX 0xE000 /* bits 15:11 */ +#define AD714x_SPI_READ BIT(10) #define AD714X_PWR_CTRL 0x0 -#define AD714x_STG_CAL_EN_REG 0x1 +#define AD714X_STG_CAL_EN_REG 0x1 #define AD714X_AMB_COMP_CTRL0_REG 0x2 -#define AD714x_PARTID_REG 0x17 +#define AD714X_PARTID_REG 0x17 #define AD7147_PARTID 0x1470 #define AD7142_PARTID 0xE620 -#define AD714x_STAGECFG_REG 0x80 -#define AD714x_SYSCFG_REG 0x0 +#define AD714X_STAGECFG_REG 0x80 +#define AD714X_SYSCFG_REG 0x0 #define STG_LOW_INT_EN_REG 0x5 #define STG_HIGH_INT_EN_REG 0x6 <at> <at> -66,14 +64,6 <at> <at> #define STAGE_CFGREG_NUM 8 #define SYS_CFGREG_NUM 8 -#if defined(CONFIG_INPUT_AD714X_SPI) -#define bus_device struct spi_device -#elif defined(CONFIG_INPUT_AD714X_I2C) -#define bus_device struct i2c_client -#else -#error Communication method needs to be selected (I2C or SPI) -#endif - /* * driver information which will be used to maintain the software flow */ <at> <at> -124,7 +114,8 <at> <at> struct ad714x_button_drv { ad714x_device_state state; /* Unlike slider/wheel/touchpad, all buttons point to - * same input_dev instance */ + * same input_dev instance + */ struct input_dev *input; }; <at> <at> -136,7 +127,8 <at> <at> }; /* information to integrate all things which will be private data - * of spi/i2c device */ + * of spi/i2c device + */ struct ad714x_chip { unsigned short h_state; unsigned short l_state; <at> <at> -148,14 +140,18 <at> <at> struct ad714x_platform_data *hw; struct ad714x_driver_data *sw; - bus_device *bus; - int (*read) (bus_device *, unsigned short, unsigned short *); - int (*write) (bus_device *, unsigned short, unsigned short); + int irq; + struct device *dev; + int (*read) (struct device *, unsigned short, unsigned short *); + int (*write) (struct device *, unsigned short, unsigned short); struct mutex mutex; + + unsigned product; + unsigned version; }; -static void stage_use_com_int(struct ad714x_chip *ad714x, int start_stage, +static void ad714x_use_com_int(struct ad714x_chip *ad714x, int start_stage, int end_stage) { unsigned short data; <at> <at> -163,16 +159,16 <at> <at> mask = ((1 << (end_stage + 1)) - 1) - (1 << start_stage); - ad714x->read(ad714x->bus, STG_COM_INT_EN_REG, &data); + ad714x->read(ad714x->dev, STG_COM_INT_EN_REG, &data); data |= 1 << start_stage; - ad714x->write(ad714x->bus, STG_COM_INT_EN_REG, data); + ad714x->write(ad714x->dev, STG_COM_INT_EN_REG, data); - ad714x->read(ad714x->bus, STG_HIGH_INT_EN_REG, &data); + ad714x->read(ad714x->dev, STG_HIGH_INT_EN_REG, &data); data &= ~mask; - ad714x->write(ad714x->bus, STG_HIGH_INT_EN_REG, data); + ad714x->write(ad714x->dev, STG_HIGH_INT_EN_REG, data); } -static void stage_use_thr_int(struct ad714x_chip *ad714x, int start_stage, +static void ad714x_use_thr_int(struct ad714x_chip *ad714x, int start_stage, int end_stage) { unsigned short data; <at> <at> -180,16 +176,16 <at> <at> mask = ((1 << (end_stage + 1)) - 1) - (1 << start_stage); - ad714x->read(ad714x->bus, STG_COM_INT_EN_REG, &data); + ad714x->read(ad714x->dev, STG_COM_INT_EN_REG, &data); data &= ~(1 << start_stage); - ad714x->write(ad714x->bus, STG_COM_INT_EN_REG, data); + ad714x->write(ad714x->dev, STG_COM_INT_EN_REG, data); - ad714x->read(ad714x->bus, STG_HIGH_INT_EN_REG, &data); + ad714x->read(ad714x->dev, STG_HIGH_INT_EN_REG, &data); data |= mask; - ad714x->write(ad714x->bus, STG_HIGH_INT_EN_REG, data); + ad714x->write(ad714x->dev, STG_HIGH_INT_EN_REG, data); } -static int stage_cal_highest_stage(struct ad714x_chip *ad714x, int start_stage, +static int ad714x_cal_highest_stage(struct ad714x_chip *ad714x, int start_stage, int end_stage) { int max_res = 0; <at> <at> -206,7 +202,7 <at> <at> return max_idx; } -static int stage_cal_abs_pos(struct ad714x_chip *ad714x, int start_stage, +static int ad714x_cal_abs_pos(struct ad714x_chip *ad714x, int start_stage, int end_stage, int highest_stage, int max_coord) { int a_param, b_param; <at> <at> -238,10 +234,10 <at> <at> } -/* One button can connect to multi postive and negative of CDCs - * Multi-buttons can connect to same postive/negative of one CDC +/* One button can connect to multi positive and negative of CDCs + * Multi-buttons can connect to same positive/negative of one CDC */ -static void button_state_machine(struct ad714x_chip *ad714x, int idx) +static void ad714x_button_state_machine(struct ad714x_chip *ad714x, int idx) { struct ad714x_button_plat *hw = &ad714x->hw->button[idx]; struct ad714x_button_drv *sw = &ad714x->sw->button[idx]; <at> <at> -250,7 +246,7 <at> <at> case IDLE: if (((ad714x->h_state & hw->h_mask) == hw->h_mask) && ((ad714x->l_state & hw->l_mask) == hw->l_mask)) { - pr_debug("button %d touched\n", idx); + dev_dbg(ad714x->dev, "button %d touched\n", idx); input_report_key(sw->input, hw->keycode, 1); input_sync(sw->input); sw->state = ACTIVE; <at> <at> -259,7 +255,7 <at> <at> case ACTIVE: if (((ad714x->h_state & hw->h_mask) != hw->h_mask) || ((ad714x->l_state & hw->l_mask) != hw->l_mask)) { - pr_debug("button %d released\n", idx); + dev_dbg(ad714x->dev, "button %d released\n", idx); input_report_key(sw->input, hw->keycode, 0); input_sync(sw->input); sw->state = IDLE; <at> <at> -273,15 +269,15 <at> <at> /* The response of a sensor is defined by the absolute number of codes * between the current CDC value and the ambient value. */ -void slider_cal_sensor_val(struct ad714x_chip *ad714x, int idx) +void ad714x_slider_cal_sensor_val(struct ad714x_chip *ad714x, int idx) { struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx]; int i; for (i = hw->start_stage; i <= hw->end_stage; i++) { - ad714x->read(ad714x->bus, CDC_RESULT_S0 + i, + ad714x->read(ad714x->dev, CDC_RESULT_S0 + i, &ad714x->adc_reg[i]); - ad714x->read(ad714x->bus, + ad714x->read(ad714x->dev, STAGE0_AMBIENT + i * PER_STAGE_REG_NUM, &ad714x->amb_reg[i]); <at> <at> -290,15 +286,16 <at> <at> } } -void slider_cal_highest_stage(struct ad714x_chip *ad714x, int idx) +void ad714x_slider_cal_highest_stage(struct ad714x_chip *ad714x, int idx) { struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx]; struct ad714x_slider_drv *sw = &ad714x->sw->slider[idx]; - sw->highest_stage = stage_cal_highest_stage(ad714x, hw->start_stage, + sw->highest_stage = ad714x_cal_highest_stage(ad714x, hw->start_stage, hw->end_stage); - pr_debug("slider %d highest_stage:%d\n", idx, sw->highest_stage); + dev_dbg(ad714x->dev, "slider %d highest_stage:%d\n", idx, + sw->highest_stage); } /* The formulae are very straight forward. It uses the sensor with the <at> <at> -313,15 +310,16 <at> <at> * w += Sensor response(i) * POS=(Number_of_Positions_Wanted/(Number_of_Sensors_Used-1)) *(v/w) */ -void slider_cal_abs_pos(struct ad714x_chip *ad714x, int idx) +void ad714x_slider_cal_abs_pos(struct ad714x_chip *ad714x, int idx) { struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx]; struct ad714x_slider_drv *sw = &ad714x->sw->slider[idx]; - sw->abs_pos = stage_cal_abs_pos(ad714x, hw->start_stage, hw->end_stage, + sw->abs_pos = ad714x_cal_abs_pos(ad714x, hw->start_stage, hw->end_stage, sw->highest_stage, hw->max_coord); - pr_debug("slider %d absolute position:%d\n", idx, sw->abs_pos); + dev_dbg(ad714x->dev, "slider %d absolute position:%d\n", idx, + sw->abs_pos); } /* <at> <at> -334,29 +332,30 <at> <at> * Filtered_CDC_result = (Filtered_CDC_result * (10 - Coefficient) + * Latest_CDC_result * Coefficient)/10 */ -void slider_cal_flt_pos(struct ad714x_chip *ad714x, int idx) +void ad714x_slider_cal_flt_pos(struct ad714x_chip *ad714x, int idx) { struct ad714x_slider_drv *sw = &ad714x->sw->slider[idx]; sw->flt_pos = (sw->flt_pos * (10 - 4) + sw->abs_pos * 4)/10; - pr_debug("slider %d filter position:%d\n", idx, sw->flt_pos); + dev_dbg(ad714x->dev, "slider %d filter position:%d\n", idx, + sw->flt_pos); } -static void slider_use_com_int(struct ad714x_chip *ad714x, int idx) +static void ad714x_slider_use_com_int(struct ad714x_chip *ad714x, int idx) { struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx]; - stage_use_com_int(ad714x, hw->start_stage, hw->end_stage); + ad714x_use_com_int(ad714x, hw->start_stage, hw->end_stage); } -static void slider_use_thr_int(struct ad714x_chip *ad714x, int idx) +static void ad714x_slider_use_thr_int(struct ad714x_chip *ad714x, int idx) { struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx]; - stage_use_thr_int(ad714x, hw->start_stage, hw->end_stage); + ad714x_use_thr_int(ad714x, hw->start_stage, hw->end_stage); } -static void slider_state_machine(struct ad714x_chip *ad714x, int idx) +static void ad714x_slider_state_machine(struct ad714x_chip *ad714x, int idx) { struct ad714x_slider_plat *hw = &ad714x->hw->slider[idx]; struct ad714x_slider_drv *sw = &ad714x->sw->slider[idx]; <at> <at> -372,18 +371,18 <at> <at> case IDLE: if (h_state) { sw->state = JITTER; - /* In End of Conversion interrupt mode, the AD714x + /* In End of Conversion interrupt mode, the AD714X * continuously generates hardware interrupts. */ - slider_use_com_int(ad714x, idx); - pr_debug("slider %d touched\n", idx); + ad714x_slider_use_com_int(ad714x, idx); + dev_dbg(ad714x->dev, "slider %d touched\n", idx); } break; case JITTER: if (c_state == mask) { - slider_cal_sensor_val(ad714x, idx); - slider_cal_highest_stage(ad714x, idx); - slider_cal_abs_pos(ad714x, idx); + ad714x_slider_cal_sensor_val(ad714x, idx); + ad714x_slider_cal_highest_stage(ad714x, idx); + ad714x_slider_cal_abs_pos(ad714x, idx); sw->flt_pos = sw->abs_pos; sw->state = ACTIVE; } <at> <at> -391,10 +390,10 <at> <at> case ACTIVE: if (c_state == mask) { if (h_state) { - slider_cal_sensor_val(ad714x, idx); - slider_cal_highest_stage(ad714x, idx); - slider_cal_abs_pos(ad714x, idx); - slider_cal_flt_pos(ad714x, idx); + ad714x_slider_cal_sensor_val(ad714x, idx); + ad714x_slider_cal_highest_stage(ad714x, idx); + ad714x_slider_cal_abs_pos(ad714x, idx); + ad714x_slider_cal_flt_pos(ad714x, idx); input_report_abs(sw->input, ABS_X, sw->flt_pos); input_report_abs(sw->input, ABS_PRESSURE, 1); <at> <at> -402,10 +401,11 <at> <at> /* When the user lifts off the sensor, configure * the AD714X back to threshold interrupt mode. */ - slider_use_thr_int(ad714x, idx); + ad714x_slider_use_thr_int(ad714x, idx); sw->state = IDLE; input_report_abs(sw->input, ABS_PRESSURE, 0); - pr_debug("slider %d released\n", idx); + dev_dbg(ad714x->dev, "slider %d released\n", + idx); } input_sync(sw->input); } <at> <at> -421,27 +421,28 <at> <at> * the scrollwheel. Then we determined the 2 sensors on either sides of the * sensor with the highest response and we apply weights to these sensors. */ -void wheel_cal_highest_stage(struct ad714x_chip *ad714x, int idx) +static void ad714x_wheel_cal_highest_stage(struct ad714x_chip *ad714x, int idx) { struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx]; struct ad714x_wheel_drv *sw = &ad714x->sw->wheel[idx]; sw->pre_highest_stage = sw->highest_stage; - sw->highest_stage = stage_cal_highest_stage(ad714x, hw->start_stage, + sw->highest_stage = ad714x_cal_highest_stage(ad714x, hw->start_stage, hw->end_stage); - pr_debug("wheel %d highest_stage:%d\n", idx, sw->highest_stage); + dev_dbg(ad714x->dev, "wheel %d highest_stage:%d\n", idx, + sw->highest_stage); } -void wheel_cal_sensor_val(struct ad714x_chip *ad714x, int idx) +static void ad714x_wheel_cal_sensor_val(struct ad714x_chip *ad714x, int idx) { struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx]; int i; for (i = hw->start_stage; i <= hw->end_stage; i++) { - ad714x->read(ad714x->bus, CDC_RESULT_S0 + i, + ad714x->read(ad714x->dev, CDC_RESULT_S0 + i, &ad714x->adc_reg[i]); - ad714x->read(ad714x->bus, + ad714x->read(ad714x->dev, STAGE0_AMBIENT + i * PER_STAGE_REG_NUM, &ad714x->amb_reg[i]); if (ad714x->adc_reg[i] > ad714x->amb_reg[i]) <at> <at> -470,7 +471,7 <at> <at> #define WEIGHT_FACTOR 30 /* This constant prevents the "PositionOffset" from reaching a big value */ #define OFFSET_POSITION_CLAMP 120 -void wheel_cal_abs_pos(struct ad714x_chip *ad714x, int idx) +static void ad714x_wheel_cal_abs_pos(struct ad714x_chip *ad714x, int idx) { struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx]; struct ad714x_wheel_drv *sw = &ad714x->sw->wheel[idx]; <at> <at> -554,7 +555,7 <at> <at> sw->abs_pos = hw->max_coord; } -void wheel_cal_flt_pos(struct ad714x_chip *ad714x, int idx) +static void ad714x_wheel_cal_flt_pos(struct ad714x_chip *ad714x, int idx) { struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx]; struct ad714x_wheel_drv *sw = &ad714x->sw->wheel[idx]; <at> <at> -570,19 +571,19 <at> <at> sw->flt_pos = hw->max_coord; } -static void wheel_use_com_int(struct ad714x_chip *ad714x, int idx) +static void ad714x_wheel_use_com_int(struct ad714x_chip *ad714x, int idx) { struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx]; - stage_use_com_int(ad714x, hw->start_stage, hw->end_stage); + ad714x_use_com_int(ad714x, hw->start_stage, hw->end_stage); } -static void wheel_use_thr_int(struct ad714x_chip *ad714x, int idx) +static void ad714x_wheel_use_thr_int(struct ad714x_chip *ad714x, int idx) { struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx]; - stage_use_thr_int(ad714x, hw->start_stage, hw->end_stage); + ad714x_use_thr_int(ad714x, hw->start_stage, hw->end_stage); } -static void wheel_state_machine(struct ad714x_chip *ad714x, int idx) +static void ad714x_wheel_state_machine(struct ad714x_chip *ad714x, int idx) { struct ad714x_wheel_plat *hw = &ad714x->hw->wheel[idx]; struct ad714x_wheel_drv *sw = &ad714x->sw->wheel[idx]; <at> <at> -598,18 +599,18 <at> <at> case IDLE: if (h_state) { sw->state = JITTER; - /* In End of Conversion interrupt mode, the AD714x + /* In End of Conversion interrupt mode, the AD714X * continuously generates hardware interrupts. */ - wheel_use_com_int(ad714x, idx); - pr_debug("wheel %d touched\n", idx); + ad714x_wheel_use_com_int(ad714x, idx); + dev_dbg(ad714x->dev, "wheel %d touched\n", idx); } break; case JITTER: if (c_state == mask) { - wheel_cal_sensor_val(ad714x, idx); - wheel_cal_highest_stage(ad714x, idx); - wheel_cal_abs_pos(ad714x, idx); + ad714x_wheel_cal_sensor_val(ad714x, idx); + ad714x_wheel_cal_highest_stage(ad714x, idx); + ad714x_wheel_cal_abs_pos(ad714x, idx); sw->flt_pos = sw->abs_pos; sw->state = ACTIVE; } <at> <at> -617,9 +618,10 <at> <at> case ACTIVE: if (c_state == mask) { if (h_state) { - wheel_cal_sensor_val(ad714x, idx); - wheel_cal_highest_stage(ad714x, idx); - wheel_cal_abs_pos(ad714x, idx); + ad714x_wheel_cal_sensor_val(ad714x, idx); + ad714x_wheel_cal_highest_stage(ad714x, idx); + ad714x_wheel_cal_abs_pos(ad714x, idx); + ad714x_wheel_cal_flt_pos(ad714x, idx); input_report_abs(sw->input, ABS_WHEEL, sw->abs_pos); <at> <at> -628,11 +630,12 <at> <at> /* When the user lifts off the sensor, configure * the AD714X back to threshold interrupt mode. */ - wheel_use_thr_int(ad714x, idx); + ad714x_wheel_use_thr_int(ad714x, idx); sw->state = IDLE; input_report_abs(sw->input, ABS_PRESSURE, 0); - pr_debug("wheel %d released\n", idx); + dev_dbg(ad714x->dev, "wheel %d released\n", + idx); } input_sync(sw->input); } <at> <at> -642,15 +645,15 <at> <at> } } -void touchpad_cal_sensor_val(struct ad714x_chip *ad714x, int idx) +static void touchpad_cal_sensor_val(struct ad714x_chip *ad714x, int idx) { struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx]; int i; for (i = hw->x_start_stage; i <= hw->x_end_stage; i++) { - ad714x->read(ad714x->bus, CDC_RESULT_S0 + i, + ad714x->read(ad714x->dev, CDC_RESULT_S0 + i, &ad714x->adc_reg[i]); - ad714x->read(ad714x->bus, + ad714x->read(ad714x->dev, STAGE0_AMBIENT + i * PER_STAGE_REG_NUM, &ad714x->amb_reg[i]); if (ad714x->adc_reg[i] > ad714x->amb_reg[i]) <at> <at> -666,13 +669,14 <at> <at> struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx]; struct ad714x_touchpad_drv *sw = &ad714x->sw->touchpad[idx]; - sw->x_highest_stage = stage_cal_highest_stage(ad714x, hw->x_start_stage, - hw->x_end_stage); - sw->y_highest_stage = stage_cal_highest_stage(ad714x, hw->y_start_stage, - hw->y_end_stage); + sw->x_highest_stage = ad714x_cal_highest_stage(ad714x, + hw->x_start_stage, hw->x_end_stage); + sw->y_highest_stage = ad714x_cal_highest_stage(ad714x, + hw->y_start_stage, hw->y_end_stage); - pr_debug("touchpad %d x_highest_stage:%d, y_highest_stage:%d\n", - idx, sw->x_highest_stage, sw->y_highest_stage); + dev_dbg(ad714x->dev, + "touchpad %d x_highest_stage:%d, y_highest_stage:%d\n", + idx, sw->x_highest_stage, sw->y_highest_stage); } /* If 2 fingers are touching the sensor then 2 peaks can be observed in the <at> <at> -723,12 +727,12 <at> <at> struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx]; struct ad714x_touchpad_drv *sw = &ad714x->sw->touchpad[idx]; - sw->x_abs_pos = stage_cal_abs_pos(ad714x, hw->x_start_stage, + sw->x_abs_pos = ad714x_cal_abs_pos(ad714x, hw->x_start_stage, hw->x_end_stage, sw->x_highest_stage, hw->x_max_coord); - sw->y_abs_pos = stage_cal_abs_pos(ad714x, hw->y_start_stage, + sw->y_abs_pos = ad714x_cal_abs_pos(ad714x, hw->y_start_stage, hw->y_end_stage, sw->y_highest_stage, hw->y_max_coord); - pr_debug("touchpad %d absolute position:(%d, %d)\n", idx, + dev_dbg(ad714x->dev, "touchpad %d absolute position:(%d, %d)\n", idx, sw->x_abs_pos, sw->y_abs_pos); } <at> <at> -741,7 +745,7 <at> <at> sw->y_flt_pos = (sw->y_flt_pos * (10 - 4) + sw->y_abs_pos * 4)/10; - pr_debug("touchpad %d filter position:(%d, %d)\n", + dev_dbg(ad714x->dev, "touchpad %d filter position:(%d, %d)\n", idx, sw->x_flt_pos, sw->y_flt_pos); } <at> <at> -756,12 +760,12 <at> <at> * detection independent of the pressure. */ -#define LEFT_END_POINT_DETECTION_LEVEL 550 -#define RIGHT_END_POINT_DETECTION_LEVEL 750 -#define LEFT_RIGHT_END_POINT_DEAVTIVALION_LEVEL 850 -#define TOP_END_POINT_DETECTION_LEVEL 550 -#define BOTTOM_END_POINT_DETECTION_LEVEL 950 -#define TOP_BOTTOM_END_POINT_DEAVTIVALION_LEVEL 700 +#define LEFT_END_POINT_DETECTION_LEVEL 550 +#define RIGHT_END_POINT_DETECTION_LEVEL 750 +#define LEFT_RIGHT_END_POINT_DEAVTIVALION_LEVEL 850 +#define TOP_END_POINT_DETECTION_LEVEL 550 +#define BOTTOM_END_POINT_DETECTION_LEVEL 950 +#define TOP_BOTTOM_END_POINT_DEAVTIVALION_LEVEL 700 static int touchpad_check_endpoint(struct ad714x_chip *ad714x, int idx) { struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx]; <at> <at> -842,17 +846,17 <at> <at> static void touchpad_use_com_int(struct ad714x_chip *ad714x, int idx) { struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx]; - stage_use_com_int(ad714x, hw->x_start_stage, hw->x_end_stage); + ad714x_use_com_int(ad714x, hw->x_start_stage, hw->x_end_stage); } static void touchpad_use_thr_int(struct ad714x_chip *ad714x, int idx) { struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx]; - stage_use_thr_int(ad714x, hw->x_start_stage, hw->x_end_stage); - stage_use_thr_int(ad714x, hw->y_start_stage, hw->y_end_stage); + ad714x_use_thr_int(ad714x, hw->x_start_stage, hw->x_end_stage); + ad714x_use_thr_int(ad714x, hw->y_start_stage, hw->y_end_stage); } -static void touchpad_state_machine(struct ad714x_chip *ad714x, int idx) +static void ad714x_touchpad_state_machine(struct ad714x_chip *ad714x, int idx) { struct ad714x_touchpad_plat *hw = &ad714x->hw->touchpad[idx]; struct ad714x_touchpad_drv *sw = &ad714x->sw->touchpad[idx]; <at> <at> -871,11 +875,11 <at> <at> case IDLE: if (h_state) { sw->state = JITTER; - /* In End of Conversion interrupt mode, the AD714x + /* In End of Conversion interrupt mode, the AD714X * continuously generates hardware interrupts. */ touchpad_use_com_int(ad714x, idx); - pr_debug("touchpad %d touched\n", idx); + dev_dbg(ad714x->dev, "touchpad %d touched\n", idx); } break; case JITTER: <at> <at> -884,8 +888,9 <at> <at> touchpad_cal_highest_stage(ad714x, idx); if ((!touchpad_check_second_peak(ad714x, idx)) && (!touchpad_check_endpoint(ad714x, idx))) { - pr_debug("touchpad%d, 2 fingers or endpoint\n", - idx); + dev_dbg(ad714x->dev, + "touchpad%d, 2 fingers or endpoint\n", + idx); touchpad_cal_abs_pos(ad714x, idx); sw->x_flt_pos = sw->x_abs_pos; sw->y_flt_pos = sw->y_abs_pos; <at> <at> -916,7 +921,8 <at> <at> touchpad_use_thr_int(ad714x, idx); sw->state = IDLE; input_report_abs(sw->input, ABS_PRESSURE, 0); - pr_debug("touchpad %d released\n", idx); + dev_dbg(ad714x->dev, "touchpad %d released\n", + idx); } input_sync(sw->input); } <at> <at> -930,24 +936,29 <at> <at> { unsigned short data; - ad714x->read(ad714x->bus, AD714x_PARTID_REG, &data); + ad714x->read(ad714x->dev, AD714X_PARTID_REG, &data); switch (data & 0xFFF0) { case AD7147_PARTID: - dev_info(&ad714x->bus->dev, "Found AD7147 captouch, rev:%d\n", - data & 0xF); + ad714x->product = 0x7147; + ad714x->version = data & 0xF; + dev_info(ad714x->dev, "Found AD7147 captouch, rev:%d\n", + ad714x->version); return 0; case AD7142_PARTID: - dev_info(&ad714x->bus->dev, "Found AD7142 captouch, rev:%d\n", - data & 0xF); + ad714x->product = 0x7142; + ad714x->version = data & 0xF; + dev_info(ad714x->dev, "Found AD7142 captouch, rev:%d\n", + ad714x->version); return 0; default: - dev_err(&ad714x->bus->dev, "Fail to detect AD714x captouch,\ - read ID is %04x\n", data); + dev_err(ad714x->dev, + "Fail to detect AD714X captouch, read ID is %04x\n", + data); return -ENODEV; } } -static int ad714x_hw_init(struct ad714x_chip *ad714x) +static void __devinit ad714x_hw_init(struct ad714x_chip *ad714x) { int i, j; unsigned short reg_base; <at> <at> -956,24 +967,25 <at> <at> /* configuration CDC and interrupts*/ for (i = 0; i < STAGE_NUM; i++) { - reg_base = AD714x_STAGECFG_REG + i * STAGE_CFGREG_NUM; + reg_base = AD714X_STAGECFG_REG + i * STAGE_CFGREG_NUM; for (j = 0; j < STAGE_CFGREG_NUM; j++) - ad714x->write(ad714x->bus, reg_base + j, - ad714x->hw->stage_cfg_reg[i][j]); + ad714x->write(ad714x->dev, reg_base + j, + ad714x->hw->stage_cfg_reg[i][j]); } for (i = 0; i < SYS_CFGREG_NUM; i++) - ad714x->write(ad714x->bus, AD714x_SYSCFG_REG + i, + ad714x->write(ad714x->dev, AD714X_SYSCFG_REG + i, ad714x->hw->sys_cfg_reg[i]); + for (i = 0; i < SYS_CFGREG_NUM; i++) + ad714x->read(ad714x->dev, AD714X_SYSCFG_REG + i, + &data); - ad714x->write(ad714x->bus, AD714x_STG_CAL_EN_REG, 0xFFF); + ad714x->write(ad714x->dev, AD714X_STG_CAL_EN_REG, 0xFFF); /* clear all interrupts */ - ad714x->read(ad714x->bus, STG_LOW_INT_STA_REG, &data); - ad714x->read(ad714x->bus, STG_HIGH_INT_STA_REG, &data); - ad714x->read(ad714x->bus, STG_COM_INT_STA_REG, &data); - - return 0; + ad714x->read(ad714x->dev, STG_LOW_INT_STA_REG, &data); + ad714x->read(ad714x->dev, STG_HIGH_INT_STA_REG, &data); + ad714x->read(ad714x->dev, STG_COM_INT_STA_REG, &data); } static irqreturn_t ad714x_interrupt_thread(int irq, void *data) <at> <at> -983,21 +995,18 <at> <at> mutex_lock(&ad714x->mutex); - ad714x->read(ad714x->bus, STG_LOW_INT_STA_REG, &ad714x->l_state); - ad714x->read(ad714x->bus, STG_HIGH_INT_STA_REG, &ad714x->h_state); - ad714x->read(ad714x->bus, STG_COM_INT_STA_REG, &ad714x->c_state); + ad714x->read(ad714x->dev, STG_LOW_INT_STA_REG, &ad714x->l_state); + ad714x->read(ad714x->dev, STG_HIGH_INT_STA_REG, &ad714x->h_state); + ad714x->read(ad714x->dev, STG_COM_INT_STA_REG, &ad714x->c_state); - pr_debug("%s l_state:%04x h_state:%04x c_stage:%04x\n", __func__, - ad714x->l_state, ad714x->h_state, ad714x->c_state); - for (i = 0; i < ad714x->hw->button_num; i++) - button_state_machine(ad714x, i); + ad714x_button_state_machine(ad714x, i); for (i = 0; i < ad714x->hw->slider_num; i++) - slider_state_machine(ad714x, i); + ad714x_slider_state_machine(ad714x, i); for (i = 0; i < ad714x->hw->wheel_num; i++) - wheel_state_machine(ad714x, i); + ad714x_wheel_state_machine(ad714x, i); for (i = 0; i < ad714x->hw->touchpad_num; i++) - touchpad_state_machine(ad714x, i); + ad714x_touchpad_state_machine(ad714x, i); mutex_unlock(&ad714x->mutex); <at> <at> -1010,7 +1019,7 <at> <at> } #define MAX_DEVICE_NUM 8 -static int __devinit ad714x_probe(struct ad714x_chip *ad714x) +static int __devinit ad714x_probe(struct ad714x_chip *ad714x, u16 bus_type) { int ret = 0; struct input_dev *input[MAX_DEVICE_NUM]; <at> <at> -1034,13 +1043,30 <at> <at> if (ret) goto det_err; + /* initilize and request sw/hw resources */ + + ad714x_hw_init(ad714x); + mutex_init(&ad714x->mutex); + + if (ad714x->irq > 0) { + ret = request_threaded_irq(ad714x->irq, ad714x_interrupt, + ad714x_interrupt_thread, IRQF_TRIGGER_FALLING, + "ad714x_captouch", ad714x); + if (ret) { + dev_err(ad714x->dev, "Can't allocate irq %d\n", + ad714x->irq); + goto fail_irq; + } + } else + dev_err(ad714x->dev, "IRQ not configured!\n"); + /* - * Allocate and register AD714x input device + * Allocate and register AD714X input device */ drv_data = kzalloc(sizeof(struct ad714x_driver_data), GFP_KERNEL); if (!drv_data) { - dev_err(&ad714x->bus->dev, + dev_err(ad714x->dev, "Can't allocate memory for ad714x driver info\n"); ret = -ENOMEM; goto fail_alloc_reg; <at> <at> -1052,7 +1078,7 <at> <at> sd_drv = kzalloc(sizeof(struct ad714x_slider_drv) * ad714x->hw->slider_num, GFP_KERNEL); if (!sd_drv) { - dev_err(&ad714x->bus->dev, + dev_err(ad714x->dev, "Can't allocate memory for slider info\n"); ret = -ENOMEM; goto fail_alloc_reg; <at> <at> -1061,7 +1087,7 <at> <at> for (i = 0; i < ad714x->hw->slider_num; i++) { input[alloc_idx] = input_allocate_device(); if (!input[alloc_idx]) { - dev_err(&ad714x->bus->dev, + dev_err(ad714x->dev, "Can't allocate input device %d\n", alloc_idx); ret = -ENOMEM; goto fail_alloc_reg; <at> <at> -1076,12 +1102,14 <at> <at> input_set_abs_params(input[alloc_idx-1], ABS_PRESSURE, 0, 1, 0, 0); - input[alloc_idx-1]->id.bustype = BUS_I2C; + input[alloc_idx-1]->id.bustype = bus_type; + input[alloc_idx-1]->id.product = ad714x->product; + input[alloc_idx-1]->id.version = ad714x->version; ret = input_register_device(input[reg_idx]); if (ret) { - dev_err(&ad714x->bus->dev, - "Failed to register AD714x input device!\n"); + dev_err(ad714x->dev, + "Failed to register AD714X input device!\n"); goto fail_alloc_reg; } reg_idx++; <at> <at> -1096,7 +1124,7 <at> <at> wl_drv = kzalloc(sizeof(struct ad714x_wheel_drv) * ad714x->hw->wheel_num, GFP_KERNEL); if (!wl_drv) { - dev_err(&ad714x->bus->dev, + dev_err(ad714x->dev, "Can't allocate memory for wheel info\n"); ret = -ENOMEM; goto fail_alloc_reg; <at> <at> -1105,7 +1133,7 <at> <at> for (i = 0; i < ad714x->hw->wheel_num; i++) { input[alloc_idx] = input_allocate_device(); if (!input[alloc_idx]) { - dev_err(&ad714x->bus->dev, + dev_err(ad714x->dev, "Can't allocate input device %d\n", alloc_idx); ret = -ENOMEM; goto fail_alloc_reg; <at> <at> -1120,12 +1148,14 <at> <at> input_set_abs_params(input[alloc_idx-1], ABS_PRESSURE, 0, 1, 0, 0); - input[alloc_idx-1]->id.bustype = BUS_I2C; + input[alloc_idx-1]->id.bustype = bus_type; + input[alloc_idx-1]->id.product = ad714x->product; + input[alloc_idx-1]->id.version = ad714x->version; ret = input_register_device(input[reg_idx]); if (ret) { - dev_err(&ad714x->bus->dev, - "Failed to register AD714x input device!\n"); + dev_err(ad714x->dev, + "Failed to register AD714X input device!\n"); goto fail_alloc_reg; } reg_idx++; <at> <at> -1140,7 +1170,7 <at> <at> tp_drv = kzalloc(sizeof(struct ad714x_touchpad_drv) * ad714x->hw->touchpad_num, GFP_KERNEL); if (!tp_drv) { - dev_err(&ad714x->bus->dev, + dev_err(ad714x->dev, "Can't allocate memory for touchpad info\n"); ret = -ENOMEM; goto fail_alloc_reg; <at> <at> -1149,7 +1179,7 <at> <at> for (i = 0; i < ad714x->hw->touchpad_num; i++) { input[alloc_idx] = input_allocate_device(); if (!input[alloc_idx]) { - dev_err(&ad714x->bus->dev, + dev_err(ad714x->dev, "Can't allocate input device %d\n", alloc_idx); ret = -ENOMEM; <at> <at> -1168,12 +1198,14 <at> <at> input_set_abs_params(input[alloc_idx-1], ABS_PRESSURE, 0, 1, 0, 0); - input[alloc_idx-1]->id.bustype = BUS_I2C; + input[alloc_idx-1]->id.bustype = bus_type; + input[alloc_idx-1]->id.product = ad714x->product; + input[alloc_idx-1]->id.version = ad714x->version; ret = input_register_device(input[reg_idx]); if (ret) { - dev_err(&ad714x->bus->dev, - "Failed to register AD714x input device!\n"); + dev_err(ad714x->dev, + "Failed to register AD714X input device!\n"); goto fail_alloc_reg; } reg_idx++; <at> <at> -1188,7 +1220,7 <at> <at> bt_drv = kzalloc(sizeof(struct ad714x_button_drv) * ad714x->hw->button_num, GFP_KERNEL); if (!bt_drv) { - dev_err(&ad714x->bus->dev, + dev_err(ad714x->dev, "Can't allocate memory for button info\n"); ret = -ENOMEM; goto fail_alloc_reg; <at> <at> -1196,7 +1228,7 <at> <at> input[alloc_idx] = input_allocate_device(); if (!input[alloc_idx]) { - dev_err(&ad714x->bus->dev, + dev_err(ad714x->dev, "Can't allocate input device %d\n", alloc_idx); ret = -ENOMEM; <at> <at> -1210,12 +1242,14 <at> <at> input[alloc_idx-1]->keybit); } - input[alloc_idx-1]->id.bustype = BUS_I2C; + input[alloc_idx-1]->id.bustype = bus_type; + input[alloc_idx-1]->id.product = ad714x->product; + input[alloc_idx-1]->id.version = ad714x->version; ret = input_register_device(input[reg_idx]); if (ret) { - dev_err(&ad714x->bus->dev, - "Failed to register AD714x input device!\n"); + dev_err(ad714x->dev, + "Failed to register AD714X input device!\n"); goto fail_alloc_reg; } reg_idx++; <at> <at> -1225,36 +1259,23 <at> <at> ad714x->sw->button = bt_drv; } - /* initilize and request sw/hw resources */ - ad714x_hw_init(ad714x); - mutex_init(&ad714x->mutex); - - if (ad714x->bus->irq > 0) { - ret = request_threaded_irq(ad714x->bus->irq, ad714x_interrupt, - ad714x_interrupt_thread, IRQF_TRIGGER_FALLING, - "ad714x_captouch", ad714x); - if (ret) { - dev_err(&ad714x->bus->dev, "Can't allocate irq %d\n", - ad714x->bus->irq); - goto fail_irq; - } - } else - dev_warn(&ad714x->bus->dev, "IRQ not configured!\n"); - return 0; -fail_irq: fail_alloc_reg: for (i = 0; i < reg_idx; i++) input_unregister_device(input[i]); for (i = 0; i < alloc_idx; i++) input_free_device(input[i]); - kfree(bt_drv); /* kfree(NULL) is safe check is not required */ + + kfree(bt_drv); kfree(sd_drv); kfree(wl_drv); kfree(tp_drv); kfree(drv_data); + + free_irq(ad714x->irq, ad714x); +fail_irq: det_err: return ret; } <at> <at> -1269,11 +1290,7 <at> <at> struct ad714x_wheel_drv *wl_drv = ad714x->sw->wheel; struct ad714x_touchpad_drv *tp_drv = ad714x->sw->touchpad; - /* free irq hardware resource */ - if (ad714x->bus->irq > 0) - free_irq(ad714x->bus->irq, ad714x); - /* unregister and free all input devices */ for (i = 0; i < ad714x->hw->slider_num; i++) { <at> <at> -1295,119 +1312,132 <at> <at> input_free_device(ad714x->sw->button[0].input); /* free all memories for software flow */ - kfree(bt_drv); /* kfree(NULL) is safe check is not required */ + + kfree(bt_drv); kfree(sd_drv); kfree(wl_drv); kfree(tp_drv); kfree(drv_data); - kfree(ad714x); + /* free irq hardware resource */ + + free_irq(ad714x->irq, ad714x); + return 0; } #ifdef CONFIG_PM -static int ad714x_suspend(bus_device *bus, pm_message_t message) +static int ad714x_disable(struct ad714x_chip *ad714x) { - struct ad714x_chip *ad714x = dev_get_drvdata(&bus->dev); unsigned short data; - pr_debug("%s enter\n", __func__); + dev_dbg(ad714x->dev, "%s enter\n", __func__); mutex_lock(&ad714x->mutex); data = ad714x->hw->sys_cfg_reg[AD714X_PWR_CTRL] | 0x3; - ad714x->write(bus, AD714X_PWR_CTRL, data); + ad714x->write(ad714x->dev, AD714X_PWR_CTRL, data); mutex_unlock(&ad714x->mutex); return 0; } -static int ad714x_resume(bus_device *bus) +static int ad714x_enable(struct ad714x_chip *ad714x) { - struct ad714x_chip *ad714x = dev_get_drvdata(&bus->dev); unsigned short data; - pr_debug("%s enter\n", __func__); + dev_dbg(ad714x->dev, "%s enter\n", __func__); mutex_lock(&ad714x->mutex); /* resume to non-shutdown mode */ - ad714x->write(bus, AD714X_PWR_CTRL, + ad714x->write(ad714x->dev, AD714X_PWR_CTRL, ad714x->hw->sys_cfg_reg[AD714X_PWR_CTRL]); /* make sure the interrupt output line is not low level after resume, * otherwise we will get no chance to enter falling-edge irq again */ - ad714x->read(bus, STG_LOW_INT_STA_REG, &data); - ad714x->read(bus, STG_HIGH_INT_STA_REG, &data); - ad714x->read(bus, STG_COM_INT_STA_REG, &data); + ad714x->read(ad714x->dev, STG_LOW_INT_STA_REG, &data); + ad714x->read(ad714x->dev, STG_HIGH_INT_STA_REG, &data); + ad714x->read(ad714x->dev, STG_COM_INT_STA_REG, &data); mutex_unlock(&ad714x->mutex); return 0; } -#else -#define ad714x_suspend NULL -#define ad714x_resume NULL -#endif -#if defined(CONFIG_INPUT_AD714X_SPI) -int ad714x_spi_read(struct spi_device *spi, unsigned short reg, - unsigned short *data) +#if defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE) +static int ad714x_spi_suspend(struct spi_device *spi, pm_message_t message) { - int ret; - unsigned short tx[2]; - unsigned short rx[2]; - struct spi_transfer t = { - .tx_buf = tx, - .rx_buf = rx, - .len = 4, - }; - struct spi_message m; + struct ad714x_chip *ad714x = spi_get_drvdata(spi); - tx[0] = (AD714x_SPI_ADDR << AD714x_SPI_ADDR_SHFT) | - (AD714x_SPI_READ << AD714x_SPI_READ_SHFT) | reg; + ad714x_disable(ad714x); - spi_message_init(&m); - spi_message_add_tail(&t, &m); - ret = spi_sync(spi, &m); + return 0; +} - if (ret < 0) { - dev_err(&spi->dev, "SPI read error\n"); - return ret; - } +static int ad714x_spi_resume(struct spi_device *spi) +{ + struct ad714x_chip *ad714x = spi_get_drvdata(spi); - *data = rx[1]; - return ret; + ad714x_enable(ad714x); + + return 0; } +#endif -int ad714x_spi_write(struct spi_device *spi, unsigned short reg, - unsigned short data) +#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) +static int ad714x_i2c_suspend(struct i2c_client *client, pm_message_t message) { - int ret = 0; - unsigned short tx[2]; - struct spi_transfer t = { - .tx_buf = tx, - .len = 4, - }; - struct spi_message m; + struct ad714x_chip *ad714x = i2c_get_clientdata(client); - tx[0] = (AD714x_SPI_ADDR << AD714x_SPI_ADDR_SHFT) | reg; - tx[1] = data; + ad714x_disable(ad714x); - spi_message_init(&m); - spi_message_add_tail(&t, &m); + return 0; +} - ret = spi_sync(spi, &m); - if (ret < 0) - dev_err(&spi->dev, "SPI write error\n"); +static int ad714x_i2c_resume(struct i2c_client *client) +{ + struct ad714x_chip *ad714x = i2c_get_clientdata(client); - return ret; + ad714x_enable(ad714x); + + return 0; } +#endif +#else +#define ad714x_spi_suspend NULL +#define ad714x_spi_resume NULL +#define ad714x_i2c_suspend NULL +#define ad714x_i2c_resume NULL +#endif + +#if defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE) +static int ad714x_spi_read(struct device *dev, unsigned short reg, + unsigned short *data) +{ + struct spi_device *spi = to_spi_device(dev); + unsigned short tx = AD714x_SPI_CMD_PREFIX | AD714x_SPI_READ | reg; + + return spi_write_then_read(spi, (u8 *)&tx, 2, (u8 *)data, 2); +} + +static int ad714x_spi_write(struct device *dev, unsigned short reg, + unsigned short data) +{ + struct spi_device *spi = to_spi_device(dev); + unsigned short tx[2] = { + AD714x_SPI_CMD_PREFIX | reg, + data + }; + + return spi_write(spi, (u8 *)tx, 4); +} + static int __devinit ad714x_spi_probe(struct spi_device *spi) { int ret = 0; <at> <at> -1422,14 +1452,15 <at> <at> if (!chip) return -ENOMEM; - chip->bus = spi; chip->read = ad714x_spi_read; chip->write = ad714x_spi_write; chip->hw = spi->dev.platform_data; + chip->irq = spi->irq; + chip->dev = &spi->dev; spi_set_drvdata(spi, chip); /* common probe not related with spi/i2c */ - ret = ad714x_probe(chip); + ret = ad714x_probe(chip, BUS_SPI); if (ret) kfree(chip); <at> <at> -1439,52 +1470,42 <at> <at> static int __devexit ad714x_spi_remove(struct spi_device *spi) { struct ad714x_chip *chip = spi_get_drvdata(spi); + ad714x_remove(chip); + kfree(chip); + return 0; } static struct spi_driver ad714x_spi_driver = { .driver = { .name = "ad714x_captouch", - .bus = &spi_bus_type, .owner = THIS_MODULE, }, .probe = ad714x_spi_probe, .remove = __devexit_p(ad714x_spi_remove), - .suspend = ad714x_suspend, - .resume = ad714x_resume, + .suspend = ad714x_spi_suspend, + .resume = ad714x_spi_resume, }; +#endif -static int __init ad714x_init(void) -{ - int ret; - ret = spi_register_driver(&ad714x_spi_driver); - if (ret != 0) { - printk(KERN_ERR "Failed to register ad714x SPI driver: %d\n", - ret); - } - - return ret; -} - -static void __exit ad714x_exit(void) -{ - spi_unregister_driver(&ad714x_spi_driver); -} -#else -static int ad714x_i2c_write(struct i2c_client *client, unsigned short reg, +#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) +static int ad714x_i2c_write(struct device *dev, unsigned short reg, unsigned short data) { + struct i2c_client *client = to_i2c_client(dev); int ret = 0; - u8 tx[4]; + u8 *_reg = (u8 *)&reg; + u8 *_data = (u8 *)&data; - /* Do raw I2C, not smbus compatible */ - tx[0] = (reg & 0xFF00) >> 8; - tx[1] = (reg & 0x00FF); - tx[2] = (data & 0xFF00) >> 8; - tx[3] = data & 0x00FF; + u8 tx[4] = { + _reg[1], + _reg[0], + _data[1], + _data[0] + }; ret = i2c_master_send(client, tx, 4); if (ret < 0) <at> <at> -1493,17 +1514,20 <at> <at> return ret; } -static int ad714x_i2c_read(struct i2c_client *client, unsigned short reg, +static int ad714x_i2c_read(struct device *dev, unsigned short reg, unsigned short *data) { + struct i2c_client *client = to_i2c_client(dev); int ret = 0; - u8 tx[2]; + u8 *_reg = (u8 *)&reg; + u8 *_data = (u8 *)data; + + u8 tx[2] = { + _reg[1], + _reg[0] + }; u8 rx[2]; - /* Do raw I2C, not smbus compatible */ - tx[0] = (reg & 0xFF00) >> 8; - tx[1] = (reg & 0x00FF); - ret = i2c_master_send(client, tx, 2); if (ret < 0) { dev_err(&client->dev, "I2C read error\n"); <at> <at> -1516,8 +1540,8 <at> <at> return ret; } - *data = rx[0]; - *data = (*data << 8) | rx[1]; + _data[0] = rx[1]; + _data[1] = rx[0]; return ret; } <at> <at> -1538,14 +1562,15 <at> <at> if (!chip) return -ENOMEM; - chip->bus = client; chip->read = ad714x_i2c_read; chip->write = ad714x_i2c_write; chip->hw = client->dev.platform_data; + chip->irq = client->irq; + chip->dev = &client->dev; i2c_set_clientdata(client, chip); /* common probe not related with spi/i2c */ - ret = ad714x_probe(chip); + ret = ad714x_probe(chip, BUS_I2C); if (ret) kfree(chip); <at> <at> -1555,13 +1580,17 <at> <at> static int __devexit ad714x_i2c_remove(struct i2c_client *client) { struct ad714x_chip *chip = i2c_get_clientdata(client); + ad714x_remove(chip); + kfree(chip); + return 0; } static const struct i2c_device_id ad714x_id[] = { - { "ad714x_captouch", 0 }, + { "ad7142_captouch", 0 }, + { "ad7147_captouch", 0 }, { } }; MODULE_DEVICE_TABLE(i2c, ad714x_id); <at> <at> -1570,27 +1599,54 <at> <at> .driver = { .name = "ad714x_captouch", }, - .probe = ad714x_i2c_probe, - .remove = __devexit_p(ad714x_i2c_remove), - .suspend = ad714x_suspend, - .resume = ad714x_resume, + .probe = ad714x_i2c_probe, + .remove = __devexit_p(ad714x_i2c_remove), + .suspend = ad714x_i2c_suspend, + .resume = ad714x_i2c_resume, .id_table = ad714x_id, }; +#endif static int __init ad714x_init(void) { +#if (defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)) && \ + !(defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)) + return spi_register_driver(&ad714x_spi_driver); +#endif + +#if (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)) && \ + !(defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)) return i2c_add_driver(&ad714x_i2c_driver); +#endif + +#if (defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)) && \ + (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)) + int ret = 0; + ret = spi_register_driver(&ad714x_spi_driver); + if (ret) + goto err; + ret = i2c_add_driver(&ad714x_i2c_driver); + if (ret) + spi_unregister_driver(&ad714x_spi_driver); +err: + return ret; +#endif } static void __exit ad714x_exit(void) { +#if defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE) + spi_unregister_driver(&ad714x_spi_driver); +#endif + +#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) i2c_del_driver(&ad714x_i2c_driver); +#endif } -#endif module_init(ad714x_init); module_exit(ad714x_exit); -MODULE_DESCRIPTION("ad714x captouch driver"); +MODULE_DESCRIPTION("Analog Devices AD714X Capacitance Touch Sensor Driver"); MODULE_AUTHOR("Barry Song <21cnbao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>"); MODULE_LICENSE("GPL");

Copied: trunk/include/linux/input/ad714x.h (from rev 7259, trunk/include/linux/spi/ad714x.h) (0 => 7260)

--- trunk/include/linux/input/ad714x.h (rev 0) +++ trunk/include/linux/input/ad714x.h 2009-09-02 21:47:05 UTC (rev 7260) <at> <at> -0,0 +1,62 <at> <at> +/* + * include/linux/input/ad714x.h + * + * AD714x is very flexible, it can be used as buttons, scrollwheel, + * slider, touchpad at the same time. That depends on the boards. + * The platform_data for the device's "struct device" holds this + * information. + * Copyright 2009 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +#ifndef __LINUX_INPUT_AD714X_H__ +#define __LINUX_INPUT_AD714X_H__ + +#define STAGE_NUM 12 +#define STAGE_CFGREG_NUM 8 +#define SYS_CFGREG_NUM 8 + +/* board information which need be initialized in arch/mach... */ +struct ad714x_slider_plat { + int start_stage; + int end_stage; + int max_coord; +}; + +struct ad714x_wheel_plat { + int start_stage; + int end_stage; + int max_coord; +}; + +struct ad714x_touchpad_plat { + int x_start_stage; + int x_end_stage; + int x_max_coord; + + int y_start_stage; + int y_end_stage; + int y_max_coord; +}; + +struct ad714x_button_plat { + int keycode; + unsigned short l_mask; + unsigned short h_mask; +}; + +struct ad714x_platform_data { + int slider_num; + int wheel_num; + int touchpad_num; + int button_num; + struct ad714x_slider_plat *slider; + struct ad714x_wheel_plat *wheel; + struct ad714x_touchpad_plat *touchpad; + struct ad714x_button_plat *button; + unsigned short stage_cfg_reg[STAGE_NUM][STAGE_CFGREG_NUM]; + unsigned short sys_cfg_reg[SYS_CFGREG_NUM]; +}; + +#endif

Property changes: trunk/include/linux/input/ad714x.h

Added: svn:mergeinfo

Deleted: trunk/include/linux/spi/ad714x.h (7259 => 7260)

--- trunk/include/linux/spi/ad714x.h 2009-09-02 08:14:05 UTC (rev 7259) +++ trunk/include/linux/spi/ad714x.h 2009-09-02 21:47:05 UTC (rev 7260) <at> <at> -1,62 +0,0 <at> <at> -/* - * include/linux/ad714x.h - * - * AD714x is very flexible, it can be used as buttons, scrollwheel, - * slider, touchpad at the same time. That depends on the boards. - * The platform_data for the device's "struct device" holds this - * information. - * Copyright 2009 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. - */ - -#ifndef __LINUX_SPI_AD714X_H__ -#define __LINUX_SPI_AD714X_H__ - -#define STAGE_NUM 12 -#define STAGE_CFGREG_NUM 8 -#define SYS_CFGREG_NUM 8 - -/* board information which need be initialized in arch/mach... */ -struct ad714x_slider_plat { - int start_stage; - int end_stage; - int max_coord; -}; - -struct ad714x_wheel_plat { - int start_stage; - int end_stage; - int max_coord; -}; - -struct ad714x_touchpad_plat { - int x_start_stage; - int x_end_stage; - int x_max_coord; - - int y_start_stage; - int y_end_stage; - int y_max_coord; -}; - -struct ad714x_button_plat { - int keycode; - unsigned short l_mask; - unsigned short h_mask; -}; - -struct ad714x_platform_data { - int slider_num; - int wheel_num; - int touchpad_num; - int button_num; - struct ad714x_slider_plat *slider; - struct ad714x_wheel_plat *wheel; - struct ad714x_touchpad_plat *touchpad; - struct ad714x_button_plat *button; - unsigned short stage_cfg_reg[STAGE_NUM][STAGE_CFGREG_NUM]; - unsigned short sys_cfg_reg[SYS_CFGREG_NUM]; -}; - -#endif
<div>

&lt;!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg &gt; ul, #logmsg &gt; ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--&gt;<div>
Revision <a href="http://blackfin.uclinux.org/gf/project/linux-kernel/scmsvn/?action=browse&amp;path=/&amp;view=rev&amp;root=linux-kernel&amp;revision=7260">7260</a>
Author <a href="http://blackfin.uclinux.org/gf/user/bhsong/">bhsong</a>
Date 2009-09-02 17:47:05 -0400 (Wed, 02 Sep 2009)
<h3>Log Message</h3>
update according to the feedback of David Brownell/Mike Frysinger
1.enable both i2c and spi bus, use bus-match to trigger devices probing
2.move headfile ad714x.h from include/linux/spi to include/linux/input
3.coding style issues

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkarchblackfinmachbf537boardsstampc">trunk/arch/blackfin/mach-bf537/boards/stamp.c</a></li>
<li><a href="#trunkdriversinputmiscKconfig">trunk/drivers/input/misc/Kconfig</a></li>
<li><a href="#trunkdriversinputmiscad714xc">trunk/drivers/input/misc/ad714x.c</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/include/linux/input/≤/li>
<li><a href="#trunkincludelinuxinputad714xh">trunk/include/linux/input/ad714x.h</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkincludelinuxspiad714xh">trunk/include/linux/spi/ad714x.h</a></li>
</ul>
</div>
<div>
<h3>Diff</h3>
<a></a>
<div class="modfile">
<h4>Modified: trunk/arch/blackfin/mach-bf537/boards/stamp.c (7259 =&gt; 7260)</h4>
<span>
<span class="info">--- trunk/arch/blackfin/mach-bf537/boards/stamp.c	2009-09-02 08:14:05 UTC (rev 7259)
+++ trunk/arch/blackfin/mach-bf537/boards/stamp.c	2009-09-02 21:47:05 UTC (rev 7260)
</span><span class="lines"> <at>  <at>  -553,7 +553,7  <at>  <at> 
</span><span class="cx"> 
</span><span class="cx"> #if defined(CONFIG_INPUT_EVAL_AD7147EBZ)
</span><span class="cx"> #include &lt;linux/input.h&gt;
</span>-#include &lt;linux/spi/ad714x.h&gt;
+#include &lt;linux/input/ad714x.h&gt;
<span class="cx"> static struct bfin5xx_spi_chip ad7147_spi_chip_info = {
</span><span class="cx"> 	.enable_dma = 0,
</span><span class="cx"> 	.bits_per_word = 16,
</span><span class="lines"> <at>  <at>  -615,9 +615,11  <at>  <at> 
</span><span class="cx"> 	},
</span><span class="cx"> 	.sys_cfg_reg = {0x2B2, 0x0, 0x3233, 0x819, 0x832, 0xCFF, 0xCFF, 0x0},
</span><span class="cx"> };
</span>-#elif defined(CONFIG_INPUT_EVAL_AD7142EB)
+#endif
+
+#if defined(CONFIG_INPUT_EVAL_AD7142EB)
<span class="cx"> #include &lt;linux/input.h&gt;
</span>-#include &lt;linux/spi/ad714x.h&gt;
+#include &lt;linux/input/ad714x.h&gt;
<span class="cx"> static struct ad714x_button_plat button_plat[] = {
</span><span class="cx"> 	{
</span><span class="cx"> 		.keycode = BTN_1,
</span><span class="lines"> <at>  <at>  -1450,7 +1452,7  <at>  <at> 
</span><span class="cx"> static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
</span><span class="cx"> #if defined(CONFIG_INPUT_EVAL_AD7142EB)
</span><span class="cx"> 	{
</span>-		I2C_BOARD_INFO("ad714x_captouch", 0x2C),
+		I2C_BOARD_INFO("ad7142_captouch", 0x2C),
<span class="cx"> 		.irq = IRQ_PG5,
</span><span class="cx"> 		.platform_data = (void *)&amp;ad7142_platfrom_data,
</span><span class="cx"> 	},
</span></span>
</div>
<a></a>
<div class="modfile">
<h4>Modified: trunk/drivers/input/misc/Kconfig (7259 =&gt; 7260)</h4>
<span>
<span class="info">--- trunk/drivers/input/misc/Kconfig	2009-09-02 08:14:05 UTC (rev 7259)
+++ trunk/drivers/input/misc/Kconfig	2009-09-02 21:47:05 UTC (rev 7260)
</span><span class="lines"> <at>  <at>  -259,47 +259,19  <at>  <at> 
</span><span class="cx"> 	  To compile this driver as a module, choose M here: the
</span><span class="cx"> 	  module will be called ad714X.
</span><span class="cx"> 
</span>-choice
-	prompt "AD714X Communication Method"
-	depends on INPUT_AD714X
-	default INPUT_AD714X_I2C if I2C
-	default INPUT_AD714X_SPI if (!I2C) &amp;&amp; SPI_MASTER
-
-config INPUT_AD714X_I2C
-	bool "I2C Interface"
-	depends on I2C
-	help
-	  Select this if you have a Capacitance Touch Sensor using the
-	  AD714X controller, and your board-specific initialization
-	  code includes that in its table of I2C devices.
-
-config INPUT_AD714X_SPI
-	bool "SPI Interface"
-	depends on SPI_MASTER
-	help
-	  Select this if you have a Capacitance Touch Sensor using the
-	  AD714X controller, and your board-specific initialization
-	  code includes that in its table of SPI devices.
-endchoice
-
-choice
-	prompt "Select a AD7142/AD7147 board you are connecting"
-	depends on INPUT_AD714X
-
<span class="cx"> config INPUT_EVAL_AD7147EBZ
</span><span class="cx"> 	bool "ADI EVAL-AD7147EBZ board"
</span>-	depends on INPUT_AD714X_SPI
+	depends on INPUT_AD714X &amp;&amp; SPI
<span class="cx"> 	help
</span><span class="cx"> 	  Select this if you are using ADI EVAL-AD7147EBZ board, there are
</span><span class="cx"> 	  five buttons and one slider on this board.
</span><span class="cx"> 
</span><span class="cx"> config INPUT_EVAL_AD7142EB
</span><span class="cx"> 	bool "ADI EVAL-AD7142EB board"
</span>-	depends on INPUT_AD714X_I2C
+	depends on INPUT_AD714X &amp;&amp; I2C
<span class="cx"> 	help
</span><span class="cx"> 	  Select this if you are using ADI EVAL-AD7142EB board, there are
</span><span class="cx"> 	  four buttons and two sliders on this board.
</span>-endchoice
<span class="cx"> 
</span><span class="cx"> config INPUT_ADXL34X
</span><span class="cx"> 	tristate "ADXL345/346 Three-Axis Digital Accelerometer"
</span></span>
</div>
<a></a>
<div class="modfile">
<h4>Modified: trunk/drivers/input/misc/ad714x.c (7259 =&gt; 7260)</h4>
<span>
<span class="info">--- trunk/drivers/input/misc/ad714x.c	2009-09-02 08:14:05 UTC (rev 7259)
+++ trunk/drivers/input/misc/ad714x.c	2009-09-02 21:47:05 UTC (rev 7260)
</span><span class="lines"> <at>  <at>  -5,28 +5,26  <at>  <at> 
</span><span class="cx">  *
</span><span class="cx">  * Licensed under the GPL-2 or later.
</span><span class="cx">  */
</span>-
+#define pr_fmt(fmt) "ad714x: " fmt
<span class="cx"> #include &lt;linux/device.h&gt;
</span><span class="cx"> #include &lt;linux/init.h&gt;
</span><span class="cx"> #include &lt;linux/spi/spi.h&gt;
</span><span class="cx"> #include &lt;linux/i2c.h&gt;
</span><span class="cx"> #include &lt;linux/input.h&gt;
</span><span class="cx"> #include &lt;linux/interrupt.h&gt;
</span>-#include &lt;linux/spi/ad714x.h&gt;
+#include &lt;linux/input/ad714x.h&gt;
<span class="cx"> 
</span>-#define AD714x_SPI_ADDR        0x1C
-#define AD714x_SPI_ADDR_SHFT   11
-#define AD714x_SPI_READ        1
-#define AD714x_SPI_READ_SHFT   10
+#define AD714x_SPI_CMD_PREFIX      0xE000   /* bits 15:11 */
+#define AD714x_SPI_READ            BIT(10)
<span class="cx"> 
</span><span class="cx"> #define AD714X_PWR_CTRL           0x0
</span>-#define AD714x_STG_CAL_EN_REG     0x1
+#define AD714X_STG_CAL_EN_REG     0x1
<span class="cx"> #define AD714X_AMB_COMP_CTRL0_REG 0x2
</span>-#define AD714x_PARTID_REG         0x17
+#define AD714X_PARTID_REG         0x17
<span class="cx"> #define AD7147_PARTID             0x1470
</span><span class="cx"> #define AD7142_PARTID             0xE620
</span>-#define AD714x_STAGECFG_REG       0x80
-#define AD714x_SYSCFG_REG         0x0
+#define AD714X_STAGECFG_REG       0x80
+#define AD714X_SYSCFG_REG         0x0
<span class="cx"> 
</span><span class="cx"> #define STG_LOW_INT_EN_REG     0x5
</span><span class="cx"> #define STG_HIGH_INT_EN_REG    0x6
</span><span class="lines"> <at>  <at>  -66,14 +64,6  <at>  <at> 
</span><span class="cx"> #define STAGE_CFGREG_NUM       8
</span><span class="cx"> #define SYS_CFGREG_NUM         8
</span><span class="cx"> 
</span>-#if defined(CONFIG_INPUT_AD714X_SPI)
-#define bus_device		struct spi_device
-#elif defined(CONFIG_INPUT_AD714X_I2C)
-#define bus_device		struct i2c_client
-#else
-#error Communication method needs to be selected (I2C or SPI)
-#endif
-
<span class="cx"> /*
</span><span class="cx">  * driver information which will be used to maintain the software flow
</span><span class="cx">  */
</span><span class="lines"> <at>  <at>  -124,7 +114,8  <at>  <at> 
</span><span class="cx"> struct ad714x_button_drv {
</span><span class="cx"> 	ad714x_device_state state;
</span><span class="cx"> 	/* Unlike slider/wheel/touchpad, all buttons point to
</span>-	 * same input_dev instance */
+	 * same input_dev instance
+	 */
<span class="cx"> 	struct input_dev *input;
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines"> <at>  <at>  -136,7 +127,8  <at>  <at> 
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> /* information to integrate all things which will be private data
</span>- * of spi/i2c device */
+ * of spi/i2c device
+ */
<span class="cx"> struct ad714x_chip {
</span><span class="cx"> 	unsigned short h_state;
</span><span class="cx"> 	unsigned short l_state;
</span><span class="lines"> <at>  <at>  -148,14 +140,18  <at>  <at> 
</span><span class="cx"> 	struct ad714x_platform_data *hw;
</span><span class="cx"> 	struct ad714x_driver_data *sw;
</span><span class="cx"> 
</span>-	bus_device *bus;
-	int (*read) (bus_device *, unsigned short, unsigned short *);
-	int (*write) (bus_device *, unsigned short, unsigned short);
+	int irq;
+	struct device *dev;
+	int (*read) (struct device *, unsigned short, unsigned short *);
+	int (*write) (struct device *, unsigned short, unsigned short);
<span class="cx"> 
</span><span class="cx"> 	struct mutex mutex;
</span>+
+	unsigned product;
+	unsigned version;
<span class="cx"> };
</span><span class="cx"> 
</span>-static void stage_use_com_int(struct ad714x_chip *ad714x, int start_stage,
+static void ad714x_use_com_int(struct ad714x_chip *ad714x, int start_stage,
<span class="cx"> 		int end_stage)
</span><span class="cx"> {
</span><span class="cx"> 	unsigned short data;
</span><span class="lines"> <at>  <at>  -163,16 +159,16  <at>  <at> 
</span><span class="cx"> 
</span><span class="cx"> 	mask = ((1 &lt;&lt; (end_stage + 1)) - 1) - (1 &lt;&lt; start_stage);
</span><span class="cx"> 
</span>-	ad714x-&gt;read(ad714x-&gt;bus, STG_COM_INT_EN_REG, &amp;data);
+	ad714x-&gt;read(ad714x-&gt;dev, STG_COM_INT_EN_REG, &amp;data);
<span class="cx"> 	data |= 1 &lt;&lt; start_stage;
</span>-	ad714x-&gt;write(ad714x-&gt;bus, STG_COM_INT_EN_REG, data);
+	ad714x-&gt;write(ad714x-&gt;dev, STG_COM_INT_EN_REG, data);
<span class="cx"> 
</span>-	ad714x-&gt;read(ad714x-&gt;bus, STG_HIGH_INT_EN_REG, &amp;data);
+	ad714x-&gt;read(ad714x-&gt;dev, STG_HIGH_INT_EN_REG, &amp;data);
<span class="cx"> 	data &amp;= ~mask;
</span>-	ad714x-&gt;write(ad714x-&gt;bus, STG_HIGH_INT_EN_REG, data);
+	ad714x-&gt;write(ad714x-&gt;dev, STG_HIGH_INT_EN_REG, data);
<span class="cx"> }
</span><span class="cx"> 
</span>-static void stage_use_thr_int(struct ad714x_chip *ad714x, int start_stage,
+static void ad714x_use_thr_int(struct ad714x_chip *ad714x, int start_stage,
<span class="cx"> 		int end_stage)
</span><span class="cx"> {
</span><span class="cx"> 	unsigned short data;
</span><span class="lines"> <at>  <at>  -180,16 +176,16  <at>  <at> 
</span><span class="cx"> 
</span><span class="cx"> 	mask = ((1 &lt;&lt; (end_stage + 1)) - 1) - (1 &lt;&lt; start_stage);
</span><span class="cx"> 
</span>-	ad714x-&gt;read(ad714x-&gt;bus, STG_COM_INT_EN_REG, &amp;data);
+	ad714x-&gt;read(ad714x-&gt;dev, STG_COM_INT_EN_REG, &amp;data);
<span class="cx"> 	data &amp;= ~(1 &lt;&lt; start_stage);
</span>-	ad714x-&gt;write(ad714x-&gt;bus, STG_COM_INT_EN_REG, data);
+	ad714x-&gt;write(ad714x-&gt;dev, STG_COM_INT_EN_REG, data);
<span class="cx"> 
</span>-	ad714x-&gt;read(ad714x-&gt;bus, STG_HIGH_INT_EN_REG, &amp;data);
+	ad714x-&gt;read(ad714x-&gt;dev, STG_HIGH_INT_EN_REG, &amp;data);
<span class="cx"> 	data |= mask;
</span>-	ad714x-&gt;write(ad714x-&gt;bus, STG_HIGH_INT_EN_REG, data);
+	ad714x-&gt;write(ad714x-&gt;dev, STG_HIGH_INT_EN_REG, data);
<span class="cx"> }
</span><span class="cx"> 
</span>-static int stage_cal_highest_stage(struct ad714x_chip *ad714x, int start_stage,
+static int ad714x_cal_highest_stage(struct ad714x_chip *ad714x, int start_stage,
<span class="cx"> 		int end_stage)
</span><span class="cx"> {
</span><span class="cx"> 	int max_res = 0;
</span><span class="lines"> <at>  <at>  -206,7 +202,7  <at>  <at> 
</span><span class="cx"> 	return max_idx;
</span><span class="cx"> }
</span><span class="cx"> 
</span>-static int stage_cal_abs_pos(struct ad714x_chip *ad714x, int start_stage,
+static int ad714x_cal_abs_pos(struct ad714x_chip *ad714x, int start_stage,
<span class="cx"> 		int end_stage, int highest_stage, int max_coord)
</span><span class="cx"> {
</span><span class="cx"> 	int a_param, b_param;
</span><span class="lines"> <at>  <at>  -238,10 +234,10  <at>  <at> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span>-/* One button can connect to multi postive and negative of CDCs
- * Multi-buttons can connect to same postive/negative of one CDC
+/* One button can connect to multi positive and negative of CDCs
+ * Multi-buttons can connect to same positive/negative of one CDC
<span class="cx">  */
</span>-static void button_state_machine(struct ad714x_chip *ad714x, int idx)
+static void ad714x_button_state_machine(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> 	struct ad714x_button_plat *hw = &amp;ad714x-&gt;hw-&gt;button[idx];
</span><span class="cx"> 	struct ad714x_button_drv *sw = &amp;ad714x-&gt;sw-&gt;button[idx];
</span><span class="lines"> <at>  <at>  -250,7 +246,7  <at>  <at> 
</span><span class="cx"> 	case IDLE:
</span><span class="cx"> 		if (((ad714x-&gt;h_state &amp; hw-&gt;h_mask) == hw-&gt;h_mask) &amp;&amp;
</span><span class="cx"> 			((ad714x-&gt;l_state &amp; hw-&gt;l_mask) == hw-&gt;l_mask)) {
</span>-			pr_debug("button %d touched\n", idx);
+			dev_dbg(ad714x-&gt;dev, "button %d touched\n", idx);
<span class="cx"> 			input_report_key(sw-&gt;input, hw-&gt;keycode, 1);
</span><span class="cx"> 			input_sync(sw-&gt;input);
</span><span class="cx"> 			sw-&gt;state = ACTIVE;
</span><span class="lines"> <at>  <at>  -259,7 +255,7  <at>  <at> 
</span><span class="cx"> 	case ACTIVE:
</span><span class="cx"> 		if (((ad714x-&gt;h_state &amp; hw-&gt;h_mask) != hw-&gt;h_mask) ||
</span><span class="cx"> 			((ad714x-&gt;l_state &amp; hw-&gt;l_mask) != hw-&gt;l_mask)) {
</span>-			pr_debug("button %d released\n", idx);
+			dev_dbg(ad714x-&gt;dev, "button %d released\n", idx);
<span class="cx"> 			input_report_key(sw-&gt;input, hw-&gt;keycode, 0);
</span><span class="cx"> 			input_sync(sw-&gt;input);
</span><span class="cx"> 			sw-&gt;state = IDLE;
</span><span class="lines"> <at>  <at>  -273,15 +269,15  <at>  <at> 
</span><span class="cx"> /* The response of a sensor is defined by the absolute number of codes
</span><span class="cx">  * between the current CDC value and the ambient value.
</span><span class="cx">  */
</span>-void slider_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
+void ad714x_slider_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> 	struct ad714x_slider_plat *hw = &amp;ad714x-&gt;hw-&gt;slider[idx];
</span><span class="cx"> 	int i;
</span><span class="cx"> 
</span><span class="cx"> 	for (i = hw-&gt;start_stage; i &lt;= hw-&gt;end_stage; i++) {
</span>-		ad714x-&gt;read(ad714x-&gt;bus, CDC_RESULT_S0 + i,
+		ad714x-&gt;read(ad714x-&gt;dev, CDC_RESULT_S0 + i,
<span class="cx"> 			&amp;ad714x-&gt;adc_reg[i]);
</span>-		ad714x-&gt;read(ad714x-&gt;bus,
+		ad714x-&gt;read(ad714x-&gt;dev,
<span class="cx"> 				STAGE0_AMBIENT + i * PER_STAGE_REG_NUM,
</span><span class="cx"> 				&amp;ad714x-&gt;amb_reg[i]);
</span><span class="cx"> 
</span><span class="lines"> <at>  <at>  -290,15 +286,16  <at>  <at> 
</span><span class="cx"> 	}
</span><span class="cx"> }
</span><span class="cx"> 
</span>-void slider_cal_highest_stage(struct ad714x_chip *ad714x, int idx)
+void ad714x_slider_cal_highest_stage(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> 	struct ad714x_slider_plat *hw = &amp;ad714x-&gt;hw-&gt;slider[idx];
</span><span class="cx"> 	struct ad714x_slider_drv *sw = &amp;ad714x-&gt;sw-&gt;slider[idx];
</span><span class="cx"> 
</span>-	sw-&gt;highest_stage = stage_cal_highest_stage(ad714x, hw-&gt;start_stage,
+	sw-&gt;highest_stage = ad714x_cal_highest_stage(ad714x, hw-&gt;start_stage,
<span class="cx"> 			hw-&gt;end_stage);
</span><span class="cx"> 
</span>-	pr_debug("slider %d highest_stage:%d\n", idx, sw-&gt;highest_stage);
+	dev_dbg(ad714x-&gt;dev, "slider %d highest_stage:%d\n", idx,
+		sw-&gt;highest_stage);
<span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /* The formulae are very straight forward. It uses the sensor with the
</span><span class="lines"> <at>  <at>  -313,15 +310,16  <at>  <at> 
</span><span class="cx">  *         w += Sensor response(i)
</span><span class="cx">  * POS=(Number_of_Positions_Wanted/(Number_of_Sensors_Used-1)) *(v/w)
</span><span class="cx">  */
</span>-void slider_cal_abs_pos(struct ad714x_chip *ad714x, int idx)
+void ad714x_slider_cal_abs_pos(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> 	struct ad714x_slider_plat *hw = &amp;ad714x-&gt;hw-&gt;slider[idx];
</span><span class="cx"> 	struct ad714x_slider_drv *sw = &amp;ad714x-&gt;sw-&gt;slider[idx];
</span><span class="cx"> 
</span>-	sw-&gt;abs_pos = stage_cal_abs_pos(ad714x, hw-&gt;start_stage, hw-&gt;end_stage,
+	sw-&gt;abs_pos = ad714x_cal_abs_pos(ad714x, hw-&gt;start_stage, hw-&gt;end_stage,
<span class="cx"> 		sw-&gt;highest_stage, hw-&gt;max_coord);
</span><span class="cx"> 
</span>-	pr_debug("slider %d absolute position:%d\n", idx, sw-&gt;abs_pos);
+	dev_dbg(ad714x-&gt;dev, "slider %d absolute position:%d\n", idx,
+		sw-&gt;abs_pos);
<span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /*
</span><span class="lines"> <at>  <at>  -334,29 +332,30  <at>  <at> 
</span><span class="cx">  * Filtered_CDC_result = (Filtered_CDC_result * (10 - Coefficient) +
</span><span class="cx">  * 				Latest_CDC_result * Coefficient)/10
</span><span class="cx">  */
</span>-void slider_cal_flt_pos(struct ad714x_chip *ad714x, int idx)
+void ad714x_slider_cal_flt_pos(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> 	struct ad714x_slider_drv *sw = &amp;ad714x-&gt;sw-&gt;slider[idx];
</span><span class="cx"> 
</span><span class="cx"> 	sw-&gt;flt_pos = (sw-&gt;flt_pos * (10 - 4) +
</span><span class="cx"> 			sw-&gt;abs_pos * 4)/10;
</span><span class="cx"> 
</span>-	pr_debug("slider %d filter position:%d\n", idx, sw-&gt;flt_pos);
+	dev_dbg(ad714x-&gt;dev, "slider %d filter position:%d\n", idx,
+		sw-&gt;flt_pos);
<span class="cx"> }
</span><span class="cx"> 
</span>-static void slider_use_com_int(struct ad714x_chip *ad714x, int idx)
+static void ad714x_slider_use_com_int(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> 	struct ad714x_slider_plat *hw = &amp;ad714x-&gt;hw-&gt;slider[idx];
</span>-	stage_use_com_int(ad714x, hw-&gt;start_stage, hw-&gt;end_stage);
+	ad714x_use_com_int(ad714x, hw-&gt;start_stage, hw-&gt;end_stage);
<span class="cx"> }
</span><span class="cx"> 
</span>-static void slider_use_thr_int(struct ad714x_chip *ad714x, int idx)
+static void ad714x_slider_use_thr_int(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> 	struct ad714x_slider_plat *hw = &amp;ad714x-&gt;hw-&gt;slider[idx];
</span>-	stage_use_thr_int(ad714x, hw-&gt;start_stage, hw-&gt;end_stage);
+	ad714x_use_thr_int(ad714x, hw-&gt;start_stage, hw-&gt;end_stage);
<span class="cx"> }
</span><span class="cx"> 
</span>-static void slider_state_machine(struct ad714x_chip *ad714x, int idx)
+static void ad714x_slider_state_machine(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> 	struct ad714x_slider_plat *hw = &amp;ad714x-&gt;hw-&gt;slider[idx];
</span><span class="cx"> 	struct ad714x_slider_drv *sw = &amp;ad714x-&gt;sw-&gt;slider[idx];
</span><span class="lines"> <at>  <at>  -372,18 +371,18  <at>  <at> 
</span><span class="cx"> 	case IDLE:
</span><span class="cx"> 		if (h_state) {
</span><span class="cx"> 			sw-&gt;state = JITTER;
</span>-			/* In End of Conversion interrupt mode, the AD714x
+			/* In End of Conversion interrupt mode, the AD714X
<span class="cx"> 			 * continuously generates hardware interrupts.
</span><span class="cx"> 			 */
</span>-			slider_use_com_int(ad714x, idx);
-			pr_debug("slider %d touched\n", idx);
+			ad714x_slider_use_com_int(ad714x, idx);
+			dev_dbg(ad714x-&gt;dev, "slider %d touched\n", idx);
<span class="cx"> 		}
</span><span class="cx"> 		break;
</span><span class="cx"> 	case JITTER:
</span><span class="cx"> 		if (c_state == mask) {
</span>-			slider_cal_sensor_val(ad714x, idx);
-			slider_cal_highest_stage(ad714x, idx);
-			slider_cal_abs_pos(ad714x, idx);
+			ad714x_slider_cal_sensor_val(ad714x, idx);
+			ad714x_slider_cal_highest_stage(ad714x, idx);
+			ad714x_slider_cal_abs_pos(ad714x, idx);
<span class="cx"> 			sw-&gt;flt_pos = sw-&gt;abs_pos;
</span><span class="cx"> 			sw-&gt;state = ACTIVE;
</span><span class="cx"> 		}
</span><span class="lines"> <at>  <at>  -391,10 +390,10  <at>  <at> 
</span><span class="cx"> 	case ACTIVE:
</span><span class="cx"> 		if (c_state == mask) {
</span><span class="cx"> 			if (h_state) {
</span>-				slider_cal_sensor_val(ad714x, idx);
-				slider_cal_highest_stage(ad714x, idx);
-				slider_cal_abs_pos(ad714x, idx);
-				slider_cal_flt_pos(ad714x, idx);
+				ad714x_slider_cal_sensor_val(ad714x, idx);
+				ad714x_slider_cal_highest_stage(ad714x, idx);
+				ad714x_slider_cal_abs_pos(ad714x, idx);
+				ad714x_slider_cal_flt_pos(ad714x, idx);
<span class="cx"> 
</span><span class="cx"> 				input_report_abs(sw-&gt;input, ABS_X, sw-&gt;flt_pos);
</span><span class="cx"> 				input_report_abs(sw-&gt;input, ABS_PRESSURE, 1);
</span><span class="lines"> <at>  <at>  -402,10 +401,11  <at>  <at> 
</span><span class="cx"> 				/* When the user lifts off the sensor, configure
</span><span class="cx"> 				 * the AD714X back to threshold interrupt mode.
</span><span class="cx"> 				 */
</span>-				slider_use_thr_int(ad714x, idx);
+				ad714x_slider_use_thr_int(ad714x, idx);
<span class="cx"> 				sw-&gt;state = IDLE;
</span><span class="cx"> 				input_report_abs(sw-&gt;input, ABS_PRESSURE, 0);
</span>-				pr_debug("slider %d released\n", idx);
+				dev_dbg(ad714x-&gt;dev, "slider %d released\n",
+					idx);
<span class="cx"> 			}
</span><span class="cx"> 			input_sync(sw-&gt;input);
</span><span class="cx"> 		}
</span><span class="lines"> <at>  <at>  -421,27 +421,28  <at>  <at> 
</span><span class="cx">  * the scrollwheel. Then we determined the 2 sensors on either sides of the
</span><span class="cx">  * sensor with the highest response and we apply weights to these sensors.
</span><span class="cx">  */
</span>-void wheel_cal_highest_stage(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_cal_highest_stage(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> 	struct ad714x_wheel_plat *hw = &amp;ad714x-&gt;hw-&gt;wheel[idx];
</span><span class="cx"> 	struct ad714x_wheel_drv *sw = &amp;ad714x-&gt;sw-&gt;wheel[idx];
</span><span class="cx"> 
</span><span class="cx"> 	sw-&gt;pre_highest_stage = sw-&gt;highest_stage;
</span>-	sw-&gt;highest_stage = stage_cal_highest_stage(ad714x, hw-&gt;start_stage,
+	sw-&gt;highest_stage = ad714x_cal_highest_stage(ad714x, hw-&gt;start_stage,
<span class="cx"> 			hw-&gt;end_stage);
</span><span class="cx"> 
</span>-	pr_debug("wheel %d highest_stage:%d\n", idx, sw-&gt;highest_stage);
+	dev_dbg(ad714x-&gt;dev, "wheel %d highest_stage:%d\n", idx,
+		sw-&gt;highest_stage);
<span class="cx"> }
</span><span class="cx"> 
</span>-void wheel_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> 	struct ad714x_wheel_plat *hw = &amp;ad714x-&gt;hw-&gt;wheel[idx];
</span><span class="cx"> 	int i;
</span><span class="cx"> 
</span><span class="cx"> 	for (i = hw-&gt;start_stage; i &lt;= hw-&gt;end_stage; i++) {
</span>-		ad714x-&gt;read(ad714x-&gt;bus, CDC_RESULT_S0 + i,
+		ad714x-&gt;read(ad714x-&gt;dev, CDC_RESULT_S0 + i,
<span class="cx"> 			&amp;ad714x-&gt;adc_reg[i]);
</span>-		ad714x-&gt;read(ad714x-&gt;bus,
+		ad714x-&gt;read(ad714x-&gt;dev,
<span class="cx"> 				STAGE0_AMBIENT + i * PER_STAGE_REG_NUM,
</span><span class="cx"> 				&amp;ad714x-&gt;amb_reg[i]);
</span><span class="cx"> 		if (ad714x-&gt;adc_reg[i] &gt; ad714x-&gt;amb_reg[i])
</span><span class="lines"> <at>  <at>  -470,7 +471,7  <at>  <at> 
</span><span class="cx"> #define WEIGHT_FACTOR 30
</span><span class="cx"> /* This constant prevents the "PositionOffset" from reaching a big value */
</span><span class="cx"> #define OFFSET_POSITION_CLAMP	120
</span>-void wheel_cal_abs_pos(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_cal_abs_pos(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> 	struct ad714x_wheel_plat *hw = &amp;ad714x-&gt;hw-&gt;wheel[idx];
</span><span class="cx"> 	struct ad714x_wheel_drv *sw = &amp;ad714x-&gt;sw-&gt;wheel[idx];
</span><span class="lines"> <at>  <at>  -554,7 +555,7  <at>  <at> 
</span><span class="cx"> 		sw-&gt;abs_pos = hw-&gt;max_coord;
</span><span class="cx"> }
</span><span class="cx"> 
</span>-void wheel_cal_flt_pos(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_cal_flt_pos(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> 	struct ad714x_wheel_plat *hw = &amp;ad714x-&gt;hw-&gt;wheel[idx];
</span><span class="cx"> 	struct ad714x_wheel_drv *sw = &amp;ad714x-&gt;sw-&gt;wheel[idx];
</span><span class="lines"> <at>  <at>  -570,19 +571,19  <at>  <at> 
</span><span class="cx"> 		sw-&gt;flt_pos = hw-&gt;max_coord;
</span><span class="cx"> }
</span><span class="cx"> 
</span>-static void wheel_use_com_int(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_use_com_int(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> 	struct ad714x_wheel_plat *hw = &amp;ad714x-&gt;hw-&gt;wheel[idx];
</span>-	stage_use_com_int(ad714x, hw-&gt;start_stage, hw-&gt;end_stage);
+	ad714x_use_com_int(ad714x, hw-&gt;start_stage, hw-&gt;end_stage);
<span class="cx"> }
</span><span class="cx"> 
</span>-static void wheel_use_thr_int(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_use_thr_int(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> 	struct ad714x_wheel_plat *hw = &amp;ad714x-&gt;hw-&gt;wheel[idx];
</span>-	stage_use_thr_int(ad714x, hw-&gt;start_stage, hw-&gt;end_stage);
+	ad714x_use_thr_int(ad714x, hw-&gt;start_stage, hw-&gt;end_stage);
<span class="cx"> }
</span><span class="cx"> 
</span>-static void wheel_state_machine(struct ad714x_chip *ad714x, int idx)
+static void ad714x_wheel_state_machine(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> 	struct ad714x_wheel_plat *hw = &amp;ad714x-&gt;hw-&gt;wheel[idx];
</span><span class="cx"> 	struct ad714x_wheel_drv *sw = &amp;ad714x-&gt;sw-&gt;wheel[idx];
</span><span class="lines"> <at>  <at>  -598,18 +599,18  <at>  <at> 
</span><span class="cx"> 	case IDLE:
</span><span class="cx"> 		if (h_state) {
</span><span class="cx"> 			sw-&gt;state = JITTER;
</span>-			/* In End of Conversion interrupt mode, the AD714x
+			/* In End of Conversion interrupt mode, the AD714X
<span class="cx"> 			 * continuously generates hardware interrupts.
</span><span class="cx"> 			 */
</span>-			wheel_use_com_int(ad714x, idx);
-			pr_debug("wheel %d touched\n", idx);
+			ad714x_wheel_use_com_int(ad714x, idx);
+			dev_dbg(ad714x-&gt;dev, "wheel %d touched\n", idx);
<span class="cx"> 		}
</span><span class="cx"> 		break;
</span><span class="cx"> 	case JITTER:
</span><span class="cx"> 		if (c_state == mask)	{
</span>-			wheel_cal_sensor_val(ad714x, idx);
-			wheel_cal_highest_stage(ad714x, idx);
-			wheel_cal_abs_pos(ad714x, idx);
+			ad714x_wheel_cal_sensor_val(ad714x, idx);
+			ad714x_wheel_cal_highest_stage(ad714x, idx);
+			ad714x_wheel_cal_abs_pos(ad714x, idx);
<span class="cx"> 			sw-&gt;flt_pos = sw-&gt;abs_pos;
</span><span class="cx"> 			sw-&gt;state = ACTIVE;
</span><span class="cx"> 		}
</span><span class="lines"> <at>  <at>  -617,9 +618,10  <at>  <at> 
</span><span class="cx"> 	case ACTIVE:
</span><span class="cx"> 		if (c_state == mask) {
</span><span class="cx"> 			if (h_state) {
</span>-				wheel_cal_sensor_val(ad714x, idx);
-				wheel_cal_highest_stage(ad714x, idx);
-				wheel_cal_abs_pos(ad714x, idx);
+				ad714x_wheel_cal_sensor_val(ad714x, idx);
+				ad714x_wheel_cal_highest_stage(ad714x, idx);
+				ad714x_wheel_cal_abs_pos(ad714x, idx);
+				ad714x_wheel_cal_flt_pos(ad714x, idx);
<span class="cx"> 
</span><span class="cx"> 				input_report_abs(sw-&gt;input, ABS_WHEEL,
</span><span class="cx"> 					sw-&gt;abs_pos);
</span><span class="lines"> <at>  <at>  -628,11 +630,12  <at>  <at> 
</span><span class="cx"> 				/* When the user lifts off the sensor, configure
</span><span class="cx"> 				 * the AD714X back to threshold interrupt mode.
</span><span class="cx"> 				 */
</span>-				wheel_use_thr_int(ad714x, idx);
+				ad714x_wheel_use_thr_int(ad714x, idx);
<span class="cx"> 				sw-&gt;state = IDLE;
</span><span class="cx"> 				input_report_abs(sw-&gt;input, ABS_PRESSURE, 0);
</span><span class="cx"> 
</span>-				pr_debug("wheel %d released\n", idx);
+				dev_dbg(ad714x-&gt;dev, "wheel %d released\n",
+					idx);
<span class="cx"> 			}
</span><span class="cx"> 			input_sync(sw-&gt;input);
</span><span class="cx"> 		}
</span><span class="lines"> <at>  <at>  -642,15 +645,15  <at>  <at> 
</span><span class="cx"> 	}
</span><span class="cx"> }
</span><span class="cx"> 
</span>-void touchpad_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
+static void touchpad_cal_sensor_val(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> 	struct ad714x_touchpad_plat *hw = &amp;ad714x-&gt;hw-&gt;touchpad[idx];
</span><span class="cx"> 	int i;
</span><span class="cx"> 
</span><span class="cx"> 	for (i = hw-&gt;x_start_stage; i &lt;= hw-&gt;x_end_stage; i++) {
</span>-		ad714x-&gt;read(ad714x-&gt;bus, CDC_RESULT_S0 + i,
+		ad714x-&gt;read(ad714x-&gt;dev, CDC_RESULT_S0 + i,
<span class="cx"> 				&amp;ad714x-&gt;adc_reg[i]);
</span>-		ad714x-&gt;read(ad714x-&gt;bus,
+		ad714x-&gt;read(ad714x-&gt;dev,
<span class="cx"> 				STAGE0_AMBIENT + i * PER_STAGE_REG_NUM,
</span><span class="cx"> 				&amp;ad714x-&gt;amb_reg[i]);
</span><span class="cx"> 		if (ad714x-&gt;adc_reg[i] &gt; ad714x-&gt;amb_reg[i])
</span><span class="lines"> <at>  <at>  -666,13 +669,14  <at>  <at> 
</span><span class="cx"> 	struct ad714x_touchpad_plat *hw = &amp;ad714x-&gt;hw-&gt;touchpad[idx];
</span><span class="cx"> 	struct ad714x_touchpad_drv *sw = &amp;ad714x-&gt;sw-&gt;touchpad[idx];
</span><span class="cx"> 
</span>-	sw-&gt;x_highest_stage = stage_cal_highest_stage(ad714x, hw-&gt;x_start_stage,
-			hw-&gt;x_end_stage);
-	sw-&gt;y_highest_stage = stage_cal_highest_stage(ad714x, hw-&gt;y_start_stage,
-			hw-&gt;y_end_stage);
+	sw-&gt;x_highest_stage = ad714x_cal_highest_stage(ad714x,
+		hw-&gt;x_start_stage, hw-&gt;x_end_stage);
+	sw-&gt;y_highest_stage = ad714x_cal_highest_stage(ad714x,
+		hw-&gt;y_start_stage, hw-&gt;y_end_stage);
<span class="cx"> 
</span>-	pr_debug("touchpad %d x_highest_stage:%d, y_highest_stage:%d\n",
-			idx, sw-&gt;x_highest_stage, sw-&gt;y_highest_stage);
+	dev_dbg(ad714x-&gt;dev,
+		"touchpad %d x_highest_stage:%d, y_highest_stage:%d\n",
+		idx, sw-&gt;x_highest_stage, sw-&gt;y_highest_stage);
<span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /* If 2 fingers are touching the sensor then 2 peaks can be observed in the
</span><span class="lines"> <at>  <at>  -723,12 +727,12  <at>  <at> 
</span><span class="cx"> 	struct ad714x_touchpad_plat *hw = &amp;ad714x-&gt;hw-&gt;touchpad[idx];
</span><span class="cx"> 	struct ad714x_touchpad_drv *sw = &amp;ad714x-&gt;sw-&gt;touchpad[idx];
</span><span class="cx"> 
</span>-	sw-&gt;x_abs_pos = stage_cal_abs_pos(ad714x, hw-&gt;x_start_stage,
+	sw-&gt;x_abs_pos = ad714x_cal_abs_pos(ad714x, hw-&gt;x_start_stage,
<span class="cx"> 			hw-&gt;x_end_stage, sw-&gt;x_highest_stage, hw-&gt;x_max_coord);
</span>-	sw-&gt;y_abs_pos = stage_cal_abs_pos(ad714x, hw-&gt;y_start_stage,
+	sw-&gt;y_abs_pos = ad714x_cal_abs_pos(ad714x, hw-&gt;y_start_stage,
<span class="cx"> 			hw-&gt;y_end_stage, sw-&gt;y_highest_stage, hw-&gt;y_max_coord);
</span><span class="cx"> 
</span>-	pr_debug("touchpad %d absolute position:(%d, %d)\n", idx,
+	dev_dbg(ad714x-&gt;dev, "touchpad %d absolute position:(%d, %d)\n", idx,
<span class="cx"> 			sw-&gt;x_abs_pos, sw-&gt;y_abs_pos);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines"> <at>  <at>  -741,7 +745,7  <at>  <at> 
</span><span class="cx"> 	sw-&gt;y_flt_pos = (sw-&gt;y_flt_pos * (10 - 4) +
</span><span class="cx"> 			sw-&gt;y_abs_pos * 4)/10;
</span><span class="cx"> 
</span>-	pr_debug("touchpad %d filter position:(%d, %d)\n",
+	dev_dbg(ad714x-&gt;dev, "touchpad %d filter position:(%d, %d)\n",
<span class="cx"> 			idx, sw-&gt;x_flt_pos, sw-&gt;y_flt_pos);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines"> <at>  <at>  -756,12 +760,12  <at>  <at> 
</span><span class="cx">  * detection independent of the pressure.
</span><span class="cx">  */
</span><span class="cx"> 
</span>-#define LEFT_END_POINT_DETECTION_LEVEL			550
-#define RIGHT_END_POINT_DETECTION_LEVEL			750
-#define LEFT_RIGHT_END_POINT_DEAVTIVALION_LEVEL		850
-#define TOP_END_POINT_DETECTION_LEVEL			550
-#define BOTTOM_END_POINT_DETECTION_LEVEL		950
-#define TOP_BOTTOM_END_POINT_DEAVTIVALION_LEVEL		700
+#define LEFT_END_POINT_DETECTION_LEVEL                  550
+#define RIGHT_END_POINT_DETECTION_LEVEL                 750
+#define LEFT_RIGHT_END_POINT_DEAVTIVALION_LEVEL         850
+#define TOP_END_POINT_DETECTION_LEVEL                   550
+#define BOTTOM_END_POINT_DETECTION_LEVEL                950
+#define TOP_BOTTOM_END_POINT_DEAVTIVALION_LEVEL         700
<span class="cx"> static int touchpad_check_endpoint(struct ad714x_chip *ad714x, int idx)
</span><span class="cx"> {
</span><span class="cx"> 	struct ad714x_touchpad_plat *hw = &amp;ad714x-&gt;hw-&gt;touchpad[idx];
</span><span class="lines"> <at>  <at>  -842,17 +846,17  <at>  <at> 
</span><span class="cx"> static void touchpad_use_com_int(struct ad714x_chip *ad714x, int idx)
</span><span class="cx"> {
</span><span class="cx"> 	struct ad714x_touchpad_plat *hw = &amp;ad714x-&gt;hw-&gt;touchpad[idx];
</span>-	stage_use_com_int(ad714x, hw-&gt;x_start_stage, hw-&gt;x_end_stage);
+	ad714x_use_com_int(ad714x, hw-&gt;x_start_stage, hw-&gt;x_end_stage);
<span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void touchpad_use_thr_int(struct ad714x_chip *ad714x, int idx)
</span><span class="cx"> {
</span><span class="cx"> 	struct ad714x_touchpad_plat *hw = &amp;ad714x-&gt;hw-&gt;touchpad[idx];
</span>-	stage_use_thr_int(ad714x, hw-&gt;x_start_stage, hw-&gt;x_end_stage);
-	stage_use_thr_int(ad714x, hw-&gt;y_start_stage, hw-&gt;y_end_stage);
+	ad714x_use_thr_int(ad714x, hw-&gt;x_start_stage, hw-&gt;x_end_stage);
+	ad714x_use_thr_int(ad714x, hw-&gt;y_start_stage, hw-&gt;y_end_stage);
<span class="cx"> }
</span><span class="cx"> 
</span>-static void touchpad_state_machine(struct ad714x_chip *ad714x, int idx)
+static void ad714x_touchpad_state_machine(struct ad714x_chip *ad714x, int idx)
<span class="cx"> {
</span><span class="cx"> 	struct ad714x_touchpad_plat *hw = &amp;ad714x-&gt;hw-&gt;touchpad[idx];
</span><span class="cx"> 	struct ad714x_touchpad_drv *sw = &amp;ad714x-&gt;sw-&gt;touchpad[idx];
</span><span class="lines"> <at>  <at>  -871,11 +875,11  <at>  <at> 
</span><span class="cx"> 	case IDLE:
</span><span class="cx"> 		if (h_state) {
</span><span class="cx"> 			sw-&gt;state = JITTER;
</span>-			/* In End of Conversion interrupt mode, the AD714x
+			/* In End of Conversion interrupt mode, the AD714X
<span class="cx"> 			 * continuously generates hardware interrupts.
</span><span class="cx"> 			 */
</span><span class="cx"> 			touchpad_use_com_int(ad714x, idx);
</span>-			pr_debug("touchpad %d touched\n", idx);
+			dev_dbg(ad714x-&gt;dev, "touchpad %d touched\n", idx);
<span class="cx"> 		}
</span><span class="cx"> 		break;
</span><span class="cx"> 	case JITTER:
</span><span class="lines"> <at>  <at>  -884,8 +888,9  <at>  <at> 
</span><span class="cx"> 			touchpad_cal_highest_stage(ad714x, idx);
</span><span class="cx"> 			if ((!touchpad_check_second_peak(ad714x, idx)) &amp;&amp;
</span><span class="cx"> 				(!touchpad_check_endpoint(ad714x, idx))) {
</span>-				pr_debug("touchpad%d, 2 fingers or endpoint\n",
-						idx);
+				dev_dbg(ad714x-&gt;dev,
+					"touchpad%d, 2 fingers or endpoint\n",
+					idx);
<span class="cx"> 				touchpad_cal_abs_pos(ad714x, idx);
</span><span class="cx"> 				sw-&gt;x_flt_pos = sw-&gt;x_abs_pos;
</span><span class="cx"> 				sw-&gt;y_flt_pos = sw-&gt;y_abs_pos;
</span><span class="lines"> <at>  <at>  -916,7 +921,8  <at>  <at> 
</span><span class="cx"> 				touchpad_use_thr_int(ad714x, idx);
</span><span class="cx"> 				sw-&gt;state = IDLE;
</span><span class="cx"> 				input_report_abs(sw-&gt;input, ABS_PRESSURE, 0);
</span>-				pr_debug("touchpad %d released\n", idx);
+				dev_dbg(ad714x-&gt;dev, "touchpad %d released\n",
+					idx);
<span class="cx"> 			}
</span><span class="cx"> 			input_sync(sw-&gt;input);
</span><span class="cx"> 		}
</span><span class="lines"> <at>  <at>  -930,24 +936,29  <at>  <at> 
</span><span class="cx"> {
</span><span class="cx"> 	unsigned short data;
</span><span class="cx"> 
</span>-	ad714x-&gt;read(ad714x-&gt;bus, AD714x_PARTID_REG, &amp;data);
+	ad714x-&gt;read(ad714x-&gt;dev, AD714X_PARTID_REG, &amp;data);
<span class="cx"> 	switch (data &amp; 0xFFF0) {
</span><span class="cx"> 	case AD7147_PARTID:
</span>-		dev_info(&amp;ad714x-&gt;bus-&gt;dev, "Found AD7147 captouch, rev:%d\n",
-				data &amp; 0xF);
+		ad714x-&gt;product = 0x7147;
+		ad714x-&gt;version = data &amp; 0xF;
+		dev_info(ad714x-&gt;dev, "Found AD7147 captouch, rev:%d\n",
+				ad714x-&gt;version);
<span class="cx"> 		return 0;
</span><span class="cx"> 	case AD7142_PARTID:
</span>-		dev_info(&amp;ad714x-&gt;bus-&gt;dev, "Found AD7142 captouch, rev:%d\n",
-				data &amp; 0xF);
+		ad714x-&gt;product = 0x7142;
+		ad714x-&gt;version = data &amp; 0xF;
+		dev_info(ad714x-&gt;dev, "Found AD7142 captouch, rev:%d\n",
+				ad714x-&gt;version);
<span class="cx"> 		return 0;
</span><span class="cx"> 	default:
</span>-		dev_err(&amp;ad714x-&gt;bus-&gt;dev, "Fail to detect AD714x captouch,\
-				read ID is %04x\n", data);
+		dev_err(ad714x-&gt;dev,
+			"Fail to detect AD714X captouch, read ID is %04x\n",
+			data);
<span class="cx"> 		return -ENODEV;
</span><span class="cx"> 	}
</span><span class="cx"> }
</span><span class="cx"> 
</span>-static int ad714x_hw_init(struct ad714x_chip *ad714x)
+static void __devinit ad714x_hw_init(struct ad714x_chip *ad714x)
<span class="cx"> {
</span><span class="cx"> 	int i, j;
</span><span class="cx"> 	unsigned short reg_base;
</span><span class="lines"> <at>  <at>  -956,24 +967,25  <at>  <at> 
</span><span class="cx"> 	/* configuration CDC and interrupts*/
</span><span class="cx"> 
</span><span class="cx"> 	for (i = 0; i &lt; STAGE_NUM; i++) {
</span>-		reg_base = AD714x_STAGECFG_REG + i * STAGE_CFGREG_NUM;
+		reg_base = AD714X_STAGECFG_REG + i * STAGE_CFGREG_NUM;
<span class="cx"> 		for (j = 0; j &lt; STAGE_CFGREG_NUM; j++)
</span>-			ad714x-&gt;write(ad714x-&gt;bus, reg_base + j,
-				ad714x-&gt;hw-&gt;stage_cfg_reg[i][j]);
+			ad714x-&gt;write(ad714x-&gt;dev, reg_base + j,
+					ad714x-&gt;hw-&gt;stage_cfg_reg[i][j]);
<span class="cx"> 	}
</span><span class="cx"> 
</span><span class="cx"> 	for (i = 0; i &lt; SYS_CFGREG_NUM; i++)
</span>-		ad714x-&gt;write(ad714x-&gt;bus, AD714x_SYSCFG_REG + i,
+		ad714x-&gt;write(ad714x-&gt;dev, AD714X_SYSCFG_REG + i,
<span class="cx"> 			ad714x-&gt;hw-&gt;sys_cfg_reg[i]);
</span>+	for (i = 0; i &lt; SYS_CFGREG_NUM; i++)
+		ad714x-&gt;read(ad714x-&gt;dev, AD714X_SYSCFG_REG + i,
+			&amp;data);
<span class="cx"> 
</span>-	ad714x-&gt;write(ad714x-&gt;bus, AD714x_STG_CAL_EN_REG, 0xFFF);
+	ad714x-&gt;write(ad714x-&gt;dev, AD714X_STG_CAL_EN_REG, 0xFFF);
<span class="cx"> 
</span><span class="cx"> 	/* clear all interrupts */
</span>-	ad714x-&gt;read(ad714x-&gt;bus, STG_LOW_INT_STA_REG, &amp;data);
-	ad714x-&gt;read(ad714x-&gt;bus, STG_HIGH_INT_STA_REG, &amp;data);
-	ad714x-&gt;read(ad714x-&gt;bus, STG_COM_INT_STA_REG, &amp;data);
-
-	return 0;
+	ad714x-&gt;read(ad714x-&gt;dev, STG_LOW_INT_STA_REG, &amp;data);
+	ad714x-&gt;read(ad714x-&gt;dev, STG_HIGH_INT_STA_REG, &amp;data);
+	ad714x-&gt;read(ad714x-&gt;dev, STG_COM_INT_STA_REG, &amp;data);
<span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static irqreturn_t ad714x_interrupt_thread(int irq, void *data)
</span><span class="lines"> <at>  <at>  -983,21 +995,18  <at>  <at> 
</span><span class="cx"> 
</span><span class="cx"> 	mutex_lock(&amp;ad714x-&gt;mutex);
</span><span class="cx"> 
</span>-	ad714x-&gt;read(ad714x-&gt;bus, STG_LOW_INT_STA_REG, &amp;ad714x-&gt;l_state);
-	ad714x-&gt;read(ad714x-&gt;bus, STG_HIGH_INT_STA_REG, &amp;ad714x-&gt;h_state);
-	ad714x-&gt;read(ad714x-&gt;bus, STG_COM_INT_STA_REG, &amp;ad714x-&gt;c_state);
+	ad714x-&gt;read(ad714x-&gt;dev, STG_LOW_INT_STA_REG, &amp;ad714x-&gt;l_state);
+	ad714x-&gt;read(ad714x-&gt;dev, STG_HIGH_INT_STA_REG, &amp;ad714x-&gt;h_state);
+	ad714x-&gt;read(ad714x-&gt;dev, STG_COM_INT_STA_REG, &amp;ad714x-&gt;c_state);
<span class="cx"> 
</span>-	pr_debug("%s l_state:%04x h_state:%04x c_stage:%04x\n", __func__,
-			ad714x-&gt;l_state, ad714x-&gt;h_state, ad714x-&gt;c_state);
-
<span class="cx"> 	for (i = 0; i &lt; ad714x-&gt;hw-&gt;button_num; i++)
</span>-		button_state_machine(ad714x, i);
+		ad714x_button_state_machine(ad714x, i);
<span class="cx"> 	for (i = 0; i &lt; ad714x-&gt;hw-&gt;slider_num; i++)
</span>-		slider_state_machine(ad714x, i);
+		ad714x_slider_state_machine(ad714x, i);
<span class="cx"> 	for (i = 0; i &lt; ad714x-&gt;hw-&gt;wheel_num; i++)
</span>-		wheel_state_machine(ad714x, i);
+		ad714x_wheel_state_machine(ad714x, i);
<span class="cx"> 	for (i = 0; i &lt; ad714x-&gt;hw-&gt;touchpad_num; i++)
</span>-		touchpad_state_machine(ad714x, i);
+		ad714x_touchpad_state_machine(ad714x, i);
<span class="cx"> 
</span><span class="cx"> 	mutex_unlock(&amp;ad714x-&gt;mutex);
</span><span class="cx"> 
</span><span class="lines"> <at>  <at>  -1010,7 +1019,7  <at>  <at> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #define MAX_DEVICE_NUM 8
</span>-static int __devinit ad714x_probe(struct ad714x_chip *ad714x)
+static int __devinit ad714x_probe(struct ad714x_chip *ad714x, u16 bus_type)
<span class="cx"> {
</span><span class="cx"> 	int ret = 0;
</span><span class="cx"> 	struct input_dev *input[MAX_DEVICE_NUM];
</span><span class="lines"> <at>  <at>  -1034,13 +1043,30  <at>  <at> 
</span><span class="cx"> 	if (ret)
</span><span class="cx"> 		goto det_err;
</span><span class="cx"> 
</span>+	/* initilize and request sw/hw resources */
+
+	ad714x_hw_init(ad714x);
+	mutex_init(&amp;ad714x-&gt;mutex);
+
+	if (ad714x-&gt;irq &gt; 0) {
+		ret = request_threaded_irq(ad714x-&gt;irq, ad714x_interrupt,
+				ad714x_interrupt_thread, IRQF_TRIGGER_FALLING,
+				"ad714x_captouch", ad714x);
+		if (ret) {
+			dev_err(ad714x-&gt;dev, "Can't allocate irq %d\n",
+					ad714x-&gt;irq);
+			goto fail_irq;
+		}
+	} else
+		dev_err(ad714x-&gt;dev, "IRQ not configured!\n");
+
<span class="cx"> 	/*
</span>-	 * Allocate and register AD714x input device
+	 * Allocate and register AD714X input device
<span class="cx"> 	 */
</span><span class="cx"> 
</span><span class="cx"> 	drv_data = kzalloc(sizeof(struct ad714x_driver_data), GFP_KERNEL);
</span><span class="cx"> 	if (!drv_data) {
</span>-		dev_err(&amp;ad714x-&gt;bus-&gt;dev,
+		dev_err(ad714x-&gt;dev,
<span class="cx"> 			"Can't allocate memory for ad714x driver info\n");
</span><span class="cx"> 		ret = -ENOMEM;
</span><span class="cx"> 		goto fail_alloc_reg;
</span><span class="lines"> <at>  <at>  -1052,7 +1078,7  <at>  <at> 
</span><span class="cx"> 		sd_drv = kzalloc(sizeof(struct ad714x_slider_drv) *
</span><span class="cx"> 				ad714x-&gt;hw-&gt;slider_num, GFP_KERNEL);
</span><span class="cx"> 		if (!sd_drv) {
</span>-			dev_err(&amp;ad714x-&gt;bus-&gt;dev,
+			dev_err(ad714x-&gt;dev,
<span class="cx"> 				"Can't allocate memory for slider info\n");
</span><span class="cx"> 			ret = -ENOMEM;
</span><span class="cx"> 			goto fail_alloc_reg;
</span><span class="lines"> <at>  <at>  -1061,7 +1087,7  <at>  <at> 
</span><span class="cx"> 		for (i = 0; i &lt; ad714x-&gt;hw-&gt;slider_num; i++) {
</span><span class="cx"> 			input[alloc_idx] = input_allocate_device();
</span><span class="cx"> 			if (!input[alloc_idx]) {
</span>-				dev_err(&amp;ad714x-&gt;bus-&gt;dev,
+				dev_err(ad714x-&gt;dev,
<span class="cx"> 				"Can't allocate input device %d\n", alloc_idx);
</span><span class="cx"> 				ret = -ENOMEM;
</span><span class="cx"> 				goto fail_alloc_reg;
</span><span class="lines"> <at>  <at>  -1076,12 +1102,14  <at>  <at> 
</span><span class="cx"> 			input_set_abs_params(input[alloc_idx-1], ABS_PRESSURE,
</span><span class="cx"> 				0, 1, 0, 0);
</span><span class="cx"> 
</span>-			input[alloc_idx-1]-&gt;id.bustype = BUS_I2C;
+			input[alloc_idx-1]-&gt;id.bustype = bus_type;
+			input[alloc_idx-1]-&gt;id.product = ad714x-&gt;product;
+			input[alloc_idx-1]-&gt;id.version = ad714x-&gt;version;
<span class="cx"> 
</span><span class="cx"> 			ret = input_register_device(input[reg_idx]);
</span><span class="cx"> 			if (ret) {
</span>-				dev_err(&amp;ad714x-&gt;bus-&gt;dev,
-				"Failed to register AD714x input device!\n");
+				dev_err(ad714x-&gt;dev,
+				"Failed to register AD714X input device!\n");
<span class="cx"> 				goto fail_alloc_reg;
</span><span class="cx"> 			}
</span><span class="cx"> 			reg_idx++;
</span><span class="lines"> <at>  <at>  -1096,7 +1124,7  <at>  <at> 
</span><span class="cx"> 		wl_drv = kzalloc(sizeof(struct ad714x_wheel_drv) *
</span><span class="cx"> 				ad714x-&gt;hw-&gt;wheel_num, GFP_KERNEL);
</span><span class="cx"> 		if (!wl_drv) {
</span>-			dev_err(&amp;ad714x-&gt;bus-&gt;dev,
+			dev_err(ad714x-&gt;dev,
<span class="cx"> 				"Can't allocate memory for wheel info\n");
</span><span class="cx"> 			ret = -ENOMEM;
</span><span class="cx"> 			goto fail_alloc_reg;
</span><span class="lines"> <at>  <at>  -1105,7 +1133,7  <at>  <at> 
</span><span class="cx"> 		for (i = 0; i &lt; ad714x-&gt;hw-&gt;wheel_num; i++) {
</span><span class="cx"> 			input[alloc_idx] = input_allocate_device();
</span><span class="cx"> 			if (!input[alloc_idx]) {
</span>-				dev_err(&amp;ad714x-&gt;bus-&gt;dev,
+				dev_err(ad714x-&gt;dev,
<span class="cx"> 				"Can't allocate input device %d\n", alloc_idx);
</span><span class="cx"> 				ret = -ENOMEM;
</span><span class="cx"> 				goto fail_alloc_reg;
</span><span class="lines"> <at>  <at>  -1120,12 +1148,14  <at>  <at> 
</span><span class="cx"> 			input_set_abs_params(input[alloc_idx-1], ABS_PRESSURE,
</span><span class="cx"> 				0, 1, 0, 0);
</span><span class="cx"> 
</span>-			input[alloc_idx-1]-&gt;id.bustype = BUS_I2C;
+			input[alloc_idx-1]-&gt;id.bustype = bus_type;
+			input[alloc_idx-1]-&gt;id.product = ad714x-&gt;product;
+			input[alloc_idx-1]-&gt;id.version = ad714x-&gt;version;
<span class="cx"> 
</span><span class="cx"> 			ret = input_register_device(input[reg_idx]);
</span><span class="cx"> 			if (ret) {
</span>-				dev_err(&amp;ad714x-&gt;bus-&gt;dev,
-				"Failed to register AD714x input device!\n");
+				dev_err(ad714x-&gt;dev,
+				"Failed to register AD714X input device!\n");
<span class="cx"> 				goto fail_alloc_reg;
</span><span class="cx"> 			}
</span><span class="cx"> 			reg_idx++;
</span><span class="lines"> <at>  <at>  -1140,7 +1170,7  <at>  <at> 
</span><span class="cx"> 		tp_drv = kzalloc(sizeof(struct ad714x_touchpad_drv) *
</span><span class="cx"> 				ad714x-&gt;hw-&gt;touchpad_num, GFP_KERNEL);
</span><span class="cx"> 		if (!tp_drv) {
</span>-			dev_err(&amp;ad714x-&gt;bus-&gt;dev,
+			dev_err(ad714x-&gt;dev,
<span class="cx"> 				"Can't allocate memory for touchpad info\n");
</span><span class="cx"> 			ret = -ENOMEM;
</span><span class="cx"> 			goto fail_alloc_reg;
</span><span class="lines"> <at>  <at>  -1149,7 +1179,7  <at>  <at> 
</span><span class="cx"> 		for (i = 0; i &lt; ad714x-&gt;hw-&gt;touchpad_num; i++) {
</span><span class="cx"> 			input[alloc_idx] = input_allocate_device();
</span><span class="cx"> 			if (!input[alloc_idx]) {
</span>-				dev_err(&amp;ad714x-&gt;bus-&gt;dev,
+				dev_err(ad714x-&gt;dev,
<span class="cx"> 					"Can't allocate input device %d\n",
</span><span class="cx"> 					alloc_idx);
</span><span class="cx"> 				ret = -ENOMEM;
</span><span class="lines"> <at>  <at>  -1168,12 +1198,14  <at>  <at> 
</span><span class="cx"> 			input_set_abs_params(input[alloc_idx-1], ABS_PRESSURE,
</span><span class="cx"> 				0, 1, 0, 0);
</span><span class="cx"> 
</span>-			input[alloc_idx-1]-&gt;id.bustype = BUS_I2C;
+			input[alloc_idx-1]-&gt;id.bustype = bus_type;
+			input[alloc_idx-1]-&gt;id.product = ad714x-&gt;product;
+			input[alloc_idx-1]-&gt;id.version = ad714x-&gt;version;
<span class="cx"> 
</span><span class="cx"> 			ret = input_register_device(input[reg_idx]);
</span><span class="cx"> 			if (ret) {
</span>-				dev_err(&amp;ad714x-&gt;bus-&gt;dev,
-				"Failed to register AD714x input device!\n");
+				dev_err(ad714x-&gt;dev,
+				"Failed to register AD714X input device!\n");
<span class="cx"> 				goto fail_alloc_reg;
</span><span class="cx"> 			}
</span><span class="cx"> 			reg_idx++;
</span><span class="lines"> <at>  <at>  -1188,7 +1220,7  <at>  <at> 
</span><span class="cx"> 		bt_drv = kzalloc(sizeof(struct ad714x_button_drv) *
</span><span class="cx"> 				ad714x-&gt;hw-&gt;button_num, GFP_KERNEL);
</span><span class="cx"> 		if (!bt_drv) {
</span>-			dev_err(&amp;ad714x-&gt;bus-&gt;dev,
+			dev_err(ad714x-&gt;dev,
<span class="cx"> 				"Can't allocate memory for button info\n");
</span><span class="cx"> 			ret = -ENOMEM;
</span><span class="cx"> 			goto fail_alloc_reg;
</span><span class="lines"> <at>  <at>  -1196,7 +1228,7  <at>  <at> 
</span><span class="cx"> 
</span><span class="cx"> 		input[alloc_idx] = input_allocate_device();
</span><span class="cx"> 		if (!input[alloc_idx]) {
</span>-			dev_err(&amp;ad714x-&gt;bus-&gt;dev,
+			dev_err(ad714x-&gt;dev,
<span class="cx"> 					"Can't allocate input device %d\n",
</span><span class="cx"> 					alloc_idx);
</span><span class="cx"> 			ret = -ENOMEM;
</span><span class="lines"> <at>  <at>  -1210,12 +1242,14  <at>  <at> 
</span><span class="cx"> 				input[alloc_idx-1]-&gt;keybit);
</span><span class="cx"> 		}
</span><span class="cx"> 
</span>-		input[alloc_idx-1]-&gt;id.bustype = BUS_I2C;
+		input[alloc_idx-1]-&gt;id.bustype = bus_type;
+		input[alloc_idx-1]-&gt;id.product = ad714x-&gt;product;
+		input[alloc_idx-1]-&gt;id.version = ad714x-&gt;version;
<span class="cx"> 
</span><span class="cx"> 		ret = input_register_device(input[reg_idx]);
</span><span class="cx"> 		if (ret) {
</span>-			dev_err(&amp;ad714x-&gt;bus-&gt;dev,
-				"Failed to register AD714x input device!\n");
+			dev_err(ad714x-&gt;dev,
+				"Failed to register AD714X input device!\n");
<span class="cx"> 			goto fail_alloc_reg;
</span><span class="cx"> 		}
</span><span class="cx"> 		reg_idx++;
</span><span class="lines"> <at>  <at>  -1225,36 +1259,23  <at>  <at> 
</span><span class="cx"> 		ad714x-&gt;sw-&gt;button = bt_drv;
</span><span class="cx"> 	}
</span><span class="cx"> 
</span>-	/* initilize and request sw/hw resources */
<span class="cx"> 
</span>-	ad714x_hw_init(ad714x);
-	mutex_init(&amp;ad714x-&gt;mutex);
-
-	if (ad714x-&gt;bus-&gt;irq &gt; 0) {
-		ret = request_threaded_irq(ad714x-&gt;bus-&gt;irq, ad714x_interrupt,
-				ad714x_interrupt_thread, IRQF_TRIGGER_FALLING,
-				"ad714x_captouch", ad714x);
-		if (ret) {
-			dev_err(&amp;ad714x-&gt;bus-&gt;dev, "Can't allocate irq %d\n",
-					ad714x-&gt;bus-&gt;irq);
-			goto fail_irq;
-		}
-	} else
-		dev_warn(&amp;ad714x-&gt;bus-&gt;dev, "IRQ not configured!\n");
-
<span class="cx"> 	return 0;
</span><span class="cx"> 
</span>-fail_irq:
<span class="cx"> fail_alloc_reg:
</span><span class="cx"> 	for (i = 0; i &lt; reg_idx; i++)
</span><span class="cx"> 		input_unregister_device(input[i]);
</span><span class="cx"> 	for (i = 0; i &lt; alloc_idx; i++)
</span><span class="cx"> 		input_free_device(input[i]);
</span>-	kfree(bt_drv); /* kfree(NULL) is safe check is not required */
+
+	kfree(bt_drv);
<span class="cx"> 	kfree(sd_drv);
</span><span class="cx"> 	kfree(wl_drv);
</span><span class="cx"> 	kfree(tp_drv);
</span><span class="cx"> 	kfree(drv_data);
</span>+
+	free_irq(ad714x-&gt;irq, ad714x);
+fail_irq:
<span class="cx"> det_err:
</span><span class="cx"> 	return ret;
</span><span class="cx"> }
</span><span class="lines"> <at>  <at>  -1269,11 +1290,7  <at>  <at> 
</span><span class="cx"> 	struct ad714x_wheel_drv *wl_drv    = ad714x-&gt;sw-&gt;wheel;
</span><span class="cx"> 	struct ad714x_touchpad_drv *tp_drv = ad714x-&gt;sw-&gt;touchpad;
</span><span class="cx"> 
</span>-	/* free irq hardware resource */
<span class="cx"> 
</span>-	if (ad714x-&gt;bus-&gt;irq &gt; 0)
-		free_irq(ad714x-&gt;bus-&gt;irq, ad714x);
-
<span class="cx"> 	/* unregister and free all input devices */
</span><span class="cx"> 
</span><span class="cx"> 	for (i = 0; i &lt; ad714x-&gt;hw-&gt;slider_num; i++) {
</span><span class="lines"> <at>  <at>  -1295,119 +1312,132  <at>  <at> 
</span><span class="cx"> 	input_free_device(ad714x-&gt;sw-&gt;button[0].input);
</span><span class="cx"> 
</span><span class="cx"> 	/* free all memories for software flow */
</span>-	kfree(bt_drv); /* kfree(NULL) is safe check is not required */
+
+	kfree(bt_drv);
<span class="cx"> 	kfree(sd_drv);
</span><span class="cx"> 	kfree(wl_drv);
</span><span class="cx"> 	kfree(tp_drv);
</span><span class="cx"> 	kfree(drv_data);
</span>-	kfree(ad714x);
<span class="cx"> 
</span>+	/* free irq hardware resource */
+
+	free_irq(ad714x-&gt;irq, ad714x);
+
<span class="cx"> 	return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #ifdef CONFIG_PM
</span>-static int ad714x_suspend(bus_device *bus, pm_message_t message)
+static int ad714x_disable(struct ad714x_chip *ad714x)
<span class="cx"> {
</span>-	struct ad714x_chip *ad714x = dev_get_drvdata(&amp;bus-&gt;dev);
<span class="cx"> 	unsigned short data;
</span><span class="cx"> 
</span>-	pr_debug("%s enter\n", __func__);
+	dev_dbg(ad714x-&gt;dev, "%s enter\n", __func__);
<span class="cx"> 
</span><span class="cx"> 	mutex_lock(&amp;ad714x-&gt;mutex);
</span><span class="cx"> 
</span><span class="cx"> 	data = ad714x-&gt;hw-&gt;sys_cfg_reg[AD714X_PWR_CTRL] | 0x3;
</span>-	ad714x-&gt;write(bus, AD714X_PWR_CTRL, data);
+	ad714x-&gt;write(ad714x-&gt;dev, AD714X_PWR_CTRL, data);
<span class="cx"> 
</span><span class="cx"> 	mutex_unlock(&amp;ad714x-&gt;mutex);
</span><span class="cx"> 
</span><span class="cx"> 	return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span>-static int ad714x_resume(bus_device *bus)
+static int ad714x_enable(struct ad714x_chip *ad714x)
<span class="cx"> {
</span>-	struct ad714x_chip *ad714x = dev_get_drvdata(&amp;bus-&gt;dev);
<span class="cx"> 	unsigned short data;
</span><span class="cx"> 
</span>-	pr_debug("%s enter\n", __func__);
+	dev_dbg(ad714x-&gt;dev, "%s enter\n", __func__);
<span class="cx"> 
</span><span class="cx"> 	mutex_lock(&amp;ad714x-&gt;mutex);
</span><span class="cx"> 
</span><span class="cx"> 	/* resume to non-shutdown mode */
</span><span class="cx"> 
</span>-	ad714x-&gt;write(bus, AD714X_PWR_CTRL,
+	ad714x-&gt;write(ad714x-&gt;dev, AD714X_PWR_CTRL,
<span class="cx"> 			ad714x-&gt;hw-&gt;sys_cfg_reg[AD714X_PWR_CTRL]);
</span><span class="cx"> 
</span><span class="cx"> 	/* make sure the interrupt output line is not low level after resume,
</span><span class="cx"> 	 * otherwise we will get no chance to enter falling-edge irq again
</span><span class="cx"> 	 */
</span><span class="cx"> 
</span>-	ad714x-&gt;read(bus, STG_LOW_INT_STA_REG, &amp;data);
-	ad714x-&gt;read(bus, STG_HIGH_INT_STA_REG, &amp;data);
-	ad714x-&gt;read(bus, STG_COM_INT_STA_REG, &amp;data);
+	ad714x-&gt;read(ad714x-&gt;dev, STG_LOW_INT_STA_REG, &amp;data);
+	ad714x-&gt;read(ad714x-&gt;dev, STG_HIGH_INT_STA_REG, &amp;data);
+	ad714x-&gt;read(ad714x-&gt;dev, STG_COM_INT_STA_REG, &amp;data);
<span class="cx"> 
</span><span class="cx"> 	mutex_unlock(&amp;ad714x-&gt;mutex);
</span><span class="cx"> 
</span><span class="cx"> 	return 0;
</span><span class="cx"> }
</span>-#else
-#define ad714x_suspend NULL
-#define ad714x_resume  NULL
-#endif
<span class="cx"> 
</span>-#if defined(CONFIG_INPUT_AD714X_SPI)
-int ad714x_spi_read(struct spi_device *spi, unsigned short reg,
-		unsigned short *data)
+#if defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)
+static int ad714x_spi_suspend(struct spi_device *spi, pm_message_t message)
<span class="cx"> {
</span>-	int ret;
-	unsigned short tx[2];
-	unsigned short rx[2];
-	struct spi_transfer t = {
-		.tx_buf = tx,
-		.rx_buf = rx,
-		.len = 4,
-	};
-	struct spi_message m;
+	struct ad714x_chip *ad714x = spi_get_drvdata(spi);
<span class="cx"> 
</span>-	tx[0] = (AD714x_SPI_ADDR &lt;&lt; AD714x_SPI_ADDR_SHFT) |
-		(AD714x_SPI_READ &lt;&lt; AD714x_SPI_READ_SHFT) | reg;
+	ad714x_disable(ad714x);
<span class="cx"> 
</span>-	spi_message_init(&amp;m);
-	spi_message_add_tail(&amp;t, &amp;m);
-	ret = spi_sync(spi, &amp;m);
+	return 0;
+}
<span class="cx"> 
</span>-	if (ret &lt; 0) {
-		dev_err(&amp;spi-&gt;dev, "SPI read error\n");
-		return ret;
-	}
+static int ad714x_spi_resume(struct spi_device *spi)
+{
+	struct ad714x_chip *ad714x = spi_get_drvdata(spi);
<span class="cx"> 
</span>-	*data = rx[1];
-	return ret;
+	ad714x_enable(ad714x);
+
+	return 0;
<span class="cx"> }
</span>+#endif
<span class="cx"> 
</span>-int ad714x_spi_write(struct spi_device *spi, unsigned short reg,
-		unsigned short data)
+#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+static int ad714x_i2c_suspend(struct i2c_client *client, pm_message_t message)
<span class="cx"> {
</span>-	int ret = 0;
-	unsigned short tx[2];
-	struct spi_transfer t = {
-		.tx_buf = tx,
-		.len = 4,
-	};
-	struct spi_message m;
+	struct ad714x_chip *ad714x = i2c_get_clientdata(client);
<span class="cx"> 
</span>-	tx[0] = (AD714x_SPI_ADDR &lt;&lt; AD714x_SPI_ADDR_SHFT) | reg;
-	tx[1] = data;
+	ad714x_disable(ad714x);
<span class="cx"> 
</span>-	spi_message_init(&amp;m);
-	spi_message_add_tail(&amp;t, &amp;m);
+	return 0;
+}
<span class="cx"> 
</span>-	ret = spi_sync(spi, &amp;m);
-	if (ret &lt; 0)
-		dev_err(&amp;spi-&gt;dev, "SPI write error\n");
+static int ad714x_i2c_resume(struct i2c_client *client)
+{
+	struct ad714x_chip *ad714x = i2c_get_clientdata(client);
<span class="cx"> 
</span>-	return ret;
+	ad714x_enable(ad714x);
+
+	return 0;
<span class="cx"> }
</span>+#endif
<span class="cx"> 
</span>+#else
+#define ad714x_spi_suspend NULL
+#define ad714x_spi_resume  NULL
+#define ad714x_i2c_suspend NULL
+#define ad714x_i2c_resume  NULL
+#endif
+
+#if defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)
+static int ad714x_spi_read(struct device *dev, unsigned short reg,
+		unsigned short *data)
+{
+	struct spi_device *spi = to_spi_device(dev);
+	unsigned short tx = AD714x_SPI_CMD_PREFIX | AD714x_SPI_READ | reg;
+
+	return spi_write_then_read(spi, (u8 *)&amp;tx, 2, (u8 *)data, 2);
+}
+
+static int ad714x_spi_write(struct device *dev, unsigned short reg,
+		unsigned short data)
+{
+	struct spi_device *spi = to_spi_device(dev);
+	unsigned short tx[2] = {
+		AD714x_SPI_CMD_PREFIX | reg,
+		data
+	};
+
+	return spi_write(spi, (u8 *)tx, 4);
+}
+
<span class="cx"> static int __devinit ad714x_spi_probe(struct spi_device *spi)
</span><span class="cx"> {
</span><span class="cx"> 	int ret = 0;
</span><span class="lines"> <at>  <at>  -1422,14 +1452,15  <at>  <at> 
</span><span class="cx"> 	if (!chip)
</span><span class="cx"> 		return -ENOMEM;
</span><span class="cx"> 
</span>-	chip-&gt;bus = spi;
<span class="cx"> 	chip-&gt;read = ad714x_spi_read;
</span><span class="cx"> 	chip-&gt;write = ad714x_spi_write;
</span><span class="cx"> 	chip-&gt;hw = spi-&gt;dev.platform_data;
</span>+	chip-&gt;irq = spi-&gt;irq;
+	chip-&gt;dev = &amp;spi-&gt;dev;
<span class="cx"> 	spi_set_drvdata(spi, chip);
</span><span class="cx"> 
</span><span class="cx"> 	/* common probe not related with spi/i2c */
</span>-	ret = ad714x_probe(chip);
+	ret = ad714x_probe(chip, BUS_SPI);
<span class="cx"> 	if (ret)
</span><span class="cx"> 		kfree(chip);
</span><span class="cx"> 
</span><span class="lines"> <at>  <at>  -1439,52 +1470,42  <at>  <at> 
</span><span class="cx"> static int __devexit ad714x_spi_remove(struct spi_device *spi)
</span><span class="cx"> {
</span><span class="cx"> 	struct ad714x_chip *chip = spi_get_drvdata(spi);
</span>+
<span class="cx"> 	ad714x_remove(chip);
</span><span class="cx"> 
</span>+	kfree(chip);
+
<span class="cx"> 	return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static struct spi_driver ad714x_spi_driver = {
</span><span class="cx"> 	.driver = {
</span><span class="cx"> 		.name	= "ad714x_captouch",
</span>-		.bus	= &amp;spi_bus_type,
<span class="cx"> 		.owner	= THIS_MODULE,
</span><span class="cx"> 	},
</span><span class="cx"> 	.probe		= ad714x_spi_probe,
</span><span class="cx"> 	.remove		= __devexit_p(ad714x_spi_remove),
</span>-	.suspend	= ad714x_suspend,
-	.resume		= ad714x_resume,
+	.suspend	= ad714x_spi_suspend,
+	.resume		= ad714x_spi_resume,
<span class="cx"> };
</span>+#endif
<span class="cx"> 
</span>-static int __init ad714x_init(void)
-{
-	int ret;
<span class="cx"> 
</span>-	ret = spi_register_driver(&amp;ad714x_spi_driver);
-	if (ret != 0) {
-		printk(KERN_ERR "Failed to register ad714x SPI driver: %d\n",
-				ret);
-	}
-
-	return ret;
-}
-
-static void __exit ad714x_exit(void)
-{
-	spi_unregister_driver(&amp;ad714x_spi_driver);
-}
-#else
-static int ad714x_i2c_write(struct i2c_client *client, unsigned short reg,
+#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+static int ad714x_i2c_write(struct device *dev, unsigned short reg,
<span class="cx"> 		unsigned short data)
</span><span class="cx"> {
</span>+	struct i2c_client *client = to_i2c_client(dev);
<span class="cx"> 	int ret = 0;
</span>-	u8 tx[4];
+	u8 *_reg = (u8 *)&amp;reg;
+	u8 *_data = (u8 *)&amp;data;
<span class="cx"> 
</span>-	/* Do raw I2C, not smbus compatible */
-	tx[0] = (reg &amp; 0xFF00) &gt;&gt; 8;
-	tx[1] = (reg &amp; 0x00FF);
-	tx[2] = (data &amp; 0xFF00) &gt;&gt; 8;
-	tx[3] = data &amp; 0x00FF;
+	u8 tx[4] = {
+		_reg[1],
+		_reg[0],
+		_data[1],
+		_data[0]
+	};
<span class="cx"> 
</span><span class="cx"> 	ret = i2c_master_send(client, tx, 4);
</span><span class="cx"> 	if (ret &lt; 0)
</span><span class="lines"> <at>  <at>  -1493,17 +1514,20  <at>  <at> 
</span><span class="cx"> 	return ret;
</span><span class="cx"> }
</span><span class="cx"> 
</span>-static int ad714x_i2c_read(struct i2c_client *client, unsigned short reg,
+static int ad714x_i2c_read(struct device *dev, unsigned short reg,
<span class="cx"> 		unsigned short *data)
</span><span class="cx"> {
</span>+	struct i2c_client *client = to_i2c_client(dev);
<span class="cx"> 	int ret = 0;
</span>-	u8 tx[2];
+	u8 *_reg = (u8 *)&amp;reg;
+	u8 *_data = (u8 *)data;
+
+	u8 tx[2] = {
+		_reg[1],
+		_reg[0]
+	};
<span class="cx"> 	u8 rx[2];
</span><span class="cx"> 
</span>-	/* Do raw I2C, not smbus compatible */
-	tx[0] = (reg &amp; 0xFF00) &gt;&gt; 8;
-	tx[1] = (reg &amp; 0x00FF);
-
<span class="cx"> 	ret = i2c_master_send(client, tx, 2);
</span><span class="cx"> 	if (ret &lt; 0) {
</span><span class="cx"> 		dev_err(&amp;client-&gt;dev, "I2C read error\n");
</span><span class="lines"> <at>  <at>  -1516,8 +1540,8  <at>  <at> 
</span><span class="cx"> 		return ret;
</span><span class="cx"> 	}
</span><span class="cx"> 
</span>-	*data = rx[0];
-	*data = (*data &lt;&lt; 8) | rx[1];
+	_data[0] = rx[1];
+	_data[1] = rx[0];
<span class="cx"> 
</span><span class="cx"> 	return ret;
</span><span class="cx"> }
</span><span class="lines"> <at>  <at>  -1538,14 +1562,15  <at>  <at> 
</span><span class="cx"> 	if (!chip)
</span><span class="cx"> 		return -ENOMEM;
</span><span class="cx"> 
</span>-	chip-&gt;bus = client;
<span class="cx"> 	chip-&gt;read = ad714x_i2c_read;
</span><span class="cx"> 	chip-&gt;write = ad714x_i2c_write;
</span><span class="cx"> 	chip-&gt;hw = client-&gt;dev.platform_data;
</span>+	chip-&gt;irq = client-&gt;irq;
+	chip-&gt;dev = &amp;client-&gt;dev;
<span class="cx"> 	i2c_set_clientdata(client, chip);
</span><span class="cx"> 
</span><span class="cx"> 	/* common probe not related with spi/i2c */
</span>-	ret = ad714x_probe(chip);
+	ret = ad714x_probe(chip, BUS_I2C);
<span class="cx"> 	if (ret)
</span><span class="cx"> 		kfree(chip);
</span><span class="cx"> 
</span><span class="lines"> <at>  <at>  -1555,13 +1580,17  <at>  <at> 
</span><span class="cx"> static int __devexit ad714x_i2c_remove(struct i2c_client *client)
</span><span class="cx"> {
</span><span class="cx"> 	struct ad714x_chip *chip = i2c_get_clientdata(client);
</span>+
<span class="cx"> 	ad714x_remove(chip);
</span><span class="cx"> 
</span>+	kfree(chip);
+
<span class="cx"> 	return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static const struct i2c_device_id ad714x_id[] = {
</span>-	{ "ad714x_captouch", 0 },
+	{ "ad7142_captouch", 0 },
+	{ "ad7147_captouch", 0 },
<span class="cx"> 	{ }
</span><span class="cx"> };
</span><span class="cx"> MODULE_DEVICE_TABLE(i2c, ad714x_id);
</span><span class="lines"> <at>  <at>  -1570,27 +1599,54  <at>  <at> 
</span><span class="cx"> 	.driver = {
</span><span class="cx"> 		.name = "ad714x_captouch",
</span><span class="cx"> 	},
</span>-	.probe = ad714x_i2c_probe,
-	.remove = __devexit_p(ad714x_i2c_remove),
-	.suspend	= ad714x_suspend,
-	.resume		= ad714x_resume,
+	.probe    = ad714x_i2c_probe,
+	.remove   = __devexit_p(ad714x_i2c_remove),
+	.suspend  = ad714x_i2c_suspend,
+	.resume	  = ad714x_i2c_resume,
<span class="cx"> 	.id_table = ad714x_id,
</span><span class="cx"> };
</span>+#endif
<span class="cx"> 
</span><span class="cx"> static int __init ad714x_init(void)
</span><span class="cx"> {
</span>+#if (defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)) &amp;&amp; \
+	!(defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE))
+	return spi_register_driver(&amp;ad714x_spi_driver);
+#endif
+
+#if (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE))  &amp;&amp; \
+	!(defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE))
<span class="cx"> 	return i2c_add_driver(&amp;ad714x_i2c_driver);
</span>+#endif
+
+#if (defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)) &amp;&amp; \
+	(defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE))
+	int ret = 0;
+	ret = spi_register_driver(&amp;ad714x_spi_driver);
+	if (ret)
+		goto err;
+	ret = i2c_add_driver(&amp;ad714x_i2c_driver);
+	if (ret)
+		spi_unregister_driver(&amp;ad714x_spi_driver);
+err:
+	return ret;
+#endif
<span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void __exit ad714x_exit(void)
</span><span class="cx"> {
</span>+#if defined(CONFIG_SPI) || defined(CONFIG_SPI_MODULE)
+	spi_unregister_driver(&amp;ad714x_spi_driver);
+#endif
+
+#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
<span class="cx"> 	i2c_del_driver(&amp;ad714x_i2c_driver);
</span>+#endif
<span class="cx"> }
</span>-#endif
<span class="cx"> 
</span><span class="cx"> module_init(ad714x_init);
</span><span class="cx"> module_exit(ad714x_exit);
</span><span class="cx"> 
</span>-MODULE_DESCRIPTION("ad714x captouch driver");
+MODULE_DESCRIPTION("Analog Devices AD714X Capacitance Touch Sensor Driver");
<span class="cx"> MODULE_AUTHOR("Barry Song &lt;21cnbao@...&gt;");
</span><span class="cx"> MODULE_LICENSE("GPL");
</span></span>
</div>
<a></a>
<div class="copfile">
<h4>Copied: trunk/include/linux/input/ad714x.h (from rev 7259, trunk/include/linux/spi/ad714x.h) (0 =&gt; 7260)</h4>
<span>
<span class="info">--- trunk/include/linux/input/ad714x.h	                        (rev 0)
+++ trunk/include/linux/input/ad714x.h	2009-09-02 21:47:05 UTC (rev 7260)
</span><span class="lines"> <at>  <at>  -0,0 +1,62  <at>  <at> 
</span>+/*
+ * include/linux/input/ad714x.h
+ *
+ * AD714x is very flexible, it can be used as buttons, scrollwheel,
+ * slider, touchpad at the same time. That depends on the boards.
+ * The platform_data for the device's "struct device" holds this
+ * information.
+ * Copyright 2009 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#ifndef __LINUX_INPUT_AD714X_H__
+#define __LINUX_INPUT_AD714X_H__
+
+#define STAGE_NUM              12
+#define STAGE_CFGREG_NUM       8
+#define SYS_CFGREG_NUM         8
+
+/* board information which need be initialized in arch/mach... */
+struct ad714x_slider_plat {
+	int start_stage;
+	int end_stage;
+	int max_coord;
+};
+
+struct ad714x_wheel_plat {
+	int start_stage;
+	int end_stage;
+	int max_coord;
+};
+
+struct ad714x_touchpad_plat {
+	int x_start_stage;
+	int x_end_stage;
+	int x_max_coord;
+
+	int y_start_stage;
+	int y_end_stage;
+	int y_max_coord;
+};
+
+struct ad714x_button_plat {
+	int keycode;
+	unsigned short l_mask;
+	unsigned short h_mask;
+};
+
+struct ad714x_platform_data {
+	int slider_num;
+	int wheel_num;
+	int touchpad_num;
+	int button_num;
+	struct ad714x_slider_plat *slider;
+	struct ad714x_wheel_plat *wheel;
+	struct ad714x_touchpad_plat *touchpad;
+	struct ad714x_button_plat *button;
+	unsigned short stage_cfg_reg[STAGE_NUM][STAGE_CFGREG_NUM];
+	unsigned short sys_cfg_reg[SYS_CFGREG_NUM];
+};
+
+#endif
</span>
</div>
<a></a>
<div class="propset">
<h4>Property changes: trunk/include/linux/input/ad714x.h</h4>
<span>
</span>
</div>
<a></a>
<div class="addfile"><h4>Added: svn:mergeinfo</h4></div>
<a></a>
<div class="delfile">
<h4>Deleted: trunk/include/linux/spi/ad714x.h (7259 =&gt; 7260)</h4>
<span>
<span class="info">--- trunk/include/linux/spi/ad714x.h	2009-09-02 08:14:05 UTC (rev 7259)
+++ trunk/include/linux/spi/ad714x.h	2009-09-02 21:47:05 UTC (rev 7260)
</span><span class="lines"> <at>  <at>  -1,62 +0,0  <at>  <at> 
</span>-/*
- * include/linux/ad714x.h
- *
- * AD714x is very flexible, it can be used as buttons, scrollwheel,
- * slider, touchpad at the same time. That depends on the boards.
- * The platform_data for the device's "struct device" holds this
- * information.
- * Copyright 2009 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later.
- */
-
-#ifndef __LINUX_SPI_AD714X_H__
-#define __LINUX_SPI_AD714X_H__
-
-#define STAGE_NUM              12
-#define STAGE_CFGREG_NUM       8
-#define SYS_CFGREG_NUM         8
-
-/* board information which need be initialized in arch/mach... */
-struct ad714x_slider_plat {
-	int start_stage;
-	int end_stage;
-	int max_coord;
-};
-
-struct ad714x_wheel_plat {
-	int start_stage;
-	int end_stage;
-	int max_coord;
-};
-
-struct ad714x_touchpad_plat {
-	int x_start_stage;
-	int x_end_stage;
-	int x_max_coord;
-
-	int y_start_stage;
-	int y_end_stage;
-	int y_max_coord;
-};
-
-struct ad714x_button_plat {
-	int keycode;
-	unsigned short l_mask;
-	unsigned short h_mask;
-};
-
-struct ad714x_platform_data {
-	int slider_num;
-	int wheel_num;
-	int touchpad_num;
-	int button_num;
-	struct ad714x_slider_plat *slider;
-	struct ad714x_wheel_plat *wheel;
-	struct ad714x_touchpad_plat *touchpad;
-	struct ad714x_button_plat *button;
-	unsigned short stage_cfg_reg[STAGE_NUM][STAGE_CFGREG_NUM];
-	unsigned short sys_cfg_reg[SYS_CFGREG_NUM];
-};
-
-#endif
</span>
</div>
</div>

</div>
bhsong | 2 Sep 23:52 2009

[7261] trunk/include/linux/input.h: forget to check-in input.h

<!-- #msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dl.meta dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; } #logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; } #logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; } #logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } #logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; } #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; } #logmsg pre { background: #eee; padding: 1em; } #logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;} #logmsg dl { margin: 0; } #logmsg dt { font-weight: bold; } #logmsg dd { margin: 0; padding: 0 0 0.5em 0; } #logmsg dd:before { content:'\00bb';} #logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; } #logmsg table th.Corner { text-align: left; } #logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} -->
Revision 7261 Author bhsong Date 2009-09-02 17:52:47 -0400 (Wed, 02 Sep 2009)

Log Message

forget to check-in input.h

Modified Paths

Diff

Modified: trunk/include/linux/input.h (7260 => 7261)

--- trunk/include/linux/input.h 2009-09-02 21:47:05 UTC (rev 7260) +++ trunk/include/linux/input.h 2009-09-02 21:52:47 UTC (rev 7261) <at> <at> -755,6 +755,7 <at> <at> #define BUS_HOST 0x19 #define BUS_GSC 0x1A #define BUS_ATARI 0x1B +#define BUS_SPI 0x1C /* * MT_TOOL types
<div>

&lt;!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg &gt; ul, #logmsg &gt; ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--&gt;<div>
Revision <a href="http://blackfin.uclinux.org/gf/project/linux-kernel/scmsvn/?action=browse&amp;path=/&amp;view=rev&amp;root=linux-kernel&amp;revision=7261">7261</a>
Author <a href="http://blackfin.uclinux.org/gf/user/bhsong/">bhsong</a>
Date 2009-09-02 17:52:47 -0400 (Wed, 02 Sep 2009)
<h3>Log Message</h3>
forget to check-in input.h

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkincludelinuxinputh">trunk/include/linux/input.h</a></li>
</ul>
</div>
<div>
<h3>Diff</h3>
<a></a>
<div class="modfile">
<h4>Modified: trunk/include/linux/input.h (7260 =&gt; 7261)</h4>
<span>
<span class="info">--- trunk/include/linux/input.h	2009-09-02 21:47:05 UTC (rev 7260)
+++ trunk/include/linux/input.h	2009-09-02 21:52:47 UTC (rev 7261)
</span><span class="lines"> <at>  <at>  -755,6 +755,7  <at>  <at> 
</span><span class="cx"> #define BUS_HOST		0x19
</span><span class="cx"> #define BUS_GSC			0x1A
</span><span class="cx"> #define BUS_ATARI		0x1B
</span>+#define BUS_SPI			0x1C
<span class="cx"> 
</span><span class="cx"> /*
</span><span class="cx">  * MT_TOOL types
</span></span>
</div>
</div>

</div>
cliff | 3 Sep 06:58 2009

[7262] branches/2009R1/drivers/usb/musb/blackfin.c: bug[#4141] use byte access way to read the last byte of packet with odd size

<!-- #msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dl.meta dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; } #logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; } #logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; } #logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } #logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; } #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; } #logmsg pre { background: #eee; padding: 1em; } #logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;} #logmsg dl { margin: 0; } #logmsg dt { font-weight: bold; } #logmsg dd { margin: 0; padding: 0 0 0.5em 0; } #logmsg dd:before { content:'\00bb';} #logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; } #logmsg table th.Corner { text-align: left; } #logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} -->
Revision 7262 Author cliff Date 2009-09-03 00:58:56 -0400 (Thu, 03 Sep 2009)

Log Message

bug[#4141]use byte access way to read the last byte of packet with odd size

Modified Paths

Diff

Modified: branches/2009R1/drivers/usb/musb/blackfin.c (7261 => 7262)

--- branches/2009R1/drivers/usb/musb/blackfin.c 2009-09-02 21:52:47 UTC (rev 7261) +++ branches/2009R1/drivers/usb/musb/blackfin.c 2009-09-03 04:58:56 UTC (rev 7262) <at> <at> -30,11 +30,9 <at> <at> { void __iomem *fifo = hw_ep->fifo; void __iomem *epio = hw_ep->regs; - -#if !ANOMALY_05000380 u8 epnum = hw_ep->epnum; u16 dma_reg = 0; -#endif + prefetch((u8 *)src); musb_writew(epio, MUSB_TXCOUNT, len); <at> <at> -44,60 +42,62 <at> <at> dump_fifo_data(src, len); -#if !ANOMALY_05000380 - flush_dcache_range((unsigned int)src, - (unsigned int)(src + len)); + if (!ANOMALY_05000380 && epnum != 0) { + flush_dcache_range((unsigned int)src, + (unsigned int)(src + len)); - /* Setup DMA address register */ - dma_reg = (u16) ((u32) src & 0xFFFF); - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg); - SSYNC(); + /* Setup DMA address register */ + dma_reg = (u16) ((u32) src & 0xFFFF); + bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg); + SSYNC(); - dma_reg = (u16) (((u32) src >> 16) & 0xFFFF); - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg); - SSYNC(); + dma_reg = (u16) (((u32) src >> 16) & 0xFFFF); + bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg); + SSYNC(); - /* Setup DMA count register */ - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_LOW), len); - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_HIGH), 0); - SSYNC(); + /* Setup DMA count register */ + bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_LOW), len); + bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_HIGH), 0); + SSYNC(); - /* Enable the DMA */ - dma_reg = (epnum << 4) | DMA_ENA | INT_ENA | DIRECTION; - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), dma_reg); - SSYNC(); + /* Enable the DMA */ + dma_reg = (epnum << 4) | DMA_ENA | INT_ENA | DIRECTION; + bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), dma_reg); + SSYNC(); - /* Wait for compelete */ - while (!(bfin_read_USB_DMA_INTERRUPT() & (1 << epnum))) - cpu_relax(); + /* Wait for compelete */ + while (!(bfin_read_USB_DMA_INTERRUPT() & (1 << epnum))) + cpu_relax(); - /* acknowledge dma interrupt */ - bfin_write_USB_DMA_INTERRUPT(1 << epnum); - SSYNC(); + /* acknowledge dma interrupt */ + bfin_write_USB_DMA_INTERRUPT(1 << epnum); + SSYNC(); - /* Reset DMA */ - bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), 0); - SSYNC(); -#else - if (unlikely((unsigned long)src & 0x01)) - outsw_8((unsigned long)fifo, src, - len & 0x01 ? (len >> 1) + 1 : len >> 1); - else - outsw((unsigned long)fifo, src, - len & 0x01 ? (len >> 1) + 1 : len >> 1); -#endif + /* Reset DMA */ + bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), 0); + SSYNC(); + } else { + SSYNC(); + + if (unlikely((unsigned long)src & 0x01)) + outsw_8((unsigned long)fifo, src, + len & 0x01 ? (len >> 1) + 1 : len >> 1); + else + outsw((unsigned long)fifo, src, + len & 0x01 ? (len >> 1) + 1 : len >> 1); + + } } - /* * Unload an endpoint's FIFO */ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) { void __iomem *fifo = hw_ep->fifo; + u8 epnum = hw_ep->epnum; + u16 dma_reg = 0; -#if ANOMALY_05000467 - u8 epnum = hw_ep->epnum; - u16 dma_reg = 0; + if (ANOMALY_05000467 && epnum != 0) { invalidate_dcache_range((unsigned int)dst, (unsigned int)(dst + len)); <at> <at> -132,15 +132,23 <at> <at> /* Reset DMA */ bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), 0); SSYNC(); -#else + } else { + SSYNC(); + /* Read the last byte of packet with odd size from address fifo + 4 + * to trigger 1 byte access to EP0 FIFO. + */ + if (len == 1) + *dst = (u8)inw((unsigned long)fifo + 4); + else { + if (unlikely((unsigned long)dst & 0x01)) + insw_8((unsigned long)fifo, dst, len >> 1); + else + insw((unsigned long)fifo, dst, len >> 1); - if (unlikely((unsigned long)dst & 0x01)) - insw_8((unsigned long)fifo, dst, - len & 0x01 ? (len >> 1) + 1 : len >> 1); - else - insw((unsigned long)fifo, dst, - len & 0x01 ? (len >> 1) + 1 : len >> 1); -#endif + if (len & 0x01) + *(dst + len - 1) = (u8)inw((unsigned long)fifo + 4); + } + } DBG(4, "%cX ep%d fifo %p count %d buf %p\n", 'R', hw_ep->epnum, fifo, len, dst);
<div>

&lt;!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg &gt; ul, #logmsg &gt; ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--&gt;<div>
Revision <a href="http://blackfin.uclinux.org/gf/project/linux-kernel/scmsvn/?action=browse&amp;path=/&amp;view=rev&amp;root=linux-kernel&amp;revision=7262">7262</a>
Author <a href="http://blackfin.uclinux.org/gf/user/cliff/">cliff</a>
Date 2009-09-03 00:58:56 -0400 (Thu, 03 Sep 2009)
<h3>Log Message</h3>
bug<a href="http://blackfin.uclinux.org/gf/tracker/4141">[#4141]</a>use byte access way to read the last byte of packet with odd size

<h3>Modified Paths</h3>
<ul>
<li><a href="#branches2009R1driversusbmusbblackfinc">branches/2009R1/drivers/usb/musb/blackfin.c</a></li>
</ul>
</div>
<div>
<h3>Diff</h3>
<a></a>
<div class="modfile">
<h4>Modified: branches/2009R1/drivers/usb/musb/blackfin.c (7261 =&gt; 7262)</h4>
<span>
<span class="info">--- branches/2009R1/drivers/usb/musb/blackfin.c	2009-09-02 21:52:47 UTC (rev 7261)
+++ branches/2009R1/drivers/usb/musb/blackfin.c	2009-09-03 04:58:56 UTC (rev 7262)
</span><span class="lines"> <at>  <at>  -30,11 +30,9  <at>  <at> 
</span><span class="cx"> {
</span><span class="cx"> 	void __iomem *fifo = hw_ep-&gt;fifo;
</span><span class="cx"> 	void __iomem *epio = hw_ep-&gt;regs;
</span>-
-#if !ANOMALY_05000380
<span class="cx"> 	u8 epnum = hw_ep-&gt;epnum;
</span><span class="cx"> 	u16 dma_reg = 0;
</span>-#endif
+
<span class="cx"> 	prefetch((u8 *)src);
</span><span class="cx"> 
</span><span class="cx"> 	musb_writew(epio, MUSB_TXCOUNT, len);
</span><span class="lines"> <at>  <at>  -44,60 +42,62  <at>  <at> 
</span><span class="cx"> 
</span><span class="cx"> 	dump_fifo_data(src, len);
</span><span class="cx"> 
</span>-#if !ANOMALY_05000380
-	flush_dcache_range((unsigned int)src,
-		(unsigned int)(src + len));
+	if (!ANOMALY_05000380 &amp;&amp; epnum != 0) {
+		flush_dcache_range((unsigned int)src,
+			(unsigned int)(src + len));
<span class="cx"> 
</span>-	/* Setup DMA address register */
-	dma_reg = (u16) ((u32) src &amp; 0xFFFF);
-	bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg);
-	SSYNC();
+		/* Setup DMA address register */
+		dma_reg = (u16) ((u32) src &amp; 0xFFFF);
+		bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg);
+		SSYNC();
<span class="cx"> 
</span>-	dma_reg = (u16) (((u32) src &gt;&gt; 16) &amp; 0xFFFF);
-	bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg);
-	SSYNC();
+		dma_reg = (u16) (((u32) src &gt;&gt; 16) &amp; 0xFFFF);
+		bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg);
+		SSYNC();
<span class="cx"> 
</span>-	/* Setup DMA count register */
-	bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_LOW), len);
-	bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_HIGH), 0);
-	SSYNC();
+		/* Setup DMA count register */
+		bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_LOW), len);
+		bfin_write16(USB_DMA_REG(epnum, USB_DMAx_COUNT_HIGH), 0);
+		SSYNC();
<span class="cx"> 
</span>-	/* Enable the DMA */
-	dma_reg = (epnum &lt;&lt; 4) | DMA_ENA | INT_ENA | DIRECTION;
-	bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), dma_reg);
-	SSYNC();
+		/* Enable the DMA */
+		dma_reg = (epnum &lt;&lt; 4) | DMA_ENA | INT_ENA | DIRECTION;
+		bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), dma_reg);
+		SSYNC();
<span class="cx"> 
</span>-	/* Wait for compelete */
-	while (!(bfin_read_USB_DMA_INTERRUPT() &amp; (1 &lt;&lt; epnum)))
-		cpu_relax();
+		/* Wait for compelete */
+		while (!(bfin_read_USB_DMA_INTERRUPT() &amp; (1 &lt;&lt; epnum)))
+			cpu_relax();
<span class="cx"> 
</span>-	/* acknowledge dma interrupt */
-	bfin_write_USB_DMA_INTERRUPT(1 &lt;&lt; epnum);
-	SSYNC();
+		/* acknowledge dma interrupt */
+		bfin_write_USB_DMA_INTERRUPT(1 &lt;&lt; epnum);
+		SSYNC();
<span class="cx"> 
</span>-	/* Reset DMA */
-	bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), 0);
-	SSYNC();
-#else
-	if (unlikely((unsigned long)src &amp; 0x01))
-		outsw_8((unsigned long)fifo, src,
-			len &amp; 0x01 ? (len &gt;&gt; 1) + 1 : len &gt;&gt; 1);
-	else
-		outsw((unsigned long)fifo, src,
-			len &amp; 0x01 ? (len &gt;&gt; 1) + 1 : len &gt;&gt; 1);
-#endif
+		/* Reset DMA */
+		bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), 0);
+		SSYNC();
+	} else {
+		SSYNC();
+
+		if (unlikely((unsigned long)src &amp; 0x01))
+			outsw_8((unsigned long)fifo, src,
+				len &amp; 0x01 ? (len &gt;&gt; 1) + 1 : len &gt;&gt; 1);
+		else
+			outsw((unsigned long)fifo, src,
+				len &amp; 0x01 ? (len &gt;&gt; 1) + 1 : len &gt;&gt; 1);
+
+	}
<span class="cx"> }
</span>-
<span class="cx"> /*
</span><span class="cx">  * Unload an endpoint's FIFO
</span><span class="cx">  */
</span><span class="cx"> void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
</span><span class="cx"> {
</span><span class="cx"> 	void __iomem *fifo = hw_ep-&gt;fifo;
</span>+	u8 epnum = hw_ep-&gt;epnum;
+	u16 dma_reg = 0;
<span class="cx"> 
</span>-#if ANOMALY_05000467
-		u8 epnum = hw_ep-&gt;epnum;
-		u16 dma_reg = 0;
+	if (ANOMALY_05000467 &amp;&amp; epnum != 0) {
<span class="cx"> 
</span><span class="cx"> 		invalidate_dcache_range((unsigned int)dst,
</span><span class="cx"> 			(unsigned int)(dst + len));
</span><span class="lines"> <at>  <at>  -132,15 +132,23  <at>  <at> 
</span><span class="cx"> 		/* Reset DMA */
</span><span class="cx"> 		bfin_write16(USB_DMA_REG(epnum, USB_DMAx_CTRL), 0);
</span><span class="cx"> 		SSYNC();
</span>-#else
+	} else {
+		SSYNC();
+		/* Read the last byte of packet with odd size from address fifo + 4
+		 * to trigger 1 byte access to EP0 FIFO.
+		 */
+		if (len == 1)
+			*dst = (u8)inw((unsigned long)fifo + 4);
+		else {
+			if (unlikely((unsigned long)dst &amp; 0x01))
+				insw_8((unsigned long)fifo, dst, len &gt;&gt; 1);
+			else
+				insw((unsigned long)fifo, dst, len &gt;&gt; 1);
<span class="cx"> 
</span>-		if (unlikely((unsigned long)dst &amp; 0x01))
-			insw_8((unsigned long)fifo, dst,
-				len &amp; 0x01 ? (len &gt;&gt; 1) + 1 : len &gt;&gt; 1);
-		else
-			insw((unsigned long)fifo, dst,
-				len &amp; 0x01 ? (len &gt;&gt; 1) + 1 : len &gt;&gt; 1);
-#endif
+			if (len &amp; 0x01)
+				*(dst + len - 1) = (u8)inw((unsigned long)fifo + 4);
+		}
+	}
<span class="cx"> 	DBG(4, "%cX ep%d fifo %p count %d buf %p\n",
</span><span class="cx"> 			'R', hw_ep-&gt;epnum, fifo, len, dst);
</span><span class="cx"> 
</span></span>
</div>
</div>

</div>
hennerich | 3 Sep 07:41 2009

[7263] trunk/drivers/usb/gadget/net2272.c: [#5485] usb lan test failed on bf537-stamp and bf561-ezkit

<!-- #msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dl.meta dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; } #logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; } #logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; } #logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } #logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; } #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; } #logmsg pre { background: #eee; padding: 1em; } #logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;} #logmsg dl { margin: 0; } #logmsg dt { font-weight: bold; } #logmsg dd { margin: 0; padding: 0 0 0.5em 0; } #logmsg dd:before { content:'\00bb';} #logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; } #logmsg table th.Corner { text-align: left; } #logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} -->
Revision 7263 Author hennerich Date 2009-09-03 01:41:01 -0400 (Thu, 03 Sep 2009)

Log Message

[#5485] usb lan test failed on bf537-stamp and bf561-ezkit A platform driver should use platform_driver_register() and friends, and not driver_register() directly. With the recent kernel update probe() won't be called even if struct device_driver .bus = &platform_bus_type is set. platform_driver_register() also calls driver_register() however it initializes shutdown, suspend and resume with platform_driver defaults if not already set.

Modified Paths

Diff

Modified: trunk/drivers/usb/gadget/net2272.c (7262 => 7263)

--- trunk/drivers/usb/gadget/net2272.c 2009-09-03 04:58:56 UTC (rev 7262) +++ trunk/drivers/usb/gadget/net2272.c 2009-09-03 05:41:01 UTC (rev 7263) <at> <at> -2404,14 +2404,11 <at> <at> #if !defined(PLX_PCI_RDK) // Platform remove -static int net2272_remove (struct device *_dev) +static int __devexit net2272_remove(struct platform_device *pdev) { struct net2272 *dev; - struct platform_device *pdev; + dev = platform_get_drvdata(pdev); - pdev = to_platform_device (_dev); - dev = dev_get_drvdata (&pdev->dev); - /* start with the driver above us */ if (dev->driver) { /* should have been done already by driver model core */ <at> <at> -2431,7 +2428,7 <at> <at> INFO (dev, "unbind\n"); - dev_set_drvdata (_dev, 0); + platform_set_drvdata(pdev, NULL); the_controller = NULL; #ifdef CONFIG_BFIN533_STAMP <at> <at> -2442,18 +2439,16 <at> <at> #ifdef CONFIG_BFIN537_BLUETECHNIX_CM gpio_free(GPIO_47); #endif + kfree(dev); return 0; } -static int net2272_probe (struct device *_dev) +static int __devinit net2272_probe(struct platform_device *pdev) { struct net2272 *dev; - struct platform_device *pdev; int retval; - pdev = to_platform_device (_dev); - if (the_controller) { dev_warn (&pdev->dev, "ignoring\n"); return -EBUSY; <at> <at> -2525,14 +2520,13 <at> <at> } /* alloc, and start init */ - dev = kmalloc (sizeof *dev, GFP_KERNEL); + dev = kzalloc(sizeof *dev, GFP_KERNEL); if (dev == NULL) { printk ("can't allocate memory!\n"); retval = -ENOMEM; goto done; } - memset (dev, 0, sizeof *dev); spin_lock_init (&dev->lock); dev->pdev = pdev; dev->gadget.ops = &net2272_ops; <at> <at> -2552,7 +2546,7 <at> <at> if (!dev->base_addr) { DEBUG (dev, "can't map memory\n"); retval = -EFAULT; - goto done; + goto done1; } dev->indexed_threshold = 1 << 5; <at> <at> -2561,22 +2555,29 <at> <at> dev->dma_dreq_polarity = 0; dev->dma_busy = 0; - usb_reset (dev); - usb_reinit (dev); + usb_reset(dev); + usb_reinit(dev); + /* See if there..., can remove this test for production code */ + if (net2272_present(dev)) { + WARNING(dev, "2272 not found!\n"); + retval = -ENODEV; + goto done; + } + if (request_irq (irq, net2272_irq, IRQF_TRIGGER_LOW , driver_name, dev) != 0) { ERROR(dev, "request interrupt %d failed\n", irq); retval = -EBUSY; - goto done; + goto done1; } dev->got_irq = 1; dev->irq = irq; - dev->chiprev = net2272_read (dev, CHIPREV_2272); + dev->chiprev = net2272_read(dev, CHIPREV_2272); /* done */ - dev_set_drvdata (&pdev->dev, dev); + platform_set_drvdata(pdev, dev); INFO (dev, "%s\n", driver_desc); INFO (dev, "irq %d, mapped mem %p, chip rev %04x\n", dev->irq, dev->base_addr, dev->chiprev); <at> <at> -2587,55 +2588,62 <at> <at> the_controller = dev; - retval = device_register (&dev->gadget.dev); - if (retval) goto done; - retval = device_create_file (&pdev->dev, &dev_attr_registers); - if (retval) goto done; + retval = device_register(&dev->gadget.dev); + if (retval) + goto done2; + retval = device_create_file(&pdev->dev, &dev_attr_registers); + if (retval) + goto done3; - // See if there..., can remove this test for production code - if (net2272_present(dev)) - { - WARNING(dev, "2272 not found!\n"); - retval = -ENODEV; - goto done; - } - return 0; +done3: + device_remove_file(&pdev->dev, &dev_attr_registers); +done2: + device_unregister(&dev->gadget.dev); + free_irq(irq, dev); +done1: + iounmap(dev->base_addr); done: - if (dev) - net2272_remove (_dev); +#ifdef CONFIG_BFIN533_STAMP + gpio_free(GPIO_0); + gpio_free(GPIO_1); +#endif +#ifdef CONFIG_BFIN537_BLUETECHNIX_CM + gpio_free(GPIO_47); +#endif + return retval; } -static struct device_driver net2272_driver = { - .name = (char *)driver_name, - .bus = &platform_bus_type, +static struct platform_driver net2272_driver = { + .probe = net2272_probe, + .remove = __devexit_p(net2272_remove), + .driver = { + .name = (char *)driver_name, + .owner = THIS_MODULE, + }, +}; - .probe = net2272_probe, - .remove = net2272_remove, - - /* FIXME .suspend, .resume */ -}; /*---------------------------------------------------------------------------*/ #endif static int __init init (void) { #if defined(PLX_PCI_RDK) - return pci_register_driver (&net2272_driver); + return pci_register_driver(&net2272_driver); #else - return driver_register (&net2272_driver); + return platform_driver_register(&net2272_driver); #endif } static void __exit cleanup (void) { #if defined(PLX_PCI_RDK) - pci_unregister_driver (&net2272_driver); + pci_unregister_driver(&net2272_driver); #else - driver_unregister (&net2272_driver); + platform_driver_unregister(&net2272_driver); #endif } module_init (init);
<div>

&lt;!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg &gt; ul, #logmsg &gt; ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--&gt;<div>
Revision <a href="http://blackfin.uclinux.org/gf/project/linux-kernel/scmsvn/?action=browse&amp;path=/&amp;view=rev&amp;root=linux-kernel&amp;revision=7263">7263</a>
Author <a href="http://blackfin.uclinux.org/gf/user/hennerich/">hennerich</a>
Date 2009-09-03 01:41:01 -0400 (Thu, 03 Sep 2009)
<h3>Log Message</h3>
<a href="http://blackfin.uclinux.org/gf/tracker/5485">[#5485]</a> usb lan test failed on bf537-stamp and bf561-ezkit
A platform driver should use platform_driver_register() and friends, and
not driver_register() directly.
With the recent kernel update probe() won't be called even if struct
device_driver .bus = &amp;platform_bus_type is set.
platform_driver_register() also calls driver_register() however it
initializes shutdown, suspend and resume with platform_driver defaults
if not already set.

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdriversusbgadgetnet2272c">trunk/drivers/usb/gadget/net2272.c</a></li>
</ul>
</div>
<div>
<h3>Diff</h3>
<a></a>
<div class="modfile">
<h4>Modified: trunk/drivers/usb/gadget/net2272.c (7262 =&gt; 7263)</h4>
<span>
<span class="info">--- trunk/drivers/usb/gadget/net2272.c	2009-09-03 04:58:56 UTC (rev 7262)
+++ trunk/drivers/usb/gadget/net2272.c	2009-09-03 05:41:01 UTC (rev 7263)
</span><span class="lines"> <at>  <at>  -2404,14 +2404,11  <at>  <at> 
</span><span class="cx"> #if !defined(PLX_PCI_RDK)
</span><span class="cx"> 
</span><span class="cx"> // Platform remove
</span>-static int net2272_remove (struct device *_dev)
+static int __devexit net2272_remove(struct platform_device *pdev)
<span class="cx"> {
</span><span class="cx"> 	struct net2272		*dev;
</span>-	struct platform_device	*pdev;
+	dev = platform_get_drvdata(pdev);
<span class="cx"> 
</span>-	pdev = to_platform_device (_dev);
-	dev = dev_get_drvdata (&amp;pdev-&gt;dev);
-
<span class="cx"> 	/* start with the driver above us */
</span><span class="cx"> 	if (dev-&gt;driver) {
</span><span class="cx"> 		/* should have been done already by driver model core */
</span><span class="lines"> <at>  <at>  -2431,7 +2428,7  <at>  <at> 
</span><span class="cx"> 
</span><span class="cx"> 	INFO (dev, "unbind\n");
</span><span class="cx"> 
</span>-	dev_set_drvdata (_dev, 0);
+	platform_set_drvdata(pdev, NULL);
<span class="cx"> 	the_controller = NULL;
</span><span class="cx"> 
</span><span class="cx"> #ifdef CONFIG_BFIN533_STAMP
</span><span class="lines"> <at>  <at>  -2442,18 +2439,16  <at>  <at> 
</span><span class="cx"> #ifdef CONFIG_BFIN537_BLUETECHNIX_CM
</span><span class="cx"> 	gpio_free(GPIO_47);
</span><span class="cx"> #endif
</span>+	kfree(dev);
<span class="cx"> 
</span><span class="cx"> 	return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span>-static int net2272_probe (struct device *_dev)
+static int __devinit net2272_probe(struct platform_device *pdev)
<span class="cx"> {
</span><span class="cx"> 	struct net2272		*dev;
</span>-	struct platform_device	*pdev;
<span class="cx"> 	int			retval;
</span><span class="cx"> 
</span>-	pdev = to_platform_device (_dev);
-
<span class="cx"> 	if (the_controller) {
</span><span class="cx"> 		dev_warn (&amp;pdev-&gt;dev, "ignoring\n");
</span><span class="cx"> 		return -EBUSY;
</span><span class="lines"> <at>  <at>  -2525,14 +2520,13  <at>  <at> 
</span><span class="cx"> 	}
</span><span class="cx"> 
</span><span class="cx"> 	/* alloc, and start init */
</span>-	dev = kmalloc (sizeof *dev, GFP_KERNEL);
+	dev = kzalloc(sizeof *dev, GFP_KERNEL);
<span class="cx"> 	if (dev == NULL) {
</span><span class="cx"> 		printk ("can't allocate memory!\n");
</span><span class="cx"> 		retval = -ENOMEM;
</span><span class="cx"> 		goto done;
</span><span class="cx"> 	}
</span><span class="cx"> 
</span>-	memset (dev, 0, sizeof *dev);
<span class="cx"> 	spin_lock_init (&amp;dev-&gt;lock);
</span><span class="cx"> 	dev-&gt;pdev = pdev;
</span><span class="cx"> 	dev-&gt;gadget.ops = &amp;net2272_ops;
</span><span class="lines"> <at>  <at>  -2552,7 +2546,7  <at>  <at> 
</span><span class="cx"> 	if (!dev-&gt;base_addr) {
</span><span class="cx"> 		DEBUG (dev, "can't map memory\n");
</span><span class="cx"> 		retval = -EFAULT;
</span>-		goto done;
+		goto done1;
<span class="cx"> 	}
</span><span class="cx"> 
</span><span class="cx"> 	dev-&gt;indexed_threshold = 1 &lt;&lt; 5;
</span><span class="lines"> <at>  <at>  -2561,22 +2555,29  <at>  <at> 
</span><span class="cx"> 	dev-&gt;dma_dreq_polarity = 0;
</span><span class="cx"> 	dev-&gt;dma_busy = 0;
</span><span class="cx"> 
</span>-	usb_reset (dev);
-	usb_reinit (dev);
+	usb_reset(dev);
+	usb_reinit(dev);
<span class="cx"> 
</span>+	/* See if there..., can remove this test for production code */
+	if (net2272_present(dev)) {
+		WARNING(dev, "2272 not found!\n");
+		retval = -ENODEV;
+		goto done;
+	}
+
<span class="cx"> 	if (request_irq (irq, net2272_irq, IRQF_TRIGGER_LOW , driver_name, dev) != 0) {
</span><span class="cx"> 		ERROR(dev, "request interrupt %d failed\n", irq);
</span><span class="cx"> 		retval = -EBUSY;
</span>-		goto done;
+		goto done1;
<span class="cx"> 	}
</span><span class="cx"> 
</span><span class="cx"> 	dev-&gt;got_irq = 1;
</span><span class="cx"> 	dev-&gt;irq = irq;
</span><span class="cx"> 
</span>-	dev-&gt;chiprev = net2272_read (dev, CHIPREV_2272);
+	dev-&gt;chiprev = net2272_read(dev, CHIPREV_2272);
<span class="cx"> 
</span><span class="cx"> 	/* done */
</span>-	dev_set_drvdata (&amp;pdev-&gt;dev, dev);
+	platform_set_drvdata(pdev, dev);
<span class="cx"> 	INFO (dev, "%s\n", driver_desc);
</span><span class="cx"> 	INFO (dev, "irq %d, mapped mem %p, chip rev %04x\n",
</span><span class="cx"> 			dev-&gt;irq, dev-&gt;base_addr, dev-&gt;chiprev);
</span><span class="lines"> <at>  <at>  -2587,55 +2588,62  <at>  <at> 
</span><span class="cx"> 
</span><span class="cx"> 	the_controller = dev;
</span><span class="cx"> 
</span>-	retval = device_register (&amp;dev-&gt;gadget.dev);
-	if (retval) goto done;
-	retval = device_create_file (&amp;pdev-&gt;dev, &amp;dev_attr_registers);
-	if (retval) goto done;
+	retval = device_register(&amp;dev-&gt;gadget.dev);
+	if (retval)
+		goto done2;
+	retval = device_create_file(&amp;pdev-&gt;dev, &amp;dev_attr_registers);
+	if (retval)
+		goto done3;
<span class="cx"> 
</span>-	// See if there..., can remove this test for production code
-	if (net2272_present(dev))
-	{
-		WARNING(dev, "2272 not found!\n");
-		retval = -ENODEV;
-		goto done;
-	}
-
<span class="cx"> 	return 0;
</span><span class="cx"> 
</span>+done3:
+	device_remove_file(&amp;pdev-&gt;dev, &amp;dev_attr_registers);
+done2:
+	device_unregister(&amp;dev-&gt;gadget.dev);
+	free_irq(irq, dev);
+done1:
+	iounmap(dev-&gt;base_addr);
<span class="cx"> done:
</span>-	if (dev)
-		net2272_remove (_dev);
+#ifdef CONFIG_BFIN533_STAMP
+	gpio_free(GPIO_0);
+	gpio_free(GPIO_1);
+#endif
<span class="cx"> 
</span>+#ifdef CONFIG_BFIN537_BLUETECHNIX_CM
+	gpio_free(GPIO_47);
+#endif
+
<span class="cx"> 	return retval;
</span><span class="cx"> }
</span><span class="cx"> 
</span>-static struct device_driver net2272_driver = {
-	.name			= (char *)driver_name,
-	.bus			= &amp;platform_bus_type,
+static struct platform_driver net2272_driver = {
+	.probe   = net2272_probe,
+	.remove	 = __devexit_p(net2272_remove),
+	.driver	 = {
+		.name	 = (char *)driver_name,
+		.owner	= THIS_MODULE,
+	},
+};
<span class="cx"> 
</span>-	.probe			= net2272_probe,
-	.remove			= net2272_remove,
-
-	/* FIXME .suspend, .resume */
-};
<span class="cx"> /*---------------------------------------------------------------------------*/
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> static int __init init (void)
</span><span class="cx"> {
</span><span class="cx"> #if defined(PLX_PCI_RDK)
</span>-	return pci_register_driver (&amp;net2272_driver);
+	return pci_register_driver(&amp;net2272_driver);
<span class="cx"> #else
</span>-	return driver_register (&amp;net2272_driver);
+	return platform_driver_register(&amp;net2272_driver);
<span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void __exit cleanup (void)
</span><span class="cx"> {
</span><span class="cx"> #if defined(PLX_PCI_RDK)
</span>-	pci_unregister_driver (&amp;net2272_driver);
+	pci_unregister_driver(&amp;net2272_driver);
<span class="cx"> #else
</span>-	driver_unregister (&amp;net2272_driver);
+	platform_driver_unregister(&amp;net2272_driver);
<span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> module_init (init);
</span></span>
</div>
</div>

</div>
adamliyi | 3 Sep 23:14 2009

[7264] trunk/drivers/char/bfin_timer_latency.c: - fix the average latency overflow by using unsigned long long.

<!-- #msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dl.meta dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; } #logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; } #logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; } #logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } #logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; } #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; } #logmsg pre { background: #eee; padding: 1em; } #logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;} #logmsg dl { margin: 0; } #logmsg dt { font-weight: bold; } #logmsg dd { margin: 0; padding: 0 0 0.5em 0; } #logmsg dd:before { content:'\00bb';} #logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; } #logmsg table th.Corner { text-align: left; } #logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} -->
Revision 7264 Author adamliyi Date 2009-09-03 17:14:48 -0400 (Thu, 03 Sep 2009)

Log Message

- fix the average latency overflow by using unsigned long long. - using sched_clock() instead of readling cycles directly

Modified Paths

Diff

Modified: trunk/drivers/char/bfin_timer_latency.c (7263 => 7264)

--- trunk/drivers/char/bfin_timer_latency.c 2009-09-03 05:41:01 UTC (rev 7263) +++ trunk/drivers/char/bfin_timer_latency.c 2009-09-03 21:14:48 UTC (rev 7264) <at> <at> -45,133 +45,118 <at> <at> # define DPRINTK(x...) do { } while (0) #endif +#define WARM_CNT 0 + struct timer_latency_data_t { char value; - unsigned long last_latency; unsigned long worst_latency; - unsigned long average_latency; + unsigned long long total_latency; unsigned long test_number; unsigned int period_sclk; - unsigned int period_cclk; + unsigned int period_ns; }; struct proc_dir_entry *timer_latency_file; struct timer_latency_data_t timer_latency_data; +static unsigned long long ns_new, ns_last; +static unsigned long warmup; + static int read_timer_latency(char *page, char **start, off_t offset, int count, int *eof, void *data) { + unsigned long long average_latency = timer_latency_data.total_latency; + + if (likely(timer_latency_data.test_number > 0)) + do_div(average_latency, timer_latency_data.test_number); + return sprintf(page, - "number, worst latency, average latency\n %lu, %lu, %lu\n", - timer_latency_data.test_number, - timer_latency_data.worst_latency, - timer_latency_data.average_latency); + "number, worst latency(ns), average latency(ns)\n" + "%lu, %lu, %llu\n", + timer_latency_data.test_number, + timer_latency_data.worst_latency, average_latency); } static int write_timer_latency(struct file *file, const char *buffer, unsigned long count, void *data) { - unsigned long sclk, cclk; - char user_value[8]; + unsigned long sclk; + char user_value[8] = {'\0'}; unsigned int wd_period_us; - copy_from_user(user_value, buffer, count); + if (count > sizeof(user_value) - 1) + return -EINVAL; + + if (copy_from_user(user_value, buffer, count) != 0) + return -EFAULT; + + user_value[count] = '\0'; + wd_period_us = simple_strtoul(user_value, NULL, 0); if ((wd_period_us >= 100) && (timer_latency_data.value == 0)) { - DPRINTK("start timer_latency\n"); + DPRINTK("start timer_latency: period: %d us\n", wd_period_us); timer_latency_data.value = 1; sclk = get_sclk() / 1000000; - cclk = get_cclk() / 1000000; - /* convert from us to cycles */ timer_latency_data.period_sclk = wd_period_us * sclk; - timer_latency_data.period_cclk = wd_period_us * cclk; + timer_latency_data.period_ns = wd_period_us * 1000; + timer_latency_data.worst_latency = 0; + timer_latency_data.total_latency = 0; + timer_latency_data.test_number = 0; + warmup = WARM_CNT; + /* set count timer cycles */ bfin_write_WDOG_CNT(timer_latency_data.period_sclk); + /* start WDOT timer */ + bfin_write_WDOG_CTL(0x4); + ns_last = sched_clock(); + ns_new = ns_last; + } else if ((wd_period_us == 0) && timer_latency_data.value == 1) { + DPRINTK("stop timer_latency\n"); + timer_latency_data.value = 0; - /* set CYCLES counter to 0 and start it */ - __asm__( - "R2 = 0;\n\t" - "CYCLES = R2;\n\t" - "CYCLES2 = R2;\n\t" - "R2 = SYSCFG;\n\t" - "BITSET(R2,1);\n\t" - - "P2.H = 0xffc0;\n\t" - "P2.L = 0x0200;\n\t" - "R3 = 0x0004;\n\t" - "W[P2] = R3;\n\t" /* start watchdog timer */ - "SYSCFG = R2;\n\t" /* start cycles counter */ - : : : "R2", "R3", "P2" - ); - + bfin_write_WDOG_CTL(0x8AD6); /* close counter */ + bfin_write_WDOG_CTL(0x8AD6); /* have to write it twice to disable the timer */ } - return 1; /* always write 1 byte */ + return count; /* always write 1 byte */ } + static irqreturn_t timer_latency_irq(int irq, void *dev_id) { struct timer_latency_data_t *data = dev_id; + unsigned long latency = 0; - unsigned long cycles_past; - unsigned long latency; + ns_new = sched_clock(); - /* unsigned long first_latency, second_latency, third_latency; */ - - /* get current cycle counter */ - /* - asm("%0 = CYCLES; p2 = 0xFFE07040; %1 = [p2]; p2 = 0xFFE07044; %2 = [p2]; p2 = 0xFFE07048; %3 = [p2];" - : "=d" (cycles_past), "=d" (first_latency), "=d" (second_latency), "=d" (third_latency):); */ - - asm("%0 = CYCLES;":"=d"(cycles_past)); - bfin_write_WDOG_CTL(0x8AD6); /* close counter */ bfin_write_WDOG_CTL(0x8AD6); /* have to write it twice to disable the timer */ - __asm__( /* stop CYCLES counter */ - "R2 = SYSCFG;\n\t" - "BITCLR(R2,1);\n\t" - "SYSCFG = R2;\n\t" - : : : "R2" - ); + latency = (ns_new - ns_last) - data->period_ns; /* latency in ns */ + ns_last = ns_new; - latency = cycles_past - data->period_cclk; /* latency in cycles */ - DPRINTK("latecy is %lu\n", latency); if (bfin_read_WDOG_STAT() != 0) { - DPRINTK("timer_latency error!\n"); + printk(KERN_ERR "timer_latency error!\n"); return IRQ_HANDLED; } - if (latency > data->worst_latency) - data->worst_latency = latency; - data->last_latency = latency; - data->test_number++; - data->average_latency = - ((data->average_latency * (data->test_number - 1)) + - latency) / (data->test_number); + if (likely(warmup <= 0)) { + if (latency > data->worst_latency) + data->worst_latency = latency; + data->test_number++; + data->total_latency += latency; + } else + warmup--; /* restart watchdog timer again */ bfin_write_WDOG_CNT(data->period_sclk); + bfin_write_WDOG_CTL(0x4); - __asm__( - "R2 = 0;\n\t" - "CYCLES = R2;\n\t" - "CYCLES2 = R2;\n\t" - "R2 = SYSCFG;\n\t" - "BITSET(R2,1);\n\t" - "P2.H = 0xffc0;\n\t" - "P2.L = 0x0200;\n\t" - "R3 = 0x0004;\n\t" - "W[P2] = R3;\n\t" /* start watchdog timer */ - "SYSCFG = R2;\n\t" /* start cycles counter */ - : : : "R2", "R3", "P2" - ); - return IRQ_HANDLED; } <at> <at> -186,8 +171,9 <at> <at> /* default value is 0 (timer is stopped) */ timer_latency_data.value = 0; timer_latency_data.worst_latency = 0; - timer_latency_data.average_latency = 0; - timer_latency_data.last_latency = 0; + timer_latency_data.total_latency = 0; + warmup = WARM_CNT; + ns_new = ns_last = 0; timer_latency_file->data = &timer_latency_data; timer_latency_file->read_proc = &read_timer_latency; <at> <at> -198,7 +184,6 <at> <at> remove_proc_entry("timer_latency", NULL); return -EBUSY; } - printk(KERN_INFO "timer_latency module loaded\n"); return 0; /* everything's OK */
<div>

&lt;!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg &gt; ul, #logmsg &gt; ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--&gt;<div>
Revision <a href="http://blackfin.uclinux.org/gf/project/linux-kernel/scmsvn/?action=browse&amp;path=/&amp;view=rev&amp;root=linux-kernel&amp;revision=7264">7264</a>
Author <a href="http://blackfin.uclinux.org/gf/user/adamliyi/">adamliyi</a>
Date 2009-09-03 17:14:48 -0400 (Thu, 03 Sep 2009)
<h3>Log Message</h3>
- fix the average latency overflow by using unsigned long long.
- using sched_clock() instead of readling cycles directly

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdriverscharbfin_timer_latencyc">trunk/drivers/char/bfin_timer_latency.c</a></li>
</ul>
</div>
<div>
<h3>Diff</h3>
<a></a>
<div class="modfile">
<h4>Modified: trunk/drivers/char/bfin_timer_latency.c (7263 =&gt; 7264)</h4>
<span>
<span class="info">--- trunk/drivers/char/bfin_timer_latency.c	2009-09-03 05:41:01 UTC (rev 7263)
+++ trunk/drivers/char/bfin_timer_latency.c	2009-09-03 21:14:48 UTC (rev 7264)
</span><span class="lines"> <at>  <at>  -45,133 +45,118  <at>  <at> 
</span><span class="cx"> # define DPRINTK(x...)	do { } while (0)
</span><span class="cx"> #endif
</span><span class="cx"> 
</span>+#define WARM_CNT 0
+
<span class="cx"> struct timer_latency_data_t {
</span><span class="cx"> 	char value;
</span>-	unsigned long last_latency;
<span class="cx"> 	unsigned long worst_latency;
</span>-	unsigned long average_latency;
+	unsigned long long total_latency;
<span class="cx"> 	unsigned long test_number;
</span><span class="cx"> 	unsigned int period_sclk;
</span>-	unsigned int period_cclk;
+	unsigned int period_ns;
<span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct proc_dir_entry *timer_latency_file;
</span><span class="cx"> struct timer_latency_data_t timer_latency_data;
</span><span class="cx"> 
</span>+static unsigned long long ns_new, ns_last;
+static unsigned long warmup;
+
<span class="cx"> static int read_timer_latency(char *page, char **start,
</span><span class="cx"> 			      off_t offset, int count, int *eof, void *data)
</span><span class="cx"> {
</span>+	unsigned long long average_latency = timer_latency_data.total_latency;
+
+	if (likely(timer_latency_data.test_number &gt; 0))
+		do_div(average_latency, timer_latency_data.test_number);
+
<span class="cx"> 	return sprintf(page,
</span>-		       "number, worst latency, average latency\n  %lu,      %lu,       %lu\n",
-		       timer_latency_data.test_number,
-		       timer_latency_data.worst_latency,
-		       timer_latency_data.average_latency);
+		       "number,   worst latency(ns), average latency(ns)\n"
+			"%lu,      %lu,          %llu\n",
+			timer_latency_data.test_number,
+			timer_latency_data.worst_latency, average_latency);
<span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static int write_timer_latency(struct file *file, const char *buffer,
</span><span class="cx"> 			       unsigned long count, void *data)
</span><span class="cx"> {
</span>-	unsigned long sclk, cclk;
-	char user_value[8];
+	unsigned long sclk;
+	char user_value[8] = {'\0'};
<span class="cx"> 	unsigned int wd_period_us;
</span><span class="cx"> 
</span>-	copy_from_user(user_value, buffer, count);
+	if (count &gt; sizeof(user_value) - 1)
+		return -EINVAL;
+
+	if (copy_from_user(user_value, buffer, count) != 0)
+		return -EFAULT;
+
+	user_value[count] = '\0';
+
<span class="cx"> 	wd_period_us = simple_strtoul(user_value, NULL, 0);
</span><span class="cx"> 
</span><span class="cx"> 	if ((wd_period_us &gt;= 100) &amp;&amp; (timer_latency_data.value == 0)) {
</span>-		DPRINTK("start timer_latency\n");
+		DPRINTK("start timer_latency: period: %d us\n", wd_period_us);
<span class="cx"> 		timer_latency_data.value = 1;
</span><span class="cx"> 		sclk = get_sclk() / 1000000;
</span>-		cclk = get_cclk() / 1000000;
<span class="cx"> 
</span>-		/* convert from us to cycles */
<span class="cx"> 		timer_latency_data.period_sclk = wd_period_us * sclk;
</span>-		timer_latency_data.period_cclk = wd_period_us * cclk;
+		timer_latency_data.period_ns = wd_period_us * 1000;
<span class="cx"> 
</span>+		timer_latency_data.worst_latency = 0;
+		timer_latency_data.total_latency = 0;
+		timer_latency_data.test_number = 0;
+		warmup = WARM_CNT;
+
<span class="cx"> 		/* set count timer cycles */
</span><span class="cx"> 		bfin_write_WDOG_CNT(timer_latency_data.period_sclk);
</span>+		/* start WDOT timer */
+		bfin_write_WDOG_CTL(0x4);
+		ns_last = sched_clock();
+		ns_new = ns_last;
+	} else if ((wd_period_us == 0) &amp;&amp; timer_latency_data.value == 1) {
+		DPRINTK("stop timer_latency\n");
+		timer_latency_data.value = 0;
<span class="cx"> 
</span>-		/* set CYCLES counter to 0 and start it */
-		__asm__(
-			"R2 = 0;\n\t"
-			"CYCLES = R2;\n\t"
-			"CYCLES2 = R2;\n\t"
-			"R2 = SYSCFG;\n\t"
-			"BITSET(R2,1);\n\t"
-
-			"P2.H = 0xffc0;\n\t"
-			"P2.L = 0x0200;\n\t"
-			"R3 = 0x0004;\n\t"
-			"W[P2] = R3;\n\t"     /* start watchdog timer */
-			"SYSCFG = R2;\n\t"    /* start cycles counter */
-			: : : "R2", "R3", "P2"
-		);
-
+		bfin_write_WDOG_CTL(0x8AD6);	/* close counter */
+		bfin_write_WDOG_CTL(0x8AD6);	/* have to write it twice to disable the timer */
<span class="cx"> 	}
</span><span class="cx"> 
</span>-	return 1;		/* always write 1 byte */
+	return count;		/* always write 1 byte */
<span class="cx"> }
</span><span class="cx"> 
</span>+
<span class="cx"> static irqreturn_t timer_latency_irq(int irq, void *dev_id)
</span><span class="cx"> {
</span><span class="cx"> 	struct timer_latency_data_t *data = dev_id;
</span>+	unsigned long latency = 0;
<span class="cx"> 
</span>-	unsigned long cycles_past;
-	unsigned long latency;
+	ns_new = sched_clock();
<span class="cx"> 
</span>-	/* unsigned long first_latency, second_latency, third_latency; */
-
-	/* get current cycle counter */
-	/*
-	   asm("%0 = CYCLES; p2 = 0xFFE07040; %1 = [p2]; p2 = 0xFFE07044; %2 = [p2]; p2 = 0xFFE07048; %3 = [p2];"
-	   : "=d" (cycles_past), "=d" (first_latency), "=d" (second_latency), "=d" (third_latency):); */
-
-      asm("%0 = CYCLES;":"=d"(cycles_past));
-
<span class="cx"> 	bfin_write_WDOG_CTL(0x8AD6);	/* close counter */
</span><span class="cx"> 	bfin_write_WDOG_CTL(0x8AD6);	/* have to write it twice to disable the timer */
</span><span class="cx"> 
</span>-	__asm__(                      /* stop CYCLES counter */
-		"R2 = SYSCFG;\n\t"
-		"BITCLR(R2,1);\n\t"
-		"SYSCFG = R2;\n\t"
-		: : : "R2"
-	);
+	latency = (ns_new - ns_last) - data-&gt;period_ns;	/* latency in ns */
+	ns_last = ns_new;
<span class="cx"> 
</span>-	latency = cycles_past - data-&gt;period_cclk;	/* latency in cycles */
-
<span class="cx"> 	DPRINTK("latecy is %lu\n", latency);
</span><span class="cx"> 
</span><span class="cx"> 	if (bfin_read_WDOG_STAT() != 0) {
</span>-		DPRINTK("timer_latency error!\n");
+		printk(KERN_ERR "timer_latency error!\n");
<span class="cx"> 		return IRQ_HANDLED;
</span><span class="cx"> 	}
</span><span class="cx"> 
</span>-	if (latency &gt; data-&gt;worst_latency)
-		data-&gt;worst_latency = latency;
-	data-&gt;last_latency = latency;
-	data-&gt;test_number++;
-	data-&gt;average_latency =
-	    ((data-&gt;average_latency * (data-&gt;test_number - 1)) +
-	     latency) / (data-&gt;test_number);
+	if (likely(warmup &lt;= 0)) {
+		if (latency &gt; data-&gt;worst_latency)
+			data-&gt;worst_latency = latency;
+		data-&gt;test_number++;
+		data-&gt;total_latency += latency;
+	} else
+		warmup--;
<span class="cx"> 
</span><span class="cx"> 	/* restart watchdog timer again */
</span><span class="cx"> 	bfin_write_WDOG_CNT(data-&gt;period_sclk);
</span>+	bfin_write_WDOG_CTL(0x4);
<span class="cx"> 
</span>-	__asm__(
-		"R2 = 0;\n\t"
-		"CYCLES = R2;\n\t"
-		"CYCLES2 = R2;\n\t"
-		"R2 = SYSCFG;\n\t"
-		"BITSET(R2,1);\n\t"
-		"P2.H = 0xffc0;\n\t"
-		"P2.L = 0x0200;\n\t"
-		"R3 = 0x0004;\n\t"
-		"W[P2] = R3;\n\t"     /* start watchdog timer */
-		"SYSCFG = R2;\n\t"    /* start cycles counter */
-		: : : "R2", "R3", "P2"
-		);
-
<span class="cx"> 	return IRQ_HANDLED;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines"> <at>  <at>  -186,8 +171,9  <at>  <at> 
</span><span class="cx"> 	/* default value is 0 (timer is stopped) */
</span><span class="cx"> 	timer_latency_data.value = 0;
</span><span class="cx"> 	timer_latency_data.worst_latency = 0;
</span>-	timer_latency_data.average_latency = 0;
-	timer_latency_data.last_latency = 0;
+	timer_latency_data.total_latency = 0;
+	warmup = WARM_CNT;
+	ns_new = ns_last = 0;
<span class="cx"> 
</span><span class="cx"> 	timer_latency_file-&gt;data = &amp;timer_latency_data;
</span><span class="cx"> 	timer_latency_file-&gt;read_proc = &amp;read_timer_latency;
</span><span class="lines"> <at>  <at>  -198,7 +184,6  <at>  <at> 
</span><span class="cx"> 		remove_proc_entry("timer_latency", NULL);
</span><span class="cx"> 		return -EBUSY;
</span><span class="cx"> 	}
</span>-
<span class="cx"> 	printk(KERN_INFO "timer_latency module loaded\n");
</span><span class="cx"> 
</span><span class="cx"> 	return 0;		/* everything's OK */
</span></span>
</div>
</div>

</div>
adamliyi | 3 Sep 23:56 2009

[7265] trunk/drivers/char/bfin_timer_latency.c: record time a little accurately.

<!-- #msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dl.meta dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; } #logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; } #logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; } #logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } #logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; } #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; } #logmsg pre { background: #eee; padding: 1em; } #logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;} #logmsg dl { margin: 0; } #logmsg dt { font-weight: bold; } #logmsg dd { margin: 0; padding: 0 0 0.5em 0; } #logmsg dd:before { content:'\00bb';} #logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; } #logmsg table th.Corner { text-align: left; } #logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} -->
Revision 7265 Author adamliyi Date 2009-09-03 17:56:15 -0400 (Thu, 03 Sep 2009)

Log Message

record time a little accurately.

Modified Paths

Diff

Modified: trunk/drivers/char/bfin_timer_latency.c (7264 => 7265)

--- trunk/drivers/char/bfin_timer_latency.c 2009-09-03 21:14:48 UTC (rev 7264) +++ trunk/drivers/char/bfin_timer_latency.c 2009-09-03 21:56:15 UTC (rev 7265) <at> <at> -59,7 +59,7 <at> <at> struct proc_dir_entry *timer_latency_file; struct timer_latency_data_t timer_latency_data; -static unsigned long long ns_new, ns_last; +static unsigned long long ns_start, ns_end; static unsigned long warmup; static int read_timer_latency(char *page, char **start, <at> <at> -111,8 +111,8 <at> <at> bfin_write_WDOG_CNT(timer_latency_data.period_sclk); /* start WDOT timer */ bfin_write_WDOG_CTL(0x4); - ns_last = sched_clock(); - ns_new = ns_last; + ns_start = sched_clock(); + ns_end = 0; } else if ((wd_period_us == 0) && timer_latency_data.value == 1) { DPRINTK("stop timer_latency\n"); timer_latency_data.value = 0; <at> <at> -130,13 +130,12 <at> <at> struct timer_latency_data_t *data = dev_id; unsigned long latency = 0; - ns_new = sched_clock(); + ns_end = sched_clock(); bfin_write_WDOG_CTL(0x8AD6); /* close counter */ bfin_write_WDOG_CTL(0x8AD6); /* have to write it twice to disable the timer */ - latency = (ns_new - ns_last) - data->period_ns; /* latency in ns */ - ns_last = ns_new; + latency = (ns_end - ns_start) - data->period_ns; /* latency in ns */ DPRINTK("latecy is %lu\n", latency); <at> <at> -156,7 +155,7 <at> <at> /* restart watchdog timer again */ bfin_write_WDOG_CNT(data->period_sclk); bfin_write_WDOG_CTL(0x4); - + ns_start = sched_clock(); return IRQ_HANDLED; } <at> <at> -173,7 +172,7 <at> <at> timer_latency_data.worst_latency = 0; timer_latency_data.total_latency = 0; warmup = WARM_CNT; - ns_new = ns_last = 0; + ns_start = ns_end = 0; timer_latency_file->data = &timer_latency_data; timer_latency_file->read_proc = &read_timer_latency;
<div>

&lt;!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg &gt; ul, #logmsg &gt; ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--&gt;<div>
Revision <a href="http://blackfin.uclinux.org/gf/project/linux-kernel/scmsvn/?action=browse&amp;path=/&amp;view=rev&amp;root=linux-kernel&amp;revision=7265">7265</a>
Author <a href="http://blackfin.uclinux.org/gf/user/adamliyi/">adamliyi</a>
Date 2009-09-03 17:56:15 -0400 (Thu, 03 Sep 2009)
<h3>Log Message</h3>
record time a little accurately.

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdriverscharbfin_timer_latencyc">trunk/drivers/char/bfin_timer_latency.c</a></li>
</ul>
</div>
<div>
<h3>Diff</h3>
<a></a>
<div class="modfile">
<h4>Modified: trunk/drivers/char/bfin_timer_latency.c (7264 =&gt; 7265)</h4>
<span>
<span class="info">--- trunk/drivers/char/bfin_timer_latency.c	2009-09-03 21:14:48 UTC (rev 7264)
+++ trunk/drivers/char/bfin_timer_latency.c	2009-09-03 21:56:15 UTC (rev 7265)
</span><span class="lines"> <at>  <at>  -59,7 +59,7  <at>  <at> 
</span><span class="cx"> struct proc_dir_entry *timer_latency_file;
</span><span class="cx"> struct timer_latency_data_t timer_latency_data;
</span><span class="cx"> 
</span>-static unsigned long long ns_new, ns_last;
+static unsigned long long ns_start, ns_end;
<span class="cx"> static unsigned long warmup;
</span><span class="cx"> 
</span><span class="cx"> static int read_timer_latency(char *page, char **start,
</span><span class="lines"> <at>  <at>  -111,8 +111,8  <at>  <at> 
</span><span class="cx"> 		bfin_write_WDOG_CNT(timer_latency_data.period_sclk);
</span><span class="cx"> 		/* start WDOT timer */
</span><span class="cx"> 		bfin_write_WDOG_CTL(0x4);
</span>-		ns_last = sched_clock();
-		ns_new = ns_last;
+		ns_start = sched_clock();
+		ns_end = 0;
<span class="cx"> 	} else if ((wd_period_us == 0) &amp;&amp; timer_latency_data.value == 1) {
</span><span class="cx"> 		DPRINTK("stop timer_latency\n");
</span><span class="cx"> 		timer_latency_data.value = 0;
</span><span class="lines"> <at>  <at>  -130,13 +130,12  <at>  <at> 
</span><span class="cx"> 	struct timer_latency_data_t *data = dev_id;
</span><span class="cx"> 	unsigned long latency = 0;
</span><span class="cx"> 
</span>-	ns_new = sched_clock();
+	ns_end = sched_clock();
<span class="cx"> 
</span><span class="cx"> 	bfin_write_WDOG_CTL(0x8AD6);	/* close counter */
</span><span class="cx"> 	bfin_write_WDOG_CTL(0x8AD6);	/* have to write it twice to disable the timer */
</span><span class="cx"> 
</span>-	latency = (ns_new - ns_last) - data-&gt;period_ns;	/* latency in ns */
-	ns_last = ns_new;
+	latency = (ns_end - ns_start) - data-&gt;period_ns;	/* latency in ns */
<span class="cx"> 
</span><span class="cx"> 	DPRINTK("latecy is %lu\n", latency);
</span><span class="cx"> 
</span><span class="lines"> <at>  <at>  -156,7 +155,7  <at>  <at> 
</span><span class="cx"> 	/* restart watchdog timer again */
</span><span class="cx"> 	bfin_write_WDOG_CNT(data-&gt;period_sclk);
</span><span class="cx"> 	bfin_write_WDOG_CTL(0x4);
</span>-
+	ns_start = sched_clock();
<span class="cx"> 	return IRQ_HANDLED;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines"> <at>  <at>  -173,7 +172,7  <at>  <at> 
</span><span class="cx"> 	timer_latency_data.worst_latency = 0;
</span><span class="cx"> 	timer_latency_data.total_latency = 0;
</span><span class="cx"> 	warmup = WARM_CNT;
</span>-	ns_new = ns_last = 0;
+	ns_start = ns_end = 0;
<span class="cx"> 
</span><span class="cx"> 	timer_latency_file-&gt;data = &amp;timer_latency_data;
</span><span class="cx"> 	timer_latency_file-&gt;read_proc = &amp;read_timer_latency;
</span></span>
</div>
</div>

</div>
adamliyi | 4 Sep 00:17 2009

[7266] trunk/drivers/char: Move this driver out of linux-kernel, into user/ blkfin-drvs.

<!-- #msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dl.meta dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; } #logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; } #logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; } #logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } #logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; } #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; } #logmsg pre { background: #eee; padding: 1em; } #logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;} #logmsg dl { margin: 0; } #logmsg dt { font-weight: bold; } #logmsg dd { margin: 0; padding: 0 0 0.5em 0; } #logmsg dd:before { content:'\00bb';} #logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; } #logmsg table th.Corner { text-align: left; } #logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} -->
Revision 7266 Author adamliyi Date 2009-09-03 18:17:21 -0400 (Thu, 03 Sep 2009)

Log Message

Move this driver out of linux-kernel, into user/blkfin-drvs. This is a simple driver for testing irq latency only.

Modified Paths

Removed Paths

Diff

Modified: trunk/drivers/char/Kconfig (7265 => 7266)

--- trunk/drivers/char/Kconfig 2009-09-03 21:56:15 UTC (rev 7265) +++ trunk/drivers/char/Kconfig 2009-09-03 22:17:21 UTC (rev 7266) <at> <at> -63,11 +63,6 <at> <at> If unsure, then say N. -config BFIN_TIMER_LATENCY - tristate "Blackfin interrupt latency test" - depends on BLACKFIN - default n - config BFIN_TWI_LCD tristate "TWI/I2C LCD support for HD44780 based LCD modules" depends on I2C && EXPERIMENTAL && BLACKFIN

Modified: trunk/drivers/char/Makefile (7265 => 7266)

--- trunk/drivers/char/Makefile 2009-09-03 21:56:15 UTC (rev 7265) +++ trunk/drivers/char/Makefile 2009-09-03 22:17:21 UTC (rev 7266) <at> <at> -70,7 +70,6 <at> <at> obj-$(CONFIG_BFIN_SIMPLE_TIMER) += bfin_simple_timer.o obj-$(CONFIG_BFIN_SPI_ADC) += bfin_spi_adc.o obj-$(CONFIG_BFIN_SPORT) += bfin_sport.o -obj-$(CONFIG_BFIN_TIMER_LATENCY) += bfin_timer_latency.o obj-$(CONFIG_BFIN_TWI_LCD) += bfin_twi_lcd.o obj-$(CONFIG_PRINTER) += lp.o

Deleted: trunk/drivers/char/bfin_timer_latency.c (7265 => 7266)

--- trunk/drivers/char/bfin_timer_latency.c 2009-09-03 21:56:15 UTC (rev 7265) +++ trunk/drivers/char/bfin_timer_latency.c 2009-09-03 22:17:21 UTC (rev 7266) <at> <at> -1,203 +0,0 <at> <at> -/* - * File: drivers/char/bfin_timer_latency.c - * Based on: - * Author: Luke Yang - * - * Created: - * Description: Simple driver for testing interrupt latencies. - * - * Modified: - * Copyright 2005-2006 Analog Devices Inc. - * - * Bugs: Enter bugs at http://blackfin.uclinux.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see the file COPYING, or write - * to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/sched.h> -#include <linux/interrupt.h> -#include <linux/init.h> -#include <linux/proc_fs.h> -#include <asm/uaccess.h> -#include <asm/blackfin.h> -#include <asm/irq.h> - -#undef DEBUG - -#ifdef DEBUG -# define DPRINTK(x...) printk(KERN_DEBUG x) -#else -# define DPRINTK(x...) do { } while (0) -#endif - -#define WARM_CNT 0 - -struct timer_latency_data_t { - char value; - unsigned long worst_latency; - unsigned long long total_latency; - unsigned long test_number; - unsigned int period_sclk; - unsigned int period_ns; -}; - -struct proc_dir_entry *timer_latency_file; -struct timer_latency_data_t timer_latency_data; - -static unsigned long long ns_start, ns_end; -static unsigned long warmup; - -static int read_timer_latency(char *page, char **start, - off_t offset, int count, int *eof, void *data) -{ - unsigned long long average_latency = timer_latency_data.total_latency; - - if (likely(timer_latency_data.test_number > 0)) - do_div(average_latency, timer_latency_data.test_number); - - return sprintf(page, - "number, worst latency(ns), average latency(ns)\n" - "%lu, %lu, %llu\n", - timer_latency_data.test_number, - timer_latency_data.worst_latency, average_latency); -} - -static int write_timer_latency(struct file *file, const char *buffer, - unsigned long count, void *data) -{ - unsigned long sclk; - char user_value[8] = {'\0'}; - unsigned int wd_period_us; - - if (count > sizeof(user_value) - 1) - return -EINVAL; - - if (copy_from_user(user_value, buffer, count) != 0) - return -EFAULT; - - user_value[count] = '\0'; - - wd_period_us = simple_strtoul(user_value, NULL, 0); - - if ((wd_period_us >= 100) && (timer_latency_data.value == 0)) { - DPRINTK("start timer_latency: period: %d us\n", wd_period_us); - timer_latency_data.value = 1; - sclk = get_sclk() / 1000000; - - timer_latency_data.period_sclk = wd_period_us * sclk; - timer_latency_data.period_ns = wd_period_us * 1000; - - timer_latency_data.worst_latency = 0; - timer_latency_data.total_latency = 0; - timer_latency_data.test_number = 0; - warmup = WARM_CNT; - - /* set count timer cycles */ - bfin_write_WDOG_CNT(timer_latency_data.period_sclk); - /* start WDOT timer */ - bfin_write_WDOG_CTL(0x4); - ns_start = sched_clock(); - ns_end = 0; - } else if ((wd_period_us == 0) && timer_latency_data.value == 1) { - DPRINTK("stop timer_latency\n"); - timer_latency_data.value = 0; - - bfin_write_WDOG_CTL(0x8AD6); /* close counter */ - bfin_write_WDOG_CTL(0x8AD6); /* have to write it twice to disable the timer */ - } - - return count; /* always write 1 byte */ -} - - -static irqreturn_t timer_latency_irq(int irq, void *dev_id) -{ - struct timer_latency_data_t *data = dev_id; - unsigned long latency = 0; - - ns_end = sched_clock(); - - bfin_write_WDOG_CTL(0x8AD6); /* close counter */ - bfin_write_WDOG_CTL(0x8AD6); /* have to write it twice to disable the timer */ - - latency = (ns_end - ns_start) - data->period_ns; /* latency in ns */ - - DPRINTK("latecy is %lu\n", latency); - - if (bfin_read_WDOG_STAT() != 0) { - printk(KERN_ERR "timer_latency error!\n"); - return IRQ_HANDLED; - } - - if (likely(warmup <= 0)) { - if (latency > data->worst_latency) - data->worst_latency = latency; - data->test_number++; - data->total_latency += latency; - } else - warmup--; - - /* restart watchdog timer again */ - bfin_write_WDOG_CNT(data->period_sclk); - bfin_write_WDOG_CTL(0x4); - ns_start = sched_clock(); - return IRQ_HANDLED; -} - -static int __init timer_latency_init(void) -{ - DPRINTK("timer_latency start!\n"); - - timer_latency_file = create_proc_entry("timer_latency", 0666, NULL); - if (timer_latency_file == NULL) - return -ENOMEM; - - /* default value is 0 (timer is stopped) */ - timer_latency_data.value = 0; - timer_latency_data.worst_latency = 0; - timer_latency_data.total_latency = 0; - warmup = WARM_CNT; - ns_start = ns_end = 0; - - timer_latency_file->data = &timer_latency_data; - timer_latency_file->read_proc = &read_timer_latency; - timer_latency_file->write_proc = &write_timer_latency; - - if (request_irq(IRQ_WATCH, timer_latency_irq, IRQF_DISABLED, - "timer_latency", &timer_latency_data)) { - remove_proc_entry("timer_latency", NULL); - return -EBUSY; - } - printk(KERN_INFO "timer_latency module loaded\n"); - - return 0; /* everything's OK */ -} - -static void __exit timer_latency_exit(void) -{ - remove_proc_entry("timer_latency", NULL); - free_irq(IRQ_WATCH, NULL); - printk(KERN_INFO "timer_latency module removed\n"); -} - -module_init(timer_latency_init); -module_exit(timer_latency_exit); - -MODULE_AUTHOR("Luke Yang"); -MODULE_DESCRIPTION("Timer Latency testing module"); -MODULE_LICENSE("GPL");
<div>

&lt;!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg &gt; ul, #logmsg &gt; ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--&gt;<div>
Revision <a href="http://blackfin.uclinux.org/gf/project/linux-kernel/scmsvn/?action=browse&amp;path=/&amp;view=rev&amp;root=linux-kernel&amp;revision=7266">7266</a>
Author <a href="http://blackfin.uclinux.org/gf/user/adamliyi/">adamliyi</a>
Date 2009-09-03 18:17:21 -0400 (Thu, 03 Sep 2009)
<h3>Log Message</h3>
Move this driver out of linux-kernel, into user/blkfin-drvs.
This is a simple driver for testing irq latency only.

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdriverscharKconfig">trunk/drivers/char/Kconfig</a></li>
<li><a href="#trunkdriverscharMakefile">trunk/drivers/char/Makefile</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkdriverscharbfin_timer_latencyc">trunk/drivers/char/bfin_timer_latency.c</a></li>
</ul>
</div>
<div>
<h3>Diff</h3>
<a></a>
<div class="modfile">
<h4>Modified: trunk/drivers/char/Kconfig (7265 =&gt; 7266)</h4>
<span>
<span class="info">--- trunk/drivers/char/Kconfig	2009-09-03 21:56:15 UTC (rev 7265)
+++ trunk/drivers/char/Kconfig	2009-09-03 22:17:21 UTC (rev 7266)
</span><span class="lines"> <at>  <at>  -63,11 +63,6  <at>  <at> 
</span><span class="cx"> 
</span><span class="cx"> 	  If unsure, then say N.
</span><span class="cx"> 
</span>-config BFIN_TIMER_LATENCY
-	tristate "Blackfin interrupt latency test"
-	depends on BLACKFIN
-	default n
-
<span class="cx"> config BFIN_TWI_LCD
</span><span class="cx"> 	tristate "TWI/I2C LCD support for HD44780 based LCD modules"
</span><span class="cx"> 	depends on I2C &amp;&amp; EXPERIMENTAL &amp;&amp; BLACKFIN
</span></span>
</div>
<a></a>
<div class="modfile">
<h4>Modified: trunk/drivers/char/Makefile (7265 =&gt; 7266)</h4>
<span>
<span class="info">--- trunk/drivers/char/Makefile	2009-09-03 21:56:15 UTC (rev 7265)
+++ trunk/drivers/char/Makefile	2009-09-03 22:17:21 UTC (rev 7266)
</span><span class="lines"> <at>  <at>  -70,7 +70,6  <at>  <at> 
</span><span class="cx"> obj-$(CONFIG_BFIN_SIMPLE_TIMER)	+= bfin_simple_timer.o
</span><span class="cx"> obj-$(CONFIG_BFIN_SPI_ADC)	+= bfin_spi_adc.o
</span><span class="cx"> obj-$(CONFIG_BFIN_SPORT)	+= bfin_sport.o
</span>-obj-$(CONFIG_BFIN_TIMER_LATENCY) += bfin_timer_latency.o
<span class="cx"> obj-$(CONFIG_BFIN_TWI_LCD)	+= bfin_twi_lcd.o
</span><span class="cx"> 
</span><span class="cx"> obj-$(CONFIG_PRINTER)		+= lp.o
</span></span>
</div>
<a></a>
<div class="delfile">
<h4>Deleted: trunk/drivers/char/bfin_timer_latency.c (7265 =&gt; 7266)</h4>
<span>
<span class="info">--- trunk/drivers/char/bfin_timer_latency.c	2009-09-03 21:56:15 UTC (rev 7265)
+++ trunk/drivers/char/bfin_timer_latency.c	2009-09-03 22:17:21 UTC (rev 7266)
</span><span class="lines"> <at>  <at>  -1,203 +0,0  <at>  <at> 
</span>-/*
- * File:         drivers/char/bfin_timer_latency.c
- * Based on:
- * Author:       Luke Yang
- *
- * Created:
- * Description:  Simple driver for testing interrupt latencies.
- *
- * Modified:
- *               Copyright 2005-2006 Analog Devices Inc.
- *
- * Bugs:         Enter bugs at http://blackfin.uclinux.org/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see the file COPYING, or write
- * to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include &lt;linux/module.h&gt;
-#include &lt;linux/kernel.h&gt;
-#include &lt;linux/sched.h&gt;
-#include &lt;linux/interrupt.h&gt;
-#include &lt;linux/init.h&gt;
-#include &lt;linux/proc_fs.h&gt;
-#include &lt;asm/uaccess.h&gt;
-#include &lt;asm/blackfin.h&gt;
-#include &lt;asm/irq.h&gt;
-
-#undef DEBUG
-
-#ifdef DEBUG
-# define DPRINTK(x...)	printk(KERN_DEBUG x)
-#else
-# define DPRINTK(x...)	do { } while (0)
-#endif
-
-#define WARM_CNT 0
-
-struct timer_latency_data_t {
-	char value;
-	unsigned long worst_latency;
-	unsigned long long total_latency;
-	unsigned long test_number;
-	unsigned int period_sclk;
-	unsigned int period_ns;
-};
-
-struct proc_dir_entry *timer_latency_file;
-struct timer_latency_data_t timer_latency_data;
-
-static unsigned long long ns_start, ns_end;
-static unsigned long warmup;
-
-static int read_timer_latency(char *page, char **start,
-			      off_t offset, int count, int *eof, void *data)
-{
-	unsigned long long average_latency = timer_latency_data.total_latency;
-
-	if (likely(timer_latency_data.test_number &gt; 0))
-		do_div(average_latency, timer_latency_data.test_number);
-
-	return sprintf(page,
-		       "number,   worst latency(ns), average latency(ns)\n"
-			"%lu,      %lu,          %llu\n",
-			timer_latency_data.test_number,
-			timer_latency_data.worst_latency, average_latency);
-}
-
-static int write_timer_latency(struct file *file, const char *buffer,
-			       unsigned long count, void *data)
-{
-	unsigned long sclk;
-	char user_value[8] = {'\0'};
-	unsigned int wd_period_us;
-
-	if (count &gt; sizeof(user_value) - 1)
-		return -EINVAL;
-
-	if (copy_from_user(user_value, buffer, count) != 0)
-		return -EFAULT;
-
-	user_value[count] = '\0';
-
-	wd_period_us = simple_strtoul(user_value, NULL, 0);
-
-	if ((wd_period_us &gt;= 100) &amp;&amp; (timer_latency_data.value == 0)) {
-		DPRINTK("start timer_latency: period: %d us\n", wd_period_us);
-		timer_latency_data.value = 1;
-		sclk = get_sclk() / 1000000;
-
-		timer_latency_data.period_sclk = wd_period_us * sclk;
-		timer_latency_data.period_ns = wd_period_us * 1000;
-
-		timer_latency_data.worst_latency = 0;
-		timer_latency_data.total_latency = 0;
-		timer_latency_data.test_number = 0;
-		warmup = WARM_CNT;
-
-		/* set count timer cycles */
-		bfin_write_WDOG_CNT(timer_latency_data.period_sclk);
-		/* start WDOT timer */
-		bfin_write_WDOG_CTL(0x4);
-		ns_start = sched_clock();
-		ns_end = 0;
-	} else if ((wd_period_us == 0) &amp;&amp; timer_latency_data.value == 1) {
-		DPRINTK("stop timer_latency\n");
-		timer_latency_data.value = 0;
-
-		bfin_write_WDOG_CTL(0x8AD6);	/* close counter */
-		bfin_write_WDOG_CTL(0x8AD6);	/* have to write it twice to disable the timer */
-	}
-
-	return count;		/* always write 1 byte */
-}
-
-
-static irqreturn_t timer_latency_irq(int irq, void *dev_id)
-{
-	struct timer_latency_data_t *data = dev_id;
-	unsigned long latency = 0;
-
-	ns_end = sched_clock();
-
-	bfin_write_WDOG_CTL(0x8AD6);	/* close counter */
-	bfin_write_WDOG_CTL(0x8AD6);	/* have to write it twice to disable the timer */
-
-	latency = (ns_end - ns_start) - data-&gt;period_ns;	/* latency in ns */
-
-	DPRINTK("latecy is %lu\n", latency);
-
-	if (bfin_read_WDOG_STAT() != 0) {
-		printk(KERN_ERR "timer_latency error!\n");
-		return IRQ_HANDLED;
-	}
-
-	if (likely(warmup &lt;= 0)) {
-		if (latency &gt; data-&gt;worst_latency)
-			data-&gt;worst_latency = latency;
-		data-&gt;test_number++;
-		data-&gt;total_latency += latency;
-	} else
-		warmup--;
-
-	/* restart watchdog timer again */
-	bfin_write_WDOG_CNT(data-&gt;period_sclk);
-	bfin_write_WDOG_CTL(0x4);
-	ns_start = sched_clock();
-	return IRQ_HANDLED;
-}
-
-static int __init timer_latency_init(void)
-{
-	DPRINTK("timer_latency start!\n");
-
-	timer_latency_file = create_proc_entry("timer_latency", 0666, NULL);
-	if (timer_latency_file == NULL)
-		return -ENOMEM;
-
-	/* default value is 0 (timer is stopped) */
-	timer_latency_data.value = 0;
-	timer_latency_data.worst_latency = 0;
-	timer_latency_data.total_latency = 0;
-	warmup = WARM_CNT;
-	ns_start = ns_end = 0;
-
-	timer_latency_file-&gt;data = &amp;timer_latency_data;
-	timer_latency_file-&gt;read_proc = &amp;read_timer_latency;
-	timer_latency_file-&gt;write_proc = &amp;write_timer_latency;
-
-	if (request_irq(IRQ_WATCH, timer_latency_irq, IRQF_DISABLED,
-	                "timer_latency", &amp;timer_latency_data)) {
-		remove_proc_entry("timer_latency", NULL);
-		return -EBUSY;
-	}
-	printk(KERN_INFO "timer_latency module loaded\n");
-
-	return 0;		/* everything's OK */
-}
-
-static void __exit timer_latency_exit(void)
-{
-	remove_proc_entry("timer_latency", NULL);
-	free_irq(IRQ_WATCH, NULL);
-	printk(KERN_INFO "timer_latency module removed\n");
-}
-
-module_init(timer_latency_init);
-module_exit(timer_latency_exit);
-
-MODULE_AUTHOR("Luke Yang");
-MODULE_DESCRIPTION("Timer Latency testing module");
-MODULE_LICENSE("GPL");
</span>
</div>
</div>

</div>

Gmane