Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 1 | /************************************************************************** |
| 2 | |
| 3 | Copyright © 2006 Dave Airlie |
| 4 | |
| 5 | All Rights Reserved. |
| 6 | |
| 7 | Permission is hereby granted, free of charge, to any person obtaining a |
| 8 | copy of this software and associated documentation files (the |
| 9 | "Software"), to deal in the Software without restriction, including |
| 10 | without limitation the rights to use, copy, modify, merge, publish, |
| 11 | distribute, sub license, and/or sell copies of the Software, and to |
| 12 | permit persons to whom the Software is furnished to do so, subject to |
| 13 | the following conditions: |
| 14 | |
| 15 | The above copyright notice and this permission notice (including the |
| 16 | next paragraph) shall be included in all copies or substantial portions |
| 17 | of the Software. |
| 18 | |
| 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 20 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
| 22 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 23 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 24 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 25 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 26 | |
| 27 | **************************************************************************/ |
| 28 | |
| 29 | #include "dvo.h" |
| 30 | |
| 31 | #define CH7xxx_REG_VID 0x4a |
| 32 | #define CH7xxx_REG_DID 0x4b |
| 33 | |
| 34 | #define CH7011_VID 0x83 /* 7010 as well */ |
braggle@free.fr | 98304ad | 2013-05-16 12:57:38 +0200 | [diff] [blame] | 35 | #define CH7010B_VID 0x05 |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 36 | #define CH7009A_VID 0x84 |
| 37 | #define CH7009B_VID 0x85 |
| 38 | #define CH7301_VID 0x95 |
| 39 | |
| 40 | #define CH7xxx_VID 0x84 |
| 41 | #define CH7xxx_DID 0x17 |
braggle@free.fr | 98304ad | 2013-05-16 12:57:38 +0200 | [diff] [blame] | 42 | #define CH7010_DID 0x16 |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 43 | |
| 44 | #define CH7xxx_NUM_REGS 0x4c |
| 45 | |
| 46 | #define CH7xxx_CM 0x1c |
| 47 | #define CH7xxx_CM_XCM (1<<0) |
| 48 | #define CH7xxx_CM_MCP (1<<2) |
| 49 | #define CH7xxx_INPUT_CLOCK 0x1d |
| 50 | #define CH7xxx_GPIO 0x1e |
| 51 | #define CH7xxx_GPIO_HPIR (1<<3) |
| 52 | #define CH7xxx_IDF 0x1f |
| 53 | |
| 54 | #define CH7xxx_IDF_HSP (1<<3) |
| 55 | #define CH7xxx_IDF_VSP (1<<4) |
| 56 | |
| 57 | #define CH7xxx_CONNECTION_DETECT 0x20 |
| 58 | #define CH7xxx_CDET_DVI (1<<5) |
| 59 | |
| 60 | #define CH7301_DAC_CNTL 0x21 |
| 61 | #define CH7301_HOTPLUG 0x23 |
| 62 | #define CH7xxx_TCTL 0x31 |
| 63 | #define CH7xxx_TVCO 0x32 |
| 64 | #define CH7xxx_TPCP 0x33 |
| 65 | #define CH7xxx_TPD 0x34 |
| 66 | #define CH7xxx_TPVT 0x35 |
| 67 | #define CH7xxx_TLPF 0x36 |
| 68 | #define CH7xxx_TCT 0x37 |
| 69 | #define CH7301_TEST_PATTERN 0x48 |
| 70 | |
| 71 | #define CH7xxx_PM 0x49 |
| 72 | #define CH7xxx_PM_FPD (1<<0) |
| 73 | #define CH7301_PM_DACPD0 (1<<1) |
| 74 | #define CH7301_PM_DACPD1 (1<<2) |
| 75 | #define CH7301_PM_DACPD2 (1<<3) |
| 76 | #define CH7xxx_PM_DVIL (1<<6) |
| 77 | #define CH7xxx_PM_DVIP (1<<7) |
| 78 | |
| 79 | #define CH7301_SYNC_POLARITY 0x56 |
| 80 | #define CH7301_SYNC_RGB_YUV (1<<0) |
| 81 | #define CH7301_SYNC_POL_DVI (1<<5) |
| 82 | |
| 83 | /** @file |
| 84 | * driver for the Chrontel 7xxx DVI chip over DVO. |
| 85 | */ |
| 86 | |
| 87 | static struct ch7xxx_id_struct { |
Jani Nikula | accb1eb | 2018-06-12 12:56:21 +0300 | [diff] [blame] | 88 | u8 vid; |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 89 | char *name; |
| 90 | } ch7xxx_ids[] = { |
| 91 | { CH7011_VID, "CH7011" }, |
braggle@free.fr | 98304ad | 2013-05-16 12:57:38 +0200 | [diff] [blame] | 92 | { CH7010B_VID, "CH7010B" }, |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 93 | { CH7009A_VID, "CH7009A" }, |
| 94 | { CH7009B_VID, "CH7009B" }, |
| 95 | { CH7301_VID, "CH7301" }, |
| 96 | }; |
| 97 | |
braggle@free.fr | 98304ad | 2013-05-16 12:57:38 +0200 | [diff] [blame] | 98 | static struct ch7xxx_did_struct { |
Jani Nikula | accb1eb | 2018-06-12 12:56:21 +0300 | [diff] [blame] | 99 | u8 did; |
braggle@free.fr | 98304ad | 2013-05-16 12:57:38 +0200 | [diff] [blame] | 100 | char *name; |
| 101 | } ch7xxx_dids[] = { |
| 102 | { CH7xxx_DID, "CH7XXX" }, |
| 103 | { CH7010_DID, "CH7010B" }, |
| 104 | }; |
| 105 | |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 106 | struct ch7xxx_priv { |
| 107 | bool quiet; |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 108 | }; |
| 109 | |
Jani Nikula | accb1eb | 2018-06-12 12:56:21 +0300 | [diff] [blame] | 110 | static char *ch7xxx_get_id(u8 vid) |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 111 | { |
| 112 | int i; |
| 113 | |
| 114 | for (i = 0; i < ARRAY_SIZE(ch7xxx_ids); i++) { |
| 115 | if (ch7xxx_ids[i].vid == vid) |
| 116 | return ch7xxx_ids[i].name; |
| 117 | } |
| 118 | |
| 119 | return NULL; |
| 120 | } |
| 121 | |
Jani Nikula | accb1eb | 2018-06-12 12:56:21 +0300 | [diff] [blame] | 122 | static char *ch7xxx_get_did(u8 did) |
braggle@free.fr | 98304ad | 2013-05-16 12:57:38 +0200 | [diff] [blame] | 123 | { |
| 124 | int i; |
| 125 | |
| 126 | for (i = 0; i < ARRAY_SIZE(ch7xxx_dids); i++) { |
| 127 | if (ch7xxx_dids[i].did == did) |
| 128 | return ch7xxx_dids[i].name; |
| 129 | } |
| 130 | |
| 131 | return NULL; |
| 132 | } |
| 133 | |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 134 | /** Reads an 8 bit register */ |
Jani Nikula | accb1eb | 2018-06-12 12:56:21 +0300 | [diff] [blame] | 135 | static bool ch7xxx_readb(struct intel_dvo_device *dvo, int addr, u8 *ch) |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 136 | { |
Akshay Joshi | 0206e35 | 2011-08-16 15:34:10 -0400 | [diff] [blame] | 137 | struct ch7xxx_priv *ch7xxx = dvo->dev_priv; |
Keith Packard | f9c10a9 | 2009-05-30 12:16:25 -0700 | [diff] [blame] | 138 | struct i2c_adapter *adapter = dvo->i2c_bus; |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 139 | u8 out_buf[2]; |
| 140 | u8 in_buf[2]; |
| 141 | |
| 142 | struct i2c_msg msgs[] = { |
| 143 | { |
Keith Packard | f9c10a9 | 2009-05-30 12:16:25 -0700 | [diff] [blame] | 144 | .addr = dvo->slave_addr, |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 145 | .flags = 0, |
| 146 | .len = 1, |
| 147 | .buf = out_buf, |
| 148 | }, |
| 149 | { |
Keith Packard | f9c10a9 | 2009-05-30 12:16:25 -0700 | [diff] [blame] | 150 | .addr = dvo->slave_addr, |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 151 | .flags = I2C_M_RD, |
| 152 | .len = 1, |
| 153 | .buf = in_buf, |
| 154 | } |
| 155 | }; |
| 156 | |
| 157 | out_buf[0] = addr; |
| 158 | out_buf[1] = 0; |
| 159 | |
Chris Wilson | f899fc6 | 2010-07-20 15:44:45 -0700 | [diff] [blame] | 160 | if (i2c_transfer(adapter, msgs, 2) == 2) { |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 161 | *ch = in_buf[0]; |
| 162 | return true; |
Damien Lespiau | 6ed6bd8 | 2014-04-09 14:33:08 +0100 | [diff] [blame] | 163 | } |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 164 | |
| 165 | if (!ch7xxx->quiet) { |
Zhao Yakui | d0c3b04 | 2009-10-09 11:39:43 +0800 | [diff] [blame] | 166 | DRM_DEBUG_KMS("Unable to read register 0x%02x from %s:%02x.\n", |
Chris Wilson | f899fc6 | 2010-07-20 15:44:45 -0700 | [diff] [blame] | 167 | addr, adapter->name, dvo->slave_addr); |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 168 | } |
| 169 | return false; |
| 170 | } |
| 171 | |
| 172 | /** Writes an 8 bit register */ |
Jani Nikula | accb1eb | 2018-06-12 12:56:21 +0300 | [diff] [blame] | 173 | static bool ch7xxx_writeb(struct intel_dvo_device *dvo, int addr, u8 ch) |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 174 | { |
| 175 | struct ch7xxx_priv *ch7xxx = dvo->dev_priv; |
Keith Packard | f9c10a9 | 2009-05-30 12:16:25 -0700 | [diff] [blame] | 176 | struct i2c_adapter *adapter = dvo->i2c_bus; |
Jani Nikula | accb1eb | 2018-06-12 12:56:21 +0300 | [diff] [blame] | 177 | u8 out_buf[2]; |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 178 | struct i2c_msg msg = { |
Keith Packard | f9c10a9 | 2009-05-30 12:16:25 -0700 | [diff] [blame] | 179 | .addr = dvo->slave_addr, |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 180 | .flags = 0, |
| 181 | .len = 2, |
| 182 | .buf = out_buf, |
| 183 | }; |
| 184 | |
| 185 | out_buf[0] = addr; |
| 186 | out_buf[1] = ch; |
| 187 | |
Chris Wilson | f899fc6 | 2010-07-20 15:44:45 -0700 | [diff] [blame] | 188 | if (i2c_transfer(adapter, &msg, 1) == 1) |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 189 | return true; |
| 190 | |
| 191 | if (!ch7xxx->quiet) { |
Zhao Yakui | d0c3b04 | 2009-10-09 11:39:43 +0800 | [diff] [blame] | 192 | DRM_DEBUG_KMS("Unable to write register 0x%02x to %s:%d.\n", |
Chris Wilson | f899fc6 | 2010-07-20 15:44:45 -0700 | [diff] [blame] | 193 | addr, adapter->name, dvo->slave_addr); |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 194 | } |
| 195 | |
| 196 | return false; |
| 197 | } |
| 198 | |
| 199 | static bool ch7xxx_init(struct intel_dvo_device *dvo, |
Keith Packard | f9c10a9 | 2009-05-30 12:16:25 -0700 | [diff] [blame] | 200 | struct i2c_adapter *adapter) |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 201 | { |
| 202 | /* this will detect the CH7xxx chip on the specified i2c bus */ |
| 203 | struct ch7xxx_priv *ch7xxx; |
Jani Nikula | accb1eb | 2018-06-12 12:56:21 +0300 | [diff] [blame] | 204 | u8 vendor, device; |
braggle@free.fr | 98304ad | 2013-05-16 12:57:38 +0200 | [diff] [blame] | 205 | char *name, *devid; |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 206 | |
| 207 | ch7xxx = kzalloc(sizeof(struct ch7xxx_priv), GFP_KERNEL); |
| 208 | if (ch7xxx == NULL) |
| 209 | return false; |
| 210 | |
Keith Packard | f9c10a9 | 2009-05-30 12:16:25 -0700 | [diff] [blame] | 211 | dvo->i2c_bus = adapter; |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 212 | dvo->dev_priv = ch7xxx; |
| 213 | ch7xxx->quiet = true; |
| 214 | |
| 215 | if (!ch7xxx_readb(dvo, CH7xxx_REG_VID, &vendor)) |
| 216 | goto out; |
| 217 | |
| 218 | name = ch7xxx_get_id(vendor); |
| 219 | if (!name) { |
Jani Nikula | 3d06bf4 | 2017-05-31 13:16:31 +0300 | [diff] [blame] | 220 | DRM_DEBUG_KMS("ch7xxx not detected; got VID 0x%02x from %s slave %d.\n", |
| 221 | vendor, adapter->name, dvo->slave_addr); |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 222 | goto out; |
| 223 | } |
| 224 | |
| 225 | |
| 226 | if (!ch7xxx_readb(dvo, CH7xxx_REG_DID, &device)) |
| 227 | goto out; |
| 228 | |
braggle@free.fr | 98304ad | 2013-05-16 12:57:38 +0200 | [diff] [blame] | 229 | devid = ch7xxx_get_did(device); |
| 230 | if (!devid) { |
Jani Nikula | 3d06bf4 | 2017-05-31 13:16:31 +0300 | [diff] [blame] | 231 | DRM_DEBUG_KMS("ch7xxx not detected; got DID 0x%02x from %s slave %d.\n", |
| 232 | device, adapter->name, dvo->slave_addr); |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 233 | goto out; |
| 234 | } |
| 235 | |
| 236 | ch7xxx->quiet = false; |
Zhao Yakui | d0c3b04 | 2009-10-09 11:39:43 +0800 | [diff] [blame] | 237 | DRM_DEBUG_KMS("Detected %s chipset, vendor/device ID 0x%02x/0x%02x\n", |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 238 | name, vendor, device); |
| 239 | return true; |
| 240 | out: |
| 241 | kfree(ch7xxx); |
| 242 | return false; |
| 243 | } |
| 244 | |
| 245 | static enum drm_connector_status ch7xxx_detect(struct intel_dvo_device *dvo) |
| 246 | { |
Jani Nikula | accb1eb | 2018-06-12 12:56:21 +0300 | [diff] [blame] | 247 | u8 cdet, orig_pm, pm; |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 248 | |
| 249 | ch7xxx_readb(dvo, CH7xxx_PM, &orig_pm); |
| 250 | |
| 251 | pm = orig_pm; |
| 252 | pm &= ~CH7xxx_PM_FPD; |
| 253 | pm |= CH7xxx_PM_DVIL | CH7xxx_PM_DVIP; |
| 254 | |
| 255 | ch7xxx_writeb(dvo, CH7xxx_PM, pm); |
| 256 | |
| 257 | ch7xxx_readb(dvo, CH7xxx_CONNECTION_DETECT, &cdet); |
| 258 | |
| 259 | ch7xxx_writeb(dvo, CH7xxx_PM, orig_pm); |
| 260 | |
| 261 | if (cdet & CH7xxx_CDET_DVI) |
| 262 | return connector_status_connected; |
| 263 | return connector_status_disconnected; |
| 264 | } |
| 265 | |
| 266 | static enum drm_mode_status ch7xxx_mode_valid(struct intel_dvo_device *dvo, |
| 267 | struct drm_display_mode *mode) |
| 268 | { |
| 269 | if (mode->clock > 165000) |
| 270 | return MODE_CLOCK_HIGH; |
| 271 | |
| 272 | return MODE_OK; |
| 273 | } |
| 274 | |
| 275 | static void ch7xxx_mode_set(struct intel_dvo_device *dvo, |
Ville Syrjälä | 7c5f93b | 2015-09-08 13:40:49 +0300 | [diff] [blame] | 276 | const struct drm_display_mode *mode, |
| 277 | const struct drm_display_mode *adjusted_mode) |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 278 | { |
Jani Nikula | accb1eb | 2018-06-12 12:56:21 +0300 | [diff] [blame] | 279 | u8 tvco, tpcp, tpd, tlpf, idf; |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 280 | |
| 281 | if (mode->clock <= 65000) { |
| 282 | tvco = 0x23; |
| 283 | tpcp = 0x08; |
| 284 | tpd = 0x16; |
| 285 | tlpf = 0x60; |
| 286 | } else { |
| 287 | tvco = 0x2d; |
| 288 | tpcp = 0x06; |
| 289 | tpd = 0x26; |
| 290 | tlpf = 0xa0; |
| 291 | } |
| 292 | |
| 293 | ch7xxx_writeb(dvo, CH7xxx_TCTL, 0x00); |
| 294 | ch7xxx_writeb(dvo, CH7xxx_TVCO, tvco); |
| 295 | ch7xxx_writeb(dvo, CH7xxx_TPCP, tpcp); |
| 296 | ch7xxx_writeb(dvo, CH7xxx_TPD, tpd); |
| 297 | ch7xxx_writeb(dvo, CH7xxx_TPVT, 0x30); |
| 298 | ch7xxx_writeb(dvo, CH7xxx_TLPF, tlpf); |
| 299 | ch7xxx_writeb(dvo, CH7xxx_TCT, 0x00); |
| 300 | |
| 301 | ch7xxx_readb(dvo, CH7xxx_IDF, &idf); |
| 302 | |
| 303 | idf &= ~(CH7xxx_IDF_HSP | CH7xxx_IDF_VSP); |
| 304 | if (mode->flags & DRM_MODE_FLAG_PHSYNC) |
| 305 | idf |= CH7xxx_IDF_HSP; |
| 306 | |
| 307 | if (mode->flags & DRM_MODE_FLAG_PVSYNC) |
Imre Deak | 3b27af3 | 2013-07-25 16:22:31 +0300 | [diff] [blame] | 308 | idf |= CH7xxx_IDF_VSP; |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 309 | |
| 310 | ch7xxx_writeb(dvo, CH7xxx_IDF, idf); |
| 311 | } |
| 312 | |
| 313 | /* set the CH7xxx power state */ |
Daniel Vetter | fac3274 | 2012-08-12 19:27:12 +0200 | [diff] [blame] | 314 | static void ch7xxx_dpms(struct intel_dvo_device *dvo, bool enable) |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 315 | { |
Daniel Vetter | fac3274 | 2012-08-12 19:27:12 +0200 | [diff] [blame] | 316 | if (enable) |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 317 | ch7xxx_writeb(dvo, CH7xxx_PM, CH7xxx_PM_DVIL | CH7xxx_PM_DVIP); |
| 318 | else |
| 319 | ch7xxx_writeb(dvo, CH7xxx_PM, CH7xxx_PM_FPD); |
| 320 | } |
| 321 | |
Daniel Vetter | 732ce74 | 2012-07-02 15:09:45 +0200 | [diff] [blame] | 322 | static bool ch7xxx_get_hw_state(struct intel_dvo_device *dvo) |
| 323 | { |
| 324 | u8 val; |
| 325 | |
| 326 | ch7xxx_readb(dvo, CH7xxx_PM, &val); |
| 327 | |
Daniel Vetter | 4afa0ac | 2012-10-11 18:43:52 +0200 | [diff] [blame] | 328 | if (val & (CH7xxx_PM_DVIL | CH7xxx_PM_DVIP)) |
Daniel Vetter | 732ce74 | 2012-07-02 15:09:45 +0200 | [diff] [blame] | 329 | return true; |
Daniel Vetter | 4afa0ac | 2012-10-11 18:43:52 +0200 | [diff] [blame] | 330 | else |
| 331 | return false; |
Daniel Vetter | 732ce74 | 2012-07-02 15:09:45 +0200 | [diff] [blame] | 332 | } |
| 333 | |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 334 | static void ch7xxx_dump_regs(struct intel_dvo_device *dvo) |
| 335 | { |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 336 | int i; |
| 337 | |
| 338 | for (i = 0; i < CH7xxx_NUM_REGS; i++) { |
Jani Nikula | accb1eb | 2018-06-12 12:56:21 +0300 | [diff] [blame] | 339 | u8 val; |
Akshay Joshi | 0206e35 | 2011-08-16 15:34:10 -0400 | [diff] [blame] | 340 | if ((i % 8) == 0) |
Lespiau, Damien | 29139e4 | 2014-03-24 15:53:12 +0000 | [diff] [blame] | 341 | DRM_DEBUG_KMS("\n %02X: ", i); |
Eric Anholt | 6443170 | 2010-04-02 15:24:27 -0700 | [diff] [blame] | 342 | ch7xxx_readb(dvo, i, &val); |
Lespiau, Damien | 29139e4 | 2014-03-24 15:53:12 +0000 | [diff] [blame] | 343 | DRM_DEBUG_KMS("%02X ", val); |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 344 | } |
| 345 | } |
| 346 | |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 347 | static void ch7xxx_destroy(struct intel_dvo_device *dvo) |
| 348 | { |
| 349 | struct ch7xxx_priv *ch7xxx = dvo->dev_priv; |
| 350 | |
| 351 | if (ch7xxx) { |
| 352 | kfree(ch7xxx); |
| 353 | dvo->dev_priv = NULL; |
| 354 | } |
| 355 | } |
| 356 | |
Julia Lawall | 0f55564 | 2015-12-08 21:55:27 +0100 | [diff] [blame] | 357 | const struct intel_dvo_dev_ops ch7xxx_ops = { |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 358 | .init = ch7xxx_init, |
| 359 | .detect = ch7xxx_detect, |
| 360 | .mode_valid = ch7xxx_mode_valid, |
| 361 | .mode_set = ch7xxx_mode_set, |
| 362 | .dpms = ch7xxx_dpms, |
Daniel Vetter | 732ce74 | 2012-07-02 15:09:45 +0200 | [diff] [blame] | 363 | .get_hw_state = ch7xxx_get_hw_state, |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 364 | .dump_regs = ch7xxx_dump_regs, |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 365 | .destroy = ch7xxx_destroy, |
| 366 | }; |