Re: [PATCH v3 3/5] iio: adc: sun4i-gpadc-iio: add support for H3 thermal sensor

2017-07-24 Thread kbuild test robot
Hi Icenowy,

[auto build test WARNING on robh/for-next]
[also build test WARNING on v4.13-rc2 next-20170724]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Icenowy-Zheng/IIO-based-thermal-sensor-driver-for-Allwinner-H3-SoC/20170725-035642
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:10:0,
from include/linux/clk.h:16,
from drivers/iio/adc/sun4i-gpadc-iio.c:25:
   drivers/iio/adc/sun4i-gpadc-iio.c: In function 'sun8i_h3_gpadc_sample_start':
   include/linux/bitops.h:6:19: warning: large integer implicitly truncated to 
unsigned type [-Woverflow]
#define BIT(nr)   (1UL << (nr))
  ^
>> include/linux/mfd/sun4i-gpadc.h:57:45: note: in expansion of macro 'BIT'
#define SUN8I_H3_GPADC_CTRL2_TEMP_SENSE_EN  BIT(0)
^~~
>> drivers/iio/adc/sun4i-gpadc-iio.c:414:8: note: in expansion of macro 
>> 'SUN8I_H3_GPADC_CTRL2_TEMP_SENSE_EN'
   SUN8I_H3_GPADC_CTRL2_TEMP_SENSE_EN |
   ^
--
   In file included from include/linux/kernel.h:10:0,
from include/linux/clk.h:16,
from drivers/iio//adc/sun4i-gpadc-iio.c:25:
   drivers/iio//adc/sun4i-gpadc-iio.c: In function 
'sun8i_h3_gpadc_sample_start':
   include/linux/bitops.h:6:19: warning: large integer implicitly truncated to 
unsigned type [-Woverflow]
#define BIT(nr)   (1UL << (nr))
  ^
>> include/linux/mfd/sun4i-gpadc.h:57:45: note: in expansion of macro 'BIT'
#define SUN8I_H3_GPADC_CTRL2_TEMP_SENSE_EN  BIT(0)
^~~
   drivers/iio//adc/sun4i-gpadc-iio.c:414:8: note: in expansion of macro 
'SUN8I_H3_GPADC_CTRL2_TEMP_SENSE_EN'
   SUN8I_H3_GPADC_CTRL2_TEMP_SENSE_EN |
   ^

vim +/BIT +57 include/linux/mfd/sun4i-gpadc.h

56  
  > 57  #define SUN8I_H3_GPADC_CTRL2_TEMP_SENSE_EN  BIT(0)
58  #define SUN8I_H3_GPADC_CTRL2_T_ACQ1(x)  ((GENMASK(15, 
0) * (x)) << 16)
59  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH v3 3/5] iio: adc: sun4i-gpadc-iio: add support for H3 thermal sensor

2017-07-24 Thread kbuild test robot
Hi Icenowy,

[auto build test WARNING on robh/for-next]
[also build test WARNING on v4.13-rc2 next-20170724]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Icenowy-Zheng/IIO-based-thermal-sensor-driver-for-Allwinner-H3-SoC/20170725-035642
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:10:0,
from include/linux/clk.h:16,
from drivers/iio/adc/sun4i-gpadc-iio.c:25:
   drivers/iio/adc/sun4i-gpadc-iio.c: In function 'sun8i_h3_gpadc_sample_start':
   include/linux/bitops.h:6:19: warning: large integer implicitly truncated to 
unsigned type [-Woverflow]
#define BIT(nr)   (1UL << (nr))
  ^
>> include/linux/mfd/sun4i-gpadc.h:57:45: note: in expansion of macro 'BIT'
#define SUN8I_H3_GPADC_CTRL2_TEMP_SENSE_EN  BIT(0)
^~~
>> drivers/iio/adc/sun4i-gpadc-iio.c:414:8: note: in expansion of macro 
>> 'SUN8I_H3_GPADC_CTRL2_TEMP_SENSE_EN'
   SUN8I_H3_GPADC_CTRL2_TEMP_SENSE_EN |
   ^
