BeagleBoneBlackデバイスツリーを修正してi2cデバイスドライバを追加する()

BeagleBoneBlackデバイスツリーを修正してi2cデバイスドライバを追加する()

i2c2ピン[P9]:(19)I2C2_SCL、(20)I2C2_SDAを使用してBeagleBoneBlackでi2cデバイスドライバを実行しようとしています。

ユーザースペースでi2c2を正常に使用して同じatmelタッチスクリーンデバイスを制御できますが、デバイスドライバでこれを使用すると、検索時にエラー-16(リソース使用中)が発生し続けます。

デバイスドライバはhttps://github.com/ssl-maxtouch/linux-device-driver/blob/master/atmel_mxt_ts.cカーネルに静的に構築しました(drivers/input/touchscreen/atmel_mxt_ts.c)

デバイスツリーソースファイルに以下を追加しました。アーチ/arm/boot/dts/am335x-boneblack.dts:

&i2c2 {
    atmel_mxt_ts@4b {
        compatible = "atmel,atmel_mxt_ts";
        #address-cells = <1>;
        #size-cells = <0>;
        reg = <0x4b>;
        atmel,reset-gpio = <&gpio1 28 0x00>;
        atmel,irq-gpio = <&gpio1 16 0x00>;
        atmel,suspend-mode = <0x01>;
        atmel,input_name = "SSLUK";
    };
};

延長されるものアーチ/arm/boot/dts/am33xx.dtsiそしてアーチ/arm/boot/dts/am335x-bone-common.dtsi:

    i2c2: i2c@4819c000 {
        compatible = "ti,omap4-i2c";
        #address-cells = <1>;
        #size-cells = <0>;
        ti,hwmods = "i2c3";
        reg = <0x4819c000 0x1000>;
        interrupts = <30>;
        status = "disabled";
    };

&i2c2 {
    pinctrl-names = "default";
    pinctrl-0 = <>;

    status = "okay";
    clock-frequency = <100000>;

デバイスドライバがバスに正常に追加されたように見えますが、すべてのi2c_transferが-16の値で失敗したため、プローブは失敗します。

カーネルログから:

[    0.879536] atmel_mxt_ts 2-004b: mxt_probe i2c-2-004b/input0
[    0.879546] atmel_mxt_ts 2-004b: mxt_probe mxtdata->fw_name: (null), mxtdata->cfg_name: (null)
[    0.879581] atmel_mxt_ts 2-004b: mxt_initialize
[    1.887051] omap_i2c 4819c000.i2c: timeout waiting for bus ready
[    1.887069] atmel_mxt_ts 2-004b: __mxt_read_reg: i2c_transfer ret_val -16
[    2.935039] omap_i2c 4819c000.i2c: timeout waiting for bus ready
[    2.935049] atmel_mxt_ts 2-004b: __mxt_read_reg: i2c_transfer ret_val -16
[    3.947044] omap_i2c 4819c000.i2c: timeout waiting for bus ready
[    3.947059] atmel_mxt_ts 2-004b: mxt_bootloader_read: i2c_transfer ret_val -16
[    3.954340] atmel_mxt_ts 2-004b: mxt_bootloader_read: retry 1
[    5.007040] omap_i2c 4819c000.i2c: timeout waiting for bus ready
[    5.007050] atmel_mxt_ts 2-004b: mxt_bootloader_read: i2c_transfer ret_val -16
[    5.014329] atmel_mxt_ts 2-004b: mxt_probe_bootloader, 907, buf[0] = 68, buf[1] = 2e, buf[2] = c0, error = -16
[    5.014337] atmel_mxt_ts 2-004b: Trying alternate bootloader address
[    6.019042] omap_i2c 4819c000.i2c: timeout waiting for bus ready
[    6.019059] i2c i2c-2: SCL is stuck low, exit recovery
[    6.024248] atmel_mxt_ts 2-004b: mxt_bootloader_read: i2c_transfer ret_val -16
[    6.031521] atmel_mxt_ts 2-004b: mxt_bootloader_read: retry 1
[    7.083040] omap_i2c 4819c000.i2c: timeout waiting for bus ready
[    7.083050] atmel_mxt_ts 2-004b: mxt_bootloader_read: i2c_transfer ret_val -16
[    7.090329] atmel_mxt_ts 2-004b: mxt_probe_bootloader, 907, buf[0] = dc, buf[1] = 13, buf[2] = dc, error = -16
[    7.090630] atmel_mxt_ts 2-004b: mxt_probe error
[    7.090657] atmel_mxt_ts: probe of 2-004b failed with error -16

カーネルは4.14.25です。https://elinux.org/BeagleBoardUbuntu

修正する デバイスドライバをモジュールとして構築し、動作するユーザ空間でinsmodを実行します。

sudo insmod atmel_mxt_ts.ko

カーネルログを使用すると、次のようになります。

[  150.125216] atmel_mxt_ts 2-004b: mxt_probe i2c-2-004b/input0
[  150.125235] atmel_mxt_ts 2-004b: mxt_probe mxtdata->fw_name: (null), mxtdata->cfg_name: (null)
[  150.125295] atmel_mxt_ts 2-004b: mxt_initialize
[  150.167071] atmel_mxt_ts 2-004b: Family: 164 Variant: 11 Firmware V1.6.01 Objects: 34
[  150.167092] atmel_mxt_ts 2-004b: mxt_parse_object_table, object_num = 34
...
[  150.168174] atmel_mxt_ts 2-004b: Enabling RETRIGEN workaround
[  150.168617] atmel_mxt_ts 2-004b: mxt_acquire_irq mxtdata->irq = 86
[  150.224908] atmel_mxt_ts 2-004b: mxt_acquire_irq OK
[  150.224993] atmel_mxt_ts 2-004b: mxt_configure_objects
[  150.228762] atmel_mxt_ts 2-004b: Touchscreen size X1023Y1023
[  150.229141] input: SSLUK as /devices/platform/ocp/4819c000.i2c/i2c-2/2-004b/input/input1
[  150.229170] atmel_mxt_ts 2-004b: mxt_initialize OK
[  150.229178] atmel_mxt_ts 2-004b: mxt_probe OK

関連情報