static ssize_t 
KXSD9_threshold_show(struct device *dev, struct device_attribute *attr, char *buf)
{
    ssize_t ret;
    unsigned short threshold ;
  
    trace_in();

    threshold = KXSD9_dev_get_threshold() ;

    debug("KXSD9_threshold: %d", threshold);
    ret = snprintf(buf, PAGE_SIZE, "%d\n", threshold );
 
    trace_out();
    return ret;
}
Esempio n. 2
0
static struct semaphore KXSD9_sem;

static atomic_t KXSD9_ref_count;
static struct early_suspend early_suspend ;
KXSD9_cal_t cal_data;

/***************************************************************/
KXSD9_module_param_t *KXSD9_main_getparam( void )
{
    return &KXSD9_module_param ;
}

static int KXSD9_new_data(KXSD9_acc_t *old, KXSD9_acc_t *new)
{
    int threshold = KXSD9_dev_get_threshold();
    if(abs(old->X_acc - new->X_acc) >= threshold || 
       abs(old->Y_acc - new->Y_acc) >= threshold)
        return 1;
    else
        return 0;
}

static int KXSD9_thread(void *arg)
{
    int ret;
    KXSD9_acc_t acc_val;
    int wait_ms;
    KXSD9_status_t *p;
    DEFINE_WAIT(wait);