Commit 2d48dbdf authored by Patrik Dahlström's avatar Patrik Dahlström Committed by Jonathan Cameron

iio: adc: palmas: move eventX_enable into palmas_adc_event

It just makes more sense to have all information regarding adc events in
one place.
Signed-off-by: default avatarPatrik Dahlström <risca@dalakolonin.se>
Link: https://lore.kernel.org/r/20230408114825.824505-7-risca@dalakolonin.seSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 7501a3a9
......@@ -77,6 +77,7 @@ static struct palmas_gpadc_info palmas_gpadc_info[] = {
};
struct palmas_adc_event {
bool enabled;
int channel;
int raw_thresh;
enum iio_event_direction direction;
......@@ -119,8 +120,6 @@ struct palmas_gpadc {
struct completion conv_completion;
struct palmas_adc_event event0;
struct palmas_adc_event event1;
bool event0_enable;
bool event1_enable;
int auto_conversion_period;
struct mutex lock;
};
......@@ -617,7 +616,7 @@ static int palmas_adc_configure_events(struct palmas_gpadc *adc)
}
conv = 0;
if (adc->event0_enable) {
if (adc->event0.enabled) {
struct palmas_adc_event *ev = &adc->event0;
int polarity;
......@@ -653,7 +652,7 @@ static int palmas_adc_configure_events(struct palmas_gpadc *adc)
}
}
if (adc->event1_enable) {
if (adc->event1.enabled) {
struct palmas_adc_event *ev = &adc->event1;
int polarity;
......@@ -728,7 +727,7 @@ static int palmas_gpadc_suspend(struct device *dev)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct palmas_gpadc *adc = iio_priv(indio_dev);
int wakeup = adc->event0_enable || adc->event1_enable;
int wakeup = adc->event0.enabled || adc->event1.enabled;
int ret;
if (!device_may_wakeup(dev) || !wakeup)
......@@ -738,10 +737,10 @@ static int palmas_gpadc_suspend(struct device *dev)
if (ret < 0)
return ret;
if (adc->event0_enable)
if (adc->event0.enabled)
enable_irq_wake(adc->irq_auto_0);
if (adc->event1_enable)
if (adc->event1.enabled)
enable_irq_wake(adc->irq_auto_1);
return 0;
......@@ -751,7 +750,7 @@ static int palmas_gpadc_resume(struct device *dev)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct palmas_gpadc *adc = iio_priv(indio_dev);
int wakeup = adc->event0_enable || adc->event1_enable;
int wakeup = adc->event0.enabled || adc->event1.enabled;
int ret;
if (!device_may_wakeup(dev) || !wakeup)
......@@ -761,10 +760,10 @@ static int palmas_gpadc_resume(struct device *dev)
if (ret < 0)
return ret;
if (adc->event0_enable)
if (adc->event0.enabled)
disable_irq_wake(adc->irq_auto_0);
if (adc->event1_enable)
if (adc->event1.enabled)
disable_irq_wake(adc->irq_auto_1);
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment