diff mbox

Support for Asus MyCinema U3100Mini Plus (attempt 2)

Message ID 1348006936-6334-1-git-send-email-oliver+list@schinagl.nl (mailing list archive)
State New, archived
Headers show

Commit Message

Olliver Schinagl Sept. 18, 2012, 10:22 p.m. UTC
From: Oliver Schinagl <oliver@schinagl.nl>

This is initial support for the Asus MyCinema U3100Mini Plus. The driver
in its current form gets detected and loads properly. It uses the
af9035 USB Bridge chip, with an af9033 demodulator. The tuner used is
the FCI FC2580.

I have only done a quick dvb scan, but it failed to tune to anything.
Using dvbv5-scan -I CHANNEL <channelfile> It did show 'signal 100%' but
failed to tune to anything, so I don't think signal strength works at
all. Since I have really bad reception where my dev PC is, I may simple
not receive anything here.

Signed-off-by: Oliver Schinagl <oliver@schinagl.nl>
---
 drivers/media/dvb-core/dvb-usb-ids.h      |  1 +
 drivers/media/dvb-frontends/af9033.c      |  4 +++
 drivers/media/dvb-frontends/af9033.h      |  1 +
 drivers/media/dvb-frontends/af9033_priv.h | 38 +++++++++++++++++++++++
 drivers/media/tuners/fc2580.c             |  4 ++-
 drivers/media/tuners/fc2580.h             | 10 +++++++
 drivers/media/usb/dvb-usb-v2/Kconfig      |  1 +
 drivers/media/usb/dvb-usb-v2/af9035.c     | 50 +++++++++++++++++++++++++++++++
 drivers/media/usb/dvb-usb-v2/af9035.h     |  1 +
 9 files changed, 109 insertions(+), 1 deletion(-)

Comments

Antti Palosaari Sept. 18, 2012, 10:42 p.m. UTC | #1
On 09/19/2012 01:22 AM, oliver@schinagl.nl wrote:
> From: Oliver Schinagl <oliver@schinagl.nl>
>
> This is initial support for the Asus MyCinema U3100Mini Plus. The driver
> in its current form gets detected and loads properly. It uses the
> af9035 USB Bridge chip, with an af9033 demodulator. The tuner used is
> the FCI FC2580.
>
> I have only done a quick dvb scan, but it failed to tune to anything.
> Using dvbv5-scan -I CHANNEL <channelfile> It did show 'signal 100%' but
> failed to tune to anything, so I don't think signal strength works at
> all. Since I have really bad reception where my dev PC is, I may simple
> not receive anything here.

Signal strength is very worst indicator. It should not be 100% in any 
case. Switch off stupid % meter your are using and look plain numbers. 
It is should be something between 0-0xffff (0xffff == 100% ?).

For me successful tzap reports (af9035 + tua9001):
status 1f | signal 5eb7 | snr 010e | ber 00000000 | unc 00000000 | 
FE_HAS_LOCK

FE_HAS_LOCK is most important, it says demodulator is locked to channel 
and likely device is 100% working.

Biggest problem of your patch is fc2580 frontend callback. fc2580 driver 
does not use any callback and that code is simple dead. It is never called.

Otherwise it looks quite correct.

regards
Antti


