power: supply: Introduce qti_battery_charger_xiaomi

This contains huge xiaomi additions like the sysfs attributes

Change-Id: I542476baaff220299d0aa0346de337c87356f271
This commit is contained in:
Arian 2022-10-16 15:02:23 +02:00 committed by Giovanni Ricca
parent 66d9b9a489
commit a6512f27cb
No known key found for this signature in database
4 changed files with 3165 additions and 7 deletions

View File

@ -93,5 +93,5 @@ obj-$(CONFIG_CHARGER_UCS1002) += ucs1002_power.o
obj-$(CONFIG_CHARGER_BD70528) += bd70528-charger.o
obj-$(CONFIG_CHARGER_WILCO) += wilco-charger.o
obj-$(CONFIG_QTI_BATTERY_CHARGER) += qti_battery_charger_main.o
qti_battery_charger_main-y += qti_battery_charger.o qti_typec_class.o
qti_battery_charger_main-y += qti_battery_charger.o qti_typec_class.o qti_battery_charger_xiaomi.o
obj-$(CONFIG_QCOM_POWER_SUPPLY) += qcom/

View File

@ -87,7 +87,7 @@ static const unsigned int bcdev_usb_extcon_cable[] = {
};
/* Standard usb_type definitions similar to power_supply_sysfs.c */
static const char * const power_supply_usb_type_text[] = {
const char * const power_supply_usb_type_text[] = {
"Unknown", "USB", "USB_DCP", "USB_CDP", "USB_ACA", "USB_C",
"USB_PD", "PD_DRP", "PD_PPS", "BrickID", "USB_HVDCP",
"USB_HVDCP3","USB_HVDCP3P5", "USB_FLOAT"
@ -124,7 +124,7 @@ static int battery_chg_fw_write(struct battery_chg_dev *bcdev, void *data,
return rc;
}
static int battery_chg_write(struct battery_chg_dev *bcdev, void *data,
int battery_chg_write(struct battery_chg_dev *bcdev, void *data,
int len)
{
int rc;
@ -160,7 +160,7 @@ static int battery_chg_write(struct battery_chg_dev *bcdev, void *data,
return 0;
}
static int write_property_id(struct battery_chg_dev *bcdev,
int write_property_id(struct battery_chg_dev *bcdev,
struct psy_state *pst, u32 prop_id, u32 val)
{
struct battery_charger_req_msg req_msg = { { 0 } };
@ -179,7 +179,7 @@ static int write_property_id(struct battery_chg_dev *bcdev,
return battery_chg_write(bcdev, &req_msg, sizeof(req_msg));
}
static int read_property_id(struct battery_chg_dev *bcdev,
int read_property_id(struct battery_chg_dev *bcdev,
struct psy_state *pst, u32 prop_id)
{
struct battery_charger_req_msg req_msg = { { 0 } };
@ -916,7 +916,7 @@ static int battery_psy_set_fcc(struct battery_chg_dev *bcdev, u32 prop_id, int v
return rc;
}
static int usb_psy_get_prop(struct power_supply *psy,
int usb_psy_get_prop(struct power_supply *psy,
enum power_supply_property prop,
union power_supply_propval *pval)
{
@ -1880,7 +1880,18 @@ static struct attribute *battery_class_attrs[] = {
&class_attr_usb_typec_compliant.attr,
NULL,
};
ATTRIBUTE_GROUPS(battery_class);
static const struct attribute_group battery_class_group = {
.attrs = battery_class_attrs,
};
extern const struct attribute_group xiaomi_battery_class_group;
static const struct attribute_group *battery_class_groups[] = {
&battery_class_group,
&xiaomi_battery_class_group,
NULL,
};
#ifdef CONFIG_DEBUG_FS
static void battery_chg_add_debugfs(struct battery_chg_dev *bcdev)
@ -2107,6 +2118,9 @@ static int register_extcon_conn_type(struct battery_chg_dev *bcdev)
return rc;
}
extern void generate_xm_charge_uvent(struct work_struct *work);
extern void xm_charger_debug_info_print_work(struct work_struct *work);
static int battery_chg_probe(struct platform_device *pdev)
{
struct battery_chg_dev *bcdev;
@ -2248,6 +2262,8 @@ static int battery_chg_probe(struct platform_device *pdev)
schedule_work(&bcdev->usb_type_work);
INIT_DELAYED_WORK( &bcdev->xm_prop_change_work, generate_xm_charge_uvent);
INIT_DELAYED_WORK( &bcdev->charger_debug_info_print_work, xm_charger_debug_info_print_work);
schedule_delayed_work(&bcdev->charger_debug_info_print_work, 5 * HZ);
bcdev->slave_fg_verify_flag = false;

View File

@ -50,8 +50,24 @@
#define ADAP_TYPE_DCP 2
#define ADAP_TYPE_PD 6
#define USBPD_UVDM_SS_LEN 4
#define USBPD_UVDM_VERIFIED_LEN 1
#define MAX_THERMAL_LEVEL 16
enum uvdm_state {
USBPD_UVDM_DISCONNECT,
USBPD_UVDM_CHARGER_VERSION,
USBPD_UVDM_CHARGER_VOLTAGE,
USBPD_UVDM_CHARGER_TEMP,
USBPD_UVDM_SESSION_SEED,
USBPD_UVDM_AUTHENTICATION,
USBPD_UVDM_VERIFIED,
USBPD_UVDM_REMOVE_COMPENSATION,
USBPD_UVDM_REVERSE_AUTHEN,
USBPD_UVDM_CONNECT,
};
enum usb_connector_type {
USB_CONNECTOR_TYPE_TYPEC,
USB_CONNECTOR_TYPE_MICRO_USB,
@ -319,6 +335,15 @@ struct xm_verify_digest_resp_msg {
bool slave_fg;
};
struct xm_set_wls_bin_req_msg {
struct pmic_glink_hdr hdr;
u32 property_id;
u16 total_length;
u8 serial_number;
u8 fw_area;
u8 wls_fw_bin[MAX_STR_LEN];
}; /* Message */
struct wireless_fw_check_req {
struct pmic_glink_hdr hdr;
u32 fw_version;

File diff suppressed because it is too large Load Diff