Skip to contentSkip to conversation

intel_cht_int33fe: Split code to USB Micro-B and Type-C variants

PATCH RESEND New Yauhen Kharuzhy 1 participant 2 messages Oct 5, 2019 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

v5 cover intel_cht_int33fe: Split code to USB Micro-B and Type-C variants

Patch to support INT33FE ACPI pseudo-device on hardware with USB Micro-B connector.

v5:
- Spelling corrections in Kconfig, commit description and comments;
- Micro-B code: Remove warning at fuel gauge registration failure and use PTR_ERR_OR_ZERO() for simplicity.

v4:
- Micro-B variant: Don't print error to the kernel log if i2c_acpi_new_device() has returned -EPROBE_DEFER.

v3:
- Rename TypeB variant to Micro-B (we have only one such device for now and it has Micro-B connector)
- Rebase on current linus/master
- Remove empty lines and replace "TypeC" by "Type-C"

v2:
Instead of defining two separated modules with two separated config options, compile {common,typeb,typec} sources into one .ko module. Call needed variant-specific probe function based after of hardware type detection in common code.

Yauhen Kharuzhy (1):
platform/x86/intel_cht_int33fe: Split code to USB Micro-B and Type-C
variants

 drivers/platform/x86/Kconfig                  |  10 +-
 drivers/platform/x86/Makefile                 |   4 +
 .../platform/x86/intel_cht_int33fe_common.c   | 147 ++++++++++++++++++
 .../platform/x86/intel_cht_int33fe_common.h   |  41 +++++
 .../platform/x86/intel_cht_int33fe_microb.c   |  57 +++++++
 ...ht_int33fe.c => intel_cht_int33fe_typec.c} |  78 +---------
 6 files changed, 265 insertions(+), 72 deletions(-)
 create mode 100644 drivers/platform/x86/intel_cht_int33fe_common.c
 create mode 100644 drivers/platform/x86/intel_cht_int33fe_common.h
 create mode 100644 drivers/platform/x86/intel_cht_int33fe_microb.c
 rename drivers/platform/x86/{intel_cht_int33fe.c => intel_cht_int33fe_typec.c} (82%)
Signature · 1 line
2.23.0.rc1
#1 lore raw

PATCH RESEND v5 1/1 platform/x86/intel_cht_int33fe: Split code to USB Micro-B and Type-C variants

Existing intel_cht_int33fe ACPI pseudo-device driver assumes that hardware has Type-C connector and register related devices described as I2C connections in the _CRS resource.

There is at least one hardware (Lenovo Yoga Book YB1-91L/F) with Micro-B USB connector exists. It has INT33FE device in the DSDT table but there are only two I2C connection described: PMIC and BQ27452 battery fuel gauge.

Splitting existing INT33FE driver allow to maintain code for USB Micro-B (or AB) connector variant separately and make it simpler.

Split driver to intel_cht_int33fe_common.c and intel_cht_int33fe_{microb,typec}.c. Compile all this sources to one .ko module to make user experience easier.

---
 drivers/platform/x86/Kconfig                  |  10 +-
 drivers/platform/x86/Makefile                 |   4 +
 .../platform/x86/intel_cht_int33fe_common.c   | 147 ++++++++++++++++++
 .../platform/x86/intel_cht_int33fe_common.h   |  41 +++++
 .../platform/x86/intel_cht_int33fe_microb.c   |  57 +++++++
 ...ht_int33fe.c => intel_cht_int33fe_typec.c} |  78 +---------
 6 files changed, 265 insertions(+), 72 deletions(-)
 create mode 100644 drivers/platform/x86/intel_cht_int33fe_common.c
 create mode 100644 drivers/platform/x86/intel_cht_int33fe_common.h
 create mode 100644 drivers/platform/x86/intel_cht_int33fe_microb.c
 rename drivers/platform/x86/{intel_cht_int33fe.c => intel_cht_int33fe_typec.c} (82%)
drivers/platform/x86/Kconfig +8 -2
index 1b67bb578f9f..e9e5aa791caf 100644
@@ -930,14 +930,20 @@ config INTEL_CHT_INT33FE
 	  This driver add support for the INT33FE ACPI device found on
 	  some Intel Cherry Trail devices.
 
+	  There are two kinds of INT33FE ACPI device possible: for hardware
+	  with USB Type-C and Micro-B connectors. This driver supports both.
+
 	  The INT33FE ACPI device has a CRS table with I2cSerialBusV2
-	  resources for 3 devices: Maxim MAX17047 Fuel Gauge Controller,
+	  resources for Fuel Gauge Controller and (in the Type-C variant)
 	  FUSB302 USB Type-C Controller and PI3USB30532 USB switch.
 	  This driver instantiates i2c-clients for these, so that standard
 	  i2c drivers for these chips can bind to the them.
 
 	  If you enable this driver it is advised to also select
-	  CONFIG_TYPEC_FUSB302=m and CONFIG_BATTERY_MAX17042=m.
+	  CONFIG_BATTERY_BQ27XXX=m or CONFIG_BATTERY_BQ27XXX_I2C=m for Micro-B
+	  device and CONFIG_TYPEC_FUSB302=m and CONFIG_BATTERY_MAX17042=m
+	  for Type-C device.
+
 
 config INTEL_INT0002_VGPIO
 	tristate "Intel ACPI INT0002 Virtual GPIO driver"
drivers/platform/x86/Makefile +4 -0
index 415104033060..216d3b6fd6a7 100644
@@ -61,6 +61,10 @@ obj-$(CONFIG_TOSHIBA_BT_RFKILL)	+= toshiba_bluetooth.o
 obj-$(CONFIG_TOSHIBA_HAPS)	+= toshiba_haps.o
 obj-$(CONFIG_TOSHIBA_WMI)	+= toshiba-wmi.o
 obj-$(CONFIG_INTEL_CHT_INT33FE)	+= intel_cht_int33fe.o
+intel_cht_int33fe-objs		:= intel_cht_int33fe_common.o \
+				   intel_cht_int33fe_typec.o \
+				   intel_cht_int33fe_microb.o
+
 obj-$(CONFIG_INTEL_INT0002_VGPIO) += intel_int0002_vgpio.o
 obj-$(CONFIG_INTEL_HID_EVENT)	+= intel-hid.o
 obj-$(CONFIG_INTEL_VBTN)	+= intel-vbtn.o
drivers/platform/x86/intel_cht_int33fe_common.c new file +147 -0

147 lines not on this page · raw message

drivers/platform/x86/intel_cht_int33fe_common.h new file +41 -0

41 lines not on this page · raw message

drivers/platform/x86/intel_cht_int33fe_microb.c new file +57 -0

57 lines not on this page · raw message

drivers/platform/x86/intel_cht_int33fe_typec.c renamed from drivers/platform/x86/intel_cht_int33fe.c +8 -70

143 lines not on this page · raw message

Signature · 1 line
2.23.0.rc1