Disabling default gpio pull-down not working imx8mm

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Disabling default gpio pull-down not working imx8mm

跳至解决方案
3,633 次查看
borysszefler
Contributor II

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:

MX8MM_IOMUXC_SAI5_RXC_GPIO3_IO20           0x00000016
 

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:~#

标签 (1)
0 项奖励
回复
1 解答
3,520 次查看
borysszefler
Contributor II

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 = <&reg>;
IOVDD-supply = <&reg>;
DRVDD-supply = <&reg>;
};
};

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 = <&reg>;
IOVDD-supply = <&reg>;
DRVDD-supply = <&reg>;

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.

 

在原帖中查看解决方案

0 项奖励
回复
6 回复数
3,605 次查看
riteshmpatel
NXP TechSupport
NXP TechSupport

Hi @borysszefler,

I hope you are doing well.

Please make sure that you have correctly configured the pads in kernel dts and that any other declaration is not overriding the pad control register.
 
Have you added code to control reset gpio in the i2c device driver as below? 
 
in i2c device node
  reset-gpios = <&gpio3 20 GPIO_ACTIVE_HIGH>;
 
in i2c driver's probe function
 
struct gpio_desc *gpio;
gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(gpio))
       return PTR_ERR(gpio);
 
Alternatively, one can use the gpio-hog property to set a particular gpio as high permanently in dts.
 
Please send the kernel device tree file for further debugging.
 
Thanks & Regards,
Ritesh M Patel
0 项奖励
回复
3,599 次查看
borysszefler
Contributor II

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 = <&reg>;
IOVDD-supply = <&reg>;
DRVDD-supply = <&reg>;
};
};

&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

 

0 项奖励
回复
3,562 次查看
riteshmpatel
NXP TechSupport
NXP TechSupport

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

0 项奖励
回复
3,556 次查看
borysszefler
Contributor II

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?

0 项奖励
回复
3,525 次查看
riteshmpatel
NXP TechSupport
NXP TechSupport

Hi @borysszefler,

pinctrl settings from the device tree will be applied and selected (between default/gpio/init)  by devm_pinctrl_get in the bus driver when a device driver is about to probe.
 
The probe function (aic3x_probe ) must be called as it parses reset-gpio from dts and configures it.
 
Please send the complete dts file for further debugging.
 
Thanks & Regards,
Ritesh M Patel
0 项奖励
回复
3,521 次查看
borysszefler
Contributor II

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 = <&reg>;
IOVDD-supply = <&reg>;
DRVDD-supply = <&reg>;
};
};

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 = <&reg>;
IOVDD-supply = <&reg>;
DRVDD-supply = <&reg>;

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.

 

0 项奖励
回复