1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * Copyright (c) 2020 Loongson Technology Co., Ltd. 4 * Authors: 5 * sunhao <sunhao@loongson.cn> 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License as published by the 8 * Free Software Foundation; either version 2 of the License, or (at your 9 * option) any later version. 10 */ 11 12 #ifndef __LOONGSON_I2C_H__ 13 #define __LOONGSON_I2C_H__ 14 15 #include <linux/i2c.h> 16 #include <linux/i2c-algo-bit.h> 17 #include <drm/drm_edid.h> 18 19 /* Modify this marco to config i2c bus speed, bus_freq = 500 / T */ 20 /* Eg: i2c_bus_freq=100k when T=5 */ 21 #define DC_I2C_TON 5 22 #define DC_I2C_NAME "ls7a_dc_i2c" 23 #define DC_I2C_BUS_MAX 2 24 25 /* Loongson 7A display controller proprietary GPIOs */ 26 #define LS7A_DC_GPIO_CFG_OFFSET (0x1660) 27 #define LS7A_DC_GPIO_IN_OFFSET (0x1650) 28 #define LS7A_DC_GPIO_OUT_OFFSET (0x1650) 29 30 struct loongson_drm_device; 31 32 struct loongson_i2c { 33 struct loongson_drm_device *ldev; 34 struct i2c_client *ddc_client; 35 struct i2c_adapter *adapter; 36 u32 data, clock; 37 bool use, init; 38 u32 i2c_id; 39 }; 40 41 int loongson_i2c_init(struct loongson_drm_device *ldev); 42 43 #endif 44