Retry deferred probe at runtime (device tree)

I’ve developed a device tree overlay to describe some pieces of my embedded system. The system is comprised of a Raspberry Pi, a separate custom circuit board with a few I2C devices, and a power supply. While the Raspberry Pi gets power all the time, the separate circuit board only gets power when it’s enabled externally. Now, if the separate circuit board is powered when the Pi boots, the device tree overlay works flawlessly, and all I2C devices on the separate circuit board work properly. However, if the Pi boots before the separate circuit board is powered, the kernel log shows

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>[ 17.630787] i2c 1-0040: deferred probe pending
</code>
<code>[ 17.630787] i2c 1-0040: deferred probe pending </code>
[   17.630787] i2c 1-0040: deferred probe pending

and obviously I cannot communicate with the I2C devices.

Now, if I remove the dtoverlay from /boot/firmware/config.txt and try to load the overlay dynamically at runtime (after the circuit board has power), one of the drivers fails to load with the following messages in dmesg:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>[ 43.227575] tps25990 1-0040: Found fault-gpio
[ 43.227586] tps25990 1-0040: Found fault-gpio at gpio586
[ 43.227593] tps25990 1-0040: fault-gpio is mapped to IRQ-6
[ 43.227598] tps25990 1-0040: irq_set_irq_type returns -22
[ 43.227604] tps25990 1-0040: Failed to request fault-gpio irq (code: -22)
[ 43.227615] tps25990: probe of 1-0040 failed with error -22
</code>
<code>[ 43.227575] tps25990 1-0040: Found fault-gpio [ 43.227586] tps25990 1-0040: Found fault-gpio at gpio586 [ 43.227593] tps25990 1-0040: fault-gpio is mapped to IRQ-6 [ 43.227598] tps25990 1-0040: irq_set_irq_type returns -22 [ 43.227604] tps25990 1-0040: Failed to request fault-gpio irq (code: -22) [ 43.227615] tps25990: probe of 1-0040 failed with error -22 </code>
[   43.227575] tps25990 1-0040: Found fault-gpio
[   43.227586] tps25990 1-0040: Found fault-gpio at gpio586
[   43.227593] tps25990 1-0040: fault-gpio is mapped to IRQ-6
[   43.227598] tps25990 1-0040: irq_set_irq_type returns -22
[   43.227604] tps25990 1-0040: Failed to request fault-gpio irq (code: -22)
[   43.227615] tps25990: probe of 1-0040 failed with error -22

For reference, here’s the relevant lines of code from the driver:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> data->fault_gpio = devm_gpiod_get_optional(&client->dev, "fault", GPIOD_IN);
if (data->fault_gpio) {
dev_info(&client->dev, "Found fault-gpio at gpio%dn", desc_to_gpio(data->fault_gpio));
gpiod_set_consumer_name(data->fault_gpio, "EFUSE FAULT");
data->fault_gpio_irq = gpiod_to_irq(data->fault_gpio);
if (data->fault_gpio_irq < 0) {
dev_err(&client->dev, "No corresponding irq for fault-gpion");
return data->fault_gpio_irq;
} else {
dev_info(&client->dev, "fault-gpio is mapped to IRQ%dn", data->fault_gpio_irq);
}
ret = irq_set_irq_type(data->fault_gpio_irq, IRQ_TYPE_EDGE_FALLING);
dev_dbg(&client->dev, "irq_set_irq_type returns %dn", ret);
ret = devm_request_threaded_irq(&client->dev,
data->fault_gpio_irq,
NULL,
efuse_fault_gpio_irq_handler,
0,
"efuse fault",
data);
if (ret) {
dev_err(&client->dev, "Failed to request fault-gpio irq (code: %d)n", ret);
irq_dispose_mapping(data->fault_gpio_irq);
return ret;
}
} else {
dev_info(&client->dev, "No fault-gpio found in device treen");
}
</code>
<code> data->fault_gpio = devm_gpiod_get_optional(&client->dev, "fault", GPIOD_IN); if (data->fault_gpio) { dev_info(&client->dev, "Found fault-gpio at gpio%dn", desc_to_gpio(data->fault_gpio)); gpiod_set_consumer_name(data->fault_gpio, "EFUSE FAULT"); data->fault_gpio_irq = gpiod_to_irq(data->fault_gpio); if (data->fault_gpio_irq < 0) { dev_err(&client->dev, "No corresponding irq for fault-gpion"); return data->fault_gpio_irq; } else { dev_info(&client->dev, "fault-gpio is mapped to IRQ%dn", data->fault_gpio_irq); } ret = irq_set_irq_type(data->fault_gpio_irq, IRQ_TYPE_EDGE_FALLING); dev_dbg(&client->dev, "irq_set_irq_type returns %dn", ret); ret = devm_request_threaded_irq(&client->dev, data->fault_gpio_irq, NULL, efuse_fault_gpio_irq_handler, 0, "efuse fault", data); if (ret) { dev_err(&client->dev, "Failed to request fault-gpio irq (code: %d)n", ret); irq_dispose_mapping(data->fault_gpio_irq); return ret; } } else { dev_info(&client->dev, "No fault-gpio found in device treen"); } </code>
    data->fault_gpio  = devm_gpiod_get_optional(&client->dev, "fault", GPIOD_IN);
    if (data->fault_gpio) {
        dev_info(&client->dev, "Found fault-gpio at gpio%dn", desc_to_gpio(data->fault_gpio));
        gpiod_set_consumer_name(data->fault_gpio, "EFUSE FAULT");
        data->fault_gpio_irq = gpiod_to_irq(data->fault_gpio);
        if (data->fault_gpio_irq < 0) {
            dev_err(&client->dev, "No corresponding irq for fault-gpion");
            return data->fault_gpio_irq;
        } else {
            dev_info(&client->dev, "fault-gpio is mapped to IRQ%dn", data->fault_gpio_irq);
        }
        ret = irq_set_irq_type(data->fault_gpio_irq, IRQ_TYPE_EDGE_FALLING);
        dev_dbg(&client->dev, "irq_set_irq_type returns %dn", ret);
        ret = devm_request_threaded_irq(&client->dev,
                data->fault_gpio_irq,
                NULL,
                efuse_fault_gpio_irq_handler,
                0,
                "efuse fault",
                data);
        if (ret) {
            dev_err(&client->dev, "Failed to request fault-gpio irq (code: %d)n", ret);
            irq_dispose_mapping(data->fault_gpio_irq);
            return ret;
        }
    } else {
        dev_info(&client->dev, "No fault-gpio found in device treen");
    }

So it appears that irq_set_irq_type fails when loading the dtoverlay dynamically. Does anyone have suggestions on how to correct this?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật