Hardware driver for the Terratec Cinergy T/A tuner?

Hi! It has been a while :slight_smile:

Chips:
RTL2832
18273 - Presumably a tuner from NXP
CX23102 - USB video and broadcast-audio decoder family from Conexant.

So I can mod the cx231xx driver to load, but there is no driver for the TDA18273 tuner. I found one on the web, but lack the required knowledge to integrate it into the rest. It fails to compile, complaining about a missing dvb_frontend.h. Grabbed the files from here: http://www.staroceans.org/generatedTrees/_myprojects_linux-media_drivers_media_tuners.html

Hi Anders
Good to see you around :wink:

You need to update the line to use media in the affected file, assuming kernel source for your running kernel is installed.


#include "media/dvb_frontend.h"

Thanks Malcolm! Long time no see!!

I will try, meanwhile do I have another development-related question:

I do not want to build the whole kernel, just these modules, so:

  1. I used make modules SUBDIRS=drivers/media/usb/cx231xx but there is a notification that this method is deprecated. What should I use?
  2. The individual Konfigs, ie when I build just “tuners”. I have added “obj-$(CONFIG_MEDIA_TUNER_TDA18273) += tda18273.o” to the makefile, but how do I manipulate te config so that CONFIG_MEDIA_TUNER_TDA18273 is true?

OK. Thing is that I have no idea about the pedigree of this driver :slight_smile: Anyway the include was wrong, was “#include “dvb_frontend.h”” should be "#include “media/dvb_frontend.h”

Now I get:

rivers/media/tuners//tda18273.c:2133:4: error: ‘struct dvb_tuner_info’ has no member named ‘frequency_min’; did you mean ‘frequency_min_hz’?   .frequency_min  =  42000000,
    ^~~~~~~~~~~~~
    frequency_min_hz
drivers/media/tuners//tda18273.c:2134:4: error: ‘struct dvb_tuner_info’ has no member named ‘frequency_max’; did you mean ‘frequency_max_hz’?
   .frequency_max  = 870000000,
    ^~~~~~~~~~~~~
    frequency_max_hz
drivers/media/tuners//tda18273.c:2135:4: error: ‘struct dvb_tuner_info’ has no member named ‘frequency_step’; did you mean ‘frequency_step_hz’?
   .frequency_step = 50000,
    ^~~~~~~~~~~~~~
    frequency_step_hz
drivers/media/tuners//tda18273.c:2144:14: error: initialization from incompatible pointer type -Werror=incompatible-pointer-types]
  .release  = tda18273_release
              ^~~~~~~~~~~~~~~~



That member is clearly named “.frequency_step_hz” in the other tuner files

That leaves:



  CC [M]  drivers/media/tuners//tda18273.o
drivers/media/tuners//tda18273.c:2144:14: error: initialization from incompatible pointer type -Werror=incompatible-pointer-types]
  .release  = tda18273_release

Other files has the same assignment, so

static int tda18273_release(struct dvb_frontend *fe){
    struct tda18273_state *priv = fe->tuner_priv;


    BUG_ON(!priv);


    if(priv->power_state != tmPowerOff) {
        tda18273_pwr_state(fe, tmPowerStandby);
    }
    
    fe->tuner_priv = NULL;
    kfree(priv);
    return 0;
}

Others have this as static void. Changed that and it compiles. Now, how do I get the board driver to find the proper tuner driver?

[CX231XX_BOARD_TERRATEC_TA] = {        .name = "Terratec TA",
        .tuner_type = TUNER_NXP_TDA18271,

So where is that defined and how to we get from there to /lib/modules/5.3.18-150300.59.101-default/kernel/drivers/media/tuners/tda18271.ko.xz??

OK. Replying to myself:

/usr/src/linux-5.3.18-150300.59.101/include/media/tuner.h:#define TUNER_NXP_TDA18271

Added: #define TUNER_NXP_TDA18271 92

Then
/usr/src/linux-5.3.18-150300.59.101/drivers/media/v4l2-core/tuner-core.c:

case TUNER_NXP_TDA18273:
{
	struct tda18271_config cfg = {
		.small_i2c = TDA18271_03_BYTE_CHUNK_INIT,
	};


	if (!dvb_attach(tda18273_attach, &t->fe, t->i2c->addr,
			t->i2c->adapter, &cfg))
		goto attach_failed;
	tune_now = 0;
	break;
}

Wonder what would be a better approach? Just rebuild media and install or build a completely separate kernel as I apparently have to change a lot of files?

Or to clarify: I just want to install what I have built in drivers/media. Can I do that?

Hi
Yes, use module_install.

You mean:

$ sudo make modules_install

?