--
   In file included from include/linux/kernel.h:10:0,
from include/linux/clk.h:16,
from drivers/iio//adc/sun4i-gpadc-iio.c:25:
   drivers/iio//adc/sun4i-gpadc-iio.c: In function 
'sun8i_h3_gpadc_sample_start':
   include/linux/bitops.h:6:19: warning: large integer implicitly truncated to 
unsigned type [-Woverflow]
#define BIT(nr)   (1UL << (nr))
  ^
>> include/linux/mfd/sun4i-gpadc.h:57:45: note: in expansion of macro 'BIT'
#define SUN8I_H3_GPADC_CTRL2_TEMP_SENSE_EN  BIT(0)
^~~
   drivers/iio//adc/sun4i-gpadc-iio.c:414:8: note: in expansion of macro 
'SUN8I_H3_GPADC_CTRL2_TEMP_SENSE_EN'
   SUN8I_H3_GPADC_CTRL2_TEMP_SENSE_EN |
   ^

vim +/BIT +57 include/linux/mfd/sun4i-gpadc.h

56  
  > 57  #define SUN8I_H3_GPADC_CTRL2_TEMP_SENSE_EN  BIT(0)
58  #define SUN8I_H3_GPADC_CTRL2_T_ACQ1(x)  ((GENMASK(15, 
0) * (x)) << 16)
59  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH v3 3/5] iio: adc: sun4i-gpadc-iio: add support for H3 thermal sensor

2017-07-24 Thread kbuild test robot
Hi Icenowy,

[auto build test WARNING on robh/for-next]
[also build test WARNING on v4.13-rc2 next-20170724]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Icenowy-Zheng/IIO-based-thermal-sensor-driver-for-Allwinner-H3-SoC/20170725-035642
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: tile-allmodconfig (attached as .config)
compiler: tilegx-linux-gcc (GCC) 4.6.2
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=tile 

All warnings (new ones prefixed by >>):

   drivers/iio/adc/sun4i-gpadc-iio.c: In function 'sun8i_h3_gpadc_sample_start':
>> drivers/iio/adc/sun4i-gpadc-iio.c:415:8: warning: large integer implicitly 
>> truncated to unsigned type [-Woverflow]

vim +415 drivers/iio/adc/sun4i-gpadc-iio.c

   410  
   411  static int sun8i_h3_gpadc_sample_start(struct sun4i_gpadc_iio *info)
   412  {
   413  regmap_write(info->regmap, SUN8I_H3_GPADC_CTRL2,
   414   SUN8I_H3_GPADC_CTRL2_TEMP_SENSE_EN |
 > 415   SUN8I_H3_GPADC_CTRL2_T_ACQ1(31));
   416  regmap_write(info->regmap, SUN4I_GPADC_CTRL0,
   417   SUN4I_GPADC_CTRL0_T_ACQ(31));
   418  regmap_write(info->regmap, SUN8I_H3_GPADC_CTRL3,
   419   SUN4I_GPADC_CTRL3_FILTER_EN |
   420   SUN4I_GPADC_CTRL3_FILTER_TYPE(1));
   421  regmap_write(info->regmap, SUN8I_H3_GPADC_INTC,
   422   SUN8I_H3_GPADC_INTC_TEMP_PERIOD(800));
   423  
   424  return 0;
   425  }
   426  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH v3 3/5] iio: adc: sun4i-gpadc-iio: add support for H3 thermal sensor

2017-07-24 Thread kbuild test robot
Hi Icenowy,

[auto build test WARNING on robh/for-next]
[also build test WARNING on v4.13-rc2 next-20170724]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Icenowy-Zheng/IIO-based-thermal-sensor-driver-for-Allwinner-H3-SoC/20170725-035642
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: tile-allmodconfig (attached as .config)
compiler: tilegx-linux-gcc (GCC) 4.6.2
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=tile 

