forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/iio/adc/vf610_adc.c
....@@ -1,21 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Freescale Vybrid vf610 ADC driver
34 *
45 * Copyright 2013 Freescale Semiconductor, Inc.
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
196 */
207
218 #include <linux/module.h>
....@@ -741,12 +728,7 @@
741728 {
742729 struct vf610_adc *info = iio_priv(indio_dev);
743730 unsigned int channel;
744
- int ret;
745731 int val;
746
-
747
- ret = iio_triggered_buffer_postenable(indio_dev);
748
- if (ret)
749
- return ret;
750732
751733 val = readl(info->regs + VF610_REG_ADC_GC);
752734 val |= VF610_ADC_ADCON;
....@@ -778,7 +760,7 @@
778760
779761 writel(hc_cfg, info->regs + VF610_REG_ADC_HC0);
780762
781
- return iio_triggered_buffer_predisable(indio_dev);
763
+ return 0;
782764 }
783765
784766 static const struct iio_buffer_setup_ops iio_triggered_buffer_setup_ops = {
....@@ -819,7 +801,6 @@
819801 {
820802 struct vf610_adc *info;
821803 struct iio_dev *indio_dev;
822
- struct resource *mem;
823804 int irq;
824805 int ret;
825806
....@@ -832,16 +813,13 @@
832813 info = iio_priv(indio_dev);
833814 info->dev = &pdev->dev;
834815
835
- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
836
- info->regs = devm_ioremap_resource(&pdev->dev, mem);
816
+ info->regs = devm_platform_ioremap_resource(pdev, 0);
837817 if (IS_ERR(info->regs))
838818 return PTR_ERR(info->regs);
839819
840820 irq = platform_get_irq(pdev, 0);
841
- if (irq < 0) {
842
- dev_err(&pdev->dev, "no irq resource?\n");
821
+ if (irq < 0)
843822 return irq;
844
- }
845823
846824 ret = devm_request_irq(info->dev, irq,
847825 vf610_adc_isr, 0,
....@@ -881,8 +859,6 @@
881859 init_completion(&info->completion);
882860
883861 indio_dev->name = dev_name(&pdev->dev);
884
- indio_dev->dev.parent = &pdev->dev;
885
- indio_dev->dev.of_node = pdev->dev.of_node;
886862 indio_dev->info = &vf610_adc_iio_info;
887863 indio_dev->modes = INDIO_DIRECT_MODE;
888864 indio_dev->channels = vf610_adc_iio_channels;