summaryrefslogtreecommitdiff
path: root/drivers/staging
AgeCommit message (Collapse)Author
2020-04-23MGS-5565-1 staging: android: ion: Flush outer cache after zero CMA allocated ↵Richard Liu
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)
2020-04-23MGS-5565 staging: android: ion: Flush cache after zero CMA allocated memoryRichard Liu
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)
2019-07-24MLK-22308 usb: typec: tcpci: mark PM functions as __maybe_unusedLi Jun
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>
2019-04-04MLK-21368 staging: typec: tcpci: disable irq when system suspendLi Jun
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>
2019-04-04MLK-21355 staging: typec: tcpm: use freezable workqueue for event handlingLi Jun
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>
2019-02-27MMIOT-30 MA-13967-1 Add secure_ion.hOlivier Masse
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>
2019-02-27MMIOT-157: Ion: support multiple unmapped ion heapOlivier Masse
Change-Id: I268fd5d2bf039699ecdcab752146bc191209f046 Signed-off-by: Olivier Masse <olivier.masse@nxp.com>
2019-02-27MMIOT-157: Ion unmapped: reservedmem instantiantionOlivier Masse
Change-Id: I09ade28f40c549b383dcc6dfc001e239b676c54b Signed-off-by: Olivier Masse <olivier.masse@nxp.com>
2019-02-27staging: android: ion: do not clear dma_address of unmapped heapJerome Forissier
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>
2019-02-27staging:ion: add a no-map property to ion dmabuf attachmentEtienne Carriere
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>
2019-02-27staging/ion: ARM64 supports ION_UNMAPPED_HEAPEtienne Carriere
Change-Id: Id54f7d5aee14d43778ab2283504695e7fbc07416 Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2019-02-27ion: "unmapped" heap for secure data pathEtienne Carriere
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>
2019-02-12MLK-20220 staging: typec: tcpci: fix improper use of negative valueLi Jun
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>
2019-02-12MLK-20105 staging: typec: tcpm: keep non-PD session for no GoodCRCLi Jun
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>
2019-02-12MLK-18744 staging: typec: tcpm: qos handling fixLi Jun
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>
2019-02-12MLK-17921-2 staging: typec: tcpm: add qos for PD transferLi Jun
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>
2019-02-12MLK-17921-1 staging: typec: tcpci: improve properties parseLi Jun
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>
2019-02-12MLK-18834 ion: Enable ion on Kernel 4.14Song Bing
Enable ion driver on Linux platform for Kernel 4.14. Signed-off-by: Song Bing <bing.song@nxp.com>
2019-02-12MLK-18531 staging: typec: don't do vbus source disable for dead batteryLi Jun
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>
2019-02-12MLK-17108-4 staging: typec: tcpci: correct read data msg lengthLi Jun
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>
2019-02-12MLK-17108-3 staging: typec: tcpci: don't do force discharge if enable vbus sinkLi Jun
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>
2019-02-12MLK-17108-2 staging: typec: support dead battery chargingJun Li
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>
2019-02-12MLK-17237 staging: typec: return error when tcpci_parse_config has failedPeter Chen
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>
2019-02-12MLK-17242-1 staging: typec: tcpci: add sink setting for sink-disableLi Jun
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>
2019-02-12MLK-17217 staging: typec: tcpci: system wakeup source supportLi Jun
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>
2019-02-12MLK-17128-3 staging: typec: reading max_snk_mw setting from OFLi Jun
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>
2019-02-12MLK-17092 staging: typec: enable vbus voltage low alarmLi Jun
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>
2019-02-12MLK-17077 staging: typec: clear vbus change event in irq handlerLi Jun
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>
2019-02-12MLK-16820-2 staging: typec: tcpci: add sink_disable flag for source only powerLi Jun
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>
2019-02-12drm: Pass struct drm_file * to __drm_mode_object_find [v2]Keith Packard
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)
2019-02-12MLK-16776 staging: typec: tcpci: use vbus from partner for EXTCON_USBLi Jun
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>
2019-02-12MLK-16697 staging: typec: tcpci: add notfication for device attachLi Jun
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>
2019-02-12MLK-16285-2 staging: typec: tcpci: add optional reset pin supportPeter Chen
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>
2019-02-12MLK-16285-1 staging: typec: tcpci: move request interrupt to the end of probePeter Chen
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>
2019-02-12MLK-16298-1 staging: typec: make super speed signal mux select configurableLi Jun
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>
2019-02-12MLK-16013-44 staging: typec: tcpm: set data role after src detachLi Jun
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>
2019-02-12MLK-16013-43 staging: typec: tcpci: add extcon for data role switchLi Jun
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>
2019-02-12MLK-16013-37 staging: typec: Power swap force discharge for sourceLi Jun
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>
2019-02-12MLK-16013-36 staging: typec: wait for cc change on ERROR_RECOVERYLi Jun
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>
2019-02-12MLK-16013-34 staging: typec: Support cc changes on RP pull-up valueLi Jun
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>
2019-02-12MLK-16013-33 staging: typec: Do not switch to unattached state for BISTLi Jun
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>
2019-02-12MLK-16013-32 staging: typec: refine source to sink swap handlingLi Jun
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>
2019-02-12MLK-16013-31 staging: typec: Set to unattached state if souce disconnectedLi Jun
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>
2019-02-12MLK-16013-30 staging: typec: Reset hard_reset_count to be 0 after send ↵Li Jun
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>
2019-02-12MLK-16013-29 staging: typec: tcpm: Don't reset message id after soft resetLi Jun
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>
2019-02-12MLK-16013-28 staging: typec: tcpci: Populate config from dtLi Jun
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>
2019-02-12MLK-16013-27 staging: typec: add super speed signal mux selectionLi Jun
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>
2019-02-12MLK-16013-26 staging: typec: tcpm: update PD timingLi Jun
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>
2019-02-12MLK-16013-25 staging: typec: tcpm: correct the PD_T_SENDER_RESPONSE valueLi Jun
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>
2019-02-12MLK-16013-24 staging: typec: tcpm: use hrtimer for send responseLi Jun
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>