12 Feb, 2019

40 commits

  • Fix the Coverity warning "divide_by_zero".

    If "rext" is incorrectly set as zero in dts file, "divide_by_zero" will
    happen at line 960. So add a judgment condition here, and let "rext" uses
    default value when it is equal to zero.

    Signed-off-by: Clark Wang

    Clark Wang
     
  • CID 3869707: Resource leak (RESOURCE_LEAK)
    13. leaked_storage: Variable fhandler going out of scope leaks
    the storage it points to

    Signed-off-by: Haibo Chen

    Haibo Chen
     
  • CID 3869705: Unsigned compared against 0 (NO_EFFECT)
    unsigned_compare: This greater-than-or-equal-to-zero comparison of an
    unsigned value is always true. attr_count >= 0.

    Signed-off-by: Haibo Chen

    Haibo Chen
     
  • CID 3869704: Wrong sizeof argument (SIZEOF_MISMATCH)
    suspicious_sizeof: Passing argument f1a->button_control.txrx_map of
    type unsigned char * and argument 8 /* sizeof (f1a->button_control.txrx_map) */
    to function synaptics_rmi4_i2c_read is suspicious.

    Passing argument should be sizeof(unsigned char) rather than
    sizeof(unsigned char *).

    Signed-off-by: Haibo Chen

    Haibo Chen
     
  • Update SCFW API to the following commit:
    "
    ("430d1e3646fbe75e339e18abf2330565eac906e0")
    Author: Chuck Cannon
    Date: Fri Nov 2 15:25:45 2018 -0500

    SCF-105: RN updates.
    "

    Signed-off-by: Ranjani Vaidyanathan

    Ranjani Vaidyanathan
     
  • according to the function disable_irq() description, use disable_irq() in
    spin lock context may cause deadlock. So change to use disable_irq_nosync().

    Signed-off-by: Haibo Chen

    Haibo Chen
     
  • For the touch pressure_max, if dts has no property "ti,pressure-max"
    or this property is config to value 0, then default use 65535 as
    the max pressure value. otherwise, in the latest xwayland rootfs,
    will meet the following issue:

    [21:44:34.302] input device 'ADS7846 Touchscreen', /dev/input/event3 is tagged by udev as: Touchscreen
    [21:44:34.302] kernel bug: Device 'ADS7846 Touchscreen' has min == max on ABS_PRESSURE
    [21:44:34.302] input device 'ADS7846 Touchscreen', /dev/input/event3 was rejected.
    [21:44:34.302] failed to create input device '/dev/input/event3'

    Reviewed-by: Fugang Duan
    Signed-off-by: Haibo Chen

    Haibo Chen
     
  • On the imx8 MIPI DSI oled board, MIPI panel and touch share one RST
    pin. when suspend the whole system, touch will suspend first, it
    disable touch irq, and let touch work in sleep mode. Then MIPI panel
    suspend, it will give a reset signal on the RST pin. Due to this reset
    signal, touch will trigger two interrupt on GPIO1_9. Because touch
    suspend code already disable touch irq, so these two new touch interrupt
    will be pending there, and pending there in GPIO forever.

    When system resume, GPIO will restore registers in runtime resume before
    synaptics_dsx_i2c touch driver resume, so the GPIO1_9 IRQ will be unmasked
    and since its IRQ is pending there so IRQ keeps coming without touch
    driver to handle it, since it is NOT resume yet, make the system can't
    resueme back normally.

    Due to this is the hardware limitation which cause this issue, I format this
    patch to workaround this issue.
    This patch free touch irq in the touch driver suspend procedure, rather than
    just disable the touch irq.

    Reviewed-by: Fugang Duan
    Signed-off-by: Haibo Chen

    Haibo Chen
     
  • Add x/y coordinate diagonal rotation support, user can use this feature
    by add "synaptics,diagonal-rotation" in dts.

    Signed-off-by: Haibo Chen
    Reviewed-by: Fugang Duan
    (cherry picked from commit 10c98865e5d1f0b7938523c793165e72add39f10)

    Haibo Chen
     
  • On imx8mscale-evk baord, if I2C bus is configed pull-up, then once send
    the i2c command to clear touch interrupt during the touch initialization,
    touch will keep SDA line in low level, block the i2c bus. If config the
    I2C bus pull-down, then this issue gone. Due to it is not reasonable to
    set the I2c bus to pull-down for other i2c slave device, this patch work
    as a workaround, just remove this i2c command, do not clear the touch
    interrupt, test that touch can also work well after the initialization.

    Signed-off-by: Haibo Chen

    Haibo Chen
     
  • Upstream dropped the call to i2c_set_client_data as "unneeded" in commit
    8300445cc7c1 ("Input: touchscreen - drop calls to platform_set_drvdata and i2c_set_clientdata")

    The client_data pointer is used on suspend/resume by downstream commit
    76a621ae711b ("MLK-17779 input: egalax_ts: free irq resource before request the line as GPIO")

    This causes suspend/resume to crash (and apparently hang) on
    imx6qdl-sabresd with LVDS display connected. Fix by adding back the
    i2c_set_clientdata call.

    Fixes: 76a621ae711b ("MLK-17779 input: egalax_ts: free irq resource before request the line as GPIO")

    This could be squashed into MLK-17779

    Signed-off-by: Leonard Crestez
    Acked-by: Fugang Duan

    Leonard Crestez
     
  • If GPIO is connected to an IRQ then it should not request it as
    GPIO function only when free its IRQ resouce.

    Tested-by: Haibo Chen
    Signed-off-by: Fugang Duan
    Signed-off-by: Anson Huang
    Signed-off-by: Robin Gong <yibin.gong@nxp.com

    Fugang Duan
     
  • NXP i.MX7ULP EVK boards all sensors connect with M4 core, A core
    has to conmunicate with sensors by virtual io bus like rpmsg bus.
    The driver implement the virtual sensor input driver to configure
    sensors active/idle/delay actions and report the sensors' event to
    user space.

    Supply below sysfs for user to enable/disable detector and counter,
    set poll delay:
    /sys/class/misc/step_counter/enable
    /sys/class/misc/step_detector/enable
    /sys/class/misc/step_counter/poll_delay

    Reviewed-by: Elven Wang
    Signed-off-by: Fugang Duan

    Fugang Duan
     
  • Add S3508 touch driver support.

    Signed-off-by: Haibo Chen

    Haibo Chen
     
  • The sensors share an interrupt pin on imx8qm/imx8qxp mek.
    As a result, the interrupt signals will be interfered by
    each other in default push-pull status.

    This patch sets sensor interrupt pins as open-drain when
    necessary.

    Signed-off-by: Gao Pan
    (cherry-picked from 48bcb7aafa2a3ced923d1a1753bb19d89a9fc273)

    Gao Pan
     
  • This powerkey driver is a virtual driver based on scfw which control
    SNVS ON/OFF in SCU side. The key interrupt triggered by MU notfication

    BuildInfo:
    - SCFW e7d95e1e, IMX-MKIMAGE 05d3d4a7, ATF 93dd1cc
    - U-Boot 2017.03-00684-g28c5243

    Signed-off-by: Robin Gong
    Reviewed-by: Peng Fan
    Reviewed-by: Anson Huang

    Robin Gong
     
  • Add device node more property to support multiple panel.

    Signed-off-by: Fugang Duan
    (cherry picked from commit: 8e85cfa29fa33b9a6c1335e9f1355290d0f0fab7)

    Fugang Duan
     
  • A pending interrupt may cause a kernel panic at system
    startup. It is because the necessary data have not been
    initialized completely before the interrupt handler is
    called.

    [ 1.141547] Unable to handle kernel NULL pointer dereference at virtual address 00000048
    [ 1.149642] pgd = ffff000009275000
    [ 1.153048] [00000048] *pgd=00000000ffffe003[ 1.157148] , *pud=00000000ffffd003
    , *pmd=0000000000000000[ 1.162660]
    [ 1.164164] Internal error: Oops: 96000004 [#1] PREEMPT SMP
    [ 1.169740] Modules linked in:
    [ 1.172818] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.11-03067-g40eb128-dirty #112
    [ 1.180738] Hardware name: Freescale i.MX8MQ EVK (DT)
    [ 1.185794] task: ffff8000ba0e0000 task.stack: ffff8000ba0e8000
    [ 1.191725] PC is at imx_snvs_pwrkey_interrupt+0x14/0x70
    [ 1.197046] LR is at __handle_irq_event_percpu+0x9c/0x128
    [ 1.202450] pc : [] lr : [] pstate: 000001c5
    [ 1.209848] sp : ffff8000bff79ed0
    [ 1.213166] x29: ffff8000bff79ed0 x28: ffff8000ba0e8000
    [ 1.218514] x27: 0000000000000001 x26: ffff000008e582b8
    [ 1.223862] x25: ffff000009113eaf x24: ffff8000ba480200
    [ 1.229210] x23: 0000000000000021 x22: ffff8000bff79f8c
    [ 1.234557] x21: 0000000000000000 x20: ffff8000ba480200
    [ 1.239906] x19: 0000000000000000 x18: 0000000000000000
    [ 1.245253] x17: 0000000000000000 x16: 0000000000000000
    [ 1.250600] x15: 0000000000000000 x14: 0000000000000000
    [ 1.255947] x13: 0000000000000000 x12: 0000000000000000
    [ 1.261293] x11: 0000000000000040 x10: ffff8000b8000028
    [ 1.266642] x9 : ffff8000b8000130 x8 : 0000000000000000
    [ 1.271989] x7 : ffff8000ba480200 x6 : ffff8000ba480200
    [ 1.277336] x5 : ffff8000b8000000 x4 : 00008000b6eca000
    [ 1.282684] x3 : 0000000000000000 x2 : ffff000008849510
    [ 1.288030] x1 : 0000000000000000 x0 : 0000000000000021
    [ 1.293378]
    [ 1.294875] Process swapper/0 (pid: 1, stack limit = 0xffff8000ba0e8020)
    [ 1.301581] Stack: (0xffff8000bff79ed0 to 0xffff8000ba0ec000)
    [ 1.307330] Call trace:
    [ 1.309782] Exception stack(0xffff8000bff79d00 to 0xffff8000bff79e30)
    [ 1.316229] 9d00: 0000000000000000 0001000000000000 ffff8000bff79ed0 ffff000008849524
    [ 1.324065] 9d20: ffff8000bff79d40 ffff0000080e0830 ffff8000bffaa980 0000000000000000
    [ 1.331901] 9d40: ffff8000bff79d60 ffff0000080e0898 ffff8000bff79d70 ffff0000080f83d8
    [ 1.339736] 9d60: 0000000000554179 ffff0000080e097c ffff8000bff79da0 ffff0000080e7ff0
    [ 1.347572] 9d80: ffff8000ba0e0000 0000000000554179 ffff8000bff79dc0 ffff0000080eb20c
    [ 1.355408] 9da0: 0000000000000021 0000000000000000 ffff000008849510 0000000000000000
    [ 1.363243] 9dc0: 00008000b6eca000 ffff8000b8000000 ffff8000ba480200 ffff8000ba480200
    [ 1.371079] 9de0: 0000000000000000 ffff8000b8000130 ffff8000b8000028 0000000000000040
    [ 1.378914] 9e00: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    [ 1.386748] 9e20: 0000000000000000 0000000000000000
    [ 1.391633] [] imx_snvs_pwrkey_interrupt+0x14/0x70
    [ 1.397994] [] __handle_irq_event_percpu+0x9c/0x128
    [ 1.404440] [] handle_irq_event_percpu+0x1c/0x58
    [ 1.410626] [] handle_irq_event+0x48/0x78
    [ 1.416206] [] handle_fasteoi_irq+0xb8/0x1b0
    [ 1.422045] [] generic_handle_irq+0x24/0x38
    [ 1.427797] [] __handle_domain_irq+0x5c/0xb8
    [ 1.433637] [] gic_handle_irq+0xbc/0x168
    [ 1.439127] Exception stack(0xffff8000ba0eb9e0 to 0xffff8000ba0ebb10)
    [ 1.445574] b9e0: ffff8000ba48029c 0000000000000040 0000000000000005 0000000000000000
    [ 1.453409] ba00: 0000000000000004 000000000000000f ffff8000ba480220 0000000000000000
    [ 1.461244] ba20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    [ 1.469080] ba40: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    [ 1.476915] ba60: 0000000000000000 0000000000000000 0000000000000000 ffff8000ba837f00
    [ 1.484751] ba80: ffff8000ba480200 0000000000000021 ffff8000ba48029c ffff8000ba480268
    [ 1.492586] baa0: 0000000000000000 0000000000000040 ffff8000ba480220 ffff8000ba480220
    [ 1.500422] bac0: 0000000000000000 ffff8000ba0ebb10 ffff000008103cb8 ffff8000ba0ebb10
    [ 1.508258] bae0: ffff000008b2b868 0000000040000045 ffff8000ba837f00 ffff8000ba480200
    [ 1.516092] bb00: ffffffffffffffff ffff000008103e18
    [ 1.520975] [] el1_irq+0xb0/0x124
    [ 1.525863] [] _raw_spin_unlock_irqrestore+0x10/0x48
    [ 1.532397] [] request_threaded_irq+0xec/0x1c0
    [ 1.538410] [] devm_request_threaded_irq+0x74/0xe0
    [ 1.544770] [] imx_snvs_pwrkey_probe+0x178/0x2a8
    [ 1.550958] [] platform_drv_probe+0x58/0xc0
    [ 1.556713] [] driver_probe_device+0x1fc/0x2a8
    [ 1.562727] [] __driver_attach+0xac/0xb0
    [ 1.568220] [] bus_for_each_dev+0x64/0xa0
    [ 1.573800] [] driver_attach+0x20/0x28
    [ 1.579119] [] bus_add_driver+0x110/0x230
    [ 1.584698] [] driver_register+0x60/0xf8
    [ 1.590190] [] __platform_driver_register+0x40/0x48
    [ 1.596640] [] imx_snvs_pwrkey_driver_init+0x18/0x20
    [ 1.603174] [] do_one_initcall+0x38/0x128
    [ 1.608754] [] kernel_init_freeable+0x1a4/0x248
    [ 1.614853] [] kernel_init+0x10/0x100
    [ 1.620084] [] ret_from_fork+0x10/0x50
    [ 1.625403] Code: 910003fd f9000bf3 f9405833 52800001 (f9402660)
    [ 1.631518] ---[ end trace 7bb9749c5dc6e8f9 ]---
    [ 1.636148] Kernel panic - not syncing: Fatal exception in interrupt

    Review-by: Frank Li
    Signed-off-by: Shenwei Wang

    Shenwei Wang
     
  • For HannStar (HSD100PXN1 Rev: 1-A00C11 F/W:0634) LVDS touch screen,
    it has a special request for the EETI touch controller. The host
    needs to trigger I2C event to device FW at booting first, and then
    the FW can switch to I2C interface. Otherwise, the FW can’t work
    with I2C interface, and can't generate any interrupt when touch
    the screen.

    This patch send an I2C command before the device wake up, make sure
    the device switch to I2C interface first.

    Signed-off-by: Haibo Chen
    Reviewed-by: Andy Duan

    Haibo Chen
     
  • When CONFIG_SENSOR_FXLS8471=m build was failing due to missing
    exported symbol. This patch export the missing symbol.

    Signed-off-by: Julien Olivain

    Julien Olivain
     
  • i.MX8MQ use SNVS ONOFF button, add support for it.

    Signed-off-by: Anson Huang

    Anson Huang
     
  • Add rpmsg-keys driver on i.mx7ulp-evk board since vol+/vol- keys
    are connected on m4 side and have to get the status of keys by
    rpmsg.

    Signed-off-by: Robin Gong
    [Irina: updated for 4.9 APIs]
    Signed-off-by: Irina Tirdea

    Robin Gong
     
  • disable debug information for focaltech touch.

    Signed-off-by: Gao Pan
    (cherry picked from commit b88a0ed7837ab964253f710da03fdab481592350)

    Gao Pan
     
  • The touchscreen driver, max11801, which is on 12c2 bus, won't be probed
    when using the hdcp specific DTS (this is disabling 12c2, since it
    will acquire it for DDC communications). Since this driver won't be
    probed, it will spam the dmesg with the pr_err from max11801_read_adc()
    function. This function is periodically called by the battery driver. For
    this reason, I removed the pr_err() call.
    Also, to be noticed that the function signature is u32, but in case of an
    error it will return a negative integer. In order to correctly propagate
    errors, I changed the function signature to int. This is safe, since the
    read value from i2c is on 16 bits (MSB and LSB on 8 bits).

    Also, the function calibration_voltage is calling max11801_read_adc from
    touchscreen driverm which can return negative values in case of an
    error. I case of an error, just stop reading ADC data and return 0 as
    voltage_data.

    Signed-off-by: Robert Chiras

    Robert Chiras
     
  • add focaltech touch screen support

    Signed-off-by: Gao Pan
    (cherry-pick from 595cefbee5586e77ceb9ad900c256177a98367c7)

    Gao Pan
     
  • Change the suspend/resume callback to suspend_noirq/resume_noirq
    callback to make sure keypad interrupts are enabled during suspend,
    as when there is keypad interrupt coming after suspend callback
    is called, the interrupt handler will still be called and it will
    disable keypad interrupts, it will cause keypad can NOT generate
    interrupts to wake up system from suspend.

    Signed-off-by: Anson Huang

    Anson Huang
     
  • Since commit commit 560a64749d1dd0ff ("ENGR00318936-2 input: keyboard: imx:
    remove usless release interrupt enabled) the following problem happens:

    - Keep any keypad key pressed
    - Enter low power mode via "echo mem > /sys/power/state"
    - Then we are no longer able to wake-up the system via the keypad

    The reason for this behaviour is that the KRIE (Release Interrupt) is not
    enabled.

    In order to fix this problem, we should enable KRIE when a key is pressed
    (KPKD bit is set) or enable KDIE when no key is pressed (KPKR is set).

    This way we will always have a valid source of keypad interrupt no matter if
    the system entered low power mode while a keypad key was pressed or not.

    Signed-off-by: Fabio Estevam
    (cherry picked from commit 5a7ab47e67d1045cb2f5d408c112617dff48dee2)
    (cherry picked from commit f75c35512bd3df7dbb26f4a35cf17dcbb6ffb724)

    Fabio Estevam
     
  • Remove useless code for release interrupt enabled, because we check status by
    timer rather than release interrupt. Remove the code which may disable depress
    interrupt. Also make sure enable depress interrupt in suspend function.

    Signed-off-by: Robin Gong
    (cherry picked from commit 806ed5b9769efff2c9d8c66ed19315b48ec6fd57)
    (cherry picked from commit 307d613b1f363f802433cd2debbb2b28ddc17a06)

    Robin Gong
     
  • There is a small window after system suspend but timer scan function
    didn't finish timely, in this case, system enter suspend without kpp
    interrupt enabled and failed to resume back if key depressed.We add
    pm_stay_awake and pm_relax to make sure system suspend flow abort in
    this case.

    Signed-off-by: Robin Gong
    (cherry picked from commit 3868f06af8f39673f270643ada63dd88e2f5699e)
    (cherry picked from commit 529dee44f7da0ad6d57a3e8ccd942af944f6723b)

    Robin Gong
     
  • Add the support for a CT36X based touchscreens using
    the CT36X controller and i2c touchscreen interface.

    Signed-off-by: Alejandro Lozano
    Signed-off-by: Juan Gutierrez
    Signed-off-by: Alejandro Sierra

    Alejandro Lozano
     
  • Enable ONKEY wakeup interrupt before suspend, and remove usless marocs.

    Signed-off-by: Robin Gong

    Robin Gong
     
  • Add pf1550_onkey driver, so that POWERON key can link to pf1550 instead of
    i.mx6ul.

    Signed-off-by: Robin Gong

    Robin Gong
     
  • Add return value check after calling .dmi_check_system().
    Reported by Coverity: CID18431

    Signed-off-by: Fugang Duan

    Fugang Duan
     
  • Add return value check after calling .of_property_read_u32().
    The issue was reported by coverity.

    Signed-off-by: Fugang Duan

    Fugang Duan
     
  • Add elan touch screen driver in linux kernel.

    Signed-off-by: Haibo Chen
    (cherry picked from commit 20180719c54760359d78544d55e4ac1fabaf6e8b)

    Haibo Chen
     
  • The driver kfree the global memory that is not correct. The patch
    remove them.

    Signed-off-by: Fugang Duan

    Fugang Duan
     
  • We need add DCM mode/AUX mode for ADC converter function of max11801, so that
    it can be used to read voltage of battery. Meanwhile, let the driver based on
    device tree. The patchset is based on below patch (V3.5.7):

    commit 4001774cf51f0140ae7e4e8e0ec1d86475790682
    Author: Rong Dian
    Date: Fri Jan 18 14:24:28 2013 +0800

    Engr00240284-1 MAX11801: Add DCM aux adc sample function

    1.Add direct conversion mode operations
    2.Add aux adc sample function

    Signed-off-by: Robin Gong

    Robin Gong
     
  • Add pinctrl restore to support LPSR.

    Signed-off-by: Robin Gong
    (cherry picked from commit f7d40aa30ca2fe337ba9bb8f7eaca4393db900be)

    Robin Gong
     
  • i.MX6UL has SNVS power key, add support for it.

    Signed-off-by: Anson Huang
    (cherry picked from commit 095c876a12e27220cb91cb9dc376a20b6bf259e4)

    Anson Huang
     
  • Add isl29023 driver support for i.MX6Q/DL/SX platform. The code derives from 3.10.y branch.

    Signed-off-by: Luwei Zhou
    Signed-off-by: Fugang Duan
    (cherry picked from commit: b0134420bba0022151499f1bb15e0d5daba970fa)

    Luwei Zhou