xref: /aosp_15_r20/external/coreboot/src/drivers/i2c/ptn3460/ptn3460.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef _I2C_PTN3460_H_
4 #define _I2C_PTN3460_H_
5 
6 #include <types.h>
7 
8 #define PTN_EDID_OFF		0x00
9 #define PTN_EDID_LEN		0x80
10 #define PTN_CONFIG_OFF		0x80
11 #define PTN_CONFIG_LEN		0x19
12 #define PTN_FLASH_CFG_OFF	0xE8
13 #define PTN_FLASH_CFG_LEN	0x04
14 #define PTN_MAX_EDID_NUM	6
15 #define PTN_ENABLE_EMULATION	(1 << 0)
16 
17 /* Define some error codes that can be used */
18 #define PTN_SUCCESS		0x00000000
19 #define PTN_BUS_ERROR		0x10000000
20 #define PTN_INVALID_EDID	0x20000000
21 #define PTN_INVALID_EDID_BLOCK	0x30000000
22 #define PTN_ERROR		0x40000000
23 
24 struct ptn_3460_config {
25 	u8	dp_interface_ctrl;	/* DisplayPort interface control */
26 	u8	lvds_interface_ctrl1;	/* LVDS interface control register 1 */
27 	u8	lvds_interface_ctrl2;	/* LVDS interface control register 2 */
28 	u8	lvds_interface_ctrl3;	/* LVDS interface control register 3 */
29 	u8	edid_rom_emulation;	/* select which EDID-block is emulated */
30 	u8	edid_rom_access_ctrl;	/* select which EDID block to map to 0..0x7F */
31 	u8	pwm_min[3];		/* smallest PWM frequency for back light */
32 	u8	pwm_max[3];		/* biggest PWM frequency for back light */
33 	u8	fast_link_ctrl;		/* Fast link training control register */
34 	u8	pin_cfg_ctrl1;		/* Pin configuration control register 1 */
35 	u8	pin_cfg_ctrl2;		/* Pin configuration control register 2 */
36 	u8	pwm_default;		/* Default PWM bit count in DPCD register */
37 	u16	pwm_value;		/* Current PWM bit count in DPCD register */
38 	u8	pwm_default_freq;	/* Default PWM frequency in DPCD register */
39 	u8	t3_timing;		/* Panel T3 timing value */
40 	u8	t12_timing;		/* Panel T12 timing value */
41 	u8	backlight_ctrl;		/* Back light control register */
42 	u8	t2_delay;		/* Panel T2 delay */
43 	u8	t4_timing;		/* Panel T4 timing value */
44 	u8	t5_delay;		/* Panel T5 delay */
45 } __packed;
46 
47 struct ptn_3460_flash {
48 	u8	cmd;			/* Flash command (erase or erase and flash) */
49 	u16	magic;			/* Magic number needed by the flash algorithm */
50 	u8	trigger;		/* Trigger for starting flash operation */
51 } __packed;
52 
53 /* We need functions which we can call to get mainboard specific data */
54 enum cb_err mainboard_ptn3460_get_edid(uint8_t edid_data[PTN_EDID_LEN]);
55 uint8_t mainboard_ptn3460_select_edid_table(void);
56 enum cb_err mainboard_ptn3460_config(struct ptn_3460_config *cfg_ptr);
57 
58 #endif /* _I2C_PTN3460_H_ */
59