Age | Commit message (Collapse) | Author |
|
memory
Need flush outer cache after zero CMA allocated memory on arm32 platform.
Change-Id: Ieaa7c62bf65e4490f904d68bed1fa16fb7c5d8fa
Signed-off-by: Richard Liu <xuegang.liu@nxp.com>
Reviewed-by: Bing Song <bing.song@nxp.com>
(cherry picked from commit 9e51da339eb290f35eb79d9acc0ea147d8bdf0cf)
|
|
ION CMA memory default is cacheable, need flush cache after memset(),
else cache and physical memory not sync may cause problem.
Issue case:
VPU Video playback or GPU render have dirty line issue.
Root cause:
ION CMA allocate cacheable buffer and do memset(), some data still in cache
not in physical memory, VPU or GPU write the buffer with physical address,
or user call ion_mmap() to map the buffer through pgprot_writecombine() as
no-cache and write the buffer, later some CPU cache access trigger cache
flush, previous memset() data go to physical memory as dirty data.
Change-Id: I82b4cb61bbe6cffc687d452f9f81c1e35914d2f1
Signed-off-by: Richard Liu <xuegang.liu@nxp.com>
(cherry picked from commit 5d360f25f3523311b5f478b7b1c7bc9020cfda58)
|
|
Fix build warning if CONFIG_PM_SLEEP is disabled:
CC drivers/staging/typec/tcpci.o
drivers/staging/typec/tcpci.c:901:12: warning: ‘tcpci_resume’ defined
but not used [-Wunused-function]
static int tcpci_resume(struct device *dev)
^~~~~~~~~~~~
drivers/staging/typec/tcpci.c:889:12: warning: ‘tcpci_suspend’ defined
but not used [-Wunused-function]
static int tcpci_suspend(struct device *dev)
^~~~~~~~~~~~~
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
Disable typec irq when suspend to avoid the threaded irq to access
some resource(e.g. i2c over rpmsg) but those resource is not
available at later phrase, also use IRQ_DISABLE_UNLAZY flag to
mask the irq on irq chip level when irq happens.
Suggested-by: Anson Huang <anson.huang@nxp.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
While system suspend, the typec event handling required service
maybe is not available(suspended), so we need freeze those event
handling by using freezable workqueue, e.g while tcpm is handling
PD message but system suspend started.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
secure_ion.h added in drivers includes to expose it in user space
Change-Id: I3adeafc18323e751fccf954bf48e42f3ae34a40c
Signed-off-by: Olivier Masse <olivier.masse@nxp.com>
|
|
Change-Id: I268fd5d2bf039699ecdcab752146bc191209f046
Signed-off-by: Olivier Masse <olivier.masse@nxp.com>
|
|
Change-Id: I09ade28f40c549b383dcc6dfc001e239b676c54b
Signed-off-by: Olivier Masse <olivier.masse@nxp.com>
|
|
Since commit 54ef5b9db767 (staging: android: ion: Initialize dma_address
of new sg list") (Linux v4.17), the helper function dup_sg_table() called
by ion_dma_buf_attach() does not preserve the dma_address from the
original SG list. It is a problem for the unmapped heap, because
dma_buf_attach() followed by dma_buf_map_attachment() now returns a SG
table with NULL dma_address, which breaks tee_shm_register_fd().
This commit avoids the dma_address reset for the unmapped heap.
Change-Id: I50cf4649d36b610be78fb0e7c16b792833854156
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
|
|
Ion unmapped heap aims at not being mapped. This change prevents
Ion from calling dma-mapping support on dma_buf_attach for buffers
in an unmapped heap.
This change is a bit intrusive in the Ion driver. Maybe there is
another way to deal with the dma-mapping resources used for the
unmapped heap.
Change-Id: I55f5ef94e88a262288165c9ae618fdb9396f3ad0
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
|
|
Change-Id: Id54f7d5aee14d43778ab2283504695e7fbc07416
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
|
|
OP-TEE/SDP (Secure Data Path) memory pools are created through ION
secure type heap" from Allwinner. This change renames "secure" into
"unmapped" as, from Linux point of view, the heap constraint is
manipulating unampped memory pools/buffers.
"Unmapped" heap support is integrated in ION UAPI (actually this was
the Allwinner initial proposal) and ION DT parsing support.
Based in work from Sunny <sunny@allwinnertech.com> for Allwinner.
Changes:
- rename "secure_heap" into "unmapped_heap"
- define ION_HEAP_TYPE_UNMAPPED in ION UAPI (sic!)
- add structure "struct unmapped_buffer_priv" to hold allocated buffer
private data (currently only the buffer physical address.
- adapt to recent ION (i.e ion_phys_addr_t => phys_addr_t)
- Support dummy heap configuration: one can hard code into the Linux
kernel configuration the location of a "unmapped heap". It will be
created during ION device inits: see CONFIG_ION_DUMMY_UNMAPPED_HEAP.
Change-Id: I7c6526fa1327c895ad9608085a68064f2a18a0e7
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
|
|
Coverity complains CID 3411292: Improper use of negative valure
(NEGATIVE_RETURNS), as possibly assign a negative value to unsigned
int, fix it by use an int temp value for negative value return.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
In case of vbus_never_low, if source setup a typye-c only session, sink
time out on waiting for source capability message and send soft reset,
the source does not response by goodcrc for the soft reset message, we
don't do hard reset, but keep a non-PD typec session, because the source
maybe PD capable, this hard reset will make the source terminate the
session by turn off vbus, if this type-c port is the system power supply,
the whole system will reboot.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
Commit 661b7ec2359e ("MLK-17921-2 staging: typec: tcpm: add qos for
PD transfer") introduce qos for tcpm transfer between typec controller
and CPU, but the request and remove are not balanced well, the initial
request should be moved to tcpm_port_register as tcpm_init will be called
for every hard reset, and also move qos hold&release to where port state
changes.
Fixes: 661b7ec2359e ("MLK-17921-2 staging: typec: tcpm: add qos for PD transfer")
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
TCPCI based typec port controller needs very strict low latency
on i2c transfer, this patch is to improve this by adding qos and
high bus handling in tcpm during PD session setup.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
Current typec and PD properties parse can't work well for sink or source
only port, this patch is to improve it.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
Enable ion driver on Linux platform for Kernel 4.14.
Signed-off-by: Song Bing <bing.song@nxp.com>
|
|
In PTN5110 design, DisableSourceVBUS command also disables the sink
enable signal because the EN_SNK can be used to source higher voltage,
and, there is only one TCPC command to disable sourcing voltage without
telling whether to disable 5V or the high voltage, and to keep the
design simple they designed the PTN5110 to disable both. with this
fact, we use the flag drive_vbus to check if the source vbus enable was
issued, if yes we then do vbus source disable, in dead battery case,
we never did vbus source enable, so will not issue vbus source disable
command.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
Per tcpci spec, the TCPC_RX_BYTE_CNT is the number of bytes in the
RX_BUFFER_DATA_OBJECTS plus three (for the RX_BUF_FRAME_TYPE and
RX_BUF_HEADER), so after read out the header, we should only read
TCPC_RX_BYTE_CNT-3 bytes for data if this is a data message.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
We use vbus force discharge to have a quick vbus off for power role swap,
which works like this: enable vbus force discharge and wait the vbus fall
below vbus low threshold, when reaches, an alarm generated and tcpm can go
forward. but current code do vbus force discharge in any disable source
vbus case, in enable vbus charge case, we firstly disable source vbus and
then turn on vbus sink, in between, vbus force discharge should not be
enabled.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
If the vbus is aready on and remote cc state is Rp while typec init, we
think it's a dead battery case, this needs the PD session already setup
by bootloader, so kernel can negotiate a new power session by soft reset,
this patch use the exsiting flag vbus_never_low as boot from dead battery
flag, but update the condition of setting it: not only check vbus, also
the cc status to make sure remote is a power source, if yes, bypass the
vbus sink disable. If the vbus is from local, we will still disable vbus
charge so original code intention is kept.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
Otherwise, the probe would be considered successfully, and without
do any destroy jobs, eg, the interrupt has still registered.
Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
|
|
Adding fixed sink power settings for sink-disable case, which
is only for PD protocol talk to know the cc orientation if connects
to a PD capable host, HW doesn't really sink any power in this case.
Tested-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
As GPIO normally can be system wakeup source, so enable typec events
as system wakeup source if user requested.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
It's missing while do typec related properties read, sink
needs it to check if the provided PDO can match the required
power.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
We use vbus low voltage alarm to start vbus discharge to meet
timing requirement on turning off vbus for power swap from
source to sink, per type-C port controller spec(tcpci), the
Voltage Alarms Power status reporting is disabled by default,
so we need enable it at tcpci init.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
For vbus change event, we need read the vbus status to clear
the alert. Current code do this in queue work, this has problem
on single core running, the queue work of vbus change may have
no chance to be scheduled as we continue receive the vbus change
event in threaded irq.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
As we need to use DRP config for data role, but the power role is source only,
so introduce a property sink-disable to avoid sink vbus command.
Signed-off-by: Li Jun <jun.li@nxp.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
|
|
This will allow __drm_mode_object_file to be extended to perform
access control checks based on the file in use.
v2: Also fix up vboxvideo driver in staging
[airlied: merging early as this is an API change]
Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 418da17214aca5ef5f0b6f7588905ee7df92f98f)
|
|
Change to use the vbus from partner to notify EXTCON_USB.
This is to work around the case of source only typec port
connecting to Host PC via a Rp fixed cable.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
Some usb device driver can't know the connect and disconnect to host
if the vbus is always on, if use typec we can rely on cc line status
to know that, so add a notification to let controller driver know
device attach and detach from host.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
Some USB3 differential channel switch chips need to do reset before
functional, we add this support here.
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Acked-by: Li Jun <jun.li@nxp.com>
|
|
The tcpci_irq may visit tcpci->port if unexpected interrupt occurs
(eg, board design issue causes GPIO status is incorrect) and cause
NULL pointer dereference issue.
Besides, delete clear TCPC_ALERT and TCPC_ALERT_MASK code which are
already done at tcpci_init.
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Acked-by: Li Jun <jun.li@nxp.com>
|
|
Instead of fixed pull up super speed mux selection gpio for cc1, use
GPIO_ACTIVE_HIGH/LOW to map the CC1/CC2 orientation via gpiod api, So
for ss-sel-gpios:
GPIO_ACTIVE_HIGH: CC1 <--> GPIO high
GPIO_ACTIVE_LOW : CC1 <--> GPIO low
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
As the default data role is device mode if the port is not host,
so set the port data role to be device mode after src detach, this
is to fix the issue of port data role still kept to be host while
the port is open.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
Use extcon device for dual role switch on typec port.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
VBus off only means the vbus falls to be below 4v, we can use vbus
force discharge and vbus low alarm to go forward.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
We should wait at least tErrorRecovery before move to unattached state.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
CC line changes on souce side RP value is permitted per standard, in
this case we should move to SNK_ATTACH_WAIT.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
If we received unsupported BIST command, we should by pass it and ready
to accept following command for test, not unconditionly to set the port
to be unattached state and terminate the test.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
To early start sink power after source turn off vbus, move the set power
role after vbus is turned off in PR_SWAP_SRC_SNK_SOURCE_OFF, also per
spec, we should do error recovery if the sink side does not turn on
vbus in PD_T_PS_SOURCE_ON.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
In SNK_HARD_RESET_SINK_ON, if the source disconnected, we should set
state to be unattached state intead of startup sink.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
source cap
Per standard, we should clear the hard reset count to be 0 after souce
sent the source cap.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
If the power source sent soft reset and the other end accepted, we should
not reset the message id as it was already updated by pd_transmit when
handling the soft reset.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
Instead of static config, use dt to pass basic PD config for
below settings:
- Source pdo list
- Sink pdo list
- Max sink voltage
- Max sink current
- Sink operating power
- TypeC port type
- TypeC port preferred role
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
According to the polarity of cc line, we need to do USB3 signal mux
selection if it's controlled by software.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
This patch is to update several PD timings for PD compliance, all
those timing definitions should be configurable via user config,
this can be improved later, for now I just update its values in PD
spec defined range.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
Per PD spec, the sender response should be in a small range 24~30ms, so
correct the PD_T_SENDER_RESPONSE to be 25.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|
|
As the sender response timer have very small margin(25~30ms), so
use a hrtimer to handle it.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
|