via_i2c.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved.
  3. * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public
  6. * License as published by the Free Software Foundation;
  7. * either version 2, or (at your option) any later version.
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even
  10. * the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. * A PARTICULAR PURPOSE.See the GNU General Public License
  12. * for more details.
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc.,
  16. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. */
  18. #ifndef __VIA_I2C_H__
  19. #define __VIA_I2C_H__
  20. #include <linux/i2c.h>
  21. #include <linux/i2c-algo-bit.h>
  22. struct via_i2c_stuff {
  23. u16 i2c_port; /* GPIO or I2C port */
  24. struct i2c_adapter adapter;
  25. struct i2c_algo_bit_data algo;
  26. };
  27. #define I2CPORT 0x3c4
  28. #define I2CPORTINDEX 0x31
  29. #define GPIOPORT 0x3C4
  30. #define GPIOPORTINDEX 0x2C
  31. #define I2C_BUS 1
  32. #define GPIO_BUS 2
  33. #define DELAYPORT 0x3C3
  34. int viafb_i2c_readbyte(u8 slave_addr, u8 index, u8 *pdata);
  35. int viafb_i2c_writebyte(u8 slave_addr, u8 index, u8 data);
  36. int viafb_i2c_readbytes(u8 slave_addr, u8 index, u8 *buff, int buff_len);
  37. int viafb_create_i2c_bus(void *par);
  38. void viafb_delete_i2c_buss(void *par);
  39. #endif /* __VIA_I2C_H__ */