The device can only process one request at a time. So if multiple
requests came at the same time, we can enqueue them first, and
dequeue them one by one when the device is idle.
Signed-off-by: zain wang <wzz@rock-chips.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit 5a7801f663)
Change-Id: Ie155271c181cd9b6174708e8ebc36bf65c0d49c8
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
Sometime we would unable to dequeue the crypto request, in this case,
we should finish crypto and return the err code.
Signed-off-by: zain wang <wzz@rock-chips.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit 9a42e4eed3)
Change-Id: If3cd08dbd48beb66539a3ac6bbe1c3d2656c8a7b
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
It's illegal to call the completion function from hardirq context,
it will cause runtime tests to fail. Let's build a new task (done_task)
for moving update operation from hardirq context.
Signed-off-by: zain wang <wzz@rock-chips.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit 641eacd156)
Change-Id: Iddfdf48c5dc823817d7e15fc5d04bef96506c3be
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
If devm_add_action() fails we are explicitly calling the cleanup to free
the resources allocated. Lets use the helper devm_add_action_or_reset()
and return directly in case of error, as we know that the cleanup function
has been already called by the helper if there was any error.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit 16d56963e8)
Change-Id: I9fd5d7c0659744243b313693615bf332a2b5e05c
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
Lockdep warns about a possible deadlock resulting from the use of regular
spin_locks:
=================================
[ INFO: inconsistent lock state ]
4.4.0-rc2+ #2724 Not tainted
---------------------------------
inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
ksoftirqd/0/3 [HC0[0]:SC1[1]:HE1:SE0] takes:
(&(&crypto_info->lock)->rlock){+.?...}, at: [<bf14a65c>] rk_crypto_tasklet_cb+0x24/0xb4 [rk_crypto]
{SOFTIRQ-ON-W} state was registered at:
[<c007f4ac>] lock_acquire+0x178/0x218
[<c0759bac>] _raw_spin_lock+0x54/0x64
[<bf14af88>] rk_handle_req+0x7c/0xbc [rk_crypto]
[<bf14b040>] rk_des_ecb_encrypt+0x2c/0x30 [rk_crypto]
[<bf14b05c>] rk_aes_ecb_encrypt+0x18/0x1c [rk_crypto]
[<c028c820>] skcipher_encrypt_ablkcipher+0x64/0x68
[<c0290770>] __test_skcipher+0x2a8/0x8dc
[<c0292e94>] test_skcipher+0x38/0xc4
[<c0292fb0>] alg_test_skcipher+0x90/0xb0
[<c0292158>] alg_test+0x1e8/0x280
[<c028f6f4>] cryptomgr_test+0x34/0x54
[<c004bbe8>] kthread+0xf4/0x10c
[<c0010010>] ret_from_fork+0x14/0x24
irq event stamp: 10672
hardirqs last enabled at (10672): [<c002fac8>] tasklet_action+0x48/0x104
hardirqs last disabled at (10671): [<c002faa0>] tasklet_action+0x20/0x104
softirqs last enabled at (10658): [<c002ef84>] __do_softirq+0x358/0x49c
softirqs last disabled at (10669): [<c002f108>] run_ksoftirqd+0x40/0x80
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(&(&crypto_info->lock)->rlock);
<Interrupt>
lock(&(&crypto_info->lock)->rlock);
*** DEADLOCK ***
Fix this by moving to irq-disabling spinlocks.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit ac7c8e6b6d)
Change-Id: Ic333d4924b1984ea953f7a4c8da18d078cba8239
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
Crypto driver support:
ecb(aes) cbc(aes) ecb(des) cbc(des) ecb(des3_ede) cbc(des3_ede)
You can alloc tags above in your case.
And other algorithms and platforms will be added later on.
Signed-off-by: Zain Wang <zain.wang@rock-chips.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit 433cd2c617)
Change-Id: I7ee26d896754f66adb1152b33c65cc030c4906ed
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
Some crypto drivers cannot process empty data message and return a
precalculated hash for md5/sha1/sha224/sha256.
This patch add thoses precalculated hash in include/crypto.
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit 0c4c78de04)
Change-Id: Ie15d9e6119f415c7c5af875fec160299e9053770
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
Add a helper function devm_add_action_or_reset() which will internally
call devm_add_action(). But if devm_add_action() fails then it will
execute the action mentioned and return the error code.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
(cherry picked from commit a3499e9bf0)
Change-Id: Ice9a6b483021494194b3c57149bbc451050b1fe3
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
Adding the following freq cfg in 8-bit and 10-bit color depth:
{
40000000, 65000000, 71000000, 83500000, 85750000,
88750000, 108000000, 119000000, 162000000
}
New freq has been validated by quantumdata 980.
For some freq which can't be got by only using integer freq div,
frac freq div is needed, Such as 88.75Mhz 10-bit. But The actual
freq is different from the target freq, We must try to narrow
the gap between them. RK322X only support integer freq div.
The VCO of pre-PLL must be more than 2Ghz, otherwise PLL may be
unlocked.
Change-Id: Icc978a31a51e330e12c6372c68f4e6b94e26cbda
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
This change has some bug, revert it.
This reverts commit cc06fabbcd.
Change-Id: I8f772f01d50379f68767d9b79b13826b1dd3610a
Signed-off-by: Putin Lee <putin.li@rock-chips.com>
As rk3326 used the new ISP framework that different with old
ISP v10 was used by other SoCs. We didn't have a better solution to solve
the camera configure.
Also, the rk3326 linux need improve the optimization for some products.
Change-Id: I212ef50cdd0b4860759505e2f7a03106ac2ef268
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
If uart is busy all the time, which may call debug_port_init and
reset uart, but this can't clear the USR busy status. The LCR can't be
writed if UART is busy.UART can't be reinited ok.
This issue is tested by open and close wifi, and start logcat.
A lot of android log is outputed by uart,uart is always busy,maybe it
triggers reinit process, and cause the issue.
It is unnecessary to call debug_port_init, because we have make sure
uart is ok all the time.
Change-Id: I1ef06e2a913d7045e86fe75a48a152c04e7e96a7
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
The linux platform used the GPT for update image, and the new
tools(v2.55) had fixed the bug before.
Change-Id: I200d98170d538098c4e3472a22398a4ecc15270e
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
-sort include files alphabetically
-drop DRV_NAME
-fix type definition of some variables
-only support one gpio per node
-fixup gpio output value polarity
The PWM_POLARITY_NORMAL(=0) means a high signal for the duration of the
duty-cycle, thus rectify the output value in pwm_on&off.
Usually, the pwm output should be a low signal before the first-timeuse.
Because of the probe function set the gpio output value to GPIOD_OUT_LOW
within devm_gpiod_get_index, we have been forced to set the flag of
gpios with ACTIVE_HIGH.
-fixup reverse the output signal at an inappropriate moment
In one case, someone set the value of duty_cycle as the same as the
period while the pwm output is enable, the off_time will be set to zero.
However the original implementation still to set the pwm output to a low
signal, it causes the output is not a **real** high signal. As the
result,
the output duty cycle is almost 97 percent.
Change-Id: I449fc96938ccaeb7bdfaf90e237eeb9f5c4e6de6
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
This patch adds a bit-banging gpio PWM driver. It makes use of hrtimers,
to allow nano-second resolution, though it obviously strongly depends on
the switching speed of the gpio pins, hrtimer and system load.
Each pwm node can have 1 or more "pwm-gpio" entries, which will be
treated as pwm's as part of a pwm chip.
Change-Id: Ibdb28eca3239a3a8503c947667117a9b0e9427b9
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
(cherry picked from https://patchwork.kernel.org/patch/7492201/)
Some modules will use the same pvtm channel to adjust opp-table, do not
calclate pvtm data twice for the same channel.
Change-Id: Ib8d765139821cfbdcc45bd60153d975fc80d48fa
Signed-off-by: Liang Chen <cl@rock-chips.com>
The dwc2_get_ls_map() use ttport to reference into the
bitmap if we're on a multi_tt hub. But the bitmaps index
from 0 to (hub->maxchild - 1), while the ttport index from
1 to hub->maxchild. This will cause invalid memory access
when the number of ttport is hub->maxchild.
Without this patch, I can easily meet a Kernel panic issue
if connect a low-speed USB mouse with the max port of FE2.1
multi-tt hub (1a40:0201) on rk3288 platform.
Change-Id: I51c6fb53919e3ab186b95180c4fd6569e03cffee
Signed-off-by: William Wu <william.wu@rock-chips.com>
(am from https://patchwork.kernel.org/patch/10414533/)
in addition,
resolve all the conflicts;
rename all the configs and macros that have a same name in midgard/;
adjust "platform specific code" for the change of interface
to get GPU busy/idle time from "common part";
Change-Id: Iad3493c15c95653a1c72c5375f510e44c4535d0c
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
The reported scale was only correct for the default settings of 100 ms
integration time and gain 1.
This aligns the reported scale with the behaviour of any other IIO driver
and the documented ABI, but may require userspace changes if someone uses
non-default settings.
Change-Id: I969d50d317f20d05d26db74d497dba790b5a7c25
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
(cherry picked from commit 3525d7cfb7)
Instead of manually iterating the array of allowed gain values, use
find_closest. Storing the current gain setting avoids accessing the
hardware on each query.
Change-Id: Ibd41d58d50c29fdf17609d0323d8d54bdf3109a7
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
(cherry picked from commit e794bf6751)
Instead of reading the value from the register on each query, store the
set value.
Change-Id: If7930543623f78abb67f33106c0c0a12d4e1ac33
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
(cherry picked from commit df698c0402)
This improves code uniformity (range checks for als_gain are also done
in the setter). Also unmangle rounding and calculation of register value.
The calculated integration time it_ms is required in the next patch of
the series.
Change-Id: I5a315428927056b72899e303019d64f20ee34cbf
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
(cherry picked from commit 1e2ed3d0d2)
This patch adds support for STMicro VL6180 - ALS, range and proximity sensor. Sensor is capable of measuring the light
intensity as well as object distance using TOF (Time of Flight) technology.
Change-Id: I5ad6d2c2a93d5906aebfda6cb2cff332bc7c2462
Signed-off-by: Manivannan Sadhasivam <manivannanece23@gmail.com>
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
(cherry picked from commit 5e7f47e495)
For pixel clock is rounded by 1000Hz, the recalcated clock rate
of fractional frame rate mode, such 59.94/29.97/23.97Hz, is need
to take the 1000Hz rounding. Otherwise it will not find the pre-pll
settings when powering up phy.
Change-Id: I0f02bbede9314d57d97c539cd995eb0f67295cfd
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
Set the default value for pd_idle,sr_idle and standby_idle.
Change-Id: Idfa2d62229fd8ec1ab48c2506a6b5ba3da080a49
Signed-off-by: YouMin Chen <cym@rock-chips.com>