[linux-sunxi] Re: Help adding I2C child node

2016-03-13 Thread ION GROZEA
Hello Bruce,

Did you manage to get the driver working? Can you please share it?

Do you also have the driver for MS5611?


On Saturday, September 20, 2014 at 3:54:06 PM UTC+2, bruce bushby wrote:
>
> Hi 
>
> As a hobby I've been playing with an Olimex A20-SOM and trying to 
> attach a Drotek Invensense MPU9250 break out board. 
>
> So far my uboot is working and I can boot my build via dhcp + nfs. I 
> added the "i2ctools" to the build and I'm able to run "i2cdetect -y 0" 
> and I can see my devices on i2c0 
>
> # 
> # i2cdetect -y 0 
>  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f 
> 00:  -- -- -- -- -- -- -- -- -- -- -- -- -- 
> 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> 30: -- -- -- -- 34 -- -- -- -- -- -- -- -- -- -- -- 
> 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
> 60: -- -- -- -- -- -- -- -- -- 69 -- -- -- -- -- -- 
> 70: -- -- -- -- -- -- -- 77 
> # 
>
>
> The drotek breakout board: 
> http://www.drotek.fr/shop/en/home/466-imu-10dof-mpu9250-ms5611.html 
>
> includes ms5611 altimeter which is why you see address "0x34" 
>
>
> A very kind Daniel Baluta provided a patched version of the "inv_mpu" 
> drivers enabling them to compile for the 3.16+ kernels. (rather then 
> 3.4) 
>
> Now I have a module  (inv_mpu_iio) that loadsbut it is not 
> associated with my i2c0 "0x69" device, nor has it created any /sys 
> device files: 
>
> # 
> # lsmod 
> Module  Size  Used byNot tainted 
> inv_mpu_iio62968  0 
> # 
> # dmesg | grep inv 
> [1.187348] i2c i2c-0: client [inv_mpu_iio] registered with bus id 
> 0-0069 
> [   22.452739] i2c-core: driver [inv_mpu_iio] registered 
> # 
>
>
> First question: Does my DTS child node look ok? 
>
>
> i2c0: i2c@01c2ac00 { 
> pinctrl-names = "default"; 
> pinctrl-0 = <&i2c0_pins_a>; 
> status = "okay"; 
>
> mpu@69 { 
> compatible = "inv_mpu_iio"; 
> reg = <0x69>; 
> }; 
> }; 
>
>
> Something has worked because I can cat this file: 
> # cat /sys/devices/soc@01c0/1c2ac00.i2c/i2c-0/0-0069/name 
> inv_mpu_iio 
> # 
>
> This is the driver I am using: 
> https://github.com/BruceBushby/inv_mpu 
>
>
> "inv_mpu_core.c"  ...contains the probe function: 
>
> static int inv_mpu_probe(struct i2c_client *client, 
> const struct i2c_device_id *id) 
> { 
> struct inv_mpu_state *st; 
> struct iio_dev *indio_dev; 
> int result, err; 
> pr_debug("Invensense MPU probe started.\n"); 
>
>
>
>
> Sadly I don't see any "module debug" messages.even though I've 
> enabled various DEBUG in my kernel config: 
>
>
> CONFIG_I2C_DEBUG_CORE=y 
> CONFIG_I2C_DEBUG_ALGO=y 
> CONFIG_I2C_DEBUG_BUS=y 
> CONFIG_DYNAMIC_DEBUG=y 
> CONFIG_DEBUG_INFO=y 
> CONFIG_DEBUG_KERNEL=y 
>
>
>
>
> Any ideas? 
>
>
>
> Thanks 
> Bruce 
>

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [linux-sunxi] Re: Help adding I2C child node

2014-09-24 Thread Maxime Ripard
On Wed, Sep 24, 2014 at 04:27:02PM +0100, bruce bushby wrote:
> Quick update in case it help somebody else.
> 
> Big thank you to selsinork for some valuable tips and pointers.
> 
> As it turns out, you don't need a DTS entry to add an I2C child
> node/device. I removed my DTS child node entries in case they were
> breaking things, booted the board and then manually added the device
> and kernel driver.
> 
> Although my driver still doesn't work, I am able to see the debug
> messages which is great.
> 
> 
> Shell session: First I confirm I can see and query the I2C device
> using i2ctools, then instantiate the device and then load the
> module...which fails, but at least explains where it's failing.
> 
> # lsmod
> Module  Size  Used byNot tainted
> #
> #
> #
> # i2cdetect -y 0
>  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
> 00:  -- -- -- -- -- -- -- -- -- -- -- -- --
> 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 30: -- -- -- -- 34 -- -- -- -- -- -- -- -- -- -- --
> 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 60: -- -- -- -- -- -- -- -- -- 69 -- -- -- -- -- --
> 70: -- -- -- -- -- -- -- 77
> #
> #
> #
> # i2cget -y 0 0x69 0x75
> 0x71
> #
> #
> #
> # echo mpu9250 0x69 > /sys/bus/i2c/devices/i2c-0/new_device
> [   55.362493] i2c i2c-0: new_device: Instantiated device mpu9250 at 0x69
> #
> # modprobe inv-mpu-iio
> [   77.347200] inv-mpu-iio 0-0069: Unable to read axis_map_x
> [   77.352699] i2c i2c-0: inv_mpu_probe failed -22
> [   77.357254] inv-mpu-iio: probe of 0-0069 failed with error -5
> #

Without having the code, it's hard to say, but it definitely looks
like you're missing some DT properties (and hence, have to create a
node for your device).

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature


