1
0
Fork 0
Commit Graph

3042 Commits (redonkable)

Author SHA1 Message Date
Lars Ivar Miljeteig e69448bf61 rm-otgcontrol: Add licensing info 2020-10-08 20:41:29 +02:00
Steinar Bakkemo 31b0d48e3e otgcontrol: disable initial device connection procedure
Make initial sensing of device connection valid only for authenticated deviced.
Disable authenticated device connection precedure until finally implemented (TBD)
2020-10-08 20:41:28 +02:00
Lars Ivar Miljeteig 6d5938be1f otgcontrol: Fix race condition at OTG enable
Quickfix.

The ci_hdrc crashes if the DR mode is set to HOST while
it is interpreting the "set MODE bits to 0xf" state.

Possible chip errata, where the ci_hdrc has to be
powered on and off to work again.

Fixed by adding a delay of 300-400ms between enabling
OTG power out and setting USB mode to HOST mode.

NOTE: This should be further investigated, as a
delay of 300-400ms in kernel code is A LOT.
2020-10-08 20:41:28 +02:00
Steinar Bakkemo d30c2ef150 otgcontrol: change charger_mode property string to comply with power_supply_sysfs.c
OTG_supply -> OTG Supply
2020-10-08 20:41:21 +02:00
Steinar Bakkemo caeba76d7f otgcontrol: read current GPIO state directly from sysfs attribute_show method
In order to read the current GPIO state regardless of the current controller
mode, and thus regardless of whether the GPIO irq is enabled, a direct
read of the raw GPIO state is done directly from the sysfs attribute_show
method.

Required synchronization was added to the access method to prevent race
if the attribute is read at the same time the irq handler is running.
2020-10-08 20:41:21 +02:00
Steinar Bakkemo a0d2974708 otgcontrol: adapt otg1_chargermode property to take both int/string as input
When reading the otg1_chargermode property, a list of valid strings are
returned.

Valid enum values may be given when writing to the otg1_chargermode
property, in addition to one of the strings returned when reading
the property (Charger, OTG_supply, Off).
2020-10-08 20:41:21 +02:00
Steinar Bakkemo ad88355c92 otgcontrol: add device connection state check when entering unauthorized mode
In order to prevent need for disconnection and reconnection of the QR code
reader during typical test-runs in factory, a check for current connection
state is added when entering unauthorized mode.

In addition, the device disconnect procedure setting charger/USB OTG back
to charging/device mode is performed when entering authorized mode, in which
device connection/disconnection detection is currently disabled.
2020-10-08 20:41:13 +02:00
Steinar Bakkemo e27d817e3c otgcontrol: add debug hack disabling OTG detection in default state
Due to the authorized mode (default state) not being implemented
properly yet with filtering and such, a concern regarding short
while in a bag or such was discussed.

As a hot fix, the device connection (POGO ID pin) is deactivated
in default mode until this has been properly implemented, but
enabled when explicitly entering unauthorized mode from the
test-application in order to use the QR code reader.
2020-10-08 20:34:32 +02:00
Steinar Bakkemo 2edbefedce otgcontrol: fix init problem causing uninit. default sysfs controllermode shadow value
When reading the otg controller mode from sysfs before changing it, returns 0.
This is not correct, as the default mode is 1.

As the controllermode is changed, the sysfs attribute shadow value is also changed.
Now also during fsm init.
2020-10-08 20:07:16 +02:00
Shawn Guo bc5893e9a1 otgcontrol: select pinctrl state during suspend/resume
To support suspend/resume from LPSR mode, we need to select default
pinctrl state in resume, so that IOMUXC settings can be restored from
power losing.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:14 +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 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 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 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 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 fac945efde otgcontrol: add excton device registration (emulate OTG VID signal -> OTG driver) 2020-10-08 19:25:40 +02:00
Steinar Bakkemo 5279a775da otgcontrol: rm-otgcontrol driver initial commit 2020-10-08 18:30:57 +02:00
Gao Pan 3c20f4d10c MLK-17061-1 sensor: set sensor interrupt pins as open-drain
The sensors share an interrupt pin on imx8qm/imx8qxp mek.
As a result, the interrupt signals will be interfered by
each other in default push-pull status.

