Home | History | Annotate | Line # | Download | only in include
      1 /*	$NetBSD: i2caux_interface.h,v 1.2 2021/12/18 23:45:07 riastradh Exp $	*/
      2 
      3 /*
      4  * Copyright 2012-15 Advanced Micro Devices, Inc.
      5  *
      6  * Permission is hereby granted, free of charge, to any person obtaining a
      7  * copy of this software and associated documentation files (the "Software"),
      8  * to deal in the Software without restriction, including without limitation
      9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  * and/or sell copies of the Software, and to permit persons to whom the
     11  * Software is furnished to do so, subject to the following conditions:
     12  *
     13  * The above copyright notice and this permission notice shall be included in
     14  * all copies or substantial portions of the Software.
     15  *
     16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     22  * OTHER DEALINGS IN THE SOFTWARE.
     23  *
     24  * Authors: AMD
     25  *
     26  */
     27 
     28 #ifndef __DAL_I2CAUX_INTERFACE_H__
     29 #define __DAL_I2CAUX_INTERFACE_H__
     30 
     31 #include "dc_types.h"
     32 #include "gpio_service_interface.h"
     33 
     34 
     35 #define DEFAULT_AUX_MAX_DATA_SIZE 16
     36 #define AUX_MAX_DEFER_WRITE_RETRY 20
     37 
     38 struct aux_payload {
     39 	/* set following flag to read/write I2C data,
     40 	 * reset it to read/write DPCD data */
     41 	bool i2c_over_aux;
     42 	/* set following flag to write data,
     43 	 * reset it to read data */
     44 	bool write;
     45 	bool mot;
     46 	uint32_t address;
     47 	uint32_t length;
     48 	uint8_t *data;
     49 	/*
     50 	 * used to return the reply type of the transaction
     51 	 * ignored if NULL
     52 	 */
     53 	uint8_t *reply;
     54 	/* expressed in milliseconds
     55 	 * zero means "use default value"
     56 	 */
     57 	uint32_t defer_delay;
     58 };
     59 
     60 struct aux_command {
     61 	struct aux_payload *payloads;
     62 	uint8_t number_of_payloads;
     63 
     64 	/* expressed in milliseconds
     65 	 * zero means "use default value" */
     66 	uint32_t defer_delay;
     67 
     68 	/* zero means "use default value" */
     69 	uint32_t max_defer_write_retry;
     70 
     71 	enum i2c_mot_mode mot;
     72 };
     73 
     74 union aux_config {
     75 	struct {
     76 		uint32_t ALLOW_AUX_WHEN_HPD_LOW:1;
     77 	} bits;
     78 	uint32_t raw;
     79 };
     80 
     81 #endif
     82