> Signed-off-by: Oliver Schinagl <oliver@schinagl.nl>
> ---
>   drivers/media/dvb-core/dvb-usb-ids.h      |  1 +
>   drivers/media/dvb-frontends/af9033.c      |  4 +++
>   drivers/media/dvb-frontends/af9033.h      |  1 +
>   drivers/media/dvb-frontends/af9033_priv.h | 38 +++++++++++++++++++++++
>   drivers/media/tuners/fc2580.c             |  4 ++-
>   drivers/media/tuners/fc2580.h             | 10 +++++++
>   drivers/media/usb/dvb-usb-v2/Kconfig      |  1 +
>   drivers/media/usb/dvb-usb-v2/af9035.c     | 50 +++++++++++++++++++++++++++++++
>   drivers/media/usb/dvb-usb-v2/af9035.h     |  1 +
>   9 files changed, 109 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h
> index d572307..58e0220 100644
> --- a/drivers/media/dvb-core/dvb-usb-ids.h
> +++ b/drivers/media/dvb-core/dvb-usb-ids.h
> @@ -329,6 +329,7 @@
>   #define USB_PID_ASUS_U3000				0x171f
>   #define USB_PID_ASUS_U3000H				0x1736
>   #define USB_PID_ASUS_U3100				0x173f
> +#define USB_PID_ASUS_U3100MINI_PLUS			0x1779
>   #define USB_PID_YUAN_EC372S				0x1edc
>   #define USB_PID_YUAN_STK7700PH				0x1f08
>   #define USB_PID_YUAN_PD378S				0x2edc
> diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c
> index 0979ada..b40f5a0 100644
> --- a/drivers/media/dvb-frontends/af9033.c
> +++ b/drivers/media/dvb-frontends/af9033.c
> @@ -314,6 +314,10 @@ static int af9033_init(struct dvb_frontend *fe)
>   		len = ARRAY_SIZE(tuner_init_tda18218);
>   		init = tuner_init_tda18218;
>   		break;
> +	case AF9033_TUNER_FC2580:
> +		len = ARRAY_SIZE(tuner_init_fc2580);
> +		init = tuner_init_fc2580;
> +		break;
>   	default:
>   		dev_dbg(&state->i2c->dev, "%s: unsupported tuner ID=%d\n",
>   				__func__, state->cfg.tuner);
> diff --git a/drivers/media/dvb-frontends/af9033.h b/drivers/media/dvb-frontends/af9033.h
> index 288622b..739137e 100644
> --- a/drivers/media/dvb-frontends/af9033.h
> +++ b/drivers/media/dvb-frontends/af9033.h
> @@ -42,6 +42,7 @@ struct af9033_config {
>   #define AF9033_TUNER_FC0011      0x28 /* Fitipower FC0011 */
>   #define AF9033_TUNER_MXL5007T    0xa0 /* MaxLinear MxL5007T */
>   #define AF9033_TUNER_TDA18218    0xa1 /* NXP TDA 18218HN */
> +#define AF9033_TUNER_FC2580      0x32 /* FIC FC2580 */
>   	u8 tuner;
>
>   	/*
> diff --git a/drivers/media/dvb-frontends/af9033_priv.h b/drivers/media/dvb-frontends/af9033_priv.h
> index 0b783b9..d2c9ae6 100644
> --- a/drivers/media/dvb-frontends/af9033_priv.h
> +++ b/drivers/media/dvb-frontends/af9033_priv.h
> @@ -466,5 +466,43 @@ static const struct reg_val tuner_init_tda18218[] = {
>   	{0x80f1e6, 0x00},
>   };
>
> +/* FIC FC2580 tuner init
> +   AF9033_TUNER_FC2580      = 0x32 */
> +static const struct reg_val tuner_init_fc2580[] = {
> +	{ 0x800046, AF9033_TUNER_FC2580 },
> +	{ 0x800057, 0x01 },
> +	{ 0x800058, 0x00 },
> +	{ 0x80005f, 0x00 },
> +	{ 0x800060, 0x00 },
> +	{ 0x800071, 0x05 },
> +	{ 0x800072, 0x02 },
> +	{ 0x800074, 0x01 },
> +	{ 0x800079, 0x01 },
> +	{ 0x800093, 0x00 },
> +	{ 0x800094, 0x00 },
> +	{ 0x800095, 0x00 },
> +	{ 0x800096, 0x05 },
> +	{ 0x8000b3, 0x01 },
> +	{ 0x8000c3, 0x01 },
> +	{ 0x8000c4, 0x00 },
> +	{ 0x80f007, 0x00 },
> +	{ 0x80f00c, 0x19 },
> +	{ 0x80f00d, 0x1A },
> +	{ 0x80f00e, 0x00 },
> +	{ 0x80f00f, 0x02 },
> +	{ 0x80f010, 0x00 },
> +	{ 0x80f011, 0x02 },
> +	{ 0x80f012, 0x00 },
> +	{ 0x80f013, 0x02 },
> +	{ 0x80f014, 0x00 },
> +	{ 0x80f015, 0x02 },
> +	{ 0x80f01f, 0x96 },
> +	{ 0x80f020, 0x00 },
> +	{ 0x80f029, 0x96 },
> +	{ 0x80f02a, 0x00 },
> +	{ 0x80f077, 0x01 },
> +	{ 0x80f1e6, 0x01 },
> +};
> +
>   #endif /* AF9033_PRIV_H */
>
> diff --git a/drivers/media/tuners/fc2580.c b/drivers/media/tuners/fc2580.c
> index afc0491..4e7c802 100644
> --- a/drivers/media/tuners/fc2580.c
> +++ b/drivers/media/tuners/fc2580.c
> @@ -498,8 +498,10 @@ struct dvb_frontend *fc2580_attach(struct dvb_frontend *fe,
>
>   	dev_dbg(&priv->i2c->dev, "%s: chip_id=%02x\n", __func__, chip_id);
>
> -	if (chip_id != 0x56)
> +	if ((chip_id != 0x56) && (chip_id != 0x5a)) {
>   		goto err;
> +	}
> +
>
>   	dev_info(&priv->i2c->dev,
>   			"%s: FCI FC2580 successfully identified\n",
> diff --git a/drivers/media/tuners/fc2580.h b/drivers/media/tuners/fc2580.h
> index 222601e..952513d 100644
> --- a/drivers/media/tuners/fc2580.h
> +++ b/drivers/media/tuners/fc2580.h
> @@ -36,6 +36,16 @@ struct fc2580_config {
>   	u32 clock;
>   };
>
> +/** enum fc2580_fe_callback_commands - Frontend callbacks
> + *
> + * @FC2580_FE_CALLBACK_POWER: Power on tuner hardware.
> + */
> +enum fc2580_fe_callback_commands {
> +	FC2580_FE_CALLBACK_POWER,
> +};
> +
> +
> +
>   #if defined(CONFIG_MEDIA_TUNER_FC2580) || \
>   	(defined(CONFIG_MEDIA_TUNER_FC2580_MODULE) && defined(MODULE))
>   extern struct dvb_frontend *fc2580_attach(struct dvb_frontend *fe,
> diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig b/drivers/media/usb/dvb-usb-v2/Kconfig
> index e09930c..834bfec 100644
> --- a/drivers/media/usb/dvb-usb-v2/Kconfig
> +++ b/drivers/media/usb/dvb-usb-v2/Kconfig
> @@ -40,6 +40,7 @@ config DVB_USB_AF9035
>   	select MEDIA_TUNER_FC0011 if MEDIA_SUBDRV_AUTOSELECT
>   	select MEDIA_TUNER_MXL5007T if MEDIA_SUBDRV_AUTOSELECT
>   	select MEDIA_TUNER_TDA18218 if MEDIA_SUBDRV_AUTOSELECT
> +	select MEDIA_TUNER_FC2580 if MEDIA_SUBDRV_AUTOSELECT
>   	help
>   	  Say Y here to support the Afatech AF9035 based DVB USB receiver.
>
> diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
> index 89cc901..f6ca30e 100644
> --- a/drivers/media/usb/dvb-usb-v2/af9035.c
> +++ b/drivers/media/usb/dvb-usb-v2/af9035.c
> @@ -513,6 +513,7 @@ static int af9035_read_config(struct dvb_usb_device *d)
>   		case AF9033_TUNER_FC0011:
>   		case AF9033_TUNER_MXL5007T:
>   		case AF9033_TUNER_TDA18218:
> +		case AF9033_TUNER_FC2580:
>   			state->af9033_config[i].spec_inv = 1;
>   			break;
>   		default:
> @@ -648,6 +649,41 @@ err:
>   	return ret;
>   }
>
> +static int af9035_fc2580_tuner_callback(struct dvb_usb_device *d,
> +		int cmd, int arg)
> +{
> +	int ret;
> +
> +	switch (cmd) {
> +	case FC2580_FE_CALLBACK_POWER:
> +		/* Tuner enable */
> +		ret = af9035_wr_reg_mask(d, 0xd8eb, 1, 1);
> +		if (ret < 0)
> +			goto err;
> +
> +		ret = af9035_wr_reg_mask(d, 0xd8ec, 1, 1);
> +		if (ret < 0)
> +			goto err;
> +
> +		ret = af9035_wr_reg_mask(d, 0xd8ed, 1, 1);
> +		if (ret < 0)
> +			goto err;
> +
> +		usleep_range(10000, 50000);
> +		break;
> +	default:
> +		ret = -EINVAL;
> +		goto err;
> +	}
> +
> +	return 0;
> +
> +err:
> +	dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
> +
> +	return ret;
> +}
> +
>   static int af9035_tuner_callback(struct dvb_usb_device *d, int cmd, int arg)
>   {
>   	struct state *state = d_to_priv(d);
> @@ -655,6 +691,8 @@ static int af9035_tuner_callback(struct dvb_usb_device *d, int cmd, int arg)
>   	switch (state->af9033_config[0].tuner) {
>   	case AF9033_TUNER_FC0011:
>   		return af9035_fc0011_tuner_callback(d, cmd, arg);
> +	case AF9033_TUNER_FC2580:
> +		return af9035_fc2580_tuner_callback(d, cmd, arg);
>   	default:
>   		break;
>   	}
> @@ -750,6 +788,11 @@ static struct tda18218_config af9035_tda18218_config = {
>   	.i2c_wr_max = 21,
>   };
>
> +static struct fc2580_config af9035_fc2580_config = {
> +	.i2c_addr = 0x56,
> +	.clock = 16384000,
> +};
> +
>   static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
>   {
>   	struct state *state = adap_to_priv(adap);
> @@ -851,6 +894,11 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
>   		fe = dvb_attach(tda18218_attach, adap->fe[0],
>   				&d->i2c_adap, &af9035_tda18218_config);
>   		break;
> +	case AF9033_TUNER_FC2580:
> +		/* attach tuner */
> +		fe = dvb_attach(fc2580_attach, adap->fe[0],
> +				&d->i2c_adap, &af9035_fc2580_config);
> +		break;
>   	default:
>   		fe = NULL;
>   	}
> @@ -1075,6 +1123,8 @@ static const struct usb_device_id af9035_id_table[] = {
>   		&af9035_props, "AVerMedia HD Volar (A867)", NULL) },
>   	{ DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_TWINSTAR,
>   		&af9035_props, "AVerMedia Twinstar (A825)", NULL) },
> +	{ DVB_USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100MINI_PLUS,
> +		&af9035_props, "Asus U3100Mini Plus", NULL) },
>   	{ }
>   };
>   MODULE_DEVICE_TABLE(usb, af9035_id_table);
> diff --git a/drivers/media/usb/dvb-usb-v2/af9035.h b/drivers/media/usb/dvb-usb-v2/af9035.h
> index de8e761..75ef1ec 100644
> --- a/drivers/media/usb/dvb-usb-v2/af9035.h
> +++ b/drivers/media/usb/dvb-usb-v2/af9035.h
> @@ -28,6 +28,7 @@
>   #include "fc0011.h"
>   #include "mxl5007t.h"
>   #include "tda18218.h"
> +#include "fc2580.h"
>
>   struct reg_val {
>   	u32 reg;
>
Olliver Schinagl Sept. 19, 2012, 9:52 a.m. UTC | #2
On 19-09-12 00:42, Antti Palosaari wrote:
> On 09/19/2012 01:22 AM, oliver@schinagl.nl wrote:
>> From: Oliver Schinagl <oliver@schinagl.nl>
>>
>> This is initial support for the Asus MyCinema U3100Mini Plus. The driver
>> in its current form gets detected and loads properly. It uses the
>> af9035 USB Bridge chip, with an af9033 demodulator. The tuner used is
>> the FCI FC2580.
>>
>> I have only done a quick dvb scan, but it failed to tune to anything.
>> Using dvbv5-scan -I CHANNEL <channelfile> It did show 'signal 100%' but
>> failed to tune to anything, so I don't think signal strength works at
>> all. Since I have really bad reception where my dev PC is, I may simple
>> not receive anything here.
>
> Signal strength is very worst indicator. It should not be 100% in any 
> case. Switch off stupid % meter your are using and look plain numbers. 
> It is should be something between 0-0xffff (0xffff == 100% ?).
I know 100% says nothing :p and I think especially with this driver? I 
didn't see the signal strength function implemented in the FC2580 (I 
have some code for it, once I have the device actually working :) But 
this is what dvbv5-scan reported.

