Merge branches 'ib-mfd-leds-4.16', 'ib-mfd-memstick-misc-mmc-4.16', 'ib-mfd-platform-4.16' and 'ib-mfd-tty-watchdog-4.16', tag 'ib-extcon-mfd-4.16-1' into ibs-for-mfd-merged
···2424#include <linux/notifier.h>2525#include <linux/extcon-provider.h>2626#include <linux/regmap.h>2727-#include <linux/gpio.h>2828-#include <linux/gpio/consumer.h>2927#include <linux/mfd/axp20x.h>30283129/* Power source status register */···7779 AXP288_BC_DET_STAT_REG = 0x2f,7880};79818080-enum axp288_mux_select {8181- EXTCON_GPIO_MUX_SEL_PMIC = 0,8282- EXTCON_GPIO_MUX_SEL_SOC,8383-};8484-8582enum axp288_extcon_irq {8683 VBUS_FALLING_IRQ = 0,8784 VBUS_RISING_IRQ,···97104 struct device *dev;98105 struct regmap *regmap;99106 struct regmap_irq_chip_data *regmap_irqc;100100- struct gpio_desc *gpio_mux_cntl;101107 int irq[EXTCON_IRQ_END];102108 struct extcon_dev *edev;103103- struct notifier_block extcon_nb;104109 unsigned int previous_cable;105110};106111···188197 }189198190199no_vbus:191191- /*192192- * If VBUS is absent Connect D+/D- lines to PMIC for BC193193- * detection. Else connect them to SOC for USB communication.194194- */195195- if (info->gpio_mux_cntl)196196- gpiod_set_value(info->gpio_mux_cntl,197197- vbus_attach ? EXTCON_GPIO_MUX_SEL_SOC198198- : EXTCON_GPIO_MUX_SEL_PMIC);199199-200200 extcon_set_state_sync(info->edev, info->previous_cable, false);201201 if (info->previous_cable == EXTCON_CHG_USB_SDP)202202 extcon_set_state_sync(info->edev, EXTCON_USB, false);···235253{236254 struct axp288_extcon_info *info;237255 struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);238238- struct axp288_extcon_pdata *pdata = pdev->dev.platform_data;239239- int ret, i, pirq, gpio;256256+ int ret, i, pirq;240257241258 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);242259 if (!info)···245264 info->regmap = axp20x->regmap;246265 info->regmap_irqc = axp20x->regmap_irqc;247266 info->previous_cable = EXTCON_NONE;248248- if (pdata)249249- info->gpio_mux_cntl = pdata->gpio_mux_cntl;250267251268 platform_set_drvdata(pdev, info);252269···265286 return ret;266287 }267288268268- /* Set up gpio control for USB Mux */269269- if (info->gpio_mux_cntl) {270270- gpio = desc_to_gpio(info->gpio_mux_cntl);271271- ret = devm_gpio_request(&pdev->dev, gpio, "USB_MUX");272272- if (ret < 0) {273273- dev_err(&pdev->dev,274274- "failed to request the gpio=%d\n", gpio);275275- return ret;276276- }277277- gpiod_direction_output(info->gpio_mux_cntl,278278- EXTCON_GPIO_MUX_SEL_PMIC);279279- }280280-281289 for (i = 0; i < EXTCON_IRQ_END; i++) {282290 pirq = platform_get_irq(pdev, i);291291+ if (pirq < 0)292292+ return pirq;293293+283294 info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq);284295 if (info->irq[i] < 0) {285296 dev_err(&pdev->dev,
+137-3
drivers/extcon/extcon-usbc-cros-ec.c
···34343535 struct notifier_block notifier;36363737+ unsigned int dr; /* data role */3838+ bool pr; /* power role (true if VBUS enabled) */3739 bool dp; /* DisplayPort enabled */3840 bool mux; /* SuperSpeed (usb3) enabled */3941 unsigned int power_type;4042};41434244static const unsigned int usb_type_c_cable[] = {4545+ EXTCON_USB,4646+ EXTCON_USB_HOST,4347 EXTCON_DISP_DP,4448 EXTCON_NONE,4949+};5050+5151+enum usb_data_roles {5252+ DR_NONE,5353+ DR_HOST,5454+ DR_DEVICE,4555};46564757/**···160150 pd_control.port = info->port_id;161151 pd_control.role = USB_PD_CTRL_ROLE_NO_CHANGE;162152 pd_control.mux = USB_PD_CTRL_MUX_NO_CHANGE;153153+ pd_control.swap = USB_PD_CTRL_SWAP_NONE;163154 ret = cros_ec_pd_command(info, EC_CMD_USB_PD_CONTROL, 1,164155 &pd_control, sizeof(pd_control),165156 &resp, sizeof(resp));···194183 return resp.num_ports;195184}196185186186+static const char *cros_ec_usb_role_string(unsigned int role)187187+{188188+ return role == DR_NONE ? "DISCONNECTED" :189189+ (role == DR_HOST ? "DFP" : "UFP");190190+}191191+192192+static const char *cros_ec_usb_power_type_string(unsigned int type)193193+{194194+ switch (type) {195195+ case USB_CHG_TYPE_NONE:196196+ return "USB_CHG_TYPE_NONE";197197+ case USB_CHG_TYPE_PD:198198+ return "USB_CHG_TYPE_PD";199199+ case USB_CHG_TYPE_PROPRIETARY:200200+ return "USB_CHG_TYPE_PROPRIETARY";201201+ case USB_CHG_TYPE_C:202202+ return "USB_CHG_TYPE_C";203203+ case USB_CHG_TYPE_BC12_DCP:204204+ return "USB_CHG_TYPE_BC12_DCP";205205+ case USB_CHG_TYPE_BC12_CDP:206206+ return "USB_CHG_TYPE_BC12_CDP";207207+ case USB_CHG_TYPE_BC12_SDP:208208+ return "USB_CHG_TYPE_BC12_SDP";209209+ case USB_CHG_TYPE_OTHER:210210+ return "USB_CHG_TYPE_OTHER";211211+ case USB_CHG_TYPE_VBUS:212212+ return "USB_CHG_TYPE_VBUS";213213+ case USB_CHG_TYPE_UNKNOWN:214214+ return "USB_CHG_TYPE_UNKNOWN";215215+ default:216216+ return "USB_CHG_TYPE_UNKNOWN";217217+ }218218+}219219+220220+static bool cros_ec_usb_power_type_is_wall_wart(unsigned int type,221221+ unsigned int role)222222+{223223+ switch (type) {224224+ /* FIXME : Guppy, Donnettes, and other chargers will be miscategorized225225+ * because they identify with USB_CHG_TYPE_C, but we can't return true226226+ * here from that code because that breaks Suzy-Q and other kinds of227227+ * USB Type-C cables and peripherals.228228+ */229229+ case USB_CHG_TYPE_PROPRIETARY:230230+ case USB_CHG_TYPE_BC12_DCP:231231+ return true;232232+ case USB_CHG_TYPE_PD:233233+ case USB_CHG_TYPE_C:234234+ case USB_CHG_TYPE_BC12_CDP:235235+ case USB_CHG_TYPE_BC12_SDP:236236+ case USB_CHG_TYPE_OTHER:237237+ case USB_CHG_TYPE_VBUS:238238+ case USB_CHG_TYPE_UNKNOWN:239239+ case USB_CHG_TYPE_NONE:240240+ default:241241+ return false;242242+ }243243+}244244+197245static int extcon_cros_ec_detect_cable(struct cros_ec_extcon_info *info,198246 bool force)199247{200248 struct device *dev = info->dev;201249 int role, power_type;250250+ unsigned int dr = DR_NONE;251251+ bool pr = false;202252 bool polarity = false;203253 bool dp = false;204254 bool mux = false;···278206 dev_err(dev, "failed getting role err = %d\n", role);279207 return role;280208 }209209+ dev_dbg(dev, "disconnected\n");281210 } else {282211 int pd_mux_state;283212213213+ dr = (role & PD_CTRL_RESP_ROLE_DATA) ? DR_HOST : DR_DEVICE;214214+ pr = (role & PD_CTRL_RESP_ROLE_POWER);284215 pd_mux_state = cros_ec_usb_get_pd_mux_state(info);285216 if (pd_mux_state < 0)286217 pd_mux_state = USB_PD_MUX_USB_ENABLED;···291216 dp = pd_mux_state & USB_PD_MUX_DP_ENABLED;292217 mux = pd_mux_state & USB_PD_MUX_USB_ENABLED;293218 hpd = pd_mux_state & USB_PD_MUX_HPD_IRQ;219219+220220+ dev_dbg(dev,221221+ "connected role 0x%x pwr type %d dr %d pr %d pol %d mux %d dp %d hpd %d\n",222222+ role, power_type, dr, pr, polarity, mux, dp, hpd);294223 }295224296296- if (force || info->dp != dp || info->mux != mux ||297297- info->power_type != power_type) {225225+ /*226226+ * When there is no USB host (e.g. USB PD charger),227227+ * we are not really a UFP for the AP.228228+ */229229+ if (dr == DR_DEVICE &&230230+ cros_ec_usb_power_type_is_wall_wart(power_type, role))231231+ dr = DR_NONE;298232233233+ if (force || info->dr != dr || info->pr != pr || info->dp != dp ||234234+ info->mux != mux || info->power_type != power_type) {235235+ bool host_connected = false, device_connected = false;236236+237237+ dev_dbg(dev, "Type/Role switch! type = %s role = %s\n",238238+ cros_ec_usb_power_type_string(power_type),239239+ cros_ec_usb_role_string(dr));240240+ info->dr = dr;241241+ info->pr = pr;299242 info->dp = dp;300243 info->mux = mux;301244 info->power_type = power_type;302245303303- extcon_set_state(info->edev, EXTCON_DISP_DP, dp);246246+ if (dr == DR_DEVICE)247247+ device_connected = true;248248+ else if (dr == DR_HOST)249249+ host_connected = true;304250251251+ extcon_set_state(info->edev, EXTCON_USB, device_connected);252252+ extcon_set_state(info->edev, EXTCON_USB_HOST, host_connected);253253+ extcon_set_state(info->edev, EXTCON_DISP_DP, dp);254254+ extcon_set_property(info->edev, EXTCON_USB,255255+ EXTCON_PROP_USB_VBUS,256256+ (union extcon_property_value)(int)pr);257257+ extcon_set_property(info->edev, EXTCON_USB_HOST,258258+ EXTCON_PROP_USB_VBUS,259259+ (union extcon_property_value)(int)pr);260260+ extcon_set_property(info->edev, EXTCON_USB,261261+ EXTCON_PROP_USB_TYPEC_POLARITY,262262+ (union extcon_property_value)(int)polarity);263263+ extcon_set_property(info->edev, EXTCON_USB_HOST,264264+ EXTCON_PROP_USB_TYPEC_POLARITY,265265+ (union extcon_property_value)(int)polarity);305266 extcon_set_property(info->edev, EXTCON_DISP_DP,306267 EXTCON_PROP_USB_TYPEC_POLARITY,307268 (union extcon_property_value)(int)polarity);269269+ extcon_set_property(info->edev, EXTCON_USB,270270+ EXTCON_PROP_USB_SS,271271+ (union extcon_property_value)(int)mux);272272+ extcon_set_property(info->edev, EXTCON_USB_HOST,273273+ EXTCON_PROP_USB_SS,274274+ (union extcon_property_value)(int)mux);308275 extcon_set_property(info->edev, EXTCON_DISP_DP,309276 EXTCON_PROP_USB_SS,310277 (union extcon_property_value)(int)mux);···354237 EXTCON_PROP_DISP_HPD,355238 (union extcon_property_value)(int)hpd);356239240240+ extcon_sync(info->edev, EXTCON_USB);241241+ extcon_sync(info->edev, EXTCON_USB_HOST);357242 extcon_sync(info->edev, EXTCON_DISP_DP);358243359244 } else if (hpd) {···441322 return ret;442323 }443324325325+ extcon_set_property_capability(info->edev, EXTCON_USB,326326+ EXTCON_PROP_USB_VBUS);327327+ extcon_set_property_capability(info->edev, EXTCON_USB_HOST,328328+ EXTCON_PROP_USB_VBUS);329329+ extcon_set_property_capability(info->edev, EXTCON_USB,330330+ EXTCON_PROP_USB_TYPEC_POLARITY);331331+ extcon_set_property_capability(info->edev, EXTCON_USB_HOST,332332+ EXTCON_PROP_USB_TYPEC_POLARITY);444333 extcon_set_property_capability(info->edev, EXTCON_DISP_DP,445334 EXTCON_PROP_USB_TYPEC_POLARITY);335335+ extcon_set_property_capability(info->edev, EXTCON_USB,336336+ EXTCON_PROP_USB_SS);337337+ extcon_set_property_capability(info->edev, EXTCON_USB_HOST,338338+ EXTCON_PROP_USB_SS);446339 extcon_set_property_capability(info->edev, EXTCON_DISP_DP,447340 EXTCON_PROP_USB_SS);448341 extcon_set_property_capability(info->edev, EXTCON_DISP_DP,449342 EXTCON_PROP_DISP_HPD);343343+344344+ info->dr = DR_NONE;345345+ info->pr = false;450346451347 platform_set_drvdata(pdev, info);452348
+1-1
drivers/leds/leds-pm8058.c
···106106 if (!led)107107 return -ENOMEM;108108109109- led->ledtype = (u32)of_device_get_match_data(&pdev->dev);109109+ led->ledtype = (u32)(unsigned long)of_device_get_match_data(&pdev->dev);110110111111 map = dev_get_regmap(pdev->dev.parent, NULL);112112 if (!map) {
+2-2
drivers/memstick/host/Kconfig
···45454646config MEMSTICK_REALTEK_PCI4747 tristate "Realtek PCI-E Memstick Card Interface Driver"4848- depends on MFD_RTSX_PCI4848+ depends on MISC_RTSX_PCI4949 help5050 Say Y here to include driver code to support Memstick card interface5151 of Realtek PCI-E card reader···55555656config MEMSTICK_REALTEK_USB5757 tristate "Realtek USB Memstick Card Interface Driver"5858- depends on MFD_RTSX_USB5858+ depends on MISC_RTSX_USB5959 help6060 Say Y here to include driver code to support Memstick card interface6161 of Realtek RTS5129/39 series USB card reader
···222222 response time cannot be guaranteed, we support ignoring223223 'pre-amble' bytes before the response actually starts.224224225225+config MFD_CROS_EC_CHARDEV226226+ tristate "Chrome OS Embedded Controller userspace device interface"227227+ depends on MFD_CROS_EC228228+ select CROS_EC_CTL229229+ ---help---230230+ This driver adds support to talk with the ChromeOS EC from userspace.231231+232232+ If you have a supported Chromebook, choose Y or M here.233233+ The module will be called cros_ec_dev.234234+225235config MFD_ASIC3226236 bool "Compaq ASIC3"227237 depends on GPIOLIB && ARM···939929 southbridge which provides access to GPIOs and Watchdog using the940930 southbridge PCI device configuration space.941931942942-config MFD_RTSX_PCI943943- tristate "Realtek PCI-E card reader"944944- depends on PCI945945- select MFD_CORE946946- help947947- This supports for Realtek PCI-Express card reader including rts5209,948948- rts5227, rts522A, rts5229, rts5249, rts524A, rts525A, rtl8411, etc.949949- Realtek card reader supports access to many types of memory cards,950950- such as Memory Stick, Memory Stick Pro, Secure Digital and951951- MultiMediaCard.952952-953932config MFD_RT5033954933 tristate "Richtek RT5033 Power Management IC"955934 depends on I2C···951952 common support for accessing the device. The device supports multiple952953 sub-devices like charger, fuel gauge, flash LED, current source,953954 LDO and Buck.954954-955955-config MFD_RTSX_USB956956- tristate "Realtek USB card reader"957957- depends on USB958958- select MFD_CORE959959- help960960- Select this option to get support for Realtek USB 2.0 card readers961961- including RTS5129, RTS5139, RTS5179 and RTS5170.962962- Realtek card reader supports access to many types of memory cards,963963- such as Memory Stick Pro, Secure Digital and MultiMediaCard.964955965956config MFD_RC5T583966957 bool "Ricoh RC5T583 Power Management system device"···18471858 help18481859 System Registers are the platform configuration block18491860 on the ARM Ltd. Versatile Express board.18611861+18621862+config RAVE_SP_CORE18631863+ tristate "RAVE SP MCU core driver"18641864+ depends on SERIAL_DEV_BUS18651865+ select CRC_CCITT18661866+ help18671867+ Select this to get support for the Supervisory Processor18681868+ device found on several devices in RAVE line of hardware.1850186918511870endmenu18521871endif
···496496 Enable this configuration option to enable the host side test driver497497 for PCI Endpoint.498498499499+config MISC_RTSX500500+ tristate501501+ default MISC_RTSX_PCI || MISC_RTSX_USB502502+499503source "drivers/misc/c2port/Kconfig"500504source "drivers/misc/eeprom/Kconfig"501505source "drivers/misc/cb710/Kconfig"···512508source "drivers/misc/genwqe/Kconfig"513509source "drivers/misc/echo/Kconfig"514510source "drivers/misc/cxl/Kconfig"511511+source "drivers/misc/cardreader/Kconfig"515512endmenu
···11+config MISC_RTSX_PCI22+ tristate "Realtek PCI-E card reader"33+ depends on PCI44+ select MFD_CORE55+ help66+ This supports for Realtek PCI-Express card reader including rts5209,77+ rts5227, rts522A, rts5229, rts5249, rts524A, rts525A, rtl8411, rts5260.88+ Realtek card readers support access to many types of memory cards,99+ such as Memory Stick, Memory Stick Pro, Secure Digital and1010+ MultiMediaCard.1111+1212+config MISC_RTSX_USB1313+ tristate "Realtek USB card reader"1414+ depends on USB1515+ select MFD_CORE1616+ help1717+ Select this option to get support for Realtek USB 2.0 card readers1818+ including RTS5129, RTS5139, RTS5179 and RTS5170.1919+ Realtek card reader supports access to many types of memory cards,2020+ such as Memory Stick Pro, Secure Digital and MultiMediaCard.
···838838839839config MMC_REALTEK_PCI840840 tristate "Realtek PCI-E SD/MMC Card Interface Driver"841841- depends on MFD_RTSX_PCI841841+ depends on MISC_RTSX_PCI842842 help843843 Say Y here to include driver code to support SD/MMC card interface844844 of Realtek PCI-E card reader845845846846config MMC_REALTEK_USB847847 tristate "Realtek USB SD/MMC Card Interface Driver"848848- depends on MFD_RTSX_USB848848+ depends on MISC_RTSX_USB849849 help850850 Say Y here to include driver code to support SD/MMC card interface851851 of Realtek RTS5129/39 series card reader
···3838 If you have a supported Chromebook, choose Y or M here.3939 The module will be called chromeos_pstore.40404141-config CROS_EC_CHARDEV4242- tristate "Chrome OS Embedded Controller userspace device interface"4343- depends on MFD_CROS_EC4444- ---help---4545- This driver adds support to talk with the ChromeOS EC from userspace.4646-4747- If you have a supported Chromebook, choose Y or M here.4848- The module will be called cros_ec_dev.4141+config CROS_EC_CTL4242+ tristate49435044config CROS_EC_LPC5145 tristate "ChromeOS Embedded Controller (LPC)"
···11-/*22- * Copyright 2015 Google, Inc.33- *44- * This program is free software; you can redistribute it and/or modify55- * it under the terms of the GNU General Public License as published by66- * the Free Software Foundation; either version 2 of the License, or77- * (at your option) any later version.88- *99- * This program is distributed in the hope that it will be useful,1010- * but WITHOUT ANY WARRANTY; without even the implied warranty of1111- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1212- * GNU General Public License for more details.1313- *1414- * You should have received a copy of the GNU General Public License1515- * along with this program. If not, see <http://www.gnu.org/licenses/>.1616- */1717-1818-#ifndef _DRV_CROS_EC_DEBUGFS_H_1919-#define _DRV_CROS_EC_DEBUGFS_H_2020-2121-#include "cros_ec_dev.h"2222-2323-/* debugfs stuff */2424-int cros_ec_debugfs_init(struct cros_ec_dev *ec);2525-void cros_ec_debugfs_remove(struct cros_ec_dev *ec);2626-2727-#endif /* _DRV_CROS_EC_DEBUGFS_H_ */
···132132}133133EXPORT_SYMBOL_GPL(serdev_device_close);134134135135+static void devm_serdev_device_release(struct device *dev, void *dr)136136+{137137+ serdev_device_close(*(struct serdev_device **)dr);138138+}139139+140140+int devm_serdev_device_open(struct device *dev, struct serdev_device *serdev)141141+{142142+ struct serdev_device **dr;143143+ int ret;144144+145145+ dr = devres_alloc(devm_serdev_device_release, sizeof(*dr), GFP_KERNEL);146146+ if (!dr)147147+ return -ENOMEM;148148+149149+ ret = serdev_device_open(serdev);150150+ if (ret) {151151+ devres_free(dr);152152+ return ret;153153+ }154154+155155+ *dr = serdev;156156+ devres_add(dev, dr);157157+158158+ return 0;159159+}160160+EXPORT_SYMBOL_GPL(devm_serdev_device_open);161161+135162void serdev_device_write_wakeup(struct serdev_device *serdev)136163{137164 complete(&serdev->write_comp);···295268static int serdev_drv_remove(struct device *dev)296269{297270 const struct serdev_device_driver *sdrv = to_serdev_device_driver(dev->driver);298298-299299- sdrv->remove(to_serdev_device(dev));271271+ if (sdrv->remove)272272+ sdrv->remove(to_serdev_device(dev));300273 return 0;301274}302275
+7
drivers/watchdog/Kconfig
···223223 To compile this driver as a module, choose M here: the224224 module will be called ziirave_wdt.225225226226+config RAVE_SP_WATCHDOG227227+ tristate "RAVE SP Watchdog timer"228228+ depends on RAVE_SP_CORE229229+ select WATCHDOG_CORE230230+ help231231+ Support for the watchdog on RAVE SP device.232232+226233# ALPHA Architecture227234228235# ARM Architecture
···645645 const struct regmap_irq_chip *regmap_irq_chip;646646};647647648648-struct axp288_extcon_pdata {649649- /* GPIO pin control to switch D+/D- lines b/w PMIC and SOC */650650- struct gpio_desc *gpio_mux_cntl;651651-};652652-653648/* generic helper function for reading 9-16 bit wide regs */654649static inline int axp20x_read_variable_width(struct regmap *regmap,655650 unsigned int reg, unsigned int width)