I have a device connected via i2c and a reset signal from gpio. I prepared device tree, but I have a problem with reset line.
It is the IOMUXC_SW_PAD_CTL_PAD_SAI5_RXC set as GPIO3_20 and it's default state is pull resistor enabled and pull down select. The reset of the i2c device is ACTIVE_LOW so this default pull-down keeps this device in reset state.
I disabled internal pull down in dts:
and also added external pull-up, but I cannot see 3.3V there. I can see something about 0.5V so internal pull-down must be still active.
If I set gpio high using libgpio, then I can detect device using i2cdetect command, so the device is working.
My question is, how should I disable this internal pull down to detect the device on the i2c bus?
When gpio settings from device tree are set?
EDIT:
it looks like pinctrl config has value i set in device tree, but register has still value with pull down enabled. Why is that?
root@a:~# dmesg | grep MX8MM_IOMUXC_SAI5_RXC
[ 0.037921] pinctrl core: registered pin 81 (MX8MM_IOMUXC_SAI5_RXC) on 30330000.pinctrl
[ 0.040163] imx8mm-pinctrl 30330000.pinctrl: MX8MM_IOMUXC_SAI5_RXC: 0x5 0x00000016
root@a:~# devmem 0x303303ac
0x00000116
root@a:~#
已解决! 转到解答。
Hi @riteshmpatel, thank you for you response.
sound-tlv320aic3x {
compatible = "simple-audio-card";
simple-audio-card,name = "TLV320DAC32";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&codec1>;
simple-audio-card,frame-master = <&codec1>;
simple-audio-card,widgets = "Buzzer";
simple-audio-card,routing =
"Buzzer", "SPR";
simple-audio-card,cpu {
sound-dai = <&sai3>;
};
};
codec1: simple-audio-card,codec {
sound-dai = <&tlv320aic3x>;
system-clock-frequency = <&clk IMX8MM_CLK_SAI3_ROOT>;
};
&sai3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai3>;
status = "okay";
assigned-clocks = <&clk IMX8MM_CLK_SAI3>;
assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
assigned-clock-rates = <12000000>;
};
&i2c3 {
tlv320aic3x: tlv320aic3x@18 {
#sound-dai-cells = <0>;
compatible = "ti,tlv320aic3x";
reg = <0x18>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_tlv32>;
reset-gpios = <&gpio3 20 GPIO_ACTIVE_LOW>;
AVDD-supply = <®>;
IOVDD-supply = <®>;
DRVDD-supply = <®>;
};
};
pinctrl_sai3: sai3grp {
fsl,pins = <
MX8MM_IOMUXC_SAI3_MCLK_SAI3_MCLK 0x00000016
MX8MM_IOMUXC_SAI3_TXC_SAI3_TX_BCLK 0x00001816
MX8MM_IOMUXC_SAI3_TXD_SAI3_TX_DATA0 0x00000016
MX8MM_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC 0x00000016
>;
};
pinctrl_tlv32: tlv32grp {
fsl,pins = <
MX8MM_IOMUXC_SAI5_RXC_GPIO3_IO20 0x00000016
>;
};
I found out that the problem is with this part:
AVDD-supply = <®>;
IOVDD-supply = <®>;
DRVDD-supply = <®>;
I deleted it and device is probed, pull-down is disabled. I've got only error about dummy-regulator:
[ 13.248007] tlv320aic3x 2-0018: supply IOVDD not found, using dummy regulator
[ 13.259241] tlv320aic3x 2-0018: supply DVDD not found, using dummy regulator
[ 13.276491] tlv320aic3x 2-0018: supply AVDD not found, using dummy regulator
[ 13.283680] tlv320aic3x 2-0018: supply DRVDD not found, using dummy regulator
[ 13.297426] tlv320aic3x 2-0018: Invalid supply voltage(s) AVDD: -22, DVDD: -22
but the driver works now.
Now I have to work on sai3 part, because this one still not working.
Hi @borysszefler,
I hope you are doing well.
HI @riteshmpatel, thank you for your response.
&i2c3 {
tlv320aic3x: tlv320aic3x@18 {
#sound-dai-cells = <0>;
compatible = "ti,tlv320aic3x";
reg = <0x18>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_tlv32>;
reset-gpios = <&gpio3 20 GPIO_ACTIVE_LOW>;
AVDD-supply = <®>;
IOVDD-supply = <®>;
DRVDD-supply = <®>;
};
};
&iomuxc {
pinctrl_tlv32: tlv32grp {
fsl,pins = <
MX8MM_IOMUXC_SAI5_RXC_GPIO3_IO20 0x00000016
>;
};
};
I can see that driver is registered:
[ 6.080843] i2c i2c-2: of_i2c: register /soc@0/bus@30800000/i2c@30a40000/tlv320aic3x@18
[ 6.099482] i2c i2c-2: client [tlv320aic3x] registered with bus id 2-0018
[ 12.267136] i2c-core: driver [tlv320aic3x] registered
Hi @borysszefler,
Please Cross-check that Any Device tree overlay is not overriding the values of pad control register MX8MM_IOMUXC_SAI5_RXC.
You can set GPIO to high from the probe function of the i2c device driver.
Please provide me with the Probe function of the i2c device driver if the issue still persists.
Thanks & Regards,
Ritesh M Patel
Hi @riteshmpatel,
there is nothing overriding values the values of that pad.
Here you have a driver: https://github.com/torvalds/linux/blob/v5.15/sound/soc/codecs/tlv320aic3x-i2c.c
But from me debug it looks like probe function is never called.
My question is, when pinctrl settings from device tree are applied? After driver request reset gpio? Or pull-down should be disabled before driver is attached?
Hi @borysszefler,
Hi @riteshmpatel, thank you for you response.
sound-tlv320aic3x {
compatible = "simple-audio-card";
simple-audio-card,name = "TLV320DAC32";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&codec1>;
simple-audio-card,frame-master = <&codec1>;
simple-audio-card,widgets = "Buzzer";
simple-audio-card,routing =
"Buzzer", "SPR";
simple-audio-card,cpu {
sound-dai = <&sai3>;
};
};
codec1: simple-audio-card,codec {
sound-dai = <&tlv320aic3x>;
system-clock-frequency = <&clk IMX8MM_CLK_SAI3_ROOT>;
};
&sai3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai3>;
status = "okay";
assigned-clocks = <&clk IMX8MM_CLK_SAI3>;
assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
assigned-clock-rates = <12000000>;
};
&i2c3 {
tlv320aic3x: tlv320aic3x@18 {
#sound-dai-cells = <0>;
compatible = "ti,tlv320aic3x";
reg = <0x18>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_tlv32>;
reset-gpios = <&gpio3 20 GPIO_ACTIVE_LOW>;
AVDD-supply = <®>;
IOVDD-supply = <®>;
DRVDD-supply = <®>;
};
};
pinctrl_sai3: sai3grp {
fsl,pins = <
MX8MM_IOMUXC_SAI3_MCLK_SAI3_MCLK 0x00000016
MX8MM_IOMUXC_SAI3_TXC_SAI3_TX_BCLK 0x00001816
MX8MM_IOMUXC_SAI3_TXD_SAI3_TX_DATA0 0x00000016
MX8MM_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC 0x00000016
>;
};
pinctrl_tlv32: tlv32grp {
fsl,pins = <
MX8MM_IOMUXC_SAI5_RXC_GPIO3_IO20 0x00000016
>;
};
I found out that the problem is with this part:
AVDD-supply = <®>;
IOVDD-supply = <®>;
DRVDD-supply = <®>;
I deleted it and device is probed, pull-down is disabled. I've got only error about dummy-regulator:
[ 13.248007] tlv320aic3x 2-0018: supply IOVDD not found, using dummy regulator
[ 13.259241] tlv320aic3x 2-0018: supply DVDD not found, using dummy regulator
[ 13.276491] tlv320aic3x 2-0018: supply AVDD not found, using dummy regulator
[ 13.283680] tlv320aic3x 2-0018: supply DRVDD not found, using dummy regulator
[ 13.297426] tlv320aic3x 2-0018: Invalid supply voltage(s) AVDD: -22, DVDD: -22
but the driver works now.
Now I have to work on sai3 part, because this one still not working.