/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright 2020 Google, LLC
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef __GOOGLE_DC_PPS_H_
#define __GOOGLE_DC_PPS_H_

#include <linux/usb/pd.h>
#include <linux/device.h>
#include <misc/logbuffer.h>

#define PD_T_PPS_TIMEOUT		9000	/* Maximum of 10 seconds */
#define PD_T_PPS_DEADLINE_S		7

#define PPS_KEEP_ALIVE_MAX	3
#define PPS_ERROR_RETRY_MS 	1000
#define CHG_PPS_VOTER		"pps_chg"

/*
 * There is a similar one in tcpm.c
 * NOTE: we don't really need to replicate the values in tcpm.c in the
 * internal state, we just need to know to set 2 to the TCPM power supply
 * to enable PPS.
 */
enum pps_psy_online_states {
	PPS_PSY_OFFLINE = 0,
	PPS_PSY_FIXED_ONLINE,
	PPS_PSY_PROG_ONLINE,
};

enum pd_pps_stage {
	PPS_NOTSUPP = -1,	/* tried and failed or disconnected */
	PPS_DISABLED = 0,	/* default state, never tried */
	PPS_NONE,		/* try to enable */
	PPS_AVAILABLE,
	PPS_ACTIVE,
};

enum pd_nr_pdo {
	PDO_FIXED_5V = 1,
	PDO_FIXED_HIGH_VOLTAGE,
	PDO_PPS,

	PDO_MAX_SUPP = PDO_PPS,
	PDO_MAX = PDO_MAX_OBJECTS,	/* 7 */
};

struct pd_pps_data {
	struct power_supply *pps_psy;
	void *port_data;

	struct wakeup_source *pps_ws;
	bool stay_awake;

	int nr_src_cap;
	u32 *src_caps;
	u32 snk_pdo[PDO_MAX_OBJECTS];
	unsigned int nr_snk_pdo;
	u32 default_pps_pdo;

	int pd_online;
	enum pd_pps_stage stage;
	unsigned int keep_alive_cnt;
	ktime_t last_update;

	/* from TA */
	int min_uv;
	int max_uv;
	int max_ua;

	/* to TA */
	int out_uv;
	int op_ua;

	/* logging client */
	struct logbuffer *log;
};

/* TODO: device dependent */
#define PD_SNK_MAX_MV			9000
/* TODO: device dependent */
#define PD_SNK_MIN_MV			5000

struct tcpm_port;
struct tcpm_port *chg_get_tcpm_port(struct power_supply *tcpm_psy);


/* */
#define pps_is_disabled(x) (((x) == PPS_NOTSUPP) || ((x) == PPS_DISABLED))

#define pps_name(pps_psy) \
	((pps_psy) && (pps_psy)->desc && (pps_psy)->desc->name ? \
		(pps_psy)->desc->name : "<>")


struct dentry;
int pps_init(struct pd_pps_data *pps_data, struct device *dev,
	     struct power_supply *pps_psy);
int pps_init_fs(struct pd_pps_data *pps_data, struct dentry *de);
/* reset state and leave in DISABLED  */
void pps_init_state(struct pd_pps_data *pps_data);
/* free resources  */
void pps_free(struct pd_pps_data *pps_data);

/* Run the PPS state machine   */
int pps_work(struct pd_pps_data *pps, struct power_supply *tcpm_psy);

/* rougly equivalent */
int pps_ping(struct pd_pps_data *pps, struct power_supply *tcpm_psy);
int pps_keep_alive(struct pd_pps_data *pps, struct power_supply *tcpm_psy);

/* update the PPS adapter */
int pps_update_adapter(struct pd_pps_data *pps_data,
		       int pending_uv, int pending_ua,
		       struct power_supply *tcpm_psy);
int pps_check_adapter(struct pd_pps_data *pps,
		      int pending_uv, int pending_ua,
		      struct power_supply *tcpm_psy);

/* */
int pps_prog_offline(struct pd_pps_data *pps, struct power_supply *tcpm_psy);

void pps_adjust_volt(struct pd_pps_data *pps, int mod);

int chg_switch_profile(struct pd_pps_data *pps, struct power_supply *tcpm_psy,
		       bool more_pwr);

int pps_get_apdo_max_power(struct pd_pps_data *pps, unsigned int *ta_idx,
			   unsigned int *ta_max_vol, unsigned int *ta_max_cur,
			   unsigned long *ta_max_pwr);

bool pps_check_prog_online(struct pd_pps_data *pps_data);
bool pps_prog_check_online(struct pd_pps_data *pps_data,
			   struct power_supply *tcpm_psy);

int pps_get_src_cap(struct pd_pps_data *pps, struct power_supply *tcpm_psy);

void pps_set_logbuffer(struct pd_pps_data *pps_data, struct logbuffer *log);
void pps_log(struct pd_pps_data *pps, const char *fmt, ...);

/* probe */
struct power_supply *pps_get_tcpm_psy(struct device_node *node, size_t size);

int pps_request_pdo(struct pd_pps_data *pps_data, unsigned int ta_idx,
		    unsigned int ta_max_vol, unsigned int ta_max_cur);



#endif /* __GOOGLE_DC_PPS_H_ */
