From: Jiri Slaby <jirislaby@gmail.com>
To: York Sun <yorksun@freescale.com>
Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] Driver for Freescale 8610 and 5121 DIU
Date: Wed, 12 Mar 2008 23:20:28 +0100 [thread overview]
Message-ID: <47D8572C.8090501@gmail.com> (raw)
In-Reply-To: <12053582231281-git-send-email-yorksun@freescale.com>
On 03/12/2008 10:43 PM, York Sun wrote:
> +static int fsl_diu_open(struct fb_info *info, int user)
> +{
> + struct mfb_info *mfbi = info->par;
> + int res = 0;
> +
> + spin_lock(&diu_lock);
> + mfbi->count++;
> + if (mfbi->count == 1) {
> + DPRINTK("open plane index %d\n", mfbi->index);
> + fsl_diu_check_var(&info->var, info);
> + fsl_diu_set_par(info);
Please retest your code (at least) with sleep-inside spinlock debug option. If I
see correctly you call GFP_KERNEL allocation somewhere deeper in this function,
which might sleep.
> + res = fsl_diu_enable_panel(info);
> + if (res < 0)
> + mfbi->count--;
> + }
> +
> + spin_unlock(&diu_lock);
> + return res;
> +}
> +static void __exit uninstall_fb(struct fb_info *info)
> +{
> + struct mfb_info *mfbi = info->par;
> +
> + DPRINTK("Entered: uninstall_fb\n");
You don't need this stuff everywhere (kprobes).
> + if (!mfbi->registered)
> + return;
> +
> + unregister_framebuffer(info);
> + unmap_video_memory(info);
> + if (&info->cmap)
> + fb_dealloc_cmap(&info->cmap);
> +
> + mfbi->registered = 0;
> +}
[...]
> +static int fsl_diu_probe(struct platform_device *pdev)
> +{
> + struct mfb_info *mfbi;
> + unsigned long dummy_ad_addr;
> + int ret, i, error = 0;
> +
> + DPRINTK("Entered: fsl_diu_probe\n");
> +
> + /* Area descriptor memory pool aligns to 64-bit boundary */
> + allocate_buf(&pool.ad, sizeof(struct diu_ad) * FSL_AOI_NUM, 8);
> +
> + /* Get memory for Gamma Table - 32-byte aligned memory */
> + allocate_buf(&pool.gamma, 768, 32);
> +
> + /* For performance, cursor bitmap buffer aligns to 32-byte boundary */
> + allocate_buf(&pool.cursor, MAX_CURS * MAX_CURS * 2, 32);
> +
> + i = sizeof(fsl_diu_info) / sizeof(struct fb_info);
> + dummy_ad = (struct diu_ad *)((u32)pool.ad.vaddr + pool.ad.offset) + i;
> + dummy_ad->paddr = pool.ad.paddr + i * sizeof(struct diu_ad);
> + dummy_aoi_virt = fsl_diu_alloc(64, &dummy_ad_addr);
> + dummy_ad->addr = cpu_to_le32(dummy_ad_addr);
> + dummy_ad->pix_fmt = 0x88882317;
> + dummy_ad->src_size_g_alpha = cpu_to_le32((4 << 12) | 4);
> + dummy_ad->aoi_size = cpu_to_le32((4 << 16) | 2);
> + dummy_ad->offset_xyi = 0;
> + dummy_ad->offset_xyd = 0;
> + dummy_ad->next_ad = 0;
> + memset(dummy_aoi_virt, 0x00, 64);
> + write_reg(&(dr.diu_reg->desc[0]), dummy_ad->paddr);
> + write_reg(&(dr.diu_reg->desc[1]), dummy_ad->paddr);
> + write_reg(&(dr.diu_reg->desc[2]), dummy_ad->paddr);
> +
> + for (i = 0; i < sizeof(fsl_diu_info) / sizeof(struct fb_info); i++) {
> + fsl_diu_info[i].fix.smem_start = 0;
> + mfbi = fsl_diu_info[i].par;
> + mfbi->ad = (struct diu_ad *)((u32)pool.ad.vaddr
> + + pool.ad.offset) + i;
> + mfbi->ad->paddr = pool.ad.paddr + i * sizeof(struct diu_ad);
> + ret = install_fb(&fsl_diu_info[i], pdev);
> + if (ret) {
> + printk(KERN_ERR "Failed to register framebuffer %d\n",
> + i);
> + return ret;
some kind of free here
> + }
> + }
[...]
> +int __init fsl_diu_init(void)
> +{
> + struct device_node *np;
> + struct resource r;
> + int error;
> + DPRINTK("Entered: fsl_diu_init\n");
> + np = of_find_compatible_node(NULL, NULL, "fsl-diu");
> + if (!np) {
> + printk(KERN_ERR "Err: can't find device node 'fsl-diu'\n");
> + return -ENODEV;
> + }
> +
> + of_address_to_resource(np, 0, &r);
> + of_node_put(np);
> +
> + DPRINTK("%s, r.start: 0x%08x\n", __func__, r.start);
> +
> + dr.diu_reg = ioremap(r.start, sizeof(struct diu));
The arch never fails with remapping?
> +
> + write_reg(&(dr.diu_reg->diu_mode), 0); /* disable DIU anyway*/
> +
> + spin_lock_init(&dr.reg_lock);
> +
> +
> + /*
> + * For kernel boot options (in 'video=xxxfb:<options>' format)
> + */
> +#ifndef MODULE
> + {
> + char *option;
> +
> + if (fb_get_options("fslfb", &option))
> + return -ENODEV;
> + fsl_diu_setup(option);
> + }
> +#endif
> + error = platform_driver_register(&fsl_diu_driver);
> +
> + if (!error) {
> + error = platform_device_register(&fsl_diu_device);
> + if (error) {
> + printk(KERN_ERR "Err: "
> + "can't register FB device driver!\n");
> + platform_driver_unregister(&fsl_diu_driver);
iounmap
> + }
> + printk(KERN_INFO "FSL_DIU_FB: registed FB device driver!\n");
> + }
else iounmap
> +
> + return error;
> +}
[...]
> diff --git a/drivers/video/fsl-diu-fb.h b/drivers/video/fsl-diu-fb.h
> new file mode 100644
> index 0000000..294d0bf
> --- /dev/null
> +++ b/drivers/video/fsl-diu-fb.h
> @@ -0,0 +1,388 @@
[...]
> +#ifndef __FSL_DIU_FB_H__
> +#define __FSL_DIU_FB_H__
> +
> +/* FIXME: This should be changed to dev_dbg this will be done as soon as
> + * we can obtain dev through the dts setup
then use at least pr_debug() here:
> + */
> +#ifdef DEBUG
> +#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__, ## args)
> +#else
> +#define DPRINTK(fmt, args...)
> +#endif
regards,
--
Jiri Slaby
Faculty of Informatics, Masaryk University
Suse Labs
next prev parent reply other threads:[~2008-03-12 22:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-12 21:43 Driver for Freescale Display Interface Unit (A LCD controller) York Sun
2008-03-12 21:43 ` [PATCH 1/2] Driver for Freescale 8610 and 5121 DIU York Sun
2008-03-12 21:43 ` [PATCH 2/2] Add DIU platform code for MPC8610HPCD York Sun
2008-04-14 14:18 ` Arnd Bergmann
2008-03-12 22:20 ` Jiri Slaby [this message]
2008-04-11 21:45 ` [PATCH 1/2] Driver for Freescale 8610 and 5121 DIU Jiri Slaby
2008-04-12 5:18 ` Andrew Morton
2008-04-14 13:39 ` Timur Tabi
2008-04-14 13:43 ` Jiri Slaby
2008-04-14 13:45 ` Timur Tabi
2008-04-14 13:54 ` Jiri Slaby
2008-04-14 14:12 ` Timur Tabi
2008-04-14 14:24 ` Jiri Slaby
2008-04-14 14:49 ` Timur Tabi
2008-04-14 15:43 ` Jiri Slaby
2008-04-14 15:46 ` Timur Tabi
2008-04-14 19:03 ` Andrew Morton
2008-03-13 0:10 ` Stephen Rothwell
2008-03-13 10:17 ` Driver for Freescale Display Interface Unit (A LCD controller) Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47D8572C.8090501@gmail.com \
--to=jirislaby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=yorksun@freescale.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).