/* must be called with priv->lock held */ static void img_ir_refresh_raw(struct img_ir_priv *priv, u32 irq_status) { struct img_ir_priv_raw *raw = &priv->raw; struct rc_dev *rc_dev = priv->raw.rdev; int multiple; u32 ir_status; /* find whether both rise and fall was detected */ multiple = ((irq_status & IMG_IR_IRQ_EDGE) == IMG_IR_IRQ_EDGE); /* * If so, we need to see if the level has actually changed. * If it's just noise that we didn't have time to process, * there's no point reporting it. */ ir_status = img_ir_read(priv, IMG_IR_STATUS) & IMG_IR_IRRXD; if (multiple && ir_status == raw->last_status) return; raw->last_status = ir_status; /* report the edge to the IR raw decoders */ if (ir_status) /* low */ ir_raw_event_store_edge(rc_dev, IR_SPACE); else /* high */ ir_raw_event_store_edge(rc_dev, IR_PULSE); ir_raw_event_handle(rc_dev); }
static irqreturn_t gpio_ir_recv_irq(int irq, void *dev_id) { struct gpio_rc_dev *gpio_dev = dev_id; int gval; int rc = 0; enum raw_event_type type = IR_SPACE; gval = gpio_get_value_cansleep(gpio_dev->gpio_nr); if (gval < 0) goto err_get_value; if (gpio_dev->active_low) gval = !gval; if (gval == 1) type = IR_PULSE; rc = ir_raw_event_store_edge(gpio_dev->rcdev, type); if (rc < 0) goto err_get_value; ir_raw_event_handle(gpio_dev->rcdev); err_get_value: return IRQ_HANDLED; }
static irqreturn_t gpio_ir_recv_irq(int irq, void *dev_id) { int val; struct gpio_rc_dev *gpio_dev = dev_id; val = gpiod_get_value(gpio_dev->gpiod); if (val >= 0) ir_raw_event_store_edge(gpio_dev->rcdev, val == 1); return IRQ_HANDLED; }
static int saa716x_ir_raw_decode_irq(struct saa716x_dev *saa716x) { struct saa716x_ir *ir = saa716x->ir; unsigned long timeout; int space; /* key event */ space = SAA716x_EPRD(GPIO, GPIO_RD) & ir->mask_keyevent; ir_raw_event_store_edge(saa716x->ir->rc, space ? IR_SPACE : IR_PULSE); /* 15ms wait time before start processing the first event */ if (!ir->active) { timeout = jiffies + msecs_to_jiffies(15); mod_timer(&ir->timer, timeout); ir->active = true; } return 1; }
static irqreturn_t gpio_ir_recv_irq(int irq, void *dev_id) { struct gpio_rc_dev *gpio_dev = dev_id; unsigned int gval; int rc = 0; enum raw_event_type type = IR_SPACE; if (!gpio_dev->pm_qos_vote && gpio_dev->can_wakeup) { gpio_dev->pm_qos_vote = 1; pm_qos_update_request(&gpio_dev->pm_qos_req, gpio_dev->gpio_irq_latency); } if (gpio_dev->can_sleep) gval = gpio_get_value_cansleep(gpio_dev->gpio_nr); else gval = gpio_get_value(gpio_dev->gpio_nr); if (gval < 0) goto err_get_value; if (gpio_dev->active_low) gval = !gval; if (gval == 1) type = IR_PULSE; rc = ir_raw_event_store_edge(gpio_dev->rcdev, type); if (rc < 0) goto err_get_value; ir_raw_event_handle(gpio_dev->rcdev); if (gpio_dev->can_wakeup) mod_timer(&gpio_dev->gpio_ir_timer, jiffies + msecs_to_jiffies(gpio_ir_timeout)); err_get_value: return IRQ_HANDLED; }