drivers: power: ltm4700: Add support for LTM4700 dual-channel PMBus regulator#3111
drivers: power: ltm4700: Add support for LTM4700 dual-channel PMBus regulator#3111cjones-adi wants to merge 6 commits into
Conversation
3d242f5 to
fab2333
Compare
| return -EINVAL; | ||
|
|
||
| return ltm4700_send_byte(dev, 0, LTM4700_MFR_CLEAR_PEAKS); | ||
| } No newline at end of file |
There was a problem hiding this comment.
missing new line at end, check all files
| if (ret) | ||
| goto exit; | ||
|
|
||
| ret = ltm4700_set_operation(dev, LTM4700_CHAN_ALL, |
There was a problem hiding this comment.
in ltm4700_init num of channels is set to
LTM4700_CHAN_ALL is 0xFF
won't it return invalid in ltm4700_set_operation because of
if (channel >= dev->num_channels)
return -EINVAL;
|
|
||
| ret = no_os_gpio_remove(dev->alert_desc); | ||
| if (ret) | ||
| return ret; |
There was a problem hiding this comment.
Maybe we should still attempt to remove i2c to prevent partial clean ups
| #define LTM4700_LIN11_EXPONENT_MSK NO_OS_GENMASK(15,11) | ||
| #define LTM4700_LIN11_EXPONENT(x) ((int16_t)(x) >> 11) | ||
| #define LTM4700_LIN11_MANTISSA(x) (((int16_t)((x & LTM4700_LIN11_MANTISSA_MSK) << 5)) >> 5) | ||
| #define LTM4700_LIN16_EXPONENT -12 |
There was a problem hiding this comment.
maybe enclose negative values in ()
20b4639 to
10ebcb5
Compare
|
V2:
|
|
Xilinx build fails due to missing authorization. By default, PRs from forks cannot access repository secrets. FYI @cjones-adi |
| * @param tr - Transition rate in µV/ms | ||
| * @return 0 in case of success, negative error code otherwise | ||
| */ | ||
| int ltm4700_vout_tr(struct ltm4700_dev *dev, uint8_t channel, int tr); |
There was a problem hiding this comment.
this seems to be redundant.
| @@ -0,0 +1,10 @@ | |||
| { | |||
| "maxim": { | |||
| "basic_example_max32665": { | |||
There was a problem hiding this comment.
the project documentation references only max32655. what platform was actually used?
There was a problem hiding this comment.
max32665 is the one. addressed in V3
There was a problem hiding this comment.
Changed back to max32655 in V4
| $(PLATFORM_DRIVERS)/../common/maxim_dma.c \ | ||
| $(PLATFORM_DRIVERS)/maxim_i2c.c \ | ||
| $(PLATFORM_DRIVERS)/maxim_uart.c \ | ||
| $(PLATFORM_DRIVERS)/maxim_uart_stdio.c No newline at end of file |
There was a problem hiding this comment.
missing newline at eof. check all occurences in all files.
| struct ltm4700_init_param init_param = { | ||
| .i2c_init = &i2c_init_param, | ||
| .crc_en = false, | ||
| .id = ID_LTM4700 |
There was a problem hiding this comment.
this member is non-existent.
| struct no_os_gpio_init_param **run_params; | ||
| struct no_os_gpio_init_param **fault_params; | ||
|
|
||
| bool external_clk_en; |
There was a problem hiding this comment.
this doesn't seem to be used.
63dfde6 to
17892f4
Compare
|
V3
|
| else | ||
| mantissa = uval << (-exp); | ||
|
|
||
| return (uint16_t)mantissa; |
There was a problem hiding this comment.
When value overflows truncated value may give garbage values. Better to clamp
| else | ||
| val = mantissa >> (-exp); | ||
|
|
||
| return val; |
| if (exponent >= 0) | ||
| val = mantissa << exponent; | ||
| else | ||
| val = mantissa >> (-exponent); |
There was a problem hiding this comment.
same issue with overflow
| goto error_dev; | ||
|
|
||
| if (init_param->crc_en) { | ||
| no_os_crc8_populate_msb(ltm4700_crc_table, LTM4700_CRC_POLYNOMIAL); |
There was a problem hiding this comment.
crc table is in init but seems to not be used
| ptr++; | ||
| } | ||
|
|
||
| if (sscanf(ptr, "%d.%d", &int_part, &frac_part) == 2) { |
There was a problem hiding this comment.
if fractional part has leading zeros like 3.05
.05 will just be parsed as 5 this in turn will give a wrong value
|
|
||
| #define LTM4700_IIO_REG_CHAN(reg, chan) (reg | (chan << 8)) | ||
| #define LTM4700_IIO_REG(x) (x & 0xFF) | ||
| #define LTM4700_IIO_CHAN(x) ((x >> 8) & 0xFF) |
There was a problem hiding this comment.
Are these macros used?
There was a problem hiding this comment.
Removed in V4 (stale debug codes)
| return -EINVAL; | ||
|
|
||
| if (ltm4700_cmd_is_paged(cmd)) { | ||
| int ret = ltm4700_set_page(dev, page); |
There was a problem hiding this comment.
Inconsistent with coding style should be declared at the top
| return -EINVAL; | ||
|
|
||
| if (ltm4700_cmd_is_paged(cmd)) { | ||
| int ret = ltm4700_set_page(dev, page); |
There was a problem hiding this comment.
Inconsistent with coding style should be declared at the top
| return -EINVAL; | ||
|
|
||
| if (ltm4700_cmd_is_paged(cmd)) { | ||
| int ret = ltm4700_set_page(dev, page); |
There was a problem hiding this comment.
Inconsistent with coding style should be declared at the top
|
please migrate to the cmake/kconfig build system |
|
/AzurePipelines run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Add comprehensive PMBus driver for LTM4700 dual-channel regulator. Includes support for dual-channel monitoring, and complete LINEAR format conversion. Key features: - PMBus 1.3 compliant I2C interface (400kHz) - Dual-channel 50A per channel or single 100A operation - LINEAR11/LINEAR16 data format support - Comprehensive status monitoring - Complete telemetry reading (VIN, IIN, VOUT, IOUT, temperatures) - Peak value tracking and management - NVM operations for configuration storage Signed-off-by: Carlos Jones Jr <carlosjr.jones@analog.com>
Add comprehensive Industrial I/O (IIO) framework integration for LTM4700 dual-channel regulator with real-time telemetry and control interface. Key features: - 13 IIO channels covering all telemetry (VIN, IIN, VOUT0/1, IOUT0/1, etc.) - Real-time voltage/current/power/temperature monitoring - Write support for VOUT control and operation mode - Peak value management and fault clearing - Engineering unit conversion (mV, mA, m°C, mW) - Multi-channel configuration support - Complete Linux IIO subsystem compliance IIO Channels: - Input: VIN, IIN, PIN, IC temperature - Output: VOUT0/1, IOUT0/1, POUT0/1, external temperatures - Control: Operation mode, voltage commands, margins - Frequency: Per-channel switching frequency monitoring Signed-off-by: Carlos Jones Jr <carlosjr.jones@analog.com>
Add comprehensive driver documentation covering device features, PMBus command interface, IIO integration, and usage examples. Documentation includes: - Device overview - Key features and specifications - PMBus communication interface details - Data format descriptions (LINEAR11/LINEAR16) - Complete API usage examples - IIO framework integration guide - Design considerations and best practices - Build configuration instructions The documentation provides complete guidance for driver integration and application development with the LTM4700 regulator. Signed-off-by: Carlos Jones Jr <carlosjr.jones@analog.com>
Add comprehensive project structure for LTM4700 dual-channel regulator with support for both basic telemetry monitoring and IIO integration. Includes platform-specific configuration for Maxim MAX32655 with proper I2C, UART, and GPIO setup for PMBus communication at 400kHz. Signed-off-by: Carlos Jones Jr <carlosjr.jones@analog.com>
Add comprehensive project documentation covering hardware setup, build instructions, examples usage, and troubleshooting guide. Includes detailed configuration options for both basic telemetry and IIO integration examples with performance characteristics and platform-specific setup instructions. Signed-off-by: Carlos Jones Jr <carlosjr.jones@analog.com>
Add comprehensive unit test suite for LTM4700 dual-channel regulator driver using Ceedling/Unity/CMock framework. Includes core driver tests for initialization, PMBus communication, LINEAR format conversion, voltage/current/temperature reading, and IIO integration tests. Test coverage includes: - Device initialization - PMBus read/write operations with I2C mocking - LINEAR11/LINEAR16 format conversion validation - Multi-channel operation and page selection - IIO channel mapping and attribute handling - Error handling and parameter validation - Support functions for test data generation Targets 80%+ code coverage with automated testing framework. Signed-off-by: Carlos Jones Jr <carlosjr.jones@analog.com>
17892f4 to
1ddba9e
Compare
|
V4:
|
Pull Request Description
Add comprehensive support for the LTM4700 dual-channel 50A/100A μModule regulator with complete IIO subsystem integration, multi-example project build, and unit testing.
Driver Features
Files Changed
PR Type
PR Checklist