1 /* 2 * Copyright 2012-15 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 #ifndef __DAL_AUX_ENGINE_H__ 27 #define __DAL_AUX_ENGINE_H__ 28 29 #include "dc_ddc_types.h" 30 31 struct aux_engine; 32 33 struct aux_engine_funcs { 34 void (*destroy)( 35 struct aux_engine **ptr); 36 bool (*acquire_engine)( 37 struct aux_engine *engine); 38 void (*configure)( 39 struct aux_engine *engine, 40 union aux_config cfg); 41 void (*submit_channel_request)( 42 struct aux_engine *engine, 43 struct aux_request_transaction_data *request); 44 void (*process_channel_reply)( 45 struct aux_engine *engine, 46 struct aux_reply_transaction_data *reply); 47 int (*read_channel_reply)( 48 struct aux_engine *engine, 49 uint32_t size, 50 uint8_t *buffer, 51 uint8_t *reply_result, 52 uint32_t *sw_status); 53 enum aux_channel_operation_result (*get_channel_status)( 54 struct aux_engine *engine, 55 uint8_t *returned_bytes); 56 bool (*is_engine_available) ( 57 struct aux_engine *engine); 58 }; 59 60 struct aux_engine { 61 struct engine base; 62 const struct aux_engine_funcs *funcs; 63 /* following values are expressed in milliseconds */ 64 uint32_t delay; 65 uint32_t max_defer_write_retry; 66 67 bool acquire_reset; 68 }; 69 70 void dal_aux_engine_construct( 71 struct aux_engine *engine, 72 struct dc_context *ctx); 73 74 void dal_aux_engine_destruct( 75 struct aux_engine *engine); 76 bool dal_aux_engine_submit_request( 77 struct engine *ptr, 78 struct i2caux_transaction_request *request, 79 bool middle_of_transaction); 80 bool dal_aux_engine_acquire( 81 struct engine *ptr, 82 struct ddc *ddc); 83 enum i2caux_engine_type dal_aux_engine_get_engine_type( 84 const struct engine *engine); 85 86 #endif 87