| .. | .. |
|---|
| 1 | 1 | /* |
|---|
| 2 | 2 | * OMAP2plus display device setup / initialization. |
|---|
| 3 | 3 | * |
|---|
| 4 | | - * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ |
|---|
| 4 | + * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com/ |
|---|
| 5 | 5 | * Senthilvadivu Guruswamy |
|---|
| 6 | 6 | * Sumit Semwal |
|---|
| 7 | 7 | * |
|---|
| .. | .. |
|---|
| 211 | 211 | node = of_find_node_by_name(NULL, "omap4_padconf_global"); |
|---|
| 212 | 212 | if (node) |
|---|
| 213 | 213 | omap4_dsi_mux_syscon = syscon_node_to_regmap(node); |
|---|
| 214 | + of_node_put(node); |
|---|
| 214 | 215 | |
|---|
| 215 | 216 | return 0; |
|---|
| 216 | 217 | } |
|---|
| 217 | | -#else |
|---|
| 218 | | -static inline int omapdss_init_fbdev(void) |
|---|
| 218 | + |
|---|
| 219 | +static const char * const omapdss_compat_names[] __initconst = { |
|---|
| 220 | + "ti,omap2-dss", |
|---|
| 221 | + "ti,omap3-dss", |
|---|
| 222 | + "ti,omap4-dss", |
|---|
| 223 | + "ti,omap5-dss", |
|---|
| 224 | + "ti,dra7-dss", |
|---|
| 225 | +}; |
|---|
| 226 | + |
|---|
| 227 | +static struct device_node * __init omapdss_find_dss_of_node(void) |
|---|
| 219 | 228 | { |
|---|
| 220 | | - return 0; |
|---|
| 229 | + struct device_node *node; |
|---|
| 230 | + int i; |
|---|
| 231 | + |
|---|
| 232 | + for (i = 0; i < ARRAY_SIZE(omapdss_compat_names); ++i) { |
|---|
| 233 | + node = of_find_compatible_node(NULL, NULL, |
|---|
| 234 | + omapdss_compat_names[i]); |
|---|
| 235 | + if (node) |
|---|
| 236 | + return node; |
|---|
| 237 | + } |
|---|
| 238 | + |
|---|
| 239 | + return NULL; |
|---|
| 221 | 240 | } |
|---|
| 241 | + |
|---|
| 242 | +static int __init omapdss_init_of(void) |
|---|
| 243 | +{ |
|---|
| 244 | + int r; |
|---|
| 245 | + struct device_node *node; |
|---|
| 246 | + struct platform_device *pdev; |
|---|
| 247 | + |
|---|
| 248 | + /* only create dss helper devices if dss is enabled in the .dts */ |
|---|
| 249 | + |
|---|
| 250 | + node = omapdss_find_dss_of_node(); |
|---|
| 251 | + if (!node) |
|---|
| 252 | + return 0; |
|---|
| 253 | + |
|---|
| 254 | + if (!of_device_is_available(node)) { |
|---|
| 255 | + of_node_put(node); |
|---|
| 256 | + return 0; |
|---|
| 257 | + } |
|---|
| 258 | + |
|---|
| 259 | + pdev = of_find_device_by_node(node); |
|---|
| 260 | + |
|---|
| 261 | + if (!pdev) { |
|---|
| 262 | + pr_err("Unable to find DSS platform device\n"); |
|---|
| 263 | + of_node_put(node); |
|---|
| 264 | + return -ENODEV; |
|---|
| 265 | + } |
|---|
| 266 | + |
|---|
| 267 | + r = of_platform_populate(node, NULL, NULL, &pdev->dev); |
|---|
| 268 | + put_device(&pdev->dev); |
|---|
| 269 | + of_node_put(node); |
|---|
| 270 | + if (r) { |
|---|
| 271 | + pr_err("Unable to populate DSS submodule devices\n"); |
|---|
| 272 | + return r; |
|---|
| 273 | + } |
|---|
| 274 | + |
|---|
| 275 | + return omapdss_init_fbdev(); |
|---|
| 276 | +} |
|---|
| 277 | +omap_device_initcall(omapdss_init_of); |
|---|
| 222 | 278 | #endif /* CONFIG_FB_OMAP2 */ |
|---|
| 223 | 279 | |
|---|
| 224 | 280 | static void dispc_disable_outputs(void) |
|---|
| .. | .. |
|---|
| 366 | 422 | |
|---|
| 367 | 423 | return r; |
|---|
| 368 | 424 | } |
|---|
| 369 | | - |
|---|
| 370 | | -static const char * const omapdss_compat_names[] __initconst = { |
|---|
| 371 | | - "ti,omap2-dss", |
|---|
| 372 | | - "ti,omap3-dss", |
|---|
| 373 | | - "ti,omap4-dss", |
|---|
| 374 | | - "ti,omap5-dss", |
|---|
| 375 | | - "ti,dra7-dss", |
|---|
| 376 | | -}; |
|---|
| 377 | | - |
|---|
| 378 | | -static struct device_node * __init omapdss_find_dss_of_node(void) |
|---|
| 379 | | -{ |
|---|
| 380 | | - struct device_node *node; |
|---|
| 381 | | - int i; |
|---|
| 382 | | - |
|---|
| 383 | | - for (i = 0; i < ARRAY_SIZE(omapdss_compat_names); ++i) { |
|---|
| 384 | | - node = of_find_compatible_node(NULL, NULL, |
|---|
| 385 | | - omapdss_compat_names[i]); |
|---|
| 386 | | - if (node) |
|---|
| 387 | | - return node; |
|---|
| 388 | | - } |
|---|
| 389 | | - |
|---|
| 390 | | - return NULL; |
|---|
| 391 | | -} |
|---|
| 392 | | - |
|---|
| 393 | | -static int __init omapdss_init_of(void) |
|---|
| 394 | | -{ |
|---|
| 395 | | - int r; |
|---|
| 396 | | - struct device_node *node; |
|---|
| 397 | | - struct platform_device *pdev; |
|---|
| 398 | | - |
|---|
| 399 | | - /* only create dss helper devices if dss is enabled in the .dts */ |
|---|
| 400 | | - |
|---|
| 401 | | - node = omapdss_find_dss_of_node(); |
|---|
| 402 | | - if (!node) |
|---|
| 403 | | - return 0; |
|---|
| 404 | | - |
|---|
| 405 | | - if (!of_device_is_available(node)) |
|---|
| 406 | | - return 0; |
|---|
| 407 | | - |
|---|
| 408 | | - pdev = of_find_device_by_node(node); |
|---|
| 409 | | - |
|---|
| 410 | | - if (!pdev) { |
|---|
| 411 | | - pr_err("Unable to find DSS platform device\n"); |
|---|
| 412 | | - return -ENODEV; |
|---|
| 413 | | - } |
|---|
| 414 | | - |
|---|
| 415 | | - r = of_platform_populate(node, NULL, NULL, &pdev->dev); |
|---|
| 416 | | - if (r) { |
|---|
| 417 | | - pr_err("Unable to populate DSS submodule devices\n"); |
|---|
| 418 | | - return r; |
|---|
| 419 | | - } |
|---|
| 420 | | - |
|---|
| 421 | | - return omapdss_init_fbdev(); |
|---|
| 422 | | -} |
|---|
| 423 | | -omap_device_initcall(omapdss_init_of); |
|---|