#include <linux/clk.h>
#include <linux/device.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/platform_device.h>
#include <linux/spinlock.h>
#include <linux/sysfs.h>
#include <linux/thermal.h>
#define NPCM7XX_PWM_REG_BASE(base, n) …
#define NPCM7XX_PWM_REG_PR(base, n) …
#define NPCM7XX_PWM_REG_CSR(base, n) …
#define NPCM7XX_PWM_REG_CR(base, n) …
#define NPCM7XX_PWM_REG_CNRx(base, n, ch) …
#define NPCM7XX_PWM_REG_CMRx(base, n, ch) …
#define NPCM7XX_PWM_REG_PDRx(base, n, ch) …
#define NPCM7XX_PWM_REG_PIER(base, n) …
#define NPCM7XX_PWM_REG_PIIR(base, n) …
#define NPCM7XX_PWM_CTRL_CH0_MODE_BIT …
#define NPCM7XX_PWM_CTRL_CH1_MODE_BIT …
#define NPCM7XX_PWM_CTRL_CH2_MODE_BIT …
#define NPCM7XX_PWM_CTRL_CH3_MODE_BIT …
#define NPCM7XX_PWM_CTRL_CH0_INV_BIT …
#define NPCM7XX_PWM_CTRL_CH1_INV_BIT …
#define NPCM7XX_PWM_CTRL_CH2_INV_BIT …
#define NPCM7XX_PWM_CTRL_CH3_INV_BIT …
#define NPCM7XX_PWM_CTRL_CH0_EN_BIT …
#define NPCM7XX_PWM_CTRL_CH1_EN_BIT …
#define NPCM7XX_PWM_CTRL_CH2_EN_BIT …
#define NPCM7XX_PWM_CTRL_CH3_EN_BIT …
#define NPCM7XX_PWM_MAX_CHN_NUM …
#define NPCM7XX_PWM_MAX_CHN_NUM_IN_A_MODULE …
#define NPCM7XX_PWM_MAX_MODULES …
#define NPCM7XX_PWM_COUNTER_DEFAULT_NUM …
#define NPCM7XX_PWM_CMR_DEFAULT_NUM …
#define NPCM7XX_PWM_CMR_MAX …
#define NPCM7XX_PWM_PRESCALE2_DEFAULT_CH0 …
#define NPCM7XX_PWM_PRESCALE2_DEFAULT_CH1 …
#define NPCM7XX_PWM_PRESCALE2_DEFAULT_CH2 …
#define NPCM7XX_PWM_PRESCALE2_DEFAULT_CH3 …
#define PWM_OUTPUT_FREQ_25KHZ …
#define PWN_CNT_DEFAULT …
#define MIN_PRESCALE1 …
#define NPCM7XX_PWM_PRESCALE_SHIFT_CH01 …
#define NPCM7XX_PWM_PRESCALE2_DEFAULT …
#define NPCM7XX_PWM_CTRL_MODE_DEFAULT …
#define NPCM7XX_FAN_REG_BASE(base, n) …
#define NPCM7XX_FAN_REG_TCNT1(base, n) …
#define NPCM7XX_FAN_REG_TCRA(base, n) …
#define NPCM7XX_FAN_REG_TCRB(base, n) …
#define NPCM7XX_FAN_REG_TCNT2(base, n) …
#define NPCM7XX_FAN_REG_TPRSC(base, n) …
#define NPCM7XX_FAN_REG_TCKC(base, n) …
#define NPCM7XX_FAN_REG_TMCTRL(base, n) …
#define NPCM7XX_FAN_REG_TICTRL(base, n) …
#define NPCM7XX_FAN_REG_TICLR(base, n) …
#define NPCM7XX_FAN_REG_TIEN(base, n) …
#define NPCM7XX_FAN_REG_TCPA(base, n) …
#define NPCM7XX_FAN_REG_TCPB(base, n) …
#define NPCM7XX_FAN_REG_TCPCFG(base, n) …
#define NPCM7XX_FAN_REG_TINASEL(base, n) …
#define NPCM7XX_FAN_REG_TINBSEL(base, n) …
#define NPCM7XX_FAN_TCKC_CLKX_NONE …
#define NPCM7XX_FAN_TCKC_CLK1_APB …
#define NPCM7XX_FAN_TCKC_CLK2_APB …
#define NPCM7XX_FAN_TMCTRL_TBEN …
#define NPCM7XX_FAN_TMCTRL_TAEN …
#define NPCM7XX_FAN_TMCTRL_TBEDG …
#define NPCM7XX_FAN_TMCTRL_TAEDG …
#define NPCM7XX_FAN_TMCTRL_MODE_5 …
#define NPCM7XX_FAN_TICLR_CLEAR_ALL …
#define NPCM7XX_FAN_TICLR_TFCLR …
#define NPCM7XX_FAN_TICLR_TECLR …
#define NPCM7XX_FAN_TICLR_TDCLR …
#define NPCM7XX_FAN_TICLR_TCCLR …
#define NPCM7XX_FAN_TICLR_TBCLR …
#define NPCM7XX_FAN_TICLR_TACLR …
#define NPCM7XX_FAN_TIEN_ENABLE_ALL …
#define NPCM7XX_FAN_TIEN_TFIEN …
#define NPCM7XX_FAN_TIEN_TEIEN …
#define NPCM7XX_FAN_TIEN_TDIEN …
#define NPCM7XX_FAN_TIEN_TCIEN …
#define NPCM7XX_FAN_TIEN_TBIEN …
#define NPCM7XX_FAN_TIEN_TAIEN …
#define NPCM7XX_FAN_TICTRL_TFPND …
#define NPCM7XX_FAN_TICTRL_TEPND …
#define NPCM7XX_FAN_TICTRL_TDPND …
#define NPCM7XX_FAN_TICTRL_TCPND …
#define NPCM7XX_FAN_TICTRL_TBPND …
#define NPCM7XX_FAN_TICTRL_TAPND …
#define NPCM7XX_FAN_TCPCFG_HIBEN …
#define NPCM7XX_FAN_TCPCFG_EQBEN …
#define NPCM7XX_FAN_TCPCFG_LOBEN …
#define NPCM7XX_FAN_TCPCFG_CPBSEL …
#define NPCM7XX_FAN_TCPCFG_HIAEN …
#define NPCM7XX_FAN_TCPCFG_EQAEN …
#define NPCM7XX_FAN_TCPCFG_LOAEN …
#define NPCM7XX_FAN_TCPCFG_CPASEL …
#define NPCM7XX_FAN_MAX_MODULE …
#define NPCM7XX_FAN_MAX_CHN_NUM_IN_A_MODULE …
#define NPCM7XX_FAN_MAX_CHN_NUM …
#define NPCM7XX_FAN_TIMEOUT …
#define NPCM7XX_FAN_TCNT …
#define NPCM7XX_FAN_TCPA …
#define NPCM7XX_FAN_TCPB …
#define NPCM7XX_FAN_POLL_TIMER_200MS …
#define NPCM7XX_FAN_DEFAULT_PULSE_PER_REVOLUTION …
#define NPCM7XX_FAN_TINASEL_FANIN_DEFAULT …
#define NPCM7XX_FAN_CLK_PRESCALE …
#define NPCM7XX_FAN_CMPA …
#define NPCM7XX_FAN_CMPB …
#define NPCM7XX_FAN_INPUT(fan, cmp) …
#define FAN_DISABLE …
#define FAN_INIT …
#define FAN_PREPARE_TO_GET_FIRST_CAPTURE …
#define FAN_ENOUGH_SAMPLE …
struct npcm_hwmon_info { … };
struct npcm7xx_fan_dev { … };
struct npcm7xx_cooling_device { … };
struct npcm7xx_pwm_fan_data { … };
static int npcm7xx_pwm_config_set(struct npcm7xx_pwm_fan_data *data,
int channel, u16 val)
{ … }
static inline void npcm7xx_fan_start_capture(struct npcm7xx_pwm_fan_data *data,
u8 fan, u8 cmp)
{ … }
static void npcm7xx_fan_polling(struct timer_list *t)
{ … }
static inline void npcm7xx_fan_compute(struct npcm7xx_pwm_fan_data *data,
u8 fan, u8 cmp, u8 fan_id, u8 flag_int,
u8 flag_mode, u8 flag_clear)
{ … }
static inline void npcm7xx_check_cmp(struct npcm7xx_pwm_fan_data *data,
u8 fan, u8 cmp, u8 flag)
{ … }
static irqreturn_t npcm7xx_fan_isr(int irq, void *dev_id)
{ … }
static int npcm7xx_read_pwm(struct device *dev, u32 attr, int channel,
long *val)
{ … }
static int npcm7xx_write_pwm(struct device *dev, u32 attr, int channel,
long val)
{ … }
static umode_t npcm7xx_pwm_is_visible(const void *_data, u32 attr, int channel)
{ … }
static int npcm7xx_read_fan(struct device *dev, u32 attr, int channel,
long *val)
{ … }
static umode_t npcm7xx_fan_is_visible(const void *_data, u32 attr, int channel)
{ … }
static int npcm7xx_read(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long *val)
{ … }
static int npcm7xx_write(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long val)
{ … }
static umode_t npcm7xx_is_visible(const void *data,
enum hwmon_sensor_types type,
u32 attr, int channel)
{ … }
static const struct hwmon_channel_info * const npcm7xx_info[] = …;
static const struct hwmon_ops npcm7xx_hwmon_ops = …;
static const struct hwmon_chip_info npcm7xx_chip_info = …;
static const struct npcm_hwmon_info npxm7xx_hwmon_info = …;
static const struct npcm_hwmon_info npxm8xx_hwmon_info = …;
static u32 npcm7xx_pwm_init(struct npcm7xx_pwm_fan_data *data)
{ … }
static void npcm7xx_fan_init(struct npcm7xx_pwm_fan_data *data)
{ … }
static int
npcm7xx_pwm_cz_get_max_state(struct thermal_cooling_device *tcdev,
unsigned long *state)
{ … }
static int
npcm7xx_pwm_cz_get_cur_state(struct thermal_cooling_device *tcdev,
unsigned long *state)
{ … }
static int
npcm7xx_pwm_cz_set_cur_state(struct thermal_cooling_device *tcdev,
unsigned long state)
{ … }
static const struct thermal_cooling_device_ops npcm7xx_pwm_cool_ops = …;
static int npcm7xx_create_pwm_cooling(struct device *dev,
struct device_node *child,
struct npcm7xx_pwm_fan_data *data,
u32 pwm_port, u8 num_levels)
{ … }
static int npcm7xx_en_pwm_fan(struct device *dev,
struct device_node *child,
struct npcm7xx_pwm_fan_data *data)
{ … }
static int npcm7xx_pwm_fan_probe(struct platform_device *pdev)
{ … }
static const struct of_device_id of_pwm_fan_match_table[] = …;
MODULE_DEVICE_TABLE(of, of_pwm_fan_match_table);
static struct platform_driver npcm7xx_pwm_fan_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;