>
> For me successful tzap reports (af9035 + tua9001):
> status 1f | signal 5eb7 | snr 010e | ber 00000000 | unc 00000000 | 
> FE_HAS_LOCK
>
> FE_HAS_LOCK is most important, it says demodulator is locked to 
> channel and likely device is 100% working.
I can't use tzap, as I can't scan for channel file. As I write this, I 
remember that I may have one on another system so should be able to use 
that to try tonight.

Furthermore, when checking debug while it's running a scan (either 
dvbscan or dvbv5-scan) I notice that it passes the loop 5 times, but I 
think that's normal from what I can tell from the code. Also 
fc2580_get_if_frequency appears to be a stub, correct?

>
> Biggest problem of your patch is fc2580 frontend callback. fc2580 
> driver does not use any callback and that code is simple dead. It is 
> never called.
Ah, assumption eh, I simply thought the callback is always used by the 
driver. I noticed some tuners do have the callback, others do their init 
just once. What's the cleanest solution, leave the code in the callback, 
and call it from fc9035_tuner_attach? (As you otherwise get a huge 
tuner_attach function). Anyway, why do some tuners have the callback and 
others don't? I guess it's a design decision of the driver, but why 
aren't they more equal?
>
> Otherwise it looks quite correct.
I will fix the init, though I doubt it will change anything as it 
appears the tuner is enabled per default.
>
> regards
> Antti
>
>
>> Signed-off-by: Oliver Schinagl <oliver@schinagl.nl>
>> ---
>>   drivers/media/dvb-core/dvb-usb-ids.h      |  1 +
>>   drivers/media/dvb-frontends/af9033.c      |  4 +++
>>   drivers/media/dvb-frontends/af9033.h      |  1 +
>>   drivers/media/dvb-frontends/af9033_priv.h | 38 +++++++++++++++++++++++
>>   drivers/media/tuners/fc2580.c             |  4 ++-
>>   drivers/media/tuners/fc2580.h             | 10 +++++++
>>   drivers/media/usb/dvb-usb-v2/Kconfig      |  1 +
>>   drivers/media/usb/dvb-usb-v2/af9035.c     | 50 
>> +++++++++++++++++++++++++++++++
>>   drivers/media/usb/dvb-usb-v2/af9035.h     |  1 +
>>   9 files changed, 109 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/dvb-core/dvb-usb-ids.h 
>> b/drivers/media/dvb-core/dvb-usb-ids.h
>> index d572307..58e0220 100644
>> --- a/drivers/media/dvb-core/dvb-usb-ids.h
>> +++ b/drivers/media/dvb-core/dvb-usb-ids.h
>> @@ -329,6 +329,7 @@
>>   #define USB_PID_ASUS_U3000                0x171f
>>   #define USB_PID_ASUS_U3000H                0x1736
>>   #define USB_PID_ASUS_U3100                0x173f
>> +#define USB_PID_ASUS_U3100MINI_PLUS            0x1779
>>   #define USB_PID_YUAN_EC372S                0x1edc
>>   #define USB_PID_YUAN_STK7700PH                0x1f08
>>   #define USB_PID_YUAN_PD378S                0x2edc
>> diff --git a/drivers/media/dvb-frontends/af9033.c 
>> b/drivers/media/dvb-frontends/af9033.c
>> index 0979ada..b40f5a0 100644
>> --- a/drivers/media/dvb-frontends/af9033.c
>> +++ b/drivers/media/dvb-frontends/af9033.c
>> @@ -314,6 +314,10 @@ static int af9033_init(struct dvb_frontend *fe)
>>           len = ARRAY_SIZE(tuner_init_tda18218);
>>           init = tuner_init_tda18218;
>>           break;
>> +    case AF9033_TUNER_FC2580:
>> +        len = ARRAY_SIZE(tuner_init_fc2580);
>> +        init = tuner_init_fc2580;
>> +        break;
>>       default:
>>           dev_dbg(&state->i2c->dev, "%s: unsupported tuner ID=%d\n",
>>                   __func__, state->cfg.tuner);
>> diff --git a/drivers/media/dvb-frontends/af9033.h 
>> b/drivers/media/dvb-frontends/af9033.h
>> index 288622b..739137e 100644
>> --- a/drivers/media/dvb-frontends/af9033.h
>> +++ b/drivers/media/dvb-frontends/af9033.h
>> @@ -42,6 +42,7 @@ struct af9033_config {
>>   #define AF9033_TUNER_FC0011      0x28 /* Fitipower FC0011 */
>>   #define AF9033_TUNER_MXL5007T    0xa0 /* MaxLinear MxL5007T */
>>   #define AF9033_TUNER_TDA18218    0xa1 /* NXP TDA 18218HN */
>> +#define AF9033_TUNER_FC2580      0x32 /* FIC FC2580 */
>>       u8 tuner;
>>
>>       /*
>> diff --git a/drivers/media/dvb-frontends/af9033_priv.h 
>> b/drivers/media/dvb-frontends/af9033_priv.h
>> index 0b783b9..d2c9ae6 100644
>> --- a/drivers/media/dvb-frontends/af9033_priv.h
>> +++ b/drivers/media/dvb-frontends/af9033_priv.h
>> @@ -466,5 +466,43 @@ static const struct reg_val 
>> tuner_init_tda18218[] = {
>>       {0x80f1e6, 0x00},
>>   };
>>
>> +/* FIC FC2580 tuner init
>> +   AF9033_TUNER_FC2580      = 0x32 */
>> +static const struct reg_val tuner_init_fc2580[] = {
>> +    { 0x800046, AF9033_TUNER_FC2580 },
>> +    { 0x800057, 0x01 },
>> +    { 0x800058, 0x00 },
>> +    { 0x80005f, 0x00 },
>> +    { 0x800060, 0x00 },
>> +    { 0x800071, 0x05 },
>> +    { 0x800072, 0x02 },
>> +    { 0x800074, 0x01 },
>> +    { 0x800079, 0x01 },
>> +    { 0x800093, 0x00 },
>> +    { 0x800094, 0x00 },
>> +    { 0x800095, 0x00 },
>> +    { 0x800096, 0x05 },
>> +    { 0x8000b3, 0x01 },
>> +    { 0x8000c3, 0x01 },
>> +    { 0x8000c4, 0x00 },
>> +    { 0x80f007, 0x00 },
>> +    { 0x80f00c, 0x19 },
>> +    { 0x80f00d, 0x1A },
>> +    { 0x80f00e, 0x00 },
>> +    { 0x80f00f, 0x02 },
>> +    { 0x80f010, 0x00 },
>> +    { 0x80f011, 0x02 },
>> +    { 0x80f012, 0x00 },
>> +    { 0x80f013, 0x02 },
>> +    { 0x80f014, 0x00 },
>> +    { 0x80f015, 0x02 },
>> +    { 0x80f01f, 0x96 },
>> +    { 0x80f020, 0x00 },
>> +    { 0x80f029, 0x96 },
>> +    { 0x80f02a, 0x00 },
>> +    { 0x80f077, 0x01 },
>> +    { 0x80f1e6, 0x01 },
>> +};
>> +
>>   #endif /* AF9033_PRIV_H */
>>
>> diff --git a/drivers/media/tuners/fc2580.c 
>> b/drivers/media/tuners/fc2580.c
>> index afc0491..4e7c802 100644
>> --- a/drivers/media/tuners/fc2580.c
>> +++ b/drivers/media/tuners/fc2580.c
>> @@ -498,8 +498,10 @@ struct dvb_frontend *fc2580_attach(struct 
>> dvb_frontend *fe,
>>
>>       dev_dbg(&priv->i2c->dev, "%s: chip_id=%02x\n", __func__, chip_id);
>>
>> -    if (chip_id != 0x56)
>> +    if ((chip_id != 0x56) && (chip_id != 0x5a)) {
>>           goto err;
>> +    }
>> +
>>
>>       dev_info(&priv->i2c->dev,
>>               "%s: FCI FC2580 successfully identified\n",
>> diff --git a/drivers/media/tuners/fc2580.h 
>> b/drivers/media/tuners/fc2580.h
>> index 222601e..952513d 100644
>> --- a/drivers/media/tuners/fc2580.h
>> +++ b/drivers/media/tuners/fc2580.h
>> @@ -36,6 +36,16 @@ struct fc2580_config {
>>       u32 clock;
>>   };
>>
>> +/** enum fc2580_fe_callback_commands - Frontend callbacks
>> + *
>> + * @FC2580_FE_CALLBACK_POWER: Power on tuner hardware.
>> + */
>> +enum fc2580_fe_callback_commands {
>> +    FC2580_FE_CALLBACK_POWER,
>> +};
>> +
>> +
>> +
>>   #if defined(CONFIG_MEDIA_TUNER_FC2580) || \
>>       (defined(CONFIG_MEDIA_TUNER_FC2580_MODULE) && defined(MODULE))
>>   extern struct dvb_frontend *fc2580_attach(struct dvb_frontend *fe,
>> diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig 
>> b/drivers/media/usb/dvb-usb-v2/Kconfig
>> index e09930c..834bfec 100644
>> --- a/drivers/media/usb/dvb-usb-v2/Kconfig
>> +++ b/drivers/media/usb/dvb-usb-v2/Kconfig
>> @@ -40,6 +40,7 @@ config DVB_USB_AF9035
>>       select MEDIA_TUNER_FC0011 if MEDIA_SUBDRV_AUTOSELECT
>>       select MEDIA_TUNER_MXL5007T if MEDIA_SUBDRV_AUTOSELECT
>>       select MEDIA_TUNER_TDA18218 if MEDIA_SUBDRV_AUTOSELECT
>> +    select MEDIA_TUNER_FC2580 if MEDIA_SUBDRV_AUTOSELECT
>>       help
>>         Say Y here to support the Afatech AF9035 based DVB USB receiver.
>>
>> diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c 
>> b/drivers/media/usb/dvb-usb-v2/af9035.c
>> index 89cc901..f6ca30e 100644
>> --- a/drivers/media/usb/dvb-usb-v2/af9035.c
>> +++ b/drivers/media/usb/dvb-usb-v2/af9035.c
>> @@ -513,6 +513,7 @@ static int af9035_read_config(struct 
>> dvb_usb_device *d)
>>           case AF9033_TUNER_FC0011:
>>           case AF9033_TUNER_MXL5007T:
>>           case AF9033_TUNER_TDA18218:
>> +        case AF9033_TUNER_FC2580:
>>               state->af9033_config[i].spec_inv = 1;
>>               break;
>>           default:
>> @@ -648,6 +649,41 @@ err:
>>       return ret;
>>   }
>>
>> +static int af9035_fc2580_tuner_callback(struct dvb_usb_device *d,
>> +        int cmd, int arg)
>> +{
>> +    int ret;
>> +
>> +    switch (cmd) {
>> +    case FC2580_FE_CALLBACK_POWER:
>> +        /* Tuner enable */
>> +        ret = af9035_wr_reg_mask(d, 0xd8eb, 1, 1);
>> +        if (ret < 0)
>> +            goto err;
>> +
>> +        ret = af9035_wr_reg_mask(d, 0xd8ec, 1, 1);
>> +        if (ret < 0)
>> +            goto err;
>> +
>> +        ret = af9035_wr_reg_mask(d, 0xd8ed, 1, 1);
>> +        if (ret < 0)
>> +            goto err;
>> +
>> +        usleep_range(10000, 50000);
>> +        break;
>> +    default:
>> +        ret = -EINVAL;
>> +        goto err;
>> +    }
>> +
>> +    return 0;
>> +
>> +err:
>> +    dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
>> +
>> +    return ret;
>> +}
>> +
>>   static int af9035_tuner_callback(struct dvb_usb_device *d, int cmd, 
>> int arg)
>>   {
>>       struct state *state = d_to_priv(d);
>> @@ -655,6 +691,8 @@ static int af9035_tuner_callback(struct 
>> dvb_usb_device *d, int cmd, int arg)
>>       switch (state->af9033_config[0].tuner) {
>>       case AF9033_TUNER_FC0011:
>>           return af9035_fc0011_tuner_callback(d, cmd, arg);
>> +    case AF9033_TUNER_FC2580:
>> +        return af9035_fc2580_tuner_callback(d, cmd, arg);
>>       default:
>>           break;
>>       }
>> @@ -750,6 +788,11 @@ static struct tda18218_config 
>> af9035_tda18218_config = {
>>       .i2c_wr_max = 21,
>>   };
>>
>> +static struct fc2580_config af9035_fc2580_config = {
>> +    .i2c_addr = 0x56,
>> +    .clock = 16384000,
>> +};
>> +
>>   static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
>>   {
>>       struct state *state = adap_to_priv(adap);
>> @@ -851,6 +894,11 @@ static int af9035_tuner_attach(struct 
>> dvb_usb_adapter *adap)
>>           fe = dvb_attach(tda18218_attach, adap->fe[0],
>>                   &d->i2c_adap, &af9035_tda18218_config);
>>           break;
>> +    case AF9033_TUNER_FC2580:
>> +        /* attach tuner */
>> +        fe = dvb_attach(fc2580_attach, adap->fe[0],
>> +                &d->i2c_adap, &af9035_fc2580_config);
>> +        break;
>>       default:
>>           fe = NULL;
>>       }
>> @@ -1075,6 +1123,8 @@ static const struct usb_device_id 
>> af9035_id_table[] = {
>>           &af9035_props, "AVerMedia HD Volar (A867)", NULL) },
>>       { DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_TWINSTAR,
>>           &af9035_props, "AVerMedia Twinstar (A825)", NULL) },
>> +    { DVB_USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100MINI_PLUS,
>> +        &af9035_props, "Asus U3100Mini Plus", NULL) },
>>       { }
>>   };
>>   MODULE_DEVICE_TABLE(usb, af9035_id_table);
>> diff --git a/drivers/media/usb/dvb-usb-v2/af9035.h 
>> b/drivers/media/usb/dvb-usb-v2/af9035.h
>> index de8e761..75ef1ec 100644
>> --- a/drivers/media/usb/dvb-usb-v2/af9035.h
>> +++ b/drivers/media/usb/dvb-usb-v2/af9035.h
>> @@ -28,6 +28,7 @@
>>   #include "fc0011.h"
>>   #include "mxl5007t.h"
>>   #include "tda18218.h"
>> +#include "fc2580.h"
>>
>>   struct reg_val {
>>       u32 reg;
>>
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Antti Palosaari Sept. 19, 2012, 10:41 a.m. UTC | #3
On 09/19/2012 12:52 PM, Oliver Schinagl wrote:
> On 19-09-12 00:42, Antti Palosaari wrote:
>> On 09/19/2012 01:22 AM, oliver@schinagl.nl wrote:
>>> From: Oliver Schinagl <oliver@schinagl.nl>
>>>
>>> This is initial support for the Asus MyCinema U3100Mini Plus. The driver
>>> in its current form gets detected and loads properly. It uses the
>>> af9035 USB Bridge chip, with an af9033 demodulator. The tuner used is
>>> the FCI FC2580.
>>>
>>> I have only done a quick dvb scan, but it failed to tune to anything.
>>> Using dvbv5-scan -I CHANNEL <channelfile> It did show 'signal 100%' but
>>> failed to tune to anything, so I don't think signal strength works at
>>> all. Since I have really bad reception where my dev PC is, I may simple
>>> not receive anything here.
>>
>> Signal strength is very worst indicator. It should not be 100% in any
>> case. Switch off stupid % meter your are using and look plain numbers.
>> It is should be something between 0-0xffff (0xffff == 100% ?).
> I know 100% says nothing :p and I think especially with this driver? I
> didn't see the signal strength function implemented in the FC2580 (I
> have some code for it, once I have the device actually working :) But
> this is what dvbv5-scan reported.

