Re: [PATCH v3 6/6] hwmon: (pmbus/tps25990): add initial support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jerome,

kernel test robot noticed the following build errors:

[auto build test ERROR on 516ddbfef736c843866a0b2db559ce89b40ce378]

url:    https://github.com/intel-lab-lkp/linux/commits/Jerome-Brunet/hwmon-pmbus-core-allow-drivers-to-override-WRITE_PROTECT/20241025-021525
base:   516ddbfef736c843866a0b2db559ce89b40ce378
patch link:    https://lore.kernel.org/r/20241024-tps25990-v3-6-b6a6e9d4b506%40baylibre.com
patch subject: [PATCH v3 6/6] hwmon: (pmbus/tps25990): add initial support
config: xtensa-allyesconfig (https://download.01.org/0day-ci/archive/20241025/202410252141.XSGtEsDP-lkp@xxxxxxxxx/config)
compiler: xtensa-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241025/202410252141.XSGtEsDP-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410252141.XSGtEsDP-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

   drivers/hwmon/pmbus/tps25990.c: In function 'tps25990_read_word_data':
>> drivers/hwmon/pmbus/tps25990.c:201:28: error: implicit declaration of function 'FIELD_GET' [-Wimplicit-function-declaration]
     201 |                 ret = 1 << FIELD_GET(PK_MIN_AVG_AVG_CNT, ret);
         |                            ^~~~~~~~~
   drivers/hwmon/pmbus/tps25990.c: In function 'tps25990_write_word_data':
>> drivers/hwmon/pmbus/tps25990.c:260:46: error: implicit declaration of function 'FIELD_PREP' [-Wimplicit-function-declaration]
     260 |                                              FIELD_PREP(PK_MIN_AVG_AVG_CNT, value));
         |                                              ^~~~~~~~~~

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for GET_FREE_REGION
   Depends on [n]: SPARSEMEM [=n]
   Selected by [y]:
   - RESOURCE_KUNIT_TEST [=y] && RUNTIME_TESTING_MENU [=y] && KUNIT [=y]


