Richard Zhu [Fri, 11 Jan 2019 06:58:08 +0000 (12:28 +0530)]
MLK-13178-2 pci: imx6: add one regulator for ext osc
On imx6qp sabresd rev b board, there is a standalone
external oscilator, used to provided the clks for
imx6qp pcie.
Add one regulator into pcie node, let the ext osc work.
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Richard Zhu [Fri, 11 Jan 2019 06:41:11 +0000 (12:11 +0530)]
MLK-12481 pci: imx: turn off pcie clks when link down
In order to save power consumption, turn off pcie clks/regulators
if there is no pcie link at all.
Summit this patch, because of that MLK-12278
doesn't turn off the clks/regulators actually.
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
In 4.14 the part changing host_init to return int was already upstream.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Richard Zhu [Fri, 11 Jan 2019 06:31:00 +0000 (12:01 +0530)]
MLK-12278 pci: imx: turn off pcie clks when link is down
In order to save power assumption, turn off the pcie clks
when there is no pcie link up at all.
add the option CONFIG_PCI_IMX6_COMPLIANCE_TEST, enable it
when the image is used to do the pcie compliance tests.
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Richard Zhu [Fri, 11 Jan 2019 06:24:13 +0000 (11:54 +0530)]
MLK-11803 pci: imx: imx6qp pcie ep self-test failed
imx pcie used the wrab mode to do the cached access
methods on axi bus. There is 64bytes address mis-aligned
problem.
Disable the cached operations.
Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Richard Zhu [Fri, 11 Jan 2019 06:21:11 +0000 (11:51 +0530)]
MLK-11561-4 PCI: imx: enable imx6qp pcie support
enable imx6qp pcie support
Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Richard Zhu [Fri, 11 Jan 2019 06:11:59 +0000 (11:41 +0530)]
MLK-11561-3 PCI: imx: enable imx6sx pcie support
enable imx6sx pci support
Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Richard Zhu [Fri, 13 Mar 2015 08:24:11 +0000 (16:24 +0800)]
MLK-10466-2 ARM: imx: add the pcie related macros definitions
add the pcie related macros definitions into gpr.
Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
(cherry picked from commit
b4a5b2e53b2e743824d0af7428f7d9d406bec8bd)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Richard Zhu [Thu, 16 Oct 2014 06:54:40 +0000 (14:54 +0800)]
MLK-10009-2 ARM: imx6sx: Add imx6sx pcie related gpr bits definitions
Add imx6sx pcie related gpr bits definitions.
Signed-off-by: Richard Zhu <richard.zhu@freescale.com>
(cherry picked from commit
991fb25d62e3e2f550f98732f5bc00eeb98f78e3)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Richard Zhu [Fri, 11 Jan 2019 05:46:23 +0000 (11:16 +0530)]
MLK-11484-6 pci: imx: enable pcie ep rc msi test
Regarding to the limitation of the iMX ADAP(pcie connector),
only imx7d 12x12 arm2 board is used to verify the pcie
ep/rc validation system on imx7d platforms
Enalbe the msi pcie ep rc on it.
Test howto:
- Enable CONFIG_PCI_MSI=y, when rebuild the rc/ep images
- EP side(console command and kernel message):
root@imx6sxsabresd:~# ./memtool -32 <msi_addr>=0
Writing 32-bit value 0x0 to address <msi_addr>
- RC side(console command and kernel message):
root@imx6sxsabresd:~# cat /proc/interrupts | grep MSI
384: 1 PCI-MSI
Note:
imx6q msi_addr 0x01ff_8000
imx6sx msi_addr 0x08ff_8000
imx7d msi_addr 0x4ffc_0000
Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Richard Zhu [Fri, 11 Jan 2019 05:16:07 +0000 (10:46 +0530)]
MLK-11484-5 pci: imx: enable pcie ep rc system on imx7d
Regarding to the limitation of the iMX ADAP(pcie connector),
only imx7d 12x12 arm2 board is used to verify the pcie
ep/rc validation system on imx7d platforms
hw setup:
* two imx boards, one is used as pcie rc, the other is used
as pcie ep. Connected by fsl pcie adap adaptor.
sw setup:
* when build rc image, make sure that
CONFIG_IMX_PCIE=y
# CONFIG_EP_MODE_IN_EP_RC_SYS is not set
CONFIG_RC_MODE_IN_EP_RC_SYS=y
* when build ep image
CONFIG_IMX_PCIE=y
CONFIG_EP_MODE_IN_EP_RC_SYS=y
# CONFIG_RC_MODE_IN_EP_RC_SYS is not set
features:
* set-up link between rc and ep by their stand-alone
ref clk running internally.
* in ep's system, ep can access the reserved ddr memory
(default address:0x4000_0000 on imx6q sd board, and
0xb000_0000 on imx6sx sdb and imx7d arm2 boards) of
pcie rc's system, by the interconnection between pcie
ep and pcie rc.
* add the configuration methods in the ep side, used to
configure the start address and the size of the reserved
rc's memory window.
- cat /sys/devices/soc0/soc.1/
1ffc000.pcie/rc_memw_info
- echo 0x41000000 > /sys/devices/soc0/soc.1/
1ffc000.pcie/rc_memw_start_set
- echo 0x200000 > /sys/devices/soc0/soc.1/
1ffc000.pcie/rc_memw_size_set
* provide one example, howto configure the bar# and so on,
when pcie ep emaluates one memory ram ep device
* setup one new outbound memory region at rc side, used
to let imx pcie rc can access the memory of imx pcie ep
in imx pcie rc ep validation system.
- set the default address of the ddr memory to be 0x4000_0000
on imxq sd board, and 0xb000_0000 on imx6sx sdb and imx7d
arm2 boards.
NOTE:
* boot up ep platform firstly, then boot up rc platform.
* make sure that mem=768M is contained in the kernel command line,
since the start address of the upper 256mb of the 1g ddr mem is
reserved to do the pcie ep rc access operations in default.
Test howto of the RC access memory of EP on imx6q sd platforms.
step1:
EP side:
1.1:
echo <768M_DDR_MEM_ADDR> > /sys/devices/.../pcie/ep_bar0_addr
1.2:
memtool -32 <768M_DDR_MEM_ADDR> 4
E
Reading 0x4 count starting at address 0x40000000
<768M_DDR_MEM_ADDR>:
6FE9E9F6 7583FBB9 39EAEFEA FBDCFD78
step2:
RC side:
memtool -32 <PCI_BASE_ADDR> =
58D454DA
memtool -32 <PCI_BASE_ADDR + 4> =
7332095B
step3:
EP side:
memtool -32 <768M_DDR_MEM_ADDR> 4
E
Reading 0x4 count starting at address 0x40000000
<768M_DDR_MEM_ADDR>:
58D454DA 7332095B 39EAEFEA FBDCFD78
Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Richard Zhu [Fri, 11 Jan 2019 05:04:26 +0000 (10:34 +0530)]
MLK-11484-4 PCI: imx: enable imx7d pcie support
- enable pcie functions on imx7d platforms
- grst/brst should be asserted/de-asserted during resume,
since the pcie power would be cut off automatically by HW
during system suspend/resume
Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
Upstream also added imx7d support but in a different way and partially
relying on imx7d-src as a reset controller. Resolved conflicts in favor
of direct manipulation of src registers because this is closer to imx8
code added later on.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
rebase on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Richard Zhu [Thu, 10 Jan 2019 12:18:52 +0000 (17:48 +0530)]
MLK-11484-3 PCI: designware: Refine setup_rc and add msi data restore
- move "program correct class for RC" from dw_pcie_host_init()
to dw_pcie_setup_rc(). since this is RC setup, it's
better to contained in dw_pcie_setup_rc function.
Then, RC can be re-setup really by dw_pcie_setup_rc().
- add one store/re-store msi cfg functions. Because that
pcie controller maybe powered off during system suspend,
and the msi data configuration would be lost.
these functions can be used to store/restore the msi data
and msi_enable during the suspend/resume callback.
Signed-off-by: Richard Zhu <richard.zhu@freescale.com>
Vipul: rebased on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Cosmin-Gabriel Samoila [Wed, 3 Oct 2018 08:58:54 +0000 (11:58 +0300)]
MLK-19797 sound: asoc: fix clk_div computed value
When clk_div is computed, the K factor from documentation is ignored.
It happened to work on medium quality because the K factor was 1.
Now the clk_div is computed accordingly to the documentation.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit
220851ef33ce2b6fabc93869e51ab9677cdd18fb)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Tue, 2 Oct 2018 13:02:43 +0000 (16:02 +0300)]
MLK-19716-2 sound: asoc: fix quality select switch
Value read from register was shifted and compared
with a non-shifted val and the behaviour was that
it allways went on the default branch.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit
c7139e25cfd6368e7287928b94846254259adcd2)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Wed, 26 Sep 2018 13:35:23 +0000 (16:35 +0300)]
MLK-19743 sound: asoc: fix micfill sleep in interrupt context
There is a problem when an interrupt is handled by hwvad_isr
since it calls kobject_uevent_env which can sleep.
Solved it by doing the kobject_uevent_env in a threaded_irq
function.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit
536927f7d5bf5feec11868ba00d2c0cb98bbd3f9)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Wed, 26 Sep 2018 12:58:29 +0000 (15:58 +0300)]
MLK-19741 sound: asoc: add micfil hwvad alsamixer rate selection
Add alsamixer control for selecting the default voice activity detection
rate. This is a prerequisite for supporting hwvad and recording in parallel
or you will restrict the user to do the recording only at the hardcoded
hwvad rate (when hwvad is enabled).
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit
5520b4e8c48d6428cf5f40ee6f01a03e8073e5fa)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Wed, 26 Sep 2018 08:18:11 +0000 (11:18 +0300)]
MLK-19716 sound: asoc: fix div by zero
Fix issue reported by coverity where get_pdm_clk function returns 0.
This only happens when user selects the N/A quality from alsamixer
and now we are returning negative div and warning that quality
select is not valid.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
(cherry picked from commit
cdcb94ce9724befe16dfdaa7eedcdde21390026d)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Mon, 24 Sep 2018 11:20:32 +0000 (14:20 +0300)]
MLK-19617 sound: asoc: fix amixer output gain control
This bitfield represents a signed value gain and 0-7 represents +0 to +7
bits shift for output gain and 8-15 represents -8 to -1 bits shift for
output gain. Before this fix 0-47% was translated into 0 to +100% and
47% - 100% was translated into -100% to 0%.
We have added gain controls that remaps the each channel gain values
such that we go from lowest volume to highest.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit
a5b612e9162b911b1965763167692c7ab1523466)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Mon, 17 Sep 2018 14:05:54 +0000 (17:05 +0300)]
MLK-18655-7 sound: asoc: add micfil irq functions
Micfil modules have 4 IRQs:
- 44: Dgital Microphone interface voice activity detector event interrupt
- 45: Digital Microphone interface voice activity detector error
interrupt
- 109: Digital Microphone interface interrupt
- 110: Digital Microphone interface error interrupt
This patch adds different functions to treat each IRQ listed before.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit
25b83070b906e4685e27b09c553732aae1b5cd12)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Shengjiu Wang [Mon, 17 Sep 2018 10:29:59 +0000 (18:29 +0800)]
MLK-18655-6 sound: asoc: correct hwvad bug
Correct hwvad initialization procedure bugs:
- VADCHSEL was set to N instead of ((1 << N) - 1)
- IE set before ERIE
- voice detected interrupt line was used wrong
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
(cherry picked from commit
c30fea8630073be07d04b931daebc66c456dbbc1)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Tue, 18 Sep 2018 13:35:16 +0000 (16:35 +0300)]
MLK-19616 sound: asoc: fix quality selection bug
The quality selection bitfield is represented as following:
* Medium» 0 0 0
* High»» 0 0 1
* Very Low 2» 1 0 0
* Very Low 1» 1 0 1
* Very Low 0» 1 1 0
* Low» » 1 1 1
One might notice that from High to Very Low 2 quality there is
a gap of 2 (010 and 011) are missing. In the previous implementation
of amixer control, when you are selecting other quality than
the default mode, the value will always jump from High to Low
with a 2 step and will not be able to go back to a previous value.
The solution was to add two "N/A" undefined values in the
selection texts since those two values are marked as reserved
in the micfil RM.
The alternative was to write custom get and put functions to
only do the translation but the aproach in this patch is easier
to understand and less error prone.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit
976f005b20ddc12c7fe0ce60edd99e5fb9400d21)
(cherry picked from commit
29dacb22f83a3c650bb39cfe57a86c1b7b3bb774)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Mon, 10 Sep 2018 13:08:37 +0000 (16:08 +0300)]
MLK-18655-5 sound: asoc: add hwvad noise decimation amixer control
Add control for Voice Activity Detector Noise OR Enable.
Enables a OR logic in the output of minimum noise estimator block. For
more information see Filter Result Gain Setting on page 71 - micfil
reference manual:
0b - Noise input is not decimated.
1b - Noise input is decimated.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
(cherry picked from commit
317d2226fcfbbd8ae91eac9f685d71663227ae2a)
(cherry picked from commit
ff45a1902e3ac415f7c60ff215c2bfbba5786816)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Thu, 19 Jul 2018 10:16:09 +0000 (13:16 +0300)]
MLK-18655-4 sound: asoc: add micfil hwvad amixer controls
Add amixer controls for the following hardware voice activity
detection parameters: initialization mode, initialization time,
frame time, high-pass filter mode, input gain, sound gain, noise
gain, noise filter adjustment, zero-crossing detector(zcd)
enablement, zcd threshold, zcd auto-threshold, zcd filter adjustment
All of those parameters are now saved into micfil private data and
used when hardware voice detection is enabled.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
(cherry picked from commit
79972452e553f9a18cc57a89383f3be93a202c05)
(cherry picked from commit
385804e091064317bcae67003ba0a39691187143)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Thu, 19 Jul 2018 06:20:26 +0000 (09:20 +0300)]
MLK-18655-2 sound: asoc: add micfil hardware voice active detection
Hardware Voice Activity Detector (HWVAD) is a block responsible for
detect voice activity in a channel selected by the user and it can be
configured in Envelope-based or Energy-based mode. Optionally, a
Zero-Crossing Detector can be enabled to improve the voice detection.
To enable hwvad from userspace there is a interface and you should write
the number of channels in
/sys/devices/platform/
30080000.micfil/hwvad/enable
to enable the hardware voice activity detection for micfil or 0
to disable it.
When voice activity is detected, an udev event will be generated:
"EVENT=PDM_VOICE_DETECT" and hwvad will be disabled afterwards.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
(cherry picked from commit
06495dd0cb0d0e2de225e32251b78edafa473406)
(cherry picked from commit
dc72ec4a8bc8a807a075a1d48689b794e4d1b753)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Wed, 18 Jul 2018 12:08:01 +0000 (15:08 +0300)]
MLK-18655-1 sound: asoc: fix regmap caching for micfil
Remove regmap_cache_only from probe since this should be done
in suspend/resume or when hwvad is enabled/disabled. If regmap
is cached in probe, all volatile registers cannot be read/write
until caching is set to false (which in our case was done only
in resume function).
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
(cherry picked from commit
4cf9ddee84c995e02931be9de5448cb162130862)
(cherry picked from commit
4fef837d65fb31412389a49325cb83d9ab299d2b)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Anson Huang [Thu, 26 Jul 2018 13:32:03 +0000 (21:32 +0800)]
MLK-19008 soc: imx: mu: do NOT clear RIEn for i.mx6sx and i.mx7d
MU is shared between rpmsg driver and the multi-core
power management on i.MX6SX and i.MX7D, the RIE3 is
enabled by MU driver, but when rpmsg is probed, it
will call MU_Init and RIE3 will be clear and cause
multi-core power management never work, so do NOT
clear RIEn during MU initialization for i.MX6SX and
i.MX7D.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Viorel Suman [Wed, 4 Jul 2018 08:58:49 +0000 (11:58 +0300)]
MLK-18737: move 'pair_streams' to 'struct fsl_asrc_pair'
For multi p2p instance an ASRC device cannot be closed successfully
when two threads plays streams simultaneously on same ASRC device.
'pair_streams' variable shall be moved to 'struct fsl_asrc_pair'
for multi p2p instance in order to handle pair release properly.
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Suggested-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Tue, 12 Jun 2018 07:01:45 +0000 (10:01 +0300)]
MLK-18562 sound: asoc: remove micfil unsupported rates and formats
This block implements the required digital interface to provide a
16-bit audio signal from a PDM microphone bitstream in a
configurable output sampling rate 11025kHz - 48000kHz.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Thu, 7 Jun 2018 12:59:52 +0000 (15:59 +0300)]
MLK-16784 sound: asoc: mark micfil stat register volatile
Mark micfil stat register as volatile since status
flags should not be read from cache.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Thu, 7 Jun 2018 12:57:23 +0000 (15:57 +0300)]
MLK-16784 sound: asoc: change micfil dma_maxburst
MICFIL is using multi-fifo dma and maxburst must
be set proportional to number of channels.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Thu, 7 Jun 2018 12:46:18 +0000 (15:46 +0300)]
MLK-18528 sound: asoc: add amixer control widged for micfil
Add channels output gain and quality select controls.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Thu, 31 May 2018 07:36:29 +0000 (10:36 +0300)]
MLK-16784-4 sound: asoc: add micfil cpu-dai in iMX8MM
Add micfil cpu-dai for iMX8MM.
The MICFIL digital interface provides a 16-bit audio
signal from a PDM microphone bitstream in a configurable
output sampling rate.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Wed, 7 Mar 2018 09:45:22 +0000 (11:45 +0200)]
Sound: SoC: codecs: Put AK4458 codec in manual mode
We cannot both derive SAI BCLK for 384KHz-S32/768KHz-S16 and
respect the codec MCLK restrictions shown in AK4458 datasheet
Table 5, 6 and 7.
Since we can have same master clock for SAI and Codec in Manual
Mode, we've chosen to use it instead of Auto Mode.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Cosmin-Gabriel Samoila [Wed, 7 Mar 2018 09:35:07 +0000 (11:35 +0200)]
Sound: Soc: fsl: Set SAI Channel Mode to Output Mode
Transmit data pins will output zero when slots are masked or channels
are disabled. In CHMOD TDM mode, transmit data pins are tri-stated when
slots are masked or channels are disabled. When data pins are tri-stated,
there is noise on some channels when FS clock value is high and data is
read while fsclk is transitioning from high to low.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Peng Fan [Fri, 27 Oct 2017 10:02:45 +0000 (18:02 +0800)]
MLK-16716 nvmem: imx-scu-ocotp do not read invalid address
Fix: hexdump: /sys/bus/nvmem/devices/imx-ocotp0/nvmem: Input/output error
Address space [272,543] is invalid address space on 8QXP, reading from SCU
will get SC_ERR_PARAM. So ignore these words when reading fuse.
BuildInfo:
- SCFW
8dcff26, IMX-MKIMAGE
ea027c4b, ATF
- U-Boot 2017.03-imx_v2017.03_4.9.51_imx8_beta1+g6dc7b0f
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Peng Fan [Thu, 17 Aug 2017 09:06:21 +0000 (17:06 +0800)]
MLK-16204-1 nvmem: add imx-scu-ocotp driver
Add imx-scu-ocotp driver to support i.MX8QM/QXP.
The usage, add an entry in ocotp node, such as the test_1 entry:
ocotp: ocotp {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,imx8qm-ocotp", "syscon";
test_1: test_1@40 {
reg = <0x41 0x8>;
bits = <4 40>;
};
};
Then in your device node, add this:
node: node {
.....
nvmem-cells = <&test_1>;
nvmem-cell-names = "test_1";
};
Then in your driver, using the following piece code:
+#include <linux/nvmem-consumer.h>
struct nvmem_cell *cell;
u8 *val;
size_t len;
int i;
cell = devm_nvmem_cell_get(&pdev->dev, "test_1");
if (IS_ERR(cell)) {
if (PTR_ERR(cell) == -EPROBE_DEFER)
return -EPROBE_DEFER;
}
val = nvmem_cell_read(cell, &len);
The val points the contents that you need.
After shutdown or driver remove, use this:
devm_nvmem_cell_put(&pdev->dev, cell);
Note: we not reuse the imx-ocotp driver, because mix scu api with
legacy code will cost many maintenance efforts. When we have common
api support, we could merge the two.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Shengjiu Wang [Fri, 9 Oct 2015 08:56:41 +0000 (16:56 +0800)]
MLK-11676 ARM: imx_v7_defconfig: disable CONFIG_SWP_EMULATE
According to the help text in the config SWP_EMULATE in arch/arm/mm/Kconfig:
"In some older versions of glibc [<=2.8] SWP is used during futex trylock()
operations with the assumption that the code will not be preempted. This
invalid assumption may be more likely to fail with SWP emulation enabled,
leading to deadlock of the user application."
The audio codec toolchain version is gcc-4.1.1-glibc-2.4, we need turn off
the CONFIG_SWP_EMULATE in the imx_v7_defconfig.
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Robin Gong [Wed, 7 Dec 2016 03:45:09 +0000 (11:45 +0800)]
MLK-13577-4: ARM: configs: imx_v7_defconfig: enable pf1550-regulator-rpmsg driver
enable pf1550-regulator-rpmsg driver by default.
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Bai Ping [Tue, 8 Sep 2015 16:57:09 +0000 (00:57 +0800)]
MLK-11518-05 ARM: defconfig: enable the device cooling
Enable the device cooling device in the defconfig.
Signed-off-by: Bai Ping <b51503@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Dong Aisheng [Fri, 15 May 2015 06:29:50 +0000 (14:29 +0800)]
MLK-10837 dts: imx_v7_defconfig: remove CONFIG_BT_HCIBTSDIO support
We don't need btsdio driver support and enable it will cause
Broadcom WiFi driver suspend/resume unwork due to it does not
implement suspend/resume callback.
Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit
ebd90ea123d493935b559c05db0cd5b5db9d3c73)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Xiaoning Wang [Thu, 13 Sep 2018 11:12:48 +0000 (19:12 +0800)]
MLK-19452-2 ARM: imx_v7_defconfig: Add spi slave mode
Add spi slave mode and enable spi slave time/system control
functions.
Example for SPI slave time:
SLAVE: # echo spi-slave-time > /sys/class/spi_slave/spi0/slave
MASTER: # spidev_test -D /dev/spidev0.0 -p dummy-8B -v
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
RX | 00 00 04 6D 00 09 5B BB __ __ __ __ __ __ __ _...
^^^^^ ^^^^^^^^
seconds microseconds
Example for SPI slave system control:
SLAVE: # echo spi-slave-system-control >
/sys/class/spi_slave/spi0/slave
BOTH: # reboot='\x7c\x50'
BOTH: # poweroff='\x71\x3f'
BOTH: # halt='\x38\x76'
BOTH: # suspend='\x1b\x1b'
MASTER: # spidev_test -D /dev/spidev0.0 -p $suspend
or $reboot, $poweroff, $halt
Signed-off-by: Xiaoning Wang <xiaoning.wang@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Leonard Crestez [Mon, 4 Jun 2018 18:35:35 +0000 (21:35 +0300)]
MLK-18498-1 ARM: imx_v7_defconfig: CONFIG_I2C_MUX_GPIO=y
Upstream added i2c-mux-gpio to imx6qdl-sabreauto and CONFIG_I2C_MUX_GPIO
to imx_v6_v7_defconfig. We need to copy this to imx_v7_defconfig or
several devices won't probe.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Leonard Crestez [Tue, 27 Mar 2018 17:21:47 +0000 (20:21 +0300)]
MLK-14667 ARM: imx v7 defconfig: disable CONFIG_MTD_SPI_NOR_USE_4K_SECTORS
Commit
556fa2d7d7e9 ("ENGR00318895-9: mtd: spi-nor: add more read
transfer flags for n25q256a") was incompletely cherry-picked, leaving
out the removal of the SECT_4K flag:
"From the datasheet, the chip support the 64K sector erase operation.
So remove the SECT_4K for the chip which makes the flash_erase
faster."
However, the above statement is not entirely correct. Using SECT_4K
can result in faster erase operations, if the block to erase is
smaller. The documentation in spi-nor.c also states:
"All newly added entries should describe *hardware* and should use
SECT_4K (or SECT_4K_PMC) if hardware supports erasing 4 KiB
sectors. For usage scenarios excluding small sectors there is config
option that can be disabled: CONFIG_MTD_SPI_NOR_USE_4K_SECTORS. For
historical (and compatibility) reasons (before we got above config)
some old entries may be missing 4K flag."
Unfortunately, using SECT_4K means that ubifs will fail, because it
needs a minimum LBE of 15K.
Based on the above comments, it looks like the best way to handle the
ubifs issue is to disable CONFIG_MTD_SPI_NOR_USE_4K_SECTORS instead of
removing SECT_4K for the particular n25q256a chip. This approach also
has the advantage that will make ubifs work with any chip that has the
SECT_4K flag.
Signed-off-by: Octavian Purdila <octavian.purdila@nxp.com>
Reviewed-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Peter Chen [Fri, 2 Dec 2016 07:28:02 +0000 (15:28 +0800)]
MLK-13570-6 ARM: configs: imx_v7_defconfig: Enable extcon USB GPIO
It is used for imx7ulp evk which uses GPIO for USB dual-role switch
function.
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Anson Huang [Sun, 9 Oct 2016 10:19:40 +0000 (18:19 +0800)]
MLK-13303-9 arm: configs: enable i.mx6sll by default
Enable i.MX6SLL by default.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Bai Ping [Wed, 13 Apr 2016 08:44:37 +0000 (16:44 +0800)]
MLK-12627-07 ARM: config: enable imx6ull in defconfig
Enable i.MX6ULL in imx_v7_defconfig.
Signed-off-by: Bai Ping <ping.bai@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Fri, 16 Jun 2017 17:40:37 +0000 (01:40 +0800)]
MLK-15074-8 ARM: imx_v7_defconfig: enable CONFIG_FSL_UTP
CONFIG_FSL_UTP is missing for MFG tool, add it.
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Arulpandiyan Vadivel [Thu, 10 Jan 2019 10:01:33 +0000 (15:31 +0530)]
ARM: dts: imx7d-sdb.dts: adjust the node name for tsc2046
This fixes below compilation warning by keeping node name(tsc2046) all over:
Warning (interrupts_property): /soc/aips-bus@
30800000/spba-bus@
30800000/ecspi@
30840000/tsc2046:#interrupt-cells: size is (8), expected multiple of 12
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Arulpandiyan Vadivel [Thu, 10 Jan 2019 09:54:50 +0000 (15:24 +0530)]
ARM: dts: imx7d-12x12: add missing states for GPIO
This fixes below compilation warnings by adding the state of gpio respectively:
Warning (gpios_property): /soc/aips-bus@
30800000/usdhc@
30b60000:cd-gpios: property size (8) too small for cell size 2
Warning (gpios_property): /soc/aips-bus@
30800000/usdhc@
30b60000:wp-gpios: property size (8) too small for cell size 2
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Arulpandiyan Vadivel [Thu, 10 Jan 2019 09:51:45 +0000 (15:21 +0530)]
ARM: dts: imx6ul.dtsi: add missing cells for ocotp
This fixes below compilation warnings by adding address-cell and size-cell
in ocotp-ctrl@
021bc000.
Warning (avoid_default_addr_size): /soc/aips-bus@
2100000/ocotp-ctrl@
021bc000/calib@38: Relying on default #address-cells value
Warning (avoid_default_addr_size): /soc/aips-bus@
2100000/ocotp-ctrl@
021bc000/calib@38: Relying on default #size-cells value
Warning (avoid_default_addr_size): /soc/aips-bus@
2100000/ocotp-ctrl@
021bc000/temp-grade@20: Relying on default #address-cells value
Warning (avoid_default_addr_size): /soc/aips-bus@
2100000/ocotp-ctrl@
021bc000/temp-grade@20: Relying on default #size-cells value
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Arulpandiyan Vadivel [Thu, 10 Jan 2019 09:46:54 +0000 (15:16 +0530)]
ARM: dts: imx6sx: add missing cells and move nodes
This fix below compilation warnings by,
1) Moving the sub nodes to regulator node.
2) Added address-cells and size-cells in regulator node.
Warning (reg_format): /regulator@1:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
Warning (reg_format): /regulator@2:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
Warning (reg_format): /regulator@3:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
Warning (reg_format): /regulator@7:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
Warning (reg_format): /regulator@9:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
Warning (reg_format): /regulator@10:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Arulpandiyan Vadivel [Thu, 10 Jan 2019 09:41:50 +0000 (15:11 +0530)]
ARM: dts: imx6qp.dtsi: update node naming standards for 4.19
Fix below compilation warnings by adhering to 4.19 node naming standards.
Warning (reg_format): /soc/aips-bus@
02100000/pre@
021c8000:reg: property has invalid length (8 bytes) (#address-cells == 2, #size-cells == 1)
Warning (reg_format): /soc/aips-bus@
02100000/pre@
021c9000:reg: property has invalid length (8 bytes) (#address-cells == 2, #size-cells == 1)
Warning (reg_format): /soc/aips-bus@
02100000/pre@
021ca000:reg: property has invalid length (8 bytes) (#address-cells == 2, #size-cells == 1)
Warning (reg_format): /soc/aips-bus@
02100000/pre@
021cb000:reg: property has invalid length (8 bytes) (#address-cells == 2, #size-cells == 1)
Warning (reg_format): /soc/aips-bus@
02100000/prg@
021cc000:reg: property has invalid length (8 bytes) (#address-cells == 2, #size-cells == 1)
Warning (reg_format): /soc/aips-bus@
02100000/prg@
021cd000:reg: property has invalid length (8 bytes) (#address-cells == 2, #size-cells == 1)
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Liu Ying [Thu, 13 Sep 2018 05:20:05 +0000 (13:20 +0800)]
MLK-19566 pwm: imx: Add NXP copyright
This patch adds NXP copyright for the i.MX PWM driver.
Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit
59c94789cef003fe64ebeb68c7b209da0bf2de78)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Bai Ping [Tue, 17 Apr 2018 05:57:21 +0000 (13:57 +0800)]
MLK-18042-01 driver: pwm: fix pwm pre-scale div config
In i.MX7ULP TPM PWM module, it has a pre-scale divider,
this divider setting is missed, so fix it.
Signed-off-by: Bai Ping <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Bai Ping [Tue, 21 Mar 2017 03:22:51 +0000 (11:22 +0800)]
MLK-14238-04 ARM: configs: Enable TPM PWM driver in default config
Enable TPM PWM driver in default config.
Signed-off-by: Bai Ping <ping.bai@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Bai Ping [Tue, 21 Mar 2017 03:12:42 +0000 (11:12 +0800)]
MLK-14238-01 driver: pwm: Add tpm pwm driver support
Add TPM PWM driver support i.MX7ULP.
Signed-off-by: Bai Ping <ping.bai@nxp.com>
[Octavian: updated for 4.9 APIs]
Signed-off-by: Octavian Purdila <octavian.purdila@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Sandor Yu [Tue, 8 Jan 2019 12:12:10 +0000 (17:42 +0530)]
MLK-12932-01: pwm backlight: Add fb name check feature
Add fb name check function pwm_backlight_check_fb_name(),
pwm driver can banding to fb with fb name when driver working
in device tree architecture.
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Vipul Kumar [Thu, 10 Jan 2019 07:16:50 +0000 (12:46 +0530)]
usb: typec: Fix return type of tcpci_register_port() function
This patch fix the return type of tcpci_register_port() to fix the
compilation warnings.
drivers/usb/typec/tcpci.c: In function ‘tcpci_register_port’:
drivers/usb/typec/tcpci.c:882:10: warning: returning ‘int’ from a function with return type ‘struct tcpci *’ makes pointer from integer without a cast [-Wint-conversion]
return -ENOMEM;
^
drivers/usb/typec/tcpci.c:888:10: warning: returning ‘int’ from a function with return type ‘struct tcpci *’ makes pointer from integer without a cast [-Wint-conversion]
return err;
^~~
drivers/usb/typec/tcpci.c: In function ‘tcpci_probe’:
drivers/usb/typec/tcpci.c:914:6: warning: unused variable ‘val’ [-Wunused-variable]
u16 val = 0;
^~~
AR drivers/usb/typec/built-in.a
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Vipul Kumar [Thu, 10 Jan 2019 07:04:15 +0000 (12:34 +0530)]
usb: typec: Separate the definitions for data and power roles
As per 'commit
ceeb162500c3 ("usb: typec: Separate the definitions for
data and power roles")', make changes to fix the compilation warnings.
drivers/usb/typec/tcpm.c: In function ‘tcpm_qos_handling’:
drivers/usb/typec/tcpm.c:892:28: warning: comparison between ‘enum typec_port_type’ and ‘enum typec_port_data’ [-Wenum-compare]
if (port->typec_caps.type == TYPEC_PORT_UFP)
^~
drivers/usb/typec/tcpm.c:894:33: warning: comparison between ‘enum typec_port_type’ and ‘enum typec_port_data’ [-Wenum-compare]
else if (port->typec_caps.type == TYPEC_PORT_DFP)
^~
drivers/usb/typec/tcpci.c: In function ‘tcpci_parse_config’:
drivers/usb/typec/tcpci.c:701:17: warning: comparison between ‘enum typec_port_type’ and ‘enum typec_port_data’ [-Wenum-compare]
if (tcfg->type == TYPEC_PORT_UFP)
^~
drivers/usb/typec/tcpci.c:726:17: warning: comparison between ‘enum typec_port_type’ and ‘enum typec_port_data’ [-Wenum-compare]
if (tcfg->type == TYPEC_PORT_DFP)
^~
drivers/usb/typec/tcpci.c:816:15: warning: comparison between ‘enum typec_port_type’ and ‘enum typec_port_data’ [-Wenum-compare]
tcfg->type == TYPEC_PORT_UFP)
^~
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 10:20:23 +0000 (15:50 +0530)]
MLK-18744 usb: typec: tcpm: qos handling fix
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 10:13:25 +0000 (15:43 +0530)]
MLK-17921-2 usb: typec: tcpm: add qos for PD transfer
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 10:01:47 +0000 (15:31 +0530)]
MLK-18531 usb: typec: don't do vbus source disable for dead battery
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 09:59:41 +0000 (15:29 +0530)]
MLK-17108-4 usb: typec: tcpci: correct read data msg length
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 09:56:13 +0000 (15:26 +0530)]
MLK-17108-3 usb: typec: tcpci: don't do force discharge if enable vbus sink
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Jun Li [Wed, 9 Jan 2019 09:52:23 +0000 (15:22 +0530)]
MLK-17108-2 usb: typec: support dead battery charging
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 09:22:14 +0000 (14:52 +0530)]
MLK-17217 usb: typec: tcpci: system wakeup source support
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>
Vipul: Fixes for 4.19 kernel.
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Thu, 14 Dec 2017 16:09:25 +0000 (00:09 +0800)]
MLK-17128-1 dt-bindings: typec: add max_snk_mw property
Add max_snk_mw property for power sink to know the max power.
Because the max mw may be smaller than the max ma multiplied by
max mv:
max-mw <= max-mv*max-ma
After the power sink decides the PDO from source, it needs
to check the power to see if the provided power of this PDO
can match its requirement, which needs consider max_snk_mw to
know the max current it can have based on selected voltage.
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 09:14:42 +0000 (14:44 +0530)]
MLK-17092 usb: typec: enable vbus voltage low alarm
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 09:11:51 +0000 (14:41 +0530)]
MLK-17077 usb: typec: clear vbus change event in irq handler
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Tue, 28 Nov 2017 11:17:20 +0000 (19:17 +0800)]
MLK-16820-4 dt-bindings: typec: add basic typec properties
port-type is required for any typec port; default-role is only required
for drp; power source capable needs src-pdos; power sink capable needs
snk-pdos, max-snk-mv, max-snk-ma, op-snk-mw.
Signed-off-by: Li Jun <jun.li@nxp.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 09:02:42 +0000 (14:32 +0530)]
MLK-16776 usb: typec: tcpci: use vbus from partner for EXTCON_USB
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 08:57:23 +0000 (14:27 +0530)]
MLK-16697 usb: typec: tcpci: add notfication for device attach
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Peter Chen [Wed, 9 Jan 2019 08:52:08 +0000 (14:22 +0530)]
MLK-16285-2 usb: typec: tcpci: add optional reset pin support
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Peter Chen [Wed, 9 Jan 2019 07:44:27 +0000 (13:14 +0530)]
MLK-16285-1 usb: typec: tcpci: move request interrupt to the end of probe
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 07:34:03 +0000 (13:04 +0530)]
MLK-16298-1 usb: typec: make super speed signal mux select configurable
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 07:29:18 +0000 (12:59 +0530)]
MLK-16013-44 usb: typec: tcpm: set data role after src detach
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 07:27:41 +0000 (12:57 +0530)]
MLK-16013-43 usb: typec: tcpci: add extcon for data role switch
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 07:19:26 +0000 (12:49 +0530)]
MLK-16013-37 usb: typec: Power swap force discharge for source
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 07:16:13 +0000 (12:46 +0530)]
MLK-16013-36 usb: typec: wait for cc change on ERROR_RECOVERY
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 07:14:21 +0000 (12:44 +0530)]
MLK-16013-34 usb: typec: Support cc changes on RP pull-up value
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 07:11:29 +0000 (12:41 +0530)]
MLK-16013-33 usb: typec: Do not switch to unattached state for BIST
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 07:09:10 +0000 (12:39 +0530)]
MLK-16013-32 usb: typec: refine source to sink swap handling
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 07:07:13 +0000 (12:37 +0530)]
MLK-16013-31 usb: typec: Set to unattached state if souce disconnected
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 07:00:39 +0000 (12:30 +0530)]
MLK-16013-30 usb: typec: Reset hard_reset_count to be 0 after send 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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 06:58:35 +0000 (12:28 +0530)]
MLK-16013-29 usb: typec: tcpm: Don't reset message id after soft reset
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Vipul Kumar [Thu, 10 Jan 2019 05:46:29 +0000 (11:16 +0530)]
usb: typec: add max_snk_mv/ma/mw
This patch add max_snk_mv/ma/mw to fix the below
compilation error.
drivers/usb/typec/tcpci.c:707:15: error: ‘struct tcpc_config’ has no member named ‘max_snk_mv’
&tcfg->max_snk_mv) ||
^~
drivers/usb/typec/tcpci.c:709:13: error: ‘struct tcpc_config’ has no member named ‘max_snk_ma’
&tcfg->max_snk_ma) ||
^~
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 11:27:21 +0000 (16:57 +0530)]
MLK-16013-9 usb: typec: add interface to get port type and role
Add interface to get typec port type and default power role from
dt. To validate a correct setting is specified, add TYPEC_PORT_TYPE_UNKNOWN
and TYPEC_ROLE_UNKNOWN for typec_port_type and typec_role enum.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
During 4.14 rebase renamed to typec_port_types_dt to avoid conflict with
sysfs values.
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Rebase it on v4.19
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 06:44:00 +0000 (12:14 +0530)]
MLK-16013-27 usb: typec: add super speed signal mux selection
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 06:31:50 +0000 (12:01 +0530)]
MLK-16013-26 usb: typec: tcpm: update PD timing
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 06:28:55 +0000 (11:58 +0530)]
MLK-16013-25 usb: typec: tcpm: correct the PD_T_SENDER_RESPONSE value
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 06:26:46 +0000 (11:56 +0530)]
MLK-16013-24 usb: typec: tcpm: use hrtimer for send response
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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
Li Jun [Wed, 9 Jan 2019 06:14:38 +0000 (11:44 +0530)]
MLK-16013-23 usb: typec: tcpm: Do soft reset for unexpected get sink cap
A source or sink should receive the get_sink_cap message when in SRC_RDY or
SNK_RDY, if the port receives a get sink capability request before ready,
which means there is message sync error, we should do soft reset to recover
from it, instead of sending a reject message.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 06:12:22 +0000 (11:42 +0530)]
MLK-16013-22 usb: typec: tcpm: split operations of power swap from sink to source
Add one more state:PR_SWAP_SNK_SRC_ASSERT_RP, as the next state of
PR_SWAP_SNK_SRC_SINK_OFF, it will turn on vbus and wait the vbus
is really on and then send the PS_RDY to the other side.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 06:07:36 +0000 (11:37 +0530)]
MLK-16013-21 usb: typec: tcpm: handle pd message send failure
If the PD message send failed, we need to do soft reset, further if
soft reset failed, we have to start a hard reset.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 05:57:08 +0000 (11:27 +0530)]
MLK-16013-20 usb: typec: Add bist test mode support
BIST(Built In Self-Test – Power Delivery testing mechanism for
the PHY Layer), see PD 3.0 spec 5.9 Built in Self-Test (BIST), is
added to support BIST message handling in PD compliance test.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 05:50:31 +0000 (11:20 +0530)]
MLK-16013-18 usb: typec: handle unexpected vbus from sink
Power source detected the attachment of sink, will firstly check
the vbus level to make sure power sink isn't sourcing vbus(< 600mv)
before going forward, otherwise it will terminate the session and
go to SRC_UNATTACHED state, this is required by PD compliance.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Vipul Kumar [Thu, 10 Jan 2019 05:24:10 +0000 (10:54 +0530)]
usb: typec: tcpm: Fix compilation error
As per 'commit
8e04b3721cc8 ("typec: tcpm: add starting value for drp
toggling")', make changes to fix the below compilation error.
drivers/usb/typec/tcpm.c: In function ‘tcpm_src_attach’:
drivers/usb/typec/tcpm.c:2625:2: error: too few arguments to function ‘tcpm_start_drp_toggling’
tcpm_start_drp_toggling(port);
^~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/typec/tcpm.c:2537:13: note: declared here
static bool tcpm_start_drp_toggling(struct tcpm_port *port,
^~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/typec/tcpm.c: In function ‘tcpm_snk_attach’:
drivers/usb/typec/tcpm.c:2749:2: error: too few arguments to function ‘tcpm_start_drp_toggling’
tcpm_start_drp_toggling(port);
^~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/typec/tcpm.c:2537:13: note: declared here
static bool tcpm_start_drp_toggling(struct tcpm_port *port,
^~~~~~~~~~~~~~~~~~~~~~~
scripts/Makefile.build:303: recipe for target 'drivers/usb/typec/tcpm.o' failed
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 05:41:51 +0000 (11:11 +0530)]
MLK-16013-17 usb: typec: tcpm: optimise cc toggling for drp port
We should only enable drp auto toggling when unattached, so add one
more parameter; when attached, we set the cc line state according to
the other end cc status.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 05:24:57 +0000 (10:54 +0530)]
MLK-16013-16: usb: typec: tcpm: tcpm init sequence update
Force an error recovery is not a good way to handle all cases and may
break the case of power up with typec already connected. Also the tcpc
init should start after tcpm init setup is done, as tcpc init will
turn on HW event alert so may generate events immediately and drive
tcpm state machine go forward, so move it at the end of tcpm_init.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
Li Jun [Wed, 9 Jan 2019 05:18:11 +0000 (10:48 +0530)]
MLK-16013-15: usb: typec: tcpci: Enable vbus force discharge
Enable vbus low voltage alert and do force discharge, this can aid turn
off vbus quickly.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>