Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013, NVIDIA Corporation. All rights reserved. |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sub license, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice (including the |
| 12 | * next paragraph) shall be included in all copies or substantial portions |
| 13 | * of the Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 21 | * DEALINGS IN THE SOFTWARE. |
| 22 | */ |
| 23 | |
| 24 | #include <linux/backlight.h> |
Alexandre Courbot | cfdf054 | 2014-03-01 14:00:58 +0900 | [diff] [blame] | 25 | #include <linux/gpio/consumer.h> |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 26 | #include <linux/module.h> |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 27 | #include <linux/of_platform.h> |
| 28 | #include <linux/platform_device.h> |
| 29 | #include <linux/regulator/consumer.h> |
| 30 | |
| 31 | #include <drm/drmP.h> |
| 32 | #include <drm/drm_crtc.h> |
Thierry Reding | 210fcd9 | 2013-11-22 19:27:11 +0100 | [diff] [blame] | 33 | #include <drm/drm_mipi_dsi.h> |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 34 | #include <drm/drm_panel.h> |
| 35 | |
| 36 | struct panel_desc { |
| 37 | const struct drm_display_mode *modes; |
| 38 | unsigned int num_modes; |
| 39 | |
Stéphane Marchesin | 0208d51 | 2014-06-19 18:18:28 -0700 | [diff] [blame] | 40 | unsigned int bpc; |
| 41 | |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 42 | struct { |
| 43 | unsigned int width; |
| 44 | unsigned int height; |
| 45 | } size; |
Ajay Kumar | f673c37 | 2014-07-31 23:12:11 +0530 | [diff] [blame] | 46 | |
| 47 | /** |
| 48 | * @prepare: the time (in milliseconds) that it takes for the panel to |
| 49 | * become ready and start receiving video data |
| 50 | * @enable: the time (in milliseconds) that it takes for the panel to |
| 51 | * display the first valid frame after starting to receive |
| 52 | * video data |
| 53 | * @disable: the time (in milliseconds) that it takes for the panel to |
| 54 | * turn the display off (no content is visible) |
| 55 | * @unprepare: the time (in milliseconds) that it takes for the panel |
| 56 | * to power itself down completely |
| 57 | */ |
| 58 | struct { |
| 59 | unsigned int prepare; |
| 60 | unsigned int enable; |
| 61 | unsigned int disable; |
| 62 | unsigned int unprepare; |
| 63 | } delay; |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 64 | }; |
| 65 | |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 66 | struct panel_simple { |
| 67 | struct drm_panel base; |
Ajay Kumar | 613a633 | 2014-07-31 23:12:10 +0530 | [diff] [blame] | 68 | bool prepared; |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 69 | bool enabled; |
| 70 | |
| 71 | const struct panel_desc *desc; |
| 72 | |
| 73 | struct backlight_device *backlight; |
| 74 | struct regulator *supply; |
| 75 | struct i2c_adapter *ddc; |
| 76 | |
Alexandre Courbot | cfdf054 | 2014-03-01 14:00:58 +0900 | [diff] [blame] | 77 | struct gpio_desc *enable_gpio; |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 78 | }; |
| 79 | |
| 80 | static inline struct panel_simple *to_panel_simple(struct drm_panel *panel) |
| 81 | { |
| 82 | return container_of(panel, struct panel_simple, base); |
| 83 | } |
| 84 | |
| 85 | static int panel_simple_get_fixed_modes(struct panel_simple *panel) |
| 86 | { |
| 87 | struct drm_connector *connector = panel->base.connector; |
| 88 | struct drm_device *drm = panel->base.drm; |
| 89 | struct drm_display_mode *mode; |
| 90 | unsigned int i, num = 0; |
| 91 | |
| 92 | if (!panel->desc) |
| 93 | return 0; |
| 94 | |
| 95 | for (i = 0; i < panel->desc->num_modes; i++) { |
| 96 | const struct drm_display_mode *m = &panel->desc->modes[i]; |
| 97 | |
| 98 | mode = drm_mode_duplicate(drm, m); |
| 99 | if (!mode) { |
| 100 | dev_err(drm->dev, "failed to add mode %ux%u@%u\n", |
| 101 | m->hdisplay, m->vdisplay, m->vrefresh); |
| 102 | continue; |
| 103 | } |
| 104 | |
| 105 | drm_mode_set_name(mode); |
| 106 | |
| 107 | drm_mode_probed_add(connector, mode); |
| 108 | num++; |
| 109 | } |
| 110 | |
Stéphane Marchesin | 0208d51 | 2014-06-19 18:18:28 -0700 | [diff] [blame] | 111 | connector->display_info.bpc = panel->desc->bpc; |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 112 | connector->display_info.width_mm = panel->desc->size.width; |
| 113 | connector->display_info.height_mm = panel->desc->size.height; |
| 114 | |
| 115 | return num; |
| 116 | } |
| 117 | |
| 118 | static int panel_simple_disable(struct drm_panel *panel) |
| 119 | { |
| 120 | struct panel_simple *p = to_panel_simple(panel); |
| 121 | |
| 122 | if (!p->enabled) |
| 123 | return 0; |
| 124 | |
| 125 | if (p->backlight) { |
| 126 | p->backlight->props.power = FB_BLANK_POWERDOWN; |
| 127 | backlight_update_status(p->backlight); |
| 128 | } |
| 129 | |
Ajay Kumar | f673c37 | 2014-07-31 23:12:11 +0530 | [diff] [blame] | 130 | if (p->desc->delay.disable) |
| 131 | msleep(p->desc->delay.disable); |
| 132 | |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 133 | p->enabled = false; |
| 134 | |
| 135 | return 0; |
| 136 | } |
| 137 | |
Ajay Kumar | c0e1d17 | 2014-07-31 23:12:04 +0530 | [diff] [blame] | 138 | static int panel_simple_unprepare(struct drm_panel *panel) |
| 139 | { |
Ajay Kumar | 613a633 | 2014-07-31 23:12:10 +0530 | [diff] [blame] | 140 | struct panel_simple *p = to_panel_simple(panel); |
| 141 | |
| 142 | if (!p->prepared) |
| 143 | return 0; |
| 144 | |
| 145 | if (p->enable_gpio) |
| 146 | gpiod_set_value_cansleep(p->enable_gpio, 0); |
| 147 | |
| 148 | regulator_disable(p->supply); |
| 149 | |
Ajay Kumar | f673c37 | 2014-07-31 23:12:11 +0530 | [diff] [blame] | 150 | if (p->desc->delay.unprepare) |
| 151 | msleep(p->desc->delay.unprepare); |
| 152 | |
Ajay Kumar | 613a633 | 2014-07-31 23:12:10 +0530 | [diff] [blame] | 153 | p->prepared = false; |
| 154 | |
Ajay Kumar | c0e1d17 | 2014-07-31 23:12:04 +0530 | [diff] [blame] | 155 | return 0; |
| 156 | } |
| 157 | |
| 158 | static int panel_simple_prepare(struct drm_panel *panel) |
| 159 | { |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 160 | struct panel_simple *p = to_panel_simple(panel); |
| 161 | int err; |
| 162 | |
Ajay Kumar | 613a633 | 2014-07-31 23:12:10 +0530 | [diff] [blame] | 163 | if (p->prepared) |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 164 | return 0; |
| 165 | |
| 166 | err = regulator_enable(p->supply); |
| 167 | if (err < 0) { |
| 168 | dev_err(panel->dev, "failed to enable supply: %d\n", err); |
| 169 | return err; |
| 170 | } |
| 171 | |
Alexandre Courbot | cfdf054 | 2014-03-01 14:00:58 +0900 | [diff] [blame] | 172 | if (p->enable_gpio) |
Thierry Reding | 15c1a91 | 2014-03-14 12:03:47 +0100 | [diff] [blame] | 173 | gpiod_set_value_cansleep(p->enable_gpio, 1); |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 174 | |
Ajay Kumar | f673c37 | 2014-07-31 23:12:11 +0530 | [diff] [blame] | 175 | if (p->desc->delay.prepare) |
| 176 | msleep(p->desc->delay.prepare); |
| 177 | |
Ajay Kumar | 613a633 | 2014-07-31 23:12:10 +0530 | [diff] [blame] | 178 | p->prepared = true; |
| 179 | |
| 180 | return 0; |
| 181 | } |
| 182 | |
| 183 | static int panel_simple_enable(struct drm_panel *panel) |
| 184 | { |
| 185 | struct panel_simple *p = to_panel_simple(panel); |
| 186 | |
| 187 | if (p->enabled) |
| 188 | return 0; |
| 189 | |
Ajay Kumar | f673c37 | 2014-07-31 23:12:11 +0530 | [diff] [blame] | 190 | if (p->desc->delay.enable) |
| 191 | msleep(p->desc->delay.enable); |
| 192 | |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 193 | if (p->backlight) { |
| 194 | p->backlight->props.power = FB_BLANK_UNBLANK; |
| 195 | backlight_update_status(p->backlight); |
| 196 | } |
| 197 | |
| 198 | p->enabled = true; |
| 199 | |
| 200 | return 0; |
| 201 | } |
| 202 | |
| 203 | static int panel_simple_get_modes(struct drm_panel *panel) |
| 204 | { |
| 205 | struct panel_simple *p = to_panel_simple(panel); |
| 206 | int num = 0; |
| 207 | |
| 208 | /* probe EDID if a DDC bus is available */ |
| 209 | if (p->ddc) { |
| 210 | struct edid *edid = drm_get_edid(panel->connector, p->ddc); |
Stephen Warren | 70bf687 | 2014-01-09 11:37:34 -0700 | [diff] [blame] | 211 | drm_mode_connector_update_edid_property(panel->connector, edid); |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 212 | if (edid) { |
| 213 | num += drm_add_edid_modes(panel->connector, edid); |
| 214 | kfree(edid); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | /* add hard-coded panel modes */ |
| 219 | num += panel_simple_get_fixed_modes(p); |
| 220 | |
| 221 | return num; |
| 222 | } |
| 223 | |
| 224 | static const struct drm_panel_funcs panel_simple_funcs = { |
| 225 | .disable = panel_simple_disable, |
Ajay Kumar | c0e1d17 | 2014-07-31 23:12:04 +0530 | [diff] [blame] | 226 | .unprepare = panel_simple_unprepare, |
| 227 | .prepare = panel_simple_prepare, |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 228 | .enable = panel_simple_enable, |
| 229 | .get_modes = panel_simple_get_modes, |
| 230 | }; |
| 231 | |
| 232 | static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) |
| 233 | { |
| 234 | struct device_node *backlight, *ddc; |
| 235 | struct panel_simple *panel; |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 236 | int err; |
| 237 | |
| 238 | panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL); |
| 239 | if (!panel) |
| 240 | return -ENOMEM; |
| 241 | |
| 242 | panel->enabled = false; |
Ajay Kumar | 613a633 | 2014-07-31 23:12:10 +0530 | [diff] [blame] | 243 | panel->prepared = false; |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 244 | panel->desc = desc; |
| 245 | |
| 246 | panel->supply = devm_regulator_get(dev, "power"); |
| 247 | if (IS_ERR(panel->supply)) |
| 248 | return PTR_ERR(panel->supply); |
| 249 | |
Alexandre Courbot | 9746c61 | 2014-07-25 23:47:25 +0900 | [diff] [blame] | 250 | panel->enable_gpio = devm_gpiod_get_optional(dev, "enable"); |
Alexandre Courbot | cfdf054 | 2014-03-01 14:00:58 +0900 | [diff] [blame] | 251 | if (IS_ERR(panel->enable_gpio)) { |
| 252 | err = PTR_ERR(panel->enable_gpio); |
Alexandre Courbot | 9746c61 | 2014-07-25 23:47:25 +0900 | [diff] [blame] | 253 | dev_err(dev, "failed to request GPIO: %d\n", err); |
| 254 | return err; |
| 255 | } |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 256 | |
Alexandre Courbot | 9746c61 | 2014-07-25 23:47:25 +0900 | [diff] [blame] | 257 | if (panel->enable_gpio) { |
Alexandre Courbot | cfdf054 | 2014-03-01 14:00:58 +0900 | [diff] [blame] | 258 | err = gpiod_direction_output(panel->enable_gpio, 0); |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 259 | if (err < 0) { |
Alexandre Courbot | cfdf054 | 2014-03-01 14:00:58 +0900 | [diff] [blame] | 260 | dev_err(dev, "failed to setup GPIO: %d\n", err); |
| 261 | return err; |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 262 | } |
| 263 | } |
| 264 | |
| 265 | backlight = of_parse_phandle(dev->of_node, "backlight", 0); |
| 266 | if (backlight) { |
| 267 | panel->backlight = of_find_backlight_by_node(backlight); |
| 268 | of_node_put(backlight); |
| 269 | |
Alexandre Courbot | cfdf054 | 2014-03-01 14:00:58 +0900 | [diff] [blame] | 270 | if (!panel->backlight) |
| 271 | return -EPROBE_DEFER; |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0); |
| 275 | if (ddc) { |
| 276 | panel->ddc = of_find_i2c_adapter_by_node(ddc); |
| 277 | of_node_put(ddc); |
| 278 | |
| 279 | if (!panel->ddc) { |
| 280 | err = -EPROBE_DEFER; |
| 281 | goto free_backlight; |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | drm_panel_init(&panel->base); |
| 286 | panel->base.dev = dev; |
| 287 | panel->base.funcs = &panel_simple_funcs; |
| 288 | |
| 289 | err = drm_panel_add(&panel->base); |
| 290 | if (err < 0) |
| 291 | goto free_ddc; |
| 292 | |
| 293 | dev_set_drvdata(dev, panel); |
| 294 | |
| 295 | return 0; |
| 296 | |
| 297 | free_ddc: |
| 298 | if (panel->ddc) |
| 299 | put_device(&panel->ddc->dev); |
| 300 | free_backlight: |
| 301 | if (panel->backlight) |
| 302 | put_device(&panel->backlight->dev); |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 303 | |
| 304 | return err; |
| 305 | } |
| 306 | |
| 307 | static int panel_simple_remove(struct device *dev) |
| 308 | { |
| 309 | struct panel_simple *panel = dev_get_drvdata(dev); |
| 310 | |
| 311 | drm_panel_detach(&panel->base); |
| 312 | drm_panel_remove(&panel->base); |
| 313 | |
| 314 | panel_simple_disable(&panel->base); |
| 315 | |
| 316 | if (panel->ddc) |
| 317 | put_device(&panel->ddc->dev); |
| 318 | |
| 319 | if (panel->backlight) |
| 320 | put_device(&panel->backlight->dev); |
| 321 | |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 322 | return 0; |
| 323 | } |
| 324 | |
Thierry Reding | d02fd93 | 2014-04-29 17:21:21 +0200 | [diff] [blame] | 325 | static void panel_simple_shutdown(struct device *dev) |
| 326 | { |
| 327 | struct panel_simple *panel = dev_get_drvdata(dev); |
| 328 | |
| 329 | panel_simple_disable(&panel->base); |
| 330 | } |
| 331 | |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 332 | static const struct drm_display_mode auo_b101aw03_mode = { |
| 333 | .clock = 51450, |
| 334 | .hdisplay = 1024, |
| 335 | .hsync_start = 1024 + 156, |
| 336 | .hsync_end = 1024 + 156 + 8, |
| 337 | .htotal = 1024 + 156 + 8 + 156, |
| 338 | .vdisplay = 600, |
| 339 | .vsync_start = 600 + 16, |
| 340 | .vsync_end = 600 + 16 + 6, |
| 341 | .vtotal = 600 + 16 + 6 + 16, |
| 342 | .vrefresh = 60, |
| 343 | }; |
| 344 | |
| 345 | static const struct panel_desc auo_b101aw03 = { |
| 346 | .modes = &auo_b101aw03_mode, |
| 347 | .num_modes = 1, |
Stéphane Marchesin | 0208d51 | 2014-06-19 18:18:28 -0700 | [diff] [blame] | 348 | .bpc = 6, |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 349 | .size = { |
| 350 | .width = 223, |
| 351 | .height = 125, |
| 352 | }, |
| 353 | }; |
| 354 | |
Rob Clark | dac746e | 2014-08-01 17:01:06 -0400 | [diff] [blame^] | 355 | static const struct drm_display_mode auo_b101xtn01_mode = { |
| 356 | .clock = 72000, |
| 357 | .hdisplay = 1366, |
| 358 | .hsync_start = 1366 + 20, |
| 359 | .hsync_end = 1366 + 20 + 70, |
| 360 | .htotal = 1366 + 20 + 70, |
| 361 | .vdisplay = 768, |
| 362 | .vsync_start = 768 + 14, |
| 363 | .vsync_end = 768 + 14 + 42, |
| 364 | .vtotal = 768 + 14 + 42, |
| 365 | .vrefresh = 60, |
| 366 | .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC, |
| 367 | }; |
| 368 | |
| 369 | static const struct panel_desc auo_b101xtn01 = { |
| 370 | .modes = &auo_b101xtn01_mode, |
| 371 | .num_modes = 1, |
| 372 | .bpc = 6, |
| 373 | .size = { |
| 374 | .width = 223, |
| 375 | .height = 125, |
| 376 | }, |
| 377 | }; |
| 378 | |
Stéphane Marchesin | a333f7a | 2014-05-23 19:27:59 -0700 | [diff] [blame] | 379 | static const struct drm_display_mode auo_b133xtn01_mode = { |
| 380 | .clock = 69500, |
| 381 | .hdisplay = 1366, |
| 382 | .hsync_start = 1366 + 48, |
| 383 | .hsync_end = 1366 + 48 + 32, |
| 384 | .htotal = 1366 + 48 + 32 + 20, |
| 385 | .vdisplay = 768, |
| 386 | .vsync_start = 768 + 3, |
| 387 | .vsync_end = 768 + 3 + 6, |
| 388 | .vtotal = 768 + 3 + 6 + 13, |
| 389 | .vrefresh = 60, |
| 390 | }; |
| 391 | |
| 392 | static const struct panel_desc auo_b133xtn01 = { |
| 393 | .modes = &auo_b133xtn01_mode, |
| 394 | .num_modes = 1, |
Stéphane Marchesin | 0208d51 | 2014-06-19 18:18:28 -0700 | [diff] [blame] | 395 | .bpc = 6, |
Stéphane Marchesin | a333f7a | 2014-05-23 19:27:59 -0700 | [diff] [blame] | 396 | .size = { |
| 397 | .width = 293, |
| 398 | .height = 165, |
| 399 | }, |
| 400 | }; |
| 401 | |
Ajay Kumar | 3e51d60 | 2014-07-31 23:12:12 +0530 | [diff] [blame] | 402 | static const struct drm_display_mode auo_b133htn01_mode = { |
| 403 | .clock = 150660, |
| 404 | .hdisplay = 1920, |
| 405 | .hsync_start = 1920 + 172, |
| 406 | .hsync_end = 1920 + 172 + 80, |
| 407 | .htotal = 1920 + 172 + 80 + 60, |
| 408 | .vdisplay = 1080, |
| 409 | .vsync_start = 1080 + 25, |
| 410 | .vsync_end = 1080 + 25 + 10, |
| 411 | .vtotal = 1080 + 25 + 10 + 10, |
| 412 | .vrefresh = 60, |
| 413 | }; |
| 414 | |
| 415 | static const struct panel_desc auo_b133htn01 = { |
| 416 | .modes = &auo_b133htn01_mode, |
| 417 | .num_modes = 1, |
| 418 | .size = { |
| 419 | .width = 293, |
| 420 | .height = 165, |
| 421 | }, |
| 422 | .delay = { |
| 423 | .prepare = 105, |
| 424 | .enable = 20, |
| 425 | .unprepare = 50, |
| 426 | }, |
| 427 | }; |
| 428 | |
Stephen Warren | 4c93075 | 2014-01-07 16:46:26 -0700 | [diff] [blame] | 429 | static const struct drm_display_mode chunghwa_claa101wa01a_mode = { |
| 430 | .clock = 72070, |
| 431 | .hdisplay = 1366, |
| 432 | .hsync_start = 1366 + 58, |
| 433 | .hsync_end = 1366 + 58 + 58, |
| 434 | .htotal = 1366 + 58 + 58 + 58, |
| 435 | .vdisplay = 768, |
| 436 | .vsync_start = 768 + 4, |
| 437 | .vsync_end = 768 + 4 + 4, |
| 438 | .vtotal = 768 + 4 + 4 + 4, |
| 439 | .vrefresh = 60, |
| 440 | }; |
| 441 | |
| 442 | static const struct panel_desc chunghwa_claa101wa01a = { |
| 443 | .modes = &chunghwa_claa101wa01a_mode, |
| 444 | .num_modes = 1, |
Stéphane Marchesin | 0208d51 | 2014-06-19 18:18:28 -0700 | [diff] [blame] | 445 | .bpc = 6, |
Stephen Warren | 4c93075 | 2014-01-07 16:46:26 -0700 | [diff] [blame] | 446 | .size = { |
| 447 | .width = 220, |
| 448 | .height = 120, |
| 449 | }, |
| 450 | }; |
| 451 | |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 452 | static const struct drm_display_mode chunghwa_claa101wb01_mode = { |
| 453 | .clock = 69300, |
| 454 | .hdisplay = 1366, |
| 455 | .hsync_start = 1366 + 48, |
| 456 | .hsync_end = 1366 + 48 + 32, |
| 457 | .htotal = 1366 + 48 + 32 + 20, |
| 458 | .vdisplay = 768, |
| 459 | .vsync_start = 768 + 16, |
| 460 | .vsync_end = 768 + 16 + 8, |
| 461 | .vtotal = 768 + 16 + 8 + 16, |
| 462 | .vrefresh = 60, |
| 463 | }; |
| 464 | |
| 465 | static const struct panel_desc chunghwa_claa101wb01 = { |
| 466 | .modes = &chunghwa_claa101wb01_mode, |
| 467 | .num_modes = 1, |
Stéphane Marchesin | 0208d51 | 2014-06-19 18:18:28 -0700 | [diff] [blame] | 468 | .bpc = 6, |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 469 | .size = { |
| 470 | .width = 223, |
| 471 | .height = 125, |
| 472 | }, |
| 473 | }; |
| 474 | |
Stefan Agner | 26ab006 | 2014-05-15 11:38:45 +0200 | [diff] [blame] | 475 | static const struct drm_display_mode edt_et057090dhu_mode = { |
| 476 | .clock = 25175, |
| 477 | .hdisplay = 640, |
| 478 | .hsync_start = 640 + 16, |
| 479 | .hsync_end = 640 + 16 + 30, |
| 480 | .htotal = 640 + 16 + 30 + 114, |
| 481 | .vdisplay = 480, |
| 482 | .vsync_start = 480 + 10, |
| 483 | .vsync_end = 480 + 10 + 3, |
| 484 | .vtotal = 480 + 10 + 3 + 32, |
| 485 | .vrefresh = 60, |
| 486 | .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC, |
| 487 | }; |
| 488 | |
| 489 | static const struct panel_desc edt_et057090dhu = { |
| 490 | .modes = &edt_et057090dhu_mode, |
| 491 | .num_modes = 1, |
Stéphane Marchesin | 0208d51 | 2014-06-19 18:18:28 -0700 | [diff] [blame] | 492 | .bpc = 6, |
Stefan Agner | 26ab006 | 2014-05-15 11:38:45 +0200 | [diff] [blame] | 493 | .size = { |
| 494 | .width = 115, |
| 495 | .height = 86, |
| 496 | }, |
| 497 | }; |
| 498 | |
Philipp Zabel | fff5de4 | 2014-05-15 12:25:47 +0200 | [diff] [blame] | 499 | static const struct drm_display_mode edt_etm0700g0dh6_mode = { |
| 500 | .clock = 33260, |
| 501 | .hdisplay = 800, |
| 502 | .hsync_start = 800 + 40, |
| 503 | .hsync_end = 800 + 40 + 128, |
| 504 | .htotal = 800 + 40 + 128 + 88, |
| 505 | .vdisplay = 480, |
| 506 | .vsync_start = 480 + 10, |
| 507 | .vsync_end = 480 + 10 + 2, |
| 508 | .vtotal = 480 + 10 + 2 + 33, |
| 509 | .vrefresh = 60, |
| 510 | .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, |
| 511 | }; |
| 512 | |
| 513 | static const struct panel_desc edt_etm0700g0dh6 = { |
| 514 | .modes = &edt_etm0700g0dh6_mode, |
| 515 | .num_modes = 1, |
Stéphane Marchesin | 0208d51 | 2014-06-19 18:18:28 -0700 | [diff] [blame] | 516 | .bpc = 6, |
Philipp Zabel | fff5de4 | 2014-05-15 12:25:47 +0200 | [diff] [blame] | 517 | .size = { |
| 518 | .width = 152, |
| 519 | .height = 91, |
| 520 | }, |
| 521 | }; |
| 522 | |
Boris BREZILLON | 102932b | 2014-06-05 15:53:32 +0200 | [diff] [blame] | 523 | static const struct drm_display_mode foxlink_fl500wvr00_a0t_mode = { |
| 524 | .clock = 32260, |
| 525 | .hdisplay = 800, |
| 526 | .hsync_start = 800 + 168, |
| 527 | .hsync_end = 800 + 168 + 64, |
| 528 | .htotal = 800 + 168 + 64 + 88, |
| 529 | .vdisplay = 480, |
| 530 | .vsync_start = 480 + 37, |
| 531 | .vsync_end = 480 + 37 + 2, |
| 532 | .vtotal = 480 + 37 + 2 + 8, |
| 533 | .vrefresh = 60, |
| 534 | }; |
| 535 | |
| 536 | static const struct panel_desc foxlink_fl500wvr00_a0t = { |
| 537 | .modes = &foxlink_fl500wvr00_a0t_mode, |
| 538 | .num_modes = 1, |
| 539 | .size = { |
| 540 | .width = 108, |
| 541 | .height = 65, |
| 542 | }, |
| 543 | }; |
| 544 | |
Thierry Reding | 0a2288c | 2014-07-03 14:02:59 +0200 | [diff] [blame] | 545 | static const struct drm_display_mode innolux_n116bge_mode = { |
| 546 | .clock = 71000, |
| 547 | .hdisplay = 1366, |
| 548 | .hsync_start = 1366 + 64, |
| 549 | .hsync_end = 1366 + 64 + 6, |
| 550 | .htotal = 1366 + 64 + 6 + 64, |
| 551 | .vdisplay = 768, |
| 552 | .vsync_start = 768 + 8, |
| 553 | .vsync_end = 768 + 8 + 4, |
| 554 | .vtotal = 768 + 8 + 4 + 8, |
| 555 | .vrefresh = 60, |
| 556 | .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, |
| 557 | }; |
| 558 | |
| 559 | static const struct panel_desc innolux_n116bge = { |
| 560 | .modes = &innolux_n116bge_mode, |
| 561 | .num_modes = 1, |
| 562 | .bpc = 6, |
| 563 | .size = { |
| 564 | .width = 256, |
| 565 | .height = 144, |
| 566 | }, |
| 567 | }; |
| 568 | |
Alban Bedel | ea44739 | 2014-07-22 08:38:55 +0200 | [diff] [blame] | 569 | static const struct drm_display_mode innolux_n156bge_l21_mode = { |
| 570 | .clock = 69300, |
| 571 | .hdisplay = 1366, |
| 572 | .hsync_start = 1366 + 16, |
| 573 | .hsync_end = 1366 + 16 + 34, |
| 574 | .htotal = 1366 + 16 + 34 + 50, |
| 575 | .vdisplay = 768, |
| 576 | .vsync_start = 768 + 2, |
| 577 | .vsync_end = 768 + 2 + 6, |
| 578 | .vtotal = 768 + 2 + 6 + 12, |
| 579 | .vrefresh = 60, |
| 580 | }; |
| 581 | |
| 582 | static const struct panel_desc innolux_n156bge_l21 = { |
| 583 | .modes = &innolux_n156bge_l21_mode, |
| 584 | .num_modes = 1, |
Stéphane Marchesin | 0208d51 | 2014-06-19 18:18:28 -0700 | [diff] [blame] | 585 | .bpc = 6, |
Alban Bedel | ea44739 | 2014-07-22 08:38:55 +0200 | [diff] [blame] | 586 | .size = { |
| 587 | .width = 344, |
| 588 | .height = 193, |
| 589 | }, |
| 590 | }; |
| 591 | |
Thierry Reding | ec7c565 | 2013-11-15 15:59:32 +0100 | [diff] [blame] | 592 | static const struct drm_display_mode lg_lp129qe_mode = { |
| 593 | .clock = 285250, |
| 594 | .hdisplay = 2560, |
| 595 | .hsync_start = 2560 + 48, |
| 596 | .hsync_end = 2560 + 48 + 32, |
| 597 | .htotal = 2560 + 48 + 32 + 80, |
| 598 | .vdisplay = 1700, |
| 599 | .vsync_start = 1700 + 3, |
| 600 | .vsync_end = 1700 + 3 + 10, |
| 601 | .vtotal = 1700 + 3 + 10 + 36, |
| 602 | .vrefresh = 60, |
| 603 | }; |
| 604 | |
| 605 | static const struct panel_desc lg_lp129qe = { |
| 606 | .modes = &lg_lp129qe_mode, |
| 607 | .num_modes = 1, |
Stéphane Marchesin | 0208d51 | 2014-06-19 18:18:28 -0700 | [diff] [blame] | 608 | .bpc = 8, |
Thierry Reding | ec7c565 | 2013-11-15 15:59:32 +0100 | [diff] [blame] | 609 | .size = { |
| 610 | .width = 272, |
| 611 | .height = 181, |
| 612 | }, |
| 613 | }; |
| 614 | |
Marc Dietrich | 6d54e3d | 2013-12-21 21:38:12 +0100 | [diff] [blame] | 615 | static const struct drm_display_mode samsung_ltn101nt05_mode = { |
| 616 | .clock = 54030, |
| 617 | .hdisplay = 1024, |
| 618 | .hsync_start = 1024 + 24, |
| 619 | .hsync_end = 1024 + 24 + 136, |
| 620 | .htotal = 1024 + 24 + 136 + 160, |
| 621 | .vdisplay = 600, |
| 622 | .vsync_start = 600 + 3, |
| 623 | .vsync_end = 600 + 3 + 6, |
| 624 | .vtotal = 600 + 3 + 6 + 61, |
| 625 | .vrefresh = 60, |
| 626 | }; |
| 627 | |
| 628 | static const struct panel_desc samsung_ltn101nt05 = { |
| 629 | .modes = &samsung_ltn101nt05_mode, |
| 630 | .num_modes = 1, |
Stéphane Marchesin | 0208d51 | 2014-06-19 18:18:28 -0700 | [diff] [blame] | 631 | .bpc = 6, |
Marc Dietrich | 6d54e3d | 2013-12-21 21:38:12 +0100 | [diff] [blame] | 632 | .size = { |
| 633 | .width = 1024, |
| 634 | .height = 600, |
| 635 | }, |
| 636 | }; |
| 637 | |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 638 | static const struct of_device_id platform_of_match[] = { |
| 639 | { |
| 640 | .compatible = "auo,b101aw03", |
| 641 | .data = &auo_b101aw03, |
| 642 | }, { |
Rob Clark | dac746e | 2014-08-01 17:01:06 -0400 | [diff] [blame^] | 643 | .compatible = "auo,b101xtn01", |
| 644 | .data = &auo_b101xtn01, |
| 645 | }, { |
Ajay Kumar | 3e51d60 | 2014-07-31 23:12:12 +0530 | [diff] [blame] | 646 | .compatible = "auo,b133htn01", |
| 647 | .data = &auo_b133htn01, |
| 648 | }, { |
Stéphane Marchesin | a333f7a | 2014-05-23 19:27:59 -0700 | [diff] [blame] | 649 | .compatible = "auo,b133xtn01", |
| 650 | .data = &auo_b133xtn01, |
| 651 | }, { |
Stephen Warren | 4c93075 | 2014-01-07 16:46:26 -0700 | [diff] [blame] | 652 | .compatible = "chunghwa,claa101wa01a", |
| 653 | .data = &chunghwa_claa101wa01a |
| 654 | }, { |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 655 | .compatible = "chunghwa,claa101wb01", |
| 656 | .data = &chunghwa_claa101wb01 |
| 657 | }, { |
Stefan Agner | 26ab006 | 2014-05-15 11:38:45 +0200 | [diff] [blame] | 658 | .compatible = "edt,et057090dhu", |
| 659 | .data = &edt_et057090dhu, |
| 660 | }, { |
Philipp Zabel | fff5de4 | 2014-05-15 12:25:47 +0200 | [diff] [blame] | 661 | .compatible = "edt,et070080dh6", |
| 662 | .data = &edt_etm0700g0dh6, |
| 663 | }, { |
| 664 | .compatible = "edt,etm0700g0dh6", |
| 665 | .data = &edt_etm0700g0dh6, |
| 666 | }, { |
Boris BREZILLON | 102932b | 2014-06-05 15:53:32 +0200 | [diff] [blame] | 667 | .compatible = "foxlink,fl500wvr00-a0t", |
| 668 | .data = &foxlink_fl500wvr00_a0t, |
| 669 | }, { |
Thierry Reding | 0a2288c | 2014-07-03 14:02:59 +0200 | [diff] [blame] | 670 | .compatible = "innolux,n116bge", |
| 671 | .data = &innolux_n116bge, |
| 672 | }, { |
Alban Bedel | ea44739 | 2014-07-22 08:38:55 +0200 | [diff] [blame] | 673 | .compatible = "innolux,n156bge-l21", |
| 674 | .data = &innolux_n156bge_l21, |
| 675 | }, { |
Thierry Reding | ec7c565 | 2013-11-15 15:59:32 +0100 | [diff] [blame] | 676 | .compatible = "lg,lp129qe", |
| 677 | .data = &lg_lp129qe, |
| 678 | }, { |
Marc Dietrich | 6d54e3d | 2013-12-21 21:38:12 +0100 | [diff] [blame] | 679 | .compatible = "samsung,ltn101nt05", |
| 680 | .data = &samsung_ltn101nt05, |
| 681 | }, { |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 682 | /* sentinel */ |
| 683 | } |
| 684 | }; |
| 685 | MODULE_DEVICE_TABLE(of, platform_of_match); |
| 686 | |
| 687 | static int panel_simple_platform_probe(struct platform_device *pdev) |
| 688 | { |
| 689 | const struct of_device_id *id; |
| 690 | |
| 691 | id = of_match_node(platform_of_match, pdev->dev.of_node); |
| 692 | if (!id) |
| 693 | return -ENODEV; |
| 694 | |
| 695 | return panel_simple_probe(&pdev->dev, id->data); |
| 696 | } |
| 697 | |
| 698 | static int panel_simple_platform_remove(struct platform_device *pdev) |
| 699 | { |
| 700 | return panel_simple_remove(&pdev->dev); |
| 701 | } |
| 702 | |
Thierry Reding | d02fd93 | 2014-04-29 17:21:21 +0200 | [diff] [blame] | 703 | static void panel_simple_platform_shutdown(struct platform_device *pdev) |
| 704 | { |
| 705 | panel_simple_shutdown(&pdev->dev); |
| 706 | } |
| 707 | |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 708 | static struct platform_driver panel_simple_platform_driver = { |
| 709 | .driver = { |
| 710 | .name = "panel-simple", |
| 711 | .owner = THIS_MODULE, |
| 712 | .of_match_table = platform_of_match, |
| 713 | }, |
| 714 | .probe = panel_simple_platform_probe, |
| 715 | .remove = panel_simple_platform_remove, |
Thierry Reding | d02fd93 | 2014-04-29 17:21:21 +0200 | [diff] [blame] | 716 | .shutdown = panel_simple_platform_shutdown, |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 717 | }; |
| 718 | |
Thierry Reding | 210fcd9 | 2013-11-22 19:27:11 +0100 | [diff] [blame] | 719 | struct panel_desc_dsi { |
| 720 | struct panel_desc desc; |
| 721 | |
Thierry Reding | 462658b | 2014-03-14 11:24:57 +0100 | [diff] [blame] | 722 | unsigned long flags; |
Thierry Reding | 210fcd9 | 2013-11-22 19:27:11 +0100 | [diff] [blame] | 723 | enum mipi_dsi_pixel_format format; |
| 724 | unsigned int lanes; |
| 725 | }; |
| 726 | |
Alexandre Courbot | 712ac1b | 2014-01-21 18:57:10 +0900 | [diff] [blame] | 727 | static const struct drm_display_mode lg_ld070wx3_sl01_mode = { |
| 728 | .clock = 71000, |
| 729 | .hdisplay = 800, |
| 730 | .hsync_start = 800 + 32, |
| 731 | .hsync_end = 800 + 32 + 1, |
| 732 | .htotal = 800 + 32 + 1 + 57, |
| 733 | .vdisplay = 1280, |
| 734 | .vsync_start = 1280 + 28, |
| 735 | .vsync_end = 1280 + 28 + 1, |
| 736 | .vtotal = 1280 + 28 + 1 + 14, |
| 737 | .vrefresh = 60, |
| 738 | }; |
| 739 | |
| 740 | static const struct panel_desc_dsi lg_ld070wx3_sl01 = { |
| 741 | .desc = { |
| 742 | .modes = &lg_ld070wx3_sl01_mode, |
| 743 | .num_modes = 1, |
| 744 | .size = { |
| 745 | .width = 94, |
| 746 | .height = 151, |
| 747 | }, |
| 748 | }, |
Alexandre Courbot | 5e4cc27 | 2014-07-08 21:32:12 +0900 | [diff] [blame] | 749 | .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS, |
Alexandre Courbot | 712ac1b | 2014-01-21 18:57:10 +0900 | [diff] [blame] | 750 | .format = MIPI_DSI_FMT_RGB888, |
| 751 | .lanes = 4, |
| 752 | }; |
| 753 | |
Alexandre Courbot | 499ce85 | 2014-01-21 18:57:09 +0900 | [diff] [blame] | 754 | static const struct drm_display_mode lg_lh500wx1_sd03_mode = { |
| 755 | .clock = 67000, |
| 756 | .hdisplay = 720, |
| 757 | .hsync_start = 720 + 12, |
| 758 | .hsync_end = 720 + 12 + 4, |
| 759 | .htotal = 720 + 12 + 4 + 112, |
| 760 | .vdisplay = 1280, |
| 761 | .vsync_start = 1280 + 8, |
| 762 | .vsync_end = 1280 + 8 + 4, |
| 763 | .vtotal = 1280 + 8 + 4 + 12, |
| 764 | .vrefresh = 60, |
| 765 | }; |
| 766 | |
| 767 | static const struct panel_desc_dsi lg_lh500wx1_sd03 = { |
| 768 | .desc = { |
| 769 | .modes = &lg_lh500wx1_sd03_mode, |
| 770 | .num_modes = 1, |
| 771 | .size = { |
| 772 | .width = 62, |
| 773 | .height = 110, |
| 774 | }, |
| 775 | }, |
| 776 | .flags = MIPI_DSI_MODE_VIDEO, |
| 777 | .format = MIPI_DSI_FMT_RGB888, |
| 778 | .lanes = 4, |
| 779 | }; |
| 780 | |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 781 | static const struct drm_display_mode panasonic_vvx10f004b00_mode = { |
| 782 | .clock = 157200, |
| 783 | .hdisplay = 1920, |
| 784 | .hsync_start = 1920 + 154, |
| 785 | .hsync_end = 1920 + 154 + 16, |
| 786 | .htotal = 1920 + 154 + 16 + 32, |
| 787 | .vdisplay = 1200, |
| 788 | .vsync_start = 1200 + 17, |
| 789 | .vsync_end = 1200 + 17 + 2, |
| 790 | .vtotal = 1200 + 17 + 2 + 16, |
| 791 | .vrefresh = 60, |
| 792 | }; |
| 793 | |
Thierry Reding | 210fcd9 | 2013-11-22 19:27:11 +0100 | [diff] [blame] | 794 | static const struct panel_desc_dsi panasonic_vvx10f004b00 = { |
| 795 | .desc = { |
| 796 | .modes = &panasonic_vvx10f004b00_mode, |
| 797 | .num_modes = 1, |
| 798 | .size = { |
| 799 | .width = 217, |
| 800 | .height = 136, |
| 801 | }, |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 802 | }, |
Alexandre Courbot | 5e4cc27 | 2014-07-08 21:32:12 +0900 | [diff] [blame] | 803 | .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE | |
| 804 | MIPI_DSI_CLOCK_NON_CONTINUOUS, |
Thierry Reding | 210fcd9 | 2013-11-22 19:27:11 +0100 | [diff] [blame] | 805 | .format = MIPI_DSI_FMT_RGB888, |
| 806 | .lanes = 4, |
| 807 | }; |
| 808 | |
| 809 | static const struct of_device_id dsi_of_match[] = { |
| 810 | { |
Alexandre Courbot | 712ac1b | 2014-01-21 18:57:10 +0900 | [diff] [blame] | 811 | .compatible = "lg,ld070wx3-sl01", |
| 812 | .data = &lg_ld070wx3_sl01 |
| 813 | }, { |
Alexandre Courbot | 499ce85 | 2014-01-21 18:57:09 +0900 | [diff] [blame] | 814 | .compatible = "lg,lh500wx1-sd03", |
| 815 | .data = &lg_lh500wx1_sd03 |
| 816 | }, { |
Thierry Reding | 210fcd9 | 2013-11-22 19:27:11 +0100 | [diff] [blame] | 817 | .compatible = "panasonic,vvx10f004b00", |
| 818 | .data = &panasonic_vvx10f004b00 |
| 819 | }, { |
| 820 | /* sentinel */ |
| 821 | } |
| 822 | }; |
| 823 | MODULE_DEVICE_TABLE(of, dsi_of_match); |
| 824 | |
| 825 | static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi) |
| 826 | { |
| 827 | const struct panel_desc_dsi *desc; |
| 828 | const struct of_device_id *id; |
| 829 | int err; |
| 830 | |
| 831 | id = of_match_node(dsi_of_match, dsi->dev.of_node); |
| 832 | if (!id) |
| 833 | return -ENODEV; |
| 834 | |
| 835 | desc = id->data; |
| 836 | |
| 837 | err = panel_simple_probe(&dsi->dev, &desc->desc); |
| 838 | if (err < 0) |
| 839 | return err; |
| 840 | |
Thierry Reding | 462658b | 2014-03-14 11:24:57 +0100 | [diff] [blame] | 841 | dsi->mode_flags = desc->flags; |
Thierry Reding | 210fcd9 | 2013-11-22 19:27:11 +0100 | [diff] [blame] | 842 | dsi->format = desc->format; |
| 843 | dsi->lanes = desc->lanes; |
| 844 | |
| 845 | return mipi_dsi_attach(dsi); |
| 846 | } |
| 847 | |
| 848 | static int panel_simple_dsi_remove(struct mipi_dsi_device *dsi) |
| 849 | { |
| 850 | int err; |
| 851 | |
| 852 | err = mipi_dsi_detach(dsi); |
| 853 | if (err < 0) |
| 854 | dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err); |
| 855 | |
| 856 | return panel_simple_remove(&dsi->dev); |
| 857 | } |
| 858 | |
Thierry Reding | d02fd93 | 2014-04-29 17:21:21 +0200 | [diff] [blame] | 859 | static void panel_simple_dsi_shutdown(struct mipi_dsi_device *dsi) |
| 860 | { |
| 861 | panel_simple_shutdown(&dsi->dev); |
| 862 | } |
| 863 | |
Thierry Reding | 210fcd9 | 2013-11-22 19:27:11 +0100 | [diff] [blame] | 864 | static struct mipi_dsi_driver panel_simple_dsi_driver = { |
| 865 | .driver = { |
| 866 | .name = "panel-simple-dsi", |
| 867 | .owner = THIS_MODULE, |
| 868 | .of_match_table = dsi_of_match, |
| 869 | }, |
| 870 | .probe = panel_simple_dsi_probe, |
| 871 | .remove = panel_simple_dsi_remove, |
Thierry Reding | d02fd93 | 2014-04-29 17:21:21 +0200 | [diff] [blame] | 872 | .shutdown = panel_simple_dsi_shutdown, |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 873 | }; |
| 874 | |
| 875 | static int __init panel_simple_init(void) |
| 876 | { |
Thierry Reding | 210fcd9 | 2013-11-22 19:27:11 +0100 | [diff] [blame] | 877 | int err; |
| 878 | |
| 879 | err = platform_driver_register(&panel_simple_platform_driver); |
| 880 | if (err < 0) |
| 881 | return err; |
| 882 | |
| 883 | if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) { |
| 884 | err = mipi_dsi_driver_register(&panel_simple_dsi_driver); |
| 885 | if (err < 0) |
| 886 | return err; |
| 887 | } |
| 888 | |
| 889 | return 0; |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 890 | } |
| 891 | module_init(panel_simple_init); |
| 892 | |
| 893 | static void __exit panel_simple_exit(void) |
| 894 | { |
Thierry Reding | 210fcd9 | 2013-11-22 19:27:11 +0100 | [diff] [blame] | 895 | if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) |
| 896 | mipi_dsi_driver_unregister(&panel_simple_dsi_driver); |
| 897 | |
Thierry Reding | 280921d | 2013-08-30 15:10:14 +0200 | [diff] [blame] | 898 | platform_driver_unregister(&panel_simple_platform_driver); |
| 899 | } |
| 900 | module_exit(panel_simple_exit); |
| 901 | |
| 902 | MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>"); |
| 903 | MODULE_DESCRIPTION("DRM Driver for Simple Panels"); |
| 904 | MODULE_LICENSE("GPL and additional rights"); |