Have to say have never used tool. Instead w_scan, scan (dvbscan, 
scandvb) and tzap. If you get working channels.conf file for your area 
you are able to use tzap.

Signal strength is reported by af9033 demodulator regardless if tuner 
could report it or not.

>> For me successful tzap reports (af9035 + tua9001):
>> status 1f | signal 5eb7 | snr 010e | ber 00000000 | unc 00000000 |
>> FE_HAS_LOCK
>>
>> FE_HAS_LOCK is most important, it says demodulator is locked to
>> channel and likely device is 100% working.
> I can't use tzap, as I can't scan for channel file. As I write this, I
> remember that I may have one on another system so should be able to use
> that to try tonight.
>
> Furthermore, when checking debug while it's running a scan (either
> dvbscan or dvbv5-scan) I notice that it passes the loop 5 times, but I
> think that's normal from what I can tell from the code. Also
> fc2580_get_if_frequency appears to be a stub, correct?

I suspect it tests different parameters. Like one iteration for each 
bandwidth. If you know your area transmission parameters you could skip 
whole scanning and just waste only two seconds using tzap to test.

fc2580_get_if_frequency is not stub, it is correctly implemented. FC2580 
is direct conversion tuner (== zero-IF, IF 0 Hz) which means it 
transfers RF band directly to the base-band. No IF used.

