diff options
-rw-r--r-- | drivers/video/metronomefb.c | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/drivers/video/metronomefb.c b/drivers/video/metronomefb.c index cc4c038a1b3f..7cda4f80af52 100644 --- a/drivers/video/metronomefb.c +++ b/drivers/video/metronomefb.c | |||
@@ -40,15 +40,6 @@ | |||
40 | 40 | ||
41 | #include <asm/unaligned.h> | 41 | #include <asm/unaligned.h> |
42 | 42 | ||
43 | |||
44 | #define DEBUG 1 | ||
45 | #ifdef DEBUG | ||
46 | #define DPRINTK(f, a...) printk(KERN_DEBUG "%s: " f, __func__ , ## a) | ||
47 | #else | ||
48 | #define DPRINTK(f, a...) | ||
49 | #endif | ||
50 | |||
51 | |||
52 | /* Display specific information */ | 43 | /* Display specific information */ |
53 | #define DPY_W 832 | 44 | #define DPY_W 832 |
54 | #define DPY_H 622 | 45 | #define DPY_H 622 |
@@ -135,8 +126,8 @@ static u16 calc_img_cksum(u16 *start, int length) | |||
135 | 126 | ||
136 | /* here we decode the incoming waveform file and populate metromem */ | 127 | /* here we decode the incoming waveform file and populate metromem */ |
137 | #define EXP_WFORM_SIZE 47001 | 128 | #define EXP_WFORM_SIZE 47001 |
138 | static int load_waveform(u8 *mem, size_t size, u8 *metromem, int m, int t, | 129 | static int __devinit load_waveform(u8 *mem, size_t size, int m, int t, |
139 | u8 *frame_count) | 130 | struct metronomefb_par *par) |
140 | { | 131 | { |
141 | int tta; | 132 | int tta; |
142 | int wmta; | 133 | int wmta; |
@@ -148,9 +139,11 @@ static int load_waveform(u8 *mem, size_t size, u8 *metromem, int m, int t, | |||
148 | int wfm_idx, owfm_idx; | 139 | int wfm_idx, owfm_idx; |
149 | int mem_idx = 0; | 140 | int mem_idx = 0; |
150 | struct waveform_hdr *wfm_hdr; | 141 | struct waveform_hdr *wfm_hdr; |
142 | u8 *metromem = par->metromem_wfm; | ||
143 | struct device *dev = par->info->dev; | ||
151 | 144 | ||
152 | if (size != EXP_WFORM_SIZE) { | 145 | if (size != EXP_WFORM_SIZE) { |
153 | printk(KERN_ERR "Error: unexpected size %d != %d\n", size, | 146 | dev_err(dev, "Error: unexpected size %d != %d\n", size, |
154 | EXP_WFORM_SIZE); | 147 | EXP_WFORM_SIZE); |
155 | return -EINVAL; | 148 | return -EINVAL; |
156 | } | 149 | } |
@@ -158,16 +151,16 @@ static int load_waveform(u8 *mem, size_t size, u8 *metromem, int m, int t, | |||
158 | wfm_hdr = (struct waveform_hdr *) mem; | 151 | wfm_hdr = (struct waveform_hdr *) mem; |
159 | 152 | ||
160 | if (wfm_hdr->fvsn != 1) { | 153 | if (wfm_hdr->fvsn != 1) { |
161 | printk(KERN_ERR "Error: bad fvsn %x\n", wfm_hdr->fvsn); | 154 | dev_err(dev, "Error: bad fvsn %x\n", wfm_hdr->fvsn); |
162 | return -EINVAL; | 155 | return -EINVAL; |
163 | } | 156 | } |
164 | if (wfm_hdr->luts != 0) { | 157 | if (wfm_hdr->luts != 0) { |
165 | printk(KERN_ERR "Error: bad luts %x\n", wfm_hdr->luts); | 158 | dev_err(dev, "Error: bad luts %x\n", wfm_hdr->luts); |
166 | return -EINVAL; | 159 | return -EINVAL; |
167 | } | 160 | } |
168 | cksum = calc_cksum(32, 47, mem); | 161 | cksum = calc_cksum(32, 47, mem); |
169 | if (cksum != wfm_hdr->wfm_cs) { | 162 | if (cksum != wfm_hdr->wfm_cs) { |
170 | printk(KERN_ERR "Error: bad cksum %x != %x\n", cksum, | 163 | dev_err(dev, "Error: bad cksum %x != %x\n", cksum, |
171 | wfm_hdr->wfm_cs); | 164 | wfm_hdr->wfm_cs); |
172 | return -EINVAL; | 165 | return -EINVAL; |
173 | } | 166 | } |
@@ -175,7 +168,7 @@ static int load_waveform(u8 *mem, size_t size, u8 *metromem, int m, int t, | |||
175 | wfm_hdr->trc += 1; | 168 | wfm_hdr->trc += 1; |
176 | for (i = 0; i < 5; i++) { | 169 | for (i = 0; i < 5; i++) { |
177 | if (*(wfm_hdr->stuff2a + i) != 0) { | 170 | if (*(wfm_hdr->stuff2a + i) != 0) { |
178 | printk(KERN_ERR "Error: unexpected value in padding\n"); | 171 | dev_err(dev, "Error: unexpected value in padding\n"); |
179 | return -EINVAL; | 172 | return -EINVAL; |
180 | } | 173 | } |
181 | } | 174 | } |
@@ -200,7 +193,7 @@ static int load_waveform(u8 *mem, size_t size, u8 *metromem, int m, int t, | |||
200 | return -EINVAL; | 193 | return -EINVAL; |
201 | cksum = calc_cksum(sizeof(*wfm_hdr), cksum_idx, mem); | 194 | cksum = calc_cksum(sizeof(*wfm_hdr), cksum_idx, mem); |
202 | if (cksum != mem[cksum_idx]) { | 195 | if (cksum != mem[cksum_idx]) { |
203 | printk(KERN_ERR "Error: bad temperature range table cksum" | 196 | dev_err(dev, "Error: bad temperature range table cksum" |
204 | " %x != %x\n", cksum, mem[cksum_idx]); | 197 | " %x != %x\n", cksum, mem[cksum_idx]); |
205 | return -EINVAL; | 198 | return -EINVAL; |
206 | } | 199 | } |
@@ -212,7 +205,7 @@ static int load_waveform(u8 *mem, size_t size, u8 *metromem, int m, int t, | |||
212 | return -EINVAL; | 205 | return -EINVAL; |
213 | cksum = calc_cksum(cksum_idx - 3, cksum_idx, mem); | 206 | cksum = calc_cksum(cksum_idx - 3, cksum_idx, mem); |
214 | if (cksum != mem[cksum_idx]) { | 207 | if (cksum != mem[cksum_idx]) { |
215 | printk(KERN_ERR "Error: bad mode table address cksum" | 208 | dev_err(dev, "Error: bad mode table address cksum" |
216 | " %x != %x\n", cksum, mem[cksum_idx]); | 209 | " %x != %x\n", cksum, mem[cksum_idx]); |
217 | return -EINVAL; | 210 | return -EINVAL; |
218 | } | 211 | } |
@@ -224,7 +217,7 @@ static int load_waveform(u8 *mem, size_t size, u8 *metromem, int m, int t, | |||
224 | return -EINVAL; | 217 | return -EINVAL; |
225 | cksum = calc_cksum(cksum_idx - 3, cksum_idx, mem); | 218 | cksum = calc_cksum(cksum_idx - 3, cksum_idx, mem); |
226 | if (cksum != mem[cksum_idx]) { | 219 | if (cksum != mem[cksum_idx]) { |
227 | printk(KERN_ERR "Error: bad temperature table address cksum" | 220 | dev_err(dev, "Error: bad temperature table address cksum" |
228 | " %x != %x\n", cksum, mem[cksum_idx]); | 221 | " %x != %x\n", cksum, mem[cksum_idx]); |
229 | return -EINVAL; | 222 | return -EINVAL; |
230 | } | 223 | } |
@@ -259,11 +252,11 @@ static int load_waveform(u8 *mem, size_t size, u8 *metromem, int m, int t, | |||
259 | return -EINVAL; | 252 | return -EINVAL; |
260 | cksum = calc_cksum(owfm_idx, cksum_idx, mem); | 253 | cksum = calc_cksum(owfm_idx, cksum_idx, mem); |
261 | if (cksum != mem[cksum_idx]) { | 254 | if (cksum != mem[cksum_idx]) { |
262 | printk(KERN_ERR "Error: bad waveform data cksum" | 255 | dev_err(dev, "Error: bad waveform data cksum" |
263 | " %x != %x\n", cksum, mem[cksum_idx]); | 256 | " %x != %x\n", cksum, mem[cksum_idx]); |
264 | return -EINVAL; | 257 | return -EINVAL; |
265 | } | 258 | } |
266 | *frame_count = (mem_idx/64); | 259 | par->frame_count = (mem_idx/64); |
267 | 260 | ||
268 | return 0; | 261 | return 0; |
269 | } | 262 | } |
@@ -662,15 +655,15 @@ static int __devinit metronomefb_probe(struct platform_device *dev) | |||
662 | b) process waveform and decode into metromem */ | 655 | b) process waveform and decode into metromem */ |
663 | retval = request_firmware(&fw_entry, "metronome.wbf", &dev->dev); | 656 | retval = request_firmware(&fw_entry, "metronome.wbf", &dev->dev); |
664 | if (retval < 0) { | 657 | if (retval < 0) { |
665 | printk(KERN_ERR "metronomefb: couldn't get waveform\n"); | 658 | dev_err(&dev->dev, "Failed to get waveform\n"); |
666 | goto err_dma_free; | 659 | goto err_dma_free; |
667 | } | 660 | } |
668 | 661 | ||
669 | retval = load_waveform((u8 *) fw_entry->data, fw_entry->size, | 662 | retval = load_waveform((u8 *) fw_entry->data, fw_entry->size, 3, 31, |
670 | par->metromem_wfm, 3, 31, &par->frame_count); | 663 | par); |
671 | release_firmware(fw_entry); | 664 | release_firmware(fw_entry); |
672 | if (retval < 0) { | 665 | if (retval < 0) { |
673 | printk(KERN_ERR "metronomefb: couldn't process waveform\n"); | 666 | dev_err(&dev->dev, "Failed processing waveform\n"); |
674 | goto err_dma_free; | 667 | goto err_dma_free; |
675 | } | 668 | } |
676 | 669 | ||
@@ -688,7 +681,7 @@ static int __devinit metronomefb_probe(struct platform_device *dev) | |||
688 | 681 | ||
689 | retval = fb_alloc_cmap(&info->cmap, 8, 0); | 682 | retval = fb_alloc_cmap(&info->cmap, 8, 0); |
690 | if (retval < 0) { | 683 | if (retval < 0) { |
691 | printk(KERN_ERR "Failed to allocate colormap\n"); | 684 | dev_err(&dev->dev, "Failed to allocate colormap\n"); |
692 | goto err_fb_rel; | 685 | goto err_fb_rel; |
693 | } | 686 | } |
694 | 687 | ||
@@ -704,7 +697,7 @@ static int __devinit metronomefb_probe(struct platform_device *dev) | |||
704 | 697 | ||
705 | platform_set_drvdata(dev, info); | 698 | platform_set_drvdata(dev, info); |
706 | 699 | ||
707 | printk(KERN_INFO | 700 | dev_dbg(&dev->dev, |
708 | "fb%d: Metronome frame buffer device, using %dK of video" | 701 | "fb%d: Metronome frame buffer device, using %dK of video" |
709 | " memory\n", info->node, videomemorysize >> 10); | 702 | " memory\n", info->node, videomemorysize >> 10); |
710 | 703 | ||