All warnings (new ones prefixed by >>):

   drivers/iio/adc/sun4i-gpadc-iio.c: In function 'sun8i_h3_gpadc_sample_start':
>> drivers/iio/adc/sun4i-gpadc-iio.c:415:8: warning: large integer implicitly 
>> truncated to unsigned type [-Woverflow]

vim +415 drivers/iio/adc/sun4i-gpadc-iio.c

   410  
   411  static int sun8i_h3_gpadc_sample_start(struct sun4i_gpadc_iio *info)
   412  {
   413  regmap_write(info->regmap, SUN8I_H3_GPADC_CTRL2,
   414   SUN8I_H3_GPADC_CTRL2_TEMP_SENSE_EN |
 > 415   SUN8I_H3_GPADC_CTRL2_T_ACQ1(31));
   416  regmap_write(info->regmap, SUN4I_GPADC_CTRL0,
   417   SUN4I_GPADC_CTRL0_T_ACQ(31));
   418  regmap_write(info->regmap, SUN8I_H3_GPADC_CTRL3,
   419   SUN4I_GPADC_CTRL3_FILTER_EN |
   420   SUN4I_GPADC_CTRL3_FILTER_TYPE(1));
   421  regmap_write(info->regmap, SUN8I_H3_GPADC_INTC,
   422   SUN8I_H3_GPADC_INTC_TEMP_PERIOD(800));
   423  
   424  return 0;
   425  }
   426  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH v3 3/5] iio: adc: sun4i-gpadc-iio: add support for H3 thermal sensor

2017-07-24 Thread Maxime Ripard
On Sun, Jul 23, 2017 at 10:13:52PM +0800, Icenowy Zheng wrote:
> This adds support for the Allwinner H3 thermal sensor.
> 
> Allwinner H3 has a thermal sensor like the one in A33, but have its
> registers nearly all re-arranged, sample clock moved to CCU and a pair
> of bus clock and reset added. It's also the base of newer SoCs' thermal
> sensors.
> 
> Some new options is added to gpadc_data struct, to mark the difference
> between the old GPADCs and THS's and the new THS's.
> 
> Thermal sampling via interrupts are still not supported, and polling
> is used instead.
> 
> The thermal sensors on A64 and H5 is like the one on H3, but with of
> course different formula factors.
> 
> Signed-off-by: Icenowy Zheng 

Could you split it in half? One patch that would rework the existing
code, the other one adding the H3 support?

That's going to be much easier to review, bisect and revert if need be
that way.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


signature.asc
Description: PGP signature


Re: [PATCH v3 3/5] iio: adc: sun4i-gpadc-iio: add support for H3 thermal sensor

2017-07-24 Thread Maxime Ripard
On Sun, Jul 23, 2017 at 10:13:52PM +0800, Icenowy Zheng wrote:
> This adds support for the Allwinner H3 thermal sensor.
> 
> Allwinner H3 has a thermal sensor like the one in A33, but have its
> registers nearly all re-arranged, sample clock moved to CCU and a pair
> of bus clock and reset added. It's also the base of newer SoCs' thermal
> sensors.
> 
> Some new options is added to gpadc_data struct, to mark the difference
> between the old GPADCs and THS's and the new THS's.
> 
> Thermal sampling via interrupts are still not supported, and polling
> is used instead.
> 
> The thermal sensors on A64 and H5 is like the one on H3, but with of
> course different formula factors.
> 
> Signed-off-by: Icenowy Zheng 

Could you split it in half? One patch that would rework the existing
code, the other one adding the H3 support?

That's going to be much easier to review, bisect and revert if need be
that way.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


signature.asc
Description: PGP signature


Re: [PATCH v3 3/5] iio: adc: sun4i-gpadc-iio: add support for H3 thermal sensor

2017-07-23 Thread Jonathan Cameron
On Sun, 23 Jul 2017 22:13:52 +0800
Icenowy Zheng  wrote:

