1
0
Fork 0
Commit Graph

721498 Commits (82383b2bb2b6f00eae1a356e4b3d22cc05d26179)

Author SHA1 Message Date
Shawn Guo 82383b2bb2 gpio-mxc: drop GPIO_IMR register save/restore from runtime suspend/resume hooks
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>
2020-10-08 20:07:11 +02:00
Lars Ivar Miljeteig ce15e28ef5 wacom_i2c: Read distance as short integer
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.
2020-10-08 20:07:11 +02:00
Lars Ivar Miljeteig 043f1efbd7 wacom_i2c: Clean-up code
- Use bitmasks
- Don't assign bool prox = 0x03, as bool can be 0 or 1
- Remove unused read_bytes variable
2020-10-08 20:07:11 +02:00
Steinar Bakkemo 6e5820450e otgcontrol: improve driver output during boot when defering probe (not error) 2020-10-08 20:07:11 +02:00
Steinar Bakkemo 1c68dc0481 otgcontrol: add support for setting charger mode to OFF 2020-10-08 20:07:11 +02:00
Steinar Bakkemo 2d54f337c5 otgcntrol: fix simple dev_dbg outputting error message => dev_err 2020-10-08 20:07:11 +02:00
Steinar Bakkemo 437fb4e4fb otgcontrol: enable readback of last written USB OTG dr mode
Fix bug not storing this when setting the USB OTG dr mode
2020-10-08 20:07:11 +02:00
Steinar Bakkemo 33efe1a268 otgcontrol: cleanup sysfs code and fix ugly bug causing unregister to fail 2020-10-08 20:07:11 +02:00
Steinar Bakkemo 8317515b62 chipidea: cleanup/remove debug code 2020-10-08 20:07:11 +02:00
Steinar Bakkemo 345b754acd zero-sugar dts: remove flip-extcon-order property (usbotg1)
update devicetree to use "0" in extcon property for usbogt1 to indicate
"no vbus reference" instead of flipping the order as suggested at first
2020-10-08 20:07:11 +02:00
Steinar Bakkemo b8a02fdefe otgcontrol: add CONFIG_RM_OTGCONTROL_DEBUG
Update Makefile to build with DDEBUG only when CONFIG_RM_OTGCONTROL_DEBUG
is defined
2020-10-08 20:07:11 +02:00
Steinar Bakkemo b598f8263e otgcontrol: remove un-needed deallocation/un-init code
Ref. discussion on this when using devm_xxx(..) version of
allocation/init routines.
2020-10-08 20:07:11 +02:00
Steinar Bakkemo 61da068d56 otgcontrol: replace module_init/module_exit with module_platform_driver 2020-10-08 20:07:11 +02:00
Steinar Bakkemo 2f4756abaa otgcontrol: remove hard-coded one-wire tty device name/path 2020-10-08 20:07:10 +02:00
Steinar Bakkemo 3480cbfef8 otgcontrol: remove deprecated CONFIG_OF checks 2020-10-08 20:07:10 +02:00
Steinar Bakkemo 1e1203e926 otgcontrol: move include/linux/rm-otgcontrol.h => drivers/misc/rm-otgcontrol/ 2020-10-08 20:06:40 +02:00
Steinar Bakkemo e4330ec5be otgcontrol: adapt to changed charger-driver interface
Original "set mode + set online" => "set mode"
2020-10-08 20:06:40 +02:00
Steinar Bakkemo fea66edaed otgcontrol: add synch. to device-connected sysfs prop./fix pinctrl read bug
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
2020-10-08 20:06:40 +02:00
Steinar Bakkemo 914d0eaeb4 otgcontrol: improve device OTG control mode handling/authentication handling
Temporary skip  authentication of calling application

Check connection state before changing state (to keep connection state while
changing mode).

Other cleanup
2020-10-08 20:06:40 +02:00
Steinar Bakkemo 658de5096b otgcontrol: add synchronization helpers for synchronization of flags
Add synchronization to one_wire_gpio_irq_is_handling flag checked and
set by GPIO IRQ handler and reset by GPIO IRQ worker.
2020-10-08 20:06:39 +02:00
Steinar Bakkemo a43aaee241 otgcontrol: move pdata properties from otgc_data to otgc_data->pdata structure 2020-10-08 20:06:30 +02:00
Steinar Bakkemo d6cdbfc9bb otgcontrol: adjust to 8 char tab width and squeeze code within 80 chars, dyndbg
Convert printk's to dev_dbg.

