<html>
<head>
<title>Samsung Enterprise Portal mySingle</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<style id="mysingle_style" type="text/css">
p, td, li {font-family:Verdana, arial; font-size:10pt; margin-top:5px;margin-bottom:5px;} body{margin:10px 10px 10px 10px; line-height:1.4; font-family:Verdana, arial; font-size:10pt;}</style>
</head>
<body style="FONT-FAMILY: Arial; WORD-WRAP: break-word; FONT-SIZE: 10pt">
<p> Below are the links on multi master bus arbitration.</p>
<p> <a href="http://comments.gmane.org/gmane.linux.kernel/1410276">http://comments.gmane.org/gmane.linux.kernel/1410276</a></p>
<p> <a href="http://www.kernelhub.org/?msg=179505&p=2">http://www.kernelhub.org/?msg=179505&p=2</a></p>
<p> </p>
<p>------- <b>Original Message</b> -------</p>
<p><b>Sender</b> : Yuvaraj Kumar C D<yuvaraj.cd@gmail.com></p>
<p><b>Date</b> : Feb 04, 2013 14:33 (GMT+05:30)</p>
<p><b>Title</b> : [RFC] i2c: Providing hooks for i2c multimaster bus arbitration.</p>
<p> </p>This RFC patch is w.r.t multimaster bus arbitration which is already<br />
being discussing in the mainline.<br />
This patch provides hooks for the i2c multimaster bus arbitration<br />
and to have the arbitration parameters.<br />
<br />
Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com /><br />
---<br />
drivers/i2c/i2c-core.c | 13 ++++++++++++-<br />
include/linux/i2c.h | 12 ++++++++++++<br />
2 files changed, 24 insertions(+), 1 deletion(-)<br />
<br />
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c<br />
index e388590..ed89fc8 100644<br />
--- a/drivers/i2c/i2c-core.c<br />
+++ b/drivers/i2c/i2c-core.c<br />
@@ -1408,18 +1408,29 @@ int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)<br />
(msgs[ret].flags & I2C_M_RECV_LEN) ? "+" : "");<br />
}<br />
#endif<br />
+ if (adap->mm_arbit_algo) {<br />
+ ret = adap->mm_arbit_algo->i2c_mm_bus_get(adap);<br />
+ if (ret)<br />
+ /* I2C bus under control of another master. */<br />
+ return -EAGAIN;<br />
+ }<br />
<br />
if (in_atomic() || irqs_disabled()) {<br />
ret = i2c_trylock_adapter(adap);<br />
- if (!ret)<br />
+ if (!ret && adap->mm_arbit_algo) {<br />
+ adap->mm_arbit_algo->i2c_mm_bus_release(adap);<br />
+<br />
/* I2C activity is ongoing. */<br />
return -EAGAIN;<br />
+ }<br />
} else {<br />
i2c_lock_adapter(adap);<br />
}<br />
<br />
ret = __i2c_transfer(adap, msgs, num);<br />
i2c_unlock_adapter(adap);<br />
+ if (adap->mm_arbit_algo)<br />
+ adap->mm_arbit_algo->i2c_mm_bus_release(adap);<br />
<br />
return ret;<br />
} else {<br />
diff --git a/include/linux/i2c.h b/include/linux/i2c.h<br />
index d0c4db7..61fbfe3 100644<br />
--- a/include/linux/i2c.h<br />
+++ b/include/linux/i2c.h<br />
@@ -371,6 +371,17 @@ struct i2c_algorithm {<br />
};<br />
<br />
/*<br />
+ *This struct provides hooks for i2c multi-master arbitration needs.<br />
+ */<br />
+struct i2c_mm_arbitration {<br />
+ void *arbitration_data;<br />
+<br />
+ /* Should return 0 if mastership could be successfully established */<br />
+ int (*i2c_mm_bus_get)(struct i2c_adapter *adap);<br />
+ void (*i2c_mm_bus_release)(struct i2c_adapter *adap);<br />
+};<br />
+<br />
+/*<br />
* i2c_adapter is the structure used to identify a physical i2c bus along<br />
* with the access algorithms necessary to access it.<br />
*/<br />
@@ -393,6 +404,7 @@ struct i2c_adapter {<br />
<br />
struct mutex userspace_clients_lock;<br />
struct list_head userspace_clients;<br />
+ struct i2c_mm_arbitration *mm_arbit_algo;<br />
};<br />
#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)<br />
<br />
-- <br />
1.7.9.5<br />
<br />
<p> </p>
<p> </p><!--SP:yuvaraj.cd-->
<p> </p><!--yuvaraj.cd:EP-->
<p> </p>
<table id="confidentialsignimg">
<tbody>
<tr>
<td namo_lock="namo_lock">
<p><img width="520" src="cid:1CA8977932ED416E9D8527468A2126E80@samsung.net" border="0" alt="" /></p></td>
</tr>
</tbody>
</table>
</body>
</html><img src='http://ext.samsung.net/mailcheck/SeenTimeChecker?do=548ca598d6284e2a104116df5687f33dac4492158f2efd6a426746bc0fd021435d77a2a5df5ab1ed9a776fdb80b3978f29eb62efa68a00e3d3be83cd393095bc49e5ff3dfdc8681d76f80bf81d31c863cf878f9a26ce15a0' border=0 width=0 height=0 style='display:none'>