Re: [linux-sunxi] Re: Help adding I2C child node

2014-09-24 Thread Quink
Make sure other devices didn't occupy the I2C bus exclusively. This is what
happened on
my Cubieboard2 when I trying to add a mma8451. It didn't work until I
removed the HDMI
module which used the same I2C bus. I'm not clear about the details.

On Wed, Sep 24, 2014 at 11:27 PM, bruce bushby 
wrote:

> Quick update in case it help somebody else.
>
> Big thank you to selsinork for some valuable tips and pointers.
>
> As it turns out, you don't need a DTS entry to add an I2C child
> node/device. I removed my DTS child node entries in case they were
> breaking things, booted the board and then manually added the device
> and kernel driver.
>
> Although my driver still doesn't work, I am able to see the debug
> messages which is great.
>
>
> Shell session: First I confirm I can see and query the I2C device
> using i2ctools, then instantiate the device and then load the
> module...which fails, but at least explains where it's failing.
>
> # lsmod
> Module  Size  Used byNot tainted
> #
> #
> #
> # i2cdetect -y 0
>  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
> 00:  -- -- -- -- -- -- -- -- -- -- -- -- --
> 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 30: -- -- -- -- 34 -- -- -- -- -- -- -- -- -- -- --
> 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 60: -- -- -- -- -- -- -- -- -- 69 -- -- -- -- -- --
> 70: -- -- -- -- -- -- -- 77
> #
> #
> #
> # i2cget -y 0 0x69 0x75
> 0x71
> #
> #
> #
> # echo mpu9250 0x69 > /sys/bus/i2c/devices/i2c-0/new_device
> [   55.362493] i2c i2c-0: new_device: Instantiated device mpu9250 at 0x69
> #
> # modprobe inv-mpu-iio
> [   77.347200] inv-mpu-iio 0-0069: Unable to read axis_map_x
> [   77.352699] i2c i2c-0: inv_mpu_probe failed -22
> [   77.357254] inv-mpu-iio: probe of 0-0069 failed with error -5
> #
>
>
>
>
> Bruce
>
>
>
>
>
> On Sat, Sep 20, 2014 at 2:54 PM, bruce bushby 
> wrote:
> > Hi
> >
> > As a hobby I've been playing with an Olimex A20-SOM and trying to
> > attach a Drotek Invensense MPU9250 break out board.
> >
> > So far my uboot is working and I can boot my build via dhcp + nfs. I
> > added the "i2ctools" to the build and I'm able to run "i2cdetect -y 0"
> > and I can see my devices on i2c0
> >
> > #
> > # i2cdetect -y 0
> >  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
> > 00:  -- -- -- -- -- -- -- -- -- -- -- -- --
> > 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> > 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> > 30: -- -- -- -- 34 -- -- -- -- -- -- -- -- -- -- --
> > 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> > 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> > 60: -- -- -- -- -- -- -- -- -- 69 -- -- -- -- -- --
> > 70: -- -- -- -- -- -- -- 77
> > #
> >
> >
> > The drotek breakout board:
> > http://www.drotek.fr/shop/en/home/466-imu-10dof-mpu9250-ms5611.html
> >
> > includes ms5611 altimeter which is why you see address "0x34"
> >
> >
> > A very kind Daniel Baluta provided a patched version of the "inv_mpu"
> > drivers enabling them to compile for the 3.16+ kernels. (rather then
> > 3.4)
> >
> > Now I have a module  (inv_mpu_iio) that loadsbut it is not
> > associated with my i2c0 "0x69" device, nor has it created any /sys
> > device files:
> >
> > #
> > # lsmod
> > Module  Size  Used byNot tainted
> > inv_mpu_iio62968  0
> > #
> > # dmesg | grep inv
> > [1.187348] i2c i2c-0: client [inv_mpu_iio] registered with bus id
> 0-0069
> > [   22.452739] i2c-core: driver [inv_mpu_iio] registered
> > #
> >
> >
> > First question: Does my DTS child node look ok?
> >
> >
> > i2c0: i2c@01c2ac00 {
> > pinctrl-names = "default";
> > pinctrl-0 = <&i2c0_pins_a>;
> > status = "okay";
> >
> > mpu@69 {
> > compatible = "inv_mpu_iio";
> > reg = <0x69>;
> > };
> > };
> >
> >
> > Something has worked because I can cat this file:
> > # cat /sys/devices/soc@01c0/1c2ac00.i2c/i2c-0/0-0069/name
> > inv_mpu_iio
> > #
> >
> > This is the driver I am using:
> > https://github.com/BruceBushby/inv_mpu
> >
> >
> > "inv_mpu_core.c"  ...contains the probe function:
> >
> > static int inv_mpu_probe(struct i2c_client *client,
> > const struct i2c_device_id *id)
> > {
> > struct inv_mpu_state *st;
> > struct iio_dev *indio_dev;
> > int result, err;
> > pr_debug("Invensense MPU probe started.\n");
> >
> >
> >
> >
> > Sadly I don't see any "module debug" messages.even though I've
> > enabled various DEBUG in my kernel config:
> >
> >
> > CONFIG_I2C_DEBUG_CORE=y
> > CONFIG_I2C_DEBUG_ALGO=y
> > CONFIG_I2C_DEBUG_BUS=y
> > CONFIG_DYNAMIC_DEBUG=y
> > CONFIG_DEBUG_INFO=y
> > CONFIG_DEBUG_KERNEL=y
> >
> >
> >
> >
> > Any ideas?
> >
> >
> >
> > Thanks
> > Bruce
>
> --
> You received this message because you are subscribed to the Google Groups
> "linux-sunxi" group.
> To unsubscribe from this gro

[linux-sunxi] Re: Help adding I2C child node

2014-09-24 Thread bruce bushby
Quick update in case it help somebody else.

Big thank you to selsinork for some valuable tips and pointers.

As it turns out, you don't need a DTS entry to add an I2C child
node/device. I removed my DTS child node entries in case they were
breaking things, booted the board and then manually added the device
and kernel driver.

Although my driver still doesn't work, I am able to see the debug
messages which is great.


Shell session: First I confirm I can see and query the I2C device
using i2ctools, then instantiate the device and then load the
module...which fails, but at least explains where it's failing.

# lsmod
Module  Size  Used byNot tainted
#
#
#
# i2cdetect -y 0
 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:  -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- 34 -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- 69 -- -- -- -- -- --
70: -- -- -- -- -- -- -- 77
#
#
#
# i2cget -y 0 0x69 0x75
0x71
#
#
#
# echo mpu9250 0x69 > /sys/bus/i2c/devices/i2c-0/new_device
[   55.362493] i2c i2c-0: new_device: Instantiated device mpu9250 at 0x69
#
# modprobe inv-mpu-iio
[   77.347200] inv-mpu-iio 0-0069: Unable to read axis_map_x
[   77.352699] i2c i2c-0: inv_mpu_probe failed -22
[   77.357254] inv-mpu-iio: probe of 0-0069 failed with error -5
#




Bruce





On Sat, Sep 20, 2014 at 2:54 PM, bruce bushby  wrote:
> Hi
>
> As a hobby I've been playing with an Olimex A20-SOM and trying to
> attach a Drotek Invensense MPU9250 break out board.
>
> So far my uboot is working and I can boot my build via dhcp + nfs. I
> added the "i2ctools" to the build and I'm able to run "i2cdetect -y 0"
> and I can see my devices on i2c0
>
> #
> # i2cdetect -y 0
>  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
> 00:  -- -- -- -- -- -- -- -- -- -- -- -- --
> 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 30: -- -- -- -- 34 -- -- -- -- -- -- -- -- -- -- --
> 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 60: -- -- -- -- -- -- -- -- -- 69 -- -- -- -- -- --
> 70: -- -- -- -- -- -- -- 77
> #
>
>
> The drotek breakout board:
> http://www.drotek.fr/shop/en/home/466-imu-10dof-mpu9250-ms5611.html
>
> includes ms5611 altimeter which is why you see address "0x34"
>
>
> A very kind Daniel Baluta provided a patched version of the "inv_mpu"
> drivers enabling them to compile for the 3.16+ kernels. (rather then
> 3.4)
>
> Now I have a module  (inv_mpu_iio) that loadsbut it is not
> associated with my i2c0 "0x69" device, nor has it created any /sys
> device files:
>
> #
> # lsmod
> Module  Size  Used byNot tainted
> inv_mpu_iio62968  0
> #
> # dmesg | grep inv
> [1.187348] i2c i2c-0: client [inv_mpu_iio] registered with bus id 0-0069
> [   22.452739] i2c-core: driver [inv_mpu_iio] registered
> #
>
>
> First question: Does my DTS child node look ok?
>
>
> i2c0: i2c@01c2ac00 {
> pinctrl-names = "default";
> pinctrl-0 = <&i2c0_pins_a>;
> status = "okay";
>
> mpu@69 {
> compatible = "inv_mpu_iio";
> reg = <0x69>;
> };
> };
>
>
> Something has worked because I can cat this file:
> # cat /sys/devices/soc@01c0/1c2ac00.i2c/i2c-0/0-0069/name
> inv_mpu_iio
> #
>
> This is the driver I am using:
> https://github.com/BruceBushby/inv_mpu
>
>
> "inv_mpu_core.c"  ...contains the probe function:
>
> static int inv_mpu_probe(struct i2c_client *client,
> const struct i2c_device_id *id)
> {
> struct inv_mpu_state *st;
> struct iio_dev *indio_dev;
> int result, err;
> pr_debug("Invensense MPU probe started.\n");
>
>
>
>
> Sadly I don't see any "module debug" messages.even though I've
> enabled various DEBUG in my kernel config:
>
>
> CONFIG_I2C_DEBUG_CORE=y
> CONFIG_I2C_DEBUG_ALGO=y
> CONFIG_I2C_DEBUG_BUS=y
> CONFIG_DYNAMIC_DEBUG=y
> CONFIG_DEBUG_INFO=y
> CONFIG_DEBUG_KERNEL=y
>
>
>
>
> Any ideas?
>
>
>
> Thanks
> Bruce

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.