summaryrefslogtreecommitdiff
path: root/hw/xfree86/i2c
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-25 19:29:01 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-25 19:29:01 +0000
commitadc7f9a4ebdfe11d4cd6de9388b63dfe36450b39 (patch)
tree23eb7becc5360b2cbe16aa8d45529880067f3989 /hw/xfree86/i2c
parent90f1536dd315cd265bfc7ef35058761a65a01734 (diff)
XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folksxf86-4_3_99_16
Diffstat (limited to 'hw/xfree86/i2c')
-rw-r--r--hw/xfree86/i2c/xf86i2c.c35
-rw-r--r--hw/xfree86/i2c/xf86i2c.h6
2 files changed, 36 insertions, 5 deletions
diff --git a/hw/xfree86/i2c/xf86i2c.c b/hw/xfree86/i2c/xf86i2c.c
index 494f9303b..a7f5adf1a 100644
--- a/hw/xfree86/i2c/xf86i2c.c
+++ b/hw/xfree86/i2c/xf86i2c.c
@@ -6,7 +6,7 @@
* (c) 1998 Gerd Knorr <kraxel@cs.tu-berlin.de>
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c,v 1.13 2002/09/16 18:06:07 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c,v 1.15 2003/08/29 21:08:06 tsi Exp $ */
#if 1
#include "misc.h"
@@ -750,7 +750,7 @@ xf86DestroyI2CBusRec(I2CBusPtr b, Bool unalloc, Bool devs_too)
if (b) {
I2CBusPtr *p;
- /* Remove this from the list of active I2C busses. */
+ /* Remove this from the list of active I2C buses */
for (p = &I2CBusList; *p != NULL; p = &(*p)->NextBus)
if (*p == b) {
@@ -794,7 +794,7 @@ xf86DestroyI2CBusRec(I2CBusPtr b, Bool unalloc, Bool devs_too)
Bool
xf86I2CBusInit(I2CBusPtr b)
{
- /* I2C busses must be identified by a unique scrnIndex
+ /* I2C buses must be identified by a unique scrnIndex
* and name. If scrnIndex is unspecified (a negative value),
* then the name must be unique throughout the server.
*/
@@ -861,3 +861,32 @@ xf86I2CFindBus(int scrnIndex, char *name)
return NULL;
}
+
+/*
+ * Return an array of I2CBusPtr's related to a screen. The caller is
+ * responsible for freeing the array.
+ */
+int
+xf86I2CGetScreenBuses(int scrnIndex, I2CBusPtr **pppI2CBus)
+{
+ I2CBusPtr pI2CBus;
+ int n = 0;
+
+ if (pppI2CBus)
+ *pppI2CBus = NULL;
+
+ for (pI2CBus = I2CBusList; pI2CBus; pI2CBus = pI2CBus->NextBus) {
+ if ((pI2CBus->scrnIndex >= 0) && (pI2CBus->scrnIndex != scrnIndex))
+ continue;
+
+ n++;
+
+ if (!pppI2CBus)
+ continue;
+
+ *pppI2CBus = xnfrealloc(*pppI2CBus, n * sizeof(I2CBusPtr));
+ *pppI2CBus[n - 1] = pI2CBus;
+ }
+
+ return n;
+}
diff --git a/hw/xfree86/i2c/xf86i2c.h b/hw/xfree86/i2c/xf86i2c.h
index 42b68a179..e7423155a 100644
--- a/hw/xfree86/i2c/xf86i2c.h
+++ b/hw/xfree86/i2c/xf86i2c.h
@@ -2,11 +2,11 @@
* Copyright (C) 1998 Itai Nahshon, Michael Schimek
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.h,v 1.8 2001/07/19 14:19:40 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.h,v 1.11 2003/08/29 21:08:06 tsi Exp $ */
#ifndef _XF86I2C_H
#define _XF86I2C_H
-#include "miscstruct.h"
+#include "regionstr.h"
typedef unsigned char I2CByte;
typedef unsigned short I2CSlaveAddr;
@@ -52,6 +52,8 @@ I2CBusPtr xf86CreateI2CBusRec(void);
void xf86DestroyI2CBusRec(I2CBusPtr pI2CBus, Bool unalloc, Bool devs_too);
Bool xf86I2CBusInit(I2CBusPtr pI2CBus);
I2CBusPtr xf86I2CFindBus(int scrnIndex, char *name);
+int xf86I2CGetScreenBuses(int scrnIndex, I2CBusPtr **pppI2CBus);
+
/* I2C slave devices */