From: Paul Mundt <lethal@linux-sh.org>
To: Bryan Wu <cooloney@kernel.org>
Cc: Michael Hennerich <michael.hennerich@analog.com>,
Harald Krapfenbauer <harald.krapfenbauer@bluetechnix.at>,
linux-fbdev-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, adaplas@gmail.com
Subject: Re: [PATCH 1/1] [Video/Framebuffer]: Hitachi TX09D70VM1CDA TFT LCD framebuffer driver
Date: Mon, 12 May 2008 20:18:05 +0900 [thread overview]
Message-ID: <20080512111805.GA11299@linux-sh.org> (raw)
In-Reply-To: <1210589347-12840-1-git-send-email-cooloney@kernel.org>
On Mon, May 12, 2008 at 06:49:07PM +0800, Bryan Wu wrote:
> +config FB_HITACHI_TX09_REFRESHRATE
> + int "Refresh rate"
> + depends on FB_HITACHI_TX09
> + range 25 70
> + default 52
> + help
> + Refresh rate of the LCD in Hz. According to data sheet, must
> + be in the interval [52...68].
> +
25..70 != 52..68, pick one and stick with it. If there's a reason for the
discrepency, then document that, too. ie, "data sheet has no relation to
hardware".
> +static void stop_timers(void)
> +{
> + unsigned long flags;
> + long old_value = 0, new_value = 0;
> +
> + local_irq_save(flags);
> +
[snip]
> + while (1) {
> + old_value = new_value;
> + new_value = BFIN_READ(TIMER_VSYNC, COUNTER) ();
> + if ((old_value - new_value) > 45000) {
The only way to break out of here is dependent on the timer. You have no
timeout in the case of the timer getting stuck.
> +static int tx09_fb_open(struct fb_info *info, int user)
> +{
> + unsigned long flags;
> +
> + pr_debug("%s\n", __FUNCTION__);
> +
> + spin_lock_irqsave(&tx09_lock, flags);
> + tx09_open_cnt++; /* increase counter */
> + spin_unlock_irqrestore(&tx09_lock, flags);
> +
> + if (tx09_open_cnt <= 1) { /* opened the first time */
> +
> + /* stop PPI */
> + WRITE_PPI_CONTROL(0);
> + SSYNC();
> +
> + /* configure dma stuff */
> + config_dma();
> +
> + config_ppi();
> +
> + /* start dma */
> + enable_dma(CH_PPI);
> + SSYNC();
> +
> + /* start PPI */
> + WRITE_PPI_CONTROL(READ_PPI_CONTROL() | PORT_EN);
> + SSYNC();
> +
> + if (!t_conf_done)
> + config_timers();
> +
> + start_timers();
> + }
> +
Presumably this should be done in the probe path, rather than lazily.
Though you don't bother doing any error checking, so I suppose it doesn't
really matter.
> +static int tx09_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
> +{
> + unsigned long flags;
> +
> + pr_debug("%s\n", __FUNCTION__);
> +
> + if (tx09_mmap)
> + return -1; /* already mmap'ed */
> +
> + spin_lock_irqsave(&tx09_lock, flags);
> + tx09_mmap = 1;
> + spin_unlock_irqrestore(&tx09_lock, flags);
> +
> + vma->vm_start = (unsigned long)fb_buffer;
> + vma->vm_end = vma->vm_start + 320 * 240 * 2;
> + vma->vm_flags |= VM_MAYSHARE | VM_SHARED;
> +
> + return 0;
> +}
> +
This is equally bizarre. If you can never support more than one opener of
this device, then have your open() reflect that, rather than trying to do
these lame hacks in every file op.
Beyond that, the size of the VMA is reflected in info->fix.mmio_len,
which the generic fb_mmap() takes care of for you. Other than the
questionable VMA flags, it's not obvious why you rolled your own mmap.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
prev parent reply other threads:[~2008-05-12 11:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-12 10:49 [PATCH 1/1] [Video/Framebuffer]: Hitachi TX09D70VM1CDA TFT LCD framebuffer driver Bryan Wu
2008-05-12 11:18 ` Paul Mundt [this message]
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=20080512111805.GA11299@linux-sh.org \
--to=lethal@linux-sh.org \
--cc=adaplas@gmail.com \
--cc=cooloney@kernel.org \
--cc=harald.krapfenbauer@bluetechnix.at \
--cc=linux-fbdev-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.hennerich@analog.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).