1 /*	$NetBSD: intel_gmbus.h,v 1.2 2021/12/18 23:45:30 riastradh Exp $	*/
2 
3 /* SPDX-License-Identifier: MIT */
4 /*
5  * Copyright © 2019 Intel Corporation
6  */
7 
8 #ifndef __INTEL_GMBUS_H__
9 #define __INTEL_GMBUS_H__
10 
11 #include <linux/types.h>
12 
13 struct drm_i915_private;
14 struct i2c_adapter;
15 
16 #define GMBUS_PIN_DISABLED	0
17 #define GMBUS_PIN_SSC		1
18 #define GMBUS_PIN_VGADDC	2
19 #define GMBUS_PIN_PANEL		3
20 #define GMBUS_PIN_DPD_CHV	3 /* HDMID_CHV */
21 #define GMBUS_PIN_DPC		4 /* HDMIC */
22 #define GMBUS_PIN_DPB		5 /* SDVO, HDMIB */
23 #define GMBUS_PIN_DPD		6 /* HDMID */
24 #define GMBUS_PIN_RESERVED	7 /* 7 reserved */
25 #define GMBUS_PIN_1_BXT		1 /* BXT+ (atom) and CNP+ (big core) */
26 #define GMBUS_PIN_2_BXT		2
27 #define GMBUS_PIN_3_BXT		3
28 #define GMBUS_PIN_4_CNP		4
29 #define GMBUS_PIN_9_TC1_ICP	9
30 #define GMBUS_PIN_10_TC2_ICP	10
31 #define GMBUS_PIN_11_TC3_ICP	11
32 #define GMBUS_PIN_12_TC4_ICP	12
33 #define GMBUS_PIN_13_TC5_TGP	13
34 #define GMBUS_PIN_14_TC6_TGP	14
35 
36 #define GMBUS_NUM_PINS	15 /* including 0 */
37 
38 int intel_gmbus_setup(struct drm_i915_private *dev_priv);
39 void intel_gmbus_teardown(struct drm_i915_private *dev_priv);
40 bool intel_gmbus_is_valid_pin(struct drm_i915_private *dev_priv,
41 			      unsigned int pin);
42 int intel_gmbus_output_aksv(struct i2c_adapter *adapter);
43 
44 struct i2c_adapter *
45 intel_gmbus_get_adapter(struct drm_i915_private *dev_priv, unsigned int pin);
46 void intel_gmbus_set_speed(struct i2c_adapter *adapter, int speed);
47 void intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit);
48 bool intel_gmbus_is_forced_bit(struct i2c_adapter *adapter);
49 void intel_gmbus_reset(struct drm_i915_private *dev_priv);
50 
51 #endif /* __INTEL_GMBUS_H__ */
52