26 Jun, 2018

1 commit

  • commit ebeaa367548e9e92dd9374b9464ff6e7d157117b upstream.

    Current ISH driver only registers suspend/resume PM callbacks which don't
    support hibernation (suspend to disk). Basically after hiberation, the ISH
    can't resume properly and user may not see sensor events (for example: screen
    rotation may not work).

    User will not see a crash or panic or anything except the following message
    in log:

    hid-sensor-hub 001F:8086:22D8.0001: timeout waiting for response from ISHTP device

    So this patch adds support for S4/hiberbation to ISH by using the
    SIMPLE_DEV_PM_OPS() MACRO instead of struct dev_pm_ops directly. The suspend
    and resume functions will now be used for both suspend to RAM and hibernation.

    If power management is disabled, SIMPLE_DEV_PM_OPS will do nothing, the suspend
    and resume related functions won't be used, so mark them as __maybe_unused to
    clarify that this is the intended behavior, and remove #ifdefs for power
    management.

    Cc: stable@vger.kernel.org
    Signed-off-by: Even Xu
    Acked-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina
    Signed-off-by: Greg Kroah-Hartman

    Even Xu
     

21 Jun, 2018

1 commit

  • [ Upstream commit a4eb490a41a0da3b1275fc7427084cf9ae2c3c1c ]

    Never directly free @dev after calling device_register(), even
    if it returned an error. Always use put_device() to give up the
    reference initialized.

    Signed-off-by: Arvind Yadav
    Signed-off-by: Jiri Kosina
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Arvind Yadav
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

11 Jul, 2017

1 commit

  • Pull HID updates from Jiri Kosina:

    - open/close tracking improvements from Dmitry Torokhov

    - battery support improvements in Wacom driver from Jason Gerecke

    - Win8 support fixes from Benjamin Tissories and Hans de Geode

    - misc fixes to Intel-ISH driver from Arnd Bergmann

    - support for quite a few new devices and small assorted fixes here and
    there

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (35 commits)
    HID: intel-ish-hid: Enable Gemini Lake ish driver
    HID: intel-ish-hid: Enable Cannon Lake ish driver
    HID: wacom: fix mistake in printk
    HID: multitouch: optimize the sticky fingers timer
    HID: multitouch: fix rare Win 8 cases when the touch up event gets missing
    HID: multitouch: use BIT macro
    HID: Add driver for Retrode2 joypad adapter
    HID: multitouch: Add support for Google Rose Touchpad
    HID: multitouch: Support PTP Stick and Touchpad device
    HID: core: don't use negative operands when shift
    HID: apple: Use country code to detect ISO keyboards
    HID: remove no longer used hid->open field
    greybus: hid: remove custom locking from gb_hid_open/close
    HID: usbhid: remove custom locking from usbhid_open/close
    HID: i2c-hid: remove custom locking from i2c_hid_open/close
    HID: serialize hid_hw_open and hid_hw_close
    HID: usbhid: do not rely on hid->open when deciding to do IO
    HID: hiddev: use hid_hw_power instead of usbhid_get/put_power
    HID: hiddev: use hid_hw_open/close instead of usbhid_open/close
    HID: asus: Add support for Zen AiO MD-5110 keyboard
    ...

    Linus Torvalds
     

30 Jun, 2017

2 commits


09 Jun, 2017

1 commit


30 May, 2017