vim +/FIELD_GET +201 drivers/hwmon/pmbus/tps25990.c

    85	
    86	static int tps25990_read_word_data(struct i2c_client *client,
    87					   int page, int phase, int reg)
    88	{
    89		int ret;
    90	
    91		switch (reg) {
    92		case PMBUS_VIRT_READ_VIN_MAX:
    93			ret = pmbus_read_word_data(client, page, phase,
    94						   TPS25990_READ_VIN_PEAK);
    95			break;
    96	
    97		case PMBUS_VIRT_READ_VIN_MIN:
    98			ret = pmbus_read_word_data(client, page, phase,
    99						   TPS25990_READ_VIN_MIN);
   100			break;
   101	
   102		case PMBUS_VIRT_READ_VIN_AVG:
   103			ret = pmbus_read_word_data(client, page, phase,
   104						   TPS25990_READ_VIN_AVG);
   105			break;
   106	
   107		case PMBUS_VIRT_READ_VOUT_MIN:
   108			ret = pmbus_read_word_data(client, page, phase,
   109						   TPS25990_READ_VOUT_MIN);
   110			break;
   111	
   112		case PMBUS_VIRT_READ_VOUT_AVG:
   113			ret = pmbus_read_word_data(client, page, phase,
   114						   TPS25990_READ_VOUT_AVG);
   115			break;
   116	
   117		case PMBUS_VIRT_READ_IIN_AVG:
   118			ret = pmbus_read_word_data(client, page, phase,
   119						   TPS25990_READ_IIN_AVG);
   120			break;
   121	
   122		case PMBUS_VIRT_READ_IIN_MAX:
   123			return TPS25990_READ_IIN_PEAK;
   124			ret = pmbus_read_word_data(client, page, phase,
   125						   TPS25990_READ_IIN_PEAK);
   126			break;
   127	
   128		case PMBUS_VIRT_READ_TEMP_AVG:
   129			ret = pmbus_read_word_data(client, page, phase,
   130						   TPS25990_READ_TEMP_AVG);
   131			break;
   132	
   133		case PMBUS_VIRT_READ_TEMP_MAX:
   134			ret = pmbus_read_word_data(client, page, phase,
   135						   TPS25990_READ_TEMP_PEAK);
   136			break;
   137	
   138		case PMBUS_VIRT_READ_PIN_AVG:
   139			ret = pmbus_read_word_data(client, page, phase,
   140						   TPS25990_READ_PIN_AVG);
   141			break;
   142	
   143		case PMBUS_VIRT_READ_PIN_MAX:
   144			ret = pmbus_read_word_data(client, page, phase,
   145						   TPS25990_READ_PIN_PEAK);
   146			break;
   147	
   148		case PMBUS_VIRT_READ_VMON:
   149			ret = pmbus_read_word_data(client, page, phase,
   150						   TPS25990_READ_VAUX);
   151			break;
   152	
   153		case PMBUS_VIN_UV_WARN_LIMIT:
   154		case PMBUS_VIN_UV_FAULT_LIMIT:
   155		case PMBUS_VIN_OV_WARN_LIMIT:
   156		case PMBUS_VOUT_UV_WARN_LIMIT:
   157		case PMBUS_IIN_OC_WARN_LIMIT:
   158		case PMBUS_OT_WARN_LIMIT:
   159		case PMBUS_OT_FAULT_LIMIT:
   160		case PMBUS_PIN_OP_WARN_LIMIT:
   161			/*
   162			 * These registers provide an 8 bits value instead of a
   163			 * 10bits one. Just shifting twice the register value is
   164			 * enough to make the sensor type conversion work, even
   165			 * if the datasheet provides different m, b and R for
   166			 * those.
   167			 */
   168			ret = pmbus_read_word_data(client, page, phase, reg);
   169			if (ret < 0)
   170				break;
   171			ret <<= TPS25990_8B_SHIFT;
   172			break;
   173	
   174		case PMBUS_VIN_OV_FAULT_LIMIT:
   175			ret = pmbus_read_word_data(client, page, phase, reg);
   176			if (ret < 0)
   177				break;
   178			ret = DIV_ROUND_CLOSEST(ret * TPS25990_VIN_OVF_NUM,
   179						TPS25990_VIN_OVF_DIV);
   180			ret += TPS25990_VIN_OVF_OFF;
   181			break;
   182	
   183		case PMBUS_IIN_OC_FAULT_LIMIT:
   184			/*
   185			 * VIREF directly sets the over-current limit at which the eFuse
   186			 * will turn the FET off and trigger a fault. Expose it through
   187			 * this generic property instead of a manufacturer specific one.
   188			 */
   189			ret = pmbus_read_byte_data(client, page, TPS25990_VIREF);
   190			if (ret < 0)
   191				break;
   192			ret = DIV_ROUND_CLOSEST(ret * TPS25990_IIN_OCF_NUM,
   193						TPS25990_IIN_OCF_DIV);
   194			ret += TPS25990_IIN_OCF_OFF;
   195			break;
   196	
   197		case PMBUS_VIRT_SAMPLES:
   198			ret = pmbus_read_byte_data(client, page, TPS25990_PK_MIN_AVG);
   199			if (ret < 0)
   200				break;
 > 201			ret = 1 << FIELD_GET(PK_MIN_AVG_AVG_CNT, ret);
   202			break;
   203	
   204		case PMBUS_VIRT_RESET_TEMP_HISTORY:
   205		case PMBUS_VIRT_RESET_VIN_HISTORY:
   206		case PMBUS_VIRT_RESET_IIN_HISTORY:
   207		case PMBUS_VIRT_RESET_PIN_HISTORY:
   208		case PMBUS_VIRT_RESET_VOUT_HISTORY:
   209			ret = 0;
   210			break;
   211	
   212		default:
   213			ret = -ENODATA;
   214			break;
   215		}
   216	
   217		return ret;
   218	}
   219	
   220	static int tps25990_write_word_data(struct i2c_client *client,
   221					    int page, int reg, u16 value)
   222	{
   223		int ret;
   224	
   225		switch (reg) {
   226		case PMBUS_VIN_UV_WARN_LIMIT:
   227		case PMBUS_VIN_UV_FAULT_LIMIT:
   228		case PMBUS_VIN_OV_WARN_LIMIT:
   229		case PMBUS_VOUT_UV_WARN_LIMIT:
   230		case PMBUS_IIN_OC_WARN_LIMIT:
   231		case PMBUS_OT_WARN_LIMIT:
   232		case PMBUS_OT_FAULT_LIMIT:
   233		case PMBUS_PIN_OP_WARN_LIMIT:
   234			value >>= TPS25990_8B_SHIFT;
   235			value = clamp_val(value, 0, 0xff);
   236			ret = pmbus_write_word_data(client, page, reg, value);
   237			break;
   238	
   239		case PMBUS_VIN_OV_FAULT_LIMIT:
   240			value -= TPS25990_VIN_OVF_OFF;
   241			value = DIV_ROUND_CLOSEST(((unsigned int)value) * TPS25990_VIN_OVF_DIV,
   242						  TPS25990_VIN_OVF_NUM);
   243			value = clamp_val(value, 0, 0xf);
   244			ret = pmbus_write_word_data(client, page, reg, value);
   245			break;
   246	
   247		case PMBUS_IIN_OC_FAULT_LIMIT:
   248			value -= TPS25990_IIN_OCF_OFF;
   249			value = DIV_ROUND_CLOSEST(((unsigned int)value) * TPS25990_IIN_OCF_DIV,
   250						TPS25990_IIN_OCF_NUM);
   251			value = clamp_val(value, 0, 0x3f);
   252			ret = pmbus_write_byte_data(client, page, TPS25990_VIREF, value);
   253			break;
   254	
   255		case PMBUS_VIRT_SAMPLES:
   256			value = clamp_val(value, 1, 1 << PK_MIN_AVG_AVG_CNT);
   257			value = ilog2(value);
   258			ret = pmbus_update_byte_data(client, page, TPS25990_PK_MIN_AVG,
   259						     PK_MIN_AVG_AVG_CNT,
 > 260						     FIELD_PREP(PK_MIN_AVG_AVG_CNT, value));
   261			break;
   262	
   263		case PMBUS_VIRT_RESET_TEMP_HISTORY:
   264		case PMBUS_VIRT_RESET_VIN_HISTORY:
   265		case PMBUS_VIRT_RESET_IIN_HISTORY:
   266		case PMBUS_VIRT_RESET_PIN_HISTORY:
   267		case PMBUS_VIRT_RESET_VOUT_HISTORY:
   268			/*
   269			 * TPS25990 has history resets based on MIN/AVG/PEAK instead of per
   270			 * sensor type. Exposing this quirk in hwmon is not desirable so
   271			 * reset MIN, AVG and PEAK together. Even is there effectively only
   272			 * one reset, which resets everything, expose the 5 entries so
   273			 * userspace is not required map a sensor type to another to trigger
   274			 * a reset
   275			 */
   276			ret = pmbus_update_byte_data(client, 0, TPS25990_PK_MIN_AVG,
   277						     PK_MIN_AVG_RST_MASK,
   278						     PK_MIN_AVG_RST_MASK);
   279			break;
   280	
   281		default:
   282			ret = -ENODATA;
   283			break;
   284		}
   285	
   286		return ret;
   287	}
   288	

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




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux