rendered paste body****board-am335xevm.c****
#include <linux/input.h>
#include <linux/rotary_encoder.h>
/* rotary encoder structures EMEB */
#define ROT_ENC_A_PIN GPIO_TO_PIN(2, 2)
#define ROT_ENC_B_PIN GPIO_TO_PIN(2, 3)
static struct rotary_encoder_platform_data my_rotary_encoder_info = {
.steps = 24,
.axis = REL_DIAL,
.relative_axis = true,
.rollover = false,
.gpio_a = ROT_ENC_A_PIN,
.gpio_b = ROT_ENC_B_PIN,
.inverted_a = 0,
.inverted_b = 0,
.half_period = false,
};
static struct platform_device rotary_encoder_device = {
.name = "rotary-encoder",
.id = 1,
.dev = {
.platform_data = &my_rotary_encoder_info,
}
};
static struct pinmux_config rot_enc_pin_mux[] = {
{"gpmc_advn_ale.gpio2_2", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
{"gpmc_oen_ren.gpio2_3", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP},
{NULL, 0},
};
/* setup rotary encoder EMEB */
static void rot_enc_init(int evm_id, int profile)
{
pr_info("Setting up rotary encoder...\n");
/* Set mux, direction, pullup */
setup_pin_mux(rot_enc_pin_mux);
/* register device */
platform_device_register(&rotary_encoder_device);
pr_info("Done setting up rotary encoder.\n");
}
and also
****mux33xx.c****
_AM33XX_MUXENTRY(GPMC_ADVN_ALE, 0,
"gpmc_advn_ale", NULL, NULL, NULL,
NULL, NULL, NULL, "gpio2_2"),
_AM33XX_MUXENTRY(GPMC_OEN_REN, 0,
"gpmc_oen_ren", NULL, NULL, NULL,
NULL, NULL, NULL, "gpio2_3"),