From: Andreas Mohr <andi@lisas.de>
To: Takashi Iwai <tiwai@suse.de>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Andreas Mohr <andi@lisas.de>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Vojtech Pavlik <vojtech@suse.cz>, Jiri Kosina <jkosina@suse.cz>
Subject: Re: [PATCH 1/2] SOUND: kill gameport bits
Date: Sun, 24 Aug 2014 07:07:16 +0200 [thread overview]
Message-ID: <20140824050716.GA523@rhlx01.hs-esslingen.de> (raw)
In-Reply-To: <s5h4mx6rshs.wl-tiwai@suse.de>
On Thu, Aug 21, 2014 at 01:29:03PM +0200, Takashi Iwai wrote:
> I did a quick hack and it seems working on my box.
> The patch is below.
Thanks!!
Further comments below.
I will be testing this ASAP.
> +static bool use_ktime = true;
> +module_param(use_ktime, bool, 0400);
Towards final commit, should probably add param docs on what may be switched here and why.
> +
> /*
> * gameport_mutex protects entire gameport subsystem and is taken
> * every time gameport port or driver registrered or unregistered.
> @@ -76,6 +80,36 @@ static unsigned int get_time_pit(void)
>
> static int gameport_measure_speed(struct gameport *gameport)
> {
> + unsigned int i, t, tx;
> + u64 t1, t2;
> + unsigned long flags;
> +
> + if (gameport_open(gameport, NULL, GAMEPORT_MODE_RAW))
> + return 0;
> +
> + tx = ~0;
> +
> + for (i = 0; i < 50; i++) {
> + local_irq_save(flags);
> + t1 = ktime_get_ns();
> + for (t = 0; t < 50; t++)
> + gameport_read(gameport);
> + t2 = ktime_get_ns();
> + local_irq_restore(flags);
> + udelay(i * 10);
> + if (t2 - t1 < tx)
> + tx = t2 - t1;
This impl is not doing the more complex t3, t2, t1 calculation
that the PIT impl is doing (likely for the uncommented purpose
of eliminating timer I/O delay from timing consideration).
Do/don't ktime/TSC impls better need such an I/O timing correction,
or are they so fast relative to gameport I/O delays
that it does not matter? (probably the case for TSC at least).
Oh, and any reason that such a speed calculation remains painfully duplicated
in both source files? That's possibly done for layering reasons,
but I'd have to analyze it further.
> +static inline u64 get_time(void)
> +{
> + if (use_ktime) {
> + return ktime_get_ns();
> + } else {
> + unsigned int x;
> + GET_TIME(x);
> + return x;
> + }
> +}
It might be useful to have a first commit to introduce these helpers,
and a second commit to then add ktime support (to keep review code size
down).
Thanks,
Andreas Mohr
--
GNU/Linux. It's not the software that's free, it's you.
next prev parent reply other threads:[~2014-08-24 5:07 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-20 2:46 [PATCH 1/2] SOUND: kill gameport bits Andreas Mohr
2014-08-20 5:18 ` Dmitry Torokhov
2014-08-20 5:50 ` Andreas Mohr
2014-08-20 6:09 ` Takashi Iwai
2014-08-20 6:31 ` Dmitry Torokhov
2014-08-20 7:05 ` Takashi Iwai
2014-08-20 12:15 ` Takashi Iwai
2014-08-20 14:49 ` Dmitry Torokhov
2014-08-21 7:16 ` Geert Uytterhoeven
2014-08-20 12:29 ` One Thousand Gnomes
2014-08-20 12:53 ` Geert Uytterhoeven
2014-08-21 11:29 ` Takashi Iwai
2014-08-24 5:07 ` Andreas Mohr [this message]
2014-08-25 7:13 ` Takashi Iwai
2014-08-28 20:03 ` Clemens Ladisch
2014-08-28 21:11 ` Vojtech Pavlik
2014-08-20 14:27 ` Andreas Mohr
2014-08-20 14:48 ` Dmitry Torokhov
2014-08-20 6:39 ` Vojtech Pavlik
2014-08-20 12:20 ` One Thousand Gnomes
-- strict thread matches above, loose matches on Subject: below --
2014-08-19 16:41 Dmitry Torokhov
2014-08-20 7:33 ` Clemens Ladisch
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=20140824050716.GA523@rhlx01.hs-esslingen.de \
--to=andi@lisas.de \
--cc=dmitry.torokhov@gmail.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tiwai@suse.de \
--cc=vojtech@suse.cz \
/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).