This patch sets sensor interrupt pins as open-drain when
necessary.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
(cherry-picked from 48bcb7aafa2a3ced923d1a1753bb19d89a9fc273)
2018-10-29 11:10:38 +08:00
Fugang Duan 306fb4dcc1 MLK-12181 misc: at25: Cleaning up missing null-terminate in conjunction with strncpy
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.

Signed-off-by: Fugang Duan <B38611@freescale.com>
2018-10-29 11:10:38 +08:00
Nicolin Chen 89d3895798 MLK-11418 misc: sram: Set default alignment to 4Kbytes
cherry-pick below patch from v3.14.y:
ENGR00286273-2 misc: sram: Set default alignment to 4Kbytes

As Kernel 3.0.35 does, we set the default iram alignment to 4Kbytes,
although it would waste few memory space.

We here try to do this as an expediency because currently we couldn't
find a perfect solution for 4Kbytes alignment requirement from SDMA.

Signed-off-by: Nicolin Chen <b42378@freescale.com>
(cherry picked from commit cc35bf5bd3472efca29a0858c0ad468a63c60950)
2018-10-29 11:10:38 +08:00
Gao Pan 1f84146e7b MLK-11218: misc: fxos8700: support ±2g/±4g/±8g dynamically
Support ±2g/±4g/±8g dynamically selection for motion sensor fxos8700.

Set the sensor mode to standby mode before changing the scale range
with the command "echo 0 > enable". The scale range can be changed
with the command "echo 0/1/2 > range".

Signed-off-by: Gao Pan <b54642@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: 74c9af0a5806fb5c926ffdab3145fc1680fc87e6)
2018-10-29 11:10:38 +08:00
Fugang Duan 620700a238 MLK-10835-2 misc: fxos8700: add Freescale FXOS8700 6-Axis Acc and Mag Combo Sensor
Add Freescale FXOS8700 6-Axis Acc and Mag Combo Sensor

Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: c0ca56bbf3f8503a858d15bb14f27652ae6612eb)
2018-10-29 11:10:38 +08:00
Fugang Duan 375afcc576 MLK-10835-1 misc: fxas2100x: add Freescale FXAS2100X gyroscope sensor
Add Freescale FXAS2100X gyroscope sensor

Signed-off-by: Fugang Duan <B38611@freescale.com>
(cherry picked from commit: 34a99f00d4886f95a8cf8cd4acbf37a82c67e46c)
2018-10-29 11:10:38 +08:00
Johan Hovold 0470189cd9 misc: sram: enable clock before registering regions
[ Upstream commit d5b9653dd2 ]

Make sure to enable the clock before registering regions and exporting
partitions to user space at which point we must be prepared for I/O.

Fixes: ee895ccdf7 ("misc: sram: fix enabled clock leak on error path")
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-03 17:00:46 -07:00
Dan Carpenter 127cd4e233 vmci: type promotion bug in qp_host_get_user_memory()
[ Upstream commit 7fb2fd4e25 ]

The problem is that if get_user_pages_fast() fails and returns a
negative error code, it gets type promoted to a high positive value and
treated as a success.

