高通平台高速uart有时开着导致系统无法休眠,所以需要在休眠前关闭高速uart clock,在唤醒在打开相应的clock,具体说明如下:

in drivers/tty/serial/msm_serial_hs.c:

static int msm_hs_ioctl(struct uart_port *uport, unsigned int cmd,
                                                unsigned long arg)
{

...

        switch (cmd) {
        case MSM_ENABLE_UART_CLOCK: {
                ret = msm_hs_request_clock_on(&msm_uport->uport);
                break;
        }
        case MSM_DISABLE_UART_CLOCK: {
                ret = msm_hs_request_clock_off(&msm_uport->uport);
                break;
        }
        case MSM_GET_UART_CLOCK_STATUS: {
                /* Return value 0 - UART CLOCK is OFF
                 * Return value 1 - UART CLOCK is ON
                 */

                if (msm_uport->pm_state != MSM_HS_PM_ACTIVE)
                        state = 0;
                ret = state;
                MSM_HS_INFO("%s():GET UART CLOCK STATUS: cmd=%d state=%d\n",
                        __func__, cmd, state);
                break;
        }

...

所以可以在应用层做如下控制:

高速uart clock打开:

    ioctl(fd, MSM_ENABLE_UART_CLOCK, &arg);

高速uart clock关闭:

    ioctl(fd, MSM_DISABLE_UART_CLOCK, &arg);

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