01 Jul, 2020

1 commit

  • commit 302c570bf36e997d55ad0d60628a2feec76954a4 upstream.

    John reported screaming irq caused by rt1711h when system boot[1],
    this is because irq request is done before tcpci_register_port(),
    so the chip->tcpci has not been setup, irq handler is entered but
    can't do anything, this patch is to address this by moving the irq
    request after tcpci_register_port().

    [1] https://lore.kernel.org/linux-usb/20200530040157.31038-1-john.stultz@linaro.org

    Fixes: ce08eaeb6388 ("staging: typec: rt1711h typec chip driver")
    Cc: stable # v4.18+
    Cc: John Stultz
    Reported-and-tested-by: John Stultz
    Reviewed-by: Guenter Roeck
    Reviewed-by: Heikki Krogerus
    Signed-off-by: Li Jun
    Link: https://lore.kernel.org/r/20200604112118.38062-1-jun.li@nxp.com
    Signed-off-by: Greg Kroah-Hartman

    Li Jun
     

29 Apr, 2020

2 commits

  • commit 0df9433fcae02215c8fd79690c134d535c7bb905 upstream.

    Before this commit, typec_altmode_get_partner would return a
    const struct typec_altmode * pointing to address 0x08 when
    to_altmode(adev)->partner was NULL.

    Add a check for to_altmode(adev)->partner being NULL to fix this.

    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206365
    BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1785972
    Fixes: 5f54a85db5df ("usb: typec: Make sure an alt mode exist before getting its partner")
    Cc: stable@vger.kernel.org
    Signed-off-by: Naoki Kiryu
    Signed-off-by: Hans de Goede
    Link: https://lore.kernel.org/r/20200422144345.43262-1-hdegoede@redhat.com
    Signed-off-by: Greg Kroah-Hartman

    Naoki Kiryu
     
  • commit 901789745a053286e0ced37960d44fa60267b940 upstream.

    After PORT_RESET, the port is set to the appropriate
    default_state. Ignore processing CC changes here as this
    could cause the port to be switched into sink states
    by default.

    echo source > /sys/class/typec/port0/port_type

    Before:
    [ 154.528547] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms
    [ 154.528560] CC1: 0 -> 0, CC2: 3 -> 0 [state PORT_RESET, polarity 0, disconnected]
    [ 154.528564] state change PORT_RESET -> SNK_UNATTACHED

    After:
    [ 151.068814] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms [rev3 NONE_AMS]
    [ 151.072440] CC1: 3 -> 0, CC2: 0 -> 0 [state PORT_RESET, polarity 0, disconnected]
    [ 151.172117] state change PORT_RESET -> PORT_RESET_WAIT_OFF [delayed 100 ms]
    [ 151.172136] pending state change PORT_RESET_WAIT_OFF -> SRC_UNATTACHED @ 870 ms [rev3 NONE_AMS]
    [ 152.060106] state change PORT_RESET_WAIT_OFF -> SRC_UNATTACHED [delayed 870 ms]
    [ 152.060118] Start toggling

    Signed-off-by: Badhri Jagan Sridharan
    Cc: stable
    Reviewed-by: Heikki Krogerus
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20200402215947.176577-1-badhri@google.com
    Signed-off-by: Greg Kroah-Hartman

    Badhri Jagan Sridharan
     

25 Mar, 2020

2 commits

  • commit 081da1325d351ea8804cf74e65263ea120834f33 upstream.

    Locking the connector in ucsi_register_displayport() to make
    sure that nothing can access the displayport alternate mode
    before the function has finished and the alternate mode is
    actually ready.

    Fixes: af8622f6a585 ("usb: typec: ucsi: Support for DisplayPort alt mode")
    Cc: stable@vger.kernel.org
    Signed-off-by: Heikki Krogerus
    Link: https://lore.kernel.org/r/20200311130006.41288-3-heikki.krogerus@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Heikki Krogerus
     
  • commit d16e7b62c5adcd13832c6b0ba364c3468d21b856 upstream.

    If the registration of the DisplayPort was not successful,
    or if the port does not support DisplayPort alt mode in the
    first place, the function ucsi_displayport_remove_partner()
    will fail with NULL pointer dereference when it attempts to
    access the driver data.

    Adding a check to the function to make sure there really is
    driver data for the device before modifying it.

    Fixes: af8622f6a585 ("usb: typec: ucsi: Support for DisplayPort alt mode")
    Reported-by: Andrea Gagliardi La Gala
    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206365
    Cc: stable@vger.kernel.org
    Signed-off-by: Heikki Krogerus
    Link: https://lore.kernel.org/r/20200311130006.41288-2-heikki.krogerus@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Heikki Krogerus
     

