public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* Re: [PATCH 2/2] iio: temperature: add ADI MAX30210 driver
       [not found] <20260226163041.169786-3-johnerasmusmari.geronimo@analog.com>
@ 2026-02-26 22:29 ` kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-02-26 22:29 UTC (permalink / raw)
  To: John Erasmus Mari Geronimo, linux-iio
  Cc: llvm, oe-kbuild-all, devicetree, linux-kernel, Jonathan Cameron,
	David Lechner, Nuno Sá, Andy Shevchenko

Hi John,

kernel test robot noticed the following build errors:

[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on linus/master v7.0-rc1 next-20260226]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/John-Erasmus-Mari-Geronimo/dt-bindings-iio-temperature-add-ADI-MAX30210/20260227-013306
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/20260226163041.169786-3-johnerasmusmari.geronimo%40analog.com
patch subject: [PATCH 2/2] iio: temperature: add ADI MAX30210 driver
config: sparc64-allmodconfig (https://download.01.org/0day-ci/archive/20260227/202602270610.Batqc2is-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 9a109fbb6e184ec9bcce10615949f598f4c974a9)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260227/202602270610.Batqc2is-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602270610.Batqc2is-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/iio/temperature/max30210.c:412:9: error: call to undeclared function 'iio_device_claim_direct_mode'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     412 |                 ret = iio_device_claim_direct_mode(indio_dev);
         |                       ^
   drivers/iio/temperature/max30210.c:412:9: note: did you mean 'iio_device_claim_direct'?
   include/linux/iio/iio.h:687:20: note: 'iio_device_claim_direct' declared here
     687 | static inline bool iio_device_claim_direct(struct iio_dev *indio_dev)
         |                    ^
>> drivers/iio/temperature/max30210.c:426:3: error: call to undeclared function 'iio_device_release_direct_mode'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     426 |                 iio_device_release_direct_mode(indio_dev);
         |                 ^
   drivers/iio/temperature/max30210.c:460:9: error: call to undeclared function 'iio_device_claim_direct_mode'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     460 |                 ret = iio_device_claim_direct_mode(indio_dev);
         |                       ^
   drivers/iio/temperature/max30210.c:478:3: error: call to undeclared function 'iio_device_release_direct_mode'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     478 |                 iio_device_release_direct_mode(indio_dev);
         |                 ^
>> drivers/iio/temperature/max30210.c:604:24: error: incompatible function pointer types initializing 'int (*)(struct iio_dev *, const struct iio_chan_spec *, enum iio_event_type, enum iio_event_direction, bool)' (aka 'int (*)(struct iio_dev *, const struct iio_chan_spec *, enum iio_event_type, enum iio_event_direction, _Bool)') with an expression of type 'int (struct iio_dev *, const struct iio_chan_spec *, enum iio_event_type, enum iio_event_direction, int)' [-Wincompatible-function-pointer-types]
     604 |         .write_event_config = max30210_write_event_config,
         |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   5 errors generated.


vim +/iio_device_claim_direct_mode +412 drivers/iio/temperature/max30210.c

   381	
   382	static int max30210_read_raw(struct iio_dev *indio_dev,
   383				     struct iio_chan_spec const *chan, int *val,
   384				     int *val2, long mask)
   385	{
   386		struct max30210_state *st = iio_priv(indio_dev);
   387		unsigned int uval;
   388		int ret;
   389	
   390		switch (mask) {
   391		case IIO_CHAN_INFO_SCALE:
   392			*val = 5;
   393	
   394			return IIO_VAL_INT;
   395		case IIO_CHAN_INFO_SAMP_FREQ:
   396			ret = regmap_read(st->regmap, MAX30210_TEMP_CONF_2_REG, &uval);
   397			if (ret)
   398				return ret;
   399	
   400			uval = FIELD_GET(MAX30210_TEMP_PERIOD_MASK, uval);
   401	
   402			*val = 8;
   403	
   404			/**
   405			 * register values 0x9 or above have the same sample
   406			 * rate of 8Hz
   407			 */
   408			*val2 = uval >= 0x9 ? 1 : BIT(0x9 - uval);
   409	
   410			return IIO_VAL_FRACTIONAL;
   411		case IIO_CHAN_INFO_RAW:
 > 412			ret = iio_device_claim_direct_mode(indio_dev);
   413			if (ret)
   414				return ret;
   415	
   416			ret = regmap_write(st->regmap, MAX30210_TEMP_CONV_REG,
   417					   MAX30210_CONV_T_MASK);
   418			if (ret)
   419				goto release_dmode;
   420	
   421			fsleep(8000);
   422	
   423			ret = max30210_read_temp(st->regmap, MAX30210_TEMP_DATA_REG, val);
   424	
   425	release_dmode:
 > 426			iio_device_release_direct_mode(indio_dev);
   427			return ret;
   428		default:
   429			return -EINVAL;
   430		}
   431	}
   432	
   433	static int max30210_read_avail(struct iio_dev *indio_dev,
   434				       struct iio_chan_spec const *chan,
   435				       const int **vals, int *type, int *length,
   436				       long mask)
   437	{
   438		switch (mask) {
   439		case IIO_CHAN_INFO_SAMP_FREQ:
   440			*vals = samp_freq_avail;
   441			*type = IIO_VAL_INT_PLUS_MICRO;
   442			*length = ARRAY_SIZE(samp_freq_avail);
   443	
   444			return IIO_AVAIL_LIST;
   445		default:
   446			return -EINVAL;
   447		}
   448	}
   449	
   450	static int max30210_write_raw(struct iio_dev *indio_dev,
   451				      struct iio_chan_spec const *chan, int val,
   452				      int val2, long mask)
   453	{
   454		struct max30210_state *st = iio_priv(indio_dev);
   455		u64 data;
   456		int ret;
   457	
   458		switch (mask) {
   459		case IIO_CHAN_INFO_SAMP_FREQ:
   460			ret = iio_device_claim_direct_mode(indio_dev);
   461			if (ret)
   462				return ret;
   463	
   464			/**
   465			 * micro_value = val * 1000000 + val2
   466			 * reg_value = ((micro_value * 64) / 1000000) - 1
   467			 */
   468			data = (val * MICRO + val2) << 6;
   469			do_div(data, MICRO);
   470	
   471			data = fls_long(data - 1);
   472			data = FIELD_PREP(MAX30210_TEMP_PERIOD_MASK, data);
   473	
   474			ret = regmap_update_bits(st->regmap, MAX30210_TEMP_CONF_2_REG,
   475						 MAX30210_TEMP_PERIOD_MASK,
   476						 (unsigned int)data);
   477	
   478			iio_device_release_direct_mode(indio_dev);
   479			return ret;
   480		default:
   481			return -EINVAL;
   482		}
   483	}
   484	
   485	static int max30210_write_raw_get_fmt(struct iio_dev *indio_dev,
   486					      struct iio_chan_spec const *chan,
   487					      long mask)
   488	{
   489		switch (mask) {
   490		case IIO_CHAN_INFO_SAMP_FREQ:
   491			return IIO_VAL_INT_PLUS_MICRO;
   492		default:
   493			return -EINVAL;
   494		}
   495	}
   496	
   497	static const struct iio_trigger_ops max30210_trigger_ops = {
   498		.validate_device = &iio_trigger_validate_own_device,
   499	};
   500	
   501	static int max30210_set_watermark(struct iio_dev *indio_dev, unsigned int val)
   502	{
   503		struct max30210_state *st = iio_priv(indio_dev);
   504		unsigned int reg;
   505		int ret;
   506	
   507		if (val < 1 || val > MAX30210_FIFO_SIZE)
   508			return -EINVAL;
   509	
   510		reg = MAX30210_FIFO_SIZE - val;
   511	
   512		ret = regmap_write(st->regmap, MAX30210_FIFO_CONF_1_REG, reg);
   513		if (ret)
   514			return ret;
   515	
   516		st->watermark = val;
   517	
   518		return 0;
   519	}
   520	
   521	static ssize_t hwfifo_watermark_show(struct device *dev,
   522					     struct device_attribute *devattr,
   523					     char *buf)
   524	{
   525		struct max30210_state *st = iio_priv(dev_to_iio_dev(dev));
   526	
   527		return sysfs_emit(buf, "%d\n", st->watermark);
   528	}
   529	
   530	IIO_STATIC_CONST_DEVICE_ATTR(hwfifo_watermark_min, "1");
   531	IIO_STATIC_CONST_DEVICE_ATTR(hwfifo_watermark_max,
   532				     __stringify(MAX30210_FIFO_SIZE));
   533	static IIO_DEVICE_ATTR_RO(hwfifo_watermark, 0);
   534	
   535	static const struct iio_dev_attr *max30210_fifo_attributes[] = {
   536		&iio_dev_attr_hwfifo_watermark_min,
   537		&iio_dev_attr_hwfifo_watermark_max,
   538		&iio_dev_attr_hwfifo_watermark,
   539		NULL,
   540	};
   541	
   542	static int max30210_buffer_preenable(struct iio_dev *indio_dev)
   543	{
   544		struct max30210_state *st = iio_priv(indio_dev);
   545		int ret;
   546	
   547		ret = regmap_update_bits(st->regmap, MAX30210_INT_EN_REG,
   548					 MAX30210_A_FULL_MASK, MAX30210_A_FULL_MASK);
   549		if (ret)
   550			return ret;
   551	
   552		ret = regmap_update_bits(st->regmap, MAX30210_FIFO_CONF_2_REG,
   553					 MAX30210_FLUSH_FIFO_MASK,
   554					 MAX30210_FLUSH_FIFO_MASK);
   555		if (ret)
   556			return ret;
   557	
   558		ret = regmap_write(st->regmap, MAX30210_TEMP_CONV_REG,
   559				   MAX30210_AUTO_MASK | MAX30210_CONV_T_MASK);
   560		if (ret)
   561			return ret;
   562	
   563		return 0;
   564	}
   565	
   566	static int max30210_buffer_postdisable(struct iio_dev *indio_dev)
   567	{
   568		struct max30210_state *st = iio_priv(indio_dev);
   569		int ret;
   570	
   571		ret = regmap_update_bits(st->regmap, MAX30210_INT_EN_REG,
   572					 MAX30210_A_FULL_MASK, 0x0);
   573		if (ret)
   574			return ret;
   575	
   576		ret = regmap_update_bits(st->regmap, MAX30210_FIFO_CONF_2_REG,
   577					 MAX30210_FLUSH_FIFO_MASK,
   578					 MAX30210_FLUSH_FIFO_MASK);
   579		if (ret)
   580			return ret;
   581	
   582		ret = regmap_write(st->regmap, MAX30210_TEMP_CONV_REG, 0x0);
   583		if (ret)
   584			return ret;
   585	
   586		return 0;
   587	}
   588	
   589	static const struct iio_buffer_setup_ops max30210_buffer_ops = {
   590		.preenable = max30210_buffer_preenable,
   591		.postdisable = max30210_buffer_postdisable,
   592	};
   593	
   594	static const struct iio_info max30210_info = {
   595		.read_raw = max30210_read_raw,
   596		.read_avail = max30210_read_avail,
   597		.write_raw = max30210_write_raw,
   598		.write_raw_get_fmt = max30210_write_raw_get_fmt,
   599		.hwfifo_set_watermark = max30210_set_watermark,
   600		.debugfs_reg_access = &max30210_reg_access,
   601		.validate_trigger = &max30210_validate_trigger,
   602		.read_event_value = max30210_read_event,
   603		.write_event_value = max30210_write_event,
 > 604		.write_event_config = max30210_write_event_config,
   605		.read_event_config = max30210_read_event_config,
   606	};
   607	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-26 22:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260226163041.169786-3-johnerasmusmari.geronimo@analog.com>
2026-02-26 22:29 ` [PATCH 2/2] iio: temperature: add ADI MAX30210 driver kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox