On 07/30/2012 07:07 PM, poma wrote: > On 07/30/2012 02:56 PM, David Basden wrote: >>>>>> 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); >> > > …sorry for the delay, > After applied patch no luck - in attach is dmesg for working original > Realtek driver(dvb_usb_rtl2832), and second one(dvb-usb-rtl28xxu) > rtl2832 part by Thomas with tuner issue, still not working. > Most intriguing is tuner get stucked by tuning(t-zapping)! > …after warm/unload/load/reboot of course ;) This is full set of logs. Tuner(fc0012) has no debug facility(parm), so nothing from there. modprobe.d/.conf: options dvb_core frontend_debug=1 debug=1 dvbdev_debug=1 options dvb_usb debug=511 options dvb_usb_rtl28xxu debug=1 options rtl2832 debug=1 Cheers, poma