clock-8974: Support the USB UTMI clock source divider

The gcc_usb30_mock_utmi_clk also contains a CDIV divider
that can do integer division on 8974V2 and newer targets.
Support this divider in clock-gcc-8974.
Drivers will need to set a rate on usb30_utmi_clk_src, and
then set a divider on gcc_usb30_mock_utmi_clk. Both of these
operations shall make use of the clk_set_rate API.
Also update the frequency table on usb30_utmi_clk_src to
include a new 48MHz rate.

Change-Id: I0952fc25b187456eeb98b8bc4a3c5d51fd10a67a
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
usb: dwc3: Enable newer refclk-based SOF/ITP generation

Add support for refclk-based SOF and ITP generation, which is
present on DWC3 cores starting in revision 2.50a. This supersedes
the functionality provided by GCTL.SOFTITPSYNC which handled ITP
generation only. This introduces the new GFLADJ register and
writes its fields based on the reference clock period to the
core, which can now be specified as a device tree parameter.

Change-Id: I2c57586cd8b5275b77ebe64cf0835617f0340b62
Signed-off-by: Jack Pham <jackp@codeaurora.org>
USB: dwc3-msm: Add support for 24MHz utmi clock

For ref clk based SOF/ITP generation, utmi clock needs to be set
to frequencies like 19.2MHz, 24MHz etc. Hence add support for
setting utmi clock to 24MHz.

Change-Id: Ia64eaa5320846ab219c516f43e6dcdf0fb05eb89
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
ARM/dts: Set ref clock to 24MHz for msm8974

Set ref clock rate to 24MHz for 8974 platform for ref clock
based SOF/ITP generation. Otherwise enumeration of peripherals
will fail.

Change-Id: I8425e82f5ceaf3a8bcb4a5d1a3ccc7954e44d752
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
msm: vidc: flush queued work during device suspend

This change flushes any queued work related to power collapse,
once the device is power suspended.
There are applications which do not destroy video instance
on suspending the device. For such applications, if the device
is power suspended, video driver does not prepare venus for
power collapse.
Considerable power saving is observed by power collapsing
venus before the device goes in suspend state.

Change-Id: I11252e45b10d0d3d3eefb38994acd083c847bbb8
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
seq_file: introduce seq_setwidth() and seq_pad()

There are several users who want to know bytes written by seq_*() for
alignment purpose.  Currently they are using %n format for knowing it
because seq_*() returns 0 on success.

This patch introduces seq_setwidth() and seq_pad() for allowing them to
align without using %n format.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Joe Perches <joe@perches.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 839cc2a94cc3665bafe32203c2f095f4dd470a80)
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
CRs-fixed: 665291
Change-Id: I727d9af5ed320d717295c9d0f82c88623fb181c1
Signed-off-by: David Brown <davidb@codeaurora.org>
vsprintf: ignore %n again

This ignores %n in printf again, as was originally documented.
Implementing %n poses a greater security risk than utility, so it should
stay ignored.  To help anyone attempting to use %n, a warning will be
emitted if it is encountered.

Based on an earlier patch by Joe Perches.

Because %n was designed to write to pointers on the stack, it has been
frequently used as an attack vector when bugs are found that leak
user-controlled strings into functions that ultimately process format
strings.  While this class of bug can still be turned into an
information leak, removing %n eliminates the common method of elevating
such a bug into an arbitrary kernel memory writing primitive,
significantly reducing the danger of this class of bug.

For seq_file users that need to know the length of a written string for
padding, please see seq_setwidth() and seq_pad() instead.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Joe Perches <joe@perches.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 9196436ab2f713b823a2ba2024cb69f40b2f54a5
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
CRs-fixed: 665291
Change-Id: Id191acaf66e3c395df92b0a77331269b525e3cad
Signed-off-by: David Brown <davidb@codeaurora.org>
Merge "msm: vidc: flush queued work during device suspend"
seq_file: remove "%n" usage from seq_file users.

All seq_printf() users are using "%n" for calculating padding size,
convert them to use seq_setwidth() / seq_pad() pair.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Joe Perches <joe@perches.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 652586df95e5d76b37d07a11839126dcfede1621
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[rsiddoji@codeaurora.org: Resolve merge conflicts with ipv4/6 ping
 changes in upstream]
CRs-fixed: 665291
Change-Id: Ia0416c9dbe3d80ff35f24f9c93c3543d1200a327
Signed-off-by: Ravi Kumar <rsiddoji@codeaurora.org>
Merge "seq_file: introduce seq_setwidth() and seq_pad()"
Merge "seq_file: remove "%n" usage from seq_file users."
Merge "vsprintf: ignore %n again"
msm: mdss: hdmi: add hdmi_ahb clock to HPD

Power on HPD accesses HDMI registers. HDMI AHB clock needs to be
enabled while HPD is being powered on.

Change-Id: I483ac56b41e3bd3794878940fbd0d5242dd5d1cd
Signed-off-by: Casey Piper <cpiper@codeaurora.org>
Merge "msm: mdss: hdmi: add hdmi_ahb clock to HPD"
ASoC: wcd9xxx: distortion in HPH LO combo device

Follow Class H sequence for headset, lineout and ear concurrency as per
the class H HW design sequence to avoid signal clipping.

CRs-Fixed: 602408,618992
Change-Id: I517a5df98708f7292111e5cf71ffcf6ef8c4b870
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
msm_serial_hs: Fix return value handling from platform_get_irq_by_name

platform_get_irq_by_name function returns -ENXIO upon failure.
The return code should be checked for this error code to detect
failures.

CRs-Fixed: 566710
Change-Id: I95b601edf457a19ad8f617700697fae9b5db0f1f
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
Merge "ASoC: wcd9xxx: distortion in HPH LO combo device"
Merge "clock-8974: Support the USB UTMI clock source divider"
Merge "usb: dwc3: Enable newer refclk-based SOF/ITP generation"
Merge "USB: dwc3-msm: Add support for 24MHz utmi clock"