From 84905217ec74a9cfbcc32d038cdda0de6b515f8f Mon Sep 17 00:00:00 2001 From: Shilpa Suresh Date: Wed, 31 Mar 2021 13:35:37 +0530 Subject: [PATCH] include: uapi: Add charger specific headers for QM215 Add all the header files required for the charger/fg/bms drivers for QM215 target. Add snapshots of the new files as of msm-4.9 commit 0848b3af1d2f ("ARM: dts: qcom: disabled wled bl type for sim_vid panel"). Change-Id: Idd1485908488f5eddcee17bb536411abfc4ff6e6 Signed-off-by: Shilpa Suresh --- gen_headers_arm.bp | 2 ++ gen_headers_arm64.bp | 2 ++ include/linux/batterydata-interface.h | 7 +++++ include/uapi/linux/batterydata-interface.h | 31 +++++++++++++++++++ include/uapi/linux/vm_bms.h | 35 ++++++++++++++++++++++ 5 files changed, 77 insertions(+) create mode 100644 include/linux/batterydata-interface.h create mode 100644 include/uapi/linux/batterydata-interface.h create mode 100644 include/uapi/linux/vm_bms.h diff --git a/gen_headers_arm.bp b/gen_headers_arm.bp index b5a546f124ac..e8678343488b 100644 --- a/gen_headers_arm.bp +++ b/gen_headers_arm.bp @@ -148,6 +148,7 @@ gen_headers_out_arm = [ "linux/b1lli.h", "linux/batadv_packet.h", "linux/batman_adv.h", + "linux/batterydata-interface.h", "linux/baycom.h", "linux/bcache.h", "linux/bcm933xx_hcs.h", @@ -623,6 +624,7 @@ gen_headers_out_arm = [ "linux/virtio_scsi.h", "linux/virtio_types.h", "linux/virtio_vsock.h", + "linux/vm_bms.h", "linux/vm_sockets.h", "linux/vm_sockets_diag.h", "linux/vmcore.h", diff --git a/gen_headers_arm64.bp b/gen_headers_arm64.bp index 17616f395cf2..8b884b3ed6ad 100644 --- a/gen_headers_arm64.bp +++ b/gen_headers_arm64.bp @@ -143,6 +143,7 @@ gen_headers_out_arm64 = [ "linux/b1lli.h", "linux/batadv_packet.h", "linux/batman_adv.h", + "linux/batterydata-interface.h", "linux/baycom.h", "linux/bcache.h", "linux/bcm933xx_hcs.h", @@ -617,6 +618,7 @@ gen_headers_out_arm64 = [ "linux/virtio_scsi.h", "linux/virtio_types.h", "linux/virtio_vsock.h", + "linux/vm_bms.h", "linux/vm_sockets.h", "linux/vm_sockets_diag.h", "linux/vmcore.h", diff --git a/include/linux/batterydata-interface.h b/include/linux/batterydata-interface.h new file mode 100644 index 000000000000..aa3acd268ddd --- /dev/null +++ b/include/linux/batterydata-interface.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright (c) 2014-2015, 2018, 2021, The Linux Foundation. All rights reserved. + */ + +#include + +int config_battery_data(struct bms_battery_data *profile); diff --git a/include/uapi/linux/batterydata-interface.h b/include/uapi/linux/batterydata-interface.h new file mode 100644 index 000000000000..07cd900c0f4d --- /dev/null +++ b/include/uapi/linux/batterydata-interface.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +#ifndef __BATTERYDATA_LIB_H__ +#define __BATTERYDATA_LIB_H__ + +#include + +/** + * struct battery_params - Battery profile data to be exchanged. + * @soc: SOC (state of charge) of the battery + * @ocv_uv: OCV (open circuit voltage) of the battery + * @rbatt_sf: RBATT scaling factor + * @batt_temp: Battery temperature in deci-degree. + * @slope: Slope of the OCV-SOC curve. + * @fcc_mah: FCC (full charge capacity) of the battery. + */ +struct battery_params { + int soc; + int ocv_uv; + int rbatt_sf; + int batt_temp; + int slope; + int fcc_mah; +}; + +/* IOCTLs to query battery profile data */ +#define BPIOCXSOC _IOWR('B', 0x01, struct battery_params) /* SOC */ +#define BPIOCXRBATT _IOWR('B', 0x02, struct battery_params) /* RBATT SF */ +#define BPIOCXSLOPE _IOWR('B', 0x03, struct battery_params) /* SLOPE */ +#define BPIOCXFCC _IOWR('B', 0x04, struct battery_params) /* FCC */ + +#endif diff --git a/include/uapi/linux/vm_bms.h b/include/uapi/linux/vm_bms.h new file mode 100644 index 000000000000..db537f478f0c --- /dev/null +++ b/include/uapi/linux/vm_bms.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +#ifndef __VM_BMS_H__ +#define __VM_BMS_H__ + +#define VM_BMS_DEVICE "/dev/vm_bms" +#define MAX_FIFO_REGS 8 + +/** + * struct qpnp_vm_bms_data - vm-bms data (passed to usersapce) + * @data_type: type of data filled up + * @num_fifo: count of valid fifo averages + * @fifo_uv: array of fifo averages in uv + * @sample_interval sample interval of the fifo data in ms + * @sample_count total samples in one fifo + * @acc_uv averaged accumulator value in uv + * @acc_count num of accumulated samples + * @seq_num sequence number of the data + */ +struct qpnp_vm_bms_data { + unsigned int num_fifo; + unsigned int fifo_uv[MAX_FIFO_REGS]; + unsigned int sample_interval_ms; + unsigned int sample_count; + unsigned int acc_uv; + unsigned int acc_count; + unsigned int seq_num; +}; + +enum vmbms_power_usecase { + VMBMS_IGNORE_ALL_BIT = 1, + VMBMS_VOICE_CALL_BIT = (1 << 4), + VMBMS_STATIC_DISPLAY_BIT = (1 << 5), +}; + +#endif /* __VM_BMS_H__ */