>> Biggest problem of your patch is fc2580 frontend callback. fc2580
>> driver does not use any callback and that code is simple dead. It is
>> never called.
> Ah, assumption eh, I simply thought the callback is always used by the
> driver. I noticed some tuners do have the callback, others do their init
> just once. What's the cleanest solution, leave the code in the callback,
> and call it from fc9035_tuner_attach? (As you otherwise get a huge
> tuner_attach function). Anyway, why do some tuners have the callback and
> others don't? I guess it's a design decision of the driver, but why
> aren't they more equal?

There should not be frontend callback unless needed. The basic (and only 
one I know?) use scenario for tuner callback is to control some tuner 
external pins using bridge GPIO. If there is no such pins then there is 
no need for callback. For example digital AGC you asked earlier is such 
control pin (actually 2 pins) but as it is not used no need for 
callback. TUA9001 is good example of tuner having control pins.

I think you refer fc0011 tuner callbacks. There seems to be reset and 
power. At least power sounds something like it should not be there, I 
suspect it is just some GPIO that turns on/off power from tuner and not 
control any fc0011 pin.

Antti
Olliver Schinagl Sept. 19, 2012, 5:57 p.m. UTC | #4
On 09/19/12 12:41, Antti Palosaari wrote:
> On 09/19/2012 12:52 PM, Oliver Schinagl wrote:
>> On 19-09-12 00:42, Antti Palosaari wrote:
>>> On 09/19/2012 01:22 AM, oliver@schinagl.nl wrote:
>>>> From: Oliver Schinagl <oliver@schinagl.nl>
>>>>
>>>> This is initial support for the Asus MyCinema U3100Mini Plus. The
>>>> driver
>>>> in its current form gets detected and loads properly. It uses the
>>>> af9035 USB Bridge chip, with an af9033 demodulator. The tuner used is
>>>> the FCI FC2580.
>>>>
>>>> I have only done a quick dvb scan, but it failed to tune to anything.
>>>> Using dvbv5-scan -I CHANNEL <channelfile> It did show 'signal 100%' but
>>>> failed to tune to anything, so I don't think signal strength works at
>>>> all. Since I have really bad reception where my dev PC is, I may simple
>>>> not receive anything here.
>>>
>>> Signal strength is very worst indicator. It should not be 100% in any
>>> case. Switch off stupid % meter your are using and look plain numbers.
>>> It is should be something between 0-0xffff (0xffff == 100% ?).
>> I know 100% says nothing :p and I think especially with this driver? I
>> didn't see the signal strength function implemented in the FC2580 (I
>> have some code for it, once I have the device actually working :) But
>> this is what dvbv5-scan reported.
>
> Have to say have never used tool. Instead w_scan, scan (dvbscan,
> scandvb) and tzap. If you get working channels.conf file for your area
> you are able to use tzap.
dvbv5-scan is written by Mauro, it comes in the dvb-utils package 
together with tzap and dvbscan. It is to utilize the new dvb v5 api.

