1f7018c21STomi Valkeinen /* 2f7018c21STomi Valkeinen * Simplest possible simple frame-buffer driver, as a platform device 3f7018c21STomi Valkeinen * 4f7018c21STomi Valkeinen * Copyright (c) 2013, Stephen Warren 5f7018c21STomi Valkeinen * 6f7018c21STomi Valkeinen * Based on q40fb.c, which was: 7f7018c21STomi Valkeinen * Copyright (C) 2001 Richard Zidlicky <[email protected]> 8f7018c21STomi Valkeinen * 9f7018c21STomi Valkeinen * Also based on offb.c, which was: 10f7018c21STomi Valkeinen * Copyright (C) 1997 Geert Uytterhoeven 11f7018c21STomi Valkeinen * Copyright (C) 1996 Paul Mackerras 12f7018c21STomi Valkeinen * 13f7018c21STomi Valkeinen * This program is free software; you can redistribute it and/or modify it 14f7018c21STomi Valkeinen * under the terms and conditions of the GNU General Public License, 15f7018c21STomi Valkeinen * version 2, as published by the Free Software Foundation. 16f7018c21STomi Valkeinen * 17f7018c21STomi Valkeinen * This program is distributed in the hope it will be useful, but WITHOUT 18f7018c21STomi Valkeinen * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 19f7018c21STomi Valkeinen * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 20f7018c21STomi Valkeinen * more details. 21f7018c21STomi Valkeinen */ 22f7018c21STomi Valkeinen 23f7018c21STomi Valkeinen #include <linux/errno.h> 24f7018c21STomi Valkeinen #include <linux/fb.h> 25f7018c21STomi Valkeinen #include <linux/io.h> 26f7018c21STomi Valkeinen #include <linux/module.h> 27f7018c21STomi Valkeinen #include <linux/platform_data/simplefb.h> 28f7018c21STomi Valkeinen #include <linux/platform_device.h> 29*fc219bfdSLuc Verhaegen #include <linux/clk-provider.h> 30f7018c21STomi Valkeinen 31f7018c21STomi Valkeinen static struct fb_fix_screeninfo simplefb_fix = { 32f7018c21STomi Valkeinen .id = "simple", 33f7018c21STomi Valkeinen .type = FB_TYPE_PACKED_PIXELS, 34f7018c21STomi Valkeinen .visual = FB_VISUAL_TRUECOLOR, 35f7018c21STomi Valkeinen .accel = FB_ACCEL_NONE, 36f7018c21STomi Valkeinen }; 37f7018c21STomi Valkeinen 38f7018c21STomi Valkeinen static struct fb_var_screeninfo simplefb_var = { 39f7018c21STomi Valkeinen .height = -1, 40f7018c21STomi Valkeinen .width = -1, 41f7018c21STomi Valkeinen .activate = FB_ACTIVATE_NOW, 42f7018c21STomi Valkeinen .vmode = FB_VMODE_NONINTERLACED, 43f7018c21STomi Valkeinen }; 44f7018c21STomi Valkeinen 451270be4aSLuc Verhaegen #define PSEUDO_PALETTE_SIZE 16 461270be4aSLuc Verhaegen 47f7018c21STomi Valkeinen static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, 48f7018c21STomi Valkeinen u_int transp, struct fb_info *info) 49f7018c21STomi Valkeinen { 50f7018c21STomi Valkeinen u32 *pal = info->pseudo_palette; 51f7018c21STomi Valkeinen u32 cr = red >> (16 - info->var.red.length); 52f7018c21STomi Valkeinen u32 cg = green >> (16 - info->var.green.length); 53f7018c21STomi Valkeinen u32 cb = blue >> (16 - info->var.blue.length); 54f7018c21STomi Valkeinen u32 value; 55f7018c21STomi Valkeinen 561270be4aSLuc Verhaegen if (regno >= PSEUDO_PALETTE_SIZE) 57f7018c21STomi Valkeinen return -EINVAL; 58f7018c21STomi Valkeinen 59f7018c21STomi Valkeinen value = (cr << info->var.red.offset) | 60f7018c21STomi Valkeinen (cg << info->var.green.offset) | 61f7018c21STomi Valkeinen (cb << info->var.blue.offset); 62f7018c21STomi Valkeinen if (info->var.transp.length > 0) { 63f7018c21STomi Valkeinen u32 mask = (1 << info->var.transp.length) - 1; 64f7018c21STomi Valkeinen mask <<= info->var.transp.offset; 65f7018c21STomi Valkeinen value |= mask; 66f7018c21STomi Valkeinen } 67f7018c21STomi Valkeinen pal[regno] = value; 68f7018c21STomi Valkeinen 69f7018c21STomi Valkeinen return 0; 70f7018c21STomi Valkeinen } 71f7018c21STomi Valkeinen 72f7018c21STomi Valkeinen static void simplefb_destroy(struct fb_info *info) 73f7018c21STomi Valkeinen { 74f7018c21STomi Valkeinen if (info->screen_base) 75f7018c21STomi Valkeinen iounmap(info->screen_base); 76f7018c21STomi Valkeinen } 77f7018c21STomi Valkeinen 78f7018c21STomi Valkeinen static struct fb_ops simplefb_ops = { 79f7018c21STomi Valkeinen .owner = THIS_MODULE, 80f7018c21STomi Valkeinen .fb_destroy = simplefb_destroy, 81f7018c21STomi Valkeinen .fb_setcolreg = simplefb_setcolreg, 82f7018c21STomi Valkeinen .fb_fillrect = cfb_fillrect, 83f7018c21STomi Valkeinen .fb_copyarea = cfb_copyarea, 84f7018c21STomi Valkeinen .fb_imageblit = cfb_imageblit, 85f7018c21STomi Valkeinen }; 86f7018c21STomi Valkeinen 87f7018c21STomi Valkeinen static struct simplefb_format simplefb_formats[] = SIMPLEFB_FORMATS; 88f7018c21STomi Valkeinen 89f7018c21STomi Valkeinen struct simplefb_params { 90f7018c21STomi Valkeinen u32 width; 91f7018c21STomi Valkeinen u32 height; 92f7018c21STomi Valkeinen u32 stride; 93f7018c21STomi Valkeinen struct simplefb_format *format; 94f7018c21STomi Valkeinen }; 95f7018c21STomi Valkeinen 96f7018c21STomi Valkeinen static int simplefb_parse_dt(struct platform_device *pdev, 97f7018c21STomi Valkeinen struct simplefb_params *params) 98f7018c21STomi Valkeinen { 99f7018c21STomi Valkeinen struct device_node *np = pdev->dev.of_node; 100f7018c21STomi Valkeinen int ret; 101f7018c21STomi Valkeinen const char *format; 102f7018c21STomi Valkeinen int i; 103f7018c21STomi Valkeinen 104f7018c21STomi Valkeinen ret = of_property_read_u32(np, "width", ¶ms->width); 105f7018c21STomi Valkeinen if (ret) { 106f7018c21STomi Valkeinen dev_err(&pdev->dev, "Can't parse width property\n"); 107f7018c21STomi Valkeinen return ret; 108f7018c21STomi Valkeinen } 109f7018c21STomi Valkeinen 110f7018c21STomi Valkeinen ret = of_property_read_u32(np, "height", ¶ms->height); 111f7018c21STomi Valkeinen if (ret) { 112f7018c21STomi Valkeinen dev_err(&pdev->dev, "Can't parse height property\n"); 113f7018c21STomi Valkeinen return ret; 114f7018c21STomi Valkeinen } 115f7018c21STomi Valkeinen 116f7018c21STomi Valkeinen ret = of_property_read_u32(np, "stride", ¶ms->stride); 117f7018c21STomi Valkeinen if (ret) { 118f7018c21STomi Valkeinen dev_err(&pdev->dev, "Can't parse stride property\n"); 119f7018c21STomi Valkeinen return ret; 120f7018c21STomi Valkeinen } 121f7018c21STomi Valkeinen 122f7018c21STomi Valkeinen ret = of_property_read_string(np, "format", &format); 123f7018c21STomi Valkeinen if (ret) { 124f7018c21STomi Valkeinen dev_err(&pdev->dev, "Can't parse format property\n"); 125f7018c21STomi Valkeinen return ret; 126f7018c21STomi Valkeinen } 127f7018c21STomi Valkeinen params->format = NULL; 128f7018c21STomi Valkeinen for (i = 0; i < ARRAY_SIZE(simplefb_formats); i++) { 129f7018c21STomi Valkeinen if (strcmp(format, simplefb_formats[i].name)) 130f7018c21STomi Valkeinen continue; 131f7018c21STomi Valkeinen params->format = &simplefb_formats[i]; 132f7018c21STomi Valkeinen break; 133f7018c21STomi Valkeinen } 134f7018c21STomi Valkeinen if (!params->format) { 135f7018c21STomi Valkeinen dev_err(&pdev->dev, "Invalid format value\n"); 136f7018c21STomi Valkeinen return -EINVAL; 137f7018c21STomi Valkeinen } 138f7018c21STomi Valkeinen 139f7018c21STomi Valkeinen return 0; 140f7018c21STomi Valkeinen } 141f7018c21STomi Valkeinen 142f7018c21STomi Valkeinen static int simplefb_parse_pd(struct platform_device *pdev, 143f7018c21STomi Valkeinen struct simplefb_params *params) 144f7018c21STomi Valkeinen { 145f7018c21STomi Valkeinen struct simplefb_platform_data *pd = dev_get_platdata(&pdev->dev); 146f7018c21STomi Valkeinen int i; 147f7018c21STomi Valkeinen 148f7018c21STomi Valkeinen params->width = pd->width; 149f7018c21STomi Valkeinen params->height = pd->height; 150f7018c21STomi Valkeinen params->stride = pd->stride; 151f7018c21STomi Valkeinen 152f7018c21STomi Valkeinen params->format = NULL; 153f7018c21STomi Valkeinen for (i = 0; i < ARRAY_SIZE(simplefb_formats); i++) { 154f7018c21STomi Valkeinen if (strcmp(pd->format, simplefb_formats[i].name)) 155f7018c21STomi Valkeinen continue; 156f7018c21STomi Valkeinen 157f7018c21STomi Valkeinen params->format = &simplefb_formats[i]; 158f7018c21STomi Valkeinen break; 159f7018c21STomi Valkeinen } 160f7018c21STomi Valkeinen 161f7018c21STomi Valkeinen if (!params->format) { 162f7018c21STomi Valkeinen dev_err(&pdev->dev, "Invalid format value\n"); 163f7018c21STomi Valkeinen return -EINVAL; 164f7018c21STomi Valkeinen } 165f7018c21STomi Valkeinen 166f7018c21STomi Valkeinen return 0; 167f7018c21STomi Valkeinen } 168f7018c21STomi Valkeinen 1691270be4aSLuc Verhaegen struct simplefb_par { 1701270be4aSLuc Verhaegen u32 palette[PSEUDO_PALETTE_SIZE]; 171*fc219bfdSLuc Verhaegen #ifdef CONFIG_OF 172*fc219bfdSLuc Verhaegen int clk_count; 173*fc219bfdSLuc Verhaegen struct clk **clks; 174*fc219bfdSLuc Verhaegen #endif 1751270be4aSLuc Verhaegen }; 1761270be4aSLuc Verhaegen 177*fc219bfdSLuc Verhaegen #ifdef CONFIG_OF 178*fc219bfdSLuc Verhaegen /* 179*fc219bfdSLuc Verhaegen * Clock handling code. 180*fc219bfdSLuc Verhaegen * 181*fc219bfdSLuc Verhaegen * Here we handle the clocks property of our "simple-framebuffer" dt node. 182*fc219bfdSLuc Verhaegen * This is necessary so that we can make sure that any clocks needed by 183*fc219bfdSLuc Verhaegen * the display engine that the bootloader set up for us (and for which it 184*fc219bfdSLuc Verhaegen * provided a simplefb dt node), stay up, for the life of the simplefb 185*fc219bfdSLuc Verhaegen * driver. 186*fc219bfdSLuc Verhaegen * 187*fc219bfdSLuc Verhaegen * When the driver unloads, we cleanly disable, and then release the clocks. 188*fc219bfdSLuc Verhaegen * 189*fc219bfdSLuc Verhaegen * We only complain about errors here, no action is taken as the most likely 190*fc219bfdSLuc Verhaegen * error can only happen due to a mismatch between the bootloader which set 191*fc219bfdSLuc Verhaegen * up simplefb, and the clock definitions in the device tree. Chances are 192*fc219bfdSLuc Verhaegen * that there are no adverse effects, and if there are, a clean teardown of 193*fc219bfdSLuc Verhaegen * the fb probe will not help us much either. So just complain and carry on, 194*fc219bfdSLuc Verhaegen * and hope that the user actually gets a working fb at the end of things. 195*fc219bfdSLuc Verhaegen */ 196*fc219bfdSLuc Verhaegen static int simplefb_clocks_init(struct simplefb_par *par, 197*fc219bfdSLuc Verhaegen struct platform_device *pdev) 198*fc219bfdSLuc Verhaegen { 199*fc219bfdSLuc Verhaegen struct device_node *np = pdev->dev.of_node; 200*fc219bfdSLuc Verhaegen struct clk *clock; 201*fc219bfdSLuc Verhaegen int i, ret; 202*fc219bfdSLuc Verhaegen 203*fc219bfdSLuc Verhaegen if (dev_get_platdata(&pdev->dev) || !np) 204*fc219bfdSLuc Verhaegen return 0; 205*fc219bfdSLuc Verhaegen 206*fc219bfdSLuc Verhaegen par->clk_count = of_clk_get_parent_count(np); 207*fc219bfdSLuc Verhaegen if (par->clk_count <= 0) 208*fc219bfdSLuc Verhaegen return 0; 209*fc219bfdSLuc Verhaegen 210*fc219bfdSLuc Verhaegen par->clks = kcalloc(par->clk_count, sizeof(struct clk *), GFP_KERNEL); 211*fc219bfdSLuc Verhaegen if (!par->clks) 212*fc219bfdSLuc Verhaegen return -ENOMEM; 213*fc219bfdSLuc Verhaegen 214*fc219bfdSLuc Verhaegen for (i = 0; i < par->clk_count; i++) { 215*fc219bfdSLuc Verhaegen clock = of_clk_get(np, i); 216*fc219bfdSLuc Verhaegen if (IS_ERR(clock)) { 217*fc219bfdSLuc Verhaegen if (PTR_ERR(clock) == -EPROBE_DEFER) { 218*fc219bfdSLuc Verhaegen while (--i >= 0) { 219*fc219bfdSLuc Verhaegen if (par->clks[i]) 220*fc219bfdSLuc Verhaegen clk_put(par->clks[i]); 221*fc219bfdSLuc Verhaegen } 222*fc219bfdSLuc Verhaegen kfree(par->clks); 223*fc219bfdSLuc Verhaegen return -EPROBE_DEFER; 224*fc219bfdSLuc Verhaegen } 225*fc219bfdSLuc Verhaegen dev_err(&pdev->dev, "%s: clock %d not found: %ld\n", 226*fc219bfdSLuc Verhaegen __func__, i, PTR_ERR(clock)); 227*fc219bfdSLuc Verhaegen continue; 228*fc219bfdSLuc Verhaegen } 229*fc219bfdSLuc Verhaegen par->clks[i] = clock; 230*fc219bfdSLuc Verhaegen } 231*fc219bfdSLuc Verhaegen 232*fc219bfdSLuc Verhaegen for (i = 0; i < par->clk_count; i++) { 233*fc219bfdSLuc Verhaegen if (par->clks[i]) { 234*fc219bfdSLuc Verhaegen ret = clk_prepare_enable(par->clks[i]); 235*fc219bfdSLuc Verhaegen if (ret) { 236*fc219bfdSLuc Verhaegen dev_err(&pdev->dev, 237*fc219bfdSLuc Verhaegen "%s: failed to enable clock %d: %d\n", 238*fc219bfdSLuc Verhaegen __func__, i, ret); 239*fc219bfdSLuc Verhaegen clk_put(par->clks[i]); 240*fc219bfdSLuc Verhaegen par->clks[i] = NULL; 241*fc219bfdSLuc Verhaegen } 242*fc219bfdSLuc Verhaegen } 243*fc219bfdSLuc Verhaegen } 244*fc219bfdSLuc Verhaegen 245*fc219bfdSLuc Verhaegen return 0; 246*fc219bfdSLuc Verhaegen } 247*fc219bfdSLuc Verhaegen 248*fc219bfdSLuc Verhaegen static void simplefb_clocks_destroy(struct simplefb_par *par) 249*fc219bfdSLuc Verhaegen { 250*fc219bfdSLuc Verhaegen int i; 251*fc219bfdSLuc Verhaegen 252*fc219bfdSLuc Verhaegen if (!par->clks) 253*fc219bfdSLuc Verhaegen return; 254*fc219bfdSLuc Verhaegen 255*fc219bfdSLuc Verhaegen for (i = 0; i < par->clk_count; i++) { 256*fc219bfdSLuc Verhaegen if (par->clks[i]) { 257*fc219bfdSLuc Verhaegen clk_disable_unprepare(par->clks[i]); 258*fc219bfdSLuc Verhaegen clk_put(par->clks[i]); 259*fc219bfdSLuc Verhaegen } 260*fc219bfdSLuc Verhaegen } 261*fc219bfdSLuc Verhaegen 262*fc219bfdSLuc Verhaegen kfree(par->clks); 263*fc219bfdSLuc Verhaegen } 264*fc219bfdSLuc Verhaegen #else 265*fc219bfdSLuc Verhaegen static int simplefb_clocks_init(struct simplefb_par *par, 266*fc219bfdSLuc Verhaegen struct platform_device *pdev) { return 0; } 267*fc219bfdSLuc Verhaegen static void simplefb_clocks_destroy(struct simplefb_par *par) { } 268*fc219bfdSLuc Verhaegen #endif 269*fc219bfdSLuc Verhaegen 270f7018c21STomi Valkeinen static int simplefb_probe(struct platform_device *pdev) 271f7018c21STomi Valkeinen { 272f7018c21STomi Valkeinen int ret; 273f7018c21STomi Valkeinen struct simplefb_params params; 274f7018c21STomi Valkeinen struct fb_info *info; 2751270be4aSLuc Verhaegen struct simplefb_par *par; 276f7018c21STomi Valkeinen struct resource *mem; 277f7018c21STomi Valkeinen 278f7018c21STomi Valkeinen if (fb_get_options("simplefb", NULL)) 279f7018c21STomi Valkeinen return -ENODEV; 280f7018c21STomi Valkeinen 281f7018c21STomi Valkeinen ret = -ENODEV; 282f7018c21STomi Valkeinen if (dev_get_platdata(&pdev->dev)) 283f7018c21STomi Valkeinen ret = simplefb_parse_pd(pdev, ¶ms); 284f7018c21STomi Valkeinen else if (pdev->dev.of_node) 285f7018c21STomi Valkeinen ret = simplefb_parse_dt(pdev, ¶ms); 286f7018c21STomi Valkeinen 287f7018c21STomi Valkeinen if (ret) 288f7018c21STomi Valkeinen return ret; 289f7018c21STomi Valkeinen 290f7018c21STomi Valkeinen mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 291f7018c21STomi Valkeinen if (!mem) { 292f7018c21STomi Valkeinen dev_err(&pdev->dev, "No memory resource\n"); 293f7018c21STomi Valkeinen return -EINVAL; 294f7018c21STomi Valkeinen } 295f7018c21STomi Valkeinen 2961270be4aSLuc Verhaegen info = framebuffer_alloc(sizeof(struct simplefb_par), &pdev->dev); 297f7018c21STomi Valkeinen if (!info) 298f7018c21STomi Valkeinen return -ENOMEM; 299f7018c21STomi Valkeinen platform_set_drvdata(pdev, info); 300f7018c21STomi Valkeinen 3011270be4aSLuc Verhaegen par = info->par; 3021270be4aSLuc Verhaegen 303f7018c21STomi Valkeinen info->fix = simplefb_fix; 304f7018c21STomi Valkeinen info->fix.smem_start = mem->start; 305f7018c21STomi Valkeinen info->fix.smem_len = resource_size(mem); 306f7018c21STomi Valkeinen info->fix.line_length = params.stride; 307f7018c21STomi Valkeinen 308f7018c21STomi Valkeinen info->var = simplefb_var; 309f7018c21STomi Valkeinen info->var.xres = params.width; 310f7018c21STomi Valkeinen info->var.yres = params.height; 311f7018c21STomi Valkeinen info->var.xres_virtual = params.width; 312f7018c21STomi Valkeinen info->var.yres_virtual = params.height; 313f7018c21STomi Valkeinen info->var.bits_per_pixel = params.format->bits_per_pixel; 314f7018c21STomi Valkeinen info->var.red = params.format->red; 315f7018c21STomi Valkeinen info->var.green = params.format->green; 316f7018c21STomi Valkeinen info->var.blue = params.format->blue; 317f7018c21STomi Valkeinen info->var.transp = params.format->transp; 318f7018c21STomi Valkeinen 319f7018c21STomi Valkeinen info->apertures = alloc_apertures(1); 320f7018c21STomi Valkeinen if (!info->apertures) { 321bf2fda15SLuc Verhaegen ret = -ENOMEM; 322bf2fda15SLuc Verhaegen goto error_fb_release; 323f7018c21STomi Valkeinen } 324f7018c21STomi Valkeinen info->apertures->ranges[0].base = info->fix.smem_start; 325f7018c21STomi Valkeinen info->apertures->ranges[0].size = info->fix.smem_len; 326f7018c21STomi Valkeinen 327f7018c21STomi Valkeinen info->fbops = &simplefb_ops; 328f7018c21STomi Valkeinen info->flags = FBINFO_DEFAULT | FBINFO_MISC_FIRMWARE; 329f7018c21STomi Valkeinen info->screen_base = ioremap_wc(info->fix.smem_start, 330f7018c21STomi Valkeinen info->fix.smem_len); 331f7018c21STomi Valkeinen if (!info->screen_base) { 332bf2fda15SLuc Verhaegen ret = -ENOMEM; 333bf2fda15SLuc Verhaegen goto error_fb_release; 334f7018c21STomi Valkeinen } 3351270be4aSLuc Verhaegen info->pseudo_palette = par->palette; 336f7018c21STomi Valkeinen 337*fc219bfdSLuc Verhaegen ret = simplefb_clocks_init(par, pdev); 338*fc219bfdSLuc Verhaegen if (ret < 0) 339*fc219bfdSLuc Verhaegen goto error_unmap; 340*fc219bfdSLuc Verhaegen 341f7018c21STomi Valkeinen dev_info(&pdev->dev, "framebuffer at 0x%lx, 0x%x bytes, mapped to 0x%p\n", 342f7018c21STomi Valkeinen info->fix.smem_start, info->fix.smem_len, 343f7018c21STomi Valkeinen info->screen_base); 344f7018c21STomi Valkeinen dev_info(&pdev->dev, "format=%s, mode=%dx%dx%d, linelength=%d\n", 345f7018c21STomi Valkeinen params.format->name, 346f7018c21STomi Valkeinen info->var.xres, info->var.yres, 347f7018c21STomi Valkeinen info->var.bits_per_pixel, info->fix.line_length); 348f7018c21STomi Valkeinen 349f7018c21STomi Valkeinen ret = register_framebuffer(info); 350f7018c21STomi Valkeinen if (ret < 0) { 351f7018c21STomi Valkeinen dev_err(&pdev->dev, "Unable to register simplefb: %d\n", ret); 352*fc219bfdSLuc Verhaegen goto error_clocks; 353f7018c21STomi Valkeinen } 354f7018c21STomi Valkeinen 355f7018c21STomi Valkeinen dev_info(&pdev->dev, "fb%d: simplefb registered!\n", info->node); 356f7018c21STomi Valkeinen 357f7018c21STomi Valkeinen return 0; 358bf2fda15SLuc Verhaegen 359*fc219bfdSLuc Verhaegen error_clocks: 360*fc219bfdSLuc Verhaegen simplefb_clocks_destroy(par); 361bf2fda15SLuc Verhaegen error_unmap: 362bf2fda15SLuc Verhaegen iounmap(info->screen_base); 363bf2fda15SLuc Verhaegen error_fb_release: 364bf2fda15SLuc Verhaegen framebuffer_release(info); 365bf2fda15SLuc Verhaegen return ret; 366f7018c21STomi Valkeinen } 367f7018c21STomi Valkeinen 368f7018c21STomi Valkeinen static int simplefb_remove(struct platform_device *pdev) 369f7018c21STomi Valkeinen { 370f7018c21STomi Valkeinen struct fb_info *info = platform_get_drvdata(pdev); 371*fc219bfdSLuc Verhaegen struct simplefb_par *par = info->par; 372f7018c21STomi Valkeinen 373f7018c21STomi Valkeinen unregister_framebuffer(info); 374*fc219bfdSLuc Verhaegen simplefb_clocks_destroy(par); 375f7018c21STomi Valkeinen framebuffer_release(info); 376f7018c21STomi Valkeinen 377f7018c21STomi Valkeinen return 0; 378f7018c21STomi Valkeinen } 379f7018c21STomi Valkeinen 380f7018c21STomi Valkeinen static const struct of_device_id simplefb_of_match[] = { 381f7018c21STomi Valkeinen { .compatible = "simple-framebuffer", }, 382f7018c21STomi Valkeinen { }, 383f7018c21STomi Valkeinen }; 384f7018c21STomi Valkeinen MODULE_DEVICE_TABLE(of, simplefb_of_match); 385f7018c21STomi Valkeinen 386f7018c21STomi Valkeinen static struct platform_driver simplefb_driver = { 387f7018c21STomi Valkeinen .driver = { 388f7018c21STomi Valkeinen .name = "simple-framebuffer", 389f7018c21STomi Valkeinen .owner = THIS_MODULE, 390f7018c21STomi Valkeinen .of_match_table = simplefb_of_match, 391f7018c21STomi Valkeinen }, 392f7018c21STomi Valkeinen .probe = simplefb_probe, 393f7018c21STomi Valkeinen .remove = simplefb_remove, 394f7018c21STomi Valkeinen }; 395f7018c21STomi Valkeinen module_platform_driver(simplefb_driver); 396f7018c21STomi Valkeinen 397f7018c21STomi Valkeinen MODULE_AUTHOR("Stephen Warren <[email protected]>"); 398f7018c21STomi Valkeinen MODULE_DESCRIPTION("Simple framebuffer driver"); 399f7018c21STomi Valkeinen MODULE_LICENSE("GPL v2"); 400