Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v4.18-rc6 102 lines 3.0 kB view raw
1/* 2 * Copyright 2012-16 Advanced Micro Devices, Inc. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included in 12 * all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 * 22 * Authors: AMD 23 * 24 */ 25 26#include "core_types.h" 27#include "logger.h" 28#include "include/logger_interface.h" 29#include "dm_helpers.h" 30 31#define NUM_ELEMENTS(a) (sizeof(a) / sizeof((a)[0])) 32 33struct dc_signal_type_info { 34 enum signal_type type; 35 char name[MAX_NAME_LEN]; 36}; 37 38static const struct dc_signal_type_info signal_type_info_tbl[] = { 39 {SIGNAL_TYPE_NONE, "NC"}, 40 {SIGNAL_TYPE_DVI_SINGLE_LINK, "DVI"}, 41 {SIGNAL_TYPE_DVI_DUAL_LINK, "DDVI"}, 42 {SIGNAL_TYPE_HDMI_TYPE_A, "HDMIA"}, 43 {SIGNAL_TYPE_LVDS, "LVDS"}, 44 {SIGNAL_TYPE_RGB, "VGA"}, 45 {SIGNAL_TYPE_DISPLAY_PORT, "DP"}, 46 {SIGNAL_TYPE_DISPLAY_PORT_MST, "MST"}, 47 {SIGNAL_TYPE_EDP, "eDP"}, 48 {SIGNAL_TYPE_VIRTUAL, "Virtual"} 49}; 50 51void dc_conn_log(struct dc_context *ctx, 52 const struct dc_link *link, 53 uint8_t *hex_data, 54 int hex_data_count, 55 enum dc_log_type event, 56 const char *msg, 57 ...) 58{ 59 int i; 60 va_list args; 61 struct log_entry entry = { 0 }; 62 enum signal_type signal; 63 64 if (link->local_sink) 65 signal = link->local_sink->sink_signal; 66 else 67 signal = link->connector_signal; 68 69 if (link->type == dc_connection_mst_branch) 70 signal = SIGNAL_TYPE_DISPLAY_PORT_MST; 71 72 dm_logger_open(ctx->logger, &entry, event); 73 74 for (i = 0; i < NUM_ELEMENTS(signal_type_info_tbl); i++) 75 if (signal == signal_type_info_tbl[i].type) 76 break; 77 78 if (i == NUM_ELEMENTS(signal_type_info_tbl)) 79 goto fail; 80 81 dm_logger_append(&entry, "[%s][ConnIdx:%d] ", 82 signal_type_info_tbl[i].name, 83 link->link_index); 84 85 va_start(args, msg); 86 dm_logger_append_va(&entry, msg, args); 87 88 if (entry.buf_offset > 0 && 89 entry.buf[entry.buf_offset - 1] == '\n') 90 entry.buf_offset--; 91 92 if (hex_data) 93 for (i = 0; i < hex_data_count; i++) 94 dm_logger_append(&entry, "%2.2X ", hex_data[i]); 95 96 dm_logger_append(&entry, "^\n"); 97 98fail: 99 dm_logger_close(&entry); 100 101 va_end(args); 102}