فهرست منبع

Test für Beschleunigungssensor

Reinhard Russinger 8 سال پیش
والد
کامیت
5065e88451

+ 1 - 1
board/GfA/Display001/BUILD

@@ -1 +1 @@
-353
+355

+ 3 - 1
board/GfA/Display001/Display001_defconfig

@@ -1492,7 +1492,9 @@ CONFIG_INPUT_UINPUT=y
 # CONFIG_INPUT_PCF8574 is not set
 CONFIG_INPUT_PWM_BEEPER=m
 # CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set
-# CONFIG_INPUT_ADXL34X is not set
+CONFIG_INPUT_ADXL34X=m
+CONFIG_INPUT_ADXL34X_I2C=m
+CONFIG_INPUT_ADXL34X_SPI=m
 # CONFIG_INPUT_IMS_PCU is not set
 # CONFIG_INPUT_CMA3000 is not set
 

+ 17 - 1
board/GfA/Display001/Display001_rru.dts

@@ -155,6 +155,13 @@
 				0x19c 0x22      /* mcasp0_ahclkr.mcasp0_axr2, INPUT | MODE2 */
 			>;
 		};
+
+		adxl345_pins: pinmux_adxl345_pins {
+                        pinctrl-single,pins = <
+                               0x08c (PIN_INPUT | MUX_MODE7)  /* gpmc_clp gpio2.1 */
+				>;
+				};
+
 };
 
 &timer7 {
@@ -221,7 +228,6 @@
 		max_y = <768>;
         };
 
-
 	tlv320aic3x: tlv320aic3x@1b {
 		compatible = "ti,tlv320aic3x";
 		reg = <0x1b>;
@@ -233,6 +239,16 @@
 		reg = <0x51>;
 		status = "okay";
 	};
+
+	adxl345: adxl345@53 {
+		pinctrl-names = "default";
+		pinctrl-0 = <&adxl345_pins>;
+		compatible = "adi,adxl345";
+		reg = <0x53>;
+		interrupt-parent = <&gpio2>;
+		interrupts = <1 0>;
+	};
+
 };
 
 /include/ "tps65217.dtsi"

+ 139 - 0
board/GfA/Display001/linux_3.12.30/linux-019-backport-adlx34x.patch

