Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Linux I 2 C Subsystem Jean Delvare Suse L3 Support

Similar presentations


Presentation on theme: "The Linux I 2 C Subsystem Jean Delvare Suse L3 Support"— Presentation transcript:

1 The Linux I 2 C Subsystem Jean Delvare Suse L3 Support jdelvare@suse.de

2 © Novell, Inc. All rights reserved. 2 What is I 2 C? I 2 C (Inter-Integrated Circuit) is a multi-master, serial, single-ended computer bus invented by Philips, that is used to attach low-speed peripherals to a motherboard, embedded system, or cellphone. SMBus (System Management Bus) is a subset of I 2 C that defines stricter electrical and protocol conventions. TWI (Two-Wire Interface), ACCESS.bus and DDC (Display Data Channel) are basically the same as I 2 C.

3 © Novell, Inc. All rights reserved. 3 Usages of I 2 C in your computer On the motherboard (SMBus) – SPD EEPROM on the memory modules – Hardware monitoring – Clock chips, voltage regulators, etc. On the graphics adapter (DDC and I 2 C) – Monitor information and control over VGA/DVI – Thermal sensors On the TV adapter (I 2 C) – Tuner, video encoder, video decoder, audio decoder, etc.

4 © Novell, Inc. All rights reserved. 4 SMBus in your computer (example) Host controller EEPROM (memory modules) Sensor chip 0x5 0 0x5 1 0x5 2 0x2 d

5 © Novell, Inc. All rights reserved. 5 History of the Linux i2c subsystem April 1998: Implementation by Gerd Knorr (kernel v2.1.94) December 1998: Out-of-tree implementation by Simon G. Vogl, part of lm-sensors 2 December 1999: Merged into the kernel tree (v2.3.34), still part of the lm-sensors project Gerd Knorr's implementation finally dropped (v2.5.29) March to May 2003: Migrated to the Linux 2.5 device driver model by Greg KH (v2.5.66 to v2.5.70) May 2007 to April 2008: Properly integrated into the standard device driver model by David Brownell and Jean Delvare (v2.6.22 to v2.6.25)

6 © Novell, Inc. All rights reserved. 6 Why I 2 C sucks I 2 C lacks device enumeration I 2 C lacks a standard method for device presence detection I 2 C lacks standard identification registers I 2 C lacks clear semantics of what's a read and what's a write! We can't count on automatic device instantiation. How do we instantiate devices?

7 © Novell, Inc. All rights reserved. 7 Why SMBus sucks less (but still) SMBus has an ARP mechanism for both device enumeration and identification, – but it's optional. SMBus has a standard subset of bus transactions, with mostly clear semantics, – but not all chips follow the SMBus standard, – and there is still room for confusion

8 © Novell, Inc. All rights reserved. 8 Binding model migration Legacy model: – Each driver detects and instantiates its own devices – Instantiation from user-space handled by each the driver – No alternative! Standard model: – Devices are instantiated outside drivers – Instantiation from user-space is centralized – For backwards compatibility, drivers can detect their devices and ask i2c-core to instantiate them – Various ways to instantiate devices

9 Future developments

10 © Novell, Inc. All rights reserved. 1010 Remaining issues The i2c-dev driver (user-space access to I 2 C devices) is still not migrated to the new binding model – Full of race conditions – Needs a complete redesign – Missing features (e.g. exclusive bus access) Legacy attributes of i2c adapters (retries, timeout) are unclear – Need to be clarified – Do we care about backwards compatibility? – Move handling to i2c-core

11 © Novell, Inc. All rights reserved. 1 Missing features SMBus Alert – Done! ☺ by David Brownell and Jean Delvare, merged in kernel 2.6.34 Bus multiplexing – Work in progress by Rodolfo Giometti, Michael Lawnick and Jean Delvare, ready for kernel 2.6.36 SMBus ARP (Address Resolution Protocol) – Work in progress by Corentin Labbe, long way to go

12 © Novell, Inc. All rights reserved. 1212 I 2 C multiplexing, why? Host controller LM63 sensor chip (for CPU0) 0x4 c LM63 sensor chip (for CPU1) Address collision! bus_id = 0-004c Switch i2c-0

13 © Novell, Inc. All rights reserved. 1313 I 2 C Multiplexing, how? Problem: the i2c subsystem's bus_id format assumes unique device addresses on every single i2c_adapter. Solution #1: just change the bus_id format! – Not possible: user-space relies on it. Solution #2: cheat on addresses! – Not possible: only 16 bits in format for the address, needed for 10-bit addressing extension; and wouldn't cover the case of cascaded switches. Solution #3: cheat on bus numbers! – This works: just claim that struct i2c_adapter now represents an I 2 C bus segment rather than an I 2 C bus controller.

14 © Novell, Inc. All rights reserved. 1414 I 2 C multiplexing implementation Host controller LM63 sensor chip (for CPU0) 0x4c, bus_id = 1- 004c 0x4c, bus_id = 2- 004c LM63 sensor chip (for CPU1) Switch i2c-0 i2c-1 i2c-2

15 © Novell, Inc. All rights reserved. 1515 Questions?

16 General Disclaimer This document is not to be construed as a promise by any participating company to develop, deliver, or market a product. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. Novell, Inc. makes no representations or warranties with respect to the contents of this document, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. The development, release, and timing of features or functionality described for Novell products remains at the sole discretion of Novell. Further, Novell, Inc. reserves the right to revise this document and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes. All Novell marks referenced in this presentation are trademarks or registered trademarks of Novell, Inc. in the United States and other countries. All third-party trademarks are the property of their respective owners.


Download ppt "The Linux I 2 C Subsystem Jean Delvare Suse L3 Support"

Similar presentations


Ads by Google