From: David Basden <davidb-git@rcpt.to>
To: poma <pomidorabelisima@gmail.com>
Cc: davidb-git@rcpt.to, Thomas Mair <thomas.mair86@googlemail.com>,
Hans-Frieder Vogt <hfvogt@gmx.net>,
Antti Palosaari <crope@iki.fi>,
mchehab@redhat.com, linux-media@vger.kernel.org
Subject: Re: rtl28xxu - rtl2832 frontend attach
Date: Mon, 30 Jul 2012 22:56:47 +1000 [thread overview]
Message-ID: <20120730125647.GJ9047@faith.oztechninja.com> (raw)
In-Reply-To: <5016328E.3040909@gmail.com>
> >>> Right now I really don't know where I should look for the solution of
> >>> the problem. It seems that the tuner reset does not have any effect on the
> >>> tuner whatsoever.
Can I suggest setting GPIO5 to 1, leave it there, and see if it breaks. If it
doesn't, GPIO5 on the RTL isn't setup correctly somehow.
At the same time, I was rereading code from:
http://git.linuxtv.org/anttip/media_tree.git/blob/3efd26330fda97e06279cbca170ae4a0dee53220:/drivers/media/dvb/dvb-usb/rtl28xxu.c#l898
and at no point is GPIO5 actually set to an output or enabled that I can find.
rtl2832u_frontend_attach skips doing so. (Actually, I seem to remember running
into this problem while trying to use some DVB driver code as an example of
how to setup the RTL to talk to the FC0012)
Try giving the patch below a go. Sorry, I don't have a build environment to
hand, so there might be a typo I haven't picked up, but the upshot is that
I'm moving the FC0012 detection to the end, setting up GPIO5, resetting the
tuner and then trying to probe for the FC0012.
Please let me know if this helps :)
David
--- a/rtl28xxu.c 2012-07-30 22:31:53.789638678 +1000
+++ b/rtl28xxu.c 2012-07-30 22:48:35.774607232 +1000
@@ -550,15 +550,6 @@
priv->tuner = TUNER_NONE;
- /* check FC0012 ID register; reg=00 val=a1 */
- ret = rtl28xxu_ctrl_msg(adap->dev, &req_fc0012);
- if (ret == 0 && buf[0] == 0xa1) {
- priv->tuner = TUNER_RTL2832_FC0012;
- rtl2832_config = &rtl28xxu_rtl2832_fc0012_config;
- info("%s: FC0012 tuner found", __func__);
- goto found;
- }
-
/* check FC0013 ID register; reg=00 val=a3 */
ret = rtl28xxu_ctrl_msg(adap->dev, &req_fc0013);
if (ret == 0 && buf[0] == 0xa3) {
@@ -640,6 +631,71 @@
goto unsupported;
}
+ /* If it's a FC0012, we need to bring GPIO5/RESET
+ out of floating or it's not going to show up.
+ We set GPIO5 to an output, enable the output, then
+ reset the tuner by bringing GPIO5 high then low again.
+
+ We're testing this last so that we don't accidentally
+ mess with other hardware that wouldn't like us messing
+ with whatever is connected to the rtl2832's GPIO5
+ */
+
+ /* close demod I2C gate */
+ ret = rtl28xxu_ctrl_msg(adap->dev, &req_gate_close);
+ if (ret)
+ goto err;
+
+ /* Set GPIO5 to be an output */
+ ret = rtl28xx_rd_reg(adap->dev, SYS_GPIO_DIR, &val);
+ if (ret)
+ goto err;
+
+ val &= 0xdf;
+ ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_DIR, val);
+ if (ret)
+ goto err;
+
+ /* enable as output GPIO5 */
+ ret = rtl28xx_rd_reg(adap->dev, SYS_GPIO_OUT_EN, &val);
+ if (ret)
+ goto err;
+
+ val |= 0x20;
+ ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_OUT_EN, val);
+ if (ret)
+ goto err;
+
+ /* set GPIO5 high to reset fc0012 (if it exists) */
+ ret = rtl28xx_rd_reg(adap->dev, SYS_GPIO_OUT_VAL, &val);
+ if (ret)
+ goto err;
+
+ val |= 0x20;
+ ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_OUT_VAL, val);
+ if (ret)
+ goto err;
+
+ /* bring GPIO5 low again after reset */
+ val &= 0xdf;
+ ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_OUT_VAL, val);
+ if (ret)
+ goto err;
+
+ /* re-open demod I2C gate */
+ ret = rtl28xxu_ctrl_msg(adap->dev, &req_gate_open);
+ if (ret)
+ goto err;
+
+ /* check FC0012 ID register; reg=00 val=a1 */
+ ret = rtl28xxu_ctrl_msg(adap->dev, &req_fc0012);
+ if (ret == 0 && buf[0] == 0xa1) {
+ priv->tuner = TUNER_RTL2832_FC0012;
+ rtl2832_config = &rtl28xxu_rtl2832_fc0012_config;
+ info("%s: FC0012 tuner found", __func__);
+ goto found;
+ }
+
unsupported:
/* close demod I2C gate */
ret = rtl28xxu_ctrl_msg(adap->dev, &req_gate_close);
next prev parent reply other threads:[~2012-07-30 12:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-20 17:04 rtl28xxu - rtl2832 frontend attach poma
2012-05-20 20:08 ` Antti Palosaari
2012-05-20 21:12 ` Thomas Mair
2012-05-26 2:47 ` poma
2012-05-28 6:58 ` Thomas Mair
2012-05-28 14:48 ` Thomas Mair
2012-06-26 17:17 ` poma
2012-06-27 5:21 ` Thomas Mair
2012-06-27 12:22 ` poma
2012-07-30 7:06 ` poma
2012-07-30 10:17 ` David Basden
2012-07-30 15:58 ` poma
2012-07-30 12:56 ` David Basden [this message]
2012-07-30 17:07 ` poma
2012-07-31 11:42 ` poma
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=20120730125647.GJ9047@faith.oztechninja.com \
--to=davidb-git@rcpt.to \
--cc=crope@iki.fi \
--cc=hfvogt@gmx.net \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@redhat.com \
--cc=pomidorabelisima@gmail.com \
--cc=thomas.mair86@googlemail.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 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.