Linux Audio

Check our new training course

Loading...
Note: File does not exist in v6.9.4.
 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_I2CAUX_INTERFACE_H__
27#define __DAL_I2CAUX_INTERFACE_H__
28
29#include "dc_types.h"
30#include "gpio_service_interface.h"
31
32
33#define DEFAULT_AUX_MAX_DATA_SIZE 16
34#define AUX_MAX_DEFER_WRITE_RETRY 20
35
36struct aux_payload {
37	/* set following flag to read/write I2C data,
38	 * reset it to read/write DPCD data */
39	bool i2c_over_aux;
40	/* set following flag to write data,
41	 * reset it to read data */
42	bool write;
43	uint32_t address;
44	uint8_t length;
45	uint8_t *data;
46};
47
48struct aux_command {
49	struct aux_payload *payloads;
50	uint8_t number_of_payloads;
51
52	/* expressed in milliseconds
53	 * zero means "use default value" */
54	uint32_t defer_delay;
55
56	/* zero means "use default value" */
57	uint32_t max_defer_write_retry;
58
59	enum i2c_mot_mode mot;
60};
61
62union aux_config {
63	struct {
64		uint32_t ALLOW_AUX_WHEN_HPD_LOW:1;
65	} bits;
66	uint32_t raw;
67};
68
69struct i2caux;
70
71struct i2caux *dal_i2caux_create(
72	struct dc_context *ctx);
73
74bool dal_i2caux_submit_i2c_command(
75	struct i2caux *i2caux,
76	struct ddc *ddc,
77	struct i2c_command *cmd);
78
79bool dal_i2caux_submit_aux_command(
80	struct i2caux *i2caux,
81	struct ddc *ddc,
82	struct aux_command *cmd);
83
84void dal_i2caux_configure_aux(
85	struct i2caux *i2caux,
86	struct ddc *ddc,
87	union aux_config cfg);
88
89void dal_i2caux_destroy(
90	struct i2caux **ptr);
91
92#endif