Parse how to add the gsensor Driver (MMA7660) to android)

Source: Internet
Author: User

The system used the gsensor of BOSCH_BMA222 and now requires MMA7660. Let's take a look at how to increase the driver and debug process.
1. Modify Makefie
First, modify the Makefile (kernel/driver/misc) in the directory where the driver is placed, and add the following statement: Copy codeThe Code is as follows: obj-$ (CONFIG_SENSORS_MMA7660) + = mma7660.o

2. Add driver files
Add the driver file mma7660.c to kernel/driver/misc.
3. Modify the. config file and comment out the following two lines.
Copy codeThe Code is as follows: # CONFIG_BOSCH_SENSOR = y
# CONFIG_BOSCH_BMA222 = y

Add the following
Copy codeThe Code is as follows: CONFIG_SENSORS_MMA7660 = y

Compile and display the following prompt:
Copy codeThe Code is as follows: make uImage-j16
Scripts/kconfig/conf-s arch/arm/Kconfig
*
* Restart config...
*
*
* Misc devices
*
Misc devices (MISC_DEVICES) [Y/n/?] Y
Analog Devices AD525x Digital Potentiometers (AD525X_DPOT) [N/m/y/?] N
Android pmem allocator (ANDROID_PMEM) [N/y] n
Integrated Circuits ICS932S401 (ICS932S401) [N/m/y/?] N
Enclosure Services (ENCLOSURE_SERVICES) [N/m/y/?] N
Kernel Debugger Core (KERNEL_DEBUGGER_CORE) [N/y/?] N
Intersil ISL29003 ambient light sensor (ISL29003) [N/m/y/?] N
Taos TSL2550 ambient light sensor (SENSORS_TSL2550) [N/m/y/?] N
Dallas DS1682 Total Elapsed Time Recorder with Alarm (DS1682) [N/m/y/?] N
Texas Instruments DAC7512 (TI_DAC7512) [N/m/y/?] N
UID based statistics tracking exported to/proc/uid_stat (UID_STAT) [Y/n] y
Bluetooth power control driver for TI wlw.x (wlw.x_rfkill) [N/m/y/?] N
Android kernel panic diagnostics driver (APANIC) [N/y/?] N
6 Axis sensor mpu3050 (SIX_AXIS_SENSOR_MPU3050) [N/y] n
Motion Processing Unit driver version
> 1. MPU version <v3.4.0 (MPU_PRE_V340)
2. MPU version> = v3.4.0 (MPU_NEW)
Choice [1-2]: 1
BOSCH BMA222 acceleration sensor (BOSCH_SENSOR) [N/m/y/?] (NEW) N
*
* Miscellaneous I2C Chip support
*
BMA222 acceleration sensor support (BOSCH_BMA222) [N/m/y/?] (NEW) N
#
# Configuration written to. config

In this case, the system does not compile mma7660.c, and the macro of. config MMA7660 is overwritten after compilation. Therefore, there is no way to mount it. The reason for this error is that make checks the various Kconfig files and does not have the option to automatically fail. Therefore, we also need to modify the Kconfig file.
5. Modify kernel/driver/misc/Kconfig and add the following content under menuconfig MISC_DEVICES:
Copy codeThe Code is as follows: config SENSORS_MMA7660
Tristate "MEMSIC Accelerometer Sensor MMA7660 Driver Support"
Depends on I2C
Help
If you say yes here you get support for the MEMSIC accelerometer sensor

6. Because gsensor is an i2c plug-in, you must modify the i2c device information of the board so that the system can find the device. Modify the Board's resource file (my special case here is./arch/arm/mach-meson3/board-m3-reff24.c), add the information in the structure aml_i2c_bus_info_1:
Copy codeThe Code is as follows: # ifdef CONFIG_SENSORS_MMA7660
{
I2C_BOARD_INFO ("mma7660", 0x4C ),
. Irq = int_gpio2,
},
# Endif

7. Compile the driver.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.