Example #1
0
void s3c_config_wakeup_gpio(void)
{
	unsigned char reg_buff = 0;
	if (Get_MAX8698_PM_REG(ELDO5, &reg_buff)) {
		pr_info("%s: VMMC 3.0V (%d)\n", __func__, reg_buff);
		if (!reg_buff)
			Set_MAX8698_PM_REG(ELDO5, 1);
	}
	print_gpios();
}
Example #2
0
File: main.c Project: 8/gpio-poll
/* function that keeps reading the gpios in a tight loop and prints detected changes */
static void enter_read_gpios_loop(int base, int count, int states[MAX_GPIO_COUNT], char filenames[][MAX_FILENAME_LENGTH])
{
  int readcount = 0;
  while (1)
  {
    readcount++;

    /* keep polling the states of the gpios and print them if they change */
    if (read_gpios(count, states, filenames))
    {
      printf("%i * %i gpios polled before change occurred\n", readcount, count);
      readcount = 0;
      print_gpios(base, count, states);
    }
  }
}
Example #3
0
void s3c_config_sleep_gpio(void)
{	
	int spcon_val;
	printk("s3c_config_sleep_gpio");
	check_pmic();
	s3c_config_gpio_table(ARRAY_SIZE(omnia_II_sleep_gpio_table),
	omnia_II_sleep_gpio_table);
	print_gpios();

	spcon_val = __raw_readl(S3C64XX_SPCON);
	spcon_val = spcon_val & (~0xFFEC0000);
	__raw_writel(spcon_val, S3C64XX_SPCON);
	__raw_writel(0x20, S3C64XX_SPCONSLP);

	/* mem interface reg config in sleep mode */
	__raw_writel(0x00005000, S3C64XX_MEM0CONSLP0);
	__raw_writel(0x01041595, S3C64XX_MEM0CONSLP1);
	__raw_writel(0x10055000, S3C64XX_MEM1CONSLP);

}
Example #4
0
File: main.c Project: 8/gpio-poll
/* main entry point */
int main(int argc, char *argv[])
{
  int ret;

  /* init the default settings */
  struct settings_t settings;
  settings.gpio_base  = 55;
  settings.gpio_count = MAX_GPIO_COUNT;
  settings.loop       = 0;
  settings.poll       = 0;
  settings.poll_timeout = -1;

  print_info();
  
  /* parse the cmdline arguments */
  handle_parameters(argc, argv, &settings);

  /* initialize the gpio file names */
  init_gpio_filenames(settings.gpio_base, settings.gpio_count, settings.gpio_filenames);

  /* read the gpios */
  read_gpios(settings.gpio_count, settings.gpio_states, settings.gpio_filenames);

  /* print the states of the gpios */
  printf("initial values:\n");
  print_gpios(settings.gpio_base, settings.gpio_count, settings.gpio_states);
  printf("\n");

  /* keep reading gpios cpu intensive in a tight loop */
  if (settings.loop)
    enter_read_gpios_loop(settings.gpio_base, settings.gpio_count, settings.gpio_states, settings.gpio_filenames);

  /* poll the gpios once */
  if (settings.poll)
  {
    init_gpio_edges(settings.gpio_base, settings.gpio_count, settings.gpio_edge_filenames);
    if (read_edges(settings.gpio_count, settings.gpio_edge_values, settings.gpio_edge_filenames))
      if (validate_edges(settings.gpio_base, settings.gpio_count, settings.gpio_edge_values))
        enter_poll_gpios(settings.gpio_base, settings.gpio_count, settings.poll_timeout, settings.gpio_states, settings.gpio_filenames);
  }
}
Example #5
0
File: main.c Project: 8/gpio-poll
static void enter_poll_gpios(int base, int count, int timeout, int states[MAX_GPIO_COUNT], char filenames[][MAX_FILENAME_LENGTH])
{
  int ret;

  printf("waiting for interrupt on the gpios...\n");
  ret = poll_gpios(count, filenames, timeout);
  if (ret == -1)
    printf("timeout occurred\n");
  else if (ret == -2)
    printf("error occurred\n");
  else if (ret == -3)
    printf("unknown reason");
  else
  {
    printf("gpio %i changed\n", base + ret);

    /* update and show the new gpio states */
    read_gpios(count, states, filenames);
    print_gpios(base, count, states);
  }

}