From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Marcel Hasler <mahasler@gmail.com>
Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org
Subject: Re: [PATCH v3 4/4] stk1160: Give the chip some time to retrieve data from AC97 codec.
Date: Fri, 2 Dec 2016 09:09:48 -0200 [thread overview]
Message-ID: <20161202090948.0efd0678@vento.lan> (raw)
In-Reply-To: <20161127111236.GA1691@arch-desktop>
Em Sun, 27 Nov 2016 12:12:36 +0100
Marcel Hasler <mahasler@gmail.com> escreveu:
> The STK1160 needs some time to transfer data from the AC97 registers into its own. On some
> systems reading the chip's own registers to soon will return wrong values. The "proper" way to
> handle this would be to poll STK1160_AC97CTL_0 after every read or write command until the
> command bit has been cleared, but this may not be worth the hassle.
>
> Signed-off-by: Marcel Hasler <mahasler@gmail.com>
> ---
> drivers/media/usb/stk1160/stk1160-ac97.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/media/usb/stk1160/stk1160-ac97.c b/drivers/media/usb/stk1160/stk1160-ac97.c
> index 60327af..b39f51b 100644
> --- a/drivers/media/usb/stk1160/stk1160-ac97.c
> +++ b/drivers/media/usb/stk1160/stk1160-ac97.c
> @@ -23,6 +23,7 @@
> *
> */
>
> +#include <linux/delay.h>
> #include <linux/module.h>
>
> #include "stk1160.h"
> @@ -64,6 +65,14 @@ static u16 stk1160_read_ac97(struct stk1160 *dev, u16 reg)
> */
> stk1160_write_reg(dev, STK1160_AC97CTL_0, 0x8b);
>
> + /*
> + * Give the chip some time to transfer the data.
> + * The proper way would be to poll STK1160_AC97CTL_0
> + * until the command bit has been cleared, but this
> + * may not be worth the hassle.
Why not? Relying on a fixed amount time is not nice.
Take a look at em28xx_is_ac97_ready() function, at
drivers/media/usb/em28xx/em28xx-core.c to see how this could be
implemented instead.
> + */
> + usleep_range(20, 40);
> +
> /* Retrieve register value */
> stk1160_read_reg(dev, STK1160_AC97_CMD, &vall);
> stk1160_read_reg(dev, STK1160_AC97_CMD + 1, &valh);
Thanks,
Mauro
next prev parent reply other threads:[~2016-12-02 11:09 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-27 11:07 [PATCH v3 0/4] stk1160: Let the driver setup the device's internal AC97 codec Marcel Hasler
2016-11-27 11:09 ` [PATCH v3 1/4] stk1160: Remove stk1160-mixer and setup internal AC97 codec automatically Marcel Hasler
2016-11-27 11:11 ` [PATCH v3 2/4] stk1160: Check whether to use AC97 codec Marcel Hasler
2016-11-27 11:11 ` [PATCH v3 3/4] stk1160: Add module param for setting the record gain Marcel Hasler
2016-12-02 11:05 ` Mauro Carvalho Chehab
2016-12-03 20:46 ` Ezequiel Garcia
2016-12-04 13:01 ` Marcel Hasler
2016-12-04 18:25 ` Ezequiel Garcia
2016-12-05 12:12 ` Mauro Carvalho Chehab
2016-12-05 15:38 ` Ezequiel Garcia
2016-12-05 21:06 ` Marcel Hasler
2016-12-05 21:18 ` Marcel Hasler
2016-12-05 22:35 ` Ezequiel Garcia
2016-12-05 22:34 ` Ezequiel Garcia
2016-12-06 12:56 ` Mauro Carvalho Chehab
2016-12-11 12:07 ` Marcel Hasler
2016-12-11 12:20 ` mahasler
2016-12-12 11:21 ` Mauro Carvalho Chehab
2016-12-12 11:28 ` Marcel Hasler
2016-11-27 11:12 ` [PATCH v3 4/4] stk1160: Give the chip some time to retrieve data from AC97 codec Marcel Hasler
2016-12-02 11:09 ` Mauro Carvalho Chehab [this message]
2016-12-03 20:41 ` Ezequiel Garcia
2016-12-01 19:49 ` [PATCH v3 0/4] stk1160: Let the driver setup the device's internal " Ezequiel Garcia
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=20161202090948.0efd0678@vento.lan \
--to=mchehab@s-opensource.com \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=linux-media@vger.kernel.org \
--cc=mahasler@gmail.com \
--cc=mchehab@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.