This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5728: How to register i2c device in kernel

Part Number: AM5728
Other Parts Discussed in Thread: TLV320AIC3104

Tool/software: Linux

I'm developing my own customboard, based on Sitara AM5728.
I m newly in programming for embedded systems and I didn't understand, how linux knows, wich perepherial devices are plugged to processor and on wich pins this devices are connected.
For example, I need to handle audio encoder via i2c. There is several i2c ports: i2c-1, 2, 3, 4, 5. I want to connect my encoder to i2c-5.
What am I supposed to do, to get linux kernel knowlege that my device is on i2c-5? How OS registers this device? 
On AM5728 EVM only three i2c devices in /dev/ appears. How I can add other devices and configure it properly for my needs?

  • Hi,

    You need to modify the dts file (arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi). Currently the audio codec tlv320aic3104 is connected to i2c1. You can look its implementation as a reference.

    In general, you should have something like:
    &dra7_pmx_core {
             i2c5_pins_default: i2c5_pins_default {
                   pinctrl-single,pins = <
                              0x54 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_a5.i2c5_sda*/
                              0x50 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_a4.i2c5_scl.scl */
                   >;
             };
    };

    &i2c5 {
        pinctrl-names = "default";
        pinctrl-0 = <&i2c5_pins_default>;
        status = "okay";
        tlv320aic3104: tlv320aic3104@18 {
               status = "okay";
               #sound-dai-cells = <0>;
               compatible = "ti,tlv320aic3104";
               reg = <0x18>;

               assigned-clocks = <&clkoutmux2_clk_mux>;
               assigned-clock-parents = <&sys_clk2_dclk_div>;

               adc-settle-ms = <40>;
               AVDD-supply = <&vdd_3v3>;
               IOVDD-supply = <&vdd_3v3>;
               DRVDD-supply = <&vdd_3v3>;
               DVDD-supply = <&aic_dvdd>;
       };
    };

    Hope this helps.

    Best Regards,
    Yordan

  • Thanks for fast reply.
    Yes, I find in schematic files, that audio encoder connect to i2c1 and it's address is 0x18.
    But there is no i2c1 device in /dev folder, should I change something in dts file like in example above, to see it as i2c-1 file in dev?