summaryrefslogtreecommitdiff
path: root/src/via_i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/via_i2c.c')
-rw-r--r--src/via_i2c.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/via_i2c.c b/src/via_i2c.c
index 086320a..898d836 100644
--- a/src/via_i2c.c
+++ b/src/via_i2c.c
@@ -357,3 +357,22 @@ ViaI2CInit(ScrnInfoPtr pScrn)
pVia->I2CBus[4] = I2CBus5Init(pScrn->scrnIndex);
}
}
+
+/*
+ * Sure, it is polluting namespace, but this one is quite useful.
+ */
+Bool
+xf86I2CMaskByte(I2CDevPtr d, I2CByte subaddr, I2CByte value, I2CByte mask)
+{
+ I2CByte tmp;
+ Bool ret;
+
+ ret = xf86I2CReadByte(d, subaddr, &tmp);
+ if (!ret)
+ return FALSE;
+
+ tmp &= ~mask;
+ tmp |= (value & mask);
+
+ return xf86I2CWriteByte(d, subaddr, tmp);
+}