msm: vidc: Add support for setting initial qp

Adds support to set initial qp, thereby allowing the client to set
initial qp for I,P, and B frames.

Signed-off-by: Ashray Kulkarni <ashrayk@codeaurora.org>

Conflicts:
	drivers/media/platform/msm/vidc/vidc_hfi_api.h
	drivers/media/platform/msm/vidc/vidc_hfi_helper.h

Change-Id: Iccae94da98578e86853f53f5c57264ece9486528

Conflicts:
	drivers/media/platform/msm/vidc/msm_venc.c
msm: vidc: Amend calculation of buffer sizes in VENUS_BUFFER_SIZE

Add 8KB worth of padding for extradata. This is required to accommodate
some of the larger extradata types that didn't fit into the residual
space between the actual buffer size and its aligned size.

CRs-Fixed: 647378
Change-Id: I550f806079dfbdece229f68ffdfc5c0e20b3c9e1
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
msm: vidc: Expose extradata size to userspace

Previously, the extradata size was included within VENUS_BUFFER_SIZE
and callers (primarily in userspace) wouldn't know how much extra
padding was added to the buffer size. Exposing it allows userspace to
query directly instead of doing guesswork.

Change-Id: I7f9701a4adfe364d757028514bdd4fa84402a995
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
msm: vidc: Add AFD and CC metadata support to extradata

Add support and control for setting Active format
description and closed caption meta data in the
extradata. FW parses metadata and adds it to the
extradata. Client can use control to parse extradata
for the metadata information.

Change-Id: I79fb71e635927c95e0792862c9dea7d96f58e895
Signed-off-by: Jayasena Sangaraboina <jsanga@codeaurora.org>

Conflicts:
	drivers/media/platform/msm/vidc/vidc_hfi_api.h
	include/linux/videodev2.h
msm: vidc: Add support for different errors

When hardware is overloaded or when max number of clients are
reached in driver or firmware, hardware error is sent to video
client. This change is to replace hardware error with actual
errors.

CRs-fixed: 575852
Change-Id: I07e599f894a3716a3dc4fed5eb7c987311f5bdde
Signed-off-by: Deepak Verma <dverma@codeaurora.org>

Conflicts:
	drivers/media/platform/msm/vidc/hfi_response_handler.c
	drivers/media/platform/msm/vidc/msm_vidc_common.c

Conflicts:
	drivers/media/platform/msm/vidc/hfi_response_handler.c
	drivers/media/platform/msm/vidc/msm_vidc_common.c

Change-Id: I4ce54abfbc8572368517164f626654d7833cbb95

Conflicts:
	drivers/media/platform/msm/vidc/hfi_response_handler.c
	drivers/media/platform/msm/vidc/msm_vidc_common.c
msm: vidc: Change in input buffer size calculation

Right now, input buffer size is calculated based on
maximum supported height and width returned from FW.
These values are not true representation as they are
calculated for rotation usecase. Driver needs to use
max MB supported from FW. This change fixes the same.

CRs-Fixed: 599818
Change-Id: I5b5f7d0db1088a4bc16ec7a32b31e1f763d5da7c
Signed-off-by: Manikanta Sivapala <msivap@codeaurora.org>

Conflicts:
	drivers/media/platform/msm/vidc/msm_vdec.c

Change-Id: I20939211fc45f4299ad3b5c904d10c2c6e9c28d9

Conflicts:
	drivers/media/platform/msm/vidc/msm_vdec.c
msm: vidc: add new control for limiting i/p buffer size

Take the minimum of the size calculated by driver using
max width and height supported and the size set by client
for input buffers. Change interface to get input and
output buffer sizes.

Change-Id: Ia3eb4cc7ae7bb38e2650fff1b694623e2aab62ef
Signed-off-by: Manikanta Sivapala <msivap@codeaurora.org>
net: ipv6: Add IPv6 support to the ping socket.

[msm/android-3.4 commit 1f0675844e3b63a765e5bd32bc5af051ccd951c0]

This adds the ability to send ICMPv6 echo requests without a
raw socket. The equivalent ability for ICMPv4 was added in
2011.

Instead of having separate code paths for IPv4 and IPv6, make
most of the code in net/ipv4/ping.c dual-stack and only add a
few IPv6-specific bits (like the protocol definition) to a new
net/ipv6/ping.c. Hopefully this will reduce divergence and/or
duplication of bugs in the future.

Caveats:

- Setting options via ancillary data (e.g., using IPV6_PKTINFO
  to specify the outgoing interface) is not yet supported.
- There are no separate security settings for IPv4 and IPv6;
  everything is controlled by /proc/net/ipv4/ping_group_range.
