Lines Matching full:ec
2 // Debug logs for the ChromeOS EC
21 #define DRV_NAME "cros-ec-debugfs"
31 MODULE_PARM_DESC(log_poll_period_ms, "EC log polling period(ms)");
37 * struct cros_ec_debugfs - EC debugging information.
39 * @ec: EC device this debugfs information belongs to
42 * @read_msg: preallocated EC command and buffer to read console log
44 * @log_poll_work: recurring task to poll EC for new console log data
47 * when EC panic
50 struct cros_ec_dev *ec; member
52 /* EC log */
57 /* EC panicinfo */
63 * We need to make sure that the EC log buffer on the UART is large enough,
72 struct cros_ec_dev *ec = debug_info->ec; in cros_ec_console_log_work() local
75 .command = EC_CMD_CONSOLE_SNAPSHOT + ec->cmd_offset, in cros_ec_console_log_work()
85 ret = cros_ec_cmd_xfer_status(ec->ec_dev, &snapshot_msg); in cros_ec_console_log_work()
95 dev_info_once(ec->dev, in cros_ec_console_log_work()
102 ret = cros_ec_cmd_xfer_status(ec->ec_dev, in cros_ec_console_log_work()
209 struct cros_ec_device *ec_dev = debug_info->ec->ec_dev; in cros_ec_pdinfo_read()
277 struct cros_ec_device *ec_dev = debug_info->ec->ec_dev; in cros_ec_uptime_read()
323 static int ec_read_version_supported(struct cros_ec_dev *ec) in ec_read_version_supported() argument
337 msg->command = EC_CMD_GET_CMD_VERSIONS + ec->cmd_offset; in ec_read_version_supported()
345 ret = cros_ec_cmd_xfer_status(ec->ec_dev, msg) >= 0 && in ec_read_version_supported()
355 struct cros_ec_dev *ec = debug_info->ec; in cros_ec_create_console_log() local
364 if (!ec_read_version_supported(ec)) in cros_ec_create_console_log()
367 buf = devm_kzalloc(ec->dev, LOG_SIZE, GFP_KERNEL); in cros_ec_create_console_log()
372 read_response_size = ec->ec_dev->max_response; in cros_ec_create_console_log()
373 debug_info->read_msg = devm_kzalloc(ec->dev, in cros_ec_create_console_log()
380 debug_info->read_msg->command = EC_CMD_CONSOLE_READ + ec->cmd_offset; in cros_ec_create_console_log()
409 * Returns the size of the panicinfo data fetched from the EC
440 struct cros_ec_device *ec_dev = debug_info->ec->ec_dev; in cros_ec_create_panicinfo()
444 data = devm_kzalloc(debug_info->ec->dev, ec_dev->max_response, in cros_ec_create_panicinfo()
468 devm_kfree(debug_info->ec->dev, data); in cros_ec_create_panicinfo()
490 struct cros_ec_dev *ec = dev_get_drvdata(pd->dev.parent); in cros_ec_debugfs_probe() local
491 struct cros_ec_platform *ec_platform = dev_get_platdata(ec->dev); in cros_ec_debugfs_probe()
496 debug_info = devm_kzalloc(ec->dev, sizeof(*debug_info), GFP_KERNEL); in cros_ec_debugfs_probe()
500 debug_info->ec = ec; in cros_ec_debugfs_probe()
514 if (cros_ec_uptime_is_supported(ec->ec_dev)) in cros_ec_debugfs_probe()
519 &ec->ec_dev->last_resume_result); in cros_ec_debugfs_probe()
522 &ec->ec_dev->suspend_timeout_ms); in cros_ec_debugfs_probe()
525 ret = blocking_notifier_chain_register(&ec->ec_dev->panic_notifier, in cros_ec_debugfs_probe()
530 ec->debug_info = debug_info; in cros_ec_debugfs_probe()
532 dev_set_drvdata(&pd->dev, ec); in cros_ec_debugfs_probe()
543 struct cros_ec_dev *ec = dev_get_drvdata(pd->dev.parent); in cros_ec_debugfs_remove() local
545 debugfs_remove_recursive(ec->debug_info->dir); in cros_ec_debugfs_remove()
546 cros_ec_cleanup_console_log(ec->debug_info); in cros_ec_debugfs_remove()
551 struct cros_ec_dev *ec = dev_get_drvdata(dev); in cros_ec_debugfs_suspend() local
553 if (ec->debug_info->log_buffer.buf) in cros_ec_debugfs_suspend()
554 cancel_delayed_work_sync(&ec->debug_info->log_poll_work); in cros_ec_debugfs_suspend()
561 struct cros_ec_dev *ec = dev_get_drvdata(dev); in cros_ec_debugfs_resume() local
563 if (ec->debug_info->log_buffer.buf) in cros_ec_debugfs_resume()
564 schedule_delayed_work(&ec->debug_info->log_poll_work, 0); in cros_ec_debugfs_resume()
592 MODULE_DESCRIPTION("Debug logs for ChromeOS EC");