linux i2c in the 21st century · 2019-10-29  · wolfram sang, renesas / consultant linux i2c in...

Post on 07-Oct-2020

0 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Linux I2C in the 21st century

Wolfram Sang, Renesas / Consultant

29.10.2019, ELCE 2019

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 1 / 27

1 Workflow

2 Modern complex setups

3 API changes

4 New fault injectors

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 2 / 27

Workflow

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 3 / 27

I2C: its simplicity is a problem

What could go wrong?specs didn’t change much since 1982definately not rocket science1

drivers are (relatively) simple

So, do an IP core, dump the driver, move on…

I2C is a good examplea Fly-by subsystemmostly used by embeddedlargely maintained in spare time

1yet, gory details are everywhereWolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 4 / 27

I2C: its simplicity is a problem

What could go wrong?specs didn’t change much since 1982definately not rocket science1

drivers are (relatively) simple

So, do an IP core, dump the driver, move on…

I2C is a good examplea Fly-by subsystemmostly used by embeddedlargely maintained in spare time

1yet, gory details are everywhereWolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 4 / 27

Growth of I2C bus master drivers

0

20

40

60

80

100

120

140

v3.0 v3.5 v3.10 v3.15 v4.0 v4.5 v4.10 v4.15 v4.20

2011 2012 2013 2014 2015 2016 2017 2018 2018

number of files in drivers/i2c/busses

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 5 / 27

Group maintainership

Which group???

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 6 / 27

Group maintainership

Which group???

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 6 / 27

Not that I tried…

From: Wolfram Sang <wsa@the-dreams.de>Subject: I2C delay due to maintainer illness

sadly, I have been tied to bed for a few days now, not in a condition toreally work on I2C...

I think it is annoying, sure, but no catastrophe. However, it shows thatI am the single-point-of-failure for I2C patches, what I don't like.Like I said before, I am open to group maintainership. If you think youare a reliable candidate, please get in touch with me.

“Get well soon!”

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 7 / 27

Not that I tried…

From: Wolfram Sang <wsa@the-dreams.de>Subject: I2C delay due to maintainer illness

sadly, I have been tied to bed for a few days now, not in a condition toreally work on I2C...

I think it is annoying, sure, but no catastrophe. However, it shows thatI am the single-point-of-failure for I2C patches, what I don't like.Like I said before, I am open to group maintainership. If you think youare a reliable candidate, please get in touch with me.

“Get well soon!”

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 7 / 27

Divide & conquer to the extreme

I2C SUBSYSTEMM: Wolfram Sang <wsa@the-dreams.de>L: linux-i2c@vger.kernel.org...S: Maintained

I2C SUBSYSTEM HOST DRIVERSL: linux-i2c@vger.kernel.org...S: Odd Fixes

66 drivers have dedicated maintainers now

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 8 / 27

Divide & conquer to the extreme

I2C SUBSYSTEMM: Wolfram Sang <wsa@the-dreams.de>L: linux-i2c@vger.kernel.org...S: Maintained

I2C SUBSYSTEM HOST DRIVERSL: linux-i2c@vger.kernel.org...S: Odd Fixes

66 drivers have dedicated maintainers now

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 8 / 27

My companions

I2C ACPI SUPPORTM: Mika Westerberg <mika.westerberg@linux.intel.com>S: Maintained

I2C MUXESM: Peter Rosin <peda@axentia.se>S: Maintained

I2C/SMBUS CONTROLLER DRIVERS FOR PCM: Jean Delvare <jdelvare@suse.com>S: Maintained

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 9 / 27

THE Linux I2C supporter

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 10 / 27

Modern complex setups

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 11 / 27

GMSL

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 12 / 27

GMSL - the whole truth

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 13 / 27

API changes

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 14 / 27

API changes: retval for i2c_new_*

- NULL+ ERR_PTR

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 15 / 27

API changes: retval conversions

- i2c_new_dummy+ i2c_new_dummy_device (done)

- i2c_new_secondary_device+ i2c_new_ancillary_device(done)

- i2c_new_device+ i2c_new_client_device (WIP)

- i2c_new_probed_device+ ??? (TBD)

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 16 / 27

API changes: more devm_*

+ devm_i2c_new_client_device (TBD)

+ devm_i2c_new_dummy_device (done)

+ devm_i2c_new_ancillary_device (TBD)

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 17 / 27

API suggestion

- i2c_new_dummy_device- (client->adapter, addr)

+ i2c_new_ancillary_device+ (client, name, default_addr)

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 18 / 27

New atomic callbacks

+ int (*master_xfer_atomic)(...)

+ int (*smbus_xfer_atomic)(...)

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 19 / 27

New fault injectors

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 20 / 27

incomplete_write_byte

Figure 1: Scoped with sigrok

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 21 / 27

Dangerous! The unintended write

Figure 2: Scoped with sigrok

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 22 / 27

much better!

Figure 3: Scoped with sigrok

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 23 / 27

inject_panic

from the docs2:“This fault injector will create a Kernel panic once the master under teststarted a transfer. This usually means that the state machine of the busmaster driver will be ungracefully interrupted and the bus may end up inan unusual state. Use this to check if your shutdown/reboot/boot codecan handle this scenario.”

Remember the atomic transfers?

2Documentation/i2c/gpio-fault-injection.rstWolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 24 / 27

lose_arbitration

from the docs3:“Here, we want to simulate the condition where the master under testloses the bus arbitration against another master in a multi-master setup.”

As simple as:

$ echo 200 > lose_arbitration &$ i2cget -y <bus_to_test> 0x3f

3Documentation/i2c/gpio-fault-injection.rstWolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 25 / 27

The End

Questions? Comments?Questions?

Right here, right now…At the conferencewsa@the-dreams.de

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 26 / 27

References

Renesas Electronics Logo

Wolfram Sang, Renesas / Consultant Linux I2C in the 21st century 29.10.2019, ELCE 2019 27 / 27

top related