hammerhead_defconfig: Enable usb tablet devices and xpad

Bug: 11759904
Change-Id: If83a00279300c9d069d737cfa70fd15f406b73a3
Signed-off-by: jude84.kim <jude84.kim@lge.com>
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: camera: Use correct type for function return code

Using an unsigned integer to hold the signed return code
is wrong. So fix it by using the correct type to hold the
return code.

CRs-fixed: 512824
Change-Id: I389732a9af740174b26c8c43946e638a1be0d2a2
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: camera: Fix various small issues in cci driver

Remove some unused ioctl exposed, Also add
some bound checks for ioctl user params.

Change-Id: Ifdd441fdb25fd20b005c4e4e1ebe4e203f1216ac
CRs-Fixed: 511382
Signed-off-by: Hariram Purushothaman <hpurus@codeaurora.org>
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: camera_v2: CCI release resources in case of timeout

Turn off the CCI clocks and release gpio if reset timeout error is
received in function_msm_cci_init()

Bug: 11825720
Change-Id: Ib4387ce08635e0b4e6458f225bd3013557d6b5fa
Signed-off-by: Evgeniy Borisov <eborisov@codeaurora.org>
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: camera: Reset CCI core based on I2C MASTER

CCI core is used by camera sensor, actuator and EEPROM. CCI core gets
reset first time when either one of hardware modules initializes it.
But, as per hardware requirement sensor has to be powered up before
CCI can be reset. This imposes limitation in the sequence in which
camera is opened. To remove this limitation, initialize CCI core
only for corresponding I2C MASTER everytime either of the hardware
modules initilizes it.

Change-Id: If2d7cc26fe23533243714839e6375f73d5efd4f2
Signed-off-by: Sreesudhan Ramakrish Ramkumar <srramku@codeaurora.org>
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: camera: Checking an enum value greater than zero

An enum value cci_i2c_master is not checked to be greater than 0.
Add the check.

Change-Id: Ibe75ab7155def45d81b8127c5eda3fa2ed570bce
Signed-off-by: Xu Han <hanxu@codeaurora.org>
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: cci: fix for invalid error handle

fix for invalid error handle in msm cci
- msm_cci_flush_queue function never return
error because variable rc is unsigned int
- msm_cci_init function return result int32_t
but variable rc is int

Change-Id: I2610b08f4eceedfbb8bd07d8027310f43b9ee6bf
Signed-off-by: Vasko Kalanoski <vaskok@codeaurora.org>
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: msm-hdmi-codec-rx: sync state with HDMI core

To keep the state of the HDMI core and HDMI audio
sessions congruent, audio checks the state of the
core on startup, then notifies the core of the
active audio session.  On shutdown, notifies the
core of the event.

Change-Id: I8f90a4610ed9345c1affa67a7fee306e7d388d85
CRs-Fixed: 539309
Author: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: hdmi: HDMI cable connection status and vote

Add HDMI cable connection status functionality to be used by
audio driver before starting the audio session and vote for
hdmi tx core to remain power on until the audio has completed
its processing.

Change-Id: I35d1bafff472da19e04aa44f4ac91b1c3c0349e1
Author: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
video: slimport: disable not-supported timings

Disable non-supported timings from the HDMI LUT. ANX7808 is able to
support for max 1080p60.

Change-Id: Iaf26fbdd584153cbd570344830e5ac083872b267
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
video: slimport: Fix slimport blinking issue

Link integrity check sometimes failed without external power.
This is a workaround for this failure. Enabling the USB clk prevent
this issue.

Change-Id: I4934c8fe840bd865b6355aefdb565ca00f1c7b69
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
arm/dt: hammerhead: slimport: Fix slimport blinking issue

Link integrity check is sometimes failed without external the power.
This is a workaround for this failure. Enabling the USB clk prevent
this issue.

Change-Id: I793127de438d14e71ee0f104e94fd39e09d7b39b
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
Revert "mdss: hdmi: Wait for mdss iommu attached on boot with hdmi"