Both can't find any channels however when scanning. Scanning with my 
Terratec Cynergy Dual T PCI-e, I also get 'tuning failed' when scanning 
for channels using dvbscan, however I do get a usefull channels.conf 
that I can use with tzap on the stick. Unfortunatly, no success.

oliver@valexia ~ $ tzap -c channels.conf "Nederland 1"
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
reading channels from file 'channels.conf'
tuning to 546000000 Hz
video pid 0x1b63, audio pid 0x1b64
status 00 | signal ffff | snr 0000 | ber 00000000 | unc 00000000 |
status 01 | signal ffff | snr 0000 | ber 00000000 | unc 00000000 |

The status blinks to 01 every once in a while, but stays on zero mostly. 
"Nederland 1" is a FTA channel that should come in pretty strong.

Of course I tested this all before changing the tuner enable bits. Once 
I changed that, well, I had a little party :)

dvbscan still says tuning failed using dvbscan, but it actually finds 
all Networks and channels. Also tuning with tzap using a previously 
known working channels.conf works. (tzap -r + mplayer) though mplayer 
does some weird scaling, which I'm sure is mplayer's fault:
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [x11] 704x576 => 1024x576 Planar YV12


>
> Signal strength is reported by af9033 demodulator regardless if tuner
> could report it or not.
>
>>> For me successful tzap reports (af9035 + tua9001):
>>> status 1f | signal 5eb7 | snr 010e | ber 00000000 | unc 00000000 |
>>> FE_HAS_LOCK
>>>
>>> FE_HAS_LOCK is most important, it says demodulator is locked to
>>> channel and likely device is 100% working.
>> I can't use tzap, as I can't scan for channel file. As I write this, I
>> remember that I may have one on another system so should be able to use
>> that to try tonight.
>>
>> Furthermore, when checking debug while it's running a scan (either
>> dvbscan or dvbv5-scan) I notice that it passes the loop 5 times, but I
>> think that's normal from what I can tell from the code. Also
>> fc2580_get_if_frequency appears to be a stub, correct?
>
> I suspect it tests different parameters. Like one iteration for each
> bandwidth. If you know your area transmission parameters you could skip
> whole scanning and just waste only two seconds using tzap to test.
>
> fc2580_get_if_frequency is not stub, it is correctly implemented. FC2580
> is direct conversion tuner (== zero-IF, IF 0 Hz) which means it
> transfers RF band directly to the base-band. No IF used.
Ah, so it is intended to always return zero. It just felt as the debug 
information was missing something, as there was a colon, indicating to 
show us some output. Maybe always print 0 :)

>
>>> Biggest problem of your patch is fc2580 frontend callback. fc2580
>>> driver does not use any callback and that code is simple dead. It is
>>> never called.
>> Ah, assumption eh, I simply thought the callback is always used by the
>> driver. I noticed some tuners do have the callback, others do their init
>> just once. What's the cleanest solution, leave the code in the callback,
>> and call it from fc9035_tuner_attach? (As you otherwise get a huge
>> tuner_attach function). Anyway, why do some tuners have the callback and
>> others don't? I guess it's a design decision of the driver, but why
>> aren't they more equal?
>
> There should not be frontend callback unless needed. The basic (and only
> one I know?) use scenario for tuner callback is to control some tuner
> external pins using bridge GPIO. If there is no such pins then there is
> no need for callback. For example digital AGC you asked earlier is such
> control pin (actually 2 pins) but as it is not used no need for
> callback. TUA9001 is good example of tuner having control pins.
Since this tuner doesn't have external AGC that we know of, this tuner 
shouldn't have a callback. Makes sense.

>
> I think you refer fc0011 tuner callbacks. There seems to be reset and
> power. At least power sounds something like it should not be there, I
> suspect it is just some GPIO that turns on/off power from tuner and not
> control any fc0011 pin.
>
> Antti
>

Will tidy up my commit and submit it to ML again.

Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Olliver Schinagl Sept. 19, 2012, 6 p.m. UTC | #5
On 09/19/12 19:57, Oliver Schinagl wrote:
> On 09/19/12 12:41, Antti Palosaari wrote:
>> On 09/19/2012 12:52 PM, Oliver Schinagl wrote:
>>> On 19-09-12 00:42, Antti Palosaari wrote:
>>>> On 09/19/2012 01:22 AM, oliver@schinagl.nl wrote:
>>>>> From: Oliver Schinagl <oliver@schinagl.nl>
>>>>>
>>>>> This is initial support for the Asus MyCinema U3100Mini Plus. The
>>>>> driver
>>>>> in its current form gets detected and loads properly. It uses the
>>>>> af9035 USB Bridge chip, with an af9033 demodulator. The tuner used is
>>>>> the FCI FC2580.
>>>>>
>>>>> I have only done a quick dvb scan, but it failed to tune to anything.
>>>>> Using dvbv5-scan -I CHANNEL <channelfile> It did show 'signal 100%'
>>>>> but
>>>>> failed to tune to anything, so I don't think signal strength works at
>>>>> all. Since I have really bad reception where my dev PC is, I may
>>>>> simple
>>>>> not receive anything here.
>>>>
>>>> Signal strength is very worst indicator. It should not be 100% in any
>>>> case. Switch off stupid % meter your are using and look plain numbers.
>>>> It is should be something between 0-0xffff (0xffff == 100% ?).
>>> I know 100% says nothing :p and I think especially with this driver? I
>>> didn't see the signal strength function implemented in the FC2580 (I
>>> have some code for it, once I have the device actually working :) But
>>> this is what dvbv5-scan reported.
>>
>> Have to say have never used tool. Instead w_scan, scan (dvbscan,
>> scandvb) and tzap. If you get working channels.conf file for your area
>> you are able to use tzap.
> dvbv5-scan is written by Mauro, it comes in the dvb-utils package
> together with tzap and dvbscan. It is to utilize the new dvb v5 api.
>
> Both can't find any channels however when scanning. Scanning with my
> Terratec Cynergy Dual T PCI-e, I also get 'tuning failed' when scanning
> for channels using dvbscan, however I do get a usefull channels.conf
> that I can use with tzap on the stick. Unfortunatly, no success.
>
> oliver@valexia ~ $ tzap -c channels.conf "Nederland 1"
> using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
> reading channels from file 'channels.conf'
> tuning to 546000000 Hz
> video pid 0x1b63, audio pid 0x1b64
> status 00 | signal ffff | snr 0000 | ber 00000000 | unc 00000000 |
> status 01 | signal ffff | snr 0000 | ber 00000000 | unc 00000000 |
>
> The status blinks to 01 every once in a while, but stays on zero mostly.
> "Nederland 1" is a FTA channel that should come in pretty strong.
>
> Of course I tested this all before changing the tuner enable bits. Once
> I changed that, well, I had a little party :)
>
> dvbscan still says tuning failed using dvbscan, but it actually finds
> all Networks and channels. Also tuning with tzap using a previously
> known working channels.conf works. (tzap -r + mplayer) though mplayer
> does some weird scaling, which I'm sure is mplayer's fault:
> Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
> VO: [x11] 704x576 => 1024x576 Planar YV12

