15 #include <linux/i2c.h>
16 #include <linux/slab.h>
24 #define DDC1_DATA 0x02
26 #define DDC1B_CLK 0x10
27 #define DDC1B_DATA 0x04
30 #define DDC2_DATA 0x01
68 matroxfb_set_gpio(minfo, ~mask, state);
71 static void matroxfb_gpio_setsda(
void*
data,
int state) {
73 matroxfb_i2c_set(b->
minfo, b->
mask.data, state);
76 static void matroxfb_gpio_setscl(
void*
data,
int state) {
78 matroxfb_i2c_set(b->
minfo, b->
mask.clock, state);
81 static int matroxfb_gpio_getsda(
void*
data) {
83 return (matroxfb_read_gpio(b->
minfo) & b->
mask.data) ? 1 : 0;
86 static int matroxfb_gpio_getscl(
void* data) {
88 return (matroxfb_read_gpio(b->
minfo) & b->
mask.clock) ? 1 : 0;
93 .setsda = matroxfb_gpio_setsda,
94 .setscl = matroxfb_gpio_setscl,
95 .getsda = matroxfb_gpio_getsda,
96 .getscl = matroxfb_gpio_getscl,
102 unsigned int data,
unsigned int clock,
const char *
name,
113 i2c_set_adapdata(&b->
adapter, b);
117 b->
bac = matrox_i2c_algo_template;
132 i2c_bit_bus_del(&minfo2->
maven);
136 i2c_bit_bus_del(&minfo2->
ddc1);
140 i2c_bit_bus_del(&minfo2->
ddc2);
148 m2info = kzalloc(
sizeof(*m2info),
GFP_KERNEL);
157 switch (minfo->
chip) {
160 err = i2c_bus_reg(&m2info->
ddc1, minfo,
165 err = i2c_bus_reg(&m2info->
ddc1, minfo,
173 err = i2c_bus_reg(&m2info->
ddc2, minfo,
177 printk(
KERN_INFO "i2c-matroxfb: VGA->TV plug detected, DDC unavailable.\n");
179 printk(
KERN_INFO "i2c-matroxfb: Could not register secondary output i2c bus. Continuing anyway.\n");
181 err = i2c_bus_reg(&m2info->
maven, minfo,
184 printk(
KERN_INFO "i2c-matroxfb: Could not register Maven i2c bus. Continuing anyway.\n");
189 unsigned short const addr_list[2] = {
194 &maven_info, addr_list,
NULL);
200 printk(
KERN_ERR "i2c-matroxfb: Could not register primary adapter DDC bus.\n");
204 static void i2c_matroxfb_remove(
struct matrox_fb_info* minfo,
void* data) {
207 i2c_maven_done(m2info);
208 i2c_ddc2_done(m2info);
209 i2c_ddc1_done(m2info);
215 .name =
"i2c-matroxfb",
216 .probe = i2c_matroxfb_probe,
217 .remove = i2c_matroxfb_remove,
220 static int __init i2c_matroxfb_init(
void) {
228 static void __exit i2c_matroxfb_exit(
void) {
233 MODULE_DESCRIPTION(
"Support module providing I2C buses present on Matrox videocards");