AnsweredAssumed Answered

mx53 and mc34708 wakeup

Question asked by alexeym on May 22, 2013
Latest reply on May 26, 2013 by alexeym

Hello all,


I've got custom mx53 board based on mx53 loco with mc34708 power and last 2.6.35 kernel from freescale git.

 

My MC34708  PMIC_INT connected to CSI0_DAT10 and muxed as gpio 5_28.

 

How to get power button to work?

 

AFAIK TZIC workaround needs to be used only for da9053 boards.

 

Some code below:

#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)

#define GPIO_BUTTON(gpio_num, ev_code, act_low, descr, wake) \

{ \

  .gpio = gpio_num, \

  .type = EV_KEY, \

  .code = ev_code, \

  .active_low = act_low, \

  .desc = "btn " descr, \

  .wakeup = wake, \

}

 

 

static struct gpio_keys_button loco_buttons[] = {

  GPIO_BUTTON(MX53_nONKEY, KEY_POWER, 1, "power", 0),

};

 

 

static struct gpio_keys_platform_data loco_button_data = {

  .buttons = loco_buttons,

  .nbuttons = ARRAY_SIZE(loco_buttons),

};

 

 

static struct platform_device loco_button_device = {

  .name = "gpio-keys",

  .id = -1,

  .num_resources  = 0,

  .dev = {

  .platform_data = &loco_button_data,

  }

};

 

 

static void __init loco_add_device_buttons(void)

{

  platform_device_register(&loco_button_device);

}

#else

static void __init loco_add_device_buttons(void) {}

#endif

 

 

static void mxc_register_powerkey(pwrkey_callback pk_cb)

{

  pmic_event_callback_t power_key_event;

 

 

   power_key_event.param = (void *)1;

  power_key_event.func = (void *)pk_cb;

  pmic_event_subscribe(EVENT_PWRONI, power_key_event);

}

 

 

static int mxc_pwrkey_getstatus(int id)

{

  int sense;

  pmic_read_reg(REG_INT_SENSE1, &sense, 0xffffffff);

  if (sense & (1 << 3))

       return 0;

  return 1;

}

 

 

static struct power_key_platform_data pwrkey_data = {

  .key_value = KEY_F4,

  .register_pwrkey = mxc_register_powerkey,

  .get_key_status = mxc_pwrkey_getstatus,

};

 

 

//-------- init

 

mc34708_int = MX53_PAD_CSI0_DAT10__GPIO5_28;

  mx53_loco_mc34708_irq = (4*32 + 28);

mxc_iomux_v3_setup_pad(mc34708_int);

  gpio_request(mx53_loco_mc34708_irq, "pmic-int");

  gpio_direction_input(mx53_loco_mc34708_irq);

  mx53_loco_init_mc34708(mx53_loco_mc34708_irq);

  dvfs_core_data.reg_id = "SW1A";

  tve_data.dac_reg = "VDAC";

  bus_freq_data.gp_reg_id = "SW1A";

  bus_freq_data.lp_reg_id = "SW2";

  mxc_register_device(&mxc_powerkey_device, &pwrkey_data);

  mxc_register_device(&pm_device, &loco_pm_data);

 

 

  loco_add_device_buttons();

I can wakeup board thru USB, but cannot use button.

I even can't check gpio thru terminal:

echo 156 > sys/class/gpio/export

-bash: echo: write error: Device or resource busy

 

What's wrong with my configuration?

Outcomes