Skip to content

Commit 3fb7a86

Browse files
Stritayufan
authored andcommitted
arm64: dts: update pinebook-pro dts
This patch includes the following: Pinebook Pro DTS fixes rk3399 USB-C fixes Pinebook Pro audio fix Signed-off-by: Dan Johansen <[email protected]> Revert part of pbp-support sound/soc/soc-jack.c 0dbe662
1 parent 6b97bec commit 3fb7a86

File tree

4 files changed

+109
-9
lines changed

4 files changed

+109
-9
lines changed

arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
stdout-path = "serial2:1500000n8";
2929
};
3030

31+
memory {
32+
device_type = "memory";
33+
reg = <0x0 0x00200000 0x0 0xf7e00000>;
34+
};
35+
3136
backlight: edp-backlight {
3237
compatible = "pwm-backlight";
3338
power-supply = <&vcc_12v>;
@@ -128,6 +133,12 @@
128133
reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
129134
};
130135

136+
/* first 128k(0xff8d0000~0xff8f0000) for ddr and ATF */
137+
sram@ff8d0000 {
138+
compatible = "mmio-sram";
139+
reg = <0x0 0xff8d0000 0x0 0x20000>; /* 128k */
140+
};
141+
131142
/* Audio components */
132143
es8316-sound {
133144
compatible = "simple-audio-card";
@@ -375,6 +386,11 @@
375386
};
376387
};
377388

389+
&cdn_dp {
390+
status = "okay";
391+
extcon = <&fusb0>;
392+
};
393+
378394
&cpu_b0 {
379395
cpu-supply = <&vdd_cpu_b>;
380396
};
@@ -705,6 +721,9 @@
705721
<PDO_FIXED(5000, 1400, PDO_FIXED_USB_COMM)>;
706722
try-power-role = "sink";
707723

724+
extcon-cables = <1 2 5 6 9 10 12 44>;
725+
typec-altmodes = <0xff01 1 0x001c0c00 1>;
726+
708727
ports {
709728
#address-cells = <1>;
710729
#size-cells = <0>;
@@ -970,6 +989,7 @@
970989
};
971990

972991
&tcphy0 {
992+
extcon = <&fusb0>;
973993
status = "okay";
974994
};
975995

drivers/phy/rockchip/phy-rockchip-typec.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <linux/clk-provider.h>
4141
#include <linux/delay.h>
4242
#include <linux/extcon.h>
43+
#include <linux/extcon-provider.h>
4344
#include <linux/io.h>
4445
#include <linux/iopoll.h>
4546
#include <linux/kernel.h>
@@ -1156,6 +1157,22 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev)
11561157
dev_err(dev, "Invalid or missing extcon\n");
11571158
return PTR_ERR(tcphy->extcon);
11581159
}
1160+
} else {
1161+
extcon_set_property_capability(tcphy->extcon, EXTCON_USB,
1162+
EXTCON_PROP_USB_SS);
1163+
extcon_set_property_capability(tcphy->extcon, EXTCON_USB_HOST,
1164+
EXTCON_PROP_USB_SS);
1165+
extcon_set_property_capability(tcphy->extcon, EXTCON_DISP_DP,
1166+
EXTCON_PROP_USB_SS);
1167+
extcon_set_property_capability(tcphy->extcon, EXTCON_USB,
1168+
EXTCON_PROP_USB_TYPEC_POLARITY);
1169+
extcon_set_property_capability(tcphy->extcon, EXTCON_USB_HOST,
1170+
EXTCON_PROP_USB_TYPEC_POLARITY);
1171+
extcon_set_property_capability(tcphy->extcon, EXTCON_DISP_DP,
1172+
EXTCON_PROP_USB_TYPEC_POLARITY);
1173+
extcon_sync(tcphy->extcon, EXTCON_USB);
1174+
extcon_sync(tcphy->extcon, EXTCON_USB_HOST);
1175+
extcon_sync(tcphy->extcon, EXTCON_DISP_DP);
11591176
}
11601177

11611178
pm_runtime_enable(dev);

drivers/usb/typec/altmodes/displayport.c

Lines changed: 71 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
*/
1010

1111
#include <linux/delay.h>
12+
#include <linux/extcon.h>
13+
#include <linux/extcon-provider.h>
1214
#include <linux/mutex.h>
1315
#include <linux/module.h>
1416
#include <linux/property.h>
@@ -182,11 +184,58 @@ static int dp_altmode_status_update(struct dp_altmode *dp)
182184
return ret;
183185
}
184186

