Changes to only configure the LFSR on devices that don't have the
prng hardware already setup mistakenly removed the LFSR
configuration. Instead, the change is ORing in 1s into the top 16
bits of the register (they're marked as reserved).
Restore the original code by masking off the lower 16 bits of the
register and filling them with values from the
PRNG_LFSR_CFG_CLOCKS define.
Change-Id: Idd0df7b49175c211eec5ea778733ae81f5bc8188
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
This reverts commit 21b95f87c5a88a66f8ca9826465fe3a4ca01e5b2.
Commit 21b95f was meant to read the modem watchdog register
in order to determine if the modem booted up correctly after
a subsystem restart sequence. However, the modem watchdog
state is indeterminate even after the modem initializes it,
since the modem software disables the watchdog during
certain power collapse modes.
CRs-Fixed: 378114
Change-Id: Id4d59ea978b4b7a1a2df3bd5a6856f6b565cbdb8
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Video core expects one field per buffer for interlaced
clip playback.If a flush is issued we should reset the
need next field flag, so that new bitstream is processed
after flush is completed.
Reconfig flag shouldn't be reset in case of EOS.
Change-Id: Idf50a24c29e904a958b0b1e850813e2d9fc4346d
CRs-fixed: 382368
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Make this error message more informative about which clock failed
to have its rate changed, and what rate was attempted. Not all
users of debugfs are people and so the rate setting operation may
be buried layers deep in a script somewhere.
Change-Id: I6ae7f77f677b5077a294811d993df20aeadf1091
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Use the clk_prepare and clk_unprepare APIs to conform with the
changes to the clock APIs.
Change-Id: I3771ab992efcf83838d769776249379d9505ba28
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
After the change to keep the RAW_STATUS_EN always on, the
interrupt status bit was latched and could be set during
other (non-interrupt) activity on the GPIO line. This would
end up triggering the interrupt as soon as it was unmasked.
Hence, clear the interrupt status before unmasking the gpio
interrupt. This keeps the behavior and expectations same as
when the RAW_STATUS_EN was toggled and it prevented the
interrupt status to be updated while the interrupt was masked.
Change-Id: I3ccb31b5d8a7efe93f8253d4aff4a1c44281163f
CRs-Fixed: 346861
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
Move enabling the RAW_STATUS_EN at the very beginning.
Hardware team clarified that it is better to write to
RAW_STATUS_EN before writing to any other INTR_CFG bits
in order to prevent spurious interrupts.
Removing writing to the GPIO_INTR_CFG_SU register for
gpio-v2 and remove modifying any other bits except
INTR_ENABLE in mask/unmask calls as it could cause spurious
interrupts as well.
Change-Id: Ia025b324ee3be8073960eac73899f733336cac4c
CRs-Fixed: 346861
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
In some cases of system suspend, it's possible a runtime resume
may be called on a device if it's already autosuspended (say, in
order to set a device- or port-specific feature, such as the remote
wakeup setting) just prior to putting it back into low power mode.
In this case, if the controller was also auto-suspended it will also
be temporarily runtime resumed by the fact that it is an ancestor to
said device.
The incoming wakelock re-implementation from Google based on wakeup
sources breaks this driver in the above scenario since now acquiring
a wakelock (which calls __pm_stay_awake) during runtime resume while
a simultaneous asynchronous suspend callback of another device is
called will cause it to abort the entire suspend attempt.
This prompts reconsideration of why a wakelock is needed in this
driver. One apparent use is to ensure this controller's runtime
suspend is called before system suspend is allowed. In other words,
we wish to guarantee the HSIC child devices are suspended before
suspending the controller. This can be done by checking that the root
hub device is suspended, else we can abort the suspend callback by
returning -EBUSY.
To handle the cases of interrupts happening during systemwide suspend
but after the controller was already suspended (and thus its runtime
PM disabled), call the pm_stay_awake() to denote a wakeup event. This
will cause the suspend to abort as well as block it from happening
until the interrupt can be serviced--after the controller resumes.
Change-Id: I4fab47c54f7d57065833d96261de08dcdd7238dc
Signed-off-by: Jack Pham <jackp@codeaurora.org>
QDSS function driver currently works only with DWC3
core which uses DBM APIs for bam2bam mode of opearation.
Allow this driver to work with CI gadget by determining
the type of gadget it is operating with (DWC3 or CI) at
runtime and then submit the usb_request accordingly.
Change-Id: I2f0ce4092e55c6d2cabbfcc74251637a540be61f
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
The QDSS function driver supports high throughput debug information
delivery from the QDSS core to the host via the USB port.
Change-Id: Ia9397944d39d767c1200ad87aac67d5627233282
Signed-off-by: Shimrit Malichi <smalichi@codeaurora.org>
clock-debug uses a clock flag (CLKFLAG_HWCG) to determine if a
clock is capable of hardware gating. Unfortunately, recent
changes to clock handoff cause this flag to not always be set.
Take mdp_axi_clk for example. It is a depends of mdp_clk, and so
if mdp_clk is on out of the bootloader, mdp_axi_clk is indirectly
enabled by the clk_prepare_enable() call in __handoff_clk() when
mdp_clk is enabled. We could add support for handing off depends
clocks, but we're planning on removing the depends code and there
isn't a real problem in failing to hand off branches that are
depends since they're hidden from consumers anyway.
The only problem with this scenario is that branch_handoff() is
not called and so mdp_axi_clk is not marked as supporting
hardware clock gating. The clock flag is only used to indicate
support for hardware clock gating, so let's just read the
hardware anytime a users wants to know if the clock has hardware
gating or not.
This changes the semantics of the has_hw_gating file because we
read the hardware instead of returning a cached value and the
state of the hardware changes at runtime (e.g. if the clock is
put into reset hardware gating is turned off). In practice these
clocks aren't switching in and out of hardware gating mode while
a clock test is in progress so the impact of this change is
minimal to zero.
Change-Id: I4f646b1b32b42e3ef00067b47ffb78df8fb761d5
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
New characterization shows that L2 can run up to 1.188GHz. Therefore,
add this support.
Change-Id: I85368cf24c73bd7d868fdd803c34b18819d6ebf6
Signed-off-by: Tianyi Gou <tgou@codeaurora.org>
MSM_RUN_QUEUE_STATS is required to enable MP-Decision.
This change enables this kernel config for 8974 targets.
Change-Id: I225d4c4b6e8acb1f268c63ce0d0b95e6669a8bb9
Signed-off-by: Karthik Parsha <kparsha@codeaurora.org>
The msm/ directory is intended for camera. Hence moving up the wfd/
directory one level higher and renaming it as msm_wfd/.
Change-Id: I9309ccfee91a04b6d55cf3be7ed88da15364b475
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
Change the GPU clock frequency to 320MHz by default for
MSM8x25.
Change-Id: I423f1cb5e0f66c0579e080e44d91e109850cad25
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
Due to some issue with older USB PHYs, USB h/w requires to be
RESET everytime cable is diconnected. Avoid this on 8974's
USB core which doesn't have this issue.
Change-Id: I918492032de6d65eaba7c9b656c700d4f443aa99
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Software security is an important issue, in general, but it is
especially important in Linux kernel code. Buffer overflows can have
wide-reaching ramifications and can often be readily exploited to
compromise the entire system. It is important for every developer to
be aware of security issues while writing code.
However, I've noticed a few "rules" about coding that are resulting in
code that isn't any more secure, and has the disadvantage of obscuring
what the code is doing. In most instances, the "corrected" code is
actually wrong: we've traded a perceived lack of safety for incorrect
behavior. These obfuscations also make this code more distant from
upstream kernel standards.
I'm only going to focus here on strcmp/strncmp and strlen/strnlen. I
choose these two, because in the context of the kernel, it's not easy
to make a general rule, such as "always use the 'n' variant". These
function have different behavior, and the 'n' isn't just a blanket fix
that makes them better. In many instances, the correct call is the
plain variant (strcpy has a strlcpy variant which is usually helpful).
Let's start with strlen/strnlen.
size_t strlen(const char *);
size_t strnlen(const char *, size_t);
The strlen() function scans for a NUL byte within a string, and
returns the number of characters that had to be skipped to get there.
The strnlen() call is similar, but will stop after after a maximal
number of characters, and return that result. This variant was
intended for storing variable length strings in fixed-sized buffers,
where the full-length case did not have a trailing NUL. This storage
model is very uncommon, as is the use of strnlen().
The question becomes, what is the maximal length you should be giving
to strnlen(). If the string is truly variable length (allocated and
filled), there really isn't a meaningful value to use for this. The
only time that a max length makes sense is when you have something
like:
char name[MAX_NAME_LENGTH];
but, in this case, strnlen() is still probably not what you want to be
using. It would be safe to use, if you check the result, and if it is
MAX_NAME_LENGTH, raise some kind of error case. If later code assumes
there is a NUL at the end, there will still be a buffer overflow. In
this case, it is much better to check the length before storing it in
this field, and make sure there is room for the NUL.
If the string is a constant, passing in a length doesn't make sense,
since you would have to know the length of the string to check that.
There is no safety issue with calling strlen() on a constant.
So, the simple rule for strnlen()/strlen() is:
- If the string doesn't have an obvious bound length, such as an
allocated string, use strlen().
- If the string is a constant, use strlen().
- If there is a fixed buffer, strnlen() might make sense, but it is
probably better to change the design to avoid these types of
strings.
The only case where strnlen really makes sense is when you have a
string that is passed in from the user. In this case, it is very
important to check the result, and if the length is at the maximum,
return an error, and don't try to do any processing on the string.
Moving on to strcmp/strncmp. These functions are similar, except that
they take two string arguments, which gives a lot more combinations.
int strcmp(const char *, const char *);
int strncmp(const char *, const char *, size_t);
These will walk both strings (at the same time), and stop when
reaching the first difference between them. This means that they will
never go further than the length of the shortest string being
compared. As in strnlen, the max argument to strncmp sets a limit on
the comparison. Similar to strnlen, the results are unusual when the
limit is reached, but in a sense, even worse, since it may consider
the strings equal without ever reaching the end of either.
Looking over the 200 some uses of strncmp in the msm code, almost all
of them do something akin to:
strncmp(value, constant, strlen(constant))
If the call has added 1 to the 'strlen' result, the strncmp would just
become an inefficient, but otherwise identical version of strcmp.
However, without the +1, this compares the prefix of 'value' instead
of the entire string. Only one instance of strncmp in the code
appears to be intentionally checking for a prefix. The rest have
changed a simple string compare into an unintentional prefix match.
Because there are two strings, it is a little more complex to
determine which to use, but it is very similar. It might seem that
strncmp() would be useful for checking an unknown buffer (say from
userspace). However, since strncmp()'s result doesn't distinguish
between finding the end of the string, or hitting the max, there's no
way to know. Some guidelines:
- If one of the strings has a known bound length (such as a
constant, or another string whose length has already been
checked), AND this bound length is within the expected buffer of
the other string, it is safe to use strcmp().
- Otherwise, you may need to use something like strnlen() to
determine a maximum length before calling strcmp().
- strncmp() is useful to test a string for a prefix. No other uses
make sense.
To facilitate fixing these, remove strlen(), strcmp(), and
strcasecmp() from the list of calls that are banned. Problems with
these calls need to be caught at a higher level (such as review), and
replacing them with the 'n' variants doesn't help anything.
This will be followed by some patches that fixup the incorrect code
introduced by this "ban".
Change-Id: I77dfe1f2f58e8c951e4b38b23f4ec79f8209b1dc
Signed-off-by: David Brown <davidb@codeaurora.org>
When a V4L2 client sets or gets the format, driver is supposed to report
back the dimensions, the size of the buffer, and the number of planes
contained with in the buffer. The former two were being reported back
to the client, while the latter wasn't.
Change-Id: Ie225e108ce90cc40823ee9c0f13aeb7d054f5bdb
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
On-Device Logging at very high logging rates can cause
a race condition where the buffers reading in data from
the smd channel are filled with data and are not having
their data logged to userspace. Detect this condition
and restart the logging process.
CRs-Fixed: 382128
Change-Id: I3bb4cfae1bd72d2575c32e800973fac558beae7c
Signed-off-by: Dixon Peterson <dixonp@codeaurora.org>
When enabling certain branch clocks, there may be a handshake
performed with an FSM that indicates that the slave off of a
NOC is ready for traffic from that NOC. Modify the branch
clock halt checking to account for this additional handshake.
Note that only a few clocks have this requirement, and hence
the previously used halt check must still be preserved.
Change-Id: I0cdb454e5a89444e3ed9edadb88a7bc5a88c7a99
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
mdm GPIO configuration for I2S devices is now supported. Additionally
the mdm-driver can now handle the case where one of the lines it is
monitoring is assigned to GPIO 0.
Change-Id: I75fd06fc4f83fe652ab3bbb75980f2454a0f3621
Signed-off-by: Ameya Thakur <ameyat@codeaurora.org>
A recent change in the kernel disabled USB root hubs' wakeup
capability by default. This forces the setting for this particular
device/hub combination to always enable remote wakeup.
Change-Id: If7ef1e731e71feb9730a67b2d912f03890e7210d
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Move to the new clk_prepare/unprepare APIs.
Change-Id: I2991eaedab5e3c3dc974d035bd56d510ae026794
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Add support for 8625 v2.0 1GHz tables based on the
dynamic reprogramming of PLL4 clock plan.
Change-Id: If35adca22a7bf0775db6bdb865943fd9c386ca8e
Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
Add the DTS file for the MSM8974 CDP target.
Change-Id: Ibb65d718640ab926d7a3af072166233524e1730a
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
Dereference the thermal device pointer only after checking
that it is valid.
Change-Id: I5619b14f2d37969e59a16a64b6011c1dba9b2e15
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
Enable the simulator DSI panel for sim-platform.
Disable DSI controller for only RUMI-platform.
Change-Id: I38132e46e93d9bd5501f62a1a327e14d8fa4d92d
Signed-off-by: Chandan Uddaraju <chandanu@codeaurora.org>
Add DSI specific clocks to the clock lookup
structure to link proper DSI devices
with these clocks.
Change-Id: I6d621cedd5ef9697c2c5e95db63f5a1e12ea1e63
Signed-off-by: Chandan Uddaraju <chandanu@codeaurora.org>
Add new simulator dsi panel device to
represent panel configuration
settings as part of the device tree.
Change-Id: I6d2211c14e6e8f6bc7ead122c45348d18876bc74
Signed-off-by: Chandan Uddaraju <chandanu@codeaurora.org>
Fixed iommu map buffer dropped after overlay unset by saving
origianl iommu list before zero out overlay pipe structure.
Change-Id: I498dd4cf62e93f4571883fe20a0298e9fad4ccab
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
The QPNP IADC driver supports the user bank
peripheral of the current ADC(IADC).
IADC is a 16 bit ADC used for measuring current.
The single measurement mode is supported to read
current from upto seven channel configuration.
Clients can read the internal/external Rsense,
CSP_EX, CSN_RX along with gain and offset
calibraton channels.
Change-Id: I7e5ae3fc70878d16827d33705853a36bb0aa04f6
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Add this API to get the info of BAM registers and descriptor FIFOs.
Change-Id: I646119f6f1f7d8c94c71e30209b56a84bd4da38d
Signed-off-by: Yan He <yanhe@codeaurora.org>
u_ether driver passes rx data to network layer and resubmits the
request back to usb hardware in interrupt context. Network layer
processes rx data by scheduling tasklet. For high throughput
scenarios on rx data path driver is spending lot of time in interrupt
context due to rx data processing by tasklet and continuous completion
and re-submission of the usb requests which results in watchdog bark.
Hence move the rx data processing and usb request submission to a
workqueue bottom half handler.
CRs-Fixed: 382768
Change-Id: I4788b3d67f7aeeb005655c16b313653e939da79c
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Add support for vsync notification to user space using user events.
This is to trigger frame composition based on Vsync.
Change-Id: Ie94edfcdb5e540dd2f9a4a5df4bc3b7c4eb9041c
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
Userspace clients hold a wakelock while calling read. If data isn't
available, read() blocks preventing the release of the wakelock and
preventing the system from going into low power mode.
Implement poll() method to enable clients to call poll() to block and
wait for data without a wakelock. Once poll() returns, then a wakelock
can be acquired and read() called without blocking which allows
minimizing the time a wakelock is held.
CRs-fixed: 379519
Change-Id: Icea23783ee2d03e2beac81bdb1b735e4edfd1d22
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Reconfiguration sequence can lead to changes in channel segment
distribution and state. Since multiple clients can use 1 channel,
make sure channels cannot be manipulated when reconfiguration
sequence is in progress, and make sure that client doesn't send
reconfiguration sequence when no changes are pending to be sent
in the sequence from it.
CRs-Fixed: 383406
Change-Id: Ib5f0bc32f67f51f118fa417a2e580c8dc87ef0d0
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Bug fix for reading and writing multiple bytes. The bug causes holes
in the first 4 bytes when the byte count = 4, 5, or 6. Additionally,
on attempt to write more then the PMIC-arbiter supports, an error
message is logged and error value is returned. The SPMI framework
allows up to 16 byte per transfer, as supported by SPMI spec. However,
the PMIC arbiter supports up to 8 bytes per transfer.
Change-Id: I5c192fc22af51b1c61ed8ce31b75261cb8ad49ce
Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
IPC Message Router schedules a work item to read incoming messages
from the remote subsystems. Once a message is read, the work item
queues itself again in the workqueue. The queued work item performs
an uninterruptible wait for further messages. This causes the "loadavg"
to be consistently greater than 1. So refactor the read path such that
the read work item is queued only after the message has arrived.
CRs-Fixed: 383657
Change-Id: If532788de6377dd54574b57ec7a0779126d26e9b
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
Update slimbus slave driver to use updated address depending on discovered
The wcd9320 Taiko codec introduced a new register address map to configure
slimbus slave device.
Change-Id: I41e9ebabd1d375a1904b6033e46736b2fb6365f9
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
Counters need to be individually re-enabled after the CPU
comes out of power collapse. Without this the counters
will simply be set to their MAX period and starting the PMU
will have no effect.
Change-Id: I3988a45277057eb80cf580b90ce697d0e6a00c43
Signed-off-by: Ashwin Chaugule <ashwinc@codeaurora.org>
Add support for AR3002 Bluetooth SoC based on HCIUART driver
Change-Id: Ifc63c2cf620c7242acd7a14e72f80a43085661b7
Signed-off-by: Ram Mohan Korukonda <rkorukon@codeaurora.org>
Add external Bluetooth SoC support using UARTDM on msm8960.
Signed-off-by: Ram Mohan Korukonda <rkorukon@codeaurora.org>
Change-Id: I688b711e2ae3832f13370fd990aa3f425df39947
This feature allows defining more than one configuration to an android
usb gadget. This is important if we want our device to be compatible
with different kinds of host PCs. For example Windows host or Linux host.
Each host can select the configuration it supports from the several
configurations that our device exposes.
In order to define more then one configuration in a composition,
use the functions sysfs attribute of the android gadget, by using
a ':' character to separate between the configurations.
For example: echo "rndis,adb:ecm" > android0/functions
Using this feature there is one restriction, each usb configuration should
include different set of function drivers so a function driver cannot
appear in more then one usb configuration at the same time.
Change-Id: Id8ca2ee3dcc3257bc56cc7b7b8a9ecbbd6316d45
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
This commit will add support for ION memory on
8x55 target for video encoder and decoder.
Change-Id: I23be61d698cf3c6ee81846bad61be15b9e3f824f
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
In yaffs_rename(), d_entry->d_inode can be NULL if the
target directory doesn't exist or if there is any race
condition such as target directory being deleted while
renaming another directory to target directory name.
Avoid dereferencing d_inode in such cases.
CRs-Fixed: 360748
Change-Id: If95b4992f1056fea78f2e1bd54253cd5c8aac93d
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>