<div dir="ltr">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)<div><br></div><div>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 ?</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-02-10 22:23 GMT+08:00 Yong Li <span dir="ltr"><<a href="mailto:sdliyong@gmail.com" target="_blank">sdliyong@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><p class="MsoNormal">Thanks Henry. I can access the bmp085 driver sysfs entries using
the below command:</p>

<p class="MsoNormal"><span style="background:yellow">echo
bmp085 0x77 > /sys/devices/platform/80860F41:05/i2c-7/new_device</span></p>

<p class="MsoNormal"><span style="background:yellow"> </span></p>

<p class="MsoNormal"><span style="background:yellow">I am
using the LSE I2C pins. </span><span style="font-size:10.5pt;font-family:Arial,sans-serif;color:black;background-image:initial;background-repeat:initial">Documentation shows i2c on bus #5, ACPI shows it
on bus #6, but driver uses bus #7</span></p>

<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Arial,sans-serif;color:black;background-image:initial;background-repeat:initial"> </span></p>

<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Arial,sans-serif;color:black;background-image:initial;background-repeat:initial">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.</span></p>

<p class="MsoNormal">                adapter
= i2c_get_adapter(7);</p>

<p class="MsoNormal">                if
(adapter) {</p>

<p class="MsoNormal">                                printk("**%s
get adapter!\n", __FUNCTION__);</p>

<p class="MsoNormal">                                client
= i2c_new_device(adapter, &i2c_info);</p>

<p class="MsoNormal">                                if
(!client)</p>

<p class="MsoNormal">                                                pr_err("can't
create i2c device %s\n");</p>

<p class="MsoNormal">                } else
{</p>

<p class="MsoNormal">                                printk("**%s
get_adapter fail! register_board_info\n", __FUNCTION__);</p>

<p class="MsoNormal">                                i2c_register_board_info(7,
&i2c_info, 1);</p>

<p class="MsoNormal">                }<span style="background:yellow"></span></p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">After change the <span style="font-size:10.5pt;font-family:Arial,sans-serif;color:black;background-image:initial;background-repeat:initial">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. </span></p>

<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Arial,sans-serif;color:black;background-image:initial;background-repeat:initial"> </span></p>

<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Arial,sans-serif;color:black;background-image:initial;background-repeat:initial">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.</span></p>

<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Arial,sans-serif;color:black;background-image:initial;background-repeat:initial"> </span></p>

<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Arial,sans-serif;color:black;background-image:initial;background-repeat:initial">Any suggestions/comments?</span></p>

<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Arial,sans-serif;color:black;background-image:initial;background-repeat:initial"> </span></p>

<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Arial,sans-serif;color:black;background-image:initial;background-repeat:initial">Thanks,</span></p>

<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Arial,sans-serif;color:black;background-image:initial;background-repeat:initial">Yong Li </span></p><div><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2015-02-09 23:56 GMT+08:00 Darren Hart <span dir="ltr"><<a href="mailto:dvhart@linux.intel.com" target="_blank">dvhart@linux.intel.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The generic driver structure works the same for x86. Ideally you would be<br>
able to trigger the probe via an SSDT overlay (small bit of AML that<br>
functions similar to a fdt blob). The driver itself would only need a<br>
couple updates to support the new device-properties API which abstracts<br>
away the ACPI and DT part from properties collection. But, that doesn't<br>
help you too much right now.<br>
<br>
One approach would be to dynamically create the device at runtime, with<br>
something like:<br>
<br>
# echo bmp085 0x77 > /sys/class/i2c-adapter/i2c-0/new_device<br>
<br>
(I'm not in front of a Mmax at the moment, so verify the paths and values)<br>
<br>
Check that it worked with:<br>
# dmesg | grep bmp<br>
<br>
You should see something like:<br>
i2c i2c-1: new_device: Instantiated device bmp085 at 0x77<br>
bmp085 1-0077: Successfully initialized bmp085!<br>
<br>
<br>
Alternatively, you could write a simple board file driver which populates<br>
the bmp085 platform data and registers the device. I didn't find any<br>
bmp085 specific examples, but you should be able to follow another i2c<br>
example board file and extrapolate from there.<br>
<br>
Thanks,<br>
<br>
--<br>
Darren Hart<br>
Intel Open Source Technology Center<br>
<br>
<br>
<br>
<br>
From:  Yong Li <<a href="mailto:sdliyong@gmail.com" target="_blank">sdliyong@gmail.com</a>><br>
Reply-To:  MinnowBoard Development and Community Discussion<br>
<<a href="mailto:elinux-minnowboard@lists.elinux.org" target="_blank">elinux-minnowboard@lists.elinux.org</a>><br>
Date:  Monday, February 9, 2015 at 6:10 AM<br>
To:  <<a href="mailto:henry.bruce@intel.com" target="_blank">henry.bruce@intel.com</a>><br>
Cc:  <<a href="mailto:elinux-minnowboard@lists.elinux.org" target="_blank">elinux-minnowboard@lists.elinux.org</a>><br>
<div><div>Subject:  [MinnowBoard] drivers/platform/x86/minnowboard.c for<br>
MinnowboardMax?<br>
<br>
<br>
>Hi Henry,<br>
><br>
>Thanks for your reply. I am testing a pressure sensor using the MAX<br>
>board. It is an IIC device, and the kernel does support it with<br>
>drivers/misc/bmp085.c. I really want to use the kernel device driver to<br>
>support this device(Using /sys file to query the pressure)<br>
><br>
>The problem is I do not know how to trigger the driver_probe function.<br>
><br>
>On ARM platform, there are board/machine .c files, I can add i2c board<br>
>info in these files. However I do not know to use the<br>
>i2c_register_board_info on X86, is there any examples?.<br>
><br>
>Message: 4<br>
>Date: Mon, 9 Feb 2015 07:42:06 +0000<br>
>From: "Bruce, Henry" <<a href="mailto:henry.bruce@intel.com" target="_blank">henry.bruce@intel.com</a>><br>
>To: MinnowBoard Development and Community Discussion<br>
>        <<a href="mailto:elinux-minnowboard@lists.elinux.org" target="_blank">elinux-minnowboard@lists.elinux.org</a>><br>
>Subject: Re: [MinnowBoard] drivers/platform/x86/minnowboard.c for<br>
>        Minnowboard     Max?<br>
>Message-ID:<br>
><br>
><<a href="mailto:F81DC1078564A34BB4DA30CAE03814D127685017@ORSMSX104.amr.corp.intel.com" target="_blank">F81DC1078564A34BB4DA30CAE03814D127685017@ORSMSX104.amr.corp.intel.com</a>><br>
><br>
>Content-Type: text/plain; charset="utf-8"<br>
><br>
>Yong Li,<br>
><br>
>Take a look at the mraa<<a href="https://github.com/intel-iot-devkit/mraa" target="_blank">https://github.com/intel-iot-devkit/mraa</a>> library<br>
>that supports gpio and i2c for Minnowboard Max. For software that uses<br>
>this library see the upm sensor<br>
>library.<<a href="https://github.com/intel-iot-devkit/upm" target="_blank">https://github.com/intel-iot-devkit/upm</a>> There is no support<br>
>planned for Minnowboard v1.<br>
><br>
>Regards,<br>
><br>
>Henry Bruce<br>
><br>
><br>
><br>
>From: elinux-MinnowBoard<br>
>[mailto:<a href="mailto:elinux-minnowboard-bounces@lists.elinux.org" target="_blank">elinux-minnowboard-bounces@lists.elinux.org</a>] On Behalf Of Yong Li<br>
>Sent: Sunday, February 8, 2015 4:57 AM<br>
>To: <a href="mailto:elinux-minnowboard@lists.elinux.org" target="_blank">elinux-minnowboard@lists.elinux.org</a><br>
>Subject: [MinnowBoard] drivers/platform/x86/minnowboard.c for Minnowboard<br>
>Max?<br>
><br>
>Hi All, I am using the kernel 3.14.19 for my Max, but I did not find the<br>
>drivers/platform/x86/minnowboard.c file and other related patches for<br>
>Minnowboard, I would like to port them to support the Max board, to add<br>
>some other IO devices, such as IIC, SPI and other GPIO devices.<br>
><br>
>In which version, can I find these files? Is there any other demo drivers<br>
>for the IIC/SPI on Minnboard and/or Max board?<br>
><br>
>Thanks,<br>
>Yong Li<br>
><br>
</div></div>>_______________________________________________<br>
>elinux-MinnowBoard mailing list<br>
>elinux-MinnowBoard@lists.elinux.orghttp://<a href="http://lists.elinux.org/mailman/listinf" target="_blank">lists.elinux.org/mailman/listinf</a><br>
>o/elinux-minnowboard<br>
<br>
<br>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>