Skip to content
78 changes: 72 additions & 6 deletions arch/arm64/boot/dts/freescale/imx8mp-mecha-comet.dts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/dts-v1/;

//#include <dt-bindings/phy/phy-imx8-pcie.h>
#include <dt-bindings/phy/phy-imx8-pcie.h>
#include <dt-bindings/pwm/pwm.h>
#include <dt-bindings/usb/pd.h>
#include "imx8mp.dtsi"
Expand Down Expand Up @@ -79,8 +79,8 @@
"IN1", "MICBIAS",
"MIC1","IN1",
"MIC2","IN1",
"Speakers", "SPKL",
"Speakers", "SPKR",
//"Speakers", "SPKL",
//"Speakers", "SPKR",

/* DMIC-3 Routings */
"DMICL", "DMIC Mux",
Expand Down Expand Up @@ -143,6 +143,19 @@
};
};

usb_pwr_mux: ptn36043_2 {
compatible = "nxp,ptn36043";
pinctrl-names = "default";
switch-gpios = <&gpio4 1 GPIO_ACTIVE_LOW>;
orientation-switch;

port {
usb_pwr_sw_ep: endpoint {
remote-endpoint = <&usb_pwr_sw_ss>;
};
};
};

Home-button {
compatible = "gpio-keys";

Expand Down Expand Up @@ -216,8 +229,12 @@
&usb_dwc3_0 {
status = "okay";
dr_mode = "otg";
role-switch-default-mode = "none";
usb-role-switch;
port {
usb0_pwr_ep: endpoint {
remote-endpoint = <&usb_pwr_ep>;
};
};
};

&usb3_phy1 {
Expand Down Expand Up @@ -375,6 +392,7 @@
touchctl: focaltech@38 {
compatible = "focaltech,fts";
reg = <0x38>;
wakeup-source;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_touch_i2c>;
interrupt-parent = <&gpio4>;
Expand Down Expand Up @@ -481,12 +499,14 @@
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai3>;
pinctrl-1 = <&pinctrl_codec>;
compatible = "maxim,max98091";
reg = <0x10>;
clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1>;
interrupt-parent = <&gpio1>;
interrupts = <8 IRQ_TYPE_LEVEL_LOW>; /* SODIMM_218 */
interrupt-parent = <&gpio4>;
interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
clock-names = "mclk";
status = "okay";
};

bq27441: fuel-gauge@55 {
Expand Down Expand Up @@ -555,6 +575,24 @@
self-powered;
data-role = "dual";
power-role = "dual";
ports {
#address-cells = <1>;
#size-cells = <0>;

port@0 {
reg = <0>;
usb_pwr_ep: endpoint {
remote-endpoint = <&usb0_pwr_ep>;
};
};

port@1 {
reg = <1>;
usb_pwr_sw_ss: endpoint {
remote-endpoint = <&usb_pwr_sw_ep>;
};
};
};
};
};

Expand Down Expand Up @@ -743,6 +781,20 @@
};
};

&pcie_phy {
fsl,refclk-pad-mode = <IMX8_PCIE_REFCLK_PAD_OUTPUT>;
clocks = <&hsio_blk_ctrl>;
clock-names = "ref";
status = "okay";
};

&pcie {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pcie0>;
reset-gpio = <&gpio1 24 GPIO_ACTIVE_LOW>;
status = "okay";
};

