diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-12-07 05:45:00 -0500 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-12-08 08:11:09 -0500 |
commit | bb7f9d90a5c0c29885cc37418ae208118e04bd4f (patch) | |
tree | 46ad2308c20e4ef4880d557a885e8d648155a23b /drivers/iio/light | |
parent | c8231a9af8147f8a401fc55931ec44abfb937660 (diff) |
iio:cm36651: Convert to new event config interface
Switch the cm36651 driver to the new IIO event config interface as the old one
is going to be removed.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Beomho Seo <beomho.seo@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/light')
-rw-r--r-- | drivers/iio/light/cm36651.c | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/drivers/iio/light/cm36651.c b/drivers/iio/light/cm36651.c index 21df57130018..2a0eb8de3396 100644 --- a/drivers/iio/light/cm36651.c +++ b/drivers/iio/light/cm36651.c | |||
@@ -488,7 +488,11 @@ static int cm36651_write_raw(struct iio_dev *indio_dev, | |||
488 | } | 488 | } |
489 | 489 | ||
490 | static int cm36651_read_prox_thresh(struct iio_dev *indio_dev, | 490 | static int cm36651_read_prox_thresh(struct iio_dev *indio_dev, |
491 | u64 event_code, int *val) | 491 | const struct iio_chan_spec *chan, |
492 | enum iio_event_type type, | ||
493 | enum iio_event_direction dir, | ||
494 | enum iio_event_info info, | ||
495 | int *val, int *val2) | ||
492 | { | 496 | { |
493 | struct cm36651_data *cm36651 = iio_priv(indio_dev); | 497 | struct cm36651_data *cm36651 = iio_priv(indio_dev); |
494 | 498 | ||
@@ -498,7 +502,11 @@ static int cm36651_read_prox_thresh(struct iio_dev *indio_dev, | |||
498 | } | 502 | } |
499 | 503 | ||
500 | static int cm36651_write_prox_thresh(struct iio_dev *indio_dev, | 504 | static int cm36651_write_prox_thresh(struct iio_dev *indio_dev, |
501 | u64 event_code, int val) | 505 | const struct iio_chan_spec *chan, |
506 | enum iio_event_type type, | ||
507 | enum iio_event_direction dir, | ||
508 | enum iio_event_info info, | ||
509 | int val, int val2) | ||
502 | { | 510 | { |
503 | struct cm36651_data *cm36651 = iio_priv(indio_dev); | 511 | struct cm36651_data *cm36651 = iio_priv(indio_dev); |
504 | struct i2c_client *client = cm36651->client; | 512 | struct i2c_client *client = cm36651->client; |
@@ -520,7 +528,10 @@ static int cm36651_write_prox_thresh(struct iio_dev *indio_dev, | |||
520 | } | 528 | } |
521 | 529 | ||
522 | static int cm36651_write_prox_event_config(struct iio_dev *indio_dev, | 530 | static int cm36651_write_prox_event_config(struct iio_dev *indio_dev, |
523 | u64 event_code, int state) | 531 | const struct iio_chan_spec *chan, |
532 | enum iio_event_type type, | ||
533 | enum iio_event_direction dir, | ||
534 | int state) | ||
524 | { | 535 | { |
525 | struct cm36651_data *cm36651 = iio_priv(indio_dev); | 536 | struct cm36651_data *cm36651 = iio_priv(indio_dev); |
526 | int cmd, ret = -EINVAL; | 537 | int cmd, ret = -EINVAL; |
@@ -536,7 +547,9 @@ static int cm36651_write_prox_event_config(struct iio_dev *indio_dev, | |||
536 | } | 547 | } |
537 | 548 | ||
538 | static int cm36651_read_prox_event_config(struct iio_dev *indio_dev, | 549 | static int cm36651_read_prox_event_config(struct iio_dev *indio_dev, |
539 | u64 event_code) | 550 | const struct iio_chan_spec *chan, |
551 | enum iio_event_type type, | ||
552 | enum iio_event_direction dir) | ||
540 | { | 553 | { |
541 | struct cm36651_data *cm36651 = iio_priv(indio_dev); | 554 | struct cm36651_data *cm36651 = iio_priv(indio_dev); |
542 | int event_en; | 555 | int event_en; |
@@ -559,12 +572,22 @@ static int cm36651_read_prox_event_config(struct iio_dev *indio_dev, | |||
559 | .channel2 = IIO_MOD_LIGHT_##_color, \ | 572 | .channel2 = IIO_MOD_LIGHT_##_color, \ |
560 | } \ | 573 | } \ |
561 | 574 | ||
575 | static const struct iio_event_spec cm36651_event_spec[] = { | ||
576 | { | ||
577 | .type = IIO_EV_TYPE_THRESH, | ||
578 | .dir = IIO_EV_DIR_EITHER, | ||
579 | .mask_separate = BIT(IIO_EV_INFO_VALUE) | | ||
580 | BIT(IIO_EV_INFO_ENABLE), | ||
581 | } | ||
582 | }; | ||
583 | |||
562 | static const struct iio_chan_spec cm36651_channels[] = { | 584 | static const struct iio_chan_spec cm36651_channels[] = { |
563 | { | 585 | { |
564 | .type = IIO_PROXIMITY, | 586 | .type = IIO_PROXIMITY, |
565 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | | 587 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | |
566 | BIT(IIO_CHAN_INFO_INT_TIME), | 588 | BIT(IIO_CHAN_INFO_INT_TIME), |
567 | .event_mask = IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_DIR_EITHER) | 589 | .event_spec = cm36651_event_spec, |
590 | .num_event_specs = ARRAY_SIZE(cm36651_event_spec), | ||
568 | }, | 591 | }, |
569 | CM36651_LIGHT_CHANNEL(RED, CM36651_LIGHT_CHANNEL_IDX_RED), | 592 | CM36651_LIGHT_CHANNEL(RED, CM36651_LIGHT_CHANNEL_IDX_RED), |
570 | CM36651_LIGHT_CHANNEL(GREEN, CM36651_LIGHT_CHANNEL_IDX_GREEN), | 593 | CM36651_LIGHT_CHANNEL(GREEN, CM36651_LIGHT_CHANNEL_IDX_GREEN), |
@@ -591,10 +614,10 @@ static const struct iio_info cm36651_info = { | |||
591 | .driver_module = THIS_MODULE, | 614 | .driver_module = THIS_MODULE, |
592 | .read_raw = &cm36651_read_raw, | 615 | .read_raw = &cm36651_read_raw, |
593 | .write_raw = &cm36651_write_raw, | 616 | .write_raw = &cm36651_write_raw, |
594 | .read_event_value = &cm36651_read_prox_thresh, | 617 | .read_event_value_new = &cm36651_read_prox_thresh, |
595 | .write_event_value = &cm36651_write_prox_thresh, | 618 | .write_event_value_new = &cm36651_write_prox_thresh, |
596 | .read_event_config = &cm36651_read_prox_event_config, | 619 | .read_event_config_new = &cm36651_read_prox_event_config, |
597 | .write_event_config = &cm36651_write_prox_event_config, | 620 | .write_event_config_new = &cm36651_write_prox_event_config, |
598 | .attrs = &cm36651_attribute_group, | 621 | .attrs = &cm36651_attribute_group, |
599 | }; | 622 | }; |
600 | 623 | ||