Fix tabs (8 chars) and wrap lines to fit within 80 chars, according to kernel
standards.
2020-10-08 20:03:39 +02:00
Steinar Bakkemo 5e2d8da943 chipidea: convert printk's to dev_dbg 2020-10-08 19:52:42 +02:00
Steinar Bakkemo 2987bdd987 otgcontrol: load otgcontrol as builtin module/driver 2020-10-08 19:52:42 +02:00
Steinar Bakkemo 22ef032019 zero-sugar dts: remove vbus-supply-name property (replaced by vbus-supply phandle) 2020-10-08 19:52:42 +02:00
Steinar Bakkemo 7e2599d4fb otgcontrol: improve pdata initialization and probe defer/unallocation sequence 2020-10-08 19:52:42 +02:00
Steinar Bakkemo 55de395473 otgcontrol: improve sysfs attribute group allocation
Add static sysfs attribute definitions										.
Add attribute group de-allocation during un-init of the sysfs structures
2020-10-08 19:52:36 +02:00
Steinar Bakkemo a7a96a0a46 otgcontrol: clean up uninitialize code in driver probe 2020-10-08 19:49:55 +02:00
Steinar Bakkemo 7f19e08723 zero-sugar dts: update devicetree with changes required for the otgcontrol driver
Add otgcontrol
Add uart6
Change pin mux states to use both RX and TX pin
Enable usbotg1 with reference to otgcontrol through extcon interface
2020-10-08 19:49:55 +02:00
Steinar Bakkemo de8d0dd5c8 otgcontrol: improve ow/pogo IRQ handling (500 ms debounce/filter), bugfix
Fix bug caused by calling wrong method when trying to switch USB OTG DR mode
2020-10-08 19:49:42 +02:00
Steinar Bakkemo 2833df5aa4 otgcontrol: implement initial FSM
Complete disabling of authenticated USB device connection in all modes

Code cleanup
- Spaces -> tabs
- Cleaner initiation sequence
2020-10-08 19:46:24 +02:00
Steinar Bakkemo e05abcf7da rtc-bd7181x: disable debug output 2020-10-08 19:27:45 +02:00
Steinar Bakkemo e353de030a otgcontrol: add one-wire gpio irq handling
- 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
2020-10-08 19:27:33 +02:00
Steinar Bakkemo 32bea6bc06 chipidea: add of property 'flip-extcon-order' fliping VID/VBUS in extcon def. 2020-10-08 19:25:46 +02:00
Steinar Bakkemo 209844546b chipidea: change expected extcon phandle order (only emulate VID and not VBUS)
Add devicetree connection from usbotg1 to otgcontrol, which then will receive
VID status from otgcontrol based on SW control (no physical signal in connector)
2020-10-08 19:25:46 +02:00
Steinar Bakkemo fac945efde otgcontrol: add excton device registration (emulate OTG VID signal -> OTG driver) 2020-10-08 19:25:40 +02:00
Steinar Bakkemo b686926262 zero-sugar wifi-cal dts: sync with zero-sugar.dts 2020-10-08 18:31:23 +02:00
Steinar Bakkemo 5279a775da otgcontrol: rm-otgcontrol driver initial commit 2020-10-08 18:30:57 +02:00
Steinar Bakkemo 73eec6b12c imx7s.dtsi: disable default dma config for uart6 2020-10-08 01:38:41 +02:00
Steinar Bakkemo 6f49239778 chipidea: add excton debug for otgcontrol debug/verification 2020-10-08 01:38:41 +02:00
Shawn Guo 8f1a13f38f max77818-charger: add POWER_SUPPLY_MODE_ALL_OFF for charger_mode property
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>
2020-10-08 01:38:41 +02:00
Shawn Guo 0c53bacfe6 max77818-charger: make ONLINE property non-writeable
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>
2020-10-08 01:38:41 +02:00
Shawn Guo 608c0894ef max77818-charger: improve max77818_charger_set_enable() call
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>
2020-10-08 01:38:41 +02:00
Shawn Guo 16eee8f15e max77818-charger: drop 'present' from struct max77818_charger
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>
2020-10-08 01:38:41 +02:00
Shawn Guo 984cf1cf5e max77818-charger: fix UVLO charging check
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>
2020-10-08 01:38:41 +02:00
Shawn Guo 8ee53f4baf max77818-charger: fix dtls[] data type
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>
2020-10-08 01:38:41 +02:00
Shawn Guo d9ac174917 max77818-charger: drop max77818_charger_init_dev and max77818_charger_exit_dev
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>
2020-10-08 01:38:41 +02:00
Shawn Guo 2d50391fec max77818-charger: drop max77818_charger_set_charge_current() function
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>
2020-10-08 01:38:41 +02:00
Shawn Guo 5e8c4d9508 max77818-charger: report online per charging state
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>
2020-10-08 01:38:41 +02:00
Shawn Guo 072d94ccf2 max77818-charger: change MODE_OTG_BUCK_BOOST to 0x0F
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>
2020-10-08 01:38:41 +02:00