int tlmm_dump_info(char* buf, int tlmm_num) { unsigned i; char* p = buf; unsigned cfg; int output_val = 0; if(tlmm_num >= 0 && tlmm_num < TLMM_NUM_GPIO) { tlmm_get_cfg(tlmm_num, &cfg); output_val = __msm_gpio_get_inout(tlmm_num); p += tlmm_dump_cfg(p, tlmm_num, cfg, output_val); } else { p += tlmm_dump_header(p); p += sprintf(p, "Format: gpio_num function pull direction strength [output_value]\n"); p += sprintf(p, " e.g. 'echo 20 0 D O 2 1' ==> set pin 20 as GPIO output and the output = 1 \n"); printk("%s(), %d\n", __func__, __LINE__); for(i = 0; i < TLMM_NUM_GPIO; ++i) { tlmm_get_cfg(i, &cfg); output_val = __msm_gpio_get_inout(i); p += tlmm_dump_cfg(p, i, cfg, output_val); } printk("%s(), %d\n", __func__, __LINE__); p+= sprintf(p, "(%d)\n", p - buf); // only for debug reference } return p - buf; }
static ssize_t tlmm_sim_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { char *p = buf; int output_val = 0; output_val = __msm_gpio_get_inout(TLMM_GPIO_SIM); p += sprintf(p, "%d", output_val); return (p - buf); }
void tlmm_before_sleep_save_configs(void) { unsigned i; //only save tlmm configs when it has been fetched if (!before_sleep_fetched) return; printk("%s(), before_sleep_fetched=%d\n", __func__, before_sleep_fetched); before_sleep_fetched = false; for(i = 0; i < TLMM_NUM_GPIO; ++i) { unsigned cfg; int output_val = 0; tlmm_get_cfg(i, &cfg); output_val = __msm_gpio_get_inout(i); before_sleep_configs[i] = cfg | (output_val << 30); } }