LCOV - code coverage report
Current view: top level - zephyr/drivers/mfd - max31790.h Hit Total Coverage
Test: new.info Lines: 0 41 0.0 %
Date: 2024-12-22 00:14:23

          Line data    Source code
       1           0 : /*
       2             :  * Copyright (c) 2024 SILA Embedded Solutions GmbH
       3             :  * SPDX-License-Identifier: Apache-2.0
       4             :  */
       5             : 
       6             : #ifndef ZEPHYR_INCLUDE_DRIVERS_MFD_MAX31790_H_
       7             : #define ZEPHYR_INCLUDE_DRIVERS_MFD_MAX31790_H_
       8             : 
       9             : #include <zephyr/sys/util.h>
      10             : #include <zephyr/sys/util_macro.h>
      11             : 
      12           0 : #define MAX31790_OSCILLATOR_FREQUENCY_IN_HZ 32768
      13           0 : #define MAX31790_PWMTARGETDUTYCYCLE_MAXIMUM ((1 << 9) - 1)
      14           0 : #define MAX31790_TACHTARGETCOUNT_MAXIMUM    ((1 << 11) - 1)
      15           0 : #define MAX31790_CHANNEL_COUNT              6
      16           0 : #define MAX31790_RESET_TIMEOUT_IN_US        1000
      17             : 
      18           0 : #define MAX37190_REGISTER_GLOBALCONFIGURATION               0x00
      19           0 : #define MAX37190_REGISTER_PWMFREQUENCY                      0x01
      20           0 : #define MAX37190_REGISTER_FANCONFIGURATION(channel)         (0x02 + channel)
      21           0 : #define MAX31790_REGISTER_FANDYNAMICS(channel)              (0x08 + channel)
      22           0 : #define MAX37190_REGISTER_FANFAULTSTATUS1                   0x11
      23           0 : #define MAX37190_REGISTER_TACHCOUNTMSB(channel)             (0x18 + 2 * channel)
      24           0 : #define MAX31790_REGISTER_PWMOUTTARGETDUTYCYCLEMSB(channel) (0x40 + 2 * channel)
      25           0 : #define MAX31790_REGISTER_TACHTARGETCOUNTMSB(channel)       (0x50 + 2 * channel)
      26             : 
      27           0 : #define MAX37190_GLOBALCONFIGURATION_STANDBY_BIT             BIT(7)
      28           0 : #define MAX37190_GLOBALCONFIGURATION_RESET_BIT               BIT(6)
      29           0 : #define MAX37190_GLOBALCONFIGURATION_BUSTIMEOUT_BIT          BIT(5)
      30           0 : #define MAX37190_GLOBALCONFIGURATION_OSCILLATORSELECTION_BIT BIT(3)
      31           0 : #define MAX37190_GLOBALCONFIGURATION_I2CWATCHDOGSTATUS_BIT   BIT(0)
      32           0 : #define MAX37190_FANXCONFIGURATION_MONITOR_BIT               BIT(4)
      33           0 : #define MAX37190_FANXCONFIGURATION_TACHINPUTENABLED_BIT      BIT(3)
      34           0 : #define MAX37190_FANXCONFIGURATION_LOCKEDROTOR_BIT           BIT(2)
      35           0 : #define MAX37190_FANXCONFIGURATION_LOCKEDROTORPOLARITY_BIT   BIT(1)
      36           0 : #define MAX37190_FANXCONFIGURATION_TACH_BIT                  BIT(0)
      37           0 : #define MAX37190_FANXCONFIGURATION_MODE_BIT                  BIT(7)
      38           0 : #define MAX37190_FANXDYNAMICS_ASYMMETRICRATEOFCHANGE_BIT     BIT(1)
      39             : 
      40           0 : #define MAX37190_GLOBALCONFIGURATION_I2CWATCHDOG_LENGTH 2
      41           0 : #define MAX37190_GLOBALCONFIGURATION_I2CWATCHDOG_POS    1
      42           0 : #define MAX37190_FANXDYNAMICS_SPEEDRANGE_LENGTH         3
      43           0 : #define MAX37190_FANXDYNAMICS_SPEEDRANGE_POS            5
      44           0 : #define MAX37190_FANXDYNAMICS_PWMRATEOFCHANGE_LENGTH    3
      45           0 : #define MAX37190_FANXDYNAMICS_PWMRATEOFCHANGE_POS       2
      46           0 : #define MAX37190_PWMFREQUENCY_PWM_LENGTH                4
      47           0 : #define MAX37190_PWMFREQUENCY_PWM4TO6_POS               4
      48           0 : #define MAX37190_PWMFREQUENCY_PWM1TO3_LENGTH            4
      49           0 : #define MAX37190_PWMFREQUENCY_PWM1TO3_POS               0
      50           0 : #define MAX37190_FANXCONFIGURATION_SPINUP_LENGTH        2
      51           0 : #define MAX37190_FANXCONFIGURATION_SPINUP_POS           5
      52             : 
      53           0 : #define MAX31790_FANXDYNAMCIS_SPEED_RANGE_GET(value)                                               \
      54             :         FIELD_GET(GENMASK(MAX37190_FANXDYNAMICS_SPEEDRANGE_LENGTH +                                \
      55             :                                   MAX37190_FANXDYNAMICS_SPEEDRANGE_POS - 1,                        \
      56             :                           MAX37190_FANXDYNAMICS_SPEEDRANGE_POS),                                   \
      57             :                   value)
      58             : 
      59           0 : #define MAX31790_FLAG_SPEED_RANGE_GET(flags)                                                       \
      60             :         FIELD_GET(GENMASK(MAX37190_FANXDYNAMICS_SPEEDRANGE_LENGTH +                                \
      61             :                                   PWM_MAX31790_FLAG_SPEED_RANGE_POS - 1,                           \
      62             :                           PWM_MAX31790_FLAG_SPEED_RANGE_POS),                                      \
      63             :                   flags)
      64           0 : #define MAX31790_FLAG_PWM_RATE_OF_CHANGE_GET(flags)                                                \
      65             :         FIELD_GET(GENMASK(MAX37190_FANXDYNAMICS_PWMRATEOFCHANGE_LENGTH +                           \
      66             :                                   PWM_MAX31790_FLAG_PWM_RATE_OF_CHANGE_POS - 1,                    \
      67             :                           PWM_MAX31790_FLAG_PWM_RATE_OF_CHANGE_POS),                               \
      68             :                   flags)
      69             : 
      70             : #endif /* ZEPHYR_INCLUDE_DRIVERS_MFD_MAX31790_H_ */

Generated by: LCOV version 1.14