Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #include "msm_fb.h" |
| 15 | |
| 16 | static int lcdc_panel_on(struct platform_device *pdev) |
| 17 | { |
| 18 | return 0; |
| 19 | } |
| 20 | |
| 21 | static int lcdc_panel_off(struct platform_device *pdev) |
| 22 | { |
| 23 | return 0; |
| 24 | } |
| 25 | |
| 26 | static int __devinit lcdc_panel_probe(struct platform_device *pdev) |
| 27 | { |
| 28 | msm_fb_add_device(pdev); |
| 29 | |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 | static struct platform_driver this_driver = { |
| 34 | .probe = lcdc_panel_probe, |
| 35 | .driver = { |
| 36 | .name = "lcdc_panel", |
| 37 | }, |
| 38 | }; |
| 39 | |
| 40 | static struct msm_fb_panel_data lcdc_panel_data = { |
| 41 | .on = lcdc_panel_on, |
| 42 | .off = lcdc_panel_off, |
| 43 | }; |
| 44 | |
| 45 | static int lcdc_dev_id; |
| 46 | |
| 47 | int lcdc_device_register(struct msm_panel_info *pinfo) |
| 48 | { |
| 49 | struct platform_device *pdev = NULL; |
| 50 | int ret; |
| 51 | |
| 52 | pdev = platform_device_alloc("lcdc_panel", ++lcdc_dev_id); |
| 53 | if (!pdev) |
| 54 | return -ENOMEM; |
| 55 | |
| 56 | lcdc_panel_data.panel_info = *pinfo; |
| 57 | ret = platform_device_add_data(pdev, &lcdc_panel_data, |
| 58 | sizeof(lcdc_panel_data)); |
| 59 | if (ret) { |
| 60 | printk(KERN_ERR |
| 61 | "%s: platform_device_add_data failed!\n", __func__); |
| 62 | goto err_device_put; |
| 63 | } |
| 64 | |
| 65 | ret = platform_device_add(pdev); |
| 66 | if (ret) { |
| 67 | printk(KERN_ERR |
| 68 | "%s: platform_device_register failed!\n", __func__); |
| 69 | goto err_device_put; |
| 70 | } |
| 71 | |
| 72 | return 0; |
| 73 | |
| 74 | err_device_put: |
| 75 | platform_device_put(pdev); |
| 76 | return ret; |
| 77 | } |
| 78 | |
| 79 | static int __init lcdc_panel_init(void) |
| 80 | { |
| 81 | return platform_driver_register(&this_driver); |
| 82 | } |
| 83 | |
| 84 | module_init(lcdc_panel_init); |