11 Feb, 2020

1 commit

  • commit 3ba76256fc4e2a0d7fb26cc95459041ea0e88972 upstream.

    This is to prevent any possible events generated while unregister
    tpcm port.

    Fixes: 74e656d6b055 ("staging: typec: Type-C Port Controller Interface driver (tcpci)")
    Signed-off-by: Li Jun
    Reviewed-by: Heikki Krogerus
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/1579502333-4145-1-git-send-email-jun.li@nxp.com
    Signed-off-by: Greg Kroah-Hartman

    Jun Li
     

01 Feb, 2020

2 commits

  • commit eb7a3bb8c955b3694e0e0998413ce1563c02f90c upstream.

    commit 8f6244055bd3 ("usb: typec: fusb302: Always provide fwnode for the
    port") didn't convert this value from mW to uW when migrating to a new
    specification format like it should have.

    Fixes: 8f6244055bd3 ("usb: typec: fusb302: Always provide fwnode for the port")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thomas Hebb
    Reviewed-by: Heikki Krogerus
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/0da564559af75ec829c6c7e3aa4024f857c91bee.1579529334.git.tommyhebb@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Thomas Hebb
     
  • commit 0e64350bf4668d0fbbfec66fd8e637b971b4e976 upstream.

    commit 4c912bff46cc ("usb: typec: wcove: Provide fwnode for the port")
    didn't convert this value from mW to uW when migrating to a new
    specification format like it should have.

    Fixes: 4c912bff46cc ("usb: typec: wcove: Provide fwnode for the port")
    Cc: stable@vger.kernel.org
    Signed-off-by: Thomas Hebb
    Reviewed-by: Heikki Krogerus
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/d8be32512efd31995ad7d65b27df9d443131b07c.1579529334.git.tommyhebb@gmail.com
    Signed-off-by: Greg Kroah-Hartman

    Thomas Hebb
     

15 Jan, 2020

1 commit

  • commit c215e48e97d232249a33849fc46fc50311043e11 upstream.

    Augmented Power Delivery Objects (A)PDO_s are used by USB-C
    PD power adapters to advertize the voltages and currents
    they support. There can be up to 7 PDO_s but before PPS
    (programmable power supply) there were seldom more than 4
    or 5. Recently Samsung released an optional PPS 45 Watt power
    adapter (EP-TA485) that has 7 PDO_s. It is for the Galaxy 10+
    tablet and charges it quicker than the adapter supplied at
    purchase. The EP-TA485 causes an overzealous WARN_ON to soil
    the log plus it miscalculates the number of bytes to read.

    So this bug has been there for some time but goes
    undetected for the majority of USB-C PD power adapters on
    the market today that have 6 or less PDO_s. That may soon
    change as more USB-C PD adapters with PPS come to market.

    Tested on a EP-TA485 and an older Lenovo PN: SA10M13950
    USB-C 65 Watt adapter (without PPS and has 4 PDO_s) plus
    several other PD power adapters.

    Signed-off-by: Douglas Gilbert
    Reviewed-by: Guenter Roeck
    Cc: stable
    Link: https://lore.kernel.org/r/20191230033544.1809-1-dgilbert@interlog.com
    Signed-off-by: Greg Kroah-Hartman

    Douglas Gilbert
     

12 Jan, 2020

1 commit

  • [ Upstream commit 547fc228755d79af648898187e7831a825d4f42c ]

    Fixes the following compile error:

    drivers/usb/typec/tcpm/fusb302.o: In function `tcpm_get_current_limit':
    fusb302.c:(.text+0x3ee): undefined reference to `extcon_get_state'
    fusb302.c:(.text+0x422): undefined reference to `extcon_get_state'
    fusb302.c:(.text+0x450): undefined reference to `extcon_get_state'
    fusb302.c:(.text+0x48c): undefined reference to `extcon_get_state'
    drivers/usb/typec/tcpm/fusb302.o: In function `fusb302_probe':
    fusb302.c:(.text+0x980): undefined reference to `extcon_get_extcon_dev'
    make: *** [vmlinux] Error 1

    It is because EXTCON is build as a module, but FUSB302 is not.

    Suggested-by: Heikki Krogerus
    Signed-off-by: zhong jiang
    Acked-by: Heikki Krogerus
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/1576239378-50795-1-git-send-email-zhongjiang@huawei.com
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    zhong jiang
     

18 Dec, 2019

1 commit

  • commit 5c388abefda0d92355714010c0199055c57ab6c7 upstream.

    We can't use "port->sw" and/or "port->mux" after it has been freed.

    Fixes: 23481121c81d ("usb: typec: class: Don't use port parent for getting mux handles")
    Signed-off-by: Wen Yang
    Cc: stable
    Cc: linux-usb@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Acked-by: Heikki Krogerus 
    Link: https://lore.kernel.org/r/20191126140452.14048-1-wenyang@linux.alibaba.com
    Signed-off-by: Greg Kroah-Hartman

    Wen Yang
     

04 Oct, 2019

3 commits

  • Making sure that ucsi_displayport_enter() function does not
    return an error if the displayport alternate mode has
    already been entered. It's normal that the firmware (or
    controller) has already entered the alternate mode by the
    time the operating system is notified about the device.

    Fixes: af8622f6a585 ("usb: typec: ucsi: Support for DisplayPort alt mode")
    Cc: stable@vger.kernel.org
    Signed-off-by: Heikki Krogerus
    Link: https://lore.kernel.org/r/20191004100219.71152-3-heikki.krogerus@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Heikki Krogerus
     
  • The "run_isr" flag is used for preventing the driver from
    calling the interrupt service routine in its runtime resume
    callback when the driver is expecting completion to a
    command, but what that basically does is that it hides the
    real problem. The real problem is that the controller is
    allowed to suspend in the middle of command execution.

    As a more appropriate fix for the problem, using autosuspend
    delay time that matches UCSI_TIMEOUT_MS (5s). That prevents
    the controller from suspending while still in the middle of
    executing a command.

    This fixes a potential deadlock. Both ccg_read() and
    ccg_write() are called with the mutex already taken at least
    from ccg_send_command(). In ccg_read() and ccg_write, the
    mutex is only acquired so that run_isr flag can be set.

    Fixes: f0e4cd948b91 ("usb: typec: ucsi: ccg: add runtime pm workaround")
    Cc: stable@vger.kernel.org
    Signed-off-by: Heikki Krogerus
    Link: https://lore.kernel.org/r/20191004100219.71152-2-heikki.krogerus@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Heikki Krogerus
     
  • The "port->typec_caps.data" and "port->typec_caps.type" variables are
    enums and in this context GCC will treat them as an unsigned int so they
    can never be less than zero.

    Fixes: ae8a2ca8a221 ("usb: typec: Group all TCPCI/TCPM code together")
    Signed-off-by: Dan Carpenter
    Cc: stable
    Reviewed-by: Guenter Roeck
    Reviewed-by: Heikki Krogerus
    Link: https://lore.kernel.org/r/20191001120117.GA23528@mwanda
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     

03 Sep, 2019

3 commits


29 Aug, 2019

1 commit

  • There appears to be a typo in the comparison of pdo_max_voltage[i]
    with the previous value, currently it is checking against the
    array pdo_min_voltage rather than pdo_max_voltage. I believe this
    is a typo. Fix this.

    Addresses-Coverity: ("Copy-paste error")
    Fixes: 5007e1b5db73 ("typec: tcpm: Validate source and sink caps")
    Cc: stable
    Signed-off-by: Colin Ian King
    Reviewed-by: Guenter Roeck
    Reviewed-by: Heikki Krogerus
    Link: https://lore.kernel.org/r/20190822135212.10195-1-colin.king@canonical.com
    Signed-off-by: Greg Kroah-Hartman

    Colin Ian King
     

18 Aug, 2019

3 commits

  • tcpm_register_port() will call some of the fusb302 code's callbacks
    wich in turn will call fusb302_log(). So we need to call
    fusb302_debugfs_init() before we call tcpm_register_port().

    This fixes the following warning, which was caused by the logbuffer_lock
    not yet being initialized (which is done by fusb302_debugfs_init):

    DEBUG_LOCKS_WARN_ON(lock->magic != lock)
    WARNING: CPU: 0 PID: 1306 at kernel/locking/mutex.c:912 __mutex_lock+0x978/0x9a0
    Modules linked in: fusb302(+) tcpm pi3usb30532 typec bq24190_charger snd_soc_sst_cht_bsw_rt5645 mei_hdcp dwc3 intel_rapl_msr udc_core ulpi gpio_keys intel_powerclamp coretemp kvm_intel brcmfmac kvm brcmutil joydev cfg80211 wdat_wdt irqbypass pcspkr intel_cstate extcon_intel_cht_wc i2c_cht_wc(E) snd_intel_sst_acpi snd_intel_sst_core snd_soc_rt5645 snd_soc_sst_atom_hifi2_platform snd_soc_acpi_intel_match snd_soc_rl6231 snd_soc_acpi intel_xhci_usb_role_switch roles hci_uart snd_soc_core btqca mei_txe btrtl processor_thermal_device mei snd_hdmi_lpe_audio lpc_ich snd_compress btbcm intel_rapl_common ac97_bus dwc3_pci snd_pcm_dmaengine intel_soc_dts_iosf btintel snd_seq bluetooth snd_seq_device snd_pcm intel_cht_int33fe_musb snd_timer intel_cht_int33fe_typec intel_hid intel_cht_int33fe_common sparse_keymap snd ecdh_generic goodix rfkill soundcore ecc spi_pxa2xx_platform max17042_battery dw_dmac int3406_thermal dptf_power acpi_pad soc_button_array int3400_thermal int3403_thermal
    gpd_pocket_fan intel_int0002_vgpio int340x_thermal_zone acpi_thermal_rel dm_crypt mmc_block i915 crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel i2c_algo_bit drm_kms_helper drm video sdhci_acpi sdhci mmc_core pwm_lpss_platform pwm_lpss i2c_dev
    CPU: 0 PID: 1306 Comm: systemd-udevd Tainted: G E 5.3.0-rc4+ #83
    Hardware name: Default string Default string/Default string, BIOS 5.11 06/28/2017
    RIP: 0010:__mutex_lock+0x978/0x9a0
    Code: c0 0f 84 26 f7 ff ff 44 8b 05 24 25 c8 00 45 85 c0 0f 85 16 f7 ff ff 48 c7 c6 da 55 2f ae 48 c7 c7 98 8c 2d ae e8 a0 f9 5c ff 0b e9 fc f6 ff ff 4c 89 f0 4d 89 fe 49 89 c7 e9 cf fa ff ff e8
    RSP: 0018:ffffb7a8c0523800 EFLAGS: 00010286
    RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
    RDX: 0000000000000002 RSI: 0000000000000001 RDI: 0000000000000246
    RBP: ffffb7a8c05238c0 R08: 0000000000000000 R09: 0000000000000000
    R10: ffffb7a8c0523648 R11: 0000000000000030 R12: 0000000000000000
    R13: ffffb7a8c0523990 R14: ffff9bf22f70c028 R15: ffff9bf22f70c360
    FS: 00007f39ca234940(0000) GS:ffff9bf237400000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007f1f108481a0 CR3: 0000000271f28000 CR4: 00000000001006f0
    Call Trace:
    ? find_held_lock+0x39/0x90
    ? _fusb302_log+0x81/0x1d0 [fusb302]
    ? vsnprintf+0x3aa/0x4f0
    ? _fusb302_log+0x81/0x1d0 [fusb302]
    _fusb302_log+0x81/0x1d0 [fusb302]
    ...

    Reviewed-by: Guenter Roeck
    Reviewed-by: Heikki Krogerus
    Signed-off-by: Hans de Goede
    Link: https://lore.kernel.org/r/20190817184340.64086-3-hdegoede@redhat.com
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     
  • Use usb_debug_root as root for our debugfs entry instead of creating our
    own subdirectory under the debugfs root.

    Reviewed-by: Guenter Roeck
    Reviewed-by: Heikki Krogerus
    Signed-off-by: Hans de Goede
    Link: https://lore.kernel.org/r/20190817184340.64086-2-hdegoede@redhat.com
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     
  • Use usb_debug_root as root for our debugfs entry instead of creating our
    own subdirectory under the debugfs root.

    Another patch in this series will make the same change to the fusb302
    driver, which also uses dev_name() (on the same device) for the debugfs
    entry name. So we also prefix dev_name() with "tcpm-" here to avoid a
    name conflict.

    Reviewed-by: Guenter Roeck
    Reviewed-by: Heikki Krogerus
    Signed-off-by: Hans de Goede
    Link: https://lore.kernel.org/r/20190817184340.64086-1-hdegoede@redhat.com
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     

16 Aug, 2019

2 commits

  • By registering a software fwnode for the port when the
    firmware does not supply one, we can always provide tcpm the
    connector capabilities by using the common USB connector
    device properties instead of using tcpc_config platform data.

    Signed-off-by: Heikki Krogerus
    Reviewed-by: Hans de Goede
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190814132419.39759-4-heikki.krogerus@linux.intel.com
    Tested-by: Hans de Goede
    Signed-off-by: Greg Kroah-Hartman

    Heikki Krogerus
     
  • Removing the deprecated fusb302 specific properties. There
    are no more platforms using them.

    Signed-off-by: Heikki Krogerus
    Reviewed-by: Hans de Goede
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190814132419.39759-2-heikki.krogerus@linux.intel.com
    Tested-by: Hans de Goede
    Signed-off-by: Greg Kroah-Hartman

    Heikki Krogerus
     

12 Aug, 2019

1 commit


08 Aug, 2019

1 commit

  • The driver core now supports the option to automatically create and
    remove any needed sysfs attribute files for a driver when the device is
    bound/removed from it. Convert the uscsi_ccg code to use that instead
    of trying to create sysfs files "by hand".

    Cc: Ajay Gupta
    Cc: Wolfram Sang
    Cc: Wei Yongjun
    Reviewed-by: Heikki Krogerus
    Link: https://lore.kernel.org/r/20190805193636.25560-6-gregkh@linuxfoundation.org
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

03 Aug, 2019

1 commit

  • TCPM may receive PD messages associated with unknown or unsupported
    alternate modes. If that happens, calls to typec_match_altmode()
    will return NULL. The tcpm code does not currently take this into
    account. This results in crashes.

    Unable to handle kernel NULL pointer dereference at virtual address 000001f0
    pgd = 41dad9a1
    [000001f0] *pgd=00000000
    Internal error: Oops: 5 [#1] THUMB2
    Modules linked in: tcpci tcpm
    CPU: 0 PID: 2338 Comm: kworker/u2:0 Not tainted 5.1.18-sama5-armv7-r2 #6
    Hardware name: Atmel SAMA5
    Workqueue: 2-0050 tcpm_pd_rx_handler [tcpm]
    PC is at typec_altmode_attention+0x0/0x14
    LR is at tcpm_pd_rx_handler+0xa3b/0xda0 [tcpm]
    ...
    [] (typec_altmode_attention) from []
    (tcpm_pd_rx_handler+0xa3b/0xda0 [tcpm])
    [] (tcpm_pd_rx_handler [tcpm]) from []
    (process_one_work+0x123/0x2a8)
    [] (process_one_work) from []
    (worker_thread+0xbd/0x3b0)
    [] (worker_thread) from [] (kthread+0xcf/0xf4)
    [] (kthread) from [] (ret_from_fork+0x11/0x38)

    Ignore PD messages if the associated alternate mode is not supported.

    Fixes: e9576fe8e605c ("usb: typec: tcpm: Support for Alternate Modes")
    Cc: stable
    Reported-by: Douglas Gilbert
    Cc: Douglas Gilbert
    Acked-by: Heikki Krogerus
    Tested-by: Douglas Gilbert
    Signed-off-by: Guenter Roeck
    Link: https://lore.kernel.org/r/1564761822-13984-1-git-send-email-linux@roeck-us.net
    Signed-off-by: Greg Kroah-Hartman

    Guenter Roeck
     

02 Aug, 2019

1 commit

  • Fix smatch error:
    drivers/usb/typec/ucsi/ucsi_ccg.c:975 ccg_fw_update() error: uninitialized symbol 'err'.

    Fixes: 5c9ae5a87573 ("usb: typec: ucsi: ccg: add firmware flashing support")
    Cc: stable@vger.kernel.org
    Reported-by: kbuild test robot
    Signed-off-by: Heikki Krogerus
    Link: https://lore.kernel.org/r/20190801075512.24354-1-heikki.krogerus@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman

    Heikki Krogerus
     

31 Jul, 2019

1 commit

  • We don't need dev_err() messages when platform_get_irq() fails now that
    platform_get_irq() prints an error message itself when something goes
    wrong. Let's remove these prints with a simple semantic patch.

    //
    @@
    expression ret;
    struct platform_device *E;
    @@

    ret =
    (
    platform_get_irq(E, ...)
    |
    platform_get_irq_byname(E, ...)
    );

    if ( \( ret < 0 \| ret

    While we're here, remove braces on if statements that only have one
    statement (manually).

    Signed-off-by: Stephen Boyd
    Link: https://lore.kernel.org/r/20190730181557.90391-47-swboyd@chromium.org
    Signed-off-by: Greg Kroah-Hartman

    Stephen Boyd
     

30 Jul, 2019

5 commits

  • Add a helper to match the firmware node handle of a device and provide
    wrappers for {bus/class/driver}_find_device() APIs to avoid proliferation
    of duplicate custom match functions.

    Cc: "David S. Miller"
    Cc: Doug Ledford
    Cc: Jason Gunthorpe
    Cc: linux-usb@vger.kernel.org
    Cc: "Rafael J. Wysocki"
    Cc: Ulf Hansson
    Cc: Joe Perches
    Cc: Will Deacon
    Cc: Joerg Roedel
    Signed-off-by: Suzuki K Poulose
    Acked-by: Robin Murphy
    Reviewed-by: Mathieu Poirier
    Reviewed-by: Heikki Krogerus
    Link: https://lore.kernel.org/r/20190723221838.12024-4-suzuki.poulose@arm.com
    Signed-off-by: Greg Kroah-Hartman

    Suzuki K Poulose
     
  • Add a helper to match the device name for device lookup. Also
    reuse this generic exported helper for the existing bus_find_device_by_name().
    and add similar variants for driver/class.

    Cc: Alessandro Zummo
    Cc: Alexander Aring
    Cc: Alexander Shishkin
    Cc: Arnd Bergmann
    Cc: Dan Murphy
    Cc: Harald Freudenberger
    Cc: Heiko Carstens
    Cc: Jacek Anaszewski
    Cc: Lee Jones
    Cc: linux-leds@vger.kernel.org
    Cc: linux-rtc@vger.kernel.org
    Cc: linux-usb@vger.kernel.org
    Cc: linux-wpan@vger.kernel.org
    Cc: Maxime Coquelin
    Cc: Pavel Machek
    Cc: Peter Oberparleiter
    Cc: "Rafael J. Wysocki"
    Cc: Stefan Schmidt
    Cc: Greg Kroah-Hartman
    Cc: "Rafael J. Wysocki"
    Signed-off-by: Suzuki K Poulose
    Reviewed-by: Heikki Krogerus
    Acked-by: Alexandre Belloni
    Link: https://lore.kernel.org/r/20190723221838.12024-2-suzuki.poulose@arm.com
    Signed-off-by: Greg Kroah-Hartman

    Suzuki K Poulose
     
  • If config tcpm as module, module unload will not remove tcpm dir,
    then the next module load will have problem: the rootdir is NULL
    but tcpm dir is still there, so tcpm_debugfs_init() will create
    tcpm dir again with failure, fix it by remove the tcpm dir if no
    children.

    Cc: stable@vger.kernel.org # v4.15+
    Fixes: 4b4e02c83167 ("typec: tcpm: Move out of staging")
    Signed-off-by: Li Jun
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190717080646.30421-2-jun.li@nxp.com
    Signed-off-by: Greg Kroah-Hartman

    Li Jun
     
  • The logbuffer memory should be freed when remove debug file.

    Cc: stable@vger.kernel.org # v4.15+
    Fixes: 4b4e02c83167 ("typec: tcpm: Move out of staging")
    Signed-off-by: Li Jun
    Reviewed-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20190717080646.30421-1-jun.li@nxp.com
    Signed-off-by: Greg Kroah-Hartman

    Li Jun
     
  • When instantiating tcpm on an NXP OM 13588 board with NXP PTN5110,
    the following crash is seen when writing into the 'preferred_role'
    sysfs attribute.

    Unable to handle kernel NULL pointer dereference at virtual address 00000028
    pgd = f69149ad
    [00000028] *pgd=00000000
    Internal error: Oops: 5 [#1] THUMB2
    Modules linked in: tcpci tcpm
    CPU: 0 PID: 1882 Comm: bash Not tainted 5.1.18-sama5-armv7-r2 #4
    Hardware name: Atmel SAMA5
    PC is at tcpm_try_role+0x3a/0x4c [tcpm]
    LR is at tcpm_try_role+0x15/0x4c [tcpm]
    pc : [] lr : [] psr: 60030033
    sp : dc1a1e88 ip : c03fb47d fp : 00000000
    r10: dc216190 r9 : dc1a1f78 r8 : 00000001
    r7 : df4ae044 r6 : dd032e90 r5 : dd1ce340 r4 : df4ae054
    r3 : 00000000 r2 : 00000000 r1 : 00000000 r0 : df4ae044
    Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA Thumb Segment none
    Control: 50c53c7d Table: 3efec059 DAC: 00000051
    Process bash (pid: 1882, stack limit = 0x6a6d4aa5)
    Stack: (0xdc1a1e88 to 0xdc1a2000)
    1e80: dd05d808 dd1ce340 00000001 00000007 dd1ce340 c03fb4a7
    1ea0: 00000007 00000007 dc216180 00000000 00000000 c01e1e03 00000000 00000000
    1ec0: c0907008 dee98b40 c01e1d5d c06106c4 00000000 00000000 00000007 c0194e8b
    1ee0: 0000000a 00000400 00000000 c01a97db dc22bf00 ffffe000 df4b6a00 df745900
    1f00: 00000001 00000001 000000dd c01a9c2f 7aeab3be c0907008 00000000 dc22bf00
    1f20: c0907008 00000000 00000000 00000000 00000000 7aeab3be 00000007 dee98b40
    1f40: 005dc318 dc1a1f78 00000000 00000000 00000007 c01969f7 0000000a c01a20cb
    1f60: dee98b40 c0907008 dee98b40 005dc318 00000000 c0196b9b 00000000 00000000
    1f80: dee98b40 7aeab3be 00000074 005dc318 b6f3bdb0 00000004 c0101224 dc1a0000
    1fa0: 00000004 c0101001 00000074 005dc318 00000001 005dc318 00000007 00000000
    1fc0: 00000074 005dc318 b6f3bdb0 00000004 00000007 00000007 00000000 00000000
    1fe0: 00000004 be800880 b6ed35b3 b6e5c746 60030030 00000001 00000000 00000000
    [] (tcpm_try_role [tcpm]) from [] (preferred_role_store+0x2b/0x5c)
    [] (preferred_role_store) from [] (kernfs_fop_write+0xa7/0x150)
    [] (kernfs_fop_write) from [] (__vfs_write+0x1f/0x104)
    [] (__vfs_write) from [] (vfs_write+0x6b/0x104)
    [] (vfs_write) from [] (ksys_write+0x43/0x94)
    [] (ksys_write) from [] (ret_fast_syscall+0x1/0x62)

    Since commit 96232cbc6c994 ("usb: typec: tcpm: support get typec and pd
    config from device properties"), the 'config' pointer in struct tcpc_dev
    is optional when registering a Type-C port. Since it is optional, we have
    to check if it is NULL before dereferencing it.

    Reported-by: Douglas Gilbert
    Cc: Douglas Gilbert
    Fixes: 96232cbc6c994 ("usb: typec: tcpm: support get typec and pd config from device properties")
    Signed-off-by: Guenter Roeck
    Cc: stable
    Reviewed-by: Jun Li
    Reviewed-by: Heikki Krogerus
    Link: https://lore.kernel.org/r/1563979112-22483-1-git-send-email-linux@roeck-us.net
    Signed-off-by: Greg Kroah-Hartman

    Guenter Roeck
     

25 Jul, 2019

2 commits


16 Jul, 2019

1 commit

  • Pull i2c updates from Wolfram Sang:
    "New stuff from the I2C world:

    - in the core, getting irqs from ACPI is now similar to OF

    - new driver for MediaTek MT7621/7628/7688 SoCs

    - bcm2835, i801, and tegra drivers got some more attention

    - GPIO API cleanups

    - cleanups in the core headers

    - lots of usual driver updates"

    * 'i2c/for-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (74 commits)
    i2c: mt7621: Fix platform_no_drv_owner.cocci warnings
    i2c: cpm: remove casting dma_alloc
    dt-bindings: i2c: sun6i-p2wi: Fix the binding example
    dt-bindings: i2c: mv64xxx: Fix the example compatible
    i2c: i801: Documentation update
    i2c: i801: Add support for Intel Tiger Lake
    i2c: i801: Fix PCI ID sorting
    dt-bindings: i2c-stm32: document optional dmas
    i2c: i2c-stm32f7: Add I2C_SMBUS_I2C_BLOCK_DATA support
    i2c: core: Tidy up handling of init_irq
    i2c: core: Move ACPI gpio IRQ handling into i2c_acpi_get_irq
    i2c: core: Move ACPI IRQ handling to probe time
    i2c: acpi: Factor out getting the IRQ from ACPI
    i2c: acpi: Use available IRQ helper functions
    i2c: core: Allow whole core to use i2c_dev_irq_from_resources
    eeprom: at24: modify a comment referring to platform data
    dt-bindings: i2c: omap: Add new compatible for J721E SoCs
    dt-bindings: i2c: mv64xxx: Add YAML schemas
    dt-bindings: i2c: sun6i-p2wi: Add YAML schemas
    i2c: mt7621: Add MediaTek MT7621/7628/7688 I2C driver
    ...

    Linus Torvalds
     

12 Jul, 2019

1 commit

  • Pull USB / PHY updates from Greg KH:
    "Here is the big USB and PHY driver pull request for 5.3-rc1.

    Lots of stuff here, all of which has been in linux-next for a while
    with no reported issues. Nothing is earth-shattering, just constant
    forward progress for more devices supported and cleanups and small
    fixes:

    - USB gadget driver updates and fixes

    - new USB gadget driver for some hardware, followed by a quick revert
    of those patches as they were not ready to be merged...

    - PHY driver updates

    - Lots of new driver additions and cleanups with a few fixes mixed
    in"

    * tag 'usb-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (145 commits)
    Revert "usb: gadget: storage: Remove warning message"
    Revert "dt-bindings: add binding for USBSS-DRD controller."
    Revert "usb:gadget Separated decoding functions from dwc3 driver."
    Revert "usb:gadget Patch simplify usb_decode_set_clear_feature function."
    Revert "usb:gadget Simplify usb_decode_get_set_descriptor function."
    Revert "usb:cdns3 Add Cadence USB3 DRD Driver"
    Revert "usb:cdns3 Fix for stuck packets in on-chip OUT buffer."
    usb :fsl: Change string format for errata property
    usb: host: Stops USB controller init if PLL fails to lock
    usb: linux/fsl_device: Add platform member has_fsl_erratum_a006918
    usb: phy: Workaround for USB erratum-A005728
    usb: fsl: Set USB_EN bit to select ULPI phy
    usb: Handle USB3 remote wakeup for LPM enabled devices correctly
    drivers/usb/typec/tps6598x.c: fix 4CC cmd write
    drivers/usb/typec/tps6598x.c: fix portinfo width
    usb: storage: scsiglue: Do not skip VPD if try_vpd_pages is set
    usb: renesas_usbhs: add a workaround for a race condition of workqueue
    usb: gadget: udc: renesas_usb3: remove redundant assignment to ret
    usb: dwc2: use a longer AHB idle timeout in dwc2_core_reset()
    USB: gadget: function: fix issue Unneeded variable: "value"
    ...

    Linus Torvalds
     

10 Jul, 2019

1 commit

  • Pull device properties framework updates from Rafael Wysocki:
    "These add helpers for counting items in a property array and extend
    the "software nodes" support to be more convenient for representing
    device properties supplied by drivers and make the intel_cht_int33fe
    driver use that.

    Specifics:

    - Add helpers to count items in a property array (Andy Shevchenko).

    - Extend "software nodes" support to be more convenient for
    representing device properties supplied by drivers (Heikki
    Krogerus).

    - Add device_find_child_by_name() helper to the driver core (Heikki
    Krogerus).

    - Extend device connection code to also look for references provided
    via fwnode pointers (Heikki Krogerus).

    - Start to register proper struct device objects for USB Type-C muxes
    and orientation switches (Heikki Krogerus).

    - Update the intel_cht_int33fe driver to describe devices in a more
    general way with the help of "software nodes" (Heikki Krogerus)"

    * tag 'devprop-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
    device property: Add helpers to count items in an array
    platform/x86: intel_cht_int33fe: Replacing the old connections with references
    platform/x86: intel_cht_int33fe: Supply fwnodes for the external dependencies
    platform/x86: intel_cht_int33fe: Provide fwnode for the USB connector
    platform/x86: intel_cht_int33fe: Provide software nodes for the devices
    platform/x86: intel_cht_int33fe: Remove unused fusb302 device property
    platform/x86: intel_cht_int33fe: Register max17047 in its own function
    usb: typec: Registering real device entries for the muxes
    device connection: Find connections also by checking the references
    device property: Introduce fwnode_find_reference()
    ACPI / property: Don't limit named child node matching to data nodes
    driver core: Add helper device_find_child_by_name()
    software node: Add software_node_get_reference_args()
    software node: Use kobject name when finding child nodes by name
    software node: Add support for static node descriptors
    software node: Simplify software_node_release() function
    software node: Allow node creation without properties

    Linus Torvalds
     

04 Jul, 2019

2 commits

  • Writing 4CC commands with tps6598x_write_4cc() already has
    a pointer arg, don't reference it when using as arg to
    tps6598x_block_write(). Correcting this enforces the constness
    of the pointer to propagate to tps6598x_block_write(), so add
    the const qualifier there to avoid the warning.

    Fixes: 0a4c005bd171 ("usb: typec: driver for TI TPS6598x USB Power Delivery controllers")
    Signed-off-by: Nikolaus Voss
    Acked-by: Heikki Krogerus
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Nikolaus Voss
     
  • Portinfo bit field is 3 bits wide, not 2 bits. This led to
    a wrong driver configuration for some tps6598x configurations.

    Fixes: 0a4c005bd171 ("usb: typec: driver for TI TPS6598x USB Power Delivery controllers")
    Signed-off-by: Nikolaus Voss
    Acked-by: Heikki Krogerus
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Nikolaus Voss