The peripheral chip of Linux shutdown is not reset (Qualcomm platform)

Problem scene

Linux kernel version: Linux version 4.14.117 (view kernel version information command cat / proc / version)
The charging ic we use needs to be reset during the shutdown process. The function to reset the charging IC has been called in .remove, why the chip has not been reset?

Troubleshoot and solve problems

  • I initially guessed that the shutdown process did not take the remove process. Verify the conjecture, add printing to the remove function, take the shutdown process, check the LOG information, and did not find the added print LOG.
  • Go online to find relevant information and find that shutdown requires a shutdown process, add modules, increase printing information, print information successfully, add reset chip operation, and successful shutdown reset.

problem solved

Method: increase shutdown process

note

The return value of shutdown is void, and the remove process has not been modified, resulting in compilation errors. . . The details still need attention! ! !

Simple Analysis

  • There are two opportunities for the execution of the probe, one is when the device is created, and the other is when the driver is registered; remove also has two execution opportunities, one is when the device is logged off, and the other is when the driver is logged off.
  • When the system is shut down or restarted, the shutdown function of the device driver will be called to complete the shutdown operation of the device. If necessary, the function can be defined in the driver.
static struct i2c_driver bq25890_driver = {
 .driver = {
  .name = "bq25890-charger",
  .of_match_table = of_match_ptr(bq25890_of_match),
  .acpi_match_table = ACPI_PTR(bq25890_acpi_match),
  .pm = &bq25890_pm,
 },
 .probe = bq25890_probe,
 .remove = bq25890_remove,
 .shutdown = bq25890_shutdown,
 .id_table = bq25890_i2c_ids,
};
Published 162 original articles · praised 183 · 120,000 views

Guess you like

Origin blog.csdn.net/qq_31339221/article/details/105287770