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