Skip to content

Commit

Permalink
include: uapi: Add charger specific headers for QM215
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Shilpa Suresh committed Apr 1, 2021
1 parent a5eb56f commit 8490521
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gen_headers_arm.bp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions gen_headers_arm64.bp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions include/linux/batterydata-interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2014-2015, 2018, 2021, The Linux Foundation. All rights reserved.
*/

#include <uapi/linux/batterydata-interface.h>

int config_battery_data(struct bms_battery_data *profile);
31 changes: 31 additions & 0 deletions include/uapi/linux/batterydata-interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
#ifndef __BATTERYDATA_LIB_H__
#define __BATTERYDATA_LIB_H__

#include <linux/ioctl.h>

/**
* 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
35 changes: 35 additions & 0 deletions include/uapi/linux/vm_bms.h
Original file line number Diff line number Diff line change
@@ -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__ */

0 comments on commit 8490521

Please sign in to comment.