From 478c4b22acdd74241a651811a51378d8656cac66 Mon Sep 17 00:00:00 2001 From: lijilai Date: Mon, 9 Jul 2018 17:05:44 +0800 Subject: [PATCH] BSP: add s2mu106 ifpmic driver [9609][wing] ifpmic : add s2mu106 ifpmic driver Bug:HQ00000000 Workaround:no Change-Id: I186aaa9a3b83d421addb8c0310621b7d7e05afbb Signed-off-by: lijilai --- .../arm64/boot/dts/exynos/exynos9609-wing.dts | 96 +++++++++---------- arch/arm64/configs/wing_defconfig | 15 ++- drivers/Makefile | 1 + drivers/ccic/Kconfig | 69 ++++++------- drivers/ccic/Makefile | 20 ++-- drivers/ccic/s2mu106-usbpd.c | 2 + drivers/ifconn/ifconn_manager.c | 0 drivers/ifconn/ifconn_notifier.c | 4 +- drivers/muic/Kconfig | 7 ++ drivers/muic/Makefile | 0 drivers/muic/muic_core.c | 0 drivers/muic/muic_manager.c | 0 drivers/muic/muic_notifier.c | 0 drivers/muic/muic_sysfs.c | 0 include/linux/ccic/usbpd_msg.h | 0 include/linux/ifconn/ifconn_manager.h | 0 include/linux/ifconn/ifconn_notifier.h | 2 +- include/linux/mfd/samsung/core.h | 0 include/linux/muic/muic.h | 0 include/linux/muic/muic_interface.h | 0 include/linux/muic/muic_notifier.h | 0 include/linux/muic/muic_sysfs.h | 0 22 files changed, 100 insertions(+), 116 deletions(-) mode change 100644 => 100755 drivers/ccic/Kconfig mode change 100644 => 100755 drivers/ccic/Makefile mode change 100644 => 100755 drivers/ifconn/ifconn_manager.c mode change 100644 => 100755 drivers/ifconn/ifconn_notifier.c mode change 100644 => 100755 drivers/muic/Kconfig mode change 100644 => 100755 drivers/muic/Makefile mode change 100644 => 100755 drivers/muic/muic_core.c mode change 100644 => 100755 drivers/muic/muic_manager.c mode change 100644 => 100755 drivers/muic/muic_notifier.c mode change 100644 => 100755 drivers/muic/muic_sysfs.c mode change 100644 => 100755 include/linux/ccic/usbpd_msg.h mode change 100644 => 100755 include/linux/ifconn/ifconn_manager.h mode change 100644 => 100755 include/linux/ifconn/ifconn_notifier.h mode change 100644 => 100755 include/linux/mfd/samsung/core.h mode change 100644 => 100755 include/linux/muic/muic.h mode change 100644 => 100755 include/linux/muic/muic_interface.h mode change 100644 => 100755 include/linux/muic/muic_notifier.h mode change 100644 => 100755 include/linux/muic/muic_sysfs.h diff --git a/arch/arm64/boot/dts/exynos/exynos9609-wing.dts b/arch/arm64/boot/dts/exynos/exynos9609-wing.dts index 1735dfe3d239..f73b13f95202 100644 --- a/arch/arm64/boot/dts/exynos/exynos9609-wing.dts +++ b/arch/arm64/boot/dts/exynos/exynos9609-wing.dts @@ -219,12 +219,6 @@ samsung,pin-pud = <0>; samsung,pin-drv = <0>; }; - usbpd_irq: usbpd-irq { - samsung,pins = "gpa1-1"; - samsung,pin-function = <0xf>; - samsung,pin-pud = <3>; - samsung,pin-drv = <3>; - }; }; pinctrl@139B0000 { @@ -240,7 +234,7 @@ status = "okay"; compatible = "samsung,ifconn"; ifconn,usbpd = "s2mm005"; - ifconn,muic = "s2mu004-muic"; + ifconn,muic = "s2mu106-muic"; }; speedy@11a10000 { @@ -1950,14 +1944,21 @@ samsung,pin-pud = <0>; samsung,pin-drv = <0>; }; + + usbpd_irq: usbpd-irq { + samsung,pins = "gpa2-2"; + samsung,pin-function = <0xf>; + samsung,pin-pud = <3>; + samsung,pin-drv = <3>; + }; }; &i2c_0 { #address-cells = <1>; #size-cells = <0>; status = "okay"; - s2mu004-fuelgauge@3B { - compatible = "samsung,s2mu004-fuelgauge"; + s2mu106-fuelgauge@3B { + compatible = "samsung,s2mu106-fuelgauge"; reg = <0x3B>; pinctrl-names = "default"; pinctrl-0 = <&fuel_irq>; @@ -1970,19 +1971,49 @@ fuelgauge,type_str = "SDI"; fuelgauge,model_type = <1>; }; + + usbpd-s2mu106@3C { + compatible = "sec-usbpd,i2c"; + reg = <0x3C>; + pinctrl-names = "default"; + pinctrl-0 = <&usbpd_irq>; + usbpd,usbpd_int = <&gpa2 2 0>; + usb_sw_sel = <&gpg0 3 0>; + }; + + pdic-manager { + /* sink */ + pdic,max_power = <5000>; + pdic,op_power = <2500>; + pdic,max_voltage = <6000>; + pdic,max_current = <2000>; + pdic,min_current = <500>; + + pdic,giveback = <0>; + pdic,usb_com_capable = <1>; + pdic,no_usb_suspend = <1>; + + /* source */ + source,max_voltage = <5000>; + source,min_voltage = <4000>; + source,max_power = <2500>; + + /* sink cap */ + sink,capable_max_voltage = <9000>; + }; }; &i2c_1 { #address-cells = <1>; #size-cells = <0>; status = "okay"; - s2mu004@3d { - compatible = "samsung,s2mu004mfd"; + s2mu106@3d { + compatible = "samsung,s2mu106mfd"; reg = <0x3d>; pinctrl-names = "default"; pinctrl-0 = <&if_pmic_irq>; - s2mu004,irq-gpio = <&gpa2 1 0>; - s2mu004,wakeup; + s2mu106,irq-gpio = <&gpa2 1 0>; + s2mu106,wakeup; }; muic { @@ -1992,9 +2023,9 @@ muic,uart_txd = "gpq0-4"; }; - s2mu004-charger { + s2mu106-charger { status = "okay"; - battery,charger_name = "s2mu004-charger"; + battery,charger_name = "s2mu106-charger"; battery,chg_gpio_en = <0>; battery,chg_polarity_en = <0>; battery,chg_gpio_status = <0>; @@ -2023,38 +2054,3 @@ exynos,block-type = "sda"; exynos,fips-block_offset = <5>; }; - -&hsi2c_3 { - #address-cells = <1>; - #size-cells = <0>; - status = "okay"; - usbpd-s2mm005@33 { - compatible = "sec-s2mm005,i2c"; - reg = <0x33>; - pinctrl-names = "default"; - pinctrl-0 = <&usbpd_irq>; - interrupt-parent = <&gpa1>; - usbpd,usbpd_int = <&gpa1 1 0>; - }; - - usbpd-manager { - /* sink */ - pdic,max_power = <5000>; - pdic,op_power = <2500>; - pdic,max_voltage = <9000>; - pdic,max_current = <2000>; - pdic,min_current = <500>; - - pdic,giveback = <0>; - pdic,usb_com_capable = <1>; - pdic,no_usb_suspend = <1>; - - /* source */ - source,max_voltage = <5000>; - source,min_voltage = <4000>; - source,max_power = <2500>; - - /* sink cap */ - sink,capable_max_voltage = <9000>; - }; -}; diff --git a/arch/arm64/configs/wing_defconfig b/arch/arm64/configs/wing_defconfig index 63d79fdc1ebe..7620aa9caa44 100644 --- a/arch/arm64/configs/wing_defconfig +++ b/arch/arm64/configs/wing_defconfig @@ -211,7 +211,7 @@ CONFIG_SCSC_WIFILOGGER=y CONFIG_SCSC_BT=y CONFIG_USE_MUIC=y CONFIG_MUIC_MANAGER=y -CONFIG_MUIC_S2MU004=y +CONFIG_MUIC_S2MU106=y CONFIG_IFCONN_MANAGER=y CONFIG_IFCONN_NOTIFIER=y CONFIG_SCSI=y @@ -275,8 +275,8 @@ CONFIG_I2C_S3C2410=y CONFIG_SPI=y CONFIG_SPI_S3C64XX=y CONFIG_GPIOLIB=y -CONFIG_FUELGAUGE_S2MU004=y -CONFIG_CHARGER_S2MU004=y +CONFIG_FUELGAUGE_S2MU106=y +CONFIG_CHARGER_S2MU106=y CONFIG_BATTERY_S2MU00X=y # CONFIG_HWMON is not set CONFIG_THERMAL=y @@ -291,7 +291,7 @@ CONFIG_WATCHDOG=y CONFIG_S3C2410_WATCHDOG=y CONFIG_S3C2410_SHUTDOWN_REBOOT=y CONFIG_MFD_SEC_CORE=y -CONFIG_MFD_S2MU004=y +CONFIG_MFD_S2MU106=y CONFIG_MFD_S2MPU09=y CONFIG_MFD_S2MPB02=y CONFIG_REGULATOR_FIXED_VOLTAGE=y @@ -474,10 +474,9 @@ CONFIG_PWM_SAMSUNG=y CONFIG_PHY_EXYNOS8895_MIPI=y CONFIG_ANDROID=y CONFIG_ANDROID_BINDER_IPC=y -CONFIG_USBPD_CORE=y -CONFIG_USBPD_S2MM005=y -CONFIG_USBPD_ALTERNATE_MODE=y -CONFIG_CCIC_LPM_ENABLE=y +CONFIG_USE_CCIC=y +CONFIG_CCIC_S2MU106=y +CONFIG_CCIC_VDM=y CONFIG_EXT2_FS=y CONFIG_EXT3_FS=y CONFIG_EXT4_FS_SECURITY=y diff --git a/drivers/Makefile b/drivers/Makefile index e0ba375cc3f5..e0d2af38bc99 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -198,3 +198,4 @@ obj-$(CONFIG_USBPD_CORE) += ccic/ obj-$(CONFIG_VISION_SUPPORT) += vision/ +obj-$(CONFIG_USE_CCIC) += ccic/ diff --git a/drivers/ccic/Kconfig b/drivers/ccic/Kconfig old mode 100644 new mode 100755 index dc2139f28b8e..0351ca7fbd6d --- a/drivers/ccic/Kconfig +++ b/drivers/ccic/Kconfig @@ -1,64 +1,56 @@ # -# CCIC devices +# USB PD driver # -comment "CCIC configs" +comment "USB PD configs" -config USBPD_CORE - bool "CCIC framrework core" +config USE_CCIC + bool "Using USBPD device driver" depends on I2C default n help If you say yes here you will get support for - ccic core device + the USB PD(Power Delivery) device driver. -config CCIC_NOTIFIER - bool "CCIC notifier support" - depends on I2C +config CCIC_S2MU004 + bool "Using S2MU004 USB PD" + depends on USE_CCIC default n help If you say yes here you will get support for - the CCIC attached device status change notification. + for the S2MU004 USBPD chip. -config CCIC_S2MM003 - bool "CCIC S2MM003" - depends on I2C +config CCIC_S2MU106 + bool "Using S2MU106 USB PD" + depends on USE_CCIC default n help If you say yes here you will get support for - s2mm003 ccic full version chipset + for the S2MU106 USBPD chip. -config CCIC_S2MM005 - bool "CCIC S2MM005" - depends on I2C +config CCIC_VDM + bool "Using S2MU004 USB PD VDM Message" + depends on USE_CCIC default n help If you say yes here you will get support for - s2mm005 ccic full version chipset + for the S2MU004 USBPD chip. -config USBPD_S2MM005 - bool "USBPD S2MM005" - depends on USBPD_CORE +config CCIC_S2MM005 + bool "CCIC S2MM005" + depends on I2C default n help If you say yes here you will get support for - s2mm005 ccic full version chipset - -config CCIC_MAX77705 - bool "CCIC 77705" + s2mm005 ccic full version chipset + +config CCIC_NOTIFIER + bool "CCIC notifier support" depends on I2C default n help If you say yes here you will get support for - max77705 ccic full version chipset - -config CCIC_MAX77705_DEBUG - bool "CCIC 77705 DEBUG" - depends on CCIC_MAX77705 - default n - help - If you say yes here you will get support for - debugging feature with max77705 ccic chipset + the CCIC attached device status change notification. config CCIC_ALTERNATE_MODE bool "support CCIC alternate mode" @@ -68,17 +60,9 @@ config CCIC_ALTERNATE_MODE If you say yes here you will get support for alternate mode -config USBPD_ALTERNATE_MODE - bool "support USBPD alternate mode" - depends on I2C - default n - help - If you say yes here you will get support for - alternate mode - config CCIC_LPM_ENABLE bool "Support LPM ENABLE" - depends on I2C + depends on CCIC_S2MM005 default n help If you say yes here you will get support for @@ -91,3 +75,4 @@ config CCIC_WATER_DETECT help If you say yes here you will get support for water detect Enable + diff --git a/drivers/ccic/Makefile b/drivers/ccic/Makefile old mode 100644 new mode 100755 index 5c422fc5620a..e7d876a00dcd --- a/drivers/ccic/Makefile +++ b/drivers/ccic/Makefile @@ -1,16 +1,12 @@ # -# Makefile for ccic devices +# Makefile for usbpd devices # -obj-$(CONFIG_USBPD_CORE) += usbpd-core.o usbpd-manager.o usbpd-dual-role.o -obj-$(CONFIG_CCIC_NOTIFIER) += ccic_notifier.o ccic_sysfs.o ccic_core.o ccic_misc.o -obj-$(CONFIG_CCIC_ALTERNATE_MODE) += ccic_alternate.o -obj-$(CONFIG_CCIC_S2MM003) += s2mm003.o -obj-$(CONFIG_CCIC_S2MM005) += s2mm005_fw.o s2mm005_cc.o s2mm005_pd.o sec_pd.o s2mm005.o -obj-$(CONFIG_CCIC_MAX77705) += max77705_cc.o max77705_pd.o sec_pd.o max77705_usbc.o max77705_alternate.o -obj-$(CONFIG_CCIC_MAX77705_DEBUG) += max77705_debug.o -obj-$(CONFIG_USBPD_S2MM005) += s2mm005_usbpd_fw.o s2mm005_usbpd_phy.o s2mm005_usbpd.o s2mm005_usbpd_i2c.o s2mm005_usbpd_interface.o usbpd_sysfs.o -obj-$(CONFIG_CCIC_S2MU106) += s2mu106-usbpd.o -obj-$(CONFIG_USE_CCIC) += usbpd.o usbpd_cc.o -obj-$(CONFIG_USE_CCIC) += usbpd_policy.o usbpd_manager.o +obj-$(CONFIG_CCIC_S2MU004) += s2mu004-usbpd.o +obj-$(CONFIG_CCIC_S2MU106) += s2mu106-usbpd.o +obj-$(CONFIG_USE_CCIC) += usbpd.o usbpd_cc.o +obj-$(CONFIG_USE_CCIC) += usbpd_policy.o usbpd_manager.o +obj-$(CONFIG_CCIC_S2MM005) += s2mm005_fw.o s2mm005_cc.o s2mm005_pd.o s2mm005.o +obj-$(CONFIG_CCIC_NOTIFIER) += ccic_notifier.o ccic_sysfs.o +obj-$(CONFIG_CCIC_ALTERNATE_MODE) += ccic_alternate.o ccic_misc.o obj-$(CONFIG_CCIC_SYSFS) += usbpd_sysfs.o diff --git a/drivers/ccic/s2mu106-usbpd.c b/drivers/ccic/s2mu106-usbpd.c index 327a427e0c90..f1c1c4c2a4bd 100644 --- a/drivers/ccic/s2mu106-usbpd.c +++ b/drivers/ccic/s2mu106-usbpd.c @@ -120,6 +120,7 @@ static void s2mu106_usbpd_test_read(struct s2mu106_usbpd_data *usbpd_data) data[5], data[6], data[7], data[8]); } +#if defined(CONFIG_DUAL_ROLE_USB_INTF) void s2mu106_rprd_mode_change(struct s2mu106_usbpd_data *usbpd_data, u8 mode) { u8 data = 0; @@ -175,6 +176,7 @@ void s2mu106_rprd_mode_change(struct s2mu106_usbpd_data *usbpd_data, u8 mode) skip: mutex_unlock(&usbpd_data->_mutex); } +#endif void usbpd_charger_test_read(struct s2mu106_usbpd_data *usbpd_data) { diff --git a/drivers/ifconn/ifconn_manager.c b/drivers/ifconn/ifconn_manager.c old mode 100644 new mode 100755 diff --git a/drivers/ifconn/ifconn_notifier.c b/drivers/ifconn/ifconn_notifier.c old mode 100644 new mode 100755 index 6203c50be444..3c8c607ae376 --- a/drivers/ifconn/ifconn_notifier.c +++ b/drivers/ifconn/ifconn_notifier.c @@ -31,9 +31,7 @@ static struct ifconn_notifier pnoti[IFCONN_NOTIFY_MAX]; void _ifconn_show_attr(struct ifconn_notifier_template *t) { - if (t == NULL) - return; - + if (t == NULL) return; pr_info("%s, src:%s, dest:%s, id:%d, event:%d, data:0x%p\n", __func__, IFCONN_NOTI_DEV_Print[t->src], IFCONN_NOTI_DEV_Print[t->dest], t->id, t->event, t->data); } diff --git a/drivers/muic/Kconfig b/drivers/muic/Kconfig old mode 100644 new mode 100755 index cb8540c6dc88..f782d8f72634 --- a/drivers/muic/Kconfig +++ b/drivers/muic/Kconfig @@ -92,6 +92,13 @@ config MUIC_S2MU004 help If you say yes here you will get support for the S2MU004 MUIC chip. +config MUIC_S2MU106 + bool "Using S2MU106 MUIC" + depends on USE_MUIC + default n + help + If you say yes here you will get support for the S2MU106 MUIC chip. + config MUIC_S2MU004_HV bool "Using S2MU004 MUIC High Voltage Charging" depends on MUIC_S2MU004 diff --git a/drivers/muic/Makefile b/drivers/muic/Makefile old mode 100644 new mode 100755 diff --git a/drivers/muic/muic_core.c b/drivers/muic/muic_core.c old mode 100644 new mode 100755 diff --git a/drivers/muic/muic_manager.c b/drivers/muic/muic_manager.c old mode 100644 new mode 100755 diff --git a/drivers/muic/muic_notifier.c b/drivers/muic/muic_notifier.c old mode 100644 new mode 100755 diff --git a/drivers/muic/muic_sysfs.c b/drivers/muic/muic_sysfs.c old mode 100644 new mode 100755 diff --git a/include/linux/ccic/usbpd_msg.h b/include/linux/ccic/usbpd_msg.h old mode 100644 new mode 100755 diff --git a/include/linux/ifconn/ifconn_manager.h b/include/linux/ifconn/ifconn_manager.h old mode 100644 new mode 100755 diff --git a/include/linux/ifconn/ifconn_notifier.h b/include/linux/ifconn/ifconn_notifier.h old mode 100644 new mode 100755 index c5ed3f3737d6..f38a06a35872 --- a/include/linux/ifconn/ifconn_notifier.h +++ b/include/linux/ifconn/ifconn_notifier.h @@ -115,7 +115,7 @@ typedef enum { } ifconn_notifier_event_t; typedef enum { - IFCONN_NOTIFY_DP_PIN_UNKNOWN = 0, + IFCONN_NOTIFY_DP_PIN_UNKNOWN =0, IFCONN_NOTIFY_DP_PIN_A, IFCONN_NOTIFY_DP_PIN_B, IFCONN_NOTIFY_DP_PIN_C, diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h old mode 100644 new mode 100755 diff --git a/include/linux/muic/muic.h b/include/linux/muic/muic.h old mode 100644 new mode 100755 diff --git a/include/linux/muic/muic_interface.h b/include/linux/muic/muic_interface.h old mode 100644 new mode 100755 diff --git a/include/linux/muic/muic_notifier.h b/include/linux/muic/muic_notifier.h old mode 100644 new mode 100755 diff --git a/include/linux/muic/muic_sysfs.h b/include/linux/muic/muic_sysfs.h old mode 100644 new mode 100755 -- 2.20.1