> This adds support for the Allwinner H3 thermal sensor.
> 
> Allwinner H3 has a thermal sensor like the one in A33, but have its
> registers nearly all re-arranged, sample clock moved to CCU and a pair
> of bus clock and reset added. It's also the base of newer SoCs' thermal
> sensors.
> 
> Some new options is added to gpadc_data struct, to mark the difference
> between the old GPADCs and THS's and the new THS's.
> 
> Thermal sampling via interrupts are still not supported, and polling
> is used instead.
> 
> The thermal sensors on A64 and H5 is like the one on H3, but with of
> course different formula factors.
> 
> Signed-off-by: Icenowy Zheng 
Looks good to me. Just need to give Quentin time to look at it and
*fingers crossed* I should be able to pick up in a few days.

Jonathan 
> ---
> Changes in v3:
> - Clock name changes.
> - Fixed some small issues pointed out by Quentin.
> 
>  drivers/iio/adc/sun4i-gpadc-iio.c | 228 
> +++---
>  include/linux/mfd/sun4i-gpadc.h   |  27 +
>  2 files changed, 215 insertions(+), 40 deletions(-)
> 
> diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c 
> b/drivers/iio/adc/sun4i-gpadc-iio.c
> index 41769bc6a429..5c79ba4d5ef5 100644
> --- a/drivers/iio/adc/sun4i-gpadc-iio.c
> +++ b/drivers/iio/adc/sun4i-gpadc-iio.c
> @@ -22,6 +22,7 @@
>   * shutdown for not being used.
>   */
>  
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -31,6 +32,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -49,6 +51,8 @@ static unsigned int sun6i_gpadc_chan_select(unsigned int 
> chan)
>   return SUN6I_GPADC_CTRL1_ADC_CHAN_SELECT(chan);
>  }
>  
> +struct sun4i_gpadc_iio;
> +
>  struct gpadc_data {
>   int temp_offset;
>   int temp_scale;
> @@ -56,39 +60,12 @@ struct gpadc_data {
>   unsigned inttp_adc_select;
>   unsigned int(*adc_chan_select)(unsigned int chan);
>   unsigned intadc_chan_mask;
> -};
> -
> -static const struct gpadc_data sun4i_gpadc_data = {
> - .temp_offset = -1932,
> - .temp_scale = 133,
> - .tp_mode_en = SUN4I_GPADC_CTRL1_TP_MODE_EN,
> - .tp_adc_select = SUN4I_GPADC_CTRL1_TP_ADC_SELECT,
> - .adc_chan_select = _gpadc_chan_select,
> - .adc_chan_mask = SUN4I_GPADC_CTRL1_ADC_CHAN_MASK,
> -};
> -
> -static const struct gpadc_data sun5i_gpadc_data = {
> - .temp_offset = -1447,
> - .temp_scale = 100,
> - .tp_mode_en = SUN4I_GPADC_CTRL1_TP_MODE_EN,
> - .tp_adc_select = SUN4I_GPADC_CTRL1_TP_ADC_SELECT,
> - .adc_chan_select = _gpadc_chan_select,
> - .adc_chan_mask = SUN4I_GPADC_CTRL1_ADC_CHAN_MASK,
> -};
> -
> -static const struct gpadc_data sun6i_gpadc_data = {
> - .temp_offset = -1623,
> - .temp_scale = 167,
> - .tp_mode_en = SUN6I_GPADC_CTRL1_TP_MODE_EN,
> - .tp_adc_select = SUN6I_GPADC_CTRL1_TP_ADC_SELECT,
> - .adc_chan_select = _gpadc_chan_select,
> - .adc_chan_mask = SUN6I_GPADC_CTRL1_ADC_CHAN_MASK,
> -};
> -
> -static const struct gpadc_data sun8i_a33_gpadc_data = {
> - .temp_offset = -1662,
> - .temp_scale = 162,
> - .tp_mode_en = SUN8I_A23_GPADC_CTRL1_CHOP_TEMP_EN,
> + unsigned inttemp_data;
> + int (*sample_start)(struct sun4i_gpadc_iio *info);
> + int (*sample_end)(struct sun4i_gpadc_iio *info);
> + boolhas_bus_clk;
> + boolhas_bus_rst;
> + boolhas_mod_clk;
>  };
>  
>  struct sun4i_gpadc_iio {
> @@ -103,6 +80,9 @@ struct sun4i_gpadc_iio {
>   atomic_tignore_temp_data_irq;
>   const struct gpadc_data *data;
>   boolno_irq;
> + struct clk  *ths_bus_clk;
> + struct clk  *mod_clk;
> + struct reset_control*reset;
>   /* prevents concurrent reads of temperature and ADC */
>   struct mutexmutex;
>   struct thermal_zone_device  *tzd;
> @@ -276,7 +256,7 @@ static int sun4i_gpadc_temp_read(struct iio_dev 
> *indio_dev, int *val)
>   if (info->no_irq) {
>   pm_runtime_get_sync(indio_dev->dev.parent);
>  
> - regmap_read(info->regmap, SUN4I_GPADC_TEMP_DATA, val);
> + regmap_read(info->regmap, info->data->temp_data, val);
>  
>   pm_runtime_mark_last_busy(indio_dev->dev.parent);
>   pm_runtime_put_autosuspend(indio_dev->dev.parent);
> @@ -384,10 +364,8 @@ static irqreturn_t sun4i_gpadc_fifo_data_irq_handler(int 
> irq, void *dev_id)
>   return IRQ_HANDLED;
>  }
>  
> -static int sun4i_gpadc_runtime_suspend(struct device *dev)
> +static int sun4i_gpadc_sample_end(struct sun4i_gpadc_iio *info)
>  {
> - struct sun4i_gpadc_iio *info = iio_priv(dev_get_drvdata(dev));
> -
>   /* Disable the ADC on IP */
>   regmap_write(info->regmap, 

Re: [PATCH v3 3/5] iio: adc: sun4i-gpadc-iio: add support for H3 thermal sensor

2017-07-23 Thread Jonathan Cameron
On Sun, 23 Jul 2017 22:13:52 +0800
Icenowy Zheng  wrote:

> This adds support for the Allwinner H3 thermal sensor.
> 
> Allwinner H3 has a thermal sensor like the one in A33, but have its
> registers nearly all re-arranged, sample clock moved to CCU and a pair
> of bus clock and reset added. It's also the base of newer SoCs' thermal
> sensors.
> 
> Some new options is added to gpadc_data struct, to mark the difference
> between the old GPADCs and THS's and the new THS's.
> 
> Thermal sampling via interrupts are still not supported, and polling
> is used instead.
> 
> The thermal sensors on A64 and H5 is like the one on H3, but with of
> course different formula factors.
> 
> Signed-off-by: Icenowy Zheng 
Looks good to me. Just need to give Quentin time to look at it and
*fingers crossed* I should be able to pick up in a few days.

Jonathan 
> ---
> Changes in v3:
> - Clock name changes.
> - Fixed some small issues pointed out by Quentin.
> 
>  drivers/iio/adc/sun4i-gpadc-iio.c | 228 
> +++---
>  include/linux/mfd/sun4i-gpadc.h   |  27 +
>  2 files changed, 215 insertions(+), 40 deletions(-)
> 
> diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c 
> b/drivers/iio/adc/sun4i-gpadc-iio.c
> index 41769bc6a429..5c79ba4d5ef5 100644
> --- a/drivers/iio/adc/sun4i-gpadc-iio.c
> +++ b/drivers/iio/adc/sun4i-gpadc-iio.c
> @@ -22,6 +22,7 @@
>   * shutdown for not being used.
>   */
>  
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -31,6 +32,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -49,6 +51,8 @@ static unsigned int sun6i_gpadc_chan_select(unsigned int 
> chan)
>   return SUN6I_GPADC_CTRL1_ADC_CHAN_SELECT(chan);
>  }
>  
> +struct sun4i_gpadc_iio;
> +
>  struct gpadc_data {
>   int temp_offset;
>   int temp_scale;
> @@ -56,39 +60,12 @@ struct gpadc_data {
>   unsigned inttp_adc_select;
>   unsigned int(*adc_chan_select)(unsigned int chan);
>   unsigned intadc_chan_mask;
> -};
> -
> -static const struct gpadc_data sun4i_gpadc_data = {
> - .temp_offset = -1932,
> - .temp_scale = 133,
> - .tp_mode_en = SUN4I_GPADC_CTRL1_TP_MODE_EN,
> - .tp_adc_select = SUN4I_GPADC_CTRL1_TP_ADC_SELECT,
> - .adc_chan_select = _gpadc_chan_select,
> - .adc_chan_mask = SUN4I_GPADC_CTRL1_ADC_CHAN_MASK,
> -};
> -
> -static const struct gpadc_data sun5i_gpadc_data = {
> - .temp_offset = -1447,
> - .temp_scale = 100,
> - .tp_mode_en = SUN4I_GPADC_CTRL1_TP_MODE_EN,
> - .tp_adc_select = SUN4I_GPADC_CTRL1_TP_ADC_SELECT,
> - .adc_chan_select = _gpadc_chan_select,
> - .adc_chan_mask = SUN4I_GPADC_CTRL1_ADC_CHAN_MASK,
> -};
> -
> -static const struct gpadc_data sun6i_gpadc_data = {
> - .temp_offset = -1623,
> - .temp_scale = 167,
> - .tp_mode_en = SUN6I_GPADC_CTRL1_TP_MODE_EN,
> - .tp_adc_select = SUN6I_GPADC_CTRL1_TP_ADC_SELECT,
> - .adc_chan_select = _gpadc_chan_select,
> - .adc_chan_mask = SUN6I_GPADC_CTRL1_ADC_CHAN_MASK,
> -};
> -
> -static const struct gpadc_data sun8i_a33_gpadc_data = {
> - .temp_offset = -1662,
> - .temp_scale = 162,
> - .tp_mode_en = SUN8I_A23_GPADC_CTRL1_CHOP_TEMP_EN,
> + unsigned inttemp_data;
> + int (*sample_start)(struct sun4i_gpadc_iio *info);
> + int (*sample_end)(struct sun4i_gpadc_iio *info);
> + boolhas_bus_clk;
> + boolhas_bus_rst;
> + boolhas_mod_clk;
>  };
>  
>  struct sun4i_gpadc_iio {
> @@ -103,6 +80,9 @@ struct sun4i_gpadc_iio {
>   atomic_tignore_temp_data_irq;
>   const struct gpadc_data *data;
>   boolno_irq;
> + struct clk  *ths_bus_clk;
> + struct clk  *mod_clk;
> + struct reset_control*reset;
>   /* prevents concurrent reads of temperature and ADC */
>   struct mutexmutex;
>   struct thermal_zone_device  *tzd;
> @@ -276,7 +256,7 @@ static int sun4i_gpadc_temp_read(struct iio_dev 
> *indio_dev, int *val)
>   if (info->no_irq) {
>   pm_runtime_get_sync(indio_dev->dev.parent);
>  
> - regmap_read(info->regmap, SUN4I_GPADC_TEMP_DATA, val);
> + regmap_read(info->regmap, info->data->temp_data, val);
>  
>   pm_runtime_mark_last_busy(indio_dev->dev.parent);
>   pm_runtime_put_autosuspend(indio_dev->dev.parent);
> @@ -384,10 +364,8 @@ static irqreturn_t sun4i_gpadc_fifo_data_irq_handler(int 
> irq, void *dev_id)
>   return IRQ_HANDLED;
>  }
>  
> -static int sun4i_gpadc_runtime_suspend(struct device *dev)
> +static int sun4i_gpadc_sample_end(struct sun4i_gpadc_iio *info)
>  {
> - struct sun4i_gpadc_iio *info = iio_priv(dev_get_drvdata(dev));
> -
>   /* Disable the ADC on IP */
>   regmap_write(info->regmap, SUN4I_GPADC_CTRL1, 0);
>   /* Disable