mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: roger blofeld <blofeldus@yahoo.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] serial: 2.6.9rc1 pick nearest baud rate divider
Date: Tue, 21 Sep 2004 08:34:15 -0700 (PDT)	[thread overview]
Message-ID: <20040921153415.73737.qmail@web53505.mail.yahoo.com> (raw)

This patch modifies uart_get_divisor to select the nearest baud rate
divider rather than the lowest. It minimizes baud rate errors.

For example, if uartclk is 33000000 and baud is 115200 the ratio is
about 17.9
The current code selects 17 (5% error) but should select 18 (0.5%
error)

-roger

===== drivers/serial/serial_core.c 1.87 vs edited =====
--- 1.87/drivers/serial/serial_core.c   2004-06-29 09:43:58 -05:00
+++ edited/drivers/serial/serial_core.c 2004-09-15 14:04:34 -05:00
@@ -403,7 +403,7 @@
        if (baud == 38400 && (port->flags & UPF_SPD_MASK) ==
UPF_SPD_CUST)
                quot = port->custom_divisor;
        else
-               quot = port->uartclk / (16 * baud);
+               quot = (port->uartclk + (8 * baud)) / (16 * baud);
 
        return quot;
 }


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

                 reply	other threads:[~2004-09-21 15:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20040921153415.73737.qmail@web53505.mail.yahoo.com \
    --to=blofeldus@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®