After compared with an ARM platform, I found the Minnowboard MAX platform does not support the i2c_register_board_info function call, I have to use the i2c_new_device function(Since the X86 does not use static I2c adapter register process)
I found there is a drivers/platform/chrome/chromeos_laptop.c, there are several examples for adding I2C devices in X86 platform. Can we re-use this file for the Minnow MAX board ? 2015-02-10 22:23 GMT+08:00 Yong Li <[email protected]>: > Thanks Henry. I can access the bmp085 driver sysfs entries using the below > command: > > echo bmp085 0x77 > /sys/devices/platform/80860F41:05/i2c-7/new_device > > > > I am using the LSE I2C pins. Documentation shows i2c on bus #5, ACPI > shows it on bus #6, but driver uses bus #7 > > > > I want to load the bmp085 automatically during kernel boot, so I add the > below code and change the i2c_designware_platform.ko(It is /dev/i2c-7) to > statically linked with kernel. > > adapter = i2c_get_adapter(7); > > if (adapter) { > > printk("**%s get adapter!\n", > __FUNCTION__); > > client = i2c_new_device(adapter, > &i2c_info); > > if (!client) > > pr_err("can't create i2c > device %s\n"); > > } else { > > printk("**%s get_adapter fail! > register_board_info\n", __FUNCTION__); > > i2c_register_board_info(7, &i2c_info, 1); > > } > > > > After change the i2c_designware_platform to statically linked, the > i2c_new_device is called, the sensor probe can be triggered but failed. I > cannot detect the I2C device using I2cdetect command too! I tested all > these i2c-0 to i2c-9 devices. > > > > I have to change it back to .ko, in this mode, the i2c_register_board_info > is called, but it cannot trigger the bmp085 probe function. > > > > Any suggestions/comments? > > > > Thanks, > > Yong Li > > 2015-02-09 23:56 GMT+08:00 Darren Hart <[email protected]>: > >> The generic driver structure works the same for x86. Ideally you would be >> able to trigger the probe via an SSDT overlay (small bit of AML that >> functions similar to a fdt blob). The driver itself would only need a >> couple updates to support the new device-properties API which abstracts >> away the ACPI and DT part from properties collection. But, that doesn't >> help you too much right now. >> >> One approach would be to dynamically create the device at runtime, with >> something like: >> >> # echo bmp085 0x77 > /sys/class/i2c-adapter/i2c-0/new_device >> >> (I'm not in front of a Mmax at the moment, so verify the paths and values) >> >> Check that it worked with: >> # dmesg | grep bmp >> >> You should see something like: >> i2c i2c-1: new_device: Instantiated device bmp085 at 0x77 >> bmp085 1-0077: Successfully initialized bmp085! >> >> >> Alternatively, you could write a simple board file driver which populates >> the bmp085 platform data and registers the device. I didn't find any >> bmp085 specific examples, but you should be able to follow another i2c >> example board file and extrapolate from there. >> >> Thanks, >> >> -- >> Darren Hart >> Intel Open Source Technology Center >> >> >> >> >> From: Yong Li <[email protected]> >> Reply-To: MinnowBoard Development and Community Discussion >> <[email protected]> >> Date: Monday, February 9, 2015 at 6:10 AM >> To: <[email protected]> >> Cc: <[email protected]> >> Subject: [MinnowBoard] drivers/platform/x86/minnowboard.c for >> MinnowboardMax? >> >> >> >Hi Henry, >> > >> >Thanks for your reply. I am testing a pressure sensor using the MAX >> >board. It is an IIC device, and the kernel does support it with >> >drivers/misc/bmp085.c. I really want to use the kernel device driver to >> >support this device(Using /sys file to query the pressure) >> > >> >The problem is I do not know how to trigger the driver_probe function. >> > >> >On ARM platform, there are board/machine .c files, I can add i2c board >> >info in these files. However I do not know to use the >> >i2c_register_board_info on X86, is there any examples?. >> > >> >Message: 4 >> >Date: Mon, 9 Feb 2015 07:42:06 +0000 >> >From: "Bruce, Henry" <[email protected]> >> >To: MinnowBoard Development and Community Discussion >> > <[email protected]> >> >Subject: Re: [MinnowBoard] drivers/platform/x86/minnowboard.c for >> > Minnowboard Max? >> >Message-ID: >> > >> ><f81dc1078564a34bb4da30cae03814d127685...@orsmsx104.amr.corp.intel.com> >> > >> >Content-Type: text/plain; charset="utf-8" >> > >> >Yong Li, >> > >> >Take a look at the mraa<https://github.com/intel-iot-devkit/mraa> >> library >> >that supports gpio and i2c for Minnowboard Max. For software that uses >> >this library see the upm sensor >> >library.<https://github.com/intel-iot-devkit/upm> There is no support >> >planned for Minnowboard v1. >> > >> >Regards, >> > >> >Henry Bruce >> > >> > >> > >> >From: elinux-MinnowBoard >> >[mailto:[email protected]] On Behalf Of Yong >> Li >> >Sent: Sunday, February 8, 2015 4:57 AM >> >To: [email protected] >> >Subject: [MinnowBoard] drivers/platform/x86/minnowboard.c for Minnowboard >> >Max? >> > >> >Hi All, I am using the kernel 3.14.19 for my Max, but I did not find the >> >drivers/platform/x86/minnowboard.c file and other related patches for >> >Minnowboard, I would like to port them to support the Max board, to add >> >some other IO devices, such as IIC, SPI and other GPIO devices. >> > >> >In which version, can I find these files? Is there any other demo drivers >> >for the IIC/SPI on Minnboard and/or Max board? >> > >> >Thanks, >> >Yong Li >> > >> >_______________________________________________ >> >elinux-MinnowBoard mailing list >> >[email protected]:// >> lists.elinux.org/mailman/listinf >> >o/elinux-minnowboard >> >> >> >
_______________________________________________ elinux-MinnowBoard mailing list [email protected] http://lists.elinux.org/mailman/listinfo/elinux-minnowboard
