The system used to be the bosch_bma222 Gsensor, now requires to replace the use of MMA7660, we look at how to increase the drive and debugging process.
1. Modify Makefie
First, modify the makefile (KERNEL/DRIVER/MISC) in the placed driver directory to add the following statement:
Copy Code code as follows:
obj-$ (config_sensors_mma7660) + + MMA7660.O
2. Add driver files
Add the driver file mma7660.c to the Kernel/driver/misc.
3. Modify the. config file and comment out the following two lines
Copy Code code as follows:
# config_bosch_sensor=y
# config_bosch_bma222=y
Add the following
Copy Code code as follows:
compile, display prompt:
Copy Code code 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 wl127x (wl127x_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
Now look at the compiler output, the system does not compile MMA7660.C, and compiled. config's MMA7660 macros are also overwritten, so there is no way to mount them. The reason for this error is because make will check each kconfig file, no option will automatically rate, so we also need to modify the Kconfig file.
5. Modify the Kernel/driver/misc/kconfig and add the following under Menuconfig misc_devices:
Copy Code code as follows:
Config sensors_mma7660
TriState "Memsic Accelerometer Sensor MMA7660 Driver"
Depends on I2C
Help
If you say yes to support for the Memsic accelerometer sensor
6. Since Gsensor here is a I2C plug-in, it is also necessary to modify the I2C of the board device information so that the system can find equipment. Modify the Board's resource file (my special case here is./arch/arm/mach-meson3/board-m3-reff24.c), add the information to the structure aml_i2c_bus_info_1[]:
Copy Code code as follows:
#ifdef config_sensors_mma7660
{
I2c_board_info ("mma7660", 0x4c),
. IRQ = Int_gpio_2,
},
#endif
7. To compile again, the driver is compiled.