0

I am trying to integrate the NXP 7150 drivers into Android P for an x86 based platform.

Here are the integration guidelines given : https://www.nxp.com/docs/en/application-note/AN11690.pdf

Since x86 does not support device tree as of now, I need to use the Platform data. But I am not sure in which file should I place this info :

static struct pn544_i2c_platform_data nfc_pdata = {
.irq_gpio = GPIO_TO_PIN(1,29),
.ven_gpio = GPIO_TO_PIN(0,30),
.firm_gpio = GPIO_UNUSED
.clkreq_gpio = GPIO_UNUSED
};
static struct i2c_board_info __initdata nfc_board_info[] = {
{
I2C_BOARD_INFO("pn547", 0x28),
.platform_data = &nfc_pdata,
},
};

I have minimal driver development knowledge, hence I am not able to figure out. I have built the driver as a builtin module. I understand that I need to plug the PN7150 dongle and then put the device info somewhere in the kernel code, which can call the probe of the driver on boot up. Please help.

Naveen
  • 7,944
  • 12
  • 78
  • 165
  • You can either add it inside your board file or you can add a new kernel module and then export 7150 driver module from there. – vinod maverick Jan 25 '19 at 07:06
  • @vinodmaverick : I see an example here : https://github.com/PacktPublishing/Linux-Device-Drivers-Development/tree/master/Chapter05 where just the .name has to match in order for the driver to get probed. But I am still confused as what could be the way to encode `nfc_board_info` and then probe the driver? Can you please put some dummy code snippet as an answer to this ? – Naveen Jan 25 '19 at 08:03
  • Use ACPI for that. https://stackoverflow.com/questions/46095840/adding-i2c-client-devices-on-x86-64/46370798#46370798 – 0andriy Feb 07 '19 at 16:55
  • Possible duplicate of [adding i2c client devices on x86\_64](https://stackoverflow.com/questions/46095840/adding-i2c-client-devices-on-x86-64) – 0andriy Feb 07 '19 at 16:55

1 Answers1

-1

As I told in my comment as well; but if you don't have any board file (which I am assuming is not available in your X86 Arch code) then you can simply make a new kernel modul. Inside the init function of kernel module you can register your I2C device info:

static int __init dummy_nfc_init(void) {

i2c_register_board_info(1, nfc_board_info,
            ARRAY_SIZE(nfc_board_info));
}

module_init(dummy_nfc_init);

In the example while registering the board info 1 is I2C bus number. In your case you need to modify the bus number. You can make this dummy driver as built-in. So when your PN7150 driver .-name will matched with I2C_BOARD_INFO name "pn547" driver probe function will get called while for other callback function and read/write operation slave address 0x28 and I2C bus number should matched.

vinod maverick
  • 670
  • 4
  • 14