#include <linux/hwmon.h>
#include <linux/interrupt.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/pwm.h>
#include <linux/regulator/consumer.h>
#include <linux/sysfs.h>
#include <linux/thermal.h>
#include <linux/timer.h>
#define MAX_PWM …
struct pwm_fan_tach { … };
enum pwm_fan_enable_mode { … };
struct pwm_fan_ctx { … };
static irqreturn_t pulse_handler(int irq, void *dev_id)
{ … }
static void sample_timer(struct timer_list *t)
{ … }
static void pwm_fan_enable_mode_2_state(int enable_mode,
struct pwm_state *state,
bool *enable_regulator)
{ … }
static int pwm_fan_switch_power(struct pwm_fan_ctx *ctx, bool on)
{ … }
static int pwm_fan_power_on(struct pwm_fan_ctx *ctx)
{ … }
static int pwm_fan_power_off(struct pwm_fan_ctx *ctx)
{ … }
static int __set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm)
{ … }
static int set_pwm(struct pwm_fan_ctx *ctx, unsigned long pwm)
{ … }
static void pwm_fan_update_state(struct pwm_fan_ctx *ctx, unsigned long pwm)
{ … }
static int pwm_fan_update_enable(struct pwm_fan_ctx *ctx, long val)
{ … }
static int pwm_fan_write(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long val)
{ … }
static int pwm_fan_read(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long *val)
{ … }
static umode_t pwm_fan_is_visible(const void *data,
enum hwmon_sensor_types type,
u32 attr, int channel)
{ … }
static const struct hwmon_ops pwm_fan_hwmon_ops = …;
static int pwm_fan_get_max_state(struct thermal_cooling_device *cdev,
unsigned long *state)
{ … }
static int pwm_fan_get_cur_state(struct thermal_cooling_device *cdev,
unsigned long *state)
{ … }
static int
pwm_fan_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state)
{ … }
static const struct thermal_cooling_device_ops pwm_fan_cooling_ops = …;
static int pwm_fan_get_cooling_data(struct device *dev, struct pwm_fan_ctx *ctx)
{ … }
static void pwm_fan_cleanup(void *__ctx)
{ … }
static int pwm_fan_probe(struct platform_device *pdev)
{ … }
static void pwm_fan_shutdown(struct platform_device *pdev)
{ … }
static int pwm_fan_suspend(struct device *dev)
{ … }
static int pwm_fan_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(pwm_fan_pm, pwm_fan_suspend, pwm_fan_resume);
static const struct of_device_id of_pwm_fan_match[] = …;
MODULE_DEVICE_TABLE(of, of_pwm_fan_match);
static struct platform_driver pwm_fan_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_ALIAS(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;