Skip to content

mpu6050 device tree overlay #2031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 23, 2017
Merged

Conversation

T0ny0
Copy link

@T0ny0 T0ny0 commented May 22, 2017

Allows to write in /boot/config.txt
dtoverlay=mpu6050
and use mpu6050 connected on i2c interface from userspace
Also add ability to choose interrupt pin with
dtparam=mpu6050_interrupt_pin=<gpio_num>

Copy link
Contributor

@pelwell pelwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the inline comments, I'd like an entry in the README (alphabetical order, max 80 columns, no TABS, strict indentation and 2 blank lines between entries) and a patch to bcmrpi_defconfig as well.

Otherwise it looks fine.

@@ -109,7 +109,8 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
vga666.dtbo \
w1-gpio.dtbo \
w1-gpio-pullup.dtbo \
wittypi.dtbo
wittypi.dtbo \
mpu6050.dtbo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the other entries are in strict alphabetical order - please do the same. As well as being tidy and logical it helps to avoid merge conflicts.

compatible = "invensense,mpu6050";
reg = <0x68>;
interrupt-parent = <&gpio>;
interrupts = <4 1>;
};
};
};

__overrides__ {
mpu6050_interrupt_pin = <&mpu6050>,"interrupts:0";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to qualify the parameter name with the device name - the parameters exposed by an overlay are only in scope until the next overlay is loaded, so it is safe to have multiple overlays all using the same parameter names. Other overlays have used interrupt or int_pin.

status = "okay";
clock-frequency = <400000>;

inv-mpu6050@68 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the inv- prefix adds anything - the dtbindings documentation just uses mpu6050@68.

@@ -1171,6 +1171,8 @@ CONFIG_IIO=m
CONFIG_IIO_BUFFER=y
CONFIG_IIO_BUFFER_CB=m
CONFIG_IIO_KFIFO_BUF=m
CONFIG_INV_MPU6050_IIO=m
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't what savedefconfig generates - I get:

index 9164668..575cf99 100644
--- a/arch/arm/configs/bcm2709_defconfig
+++ b/arch/arm/configs/bcm2709_defconfig
@@ -1171,15 +1171,12 @@ CONFIG_RASPBERRYPI_POWER=y
 CONFIG_EXTCON=m
 CONFIG_EXTCON_ARIZONA=m
 CONFIG_IIO=m
-CONFIG_IIO_BUFFER=y
 CONFIG_IIO_BUFFER_CB=m
-CONFIG_IIO_KFIFO_BUF=m
-CONFIG_INV_MPU6050_IIO=m
-CONFIG_INV_MPU6050_I2C=m
 CONFIG_MCP320X=m
 CONFIG_MCP3422=m
 CONFIG_DHT11=m
 CONFIG_HTU21=m
+CONFIG_INV_MPU6050_I2C=m
 CONFIG_BMP280=m
 CONFIG_PWM_BCM2835=m

Setting INV_MPU6050_I2C is enough to imply INV_MPU6050_IIO, IIO_BUFFER and IIO_KFIFO_BUF. The order in the Kconfig files determines where they should go.

Using make ARCH=arm savedefconfig minimises the number of changes, and prevents others encountering spurious differences when they subsequently use the same mechanism themselves.

Copy link
Contributor

@pelwell pelwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • clicked the wrong option *

@T0ny0
Copy link
Author

T0ny0 commented May 23, 2017

Add fixes according to your comments

@pelwell
Copy link
Contributor

pelwell commented May 23, 2017

Somehow I think you missed out bcmrpi_defconfig in your commits. If you could also change the node name from inv-mpu6050@68 to mpu6050@68 I would be happier, but I'm not going to demand it because it is only cosmetic.

@pelwell pelwell merged commit 3f9f516 into raspberrypi:rpi-4.9.y May 23, 2017
@pelwell
Copy link
Contributor

pelwell commented May 23, 2017

Merged.

FYI you can also put parameters on the same line, e.g.

dtoverlay=mpu6050,interrupt=<gpio_num>

popcornmix pushed a commit that referenced this pull request May 24, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix added a commit to raspberrypi/firmware that referenced this pull request May 26, 2017
kernel: dwc_otg: make periodic scheduling behave properly for FS buses
See: raspberrypi/linux#2020

kernel: HID: usbhid: extend polling interval configuration to joysticks
See: raspberrypi/linux#2036

kernel: clk: bcm2835: Minimise clock jitter for PCM clock
See: raspberrypi/linux#2016

kernel: Add mpu6050 device tree overlay
See: raspberrypi/linux#2031

kernel: config: Add CONFIG_IPV6_SIT_6RD
See: raspberrypi/linux#1598

kernel: config: Add CONFIG_IPV6_ROUTE_INFO
See: raspberrypi/linux#1957
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this pull request May 26, 2017
kernel: dwc_otg: make periodic scheduling behave properly for FS buses
See: raspberrypi/linux#2020

kernel: HID: usbhid: extend polling interval configuration to joysticks
See: raspberrypi/linux#2036

kernel: clk: bcm2835: Minimise clock jitter for PCM clock
See: raspberrypi/linux#2016

kernel: Add mpu6050 device tree overlay
See: raspberrypi/linux#2031

kernel: config: Add CONFIG_IPV6_SIT_6RD
See: raspberrypi/linux#1598

kernel: config: Add CONFIG_IPV6_ROUTE_INFO
See: raspberrypi/linux#1957
pelwell pushed a commit that referenced this pull request Jul 10, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
pelwell pushed a commit that referenced this pull request Jul 10, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Jul 12, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Jul 13, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Jul 13, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Jul 16, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Jul 16, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Jul 17, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Jul 21, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Jul 21, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Jul 27, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Jul 29, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Aug 1, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Aug 8, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Aug 8, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Aug 10, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Aug 13, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Aug 13, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Aug 14, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Aug 23, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Aug 23, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Aug 25, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Aug 30, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Sep 1, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Sep 4, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Sep 8, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Sep 13, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Sep 13, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Sep 14, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Sep 14, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
@T0ny0 T0ny0 deleted the mpu6050_dtoverlay branch September 15, 2017 20:50
@T0ny0 T0ny0 restored the mpu6050_dtoverlay branch September 15, 2017 20:54
popcornmix pushed a commit that referenced this pull request Sep 22, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
popcornmix pushed a commit that referenced this pull request Oct 29, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
ryncsn pushed a commit to ryncsn/linux-rasp that referenced this pull request Nov 21, 2017
Add overlay and config options for InvenSense MPU6050 6-axis motion
detector.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants