/*********************************************************************************** * Linux driver 板级文件跟踪一般方法 * 声明: * 1. 这是本人使用vim+ctags最常用的跟踪方法,也是唯一的方法; :) * 2. 本人已经在跟踪线上标注了跟踪序号,也就是先后循序; * 3. 就目前而言,这种方法貌似是通用的; * 4. 这个例子仅仅是简单的演示,并没有全部展开,如果想要进一步跟踪, * 继续跟就行了。 * 5. 源代码来自:myzr_android4_2_2_1_1_0.tar.bz2 * * 2015-6-12 晴 深圳 南山平山村 曾剑锋 **********************************************************************************/ cat arch/arm/mach-mx6/board-mx6q_sabresd.c ...... #define SABRESD_POWER_OFF IMX_GPIO_NR(3, 29) <--------------------------+ ...... | | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | #define GPIO_BUTTON(gpio_num, ev_code, act_low, descr, wake, debounce) \ <------+ | { \ | | .gpio = gpio_num, \ | | .type = EV_KEY, \ | | .code = ev_code, \ | | .active_low = act_low, \ | | .desc = "btn " descr, \ | | .wakeup = wake, \ ^ | .debounce_interval = debounce, \ | | } | | | | static struct gpio_keys_button new_sabresd_buttons[] = { <-----<-------+ | | //GPIO_BUTTON(SABRESD_VOLUME_UP, KEY_VOLUMEUP, 1, "volume-up", 0, 1), | | | //GPIO_BUTTON(SABRESD_VOLUME_DN, KEY_VOLUMEDOWN, 1, "volume-down", 0, 1), | | | GPIO_BUTTON(SABRESD_POWER_OFF, KEY_POWER, 1, "power-key", 1, 1), --6->----*--+ | }; ^-----------------------7-------------------------------*----+ | static struct gpio_keys_platform_data new_sabresd_button_data = { <-------+ | .buttons = new_sabresd_buttons, >-------5----->---------------*--+ .nbuttons = ARRAY_SIZE(new_sabresd_buttons), | }; | | static struct platform_device sabresd_button_device = { <--+ | .name = "gpio-keys", | | .id = -1, | ^ .num_resources = 0, | | }; | | | | static void __init imx6q_add_device_buttons(void) <-----*-------+ | { | | | platform_device_add_data(&sabresd_button_device, >--3-+ | | &new_sabresd_button_data, | | sizeof(new_sabresd_button_data)); >---4----------*-------+ | platform_device_register(&sabresd_button_device); | } | | | ...... ^ /*! | * Board specific initialization. | */ | static void __init mx6_sabresd_board_init(void) <------------<---*--------<-----+ { | | ...... | | imx6q_add_device_buttons(); ------>-------2------>-------------+ | ...... | } | | ...... | /* ^ * initialize __mach_desc_MX6Q_SABRESD data structure. | */ | MACHINE_START(MX6Q_SABRESD, "Freescale i.MX 6Quad/DualLite/Solo Sabre-SD Board") | /* Maintainer: Freescale Semiconductor, Inc. */ | .boot_params = MX6_PHYS_OFFSET + 0x100, | .fixup = fixup_mxc_board, | .map_io = mx6_map_io, | .init_irq = mx6_init_irq, | .init_machine = mx6_sabresd_board_init, ----->-------1------>------->--------+ .timer = &mx6_sabresd_timer, .reserve = mx6q_sabresd_reserve, MACHINE_END
时间: 2024-10-27 12:00:38