14 Jun, 2017

6 commits

  • We must check for ID/VBUS changes during resume irrespective
    of whether our device wakeup is enabled or not.

    Without this we seem to be missing ID/VBUS events after
    system suspend/resume.

    Signed-off-by: Roger Quadros
    Signed-off-by: Chanwoo Choi
    (cherry picked from commit 8680b4d1933fbe3349d51a4e1fd4513b12abffed)

    Roger Quadros
     
  • Whether the USB port as a wakeup source should be determined by user,
    but not enabled by default.

    Signed-off-by: Peter Chen
    Signed-off-by: Chanwoo Choi
    (cherry picked from commit 98fd079297dd274c15c926a337253675573c5832)

    Peter Chen
     
  • At some systems, the pinctrl setting will be lost or needs to
    set as "sleep" state to save power consumption. So, we need to
    configure pinctrl as "sleep" state when system enters suspend,
    and as "default" state after system resumes. In this way, the
    pinctrl value can be recovered as "default" state after resuming.

    Signed-off-by: Peter Chen
    Signed-off-by: Chanwoo Choi
    (cherry picked from commit bcb7440e76a96c8a244bd683142a38f7d5cecb93)

    Peter Chen
     
  • Driver can now work with both ID and VBUS pins or either one of
    them.

    There can be the following 3 cases

    1) Both ID and VBUS GPIOs are available:

    ID = LOW -> USB_HOST active, USB inactive
    ID = HIGH -> USB_HOST inactive, USB state is same as VBUS.

    2) Only ID GPIO is available:

    ID = LOW -> USB_HOST active, USB inactive
    ID = HIGH -> USB_HOST inactive, USB active

    3) Only VBUS GPIO is available:

    VBUS = LOW -> USB_HOST inactive, USB inactive
    VBUS = HIGH -> USB_HOST inactive, USB active

    Signed-off-by: Roger Quadros
    Reviewed-by: Peter Chen
    Signed-off-by: Chanwoo Choi
    (cherry picked from commit 541332a13b1ded42097ba96c52c7bc70931e528c)

    Roger Quadros
     
  • This reverts commit 4c7d332e3316 ("MLK-13638-3 extcon: usb-gpio: add
    pinctrl operation during system PM"). We will use the upstream version.

    Reviewed-by: Peter Chen
    Signed-off-by: Li Jun
    (cherry picked from commit bf584fcb7294cac67c67b552d7b347b6e59fe243)

    Li Jun
     
  • This reverts commit 358776f8c5d8 ("MLK-13912-1 extcon: ext-usb-gpio: do not
    enable wakeup by default"), we will use the upstream patch version.

    Reviewed-by: Peter Chen
    Signed-off-by: Li Jun
    (cherry picked from commit 72c6b1977e334c5fde2f394ce276ab42df76575f)

    Li Jun
     

08 Jun, 2017

2 commits


20 Jan, 2017

1 commit

  • commit 5b11ebedd6a8bb4271b796e498cd15c0fe1133b6 upstream.

    Function get_zeroed_page() returns a NULL pointer if there is no enough
    memory. In function extcon_sync(), it returns 0 if the call to
    get_zeroed_page() fails. The return value 0 indicates success in the
    context, which is incosistent with the execution status. This patch
    fixes the bug by returning -ENOMEM.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188611

    Signed-off-by: Pan Bian
    Fixes: a580982f0836e
    Acked-by: Chanwoo Choi
    Signed-off-by: Greg Kroah-Hartman

    Pan Bian
     

26 Oct, 2016

1 commit

  • The driver was changed after submission to use the new style APIs
    like extcon_set_state(). Unfortunately, that only sets the state,
    and doesn't notify any consumers that the cable state has
    changed. Use extcon_set_state_sync() here instead so that we
    notify cable consumers of the state change. This fixes USB
    host-device role switching on the db8074 platform.

    Fixes: 38085c987f52 ("extcon: Add support for qcom SPMI PMIC USB id detection hardware")
    Signed-off-by: Stephen Boyd
    Signed-off-by: Chanwoo Choi

    Stephen Boyd
     

15 Sep, 2016

1 commit


13 Sep, 2016

4 commits

  • Some Qualcomm PMICs have a misc device that performs USB id pin
    detection via an interrupt. When the interrupt triggers, we
    should read the interrupt line to see if it has gone high or low.
    If the interrupt is low then the ID pin is grounded, and if the
    interrupt is high then the ID pin is being held high.

    Cc: Roger Quadros
    Signed-off-by: Stephen Boyd
    [cw00.choi: Edited the driver description and added the author information]
    Signed-off-by: Chanwoo Choi

    Stephen Boyd
     
  • This patch alters the renamed extcon API to set the state of the external
    connectors instead of deprecated extcon_set_cable_state_().

    Because the patch[1] modifies the function name to maintain the function
    naming pattern.
    - extcon_set_cable_state_() -> extcon_set_state_sync()
    - extcon_get_cable_state_() -> extcon_get_state()

    [1] https://lkml.org/lkml/2016/8/4/729
    - extcon: Rename the extcon_set/get_state() to maintain the function naming pattern

    Signed-off-by: Chanwoo Choi
    Acked-by: Charles Keepax
    Acked-by: Roger Quadros

    Chanwoo Choi
     
  • This patch fixes the spelling mistake in dev_dbg messages.

    Signed-off-by: Colin Ian King
    [cw00.choi: Modify the patch title/description]
    Signed-off-by: Chanwoo Choi

    Colin Ian King
     
  • Change my email address to kernel.org instead of Samsung one for the
    purpose of any future contact. The copyrights remain untouched and are
    attributed to Samsung.

    Signed-off-by: Krzysztof Kozlowski
    Signed-off-by: Chanwoo Choi

    Krzysztof Kozlowski
     

10 Sep, 2016

17 commits

  • This patchs add the new EXTCON_CHG_WPT for Wireless Power Transfer[1].
    The Wireless Power Transfer is the transmission of electronical energy
    from a power source. The EXTCON_CHG_WPT has the EXTCON_TYPE_CHG.

    [1] https://en.wikipedia.org/wiki/Wireless_power_transfer

    Signed-off-by: Chanwoo Choi

    Chanwoo Choi
     
  • This patch adds the new EXTCON_DISP_HMD id for Head-mounted Display[1] device.
    The HMD device is usually for USB connector type So, the HMD connector
    has the two extcon types of both EXTCON_TYPE_DISP and EXTCON_TYPE_USB.

    [1] https://en.wikipedia.org/wiki/Head-mounted_display

    Signed-off-by: Chanwoo Choi

    Chanwoo Choi
     
  • Add EXTCON_DISP_DP for the Display external connector. For Type-C
    connector the DisplayPort can work as an Alternate Mode(VESA DisplayPort
    Alt Mode on USB Type-C Standard). The Type-C support both normal
    and flipped orientation, so add a property to extcon.

    Signed-off-by: Chris Zhong
    Signed-off-by: Chanwoo Choi
    Tested-by: Chris Zhong
    Tested-by: Guenter Roeck
    Reviewed-by: Guenter Roeck

    Chris Zhong
     
  • This patch adds the synchronization extcon APIs to support the notifications
    for both state and property. When extcon_*_sync() functions is called,
    the extcon informs the information from extcon provider to extcon client.

    The extcon driver may need to change the both state and multiple properties
    at the same time. After setting the data of a external connector,
    the extcon send the notification to client driver with the extcon_*_sync().

    The list of new extcon APIs as following:
    - extcon_sync() : Send the notification for each external connector to
    synchronize the information between extcon provider driver
    and extcon client driver.
    - extcon_set_state_sync() : Set the state of external connector with noti.
    - extcon_set_property_sync() : Set the property of external connector with noti.

    For example,
    case 1, change the state of external connector and synchronized the data.
    extcon_set_state_sync(edev, EXTCON_USB, 1);

    case 2, change both the state and property of external connector
    and synchronized the data.
    extcon_set_state(edev, EXTCON_USB, 1);
    extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS 1);
    extcon_sync(edev, EXTCON_USB);

    case 3, change the property of external connector and synchronized the data.
    extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);
    extcon_sync(edev, EXTCON_USB);

    case 4, change the property of external connector and synchronized the data.
    extcon_set_property_sync(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);

    Signed-off-by: Chanwoo Choi
    Tested-by: Chris Zhong
    Tested-by: Guenter Roeck
    Reviewed-by: Guenter Roeck

    Chanwoo Choi
     
  • This patch just renames the existing extcon_get/set_cable_state_()
    as following because of maintaining the function naming pattern
    like as extcon APIs for property.
    - extcon_set_cable_state_() -> extcon_set_state()
    - extcon_get_cable_state_() -> extcon_get_state()

    But, this patch remains the old extcon_set/get_cable_state_() functions
    to prevent the build break. After altering new APIs, remove the old APIs.

    Signed-off-by: Chanwoo Choi
    Tested-by: Chris Zhong
    Tested-by: Guenter Roeck
    Reviewed-by: Guenter Roeck

    Chanwoo Choi
     
  • This patch adds the support of the property capability setting. This function
    decides the supported properties of each external connector on extcon provider
    driver.

    Ths list of new extcon APIs to get/set the capability of property as following:
    - int extcon_get_property_capability(struct extcon_dev *edev,
    unsigned int id, unsigned int prop);
    - int extcon_set_property_capability(struct extcon_dev *edev,
    unsigned int id, unsigned int prop);

    Signed-off-by: Chanwoo Choi
    Tested-by: Chris Zhong
    Tested-by: Guenter Roeck
    Reviewed-by: Guenter Roeck

    Chanwoo Choi
     
  • This patch support the extcon property for the external connector
    because each external connector might have the property according to
    the H/W design and the specific characteristics.

    - EXTCON_PROP_USB_[property name]
    - EXTCON_PROP_CHG_[property name]
    - EXTCON_PROP_JACK_[property name]
    - EXTCON_PROP_DISP_[property name]

    Add the new extcon APIs to get/set the property value as following:
    - int extcon_get_property(struct extcon_dev *edev, unsigned int id,
    unsigned int prop,
    union extcon_property_value *prop_val)
    - int extcon_set_property(struct extcon_dev *edev, unsigned int id,
    unsigned int prop,
    union extcon_property_value prop_val)

    Signed-off-by: Chanwoo Choi
    Tested-by: Chris Zhong
    Tested-by: Guenter Roeck
    Reviewed-by: Guenter Roeck

    Chanwoo Choi
     
  • This patch adds the new extcon type to group the each connecotr
    into following five category. This type would be used to handle
    the connectors as a group unit instead of a connector unit.
    - EXTCON_TYPE_USB : USB connector
    - EXTCON_TYPE_CHG : Charger connector
    - EXTCON_TYPE_JACK : Jack connector
    - EXTCON_TYPE_DISP : Display connector
    - EXTCON_TYPE_MISC : Miscellaneous connector

    Also, each external connector is possible to belong to one more extcon type.
    In caes of EXTCON_CHG_USB_SDP, it have the EXTCON_TYPE_CHG and EXTCON_TYPE_USB.

    Signed-off-by: Chanwoo Choi
    Tested-by: Chris Zhong
    Tested-by: Guenter Roeck
    Signed-off-by: MyungJoo Ham
    Reviewed-by: Guenter Roeck

    Chanwoo Choi
     
  • This patch fixes below compilation warning:-
    drivers/extcon/extcon.c: In function extcon_register_notifier:
    drivers/extcon/extcon.c:455:6: warning: idx may be used uninitialized in this function [-Wmaybe-uninitialized]
    if (idx >= 0) {

    Signed-off-by: Vaneet Narang
    Signed-off-by: Maninder Singh
    [cw00.choi : Modify the patch title using the a captical letter for first char]
    Signed-off-by: Chanwoo Choi

    Maninder Singh
     
  • This patch restrict the usage of extcon_update_state() in the extcon
    core because the extcon_update_state() use the bit masking to change
    the state of external connector. When this function is used in device drivers,
    it may occur the probelm with the handling mistake of bit masking.

    Also, this patch removes the extcon_get/set_state() functions because these
    functions use the bit masking which is reluctant way. Instead, extcon
    provides the extcon_set/get_cable_state_() functions.

    Signed-off-by: Chanwoo Choi

    Chanwoo Choi
     
  • This patch removes the state_store() which change the state of external
    connectors with bit masking on user-space. It is wrong access to modify
    the change the state of external connectors.

    Signed-off-by: Chanwoo Choi

    Chanwoo Choi
     
  • This patch removes the usage of extcon_set_state() because it uses
    the bit masking to change the state of external connectors. The extcon framework
    should handle the state by extcon_set_cable_state_() with extcon id.

    Signed-off-by: Chanwoo Choi

    Chanwoo Choi
     
  • This patch removes the usage of extcon_set_state() because it uses the bit
    masking to change the state of external connectors. The extcon framework
    should handle the state by extcon_set/get_cable_state_() with extcon id.

    Signed-off-by: Chanwoo Choi

    Chanwoo Choi
     
  • This patch remvoes the usage of extcon_update_state() because
    the extcon_update_state() use directly the bit masking calculation
    to change the state of external connector without the unique id of
    external connector. It makes the code diffcult to read it.
    So, this patch uses the extcon_set_cable_state_() instead.

    Signed-off-by: Chanwoo Choi
    Acked-by: Charles Keepax

    Chanwoo Choi
     
  • There is no need for a semi-colon at the end of a switch statement so
    remove it.

    Signed-off-by: Charles Keepax
    Signed-off-by: Chanwoo Choi

    Charles Keepax
     
  • Sometimes drivers may call this API and expect it to fail because
    the extcon they're looking for is optional. Let's move these
    prints to debug level so it doesn't look like there's a problem
    when there isn't one.

    Signed-off-by: Stephen Boyd
    Signed-off-by: Chanwoo Choi

    Stephen Boyd
     
  • Update cable state during boot to avoid any missing
    external cable events occurred before driver initialisation.

    Signed-off-by: Venkat Reddy Talla
    Signed-off-by: Chanwoo Choi

    Venkat Reddy Talla
     

08 Aug, 2016

8 commits

  • This patchs add the new EXTCON_CHG_WPT for Wireless Power Transfer[1].
    The Wireless Power Transfer is the transmission of electronical energy
    from a power source. The EXTCON_CHG_WPT has the EXTCON_TYPE_CHG.

    [1] https://en.wikipedia.org/wiki/Wireless_power_transfer

    Signed-off-by: Chanwoo Choi

    Chanwoo Choi
     
  • This patch adds the new EXTCON_DISP_HMD id for Head-mounted Display[1] device.
    The HMD device is usually for USB connector type So, the HMD connector
    has the two extcon types of both EXTCON_TYPE_DISP and EXTCON_TYPE_USB.

    [1] https://en.wikipedia.org/wiki/Head-mounted_display

    Signed-off-by: Chanwoo Choi

    Chanwoo Choi
     
  • Add EXTCON_DISP_DP for the Display external connector. For Type-C
    connector the DisplayPort can work as an Alternate Mode(VESA DisplayPort
    Alt Mode on USB Type-C Standard). The Type-C support both normal
    and flipped orientation, so add a property to extcon.

    Signed-off-by: Chris Zhong
    Signed-off-by: Chanwoo Choi
    Tested-by: Chris Zhong
    Tested-by: Guenter Roeck
    Reviewed-by: Guenter Roeck

    Chris Zhong
     
  • This patch adds the synchronization extcon APIs to support the notifications
    for both state and property. When extcon_*_sync() functions is called,
    the extcon informs the information from extcon provider to extcon client.

    The extcon driver may need to change the both state and multiple properties
    at the same time. After setting the data of a external connector,
    the extcon send the notification to client driver with the extcon_*_sync().

    The list of new extcon APIs as following:
    - extcon_sync() : Send the notification for each external connector to
    synchronize the information between extcon provider driver
    and extcon client driver.
    - extcon_set_state_sync() : Set the state of external connector with noti.
    - extcon_set_property_sync() : Set the property of external connector with noti.

    For example,
    case 1, change the state of external connector and synchronized the data.
    extcon_set_state_sync(edev, EXTCON_USB, 1);

    case 2, change both the state and property of external connector
    and synchronized the data.
    extcon_set_state(edev, EXTCON_USB, 1);
    extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS 1);
    extcon_sync(edev, EXTCON_USB);

    case 3, change the property of external connector and synchronized the data.
    extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);
    extcon_sync(edev, EXTCON_USB);

    case 4, change the property of external connector and synchronized the data.
    extcon_set_property_sync(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);

    Signed-off-by: Chanwoo Choi
    Tested-by: Chris Zhong
    Tested-by: Guenter Roeck
    Reviewed-by: Guenter Roeck

    Chanwoo Choi
     
  • This patch just renames the existing extcon_get/set_cable_state_()
    as following because of maintaining the function naming pattern
    like as extcon APIs for property.
    - extcon_set_cable_state_() -> extcon_set_state()
    - extcon_get_cable_state_() -> extcon_get_state()

    But, this patch remains the old extcon_set/get_cable_state_() functions
    to prevent the build break. After altering new APIs, remove the old APIs.

    Signed-off-by: Chanwoo Choi
    Tested-by: Chris Zhong
    Tested-by: Guenter Roeck
    Reviewed-by: Guenter Roeck

    Chanwoo Choi
     
  • This patch adds the support of the property capability setting. This function
    decides the supported properties of each external connector on extcon provider
    driver.

    Ths list of new extcon APIs to get/set the capability of property as following:
    - int extcon_get_property_capability(struct extcon_dev *edev,
    unsigned int id, unsigned int prop);
    - int extcon_set_property_capability(struct extcon_dev *edev,
    unsigned int id, unsigned int prop);

    Signed-off-by: Chanwoo Choi
    Tested-by: Chris Zhong
    Tested-by: Guenter Roeck
    Reviewed-by: Guenter Roeck

    Chanwoo Choi
     
  • This patch support the extcon property for the external connector
    because each external connector might have the property according to
    the H/W design and the specific characteristics.

    - EXTCON_PROP_USB_[property name]
    - EXTCON_PROP_CHG_[property name]
    - EXTCON_PROP_JACK_[property name]
    - EXTCON_PROP_DISP_[property name]

    Add the new extcon APIs to get/set the property value as following:
    - int extcon_get_property(struct extcon_dev *edev, unsigned int id,
    unsigned int prop,
    union extcon_property_value *prop_val)
    - int extcon_set_property(struct extcon_dev *edev, unsigned int id,
    unsigned int prop,
    union extcon_property_value prop_val)

    Signed-off-by: Chanwoo Choi
    Tested-by: Chris Zhong
    Tested-by: Guenter Roeck
    Reviewed-by: Guenter Roeck

    Chanwoo Choi
     
  • This patch adds the new extcon type to group the each connecotr
    into following five category. This type would be used to handle
    the connectors as a group unit instead of a connector unit.
    - EXTCON_TYPE_USB : USB connector
    - EXTCON_TYPE_CHG : Charger connector
    - EXTCON_TYPE_JACK : Jack connector
    - EXTCON_TYPE_DISP : Display connector
    - EXTCON_TYPE_MISC : Miscellaneous connector

    Also, each external connector is possible to belong to one more extcon type.
    In caes of EXTCON_CHG_USB_SDP, it have the EXTCON_TYPE_CHG and EXTCON_TYPE_USB.

    Signed-off-by: Chanwoo Choi
    Tested-by: Chris Zhong
    Tested-by: Guenter Roeck
    Signed-off-by: MyungJoo Ham
    Reviewed-by: Guenter Roeck

    Chanwoo Choi