/* proximity object detect */ static ssize_t px3215_show_object(struct device *dev, struct device_attribute *attr, char *buf) { struct input_dev *input = to_input_dev(dev); struct px3215_data *data = input_get_drvdata(input); return sprintf(buf, "%d\n", px3215_get_object(data->client,0)); }
static irqreturn_t px3215_irq(int irq, void *data_) { struct px3215_data *data = data_; int Pval; mutex_lock(&data->lock); Pval = px3215_get_object(data->client,1); printk("%s\n", Pval ? "obj near":"obj far"); input_report_abs(data->input, ABS_DISTANCE, !Pval); input_sync(data->input); px3215_set_intstat(data->client, 0x01); mutex_unlock(&data->lock); return IRQ_HANDLED; }