Linux-libre 5.3.12-gnu
[librecmc/linux-libre.git] / drivers / staging / sm750fb / ddk750_swi2c.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  *         Copyright (c) 2007 by Silicon Motion, Inc. (SMI)
4  *
5  *  All rights are reserved. Reproduction or in part is prohibited
6  *  without the written consent of the copyright owner.
7  *
8  *  swi2c.h --- SM750/SM718 DDK
9  *  This file contains the definitions for i2c using software
10  *  implementation.
11  *
12  */
13
14 #ifndef _SWI2C_H_
15 #define _SWI2C_H_
16
17 /* Default i2c CLK and Data GPIO. These are the default i2c pins */
18 #define DEFAULT_I2C_SCL                     30
19 #define DEFAULT_I2C_SDA                     31
20
21 /*
22  * This function initializes the i2c attributes and bus
23  *
24  * Parameters:
25  *      i2cClkGPIO  - The GPIO pin to be used as i2c SCL
26  *      i2cDataGPIO - The GPIO pin to be used as i2c SDA
27  *
28  * Return Value:
29  *      -1   - Fail to initialize the i2c
30  *       0   - Success
31  */
32 long sm750_sw_i2c_init(unsigned char clk_gpio, unsigned char data_gpio);
33
34 /*
35  *  This function reads the slave device's register
36  *
37  *  Parameters:
38  *      addr   - i2c Slave device address which register
39  *                        to be read from
40  *      reg    - Slave device's register to be read
41  *
42  *  Return Value:
43  *      Register value
44  */
45 unsigned char sm750_sw_i2c_read_reg(unsigned char addr, unsigned char reg);
46
47 /*
48  *  This function writes a value to the slave device's register
49  *
50  *  Parameters:
51  *      addr            - i2c Slave device address which register
52  *                        to be written
53  *      reg             - Slave device's register to be written
54  *      data            - Data to be written to the register
55  *
56  *  Result:
57  *          0   - Success
58  *         -1   - Fail
59  */
60 long sm750_sw_i2c_write_reg(unsigned char addr,
61                             unsigned char reg,
62                             unsigned char data);
63
64 #endif  /* _SWI2C_H_ */