Dealing with the SPI driver abstraction and architecture
This is where the driver logic takes place. It consists of filling struct spi_driver
with a set of driving functions that allow probing and controlling the underlying device.
Probing the device
The SPI device is probed by the spi_driver.probe
callback. The probe callback is responsible for making sure the driver recognizes the given device before they can be bound together. This callback has the following prototype:
int probe(struct spi_device *spi)
This method must return 0
on success, or a negative error number otherwise. The only argument is the SPI device to be probed, whose structure has been pre-initialized by the core according to its description in the device tree.
However, most (if not all) of the properties of the SPI device can be overridden, as we have seen while describing its data structure. SPI protocol drivers may need to update the transfer mode if the device doesn't work with its default...