Forgot to mention, here's output from tzap when successfully tuning a 
channel for completness sake. Also note, signal strength is awefully 
happy at 100% (ffff) which I doubt to be accurate.

status 00 | signal ffff | snr 0000 | ber 00000000 | unc 000001fa |
status 1f | signal ffff | snr 0000 | ber 00000000 | unc 000003de | 
FE_HAS_LOCK
status 1f | signal ffff | snr 00dc | ber 0001d85c | unc 000003e9 | 
FE_HAS_LOCK
status 1f | signal ffff | snr 0104 | ber 0000d1b0 | unc 000003e9 | 
FE_HAS_LOCK
status 1f | signal ffff | snr 0104 | ber 00000000 | unc 000003e9 | 
FE_HAS_LOCK
status 1f | signal ffff | snr 0104 | ber 00000000 | unc 000003e9 | 
FE_HAS_LOCK

>
>
>>
>> Signal strength is reported by af9033 demodulator regardless if tuner
>> could report it or not.
>>
>>>> For me successful tzap reports (af9035 + tua9001):
>>>> status 1f | signal 5eb7 | snr 010e | ber 00000000 | unc 00000000 |
>>>> FE_HAS_LOCK
>>>>
>>>> FE_HAS_LOCK is most important, it says demodulator is locked to
>>>> channel and likely device is 100% working.
>>> I can't use tzap, as I can't scan for channel file. As I write this, I
>>> remember that I may have one on another system so should be able to use
>>> that to try tonight.
>>>
>>> Furthermore, when checking debug while it's running a scan (either
>>> dvbscan or dvbv5-scan) I notice that it passes the loop 5 times, but I
>>> think that's normal from what I can tell from the code. Also
>>> fc2580_get_if_frequency appears to be a stub, correct?
>>
>> I suspect it tests different parameters. Like one iteration for each
>> bandwidth. If you know your area transmission parameters you could skip
>> whole scanning and just waste only two seconds using tzap to test.
>>
>> fc2580_get_if_frequency is not stub, it is correctly implemented. FC2580
>> is direct conversion tuner (== zero-IF, IF 0 Hz) which means it
>> transfers RF band directly to the base-band. No IF used.
> Ah, so it is intended to always return zero. It just felt as the debug
> information was missing something, as there was a colon, indicating to
> show us some output. Maybe always print 0 :)
>
>>
>>>> Biggest problem of your patch is fc2580 frontend callback. fc2580
>>>> driver does not use any callback and that code is simple dead. It is
>>>> never called.
>>> Ah, assumption eh, I simply thought the callback is always used by the
>>> driver. I noticed some tuners do have the callback, others do their init
>>> just once. What's the cleanest solution, leave the code in the callback,
>>> and call it from fc9035_tuner_attach? (As you otherwise get a huge
>>> tuner_attach function). Anyway, why do some tuners have the callback and
>>> others don't? I guess it's a design decision of the driver, but why
>>> aren't they more equal?
>>
>> There should not be frontend callback unless needed. The basic (and only
>> one I know?) use scenario for tuner callback is to control some tuner
>> external pins using bridge GPIO. If there is no such pins then there is
>> no need for callback. For example digital AGC you asked earlier is such
>> control pin (actually 2 pins) but as it is not used no need for
>> callback. TUA9001 is good example of tuner having control pins.
> Since this tuner doesn't have external AGC that we know of, this tuner
> shouldn't have a callback. Makes sense.
>
>>
>> I think you refer fc0011 tuner callbacks. There seems to be reset and
>> power. At least power sounds something like it should not be there, I
>> suspect it is just some GPIO that turns on/off power from tuner and not
>> control any fc0011 pin.
>>
>> Antti
>>
>
> Will tidy up my commit and submit it to ML again.
>
> Oliver
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h
index d572307..58e0220 100644
--- a/drivers/media/dvb-core/dvb-usb-ids.h
+++ b/drivers/media/dvb-core/dvb-usb-ids.h
@@ -329,6 +329,7 @@ 
 #define USB_PID_ASUS_U3000				0x171f
 #define USB_PID_ASUS_U3000H				0x1736
 #define USB_PID_ASUS_U3100				0x173f
+#define USB_PID_ASUS_U3100MINI_PLUS			0x1779
 #define USB_PID_YUAN_EC372S				0x1edc
 #define USB_PID_YUAN_STK7700PH				0x1f08
 #define USB_PID_YUAN_PD378S				0x2edc
diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c
index 0979ada..b40f5a0 100644
--- a/drivers/media/dvb-frontends/af9033.c
+++ b/drivers/media/dvb-frontends/af9033.c
@@ -314,6 +314,10 @@  static int af9033_init(struct dvb_frontend *fe)
 		len = ARRAY_SIZE(tuner_init_tda18218);
 		init = tuner_init_tda18218;
 		break;
+	case AF9033_TUNER_FC2580:
+		len = ARRAY_SIZE(tuner_init_fc2580);
+		init = tuner_init_fc2580;
+		break;
 	default:
 		dev_dbg(&state->i2c->dev, "%s: unsupported tuner ID=%d\n",
 				__func__, state->cfg.tuner);
