diff options
Diffstat (limited to 'drivers/video/intelfb/intelfb_i2c.c')
-rw-r--r-- | drivers/video/intelfb/intelfb_i2c.c | 60 |
1 files changed, 33 insertions, 27 deletions
diff --git a/drivers/video/intelfb/intelfb_i2c.c b/drivers/video/intelfb/intelfb_i2c.c index 61e4c8759b23..94c08bb5acf1 100644 --- a/drivers/video/intelfb/intelfb_i2c.c +++ b/drivers/video/intelfb/intelfb_i2c.c | |||
@@ -58,7 +58,8 @@ static void intelfb_gpio_setscl(void *data, int state) | |||
58 | struct intelfb_info *dinfo = chan->dinfo; | 58 | struct intelfb_info *dinfo = chan->dinfo; |
59 | u32 val; | 59 | u32 val; |
60 | 60 | ||
61 | OUTREG(chan->reg, (state ? SCL_VAL_OUT : 0) | SCL_DIR | SCL_DIR_MASK | SCL_VAL_MASK); | 61 | OUTREG(chan->reg, (state ? SCL_VAL_OUT : 0) | |
62 | SCL_DIR | SCL_DIR_MASK | SCL_VAL_MASK); | ||
62 | val = INREG(chan->reg); | 63 | val = INREG(chan->reg); |
63 | } | 64 | } |
64 | 65 | ||
@@ -68,7 +69,8 @@ static void intelfb_gpio_setsda(void *data, int state) | |||
68 | struct intelfb_info *dinfo = chan->dinfo; | 69 | struct intelfb_info *dinfo = chan->dinfo; |
69 | u32 val; | 70 | u32 val; |
70 | 71 | ||
71 | OUTREG(chan->reg, (state ? SDA_VAL_OUT : 0) | SDA_DIR | SDA_DIR_MASK | SDA_VAL_MASK); | 72 | OUTREG(chan->reg, (state ? SDA_VAL_OUT : 0) | |
73 | SDA_DIR | SDA_DIR_MASK | SDA_VAL_MASK); | ||
72 | val = INREG(chan->reg); | 74 | val = INREG(chan->reg); |
73 | } | 75 | } |
74 | 76 | ||
@@ -97,26 +99,26 @@ static int intelfb_gpio_getsda(void *data) | |||
97 | } | 99 | } |
98 | 100 | ||
99 | static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo, | 101 | static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo, |
100 | struct intelfb_i2c_chan *chan, | 102 | struct intelfb_i2c_chan *chan, |
101 | const u32 reg, const char *name) | 103 | const u32 reg, const char *name) |
102 | { | 104 | { |
103 | int rc; | 105 | int rc; |
104 | 106 | ||
105 | chan->dinfo = dinfo; | 107 | chan->dinfo = dinfo; |
106 | chan->reg = reg; | 108 | chan->reg = reg; |
107 | snprintf(chan->adapter.name, sizeof(chan->adapter.name), | 109 | snprintf(chan->adapter.name, sizeof(chan->adapter.name), |
108 | "intelfb %s", name); | 110 | "intelfb %s", name); |
109 | chan->adapter.owner = THIS_MODULE; | 111 | chan->adapter.owner = THIS_MODULE; |
110 | chan->adapter.id = I2C_HW_B_INTELFB; | 112 | chan->adapter.id = I2C_HW_B_INTELFB; |
111 | chan->adapter.algo_data = &chan->algo; | 113 | chan->adapter.algo_data = &chan->algo; |
112 | chan->adapter.dev.parent = &chan->dinfo->pdev->dev; | 114 | chan->adapter.dev.parent = &chan->dinfo->pdev->dev; |
113 | chan->algo.setsda = intelfb_gpio_setsda; | 115 | chan->algo.setsda = intelfb_gpio_setsda; |
114 | chan->algo.setscl = intelfb_gpio_setscl; | 116 | chan->algo.setscl = intelfb_gpio_setscl; |
115 | chan->algo.getsda = intelfb_gpio_getsda; | 117 | chan->algo.getsda = intelfb_gpio_getsda; |
116 | chan->algo.getscl = intelfb_gpio_getscl; | 118 | chan->algo.getscl = intelfb_gpio_getscl; |
117 | chan->algo.udelay = 40; | 119 | chan->algo.udelay = 40; |
118 | chan->algo.timeout = 20; | 120 | chan->algo.timeout = 20; |
119 | chan->algo.data = chan; | 121 | chan->algo.data = chan; |
120 | 122 | ||
121 | i2c_set_adapdata(&chan->adapter, chan); | 123 | i2c_set_adapdata(&chan->adapter, chan); |
122 | 124 | ||
@@ -142,40 +144,44 @@ void intelfb_create_i2c_busses(struct intelfb_info *dinfo) | |||
142 | dinfo->output[i].type = INTELFB_OUTPUT_ANALOG; | 144 | dinfo->output[i].type = INTELFB_OUTPUT_ANALOG; |
143 | 145 | ||
144 | /* setup the DDC bus for analog output */ | 146 | /* setup the DDC bus for analog output */ |
145 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, GPIOA, "CRTDDC_A"); | 147 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, GPIOA, |
148 | "CRTDDC_A"); | ||
146 | i++; | 149 | i++; |
147 | 150 | ||
148 | /* need to add the output busses for each device | 151 | /* need to add the output busses for each device |
149 | - this function is very incomplete | 152 | - this function is very incomplete |
150 | - i915GM has LVDS and TVOUT for example | 153 | - i915GM has LVDS and TVOUT for example |
151 | */ | 154 | */ |
152 | switch(dinfo->chipset) { | 155 | switch(dinfo->chipset) { |
153 | case INTEL_830M: | 156 | case INTEL_830M: |
154 | case INTEL_845G: | 157 | case INTEL_845G: |
155 | case INTEL_855GM: | 158 | case INTEL_855GM: |
156 | case INTEL_865G: | 159 | case INTEL_865G: |
157 | dinfo->output[i].type = INTELFB_OUTPUT_DVO; | 160 | dinfo->output[i].type = INTELFB_OUTPUT_DVO; |
158 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, GPIOD, "DVODDC_D"); | 161 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].ddc_bus, |
159 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus, GPIOE, "DVOI2C_E"); | 162 | GPIOD, "DVODDC_D"); |
163 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus, | ||
164 | GPIOE, "DVOI2C_E"); | ||
160 | i++; | 165 | i++; |
161 | break; | 166 | break; |
162 | case INTEL_915G: | 167 | case INTEL_915G: |
163 | case INTEL_915GM: | 168 | case INTEL_915GM: |
164 | /* has some LVDS + tv-out */ | 169 | /* has some LVDS + tv-out */ |
165 | case INTEL_945G: | 170 | case INTEL_945G: |
166 | case INTEL_945GM: | 171 | case INTEL_945GM: |
167 | /* SDVO ports have a single control bus - 2 devices */ | 172 | /* SDVO ports have a single control bus - 2 devices */ |
168 | dinfo->output[i].type = INTELFB_OUTPUT_SDVO; | 173 | dinfo->output[i].type = INTELFB_OUTPUT_SDVO; |
169 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus, GPIOE, "SDVOCTRL_E"); | 174 | intelfb_setup_i2c_bus(dinfo, &dinfo->output[i].i2c_bus, |
175 | GPIOE, "SDVOCTRL_E"); | ||
170 | /* TODO: initialize the SDVO */ | 176 | /* TODO: initialize the SDVO */ |
171 | // I830SDVOInit(pScrn, i, DVOB); | 177 | /* I830SDVOInit(pScrn, i, DVOB); */ |
172 | i++; | 178 | i++; |
173 | 179 | ||
174 | /* set up SDVOC */ | 180 | /* set up SDVOC */ |
175 | dinfo->output[i].type = INTELFB_OUTPUT_SDVO; | 181 | dinfo->output[i].type = INTELFB_OUTPUT_SDVO; |
176 | dinfo->output[i].i2c_bus = dinfo->output[i - 1].i2c_bus; | 182 | dinfo->output[i].i2c_bus = dinfo->output[i - 1].i2c_bus; |
177 | /* TODO: initialize the SDVO */ | 183 | /* TODO: initialize the SDVO */ |
178 | // I830SDVOInit(pScrn, i, DVOC); | 184 | /* I830SDVOInit(pScrn, i, DVOC); */ |
179 | i++; | 185 | i++; |
180 | break; | 186 | break; |
181 | } | 187 | } |