Odroid-C1/C2: Add I2C support for mainline kernel

This patch makes it uses /dev/i2c-0 node if its kernel version is above 4.y.z.

Signed-off-by: Deokgyu Yang <secugyu@gmail.com>
Change-Id: I2d8d30f019465eb883b323d73e81a1ce086e85d8
This commit is contained in:
Deokgyu Yang
2020-09-07 17:51:46 +09:00
parent 141eec2565
commit 54aca3f6a3
2 changed files with 8 additions and 2 deletions

View File

@@ -204,7 +204,10 @@ static void doI2Cdetect (UNU int argc, char *argv [])
switch (model) {
case MODEL_ODROID_C1:
case MODEL_ODROID_C2:
port = 1;
if (cmpKernelVersion(KERN_NUM_TO_MAJOR, 4))
port = 0;
else
port = 1;
break;
case MODEL_ODROID_XU3:
if (cmpKernelVersion(KERN_NUM_TO_MAJOR, 5))

View File

@@ -244,7 +244,10 @@ int wiringPiI2CSetup (const int devId)
switch(model) {
case MODEL_ODROID_C1:
case MODEL_ODROID_C2:
device = "/dev/i2c-1";
if (cmpKernelVersion(KERN_NUM_TO_MAJOR, 4))
device = "/dev/i2c-0";
else
device = "/dev/i2c-1";
break;
case MODEL_ODROID_XU3:
if (cmpKernelVersion(KERN_NUM_TO_MAJOR, 5))