Allowing 'data_role' and 'power_role' sysfs attributes to
be writeable implies that they can be changed independently.
This is only true if there is a PD-capable device attached,
otherwise the write permission should not be set.
Also make sure to call dual_role_instance_changed() at the
conclusion of initiating a DR swap in order to trigger the
is_writeable() callback to update the permissions. Note that
the PR swap case is already handled during the call to
usbpd_set_state(PE_{SRC,SNK}_READY).
Change-Id: I3f4bcaa8ae32af9a124e6f0967509c784e776f7d
Signed-off-by: Jack Pham <jackp@codeaurora.org>
dual_role_instance_changed() is called by drivers when updating
the state of the dual_role port device. In some cases a driver
may wish to dynamically update the visibility, in particular the
write permissions of some of its attributes. For instance,
'data_role' and 'power_role' can be writeable if they can be
changed independently, as in the case of a USB PD capable device,
but may need to be set back to non-writeable when a non-PD device
is attached.
Add a call to sysfs_update_group() in dual_role_changed_work()
which updates the attributes by calling the .is_visible() callback
again, which in turn calls dual_role_property_is_writeable() to
re-check whether write permission should be set or not. Move
dual_role_changed_work() toward the end of the file as it now
needs the definition of dual_role_attr_group.
Change-Id: Ie58b37b63f052aced24db00b91e87deff9ffed7e
Signed-off-by: Jack Pham <jackp@codeaurora.org>
While preparing page tables for fastmap, last level ptes
are not being cache cleaned. Fix this.
Change-Id: I97f894b52484d0d223b15090b94c186bba9af734
Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
SMB1381 acts as a slave charger in SDM630 QRD board. Add device node
to support it.
CRs-Fixed: 2012488
Change-Id: I03803eddc9db5f9bc7901225fa2defd8bcf0e32d
Signed-off-by: Yingwei Zhao <cyizhao@codeaurora.org>
Currently BCL LMH algorithm enable request goes for every time BCL
threshold enablement. It needs to be enabled only once. So Enable
BCL LMH algorithm only once.
Change-Id: I94c7326b7730830f71b71c92df21a589ddd2347b
Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
Just after enabling BCL, reading and evaluating current battery SoC
is bypassed. Because of this, during this same time if battery SoC
is less than preset threshold, BCL doesn't mitigate until next battery
SoC change notification comes. Fix battery SoC read and evaluation
path whenever BCL is enabled.
CRs-Fixed: 2007133
Change-Id: I65639ab078875dc3f6940fd1a89201af98e40881
Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
Presently fastmap iommu feature allocates page tables for
full 4GB virtual address space. This can be optimized to
consider virtual address range [base, size] needed by
client and prepare page tables only for applicable
region.
Change-Id: Ie6c23cb8e1702a823567e126f452b1e72d851f71
Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
If ESR value goes to 0 because of some hardware issue, there is
no way to recover it back from that state. This causes incorrect
SOC reporting leading to a bad user experience. Hence add support
to clamp ESR value based on user defined DT property so that ESR
can be clamped to this value once it is found to go below it.
Since this change modifies ESR value in SRAM, having FG_SRAM_ESR
property would make encode and decode the value easier. Hence
remove fg_get_battery_esr() and get it from FG_SRAM_ESR property.
CRs-Fixed: 2011200
Change-Id: I96250b44f52d6208f3c64fb9e61f70ea41f54f4e
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
Driver is not calling ipc_log_context_destroy in driver
cleanup which leaves the context allocated.
Change-Id: Ic1a74b530836d142c9f1db2143b5700e8b6c3321
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Add sysfs files for user applications to restrict
the battery charge current (FCC). The two files in
/sys/class/qcom-battery/ are -
1. restricted_charging: To enable/disable this feature
2. restricted_current: Restricted FCC (uA)
The default restricted_current value is 1A.
CRs-Fixed: 1113761
Change-Id: I23a6796eaa0c41c2e93a52c45f6200326d262e99
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>