5 commits

  • To increase build coverage, drivers should generally be allowed to
    build on other architectures even if they are only used on one
    of them.

    Signed-off-by: Arnd Bergmann
    Acked-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Arnd Bergmann
     
  • When building for 32-bit architectures, we get a harmless warning:

    intel-ish-hid/ishtp-hid-client.c: In function 'process_recv':
    intel-ish-hid/ishtp-hid-client.c:139:7: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'unsigned int' [-Werror=format=]

    This changes the format string to print size_t variables using %zu
    instead.

    Signed-off-by: Arnd Bergmann
    Acked-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Arnd Bergmann
     
  • The internal accounting uses 'timespec' based time stamps, which is
    slightly inefficient and also problematic once we get to the time_t
    overflow in 2038.

    When communicating to the firmware, we even get an open-coded 64-bit
    division that prevents the code from being build-tested on 32-bit
    architectures and is inefficient due to the double conversion from
    64-bit nanoseconds to seconds+nanoseconds and then microseconds.

    This changes the code to use ktime_t instead.

    Signed-off-by: Arnd Bergmann
    Acked-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Arnd Bergmann
     
  • I was trying to understand this code while working on a warning
    fix and the locking made no sense: spin_lock_irqsave() is pointless
    when run inside of an interrupt handler or nested inside of another
    spin_lock_irq() or spin_lock_irqsave().

    Here it turned out that the comment above the function is wrong,
    as both recv_ishtp_cl_msg_dma() and recv_ishtp_cl_msg() can in fact
    be called from a work queue rather than an ISR, so we do have to
    use the irqsave() version once.

    This fixes the comments accordingly, removes the misleading 'dev_flags'
    variable and modifies the inner spinlock to not use 'irqsave'.

    No functional change is intended, this is just for readability and
    it slightly simplifies the object code.

    Signed-off-by: Arnd Bergmann
    Acked-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Arnd Bergmann
     
  • gcc points out an uninialized pointer dereference that could happen
    if we ever get to recv_ishtp_cl_msg_dma() or recv_ishtp_cl_msg()
    with an empty &dev->read_list:

    drivers/hid/intel-ish-hid/ishtp/client.c: In function 'recv_ishtp_cl_msg_dma':
    drivers/hid/intel-ish-hid/ishtp/client.c:1049:3: error: 'cl' may be used uninitialized in this function [-Werror=maybe-uninitialized]

    The warning only appeared in very few randconfig builds, as the
    spinlocks tend to prevent gcc from tracing the variables. I only
    saw it in configurations that had neither SMP nor LOCKDEP enabled.

    As we can see, we only enter the case if 'complete_rb' is non-NULL,
    and then 'cl' is known to point to complete_rb->cl. Adding another
    initialization to the same pointer is harmless here and makes it
    clear to the compiler that the behavior is well-defined.

    Signed-off-by: Arnd Bergmann
    Acked-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Arnd Bergmann
     

20 Feb, 2017

1 commit


14 Feb, 2017

1 commit

  • Declare device_type structure as const as it is only stored in the
    type field of a device structure. This field is of type const, so add
    const to the declaration of device_type structure.

    File size before: drivers/hid/intel-ish-hid/ishtp/bus.o
    text data bss dec hex filename
    4260 336 16 4612 1204 hid/intel-ish-hid/ishtp/bus.o

    File size after: drivers/hid/intel-ish-hid/ishtp/bus.o
    text data bss dec hex filename
    4324 272 16 4612 1204 hid/intel-ish-hid/ishtp/bus.o

    Signed-off-by: Bhumika Goyal
    Acked-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Bhumika Goyal
     

08 Feb, 2017

1 commit

  • For ISH resume, there are two paths, they need different way to handle: one
    where ISH is not powered off, in that case a simple resume message is enough,
    in other case we need a reset sequence.

    We can use ISH FW status to distinguish those two cases and handle them
    properly.

    Signed-off-by: Even Xu
    Acked-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Even Xu
     

02 Jan, 2017

2 commits

  • In ishtp_hid_probe(), use %04X instead of %04hX to format __u32 values,
    in order to silent a format error reported by clang:

    drivers/hid/intel-ish-hid/ishtp-hid.c:212:3: error: format specifies
    type 'unsigned short' but the argument has type '__u32' (aka
    'unsigned int') [-Werror,-Wformat]
    hid->vendor, hid->product);
    ^~~~~~~~~~~
    drivers/hid/intel-ish-hid/ishtp-hid.c:212:16: error: format
    specifies type 'unsigned short' but the argument has type '__u32'
    (aka 'unsigned int') [-Werror,-Wformat]
    hid->vendor, hid->product);
    ^~~~~~~~~~~~

    Signed-off-by: Nicolas Iooss
    Acked-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Nicolas Iooss
     
  • Structure ishtp_device contains a logging function, print_log(), which
    formats some of its parameters using vsnprintf(). Add a __printf
    attribute to this function field (and to ish_event_tracer()) in order to
    detect at compile time issues related to the printf-like formatting.

    While at it, make format parameter a const pointer as print_log() is not
    supposed to modify it.

    Signed-off-by: Nicolas Iooss
    Acked-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Nicolas Iooss
     

19 Dec, 2016

1 commit


14 Dec, 2016

1 commit


02 Dec, 2016

1 commit


29 Nov, 2016

1 commit

  • Although unlikely but it is possible that when a connect or disconnect
    request is issued to the firmware, before the response comes, user
    terminates the client session. In this case when the response is arrived
    there is no matching client instance in the list of currently active
    clients. In this case, don't issue call to wake up a waiting client.

    Signed-off-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Srinivas Pandruvada
     