This reverts commit cdc6e7b7f83bceb9b099c56ac2e0c594634febae.

Signed-off-by: Dan Trifan <jimsth@gmail.com>

Conflicts:
	drivers/video/msm/mdss/mdss.h

Change-Id: I2026e75a7a252a91c6c08810f1207120a21ecfee
Signed-off-by: choongryeol.lee <choongryeol.lee@lge.com>
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
video: slimport: wait until boot done before start detection

If slimport cable inserted during boot up, slimport could not
work properly since other system is not ready yet. So, wait
until boot completion before start cable detection. The boot
completion should be notified by userspace.

Change-Id: I9fbee9568068b03a3b0d6776cc051a7d87e41c94
Signed-off-by: choongryeol.lee <choongryeol.lee@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
Fix sizeof-pointer-memaccess warning with gcc 4.8

Get size of dereferenced object when using memcpy.

Signed-off-by: Dan Trifan <jimsth@gmail.com>
Fix sizeof-pointer-memaccess warning with gcc 4.8

Used strcmp instead of strncmp to match strings.

Signed-off-by: Dan Trifan <jimsth@gmail.com>
arm/dt: hammerhead: Change the search order of dtb

bootloader searches the dtb matched with board id from appended DTBs.
So changed the order to search latest dtb first.

order:
kernel -> rev11 -> rev11j -> rev10 -> ...

Change-Id: I5d9ff4f1aee6d17616fa67e532283d3d31f8e295
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: camera: modify the number of gpios

gpios such as SENSOR_GPIO_VANA, SENSOR_GPIO_VDIG,
SENSOR_GPIO_VIO, SENSOR_GPIO_VCM, SENSOR_GPIO_OIS_LDO_EN,
and SENSOR_GPIO_OIS_RESET in msm_camera_sensor.h, must be
considered in gpio_num value.

Bug: 11747300
Signed-off-by: insup.choi <insup.choi@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: camera_v2: Handle vfe camif irq before axi irq

For each irq status, axi bits (image/stats) could be set as well
as camif sof bit. In this case, axi bits should be handled first
to better reflect the order of events: buf done of frame N before
SOF of frame N+1.

Bug: 11614033
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
seq_file: always update file->f_pos in seq_lseek()

This issue was first pointed out by Jiaxing Wang several months ago, but no
further comments:
https://lkml.org/lkml/2013/6/29/41

As we know pread() does not change f_pos, so after pread(), file->f_pos
and m->read_pos become different. And seq_lseek() does not update file->f_pos
if offset equals to m->read_pos, so after pread() and seq_lseek()(lseek to
m->read_pos), then a subsequent read may read from a wrong position, the
following program produces the problem:

    char str1[32] = { 0 };
    char str2[32] = { 0 };
    int poffset = 10;
    int count = 20;

    /*open any seq file*/
    int fd = open("/proc/modules", O_RDONLY);

    pread(fd, str1, count, poffset);
    printf("pread:%s\n", str1);

    /*seek to where m->read_pos is*/
    lseek(fd, poffset+count, SEEK_SET);

    /*supposed to read from poffset+count, but this read from position 0*/
    read(fd, str2, count);
    printf("read:%s\n", str2);

out put:
pread:
 ck_netbios_ns 12665
read:
 nf_conntrack_netbios

/proc/modules:
nf_conntrack_netbios_ns 12665 0 - Live 0xffffffffa038b000
nf_conntrack_broadcast 12589 1 nf_conntrack_netbios_ns, Live 0xffffffffa0386000

So we always update file->f_pos to offset in seq_lseek() to fix this issue.

cherry-picked from https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/fs/seq_file.c?id=05e16745c0c471bba313961b605b6da3b21a853d

Signed-off-by: Jiaxing Wang <hello.wjx@gmail.com>
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Dan Trifan <jimsth@gmail.com>

Conflicts:
	fs/seq_file.c

Change-Id: If419b92498e2c3e08669a4342e9b9ebf99ad3768
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>