Lines Matching defs:channel

81  * These macros return the address of the first reg for the given channel.
90 * The hysteresis for a channel is stored in the same register where the
115 /* Bitmask of disabled events (for rate limiting) for each channel. */
365 if (chan->channel >= BD79124_MAX_NUM_CHANNELS)
371 *val = data->alarm_r_limit[chan->channel];
373 *val = data->alarm_f_limit[chan->channel];
380 reg = BD79124_GET_HYSTERESIS_REG(chan->channel);
411 * the list of the measured channels to ensure the new channel
451 /* Clear the channel from the measured channels */
460 * channel.
483 if (chan->channel >= BD79124_MAX_NUM_CHANNELS)
486 return !!(data->alarm_monitored[chan->channel] & BIT(dir));
490 enum iio_event_direction dir, int channel)
503 reg = BD79124_GET_HIGH_LIMIT_REG(channel);
506 reg = BD79124_GET_LOW_LIMIT_REG(channel);
512 data->alarm_monitored[channel] &= ~dir_bit;
519 if (!data->alarm_monitored[channel]) {
520 bd79124_stop_measurement(data, channel);
522 BIT(channel));
530 unsigned int channel)
537 ret = bd79124_start_measurement(data, channel);
541 data->alarm_monitored[channel] |= dir_bit;
543 /* Add the channel to the list of monitored channels */
544 ret = regmap_set_bits(data->map, BD79124_REG_ALERT_CH_SEL, BIT(channel));
549 limit = &data->alarm_f_limit[channel];
550 reg = BD79124_GET_HIGH_LIMIT_REG(channel);
552 limit = &data->alarm_f_limit[channel];
553 reg = BD79124_GET_LOW_LIMIT_REG(channel);
560 if (!(data->alarm_suppressed[channel] & dir_bit)) {
585 if (chan->channel >= BD79124_MAX_NUM_CHANNELS)
589 return bd79124_enable_event(data, dir, chan->channel);
591 return bd79124_disable_event(data, dir, chan->channel);
604 if (chan->channel >= BD79124_MAX_NUM_CHANNELS)
613 data->alarm_r_limit[chan->channel] = val;
614 reg = BD79124_GET_HIGH_LIMIT_REG(chan->channel);
616 data->alarm_f_limit[chan->channel] = val;
617 reg = BD79124_GET_LOW_LIMIT_REG(chan->channel);
626 if (!(data->alarm_monitored[chan->channel] & BIT(dir)) ||
627 data->alarm_suppressed[chan->channel] & BIT(dir))
633 reg = BD79124_GET_HYSTERESIS_REG(chan->channel);
654 * cache the old config and return it when the single channel
694 if (chan->channel >= BD79124_MAX_NUM_CHANNELS)
716 ret = bd79124_single_chan_seq(data, chan->channel, &old_chan_cfg);
724 BD79124_GET_RECENT_RES_REG(chan->channel), val);
756 static void bd79124_re_enable_lo(struct bd79124_data *data, unsigned int channel)
764 if (!(data->alarm_suppressed[channel] & evbit))
767 data->alarm_suppressed[channel] &= ~evbit;
769 if (!(data->alarm_monitored[channel] & evbit))
772 ret = bd79124_write_int_to_reg(data, BD79124_GET_LOW_LIMIT_REG(channel),
773 data->alarm_f_limit[channel]);
775 dev_warn(data->dev, "Low limit enabling failed for channel%d\n",
776 channel);
779 static void bd79124_re_enable_hi(struct bd79124_data *data, unsigned int channel)
787 if (!(data->alarm_suppressed[channel] & evbit))
790 data->alarm_suppressed[channel] &= ~evbit;
792 if (!(data->alarm_monitored[channel] & evbit))
795 ret = bd79124_write_int_to_reg(data, BD79124_GET_HIGH_LIMIT_REG(channel),
796 data->alarm_r_limit[channel]);
798 dev_warn(data->dev, "High limit enabling failed for channel%d\n",
799 channel);
839 unsigned int channel)
842 data->alarm_suppressed[channel] |= BIT(IIO_EV_DIR_RISING);
845 BD79124_GET_HIGH_LIMIT_REG(channel),
850 unsigned int channel)
853 data->alarm_suppressed[channel] |= BIT(IIO_EV_DIR_FALLING);
856 BD79124_GET_LOW_LIMIT_REG(channel),
899 * Disable the event for the channel and schedule the
940 static int bd79124_chan_init(struct bd79124_data *data, int channel)
944 ret = regmap_write(data->map, BD79124_GET_HIGH_LIMIT_REG(channel),
949 return regmap_write(data->map, BD79124_GET_LOW_LIMIT_REG(channel),
964 gpio_channels &= ~BIT(cs[i].channel);