@@ -0,0 +1,139 @@
+--- a/drivers/input/misc/adxl34x.c	2014-10-09 15:46:37.000000000 +0200
++++ b/drivers/input/misc/adxl34x.c	2017-03-07 23:38:30.979529031 +0100
+@@ -8,7 +8,6 @@
+  */
+ 
+ #include <linux/device.h>
+-#include <linux/init.h>
+ #include <linux/delay.h>
+ #include <linux/input.h>
+ #include <linux/interrupt.h>
+@@ -158,7 +157,7 @@
+ 
+ /* ORIENT ADXL346 only */
+ #define ADXL346_2D_VALID		(1 << 6)
+-#define ADXL346_2D_ORIENT(x)		(((x) & 0x3) >> 4)
++#define ADXL346_2D_ORIENT(x)		(((x) & 0x30) >> 4)
+ #define ADXL346_3D_VALID		(1 << 3)
+ #define ADXL346_3D_ORIENT(x)		((x) & 0x7)
+ #define ADXL346_2D_PORTRAIT_POS		0	/* +X */
+@@ -714,7 +713,7 @@
+ 
+ 	ac->fifo_delay = fifo_delay_default;
+ 
+-	pdata = dev->platform_data;
++	pdata = dev_get_platdata(dev);
+ 	if (!pdata) {
+ 		dev_dbg(dev,
+ 			"No platform data: Using default initialization\n");
+--- a/drivers/input/misc/adxl34x-i2c.c	2014-10-09 15:46:37.000000000 +0200
++++ b/drivers/input/misc/adxl34x-i2c.c	2017-03-07 23:41:19.574002400 +0100
+@@ -6,10 +6,11 @@
+  * Copyright (C) 2009 Michael Hennerich, Analog Devices Inc.
+  * Licensed under the GPL-2 or later.
+  */
+-
++ 
+ #include <linux/input.h>	/* BUS_I2C */
+ #include <linux/i2c.h>
+ #include <linux/module.h>
++#include <linux/of.h>
+ #include <linux/types.h>
+ #include <linux/pm.h>
+ #include "adxl34x.h"
+@@ -105,8 +106,7 @@
+ 	return adxl34x_remove(ac);
+ }
+ 
+-#ifdef CONFIG_PM_SLEEP
+-static int adxl34x_i2c_suspend(struct device *dev)
++static int __maybe_unused adxl34x_i2c_suspend(struct device *dev)
+ {
+ 	struct i2c_client *client = to_i2c_client(dev);
+ 	struct adxl34x *ac = i2c_get_clientdata(client);
+@@ -116,7 +116,7 @@
+ 	return 0;
+ }
+ 
+-static int adxl34x_i2c_resume(struct device *dev)
++static int __maybe_unused adxl34x_i2c_resume(struct device *dev)
+ {
+ 	struct i2c_client *client = to_i2c_client(dev);
+ 	struct adxl34x *ac = i2c_get_clientdata(client);
+@@ -125,7 +125,6 @@
+ 
+ 	return 0;
+ }
+-#endif
+ 
+ static SIMPLE_DEV_PM_OPS(adxl34x_i2c_pm, adxl34x_i2c_suspend,
+ 			 adxl34x_i2c_resume);
+@@ -137,11 +136,30 @@
+ 
+ MODULE_DEVICE_TABLE(i2c, adxl34x_id);
+ 
++#ifdef CONFIG_OF
++static const struct of_device_id adxl34x_of_id[] = {
++	/*
++	 * The ADXL346 is backward-compatible with the ADXL345. Differences are
++	 * handled by runtime detection of the device model, there's thus no
++	 * need for listing the "adi,adxl346" compatible value explicitly.
++	 */
++	{ .compatible = "adi,adxl345", },
++	/*
++	 * Deprecated, DT nodes should use one or more of the device-specific
++	 * compatible values "adi,adxl345" and "adi,adxl346".
++	 */
++	{ .compatible = "adi,adxl34x", },
++	{ }
++};
++
++MODULE_DEVICE_TABLE(of, adxl34x_of_id);
++#endif
++
+ static struct i2c_driver adxl34x_driver = {
+ 	.driver = {
+ 		.name = "adxl34x",
+-		.owner = THIS_MODULE,
+ 		.pm = &adxl34x_i2c_pm,
++		.of_match_table = of_match_ptr(adxl34x_of_id),
+ 	},
+ 	.probe    = adxl34x_i2c_probe,
+ 	.remove   = adxl34x_i2c_remove,
+--- a/drivers/input/misc/adxl34x-spi.c	2014-10-09 15:46:37.000000000 +0200
++++ b/drivers/input/misc/adxl34x-spi.c	2017-03-07 23:38:57.314666834 +0100
+@@ -94,8 +94,7 @@
+ 	return adxl34x_remove(ac);
+ }
+ 
+-#ifdef CONFIG_PM_SLEEP
+-static int adxl34x_spi_suspend(struct device *dev)
++static int __maybe_unused adxl34x_spi_suspend(struct device *dev)
+ {
+ 	struct spi_device *spi = to_spi_device(dev);
+ 	struct adxl34x *ac = spi_get_drvdata(spi);
+@@ -105,7 +104,7 @@
+ 	return 0;
+ }
+ 
+-static int adxl34x_spi_resume(struct device *dev)
++static int __maybe_unused adxl34x_spi_resume(struct device *dev)
+ {
+ 	struct spi_device *spi = to_spi_device(dev);
+ 	struct adxl34x *ac = spi_get_drvdata(spi);
+@@ -114,7 +113,6 @@
+ 
+ 	return 0;
+ }
+-#endif
+ 
+ static SIMPLE_DEV_PM_OPS(adxl34x_spi_pm, adxl34x_spi_suspend,
+ 			 adxl34x_spi_resume);
+@@ -122,7 +120,6 @@
+ static struct spi_driver adxl34x_driver = {
+ 	.driver = {
+ 		.name = "adxl34x",
+-		.owner = THIS_MODULE,
+ 		.pm = &adxl34x_spi_pm,
+ 	},
+ 	.probe   = adxl34x_spi_probe,