Date:2010-06-28 01:01:11 (13 years 5 months ago)
Author:Lars C.
Commit:bd9ee3a48fda75e5611c929441bf251cc1a86761
Message:fbdev: jz4740: Minor cleanups

Files: drivers/video/jz4740_fb.c (13 diffs)

Change Details

drivers/video/jz4740_fb.c
11/*
22 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 SoC LCD framebuffer driver
3 * JZ4740 SoC LCD framebuffer driver
44 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
88 * option) any later version.
99 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
1212 * 675 Mass Ave, Cambridge, MA 02139, USA.
1313 *
1414 */
...... 
112112    uint32_t addr;
113113    uint32_t id;
114114    uint32_t cmd;
115} __attribute__((packed));
115} __packed;
116116
117117struct jzfb {
118118    struct fb_info *fb;
...... 
136136    uint32_t pseudo_palette[16];
137137};
138138
139static struct fb_fix_screeninfo jzfb_fix __devinitdata = {
139static const struct fb_fix_screeninfo jzfb_fix __devinitdata = {
140140    .id = "JZ4740 FB",
141141    .type = FB_TYPE_PACKED_PIXELS,
142142    .visual = FB_VISUAL_TRUECOLOR,
...... 
233233    if (regno >= 16)
234234        return -EINVAL;
235235
236    color = jzfb_convert_color_to_hw(red, fb->var.red.length);
237    color |= jzfb_convert_color_to_hw(green, fb->var.green.length);
238    color |= jzfb_convert_color_to_hw(blue, fb->var.blue.length);
239    color |= jzfb_convert_color_to_hw(transp, fb->var.transp.length);
236    color = jzfb_convert_color_to_hw(red, &fb->var.red);
237    color |= jzfb_convert_color_to_hw(green, &fb->var.green);
238    color |= jzfb_convert_color_to_hw(blue, &fb->var.blue);
239    color |= jzfb_convert_color_to_hw(transp, &fb->var.transp);
240240
241241    ((uint32_t *)(fb->pseudo_palette))[regno] = color;
242242
...... 
348348    if (mode == NULL)
349349        return -EINVAL;
350350
351    if (mode == info->mode)
352        return 0;
353
351354    info->mode = mode;
352355
353356    hds = mode->hsync_len + mode->left_margin;
...... 
387390        break;
388391    }
389392
390    cfg = 0;
391    cfg |= JZ_LCD_CFG_PS_DISABLE;
392    cfg |= JZ_LCD_CFG_CLS_DISABLE;
393    cfg |= JZ_LCD_CFG_SPL_DISABLE;
394    cfg |= JZ_LCD_CFG_REV_DISABLE;
393    cfg = JZ_LCD_CFG_PS_DISABLE | JZ_LCD_CFG_CLS_DISABLE |
394        JZ_LCD_CFG_SPL_DISABLE | JZ_LCD_CFG_REV_DISABLE;
395395
396396    if (!(mode->sync & FB_SYNC_HOR_HIGH_ACT))
397397        cfg |= JZ_LCD_CFG_HSYNC_ACTIVE_LOW;
...... 
442442
443443    if (!jzfb->is_enabled)
444444        clk_disable(jzfb->ldclk);
445
445446    mutex_unlock(&jzfb->lock);
446447
447448    clk_set_rate(jzfb->lpclk, rate);
...... 
502503        jzfb->is_enabled = 1;
503504
504505        mutex_unlock(&jzfb->lock);
505
506506        break;
507507    default:
508508        mutex_lock(&jzfb->lock);
...... 
512512        }
513513
514514        jzfb_disable(jzfb);
515
516515        jzfb->is_enabled = 0;
516
517517        mutex_unlock(&jzfb->lock);
518518        break;
519519    }
...... 
644644    }
645645
646646    jzfb->base = ioremap(mem->start, resource_size(mem));
647
648647    if (!jzfb->base) {
649648        dev_err(&pdev->dev, "Failed to ioremap register memory region\n");
650649        ret = -EBUSY;
...... 
653652
654653    platform_set_drvdata(pdev, jzfb);
655654
655    mutex_init(&jzfb->lock);
656
656657    fb_videomode_to_modelist(pdata->modes, pdata->num_modes,
657658                 &fb->modelist);
658    fb->mode = pdata->modes;
659
660    fb_videomode_to_var(&fb->var, fb->mode);
659    fb_videomode_to_var(&fb->var, pdata->modes);
661660    fb->var.bits_per_pixel = pdata->bpp;
662661    jzfb_check_var(&fb->var, fb);
663662
...... 
678677
679678    fb_alloc_cmap(&fb->cmap, 256, 0);
680679
681    mutex_init(&jzfb->lock);
682
683680    clk_enable(jzfb->ldclk);
684681    jzfb->is_enabled = 1;
685682
686683    writel(jzfb->framedesc->next, jzfb->base + JZ_REG_LCD_DA0);
684
685    fb->mode = NULL;
687686    jzfb_set_par(fb);
688687
689688    jz_gpio_bulk_request(jz_lcd_ctrl_pins, jzfb_num_ctrl_pins(jzfb));
...... 
814813
815814MODULE_LICENSE("GPL");
816815MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
817MODULE_DESCRIPTION("JZ4720/JZ4740 SoC LCD framebuffer driver");
816MODULE_DESCRIPTION("JZ4740 SoC LCD framebuffer driver");
818817MODULE_ALIAS("platform:jz4740-fb");

Archive Download the corresponding diff file



interactive