Post Go back to editing

SPI driver adis16475 has no spi_device_id for adi,adis16470

Category: Software
Product Number: ADIS16507-1
Software Version: Driver ADIS16475

Hello,

I want to use my ADIS16507-1 sensor on my Raspberry Pi 4.

I compiled my kernel by adding the driver that I put in modules.

However when I load my modules, there are errors:

pi@raspberrypi:~ $ sudo modprobe adis16475
pi@raspberrypi:~ $ dmesg 
SPI driver adis16475 has no spi_device_id for adi,adis16470
SPI driver adis16475 has no spi_device_id for adi,adis16475-1
SPI driver adis16475 has no spi_device_id for adi,adis16475-2
SPI driver adis16475 has no spi_device_id for adi,adis16475-3
SPI driver adis16475 has no spi_device_id for adi,adis16477-1
SPI driver adis16475 has no spi_device_id for adi,adis16477-2
SPI driver adis16475 has no spi_device_id for adi,adis16477-3
SPI driver adis16475 has no spi_device_id for adi,adis16465-1
SPI driver adis16475 has no spi_device_id for adi,adis16465-2
SPI driver adis16475 has no spi_device_id for adi,adis16465-3
SPI driver adis16475 has no spi_device_id for adi,adis16467-1
SPI driver adis16475 has no spi_device_id for adi,adis16467-2
SPI driver adis16475 has no spi_device_id for adi,adis16467-3
SPI driver adis16475 has no spi_device_id for adi,adis16500
SPI driver adis16475 has no spi_device_id for adi,adis16505-1
SPI driver adis16475 has no spi_device_id for adi,adis16505-2
SPI driver adis16475 has no spi_device_id for adi,adis16505-3
SPI driver adis16475 has no spi_device_id for adi,adis16507-1
SPI driver adis16475 has no spi_device_id for adi,adis16507-2
SPI driver adis16475 has no spi_device_id for adi,adis16507-3

And its errors seem to prevent the creation of  iio:device0

pi@raspberrypi:~ $ ls /sys/bus/iio/devices/
pi@raspberrypi:~ $

My modules are indicated as active despite the errors :

pi@raspberrypi:~ $ lsmod
Module                  Size  Used by
adis16475              28672  0
adis_lib               24576  1 adis16475
 

I have the latest version of Raspberry Pi OS :

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.15.50-v7l+ #3 SMP Mon Jul 4 04:09:46 PDT 2022 armv7l GNU/Linux

This error is produced by /drivers/spi/spi.c in this function (line 41,42):

int __spi_register_driver(struct module *owner, struct spi_driver *sdrv)
{
 	sdrv->driver.owner = owner;
 	sdrv->driver.bus = &spi_bus_type;

	/*
	 * For Really Good Reasons we use spi: modaliases not of:
	 * modaliases for DT so module autoloading won't work if we
	 * don't have a spi_device_id as well as a compatible string.
	 */
	if (sdrv->driver.of_match_table) {
		const struct of_device_id *of_id;

		for (of_id = sdrv->driver.of_match_table; of_id->compatible[0];
		     of_id++) {
			const char *of_name;

			/* Strip off any vendor prefix */
			of_name = strnchr(of_id->compatible,
					  sizeof(of_id->compatible), ',');
			if (of_name)
				of_name++;
			else
				of_name = of_id->compatible;

			if (sdrv->id_table) {
				const struct spi_device_id *spi_id;

				for (spi_id = sdrv->id_table; spi_id->name[0];
				     spi_id++)
					if (strcmp(spi_id->name, of_name) == 0)
						break;

				if (spi_id->name[0])
					continue;
			} else {
				if (strcmp(sdrv->driver.name, of_name) == 0)
					continue;
			}

			pr_warn("SPI driver %s has no spi_device_id for %s\n",
				sdrv->driver.name, of_id->compatible);
		}
	}
 	return driver_register(&sdrv->driver);
}

I also tried to add the adis16480 sensor module and the adis16460 sensor module for comparison. For them everything is fine, I can load it with insmod and modprobe without error. However, I don't have the adis16480 or adis16480 sensor so I can't attest that they work.
My error does not come from the way I plugged the Raspberry Pi and the tests I made are not influenced by the fact that the sensor is plugged or not

I can't find a solution, so I'm looking for ideas to help me!

Thanks in advance,

Dimitri



Update
[edited by: Dimigger at 12:11 PM (GMT -4) on 5 Jul 2022]
  • Hello,

    I found the solution of my problem.

    When I added my driver to my linux raspi-5.15.y kernel, I modified in my .config this : CONFIG_ADIS16475=y (equivalent to checking [*] in the make menuconfig).

    Then I launched directly the compilation. however I forgot to add the .dts file which during the compilation will create the .dtbo file which is obligatory so that the Raspberry Pi can know the pins and the drivers to use.

    I went to look for the adis16475.dts here

    I copied it in my linux/arch/arm/boot/dts/overlays/
    I also added in the linux/arch/arm/boot/dts/overlays/Makefile the line adis16475.dtbo

    so I have now :

    ls linux/arch/arm/boot/dts/overlays/adis16475.dts
    adis16475.dts
    

    and :

    nano linux/arch/arm/boot/dts/overlays/Makefile
    
    ...
    dtbo-$(CONFIG_ARCH_BCM2835) += \
    adis16475.dtbo \
    ...

    Now I can launch my make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbs