.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) Intel Corp. 2007. |
---|
3 | 4 | * All Rights Reserved. |
---|
.. | .. |
---|
6 | 7 | * develop this driver. |
---|
7 | 8 | * |
---|
8 | 9 | * This file is part of the Carillo Ranch video subsystem driver. |
---|
9 | | - * The Carillo Ranch video subsystem driver is free software; |
---|
10 | | - * you can redistribute it and/or modify |
---|
11 | | - * it under the terms of the GNU General Public License as published by |
---|
12 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
13 | | - * (at your option) any later version. |
---|
14 | | - * |
---|
15 | | - * The Carillo Ranch video subsystem driver is distributed |
---|
16 | | - * in the hope that it will be useful, |
---|
17 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
18 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
19 | | - * GNU General Public License for more details. |
---|
20 | | - * |
---|
21 | | - * You should have received a copy of the GNU General Public License |
---|
22 | | - * along with this driver; if not, write to the Free Software |
---|
23 | | - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
24 | 10 | * |
---|
25 | 11 | * Authors: |
---|
26 | 12 | * Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> |
---|
.. | .. |
---|
73 | 59 | |
---|
74 | 60 | static int cr_backlight_set_intensity(struct backlight_device *bd) |
---|
75 | 61 | { |
---|
76 | | - int intensity = bd->props.brightness; |
---|
77 | 62 | u32 addr = gpio_bar + CRVML_PANEL_PORT; |
---|
78 | 63 | u32 cur = inl(addr); |
---|
79 | 64 | |
---|
80 | | - if (bd->props.power == FB_BLANK_UNBLANK) |
---|
81 | | - intensity = FB_BLANK_UNBLANK; |
---|
82 | | - if (bd->props.fb_blank == FB_BLANK_UNBLANK) |
---|
83 | | - intensity = FB_BLANK_UNBLANK; |
---|
84 | | - if (bd->props.power == FB_BLANK_POWERDOWN) |
---|
85 | | - intensity = FB_BLANK_POWERDOWN; |
---|
86 | | - if (bd->props.fb_blank == FB_BLANK_POWERDOWN) |
---|
87 | | - intensity = FB_BLANK_POWERDOWN; |
---|
88 | | - |
---|
89 | | - if (intensity == FB_BLANK_UNBLANK) { /* FULL ON */ |
---|
90 | | - cur &= ~CRVML_BACKLIGHT_OFF; |
---|
91 | | - outl(cur, addr); |
---|
92 | | - } else if (intensity == FB_BLANK_POWERDOWN) { /* OFF */ |
---|
| 65 | + if (backlight_get_brightness(bd) == 0) { |
---|
| 66 | + /* OFF */ |
---|
93 | 67 | cur |= CRVML_BACKLIGHT_OFF; |
---|
94 | 68 | outl(cur, addr); |
---|
95 | | - } /* anything else, don't bother */ |
---|
| 69 | + } else { |
---|
| 70 | + /* FULL ON */ |
---|
| 71 | + cur &= ~CRVML_BACKLIGHT_OFF; |
---|
| 72 | + outl(cur, addr); |
---|
| 73 | + } |
---|
96 | 74 | |
---|
97 | 75 | return 0; |
---|
98 | 76 | } |
---|
.. | .. |
---|
104 | 82 | u8 intensity; |
---|
105 | 83 | |
---|
106 | 84 | if (cur & CRVML_BACKLIGHT_OFF) |
---|
107 | | - intensity = FB_BLANK_POWERDOWN; |
---|
| 85 | + intensity = 0; |
---|
108 | 86 | else |
---|
109 | | - intensity = FB_BLANK_UNBLANK; |
---|
| 87 | + intensity = 1; |
---|
110 | 88 | |
---|
111 | 89 | return intensity; |
---|
112 | 90 | } |
---|