187+
static void dp_altmode_update_extcon(struct dp_altmode *dp, bool disconnect) {
188+
const struct device *dev = &dp->port->dev;
189+
struct extcon_dev* edev = NULL;
190+
191+
while (dev) {
192+
edev = extcon_find_edev_by_node(dev->of_node);
193+
if(!IS_ERR(edev)) {
194+
break;
195+
}
196+
dev = dev->parent;
197+
}
198+
199+
if (IS_ERR_OR_NULL(edev)) {
200+
return;
201+
}
202+
203+
if (disconnect || !dp->data.conf) {
204+
extcon_set_state_sync(edev, EXTCON_DISP_DP, false);
205+
} else {
206+
union extcon_property_value extcon_true = { .intval = true };
207+
extcon_set_state(edev, EXTCON_DISP_DP, true);
208+
if (DP_CONF_GET_PIN_ASSIGN(dp->data.conf) & DP_PIN_ASSIGN_MULTI_FUNC_MASK) {
209+
extcon_set_state_sync(edev, EXTCON_USB_HOST, true);
210+
extcon_set_property(edev, EXTCON_DISP_DP, EXTCON_PROP_USB_SS,
211+
extcon_true);
212+
} else {
213+
extcon_set_state_sync(edev, EXTCON_USB_HOST, false);
214+
}
215+
extcon_sync(edev, EXTCON_DISP_DP);
216+
extcon_set_state_sync(edev, EXTCON_USB, false);
217+
}
218+
219+
}
220+
185221
static int dp_altmode_configured(struct dp_altmode *dp)
186222
{
187223
int ret;
188224

189225
sysfs_notify(&dp->alt->dev.kobj, "displayport", "configuration");
226+
227+
if (!dp->data.conf) {
228+
dp_altmode_update_extcon(dp, true);
229+
return typec_altmode_notify(dp->alt, TYPEC_STATE_USB,
230+
&dp->data);
231+
}
232+
233+
dp_altmode_update_extcon(dp, false);
234+
235+
ret = dp_altmode_notify(dp);
236+
if (ret)
237+
return ret;
238+
190239
sysfs_notify(&dp->alt->dev.kobj, "displayport", "pin_assignment");
191240
/*
192241
* If the DFP_D/UFP_D sends a change in HPD when first notifying the
@@ -200,7 +249,7 @@ static int dp_altmode_configured(struct dp_altmode *dp)
200249
dp->pending_hpd = false;
201250
}
202251

203-
return dp_altmode_notify(dp);
252+
return 0;
204253
}
205254

206255
static int dp_altmode_configure_vdm(struct dp_altmode *dp, u32 conf)
@@ -221,8 +270,15 @@ static int dp_altmode_configure_vdm(struct dp_altmode *dp, u32 conf)
221270
}
222271

223272
ret = typec_altmode_vdm(dp->alt, header, &conf, 2);
224-
if (ret)
225-
dp_altmode_notify(dp);
273+
if (ret) {
274+
if (DP_CONF_GET_PIN_ASSIGN(dp->data.conf))
275+
dp_altmode_notify(dp);
276+
else {
277+
dp_altmode_update_extcon(dp, true);
278+
typec_altmode_notify(dp->alt, TYPEC_STATE_USB,
279+
&dp->data);
280+
}
281+
}
226282

227283
return ret;
228284
}
@@ -300,6 +356,8 @@ static void dp_altmode_work(struct work_struct *work)
300356
case DP_STATE_EXIT:
301357
if (typec_altmode_exit(dp->alt))
302358
dev_err(&dp->alt->dev, "Exit Mode Failed!\n");
359+
else
360+
dp_altmode_update_extcon(dp, true);
303361
break;
304362
case DP_STATE_EXIT_PRIME:
305363
if (typec_cable_altmode_exit(dp->plug_prime, TYPEC_PLUG_SOP_P))
@@ -734,12 +792,17 @@ int dp_altmode_probe(struct typec_altmode *alt)
734792

735793
/* FIXME: Port can only be DFP_U. */
736794

737-
/* Make sure we have compatible pin configurations */
738-
if (!(DP_CAP_PIN_ASSIGN_DFP_D(port->vdo) &
739-
DP_CAP_PIN_ASSIGN_UFP_D(alt->vdo)) &&
740-
!(DP_CAP_PIN_ASSIGN_UFP_D(port->vdo) &
741-
DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo)))
795+
/* Make sure we have compatiple pin configurations */
796+
if (!(DP_CAP_DFP_D_PIN_ASSIGN(port->vdo) &
797+
DP_CAP_UFP_D_PIN_ASSIGN(alt->vdo)) &&
798+
!(DP_CAP_UFP_D_PIN_ASSIGN(port->vdo) &
799+
DP_CAP_DFP_D_PIN_ASSIGN(alt->vdo))) {
800+
dev_err(&alt->dev, "No compatible pin configuration found:"\
801+
"%04lx -> %04lx, %04lx <- %04lx",
802+
DP_CAP_DFP_D_PIN_ASSIGN(port->vdo), DP_CAP_UFP_D_PIN_ASSIGN(alt->vdo),
803+
DP_CAP_UFP_D_PIN_ASSIGN(port->vdo), DP_CAP_DFP_D_PIN_ASSIGN(alt->vdo));
742804
return -ENODEV;
805+
}
743806

744807
dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL);
745808
if (!dp)

sound/soc/codecs/es8316.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ static void es8316_disable_jack_detect(struct snd_soc_component *component)
732732
snd_soc_component_update_bits(component, ES8316_GPIO_DEBOUNCE,
733733
ES8316_GPIO_ENABLE_INTERRUPT, 0);
734734

735-
if (es8316->jack->status & SND_JACK_MICROPHONE) {
735+
if (es8316->jack && (es8316->jack->status & SND_JACK_MICROPHONE)) {
736736
es8316_disable_micbias_for_mic_gnd_short_detect(component);
737737
snd_soc_jack_report(es8316->jack, 0, SND_JACK_BTN_0);
738738
}

0 commit comments

Comments
 (0)