Lines Matching full:ec
2 // Debug logs for the ChromeOS EC
20 #define DRV_NAME "cros-ec-debugfs"
32 * struct cros_ec_debugfs - EC debugging information.
34 * @ec: EC device this debugfs information belongs to
37 * @read_msg: preallocated EC command and buffer to read console log
39 * @log_poll_work: recurring task to poll EC for new console log data
42 * when EC panic
45 struct cros_ec_dev *ec; member
47 /* EC log */
52 /* EC panicinfo */
58 * We need to make sure that the EC log buffer on the UART is large enough,
67 struct cros_ec_dev *ec = debug_info->ec; in cros_ec_console_log_work() local
70 .command = EC_CMD_CONSOLE_SNAPSHOT + ec->cmd_offset, in cros_ec_console_log_work()
80 ret = cros_ec_cmd_xfer_status(ec->ec_dev, &snapshot_msg); in cros_ec_console_log_work()
90 dev_info_once(ec->dev, in cros_ec_console_log_work()
97 ret = cros_ec_cmd_xfer_status(ec->ec_dev, in cros_ec_console_log_work()
204 struct cros_ec_device *ec_dev = debug_info->ec->ec_dev; in cros_ec_pdinfo_read()
272 struct cros_ec_device *ec_dev = debug_info->ec->ec_dev; in cros_ec_uptime_read()
319 static int ec_read_version_supported(struct cros_ec_dev *ec) in ec_read_version_supported() argument
333 msg->command = EC_CMD_GET_CMD_VERSIONS + ec->cmd_offset; in ec_read_version_supported()
341 ret = cros_ec_cmd_xfer_status(ec->ec_dev, msg) >= 0 && in ec_read_version_supported()
351 struct cros_ec_dev *ec = debug_info->ec; in cros_ec_create_console_log() local
360 if (!ec_read_version_supported(ec)) in cros_ec_create_console_log()
363 buf = devm_kzalloc(ec->dev, LOG_SIZE, GFP_KERNEL); in cros_ec_create_console_log()
368 read_response_size = ec->ec_dev->max_response; in cros_ec_create_console_log()
369 debug_info->read_msg = devm_kzalloc(ec->dev, in cros_ec_create_console_log()
376 debug_info->read_msg->command = EC_CMD_CONSOLE_READ + ec->cmd_offset; in cros_ec_create_console_log()
405 * Returns the size of the panicinfo data fetched from the EC
436 struct cros_ec_device *ec_dev = debug_info->ec->ec_dev; in cros_ec_create_panicinfo()
440 data = devm_kzalloc(debug_info->ec->dev, ec_dev->max_response, in cros_ec_create_panicinfo()
464 devm_kfree(debug_info->ec->dev, data); in cros_ec_create_panicinfo()
486 struct cros_ec_dev *ec = dev_get_drvdata(pd->dev.parent); in cros_ec_debugfs_probe() local
487 struct cros_ec_platform *ec_platform = dev_get_platdata(ec->dev); in cros_ec_debugfs_probe()
492 debug_info = devm_kzalloc(ec->dev, sizeof(*debug_info), GFP_KERNEL); in cros_ec_debugfs_probe()
496 debug_info->ec = ec; in cros_ec_debugfs_probe()
510 if (cros_ec_uptime_is_supported(ec->ec_dev)) in cros_ec_debugfs_probe()
515 &ec->ec_dev->last_resume_result); in cros_ec_debugfs_probe()
518 &ec->ec_dev->suspend_timeout_ms); in cros_ec_debugfs_probe()
521 ret = blocking_notifier_chain_register(&ec->ec_dev->panic_notifier, in cros_ec_debugfs_probe()
526 ec->debug_info = debug_info; in cros_ec_debugfs_probe()
528 dev_set_drvdata(&pd->dev, ec); in cros_ec_debugfs_probe()
539 struct cros_ec_dev *ec = dev_get_drvdata(pd->dev.parent); in cros_ec_debugfs_remove() local
541 debugfs_remove_recursive(ec->debug_info->dir); in cros_ec_debugfs_remove()
542 cros_ec_cleanup_console_log(ec->debug_info); in cros_ec_debugfs_remove()
549 struct cros_ec_dev *ec = dev_get_drvdata(dev); in cros_ec_debugfs_suspend() local
551 if (ec->debug_info->log_buffer.buf) in cros_ec_debugfs_suspend()
552 cancel_delayed_work_sync(&ec->debug_info->log_poll_work); in cros_ec_debugfs_suspend()
559 struct cros_ec_dev *ec = dev_get_drvdata(dev); in cros_ec_debugfs_resume() local
561 if (ec->debug_info->log_buffer.buf) in cros_ec_debugfs_resume()
562 schedule_delayed_work(&ec->debug_info->log_poll_work, 0); in cros_ec_debugfs_resume()
583 MODULE_DESCRIPTION("Debug logs for ChromeOS EC");