Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* linux/arch/arm/mach-msm/board-swordfish-panel.c |
| 2 | * |
| 3 | * Copyright (c) 2009 Google Inc. |
| 4 | * |
| 5 | * This software is licensed under the terms of the GNU General Public |
| 6 | * License version 2, as published by the Free Software Foundation, and |
| 7 | * may be copied, distributed, and modified under those terms. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * Author: Dima Zavin <dima@android.com> |
| 15 | */ |
| 16 | |
| 17 | #include <linux/kernel.h> |
| 18 | #include <linux/init.h> |
| 19 | #include <linux/platform_device.h> |
| 20 | #include <linux/err.h> |
| 21 | |
| 22 | #include <asm/io.h> |
| 23 | #include <asm/mach-types.h> |
| 24 | |
| 25 | #include <mach/msm_fb.h> |
| 26 | |
| 27 | #include "board-swordfish.h" |
| 28 | #include "devices.h" |
| 29 | |
| 30 | #define CLK_NS_TO_RATE(ns) (1000000000UL / (ns)) |
| 31 | |
| 32 | int swordfish_panel_blank(struct msm_lcdc_panel_ops *ops) |
| 33 | { |
| 34 | /* TODO: Turn backlight off? */ |
| 35 | return 0; |
| 36 | } |
| 37 | |
| 38 | int swordfish_panel_unblank(struct msm_lcdc_panel_ops *ops) |
| 39 | { |
| 40 | /* TODO: Turn backlight on? */ |
| 41 | return 0; |
| 42 | } |
| 43 | |
| 44 | int swordfish_panel_init(struct msm_lcdc_panel_ops *ops) |
| 45 | { |
| 46 | return 0; |
| 47 | } |
| 48 | |
| 49 | static struct resource resources_msm_fb[] = { |
| 50 | { |
| 51 | .start = MSM_FB_BASE, |
| 52 | .end = MSM_FB_BASE + MSM_FB_SIZE, |
| 53 | .flags = IORESOURCE_MEM, |
| 54 | }, |
| 55 | }; |
| 56 | |
| 57 | static struct msm_lcdc_timing swordfish_lcdc_timing = { |
| 58 | .clk_rate = CLK_NS_TO_RATE(26), |
| 59 | .hsync_pulse_width = 60, |
| 60 | .hsync_back_porch = 81, |
| 61 | .hsync_front_porch = 81, |
| 62 | .hsync_skew = 0, |
| 63 | .vsync_pulse_width = 2, |
| 64 | .vsync_back_porch = 20, |
| 65 | .vsync_front_porch = 27, |
| 66 | .vsync_act_low = 0, |
| 67 | .hsync_act_low = 0, |
| 68 | .den_act_low = 0, |
| 69 | }; |
| 70 | |
| 71 | static struct msm_fb_data swordfish_lcdc_fb_data = { |
| 72 | .xres = 800, |
| 73 | .yres = 480, |
| 74 | .width = 94, |
| 75 | .height = 57, |
| 76 | .output_format = 0, |
| 77 | }; |
| 78 | |
| 79 | static struct msm_lcdc_panel_ops swordfish_lcdc_panel_ops = { |
| 80 | .init = swordfish_panel_init, |
| 81 | .blank = swordfish_panel_blank, |
| 82 | .unblank = swordfish_panel_unblank, |
| 83 | }; |
| 84 | |
| 85 | static struct msm_lcdc_platform_data swordfish_lcdc_platform_data = { |
| 86 | .panel_ops = &swordfish_lcdc_panel_ops, |
| 87 | .timing = &swordfish_lcdc_timing, |
| 88 | .fb_id = 0, |
| 89 | .fb_data = &swordfish_lcdc_fb_data, |
| 90 | .fb_resource = &resources_msm_fb[0], |
| 91 | }; |
| 92 | |
| 93 | static struct platform_device swordfish_lcdc_device = { |
| 94 | .name = "msm_mdp_lcdc", |
| 95 | .id = -1, |
| 96 | .dev = { |
| 97 | .platform_data = &swordfish_lcdc_platform_data, |
| 98 | }, |
| 99 | }; |
| 100 | |
| 101 | int __init swordfish_init_panel(void) |
| 102 | { |
| 103 | int rc; |
| 104 | if (!machine_is_swordfish()) |
| 105 | return 0; |
| 106 | |
| 107 | if ((rc = platform_device_register(&msm_device_mdp)) != 0) |
| 108 | return rc; |
| 109 | |
| 110 | if ((rc = platform_device_register(&swordfish_lcdc_device)) != 0) |
| 111 | return rc; |
| 112 | |
| 113 | return 0; |
| 114 | } |
| 115 | |
| 116 | device_initcall(swordfish_init_panel); |