16 Nov, 2016

3 commits


06 Nov, 2016

1 commit

  • ts_format.reserved is not used anywhere yet, but the compiler generates a
    warning when the struct's (uninitialized) field is being copied around

    drivers/hid/intel-ish-hid/ipc/ipc.c: In function ‘write_ipc_from_queue’:
    drivers/hid/intel-ish-hid/ipc/ipc.c:316: warning: ‘ts_format.reserved’ may be used uninitialized in this function

    Avoid this by force-initializing the field to zero.

    Acked-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Jiri Kosina
     

05 Nov, 2016

4 commits

  • On some platforms ISH interrupt is shared, which causes request_irq to
    fail. This requires IRQF_SHARED irq flag.

    But IRQF_NO_SUSPEND and IRQF_SHARED should not be used together, so
    removed IRQF_NO_SUSPEND flag. Anyway this driver doesn't require
    IRQF_NO_SUSPEND, as this interrupt is not required during "noirq" phases
    of suspending and resuming devices as well as during the time when
    nonboot CPUs are taken offline and brought back online.

    Signed-off-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Srinivas Pandruvada
     
  • When built as a module, modprobe followed by rmmod can fail because
    DMA was still active. So to fix this, DMA needs to be disabled during
    module exit.

    This change disables DMA during modules exit and change the ISH PCI
    device status to D3.

    Signed-off-by: Even Xu
    Acked-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Even Xu
     
  • Add a new function ish_disable_dma() and move DMA disable operations
    here, so that this functionality can be reused.

    Signed-off-by: Even Xu
    Acked-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Even Xu
     
  • Same operations are done in ish_hw_start() and _ish_hw_reset() to
    wakeup ISH device. Consolidate them by introducing a new function
    ish_wakeup() and move the code there.

    Signed-off-by: Even Xu
    Acked-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Even Xu
     

04 Nov, 2016

1 commit

  • Fix

    drivers/hid/intel-ish-hid/ipc/pci-ish.c:247:12: warning: ‘ish_suspend’ defined but not used [-Wunused-function]
    static int ish_suspend(struct device *device)
    ^
    drivers/hid/intel-ish-hid/ipc/pci-ish.c:282:12: warning: ‘ish_resume’ defined but not used [-Wunused-function]
    static int ish_resume(struct device *device)
    ^
    by sticking them in the CONFIG_PM range too.

    Signed-off-by: Borislav Petkov
    Cc: Srinivas Pandruvada
    Cc: Jiri Kosina
    Cc: Benjamin Tissoires
    Cc: Wei Yongjun
    Cc: linux-input@vger.kernel.org
    Acked-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Borislav Petkov
     

29 Aug, 2016

5 commits


17 Aug, 2016

3 commits

  • This driver is responsible for implementing ISH HID client, which
    gets HID description and report. Once it has completely gets
    report descriptors, it registers as a HID LL drivers. This implements
    necessary callbacks so that it can be used by HID sensor hub driver.

    Original-author: Daniel Drubin
    Reviewed-and-tested-by: Ooi, Joyce
    Tested-by: Grant Likely
    Tested-by: Rann Bar-On
    Tested-by: Atri Bhattacharya
    Signed-off-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Srinivas Pandruvada
     
  • This layer is responsible for
    - Enumerating over PCI bus
    - Inform FW about host readiness
    - Provide HW interface to transport layer for control and messages
    - Interrupt handling and routing

    Original-author: Daniel Drubin
    Reviewed-and-tested-by: Ooi, Joyce
    Tested-by: Grant Likely
    Tested-by: Rann Bar-On
    Tested-by: Atri Bhattacharya
    Signed-off-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Srinivas Pandruvada
     
  • The ISH transport layer (ishtp) is a bi-directional protocol implemented
    on the top of PCI based inter processor communication layer. This layer
    offers:
    - Connection management
    - Flow control with the firmware
    - Multiple client sessions
    - Client message transfer
    - Client message reception
    - DMA for RX and TX for fast data transfer

    Refer to Documentation/hid/intel-ish-hid.txt for
    overview of the functionality implemented in this layer.

    Original-author: Daniel Drubin
    Reviewed-and-tested-by: Ooi, Joyce
    Tested-by: Grant Likely
    Tested-by: Rann Bar-On
    Tested-by: Atri Bhattacharya
    Signed-off-by: Srinivas Pandruvada
    Signed-off-by: Jiri Kosina

    Srinivas Pandruvada