diff --git a/drivers/media/dvb-frontends/af9033.h b/drivers/media/dvb-frontends/af9033.h
index 288622b..739137e 100644
--- a/drivers/media/dvb-frontends/af9033.h
+++ b/drivers/media/dvb-frontends/af9033.h
@@ -42,6 +42,7 @@  struct af9033_config {
 #define AF9033_TUNER_FC0011      0x28 /* Fitipower FC0011 */
 #define AF9033_TUNER_MXL5007T    0xa0 /* MaxLinear MxL5007T */
 #define AF9033_TUNER_TDA18218    0xa1 /* NXP TDA 18218HN */
+#define AF9033_TUNER_FC2580      0x32 /* FIC FC2580 */
 	u8 tuner;
 
 	/*
diff --git a/drivers/media/dvb-frontends/af9033_priv.h b/drivers/media/dvb-frontends/af9033_priv.h
index 0b783b9..d2c9ae6 100644
--- a/drivers/media/dvb-frontends/af9033_priv.h
+++ b/drivers/media/dvb-frontends/af9033_priv.h
@@ -466,5 +466,43 @@  static const struct reg_val tuner_init_tda18218[] = {
 	{0x80f1e6, 0x00},
 };
 
+/* FIC FC2580 tuner init
+   AF9033_TUNER_FC2580      = 0x32 */
+static const struct reg_val tuner_init_fc2580[] = {
+	{ 0x800046, AF9033_TUNER_FC2580 },
+	{ 0x800057, 0x01 },
+	{ 0x800058, 0x00 },
+	{ 0x80005f, 0x00 },
+	{ 0x800060, 0x00 },
+	{ 0x800071, 0x05 },
+	{ 0x800072, 0x02 },
+	{ 0x800074, 0x01 },
+	{ 0x800079, 0x01 },
+	{ 0x800093, 0x00 },
+	{ 0x800094, 0x00 },
+	{ 0x800095, 0x00 },
+	{ 0x800096, 0x05 },
+	{ 0x8000b3, 0x01 },
+	{ 0x8000c3, 0x01 },
+	{ 0x8000c4, 0x00 },
+	{ 0x80f007, 0x00 },
+	{ 0x80f00c, 0x19 },
+	{ 0x80f00d, 0x1A },
+	{ 0x80f00e, 0x00 },
+	{ 0x80f00f, 0x02 },
+	{ 0x80f010, 0x00 },
+	{ 0x80f011, 0x02 },
+	{ 0x80f012, 0x00 },
+	{ 0x80f013, 0x02 },
+	{ 0x80f014, 0x00 },
+	{ 0x80f015, 0x02 },
+	{ 0x80f01f, 0x96 },
+	{ 0x80f020, 0x00 },
+	{ 0x80f029, 0x96 },
+	{ 0x80f02a, 0x00 },
+	{ 0x80f077, 0x01 },
+	{ 0x80f1e6, 0x01 },
+};
+
 #endif /* AF9033_PRIV_H */
 
diff --git a/drivers/media/tuners/fc2580.c b/drivers/media/tuners/fc2580.c
index afc0491..4e7c802 100644
--- a/drivers/media/tuners/fc2580.c
+++ b/drivers/media/tuners/fc2580.c
@@ -498,8 +498,10 @@  struct dvb_frontend *fc2580_attach(struct dvb_frontend *fe,
 
 	dev_dbg(&priv->i2c->dev, "%s: chip_id=%02x\n", __func__, chip_id);
 
-	if (chip_id != 0x56)
+	if ((chip_id != 0x56) && (chip_id != 0x5a)) {
 		goto err;
+	}
+
 
 	dev_info(&priv->i2c->dev,
 			"%s: FCI FC2580 successfully identified\n",
diff --git a/drivers/media/tuners/fc2580.h b/drivers/media/tuners/fc2580.h
index 222601e..952513d 100644
--- a/drivers/media/tuners/fc2580.h
+++ b/drivers/media/tuners/fc2580.h
@@ -36,6 +36,16 @@  struct fc2580_config {
 	u32 clock;
 };
 
+/** enum fc2580_fe_callback_commands - Frontend callbacks
+ *
+ * @FC2580_FE_CALLBACK_POWER: Power on tuner hardware.
+ */
+enum fc2580_fe_callback_commands {
+	FC2580_FE_CALLBACK_POWER,
+};
+
+
+
 #if defined(CONFIG_MEDIA_TUNER_FC2580) || \
 	(defined(CONFIG_MEDIA_TUNER_FC2580_MODULE) && defined(MODULE))
 extern struct dvb_frontend *fc2580_attach(struct dvb_frontend *fe,
diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig b/drivers/media/usb/dvb-usb-v2/Kconfig
index e09930c..834bfec 100644
--- a/drivers/media/usb/dvb-usb-v2/Kconfig
+++ b/drivers/media/usb/dvb-usb-v2/Kconfig
@@ -40,6 +40,7 @@  config DVB_USB_AF9035
 	select MEDIA_TUNER_FC0011 if MEDIA_SUBDRV_AUTOSELECT
 	select MEDIA_TUNER_MXL5007T if MEDIA_SUBDRV_AUTOSELECT
 	select MEDIA_TUNER_TDA18218 if MEDIA_SUBDRV_AUTOSELECT
+	select MEDIA_TUNER_FC2580 if MEDIA_SUBDRV_AUTOSELECT
 	help
 	  Say Y here to support the Afatech AF9035 based DVB USB receiver.
 
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index 89cc901..f6ca30e 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -513,6 +513,7 @@  static int af9035_read_config(struct dvb_usb_device *d)
 		case AF9033_TUNER_FC0011:
 		case AF9033_TUNER_MXL5007T:
 		case AF9033_TUNER_TDA18218:
+		case AF9033_TUNER_FC2580:
 			state->af9033_config[i].spec_inv = 1;
 			break;
 		default:
@@ -648,6 +649,41 @@  err:
 	return ret;
 }
 
+static int af9035_fc2580_tuner_callback(struct dvb_usb_device *d,
+		int cmd, int arg)
+{
+	int ret;
+
+	switch (cmd) {
+	case FC2580_FE_CALLBACK_POWER:
+		/* Tuner enable */
+		ret = af9035_wr_reg_mask(d, 0xd8eb, 1, 1);
+		if (ret < 0)
+			goto err;
+
+		ret = af9035_wr_reg_mask(d, 0xd8ec, 1, 1);
+		if (ret < 0)
+			goto err;
+
+		ret = af9035_wr_reg_mask(d, 0xd8ed, 1, 1);
+		if (ret < 0)
+			goto err;
+
+		usleep_range(10000, 50000);
+		break;
+	default:
+		ret = -EINVAL;
+		goto err;
+	}
+
+	return 0;
+
+err:
+	dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
+
+	return ret;
+}
+
 static int af9035_tuner_callback(struct dvb_usb_device *d, int cmd, int arg)
 {
 	struct state *state = d_to_priv(d);
@@ -655,6 +691,8 @@  static int af9035_tuner_callback(struct dvb_usb_device *d, int cmd, int arg)
 	switch (state->af9033_config[0].tuner) {
 	case AF9033_TUNER_FC0011:
 		return af9035_fc0011_tuner_callback(d, cmd, arg);
+	case AF9033_TUNER_FC2580:
+		return af9035_fc2580_tuner_callback(d, cmd, arg);
 	default:
 		break;
 	}
@@ -750,6 +788,11 @@  static struct tda18218_config af9035_tda18218_config = {
 	.i2c_wr_max = 21,
 };
 
+static struct fc2580_config af9035_fc2580_config = {
+	.i2c_addr = 0x56,
+	.clock = 16384000,
+};
+
 static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
 {
 	struct state *state = adap_to_priv(adap);
@@ -851,6 +894,11 @@  static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
 		fe = dvb_attach(tda18218_attach, adap->fe[0],
 				&d->i2c_adap, &af9035_tda18218_config);
 		break;
+	case AF9033_TUNER_FC2580:
+		/* attach tuner */
+		fe = dvb_attach(fc2580_attach, adap->fe[0],
+				&d->i2c_adap, &af9035_fc2580_config);
+		break;
 	default:
 		fe = NULL;
 	}
@@ -1075,6 +1123,8 @@  static const struct usb_device_id af9035_id_table[] = {
 		&af9035_props, "AVerMedia HD Volar (A867)", NULL) },
 	{ DVB_USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_TWINSTAR,
 		&af9035_props, "AVerMedia Twinstar (A825)", NULL) },
+	{ DVB_USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100MINI_PLUS,
+		&af9035_props, "Asus U3100Mini Plus", NULL) },
 	{ }
 };
 MODULE_DEVICE_TABLE(usb, af9035_id_table);
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.h b/drivers/media/usb/dvb-usb-v2/af9035.h
index de8e761..75ef1ec 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.h
+++ b/drivers/media/usb/dvb-usb-v2/af9035.h
@@ -28,6 +28,7 @@ 
 #include "fc0011.h"
 #include "mxl5007t.h"
 #include "tda18218.h"
+#include "fc2580.h"
 
 struct reg_val {
 	u32 reg;