#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pse-pd/pse.h>
#define PD692X0_PSE_NAME …
#define PD692X0_MAX_PIS …
#define PD692X0_MAX_MANAGERS …
#define PD692X0_MAX_MANAGER_PORTS …
#define PD692X0_MAX_HW_PORTS …
#define PD69200_BT_PROD_VER …
#define PD69210_BT_PROD_VER …
#define PD69220_BT_PROD_VER …
#define PD692X0_FW_MAJ_VER …
#define PD692X0_FW_MIN_VER …
#define PD692X0_FW_PATCH_VER …
enum pd692x0_fw_state { … };
struct pd692x0_msg { … } __packed;
struct pd692x0_msg_ver { … };
enum { … };
enum { … };
struct pd692x0_priv { … };
static const struct pd692x0_msg pd692x0_msg_template_list[PD692X0_MSG_CNT] = …;
static u8 pd692x0_build_msg(struct pd692x0_msg *msg, u8 echo)
{ … }
static int pd692x0_send_msg(struct pd692x0_priv *priv, struct pd692x0_msg *msg)
{ … }
static int pd692x0_reset(struct pd692x0_priv *priv)
{ … }
static bool pd692x0_try_recv_msg(const struct i2c_client *client,
struct pd692x0_msg *msg,
struct pd692x0_msg *buf)
{ … }
static int pd692x0_recv_msg(struct pd692x0_priv *priv,
struct pd692x0_msg *msg,
struct pd692x0_msg *buf)
{ … }
static int pd692x0_sendrecv_msg(struct pd692x0_priv *priv,
struct pd692x0_msg *msg,
struct pd692x0_msg *buf)
{ … }
static struct pd692x0_priv *to_pd692x0_priv(struct pse_controller_dev *pcdev)
{ … }
static int pd692x0_fw_unavailable(struct pd692x0_priv *priv)
{ … }
static int pd692x0_pi_enable(struct pse_controller_dev *pcdev, int id)
{ … }
static int pd692x0_pi_disable(struct pse_controller_dev *pcdev, int id)
{ … }
static int pd692x0_pi_is_enabled(struct pse_controller_dev *pcdev, int id)
{ … }
struct pd692x0_pse_ext_state_mapping { … };
static const struct pd692x0_pse_ext_state_mapping
pd692x0_pse_ext_state_map[] = …;
static void
pd692x0_get_ext_state(struct ethtool_c33_pse_ext_state_info *c33_ext_state_info,
u32 status_code)
{ … }
struct pd692x0_class_pw { … };
#define PD692X0_CLASS_PW_TABLE_SIZE …
static const struct pd692x0_class_pw
pd692x0_class_pw_table[PD692X0_CLASS_PW_TABLE_SIZE] = …;
static int pd692x0_pi_get_pw_from_table(int op_mode, int added_pw)
{ … }
static int pd692x0_pi_set_pw_from_table(struct device *dev,
struct pd692x0_msg *msg, int pw)
{ … }
static int
pd692x0_pi_get_pw_ranges(struct pse_control_status *st)
{ … }
static int pd692x0_ethtool_get_status(struct pse_controller_dev *pcdev,
unsigned long id,
struct netlink_ext_ack *extack,
struct pse_control_status *status)
{ … }
static struct pd692x0_msg_ver pd692x0_get_sw_version(struct pd692x0_priv *priv)
{ … }
struct pd692x0_manager { … };
struct pd692x0_matrix { … };
static int
pd692x0_of_get_ports_manager(struct pd692x0_priv *priv,
struct pd692x0_manager *manager,
struct device_node *np)
{ … }
static int
pd692x0_of_get_managers(struct pd692x0_priv *priv,
struct pd692x0_manager manager[PD692X0_MAX_MANAGERS])
{ … }
static int
pd692x0_set_port_matrix(const struct pse_pi_pairset *pairset,
const struct pd692x0_manager *manager,
int nmanagers, struct pd692x0_matrix *port_matrix)
{ … }
static int
pd692x0_set_ports_matrix(struct pd692x0_priv *priv,
const struct pd692x0_manager *manager,
int nmanagers,
struct pd692x0_matrix port_matrix[PD692X0_MAX_PIS])
{ … }
static int
pd692x0_write_ports_matrix(struct pd692x0_priv *priv,
const struct pd692x0_matrix port_matrix[PD692X0_MAX_PIS])
{ … }
static int pd692x0_setup_pi_matrix(struct pse_controller_dev *pcdev)
{ … }
static int pd692x0_pi_get_voltage(struct pse_controller_dev *pcdev, int id)
{ … }
static int pd692x0_pi_get_current_limit(struct pse_controller_dev *pcdev,
int id)
{ … }
static int pd692x0_pi_set_current_limit(struct pse_controller_dev *pcdev,
int id, int max_uA)
{ … }
static const struct pse_controller_ops pd692x0_ops = …;
#define PD692X0_FW_LINE_MAX_SZ …
static int pd692x0_fw_get_next_line(const u8 *data,
char *line, size_t size)
{ … }
static enum fw_upload_err
pd692x0_fw_recv_resp(const struct i2c_client *client, unsigned long ms_timeout,
const char *msg_ok, unsigned int msg_size)
{ … }
static int pd692x0_fw_write_line(const struct i2c_client *client,
const char line[PD692X0_FW_LINE_MAX_SZ],
const bool last_line)
{ … }
static enum fw_upload_err pd692x0_fw_reset(const struct i2c_client *client)
{ … }
static enum fw_upload_err pd692x0_fw_prepare(struct fw_upload *fwl,
const u8 *data, u32 size)
{ … }
static enum fw_upload_err pd692x0_fw_write(struct fw_upload *fwl,
const u8 *data, u32 offset,
u32 size, u32 *written)
{ … }
static enum fw_upload_err pd692x0_fw_poll_complete(struct fw_upload *fwl)
{ … }
static void pd692x0_fw_cancel(struct fw_upload *fwl)
{ … }
static void pd692x0_fw_cleanup(struct fw_upload *fwl)
{ … }
static const struct fw_upload_ops pd692x0_fw_ops = …;
static int pd692x0_i2c_probe(struct i2c_client *client)
{ … }
static void pd692x0_i2c_remove(struct i2c_client *client)
{ … }
static const struct i2c_device_id pd692x0_id[] = …;
MODULE_DEVICE_TABLE(i2c, pd692x0_id);
static const struct of_device_id pd692x0_of_match[] = …;
MODULE_DEVICE_TABLE(of, pd692x0_of_match);
static struct i2c_driver pd692x0_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;