~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to drivers/gpu/drm/i915/dvo_sil164.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno, Martin Michlmayr
  • Date: 2011-04-06 13:53:30 UTC
  • mfrom: (43.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110406135330-wjufxhd0tvn3zx4z
Tags: 2.6.38-3
[ Ben Hutchings ]
* [ppc64] Add to linux-tools package architectures (Closes: #620124)
* [amd64] Save cr4 to mmu_cr4_features at boot time (Closes: #620284)
* appletalk: Fix bugs introduced when removing use of BKL
* ALSA: Fix yet another race in disconnection
* cciss: Fix lost command issue
* ath9k: Fix kernel panic in AR2427
* ses: Avoid kernel panic when lun 0 is not mapped
* PCI/ACPI: Report ASPM support to BIOS if not disabled from command line

[ Aurelien Jarno ]
* rtlwifi: fix build when PCI is not enabled.

[ Martin Michlmayr ]
* rtlwifi: Eliminate udelay calls with too large values (Closes: #620204)

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
 
59
59
#define SIL164_REGC 0x0c
60
60
 
61
 
struct sil164_save_rec {
62
 
        uint8_t reg8;
63
 
        uint8_t reg9;
64
 
        uint8_t regc;
65
 
};
66
 
 
67
61
struct sil164_priv {
68
62
        //I2CDevRec d;
69
63
        bool quiet;
70
 
        struct sil164_save_rec save_regs;
71
 
        struct sil164_save_rec mode_regs;
72
64
};
73
65
 
74
66
#define SILPTR(d) ((SIL164Ptr)(d->DriverPrivate.ptr))
77
69
{
78
70
        struct sil164_priv *sil = dvo->dev_priv;
79
71
        struct i2c_adapter *adapter = dvo->i2c_bus;
80
 
        struct intel_i2c_chan *i2cbus = container_of(adapter, struct intel_i2c_chan, adapter);
81
72
        u8 out_buf[2];
82
73
        u8 in_buf[2];
83
74
 
99
90
        out_buf[0] = addr;
100
91
        out_buf[1] = 0;
101
92
 
102
 
        if (i2c_transfer(&i2cbus->adapter, msgs, 2) == 2) {
 
93
        if (i2c_transfer(adapter, msgs, 2) == 2) {
103
94
                *ch = in_buf[0];
104
95
                return true;
105
96
        };
106
97
 
107
98
        if (!sil->quiet) {
108
 
                DRM_DEBUG("Unable to read register 0x%02x from %s:%02x.\n",
109
 
                          addr, i2cbus->adapter.name, dvo->slave_addr);
 
99
                DRM_DEBUG_KMS("Unable to read register 0x%02x from %s:%02x.\n",
 
100
                          addr, adapter->name, dvo->slave_addr);
110
101
        }
111
102
        return false;
112
103
}
115
106
{
116
107
        struct sil164_priv *sil= dvo->dev_priv;
117
108
        struct i2c_adapter *adapter = dvo->i2c_bus;
118
 
        struct intel_i2c_chan *i2cbus = container_of(adapter, struct intel_i2c_chan, adapter);
119
109
        uint8_t out_buf[2];
120
110
        struct i2c_msg msg = {
121
111
                .addr = dvo->slave_addr,
127
117
        out_buf[0] = addr;
128
118
        out_buf[1] = ch;
129
119
 
130
 
        if (i2c_transfer(&i2cbus->adapter, &msg, 1) == 1)
 
120
        if (i2c_transfer(adapter, &msg, 1) == 1)
131
121
                return true;
132
122
 
133
123
        if (!sil->quiet) {
134
 
                DRM_DEBUG("Unable to write register 0x%02x to %s:%d.\n",
135
 
                          addr, i2cbus->adapter.name, dvo->slave_addr);
 
124
                DRM_DEBUG_KMS("Unable to write register 0x%02x to %s:%d.\n",
 
125
                          addr, adapter->name, dvo->slave_addr);
136
126
        }
137
127
 
138
128
        return false;
158
148
                goto out;
159
149
 
160
150
        if (ch != (SIL164_VID & 0xff)) {
161
 
                DRM_DEBUG("sil164 not detected got %d: from %s Slave %d.\n",
 
151
                DRM_DEBUG_KMS("sil164 not detected got %d: from %s Slave %d.\n",
162
152
                          ch, adapter->name, dvo->slave_addr);
163
153
                goto out;
164
154
        }
167
157
                goto out;
168
158
 
169
159
        if (ch != (SIL164_DID & 0xff)) {
170
 
                DRM_DEBUG("sil164 not detected got %d: from %s Slave %d.\n",
 
160
                DRM_DEBUG_KMS("sil164 not detected got %d: from %s Slave %d.\n",
171
161
                          ch, adapter->name, dvo->slave_addr);
172
162
                goto out;
173
163
        }
174
164
        sil->quiet = false;
175
165
 
176
 
        DRM_DEBUG("init sil164 dvo controller successfully!\n");
 
166
        DRM_DEBUG_KMS("init sil164 dvo controller successfully!\n");
177
167
        return true;
178
168
 
179
169
out:
241
231
        uint8_t val;
242
232
 
243
233
        sil164_readb(dvo, SIL164_FREQ_LO, &val);
244
 
        DRM_DEBUG("SIL164_FREQ_LO: 0x%02x\n", val);
 
234
        DRM_LOG_KMS("SIL164_FREQ_LO: 0x%02x\n", val);
245
235
        sil164_readb(dvo, SIL164_FREQ_HI, &val);
246
 
        DRM_DEBUG("SIL164_FREQ_HI: 0x%02x\n", val);
 
236
        DRM_LOG_KMS("SIL164_FREQ_HI: 0x%02x\n", val);
247
237
        sil164_readb(dvo, SIL164_REG8, &val);
248
 
        DRM_DEBUG("SIL164_REG8: 0x%02x\n", val);
 
238
        DRM_LOG_KMS("SIL164_REG8: 0x%02x\n", val);
249
239
        sil164_readb(dvo, SIL164_REG9, &val);
250
 
        DRM_DEBUG("SIL164_REG9: 0x%02x\n", val);
 
240
        DRM_LOG_KMS("SIL164_REG9: 0x%02x\n", val);
251
241
        sil164_readb(dvo, SIL164_REGC, &val);
252
 
        DRM_DEBUG("SIL164_REGC: 0x%02x\n", val);
253
 
}
254
 
 
255
 
static void sil164_save(struct intel_dvo_device *dvo)
256
 
{
257
 
        struct sil164_priv *sil= dvo->dev_priv;
258
 
 
259
 
        if (!sil164_readb(dvo, SIL164_REG8, &sil->save_regs.reg8))
260
 
                return;
261
 
 
262
 
        if (!sil164_readb(dvo, SIL164_REG9, &sil->save_regs.reg9))
263
 
                return;
264
 
 
265
 
        if (!sil164_readb(dvo, SIL164_REGC, &sil->save_regs.regc))
266
 
                return;
267
 
 
268
 
        return;
269
 
}
270
 
 
271
 
static void sil164_restore(struct intel_dvo_device *dvo)
272
 
{
273
 
        struct sil164_priv *sil = dvo->dev_priv;
274
 
 
275
 
        /* Restore it powered down initially */
276
 
        sil164_writeb(dvo, SIL164_REG8, sil->save_regs.reg8 & ~0x1);
277
 
 
278
 
        sil164_writeb(dvo, SIL164_REG9, sil->save_regs.reg9);
279
 
        sil164_writeb(dvo, SIL164_REGC, sil->save_regs.regc);
280
 
        sil164_writeb(dvo, SIL164_REG8, sil->save_regs.reg8);
 
242
        DRM_LOG_KMS("SIL164_REGC: 0x%02x\n", val);
281
243
}
282
244
 
283
245
static void sil164_destroy(struct intel_dvo_device *dvo)
297
259
        .mode_set = sil164_mode_set,
298
260
        .dpms = sil164_dpms,
299
261
        .dump_regs = sil164_dump_regs,
300
 
        .save = sil164_save,
301
 
        .restore = sil164_restore,
302
262
        .destroy = sil164_destroy,
303
263
};