An issue is found in suspend/resume - if we touch screen with pen when
system is in Sleep state, system is not responding when it wakes up.
It's a similar issue that commit 20c3781a7fb9 ("MLK-20306 gpio: mxc:
Skip GPIO_IMR restore in noirq resume") was fixing.
The root cause is that GPIO_IMR is saved as enabled before suspend,
and IRQ arrived in suspend state, during resume, the IMR is restored
to unmask the IRQ, the IRQ keep coming and touch driver is NOT ready
to handle it. Similar to commit 20c3781a7fb9, fix the issue by removing
GPIO_IMR register save/restore from GPIO driver.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
The 16bit distance value was read into an
unsigned char, stripping away 8bits and
wrapping negative values. This patch
reads the distance (hover) value as an
16-bit integer.
Device-connected sysfs property is vulnerable for simultanious access by
IRQ handler and sysfs property show handler.
Fix bug causing kernel stack-dump/crash when trying to read current pinctrl state through sysfs property
Temporary skip authentication of calling application
Check connection state before changing state (to keep connection state while
changing mode).
Other cleanup
- Fix typo in devicetree causing pincontrol not being registered
- Change pin mux states to use both RX and TX pin
- Implement preliminary first attempt to communicate over ow (wip)
- Add registration as extcon device
- Add ow tty property in device-tree
- Add ow gpio property in device-tree
- Add GPIO IRQ initiation/hanndling in delayed worker
Add devicetree connection from usbotg1 to otgcontrol, which then will receive
VID status from otgcontrol based on SW control (no physical signal in connector)
Besides "Charger" and "OTG Supply", it supports the third state "Off"
for charger_mode property. To set the propety to "Off" state, either of
the following command should work.
1. $ echo 2 > /sys/class/power_supply/max77818-charger/charger_mode
2. $ echo Off > /sys/class/power_supply/max77818-charger/charger_mode
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Now charger driver can automatically turn on/off charger for as needed,
so we do not want to allow ONLINE property writeable from outside.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
It improves max77818_charger_set_enable() function call and usage in
the following aspects.
- Print MODE value to be set with dev_info().
- Add error messages for possible failures, so that we do not have to
check return for every single calling.
- Always set MODE_OTG_BUCK_BOOST as long as we set enabling for OTG
mode, because we do not want implicit disabling but explicit disabling
by calling max77818_charger_set_enable(0).
- When we set charger_mode property, we should enable or disable charger
according to charger availability, rather than always disabling.
- Change dev_info() to dev_dbg() in max77818_do_irq(), as we are already
printing MODE value, which is more important.
- Ignore interrupt in OTG mode, as we do not want to actively manage
charger on/off for OTG mode, but only when charger_mode property is
set.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
The field 'present' is only used once in max77818_charger_update()
function. It doesn't really need to be defined in struct
max77818_charger. Let's drop it. In the meantime, move around the
code a little bit and save the xxx_UNKNOWN assignments, as they have
been done just above.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Charging in FASTCHARGE_CC/CV could be because of that the other charger
rather than the one being checked is present. So we need to add one
more condition to ensure the other charger is not present.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
The dtls[] data type should be u8, so that regmap_buck_read() can read
correct DTLS_00 ~ DTLS02 values into dtls[3].
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
These two functions now only enable/disable charger and are called by
max77818_do_irq(). Let's simplify the code a little bit by drop the
functions and call max77818_charger_set_enable() from max77818_do_irq()
directly.
While at it, flip the order of dev_info() message output and
max77818_charger_set_enable() call, as it's more natural to print the
event message and then take action on the event.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
As charge current can not be set by .set_property hook any more, the
only place we need to set charge current is from max77818_charger_initialize().
So let's drop max77818_charger_set_charge_current() function and write
register directly in max77818_charger_initialize().
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
There could be situation where charger is present but it's not charging,
like charger is in timer fault, suspend, input invalid, junction
temperature (see register DETAILS_01, bits CHG_DTLS for details).
As battery driver reports its charging status by looking at online
property of charger device, this causes confusion that charger reports
Not Charging while in the meantime battery reports Charging status.
It's more accurate to report charger online status by looking at
CHARGING state, so that charger and battery stay consistent on charging
status.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
In OTG supply mode, we should allow WCIN to power system and charge
battery. So mode 0x0F should be better than 0x0E.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>