&sai3 {
#sound-dai-cells = <0>;
assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
Expand Down Expand Up @@ -794,6 +846,7 @@

&iomuxc {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hog>;

pinctrl_i2c1: i2c1grp {
fsl,pins = <
Expand Down Expand Up @@ -1114,4 +1167,17 @@
MX8MP_IOMUXC_HDMI_CEC__HDMIMIX_HDMI_CEC 0x40000010
>;
};

pinctrl_codec: codecgrp {
fsl,pins = <
MX8MP_IOMUXC_SAI1_TXD3__GPIO4_IO15 0x1c4
>;
};

pinctrl_pcie0: pci0grp {
fsl,pins = <
MX8MP_IOMUXC_ENET_RX_CTL__GPIO1_IO24 0x1c4
MX8MP_IOMUXC_UART4_RXD__PCIE_CLKREQ_B 0x1c4
>;
};
};
22 changes: 19 additions & 3 deletions arch/arm64/configs/mecha_v8_defconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
CONFIG_AUDIT=y

CONFIG_NO_HZ_IDLE=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_BPF_SYSCALL=y
Expand Down Expand Up @@ -917,7 +917,7 @@ CONFIG_BCM_SBA_RAID=m
CONFIG_FSL_EDMA=y
CONFIG_FSL_QDMA=m
CONFIG_FSL_EDMA_V3=y
CONFIG_IMX_SDMA=y

CONFIG_MV_XOR_V2=y
CONFIG_MXS_DMA=y
CONFIG_MXC_PXP_V3=y
Expand Down Expand Up @@ -1230,7 +1230,7 @@ CONFIG_BLK_DEV_RAM_SIZE=1020000

CONFIG_U_SERIAL_CONSOLE=y
CONFIG_USB_MASS_STORAGE=y
CONFIG_IMX_SDMA=n


# MIPI DSI Display
CONFIG_DRM_DISPLAY_CONNECTOR=y
Expand Down Expand Up @@ -1267,7 +1267,23 @@ CONFIG_TYPEC_TPS6598X=y
CONFIG_TRACING=y
CONFIG_EXTCON_USBC_TUSB320=y

# NXP wifi driver
CONFIG_MWIFIEX=m

CONFIG_MXC_GPU_VIV=n
CONFIG_DRM_ETNAVIV=y

# disable audit logs
CONFIG_AUDIT=n

CONFIG_ANDROID_BINDER_IPC=y
CONFIG_PSI=y
CONFIG_PSI_DEFAULT_DISABLED=n
CONFIG_MEMCG_SWAP=y
CONFIG_MEMCG_KMEM=y
CONFIG_SLUB_MEMCG_SYSFS_ON=y
CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDERFS=y
CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder,anbox-binder,anbox-hwbinder,anbox-vndbinder"

7 changes: 4 additions & 3 deletions drivers/usb/typec/tipd/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,8 @@ static int tps6598x_probe(struct i2c_client *client)
tps->role_sw = fwnode_usb_role_switch_get(fwnode);
if (IS_ERR(tps->role_sw)) {
ret = PTR_ERR(tps->role_sw);
goto err_fwnode_put;
//goto err_fwnode_put;
return ret;
}

ret = devm_tps6598_psy_register(tps);
Expand Down Expand Up @@ -1443,8 +1444,8 @@ static int tps6598x_probe(struct i2c_client *client)
typec_unregister_port(tps->port);
err_role_put:
usb_role_switch_put(tps->role_sw);
err_fwnode_put:
fwnode_handle_put(fwnode);
//err_fwnode_put:
// fwnode_handle_put(fwnode);
err_clear_mask:
tps6598x_write64(tps, TPS_REG_INT_MASK1, 0);
err_reset_controller:
Expand Down
45 changes: 38 additions & 7 deletions sound/soc/codecs/max98090.c
Original file line number Diff line number Diff line change
Expand Up @@ -1211,10 +1211,10 @@ static const struct snd_soc_dapm_widget max98090_dapm_widgets[] = {
SND_SOC_DAPM_PGA("HP Right Out", M98090_REG_OUTPUT_ENABLE,
M98090_HPREN_SHIFT, 0, NULL, 0),

SND_SOC_DAPM_PGA("SPK Left Out", M98090_REG_OUTPUT_ENABLE,
M98090_SPLEN_SHIFT, 0, NULL, 0),
SND_SOC_DAPM_PGA("SPK Right Out", M98090_REG_OUTPUT_ENABLE,
M98090_SPREN_SHIFT, 0, NULL, 0),
// SND_SOC_DAPM_PGA("SPK Left Out", M98090_REG_OUTPUT_ENABLE,
// M98090_SPLEN_SHIFT, 0, NULL, 0),
// SND_SOC_DAPM_PGA("SPK Right Out", M98090_REG_OUTPUT_ENABLE,
// M98090_SPREN_SHIFT, 0, NULL, 0),

SND_SOC_DAPM_PGA("RCV Left Out", M98090_REG_OUTPUT_ENABLE,
M98090_RCVLEN_SHIFT, 0, NULL, 0),
Expand All @@ -1223,8 +1223,8 @@ static const struct snd_soc_dapm_widget max98090_dapm_widgets[] = {

SND_SOC_DAPM_OUTPUT("HPL"),
SND_SOC_DAPM_OUTPUT("HPR"),
SND_SOC_DAPM_OUTPUT("SPKL"),
SND_SOC_DAPM_OUTPUT("SPKR"),
// SND_SOC_DAPM_OUTPUT("SPKL"),
// SND_SOC_DAPM_OUTPUT("SPKR"),
SND_SOC_DAPM_OUTPUT("RCVL"),
SND_SOC_DAPM_OUTPUT("RCVR"),
};
Expand Down Expand Up @@ -2152,7 +2152,7 @@ static void max98090_jack_work(struct work_struct *work)
struct snd_soc_component *component = max98090->component;
int status = 0;
int reg;

unsigned int value = 0;
/* Read a second time */
if (max98090->jack_state == M98090_JACK_STATE_NO_HEADSET) {

Expand Down Expand Up @@ -2224,6 +2224,37 @@ static void max98090_jack_work(struct work_struct *work)
break;
}

/* Headphone & Headset Detection logic */

if (status & (SND_JACK_HEADSET | SND_JACK_HEADPHONE)) {
dev_dbg(component->dev,"TURN OFF SPEAKER O/P\n");

regmap_read(max98090->regmap,M98090_REG_OUTPUT_ENABLE, &value);

dev_info(component->dev,"OUTPUT Register Value : 0x%x\n",value);

value = (value &
~(M98090_SPLEN_MASK | M98090_SPREN_MASK)) |
(M98090_HPLEN_MASK | M98090_HPREN_MASK) ;

regmap_write(max98090->regmap,M98090_REG_OUTPUT_ENABLE,value);

dev_info(component->dev,"Speaker outputs disabled. New value: 0x%x\n", value);
}

if (status == 0) {
regmap_read(max98090->regmap,M98090_REG_OUTPUT_ENABLE, &value);

if ((value & (M98090_SPLEN_MASK | M98090_SPREN_MASK)) == 0) {
value |= (M98090_SPLEN_MASK | M98090_SPREN_MASK);

regmap_write(max98090->regmap,M98090_REG_OUTPUT_ENABLE,
value);
dev_info(component->dev,"Speakers enabled. OUTPUT_ENABLE = 0x%x\n", value);
}
}
/**************************************/

snd_soc_jack_report(max98090->jack, status,
SND_JACK_HEADSET | SND_JACK_BTN_0);
}
Expand Down