no-OS
Loading...
Searching...
No Matches
iio_max17616.c File Reference

Source file of the MAX17616 IIO Driver. More...

#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "no_os_alloc.h"
#include "no_os_error.h"
#include "no_os_units.h"
#include "no_os_util.h"
#include "iio.h"
#include "iio_types.h"
#include "max17616.h"
#include "iio_max17616.h"
Include dependency graph for iio_max17616.c:

Enumerations

enum  max17616_iio_channels {
  MAX17616_IIO_VIN_CHAN ,
  MAX17616_IIO_VOUT_CHAN ,
  MAX17616_IIO_IOUT_CHAN ,
  MAX17616_IIO_TEMP_CHAN ,
  MAX17616_IIO_POUT_CHAN ,
  MAX17616_IIO_STATUS_WORD_CHAN ,
  MAX17616_IIO_STATUS_VOUT_CHAN ,
  MAX17616_IIO_STATUS_IOUT_CHAN ,
  MAX17616_IIO_STATUS_INPUT_CHAN ,
  MAX17616_IIO_STATUS_TEMP_CHAN ,
  MAX17616_IIO_STATUS_CML_CHAN ,
  MAX17616_IIO_STATUS_MFR_SPECIFIC_CHAN ,
  MAX17616_IIO_CLMODE_CHAN ,
  MAX17616_IIO_ISTART_RATIO_CHAN ,
  MAX17616_IIO_TSTOC_CHAN ,
  MAX17616_IIO_ISTLIM_CHAN ,
  MAX17616_IIO_CAPABILITY_CHAN ,
  MAX17616_IIO_NOMINAL_VOLTAGE_CHAN ,
  MAX17616_IIO_PGOOD_THRESHOLD_CHAN
}
 
enum  max17616_iio_global_attrs {
  MAX17616_IIO_OPERATION_ATTR ,
  MAX17616_IIO_CLEAR_FAULTS_ATTR ,
  MAX17616_IIO_DEVICE_INFO_ATTR ,
  MAX17616_IIO_FAULT_SUMMARY_ATTR ,
  MAX17616_IIO_CAPABILITY_ATTR
}
 

Functions

STATIC int max17616_iio_read_attr (void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv)
 Read attribute function for MAX17616 PMBus IIO driver.
 
STATIC int max17616_iio_write_attr (void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv)
 Write attribute function for MAX17616 output channels.
 
STATIC int max17616_iio_read_global_attr (void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv)
 Read global attribute function for MAX17616 IIO device.
 
STATIC int max17616_iio_write_global_attr (void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv)
 Write global attribute function for MAX17616 IIO device.
 
int max17616_iio_init (struct max17616_iio_desc **iio_desc, struct max17616_iio_desc_init_param *init_param)
 Initializes the MAX17616 IIO descriptor.
 
int max17616_iio_remove (struct max17616_iio_desc *iio_desc)
 Free resources allocated by the init function.
 

Detailed Description

Source file of the MAX17616 IIO Driver.

Author
Carlos Jones (carlo.nosp@m.sjr..nosp@m.jones.nosp@m.@ana.nosp@m.log.c.nosp@m.om)

Copyright 2025(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Enumeration Type Documentation

◆ max17616_iio_channels

Enumerator
MAX17616_IIO_VIN_CHAN 
MAX17616_IIO_VOUT_CHAN 
MAX17616_IIO_IOUT_CHAN 
MAX17616_IIO_TEMP_CHAN 
MAX17616_IIO_POUT_CHAN 
MAX17616_IIO_STATUS_WORD_CHAN 
MAX17616_IIO_STATUS_VOUT_CHAN 
MAX17616_IIO_STATUS_IOUT_CHAN 
MAX17616_IIO_STATUS_INPUT_CHAN 
MAX17616_IIO_STATUS_TEMP_CHAN 
MAX17616_IIO_STATUS_CML_CHAN 
MAX17616_IIO_STATUS_MFR_SPECIFIC_CHAN 
MAX17616_IIO_CLMODE_CHAN 
MAX17616_IIO_ISTART_RATIO_CHAN 
MAX17616_IIO_TSTOC_CHAN 
MAX17616_IIO_ISTLIM_CHAN 
MAX17616_IIO_CAPABILITY_CHAN 
MAX17616_IIO_NOMINAL_VOLTAGE_CHAN 
MAX17616_IIO_PGOOD_THRESHOLD_CHAN 

◆ max17616_iio_global_attrs

Enumerator
MAX17616_IIO_OPERATION_ATTR 
MAX17616_IIO_CLEAR_FAULTS_ATTR 
MAX17616_IIO_DEVICE_INFO_ATTR 
MAX17616_IIO_FAULT_SUMMARY_ATTR 
MAX17616_IIO_CAPABILITY_ATTR 

Function Documentation

◆ max17616_iio_init()

int max17616_iio_init ( struct max17616_iio_desc ** iio_desc,
struct max17616_iio_desc_init_param * init_param )

Initializes the MAX17616 IIO descriptor.

Parameters
iio_desc- Pointer to IIO device descriptor.
init_param- Device initialization parameters.
Returns
0 in case of success, an error code otherwise.

◆ max17616_iio_read_attr()

STATIC int max17616_iio_read_attr ( void * device,
char * buf,
uint32_t len,
const struct iio_ch_info * channel,
intptr_t priv )

Read attribute function for MAX17616 PMBus IIO driver.

Parameters
device- IIO device structure
buf- Buffer to write the attribute value
len- Maximum length of the buffer
channel- IIO channel information
priv- Private data (0=raw, 1=scale)
Returns
Length of the attribute value on success, negative error code otherwise

◆ max17616_iio_read_global_attr()

STATIC int max17616_iio_read_global_attr ( void * device,
char * buf,
uint32_t len,
const struct iio_ch_info * channel,
intptr_t priv )

Read global attribute function for MAX17616 IIO device.

Parameters
device- IIO device structure (max17616_iio_desc)
buf- Buffer to write the attribute value
len- Maximum length of the buffer
channel- IIO channel information (unused for global attributes)
priv- Private data identifying which global attribute to read
Returns
Length of the attribute value on success, negative error code otherwise

◆ max17616_iio_remove()

int max17616_iio_remove ( struct max17616_iio_desc * iio_desc)

Free resources allocated by the init function.

Parameters
iio_desc- The iio device descriptor.
Returns
0 in case of success, an error code otherwise.

◆ max17616_iio_write_attr()

STATIC int max17616_iio_write_attr ( void * device,
char * buf,
uint32_t len,
const struct iio_ch_info * channel,
intptr_t priv )

Write attribute function for MAX17616 output channels.

Parameters
device- IIO device structure
buf- Buffer containing the attribute value to write
len- Length of the buffer
channel- IIO channel information
priv- Private data (attribute ID)
Returns
Number of bytes written on success, negative error code otherwise

◆ max17616_iio_write_global_attr()

STATIC int max17616_iio_write_global_attr ( void * device,
char * buf,
uint32_t len,
const struct iio_ch_info * channel,
intptr_t priv )

Write global attribute function for MAX17616 IIO device.

Parameters
device- IIO device structure (max17616_iio_desc)
buf- Buffer containing the attribute value to write
len- Length of the buffer
channel- IIO channel information (unused for global attributes)
priv- Private data identifying which global attribute to write
Returns
Number of bytes written on success, negative error code otherwise