Fixes: 06164d2b72 ("VMCI: queue pairs implementation.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-03 17:00:46 -07:00
Matt Ranostay 4804f372b5 tsl2550: fix lux1_input error in low light
[ Upstream commit ce054546cc ]

ADC channel 0 photodiode detects both infrared + visible light,
but ADC channel 1 just detects infrared. However, the latter is a bit
more sensitive in that range so complete darkness or low light causes
a error condition in which the chan0 - chan1 is negative that
results in a -EAGAIN.

This patch changes the resulting lux1_input sysfs attribute message from
"Resource temporarily unavailable" to a user-grokable lux value of 0.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-03 17:00:45 -07:00
Nadav Amit 956fa50745 vmw_balloon: include asm/io.h
commit a3b92ee6fc171d7c9d9b6b829b7fef169210440c upstream.

Fix a build error due to missing virt_to_phys()

Reported-by: kbuild test robot <lkp@intel.com>
Fixes: f0a1bf29d821b ("vmw_balloon: fix inflation with batching")
Cc: stable@vger.kernel.org
Cc: Xavier Deguillard <xdeguillard@vmware.com>
Signed-off-by: Nadav Amit <namit@vmware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-29 03:06:07 -07:00
Dan Carpenter 29068d2971 mei: bus: type promotion bug in mei_nfc_if_version()
commit b40b3e9358 upstream.

We accidentally removed the check for negative returns
without considering the issue of type promotion.
The "if_version_length" variable is type size_t so if __mei_cl_recv()
returns a negative then "bytes_recv" is type promoted
to a high positive value and treated as success.

Cc: <stable@vger.kernel.org>
Fixes: 582ab27a06 ("mei: bus: fix received data size check in NFC fixup")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-26 08:38:14 +02:00
Tomas Winkler 599f1e90f7 mei: bus: need to unlink client before freeing
commit 34f1166afd upstream.

In case a client fails to connect in mei_cldev_enable(), the
caller won't call the mei_cldev_disable leaving the client
in a linked stated. Upon driver unload the client structure
will be freed in  mei_cl_bus_dev_release(), leaving a stale pointer
on a fail_list.  This will eventually end up in crash
during power down flow in mei_cl_set_disonnected().

RIP:  mei_cl_set_disconnected+0x5/0x260[mei]
Call trace:
mei_cl_all_disconnect+0x22/0x30
mei_reset+0x194/0x250
__synchronize_hardirq+0x43/0x50
_cond_resched+0x15/0x30
mei_me_intr_clear+0x20/0x100
mei_stop+0x76/0xb0
mei_me_shutdown+0x3f/0x80
pci_device_shutdown+0x34/0x60
kernel_restart+0x0e/0x30

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=200455
Fixes: 'c110cdb17148 ("mei: bus: make a client pointer always available")'
Cc: <stable@vger.kernel.org> 4.10+
Tested-by: Georg Müller <georgmueller@gmx.net>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-26 08:38:06 +02:00
Alexander Usyskin b5936d2741 mei: ignore not found client in the enumeration
commit 8d2d8935d3 upstream.

Some of the ME clients are available only for BIOS operation and are
removed during hand off to an OS. However the removal is not instant.
A client may be visible on the client list when the mei driver requests
for enumeration, while the subsequent request for properties will be
answered with client not found error value. The default behavior
for an error is to perform client reset while this error is harmless and
the link reset should be prevented. This issue started to be visible due to
suspend/resume timing changes. Currently reported only on the Haswell
based system.

Fixes:
[33.564957] mei_me 0000:00:16.0: hbm: properties response: wrong status = 1 CLIENT_NOT_FOUND
[33.564978] mei_me 0000:00:16.0: mei_irq_read_handler ret = -71.
[33.565270] mei_me 0000:00:16.0: unexpected reset: dev_state = INIT_CLIENTS fw status = 1E000255 60002306 00000200 00004401 00000000 00000010

Cc: <stable@vger.kernel.org>
Reported-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-26 08:38:06 +02:00
Gustavo A. R. Silva fc320be61f misc: hmc6352: fix potential Spectre v1
commit de916736aa upstream.

val is indirectly controlled by user-space, hence leading to a
potential exploitation of the Spectre variant 1 vulnerability.

This issue was detected with the help of Smatch:

drivers/misc/hmc6352.c:54 compass_store() warn: potential spectre issue
'map' [r]

Fix this by sanitizing val before using it to index map

Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].

[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2

Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-26 08:38:06 +02:00
Anton Vasilyev 2458e91302 misc: ti-st: Fix memory leak in the error path of probe()
[ Upstream commit 81ae962d7f ]

Free resources instead of direct return of the error code if kim_probe
fails.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-19 22:43:39 +02:00