am200epd, pxafb, metronomefb changes v2
cover am200epd, pxafb, metronomefb changes v2
Hi Eric, arm and fbdev friends,
This is version 2 of this RFC and contains the following updates:
- skip setting g_options to __initdata since it is used both by init and probe functions
- fix ordering of iounmap/release_mem_region
- fix setting of smem_len (thanks to Krzysztof for above feedback)
- make user_wfm_size static as caught by sparse
This RFC consists of five patches intended to improve the condition of the am200epd devkit support. The am200epd devkit contains a gumstix (pxa255) and a carrier board (am200epd or Lyre), and a metronome display controller. Previously, there was a drivers/video/am200epd driver that manipulated pxa LCDC registers and GPSR/GPLR registers directly. That was clearly wrong so I have removed it and written a new mach-pxa am200epd support driver. This driver interfaces with pxafb through a set of callbacks to share/unshare pxafb's framebuffer and achieve the same functionality without manipulating any pxa registers directly. The patches are split as follows:
1 pxafb: module unloading support
2 pxafb: add shared framebuffer interface
3 gumstix: conversion to MFP support and add bluetooth support 4 am200epd: remove am200epd platform device driver
5 mach-pxa: add am200epd support
I would be grateful for any feedback and advice.
Thanks,
jaya
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
RFC 1/5 pxafb: module unloading support
This patch to pxafb adds:
- exit and remove handlers
- changes to use __devinit/exit for probe functions and __init/exit for init/exit functions
- removes initdata from g_options since it is accessed both at init and probe
--- drivers/video/pxafb.c | 61 ++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 48 insertions(+), 13 deletions(-)
drivers/video/pxafb.c +48 -13
@@ -1246,7 +1246,7 @@ static int pxafb_resume(struct platform_device *dev)* cache. Once this area is remapped, all virtual memory * access to the video memory should occur at the new region. */ -static int __init pxafb_map_video_memory (struct pxafb_info *fbi) +static int __devinit pxafb_map_video_memory (struct pxafb_info *fbi) {/* * We reserve one page for the palette, plus the size
@@ -1346,7 +1346,7 @@ decode_mode:pxafb_decode_mode_info (fbi, inf->modes, inf->num_modes); } -static struct pxafb_info *__init pxafb_init_fbinfo (struct device *dev) +static struct pxafb_info *__devinit pxafb_init_fbinfo (struct device *dev) {struct pxafb_info *fbi;void *addr;
@@ -1408,7 +1408,7 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev) }#ifdef CONFIG_FB_PXA_PARAMETERS -static int __init parse_opt_mode (struct device *dev,const char *this_opt) +static int __devinit parse_opt_mode (struct device *dev,const char *this_opt) {struct pxafb_mach_info *inf = dev->platform_data;
@@ -1467,7 +1467,7 @@ done:return 0 ; } -static int __init parse_opt (struct device *dev,char *this_opt) +static int __devinit parse_opt (struct device *dev,char *this_opt) {struct pxafb_mach_info *inf = dev->platform_data;struct pxafb_mode_info *mode = &inf->modes[0 ];
@@ -1565,7 +1565,7 @@ static int __init parse_opt(struct device *dev, char *this_opt)return 0 ; } -static int __init pxafb_parse_options (struct device *dev,char *options) +static int __devinit pxafb_parse_options (struct device *dev,char *options) {char *this_opt;int ret;
@@ -1584,10 +1584,10 @@ static int __init pxafb_parse_options(struct device *dev, char *options)return 0 ; } -static char g_options[256 ]__devinitdata ="" ; +static char g_options[256 ] ="" ;#ifndef CONFIG_MODULES -static int __devinit pxafb_setup_options (void ) +static int __init pxafb_setup_options (void ) {char *options =NULL ;
@@ -1611,7 +1611,7 @@ MODULE_PARM_DESC(options, "LCD parameters (see Documentation/fb/pxafb.txt)");#define pxafb_setup_options () (0)#endif -static int __init pxafb_probe (struct platform_device *dev) +static int __devinit pxafb_probe (struct platform_device *dev) {struct pxafb_info *fbi;struct pxafb_mach_info *inf;
@@ -1763,29 +1763,58 @@ static int __init pxafb_probe(struct platform_device *dev) failed_free_irq:free_irq (irq, fbi); -failed_free_res: -release_mem_region (r->start, r->end - r->start +1 ); -failed_free_io: -iounmap (fbi->mmio_base); failed_free_mem:dma_free_writecombine (&dev->dev, fbi->map_size, fbi->map_cpu, fbi->map_dma); +failed_free_io: +iounmap (fbi->mmio_base); +failed_free_res: +release_mem_region (r->start, r->end - r->start +1 ); failed:platform_set_drvdata (dev,NULL );kfree (fbi);return ret; } +static int __devexit pxafb_remove(struct platform_device *dev) +{ +struct pxafb_info *fbi =platform_get_drvdata (dev); +struct resource *r; +int irq; + +if (fbi) { +struct fb_info *info = &fbi->fb; + +dma_free_writecombine (&dev->dev, fbi->map_size, + fbi->map_cpu, fbi->map_dma); + + irq =platform_get_irq (dev,0 ); +free_irq (irq, fbi); + +iounmap (fbi->mmio_base); + + r =platform_get_resource (dev,IORESOURCE_MEM ,0 ); +release_mem_region (r->start, r->end - r->start +1 ); + +fb_dealloc_cmap (&info->cmap); +unregister_framebuffer (info); +kfree (fbi); + } +return 0 ; +} +static struct platform_driver pxafb_driver = { .probe = pxafb_probe, + .remove = pxafb_remove, .suspend = pxafb_suspend, .resume = pxafb_resume, .driver = { + .owner =THIS_MODULE , .name ="pxa2xx-fb" , }, }; -static int __devinit pxafb_init (void ) +static int __init pxafb_init (void ) {if (pxafb_setup_options ())return -EINVAL ;
@@ -1793,7 +1822,13 @@ static int __devinit pxafb_init(void)return platform_driver_register (&pxafb_driver); } +static void __exit pxafb_exit(void) +{ +platform_driver_unregister (&pxafb_driver); +} +module_init (pxafb_init); +module_exit (pxafb_exit);MODULE_DESCRIPTION ("loadable framebuffer driver for PXA" );MODULE_LICENSE ("GPL" );
Signature · 7 lines
1.5.3.6 ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
RFC 2/5 pxafb: add shared framebuffer interface
In reply to Jaya KumarThese changes are to make it possible for a secondary driver to share the pxafb framebuffer. The changes include:
- adding clkdev entry in pxafb_mach_info so that a driver can pass in the correct struct device owner for the LCDCLK.
- adding custom_xfer_div entry so that a driver can have custom sized transfers. For example, the metronome controller uses 16 bit AMLCD transfers but actually has 3 bit pixels in 8 bit containers.
- adding extra_video_mem entry so that a driver can tell pxafb of its additional needs.
- adding share_video_mem/unshare_video_mem callbacks to notify the secondary driver of the framebuffer address, to allow refcounting, and to cleanup on completion.
--- arch/arm/mach-pxa/devices.c | 2 + drivers/video/pxafb.c | 45 ++++++++++++++++++++++++++++++++----- include/asm-arm/arch-pxa/pxafb.h | 9 +++++++ 3 files changed, 50 insertions(+), 6 deletions(-)
arch/arm/mach-pxa/devices.c +2 -0
@@ -130,6 +130,8 @@ struct platform_device pxa_device_fb = {void __init set_pxa_fb_info (struct pxafb_mach_info *info) { +if (!info->clkdev) + info->clkdev = &pxa_device_fb.dev;pxa_register_device (&pxa_device_fb, info); }
drivers/video/pxafb.c +39 -6
128 lines not on this page · raw message
include/asm-arm/arch-pxa/pxafb.h +9 -0
@@ -138,9 +138,18 @@ struct pxafb_mach_info {* All other bits in LCCR4 should be left alone. */ u_int lccr4; +unsigned int custom_xfer_div;/* divides the pixel transfer */ +/* size of extra mem needed for secondary driver */ +unsigned int extra_video_mem; +void *extra_data;/* extra data for secondary */ void (*pxafb_backlight_power)(int );void (*pxafb_lcd_power)(int ,struct fb_var_screeninfo *);void (*smart_update)(struct fb_info *); +/* share_video_mem allows client drivers to get our framebuffer */ +int (*share_video_mem)(unsigned char *,dma_addr_t ,struct module *, +void *); +void (*unshare_video_mem)(void *); +struct device *clkdev; };void set_pxa_fb_info (struct pxafb_mach_info *hard_pxa_fb_info);void set_pxa_fb_parent (struct device *parent_dev);
Signature · 7 lines
1.5.3.6 ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
RFC 3/5 gumstix: conversion to MFP support and add bluetooth support
In reply to Jaya KumarThis patch converts gumstix over to the MFP configuration system and adds bluetooth support. Added a CLK_32K clock to enable bluetooth.
--- arch/arm/mach-pxa/gumstix.c | 79 ++++++++++++++++++++++++++------- arch/arm/mach-pxa/pxa25x.c | 31 +++++++++++++ include/asm-arm/arch-pxa/mfp-pxa25x.h | 1 + 3 files changed, 95 insertions(+), 16 deletions(-)
arch/arm/mach-pxa/gumstix.c +63 -16
@@ -20,8 +20,12 @@#include <linux/init.h> #include <linux/platform_device.h> #include <linux/interrupt.h> +#include <linux/delay.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> +#include <linux/gpio.h> +#include <linux/err.h> +#include <linux/clk.h> #include <asm/setup.h> #include <asm/memory.h>
@@ -40,7 +44,7 @@#include <asm/arch/pxa-regs.h> #include <asm/arch/pxa2xx-regs.h> -#include <asm/arch/pxa2xx-gpio.h> +#include <asm/arch/mfp-pxa25x.h> #include "generic.h"
@@ -85,21 +89,8 @@ static struct platform_device *devices[] __initdata = { };#ifdef CONFIG_MMC_PXA -static struct pxamci_platform_data gumstix_mci_platform_data; - -static int gumstix_mci_init (struct device *dev,irq_handler_t detect_int, -void *data) -{ -pxa_gpio_mode (GPIO6_MMCCLK_MD ); -pxa_gpio_mode (GPIO53_MMCCLK_MD ); -pxa_gpio_mode (GPIO8_MMCCS0_MD ); - -return 0 ; -} -static struct pxamci_platform_data gumstix_mci_platform_data = { .ocr_mask =MMC_VDD_32_33 |MMC_VDD_33_34 , - .init = gumstix_mci_init, };static void __init gumstix_mmc_init (void )
@@ -109,7 +100,7 @@ static void __init gumstix_mmc_init(void)#else static void __init gumstix_mmc_init (void ) { -printk (KERN_INFO "Gumstix mmc disabled\n" ); +pr_debug ("Gumstix mmc disabled\n" ); }#endif
@@ -126,12 +117,68 @@ static void __init gumstix_udc_init(void)#else static void gumstix_udc_init (void ) { -printk (KERN_INFO "Gumstix udc is disabled\n" ); +pr_debug ("Gumstix udc is disabled\n" ); +} +#endif + +#ifdef CONFIG_BT +static void __init gumstix_bluetooth_init (void ) +{ +int err; +struct clk *clk32k; + + clk32k =clk_get (NULL ,"CLK_32K" ); +if (IS_ERR (clk32k)) { +pr_err ("gumstix: failed to find 32kHz clock\n" ); +return ; + } +clk_enable (clk32k); + + err =gpio_direction_output (GPIO_GUMSTIX_BTRESET ,1 ); +if (err) { +pr_err ("gumstix: can't reset bluetooth\n" ); +return ; + } +gpio_set_value (GPIO_GUMSTIX_BTRESET ,0 ); +udelay (100 ); +gpio_set_value (GPIO_GUMSTIX_BTRESET ,1 ); +} +#else +static void gumstix_bluetooth_init (void ) +{ +pr_debug ("Gumstix Bluetooth is disabled\n" ); }#endif +static unsigned long gumstix_pin_config[] __initdata = { +#ifdef CONFIG_BT + GPIO12_32KHz, +/* BTUART */ +GPIO42_HWUART_RXD , +GPIO43_HWUART_TXD , +GPIO44_HWUART_CTS , +GPIO45_HWUART_RTSL , +#endif +#ifdef CONFIG_MMC_PXA +/* MMC */ +GPIO6_MMC_CLK , +GPIO53_MMC_CLK , +GPIO8_MMC_CS0 , +#endif +/* these are used by AM200EPD */ +GPIO51_GPIO , +GPIO49_GPIO , +GPIO48_GPIO , +GPIO32_GPIO , +GPIO17_GPIO , + GPIO16_GPIO, +}; +static void __init gumstix_init (void ) { +pxa2xx_mfp_config (ARRAY_AND_SIZE (gumstix_pin_config)); + +gumstix_bluetooth_init ();gumstix_udc_init ();gumstix_mmc_init (); (void )platform_add_devices (devices,ARRAY_SIZE (devices));
arch/arm/mach-pxa/pxa25x.c +31 -0
@@ -22,6 +22,7 @@#include <linux/platform_device.h> #include <linux/suspend.h> #include <linux/sysdev.h> +#include <linux/delay.h> #include <asm/hardware.h> #include <asm/arch/irqs.h>
@@ -108,6 +109,30 @@ static const struct clkops clk_pxa25x_lcd_ops = { .getrate = clk_pxa25x_lcd_getrate, }; +static void clk_32k_enable (struct clk *clk) +{ +int timeout =500 ; + +OSCC |=OSCC_OON ; +do { +if (OSCC &OSCC_OOK ) +break ; +udelay (1 ); + }while (--timeout); +if (!timeout) +pr_err ("Failed to start 32kHz clock\n" ); +} + +static void clk_32k_disable (struct clk *clk) +{ +OSCC &= ~OSCC_OON ; +} + +static const struct clkops clk_32k_ops = { + .enable = clk_32k_enable, + .disable = clk_32k_disable, +}; +/* * 3.6864MHz -> OST, GPIO, SSP, PWM, PLLs (95.842MHz, 147.456MHz) * 95.842MHz -> MMC 19.169MHz, I2C 31.949MHz, FICP 47.923MHz, USB 47.923MHz
@@ -118,6 +143,12 @@ static struct clk pxa25x_hwuart_clk = ;static struct clk pxa25x_clks[] = { + { + .name ="CLK_32K" , + .ops = &clk_32k_ops, + .rate =32000 , + .delay =70 , + },INIT_CK ("LCDCLK" ,LCD , &clk_pxa25x_lcd_ops, &pxa_device_fb.dev),INIT_CKEN ("UARTCLK" ,FFUART ,14745600 ,1 , &pxa_device_ffuart.dev),INIT_CKEN ("UARTCLK" ,BTUART ,14745600 ,1 , &pxa_device_btuart.dev),
include/asm-arm/arch-pxa/mfp-pxa25x.h +1 -0
@@ -79,6 +79,7 @@#define GPIO43_HWUART_TXD MFP_CFG_OUT(GPIO43, AF3, DRIVE_HIGH)#define GPIO44_HWUART_CTS MFP_CFG_IN(GPIO44, AF3)#define GPIO45_HWUART_RTS MFP_CFG_OUT(GPIO45, AF3, DRIVE_HIGH) +#define GPIO45_HWUART_RTSL MFP_CFG_OUT(GPIO45, AF3, DRIVE_LOW)#define GPIO48_HWUART_TXD MFP_CFG_OUT(GPIO48, AF1, DRIVE_HIGH)#define GPIO49_HWUART_RXD MFP_CFG_IN(GPIO49, AF1)#define GPIO50_HWUART_CTS MFP_CFG_IN(GPIO50, AF1)
Signature · 7 lines
1.5.3.6 ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
RFC 4/5 am200epd: remove am200epd platform device driver
In reply to Jaya KumarThe am200epd driver was designed with bad assumptions. It manipulated GPSR/GPLR registers directly. It relied on direct access to the pxa LCDC registers which have since conflicted with commit ce4fb7b892a6d6c6a0f87366b26fd834d2923dd7 . Thus, it is broken and this patch removes it.
--- drivers/video/Kconfig | 13 -- drivers/video/Makefile | 1 - drivers/video/am200epd.c | 295 ---------------------------------------------- 3 files changed, 0 insertions(+), 309 deletions(-) delete mode 100644 drivers/video/am200epd.c
drivers/video/Kconfig +0 -13
@@ -1937,19 +1937,6 @@ config FB_XILINX framebuffer. ML300 carries a 640*480 LCD display on the board, ML403 uses a standard DB15 VGA connector. -config FB_AM200EPD - tristate "AM-200 E-Ink EPD devkit support" - depends on FB && ARCH_PXA && MMU - select FB_SYS_FILLRECT - select FB_SYS_COPYAREA - select FB_SYS_IMAGEBLIT - select FB_SYS_FOPS - select FB_DEFERRED_IO - select FB_METRONOME - help - This enables support for the Metronome display controller used on - the E-Ink AM-200 EPD devkit. - config FB_VIRTUAL tristate "Virtual Frame Buffer support (ONLY FOR TESTING!)" depends on FB
drivers/video/Makefile +0 -1
@@ -29,7 +29,6 @@ obj-$(CONFIG_FB_DEFERRED_IO) += fb_defio.o # Hardware specific drivers go first obj-$(CONFIG_FB_AMIGA) += amifb.o c2p.o -obj-$(CONFIG_FB_AM200EPD) += am200epd.o obj-$(CONFIG_FB_ARC) += arcfb.o obj-$(CONFIG_FB_CLPS711X) += clps711xfb.o obj-$(CONFIG_FB_CYBER2000) += cyber2000fb.o
drivers/video/am200epd.c deleted +0 -295
295 lines not on this page · raw message
Signature · 7 lines
1.5.3.6 ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
RFC 5/5 mach-pxa: add am200epd support
In reply to Jaya Kumaram200epd implements mach-pxa support for the am200epd carrier board. It interfaces with metronomefb and pxafb in order to support various E-Ink panels.
This patch does:
- export pxa_device_fb to be accessed by am200epd
- redo the metronomefb interface code to interface properly with am200epd
- allow am200epd to handle different panels properly
- cleanup to use dev_dbg instead of printk
- remove mach-pxa like structure from metronomefb
- add board support for am200epd
--- arch/arm/mach-pxa/Kconfig | 17 ++ arch/arm/mach-pxa/Makefile | 1 + arch/arm/mach-pxa/am200epd.c | 347 ++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-pxa/devices.c | 1 + drivers/video/metronomefb.c | 270 ++++++++++++++++++-------------- include/video/metronomefb.h | 21 +-- 6 files changed, 524 insertions(+), 133 deletions(-) create mode 100644 arch/arm/mach-pxa/am200epd.c
arch/arm/mach-pxa/Kconfig +17 -0
@@ -179,6 +179,23 @@ endchoice endif +if MACH_GUMSTIX_F + +choice + prompt "Select base board for Gumstix board" + +config MACH_AM200EPD + tristate "Enable AM200EPD board support" + select FB_METRONOME + select FB_SYS_FILLRECT + select FB_SYS_COPYAREA + select FB_SYS_IMAGEBLIT + select FB_SYS_FOPS + select FB_DEFERRED_IO + +endchoice + +endif if MACH_TRIZEPS4
arch/arm/mach-pxa/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_CPU_PXA320) += pxa320.o # Specific board support obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o +obj-$(CONFIG_MACH_AM200EPD) += am200epd.o obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o obj-$(CONFIG_MACH_LOGICPD_PXA270) += lpd270.o obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o
arch/arm/mach-pxa/am200epd.c new file +347 -0
347 lines not on this page · raw message
arch/arm/mach-pxa/devices.c +1 -0
@@ -127,6 +127,7 @@ struct platform_device pxa_device_fb = { .num_resources = ARRAY_SIZE(pxafb_resources), .resource = pxafb_resources, }; +EXPORT_SYMBOL_GPL (pxa_device_fb);void __init set_pxa_fb_info (struct pxafb_mach_info *info) {
drivers/video/metronomefb.c +151 -119
480 lines not on this page · raw message
include/video/metronomefb.h +7 -14
@@ -12,14 +12,6 @@ #ifndef _LINUX_METRONOMEFB_H_ #define _LINUX_METRONOMEFB_H_ -/* address and control descriptors used by metronome controller */ -struct metromem_desc { - u32 mFDADR0; - u32 mFSADR0; - u32 mFIDR0; - u32 mLDCMD0; -}; - /* command structure used by metronome controller */ struct metromem_cmd { u16 opcode;
@@ -30,7 +22,6 @@ struct metromem_cmd {/* struct used by metronome. board specific stuff comes from *board */ struct metronomefb_par {unsigned char *metromem; -struct metromem_desc *metromem_desc;struct metromem_cmd *metromem_cmd;unsigned char *metromem_wfm;unsigned char *metromem_img;
@@ -38,25 +29,27 @@ struct metronomefb_par {u16 *csum_table;int metromemsize;dma_addr_t metromem_dma; -dma_addr_t metromem_desc_dma;struct fb_info *info;struct metronome_board *board;wait_queue_head_t waitq;u8 frame_count; +int extra_size; +int dt; };/* board specific routines */ struct metronome_board {struct module *owner; -void (*free_irq)(struct fb_info *); -void (*init_gpio_regs)(struct metronomefb_par *); -void (*init_lcdc_regs)(struct metronomefb_par *); -void (*post_dma_setup)(struct metronomefb_par *); +struct module *fbmaster;void (*set_rst)(struct metronomefb_par *,int );void (*set_stdby)(struct metronomefb_par *,int ); +void (*cleanup)(struct metronomefb_par *);int (*met_wait_event)(struct metronomefb_par *);int (*met_wait_event_intr)(struct metronomefb_par *);int (*setup_irq)(struct fb_info *); +int (*setup_fb)(struct metronomefb_par *); +int (*setup_io)(struct metronomefb_par *); +int (*get_panel_type)(void ); };#endif
Signature · 7 lines
1.5.3.6 ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Quoted 10 lines · On Sat, 31 May 2008 00:41:50 -0400 Jaya Kumar <[email protected]> wrote:
Hi Eric, arm and fbdev friends,
This is version 2 of this RFC and contains the following updates:
- skip settingg_optionsto__initdatasince it is used both by init and probe functions
- fix ordering of iounmap/release_mem_region
- fix setting ofsmem_len(thanks to Krzysztof for above feedback)
- makeuser_wfm_sizestatic as caught by sparse
Hey, slow down. I have intended to review all your patches, but I have not had enough time yet. Please wait till Monday.
Also, if the am200epd changes are less then say 40% of the original driver I would prefer to see an incremental patch, not replacement of the driver as it is not clear what was changed.
Kind regards,
Krzysztof
----------------------------------------------------------------------
Mucha powraca!
Sprawdz >>> http://link.interia.pl/f1e0d
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Re: [RFC 2.6.26-rc3 1/5] pxafb: module unloading support
In reply to Jaya KumarQuoted 6 lines · On Sat, 31 May 2008 00:41:51 -0400 Jaya Kumar <[email protected]> wrote:
This patch to pxafb adds:
- exit and remove handlers
- changes to use __devinit/exit for probe functions and __init/exit for init/exit functions
- removes initdata fromg_optionssince it is accessed both at init and probe
The best solution is to leave it as __devinitdata as it is accessed only by __init and __devinit functions.
Your previous error was to change the functions to __devinit while changing the g_options to __initdata.
Regards,
Krzysztof
----------------------------------------------------------------------
Za co Doda nienawidzi Feel?
Sprawdz >>> http://link.interia.pl/f1e0b
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Quoted 4 lines · Krzysztof Helt
Also, if the am200epd changes are less then say 40% of the original driver I would prefer to see an incremental patch, not replacement of the driver as it is not clear what was changed.
Agreed. If I look at the changes manually:
$ wc -l /home/jaya/kernelwork/mainline/linux-2.6/drivers/video/am200epd.c 295 /home/jaya/kernelwork/mainline/linux-2.6/drivers/video/am200epd.c
$ diff -Naur /home/jaya/kernelwork/mainline/linux-2.6/drivers/video/am200epd.c arch/arm/mach-pxa/am200epd.c | diffstat am200epd.c | 346 +++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 199 insertions(+), 147 deletions(-)
It feels like a full replacement. I couldn't figure out how to do an incremental patch because the original version is drivers/video/am200epd.c which uses raw LCDC register writes (which is no longer compatible because of the regs changes from pxafb) whereas the new version is arch/arm/mach-pxa/am200epd.c which hooks into pxafb and does not touch LCDC registers.
Thanks,
jaya
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Re: [RFC 2.6.26-rc3 1/5] pxafb: module unloading support
In reply to Krzysztof HeltQuoted 6 lines · Krzysztof Helt
The best solution is to leave it as
__devinitdataas it is accessed only by__initand__devinitfunctions.
Your previous error was to change the functions to__devinitwhile changing theg_optionsto__initdata.
Ok, understood, I'll leave it as __devinitdata.
While we are on this subject of fbdev options parsing, I think we should just use the standard module.option = value parameters rather than doing parsing. Is there consensus in fbdev that we should deprecate the options parsing stuff? If so, should we start warning users that the option parsing code will go away? Something like:
int fb_get_options(char *name, char **option)
{
char *opt, *options = NULL;
int opt_len, retval = 0;
int name_len = strlen(name), i;
pr_warning("Please use module.option = value. Thevideo=module:options mechanism will be removed in June 2009");
...
Thanks,
jaya
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Re: [Linux-fbdev-devel] [RFC 2.6.26-rc3 5/5] mach-pxa: add am200epd support
In reply to Jaya KumarQuoted 11 lines · On Sat, 31 May 2008 00:41:55 -0400 Jaya Kumar <[email protected]> wrote:
am200epd implements mach-pxa support for the am200epd carrier board. It interfaces with metronomefb and pxafb in order to support various E-Ink panels.
This patch does:
- exportpxa_device_fbto be accessed by am200epd
- redo the metronomefb interface code to interface properly with am200epd
- allow am200epd to handle different panels properly
- cleanup to usedev_dbginstead of printk
- remove mach-pxa like structure from metronomefb
- add board support for am200epd
Quoted 2 lines
Signed-off-by Jaya Kumar <[email protected]>---
I have tried to review this patch but failed miserably. It is too long and changes too many things (I mean do completely different type of changes: variable renaming, printk -> dev_err, essential changes and even a new driver found its place).
Please create two patches before redoing this one:
- 1st patch which does non-essential stuff like printk to dev_err changes and variable renaming (e.g. reval to ret).
- 2nd patch which correctly balances all error paths
in the metronomefb as this patch brings more mistakes here
Then probably you should also break this patch into two pieces:
- changes which prepare existing stuff for a new driver but do not break existing things (like export pxa_device_fb)
- the new driver itself (much smaller then)
This is my advice as it is too hard to get some understanding of changes.
I will review your next version of patches,
Krzysztof
PS. Some found issues are pointed below.
Quoted 6 lines
arch/arm/mach-pxa/am200epd.c new file +0
-0@@ -0,0 +1,347 @@
(...)
arch/arm/mach-pxa/am200epd.c line 21
Quoted 2 lines
arch/arm/mach-pxa/am200epd.c new file +2
-0+ +#define DEBUG 1
You have left the debug code enabled. If it is intentional it is ok.
arch/arm/mach-pxa/am200epd.c
Quoted 2 lines
arch/arm/mach-pxa/am200epd.c new file +2
-0+static int am200_init_gpio_regs (struct metronomefb_par *par) +{
Many functions have metronomefb_par parameter, but do not use it. You can remove the parameter for now.
drivers/video/metronomefb.c line 22
Quoted 10 lines
drivers/video/metronomefb.c +2
-0@@ -18,6 +18,8 @@* is provided as am200epd.c * */ +#define DEBUG 1 +
Again, the debug code is enabled.
Quoted 2 lines
drivers/video/metronomefb.c +0
-0@@ -569,13 +579,16 @@ static int __devinit metronomefb_probe(struct platform_device *dev) {
(...)
drivers/video/metronomefb.c static int __devinit metronomefb_probe(struct platform_device *dev) · line 632
Quoted 6 lines
drivers/video/metronomefb.c +3
-0+ fw = epd_frame_table[epd_dt_index].fw; + fh = epd_frame_table[epd_dt_index].fh; + videomemorysize = fw * fh; videomemory =vmalloc (videomemorysize);if (!videomemory)return -ENOMEM ;
I suppose the put_module should be done before return (see the whole function code).
In order to reduce number of goto labels you can do something like this (for allocated pointers):
err_exit:
if (pointer)
free(pointer)
do_something_more
instead
err_exit1:
free(pointer)err_exit2:
do_something_more
drivers/video/metronomefb.c static int __devexit metronomefb_remove(struct platform_device *dev) · line 769
Quoted 10 lines
static int
__devexitmetronomefb_remove(struct platform_device *dev)drivers/video/metronomefb.c +0
-2@@ -734,14 +764,13 @@ static int __devexit metronomefb_remove(struct platform_device *dev)if (info) {struct metronomefb_par *par = info->par;fb_deferred_io_cleanup (info); -dma_free_writecombine (&dev->dev, par->metromemsize, - par->metromem, par->metromem_dma);fb_dealloc_cmap (&info->cmap);vfree (par->csum_table);unregister_framebuffer (info);
I am not sure but to release the color map before unregistering the framebuffer is probably a mistake.
----------------------------------------------------------------------
Tanie rozmowy!
Sprawdz >>> http://link.interia.pl/f1e13
-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel FAQ: http://www.arm.linux.org.uk/mailinglists/faq.php Etiquette: http://www.arm.linux.org.uk/mailinglists/etiquette.php
Re: [RFC 2.6.26-rc3 5/5] mach-pxa: add am200epd support
Quoted 5 lines · Krzysztof Helt
Then probably you should also break this patch into two pieces:
- changes which prepare existing stuff for a new driver but do not break existing things (like exportpxa_device_fb)
- the new driver itself (much smaller then)
Ok. I will try to do that.
Quoted 4 lines
arch/arm/mach-pxa/am200epd.c line 21
Quoted 2 lines
arch/arm/mach-pxa/am200epd.c new file +2
-0+ +#define DEBUG 1You have left the debug code enabled. If it is intentional it is ok.
Yes, I wanted to keep it there for a few releases to help debug when any problems arise.
Quoted 6 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+static int am200_init_gpio_regs(struct metronomefb_par *par) +{Many functions have
metronomefb_parparameter, but do not use it. You can remove the parameter for now.
If it's okay, I'd like to keep it because there are some features supported in the E-Ink controllers that I haven't implemented yet. Passing par around is intended to make that possible in future.
Thanks,
jaya
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Re: [RFC 2.6.26-rc3 5/5] mach-pxa: add am200epd support
In reply to Krzysztof HeltQuoted 11 lines · Krzysztof Helt
Quoted 2 lines
(quoted diff) +0
-0@@ -569,13 +579,16 @@ static int __devinit metronomefb_probe(struct platform_device *dev) {(...)
drivers/video/metronomefb.c static int __devinit metronomefb_probe(struct platform_device *dev) · line 632
Quoted 6 lines
drivers/video/metronomefb.c +3
-0+ fw = epd_frame_table[epd_dt_index].fw; + fh = epd_frame_table[epd_dt_index].fh; + videomemorysize = fw * fh; videomemory =vmalloc (videomemorysize);if (!videomemory)return -ENOMEM ;
Quoted 2 lines
I suppose the
put_moduleshould be done before return (see the whole function code).
Ah, yes. Ok, will correct that.
Quoted 8 lines
In order to reduce number of goto labels you can do something like this (for allocated pointers):
err_exit:
if (pointer)
free(pointer)
do_something_more
Quoted 6 lines
instead
err_exit1:
free(pointer)err_exit2:
do_something_more
Ok. I'll take a look at doing it that way.
Quoted 14 lines
drivers/video/metronomefb.c static int __devexit metronomefb_remove(struct platform_device *dev) · line 769
Quoted 11 lines
static int
__devexitmetronomefb_remove(struct platform_device *dev)drivers/video/metronomefb.c +0
-2@@ -734,14 +764,13 @@ static int __devexit metronomefb_remove(struct platform_device *dev)if (info) {struct metronomefb_par *par = info->par;fb_deferred_io_cleanup (info); -dma_free_writecombine (&dev->dev, par->metromemsize, - par->metromem, par->metromem_dma);fb_dealloc_cmap (&info->cmap);vfree (par->csum_table);unregister_framebuffer (info);I am not sure but to release the color map before unregistering the framebuffer is probably a mistake.
Agreed. I'll correct that.
Thanks,
jaya
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/