- The proc interface does not yet display IPv6 ping sockets
  properly.

Tested with a patched copy of ping6 and using raw socket calls.
Compiles and works with all of CONFIG_IPV6={n,m,y}.

Conflicts:
	net/ipv4/ping.c

Bug: 9469865
Change-Id: I752190e680c009c371d177d8f84af242d3990813
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[lorenzo@google.com: backported to 3.4]
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
[lorenzo@google.com: include export.h to fix missing THIS_MODULE]
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>

Conflicts:
	net/ipv4/ping.c
	net/ipv6/ping.c
net: ipv6: add missing lock in ping_v6_sendmsg

[msm/android-3.4 commit 3a018d2e8fc2910e5fb2077cde81cad659e2c7f9]

Bug: 9469865
Change-Id: I5ca9624d68fcbddf6469e5124a14b6fceedb7398
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net: ipv6: fix wrong ping_v6_sendmsg return value

[msm/android-3.4 commit 5f0fd6105f491b8b435863e98f7e96d617e3da84]

ping_v6_sendmsg currently returns 0 on success. It should return
the number of bytes written instead.

Bug: 9469865
Change-Id: If1eba8445f207b25ac8c868cbe9814554cdec8df
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net: core: Support UID-based routing.

This contains the following commits:

1. 0149763 net: core: Add a UID range to fib rules.
2. 1650474 net: core: Use the socket UID in routing lookups.
3. 0b16771 net: ipv4: Add the UID to the route cache.
4. ee058f1 net: core: Add a RTA_UID attribute to routes.
    This is so that userspace can do per-UID route lookups.

Bug: 15413527
Change-Id: I1285474c6734614d3bda6f61d88dfe89a4af7892
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
net: add a sysctl to reflect the fwmark on replies

Kernel-originated IP packets that have no user socket associated
with them (e.g., ICMP errors and echo replies, TCP RSTs, etc.)
are emitted with a mark of zero. Add a sysctl to make them have
the same mark as the packet they are replying to.

This allows an administrator that wishes to do so to use
mark-based routing, firewalling, etc. for these replies by
marking the original packets inbound.

Tested using user-mode linux:
 - ICMP/ICMPv6 echo replies and errors.
 - TCP RST packets (IPv4 and IPv6).

Change-Id: I95d896647b278d092ef331d1377b959da1deb042
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Bluetooth: Remove unused hci_le_ltk_reply()

In this API, we were using sizeof operator for an array
given as function argument, which is invalid.
However this API is not used anywhere.

Change-Id: I80a43472b35f0f6c117624de2b2907b37eefb786
Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
nf: IDLETIMER: time-stamp and suspend/resume handling.

Message notifications contains an additional timestamp field in nano seconds.
The expiry time for the timers are modified during suspend/resume.
If timer was supposed to expire while the system is suspended then a
notification is sent when it resumes with the timestamp of the scheduled expiry.

Removes the race condition for multiple work scheduled.

Bug: 13247811

Change-Id: I752c5b00225fe7085482819f975cc0eb5af89bff
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
msm: vidc: Change inline functions to function macros

Stripped out kernel headers remove the function definitions
so changing these functions to macros.

Change-Id: I550157301b92855eaf2fbb92bcba050f84fe0b95
Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>
Signed-off-by: Praveen Chavan <pchavan@codeaurora.org>

Conflicts:
	include/media/msm_media_info.h
msm: mdss: Allow smp change during composition switch

The composition fallback mechanism might not ensure unsetting of
the pipe whose prepare call failed due to smp configuration change,
typically in the cases where change in composition requests same
pipe. This scenario is a deadlock where composition switch does
not happen, due to these pipe failures.

To handle such cases, for changed SMP request for a pipe doing
non backend composition, allow smp configuration to happen, so
that the composition could be successfully switched, thereby
preventing the deadlock.

Conflicts:
	drivers/video/msm/mdss/mdss_mdp_pipe.c

Change-Id: I2d29ac6591671494abc7c4caf7c6c53f058d12f6
Signed-off-by: Justin Philip <jphili@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp_pipe.c
mdss: Add MDP_SMP_FORCE_ALLOC mdp flag

MDP_SMP_FORCE_ALLOC flag is used to allow SMP
allocations even when there is mismatch between
allocated and requested SMPs for a pipe.
User space can make use of this flag in extreme scenarios
where SMP allocations need to pass like GPU composition
and playback of protected  or secure videos.

Change-Id: I369b4361e7e2bbfc8150add467678c4ef8d5cfb6
Signed-off-by: Justin Philip <jphili@codeaurora.org>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp_pipe.c