File i2c-tools-hackweek-9-dependencies.diff of Package python-smbus

Subject: decode-dimms: Backport two functions
Upstream: yes, r6079 (partial), r6093 (partial), r6095 (partial)

Backport functions as_ddr() and ddr_core_timings() which are needed
by the hackweek 9 code.
---
 eeprom/decode-dimms |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

--- a/eeprom/decode-dimms
+++ b/eeprom/decode-dimms
@@ -826,6 +826,22 @@ sub decode_sdr_sdram($)
 		    (($bytes->[35] >> 7) ? -$temp : $temp) . " ns");
 }
 
+sub as_ddr($$)
+{
+	my ($gen, $ctime) = @_;
+
+	return " as DDR" . ($gen == 1 ? "" : $gen) . "-" .
+	       int(2000 / $ctime);
+}
+
+sub ddr_core_timings($$$$$)
+{
+	my ($cas, $ctime, $trcd, $trp, $tras) = @_;
+
+	return $cas . "-" . ceil($trcd/$ctime) . "-" . ceil($trp/$ctime) .
+		"-" . ceil($tras/$ctime);
+}
+
 # Parameter: EEPROM bytes 0-127 (using 3-62)
 sub decode_ddr_sdram($)
 {