Re: OpenBSD -current on T495

2019-11-20 Thread Thomas de Grivel
With latest snapshot the iwm driver attaches the wireless card which
works. Awesome !

Le sam. 9 nov. 2019 à 22:02, Patrick Wildt  a écrit :
>
> On Sat, Nov 09, 2019 at 12:08:35PM +0100, Thomas de Grivel wrote:
> > Everything works except wifi, suspend/resume and screen backlight, and
> > mute speakers button.
>
> Hi,
>
> I have an X395 which is basically the same machine.
>
> For Wifi I have temporarily replaced the Intel WiFi with a bwfm(4), the
> Dell Wireless DW1820a (note the a), which has two antenna connectors.
> There's the DW1830 which has three.  My X395 has two connectors, so I
> just put in the DW1820a.  Both can be purchased cheaply on eBay.
>
> The mute speaker button works for me, but the light doesn't show up.
>
> I will try to have a look at suspend/resume at one of the next OpenBSD
> hackathons.
>
> For the screen backlight I have come up with a diff, but it's not yet
> ready to be committed, as it should be done in a different fashion.
> Still, I have attached the diff if you want to give it a go.
>
> Patrick
>
> diff --git a/sys/dev/acpi/acpivideo.c b/sys/dev/acpi/acpivideo.c
> index 9498465a418..a46a99a67f7 100644
> --- a/sys/dev/acpi/acpivideo.c
> +++ b/sys/dev/acpi/acpivideo.c
> @@ -149,7 +149,7 @@ acpi_foundvout(struct aml_node *node, void *arg)
> if (node->parent != sc->sc_devnode)
> return (0);
>
> -   if (aml_searchname(node, "_BCM") && aml_searchname(node, "_BQC")) {
> +   if (aml_searchname(node, "_BCM")) {
> memset(, 0, sizeof(aaa));
> aaa.aaa_iot = sc->sc_acpi->sc_iot;
> aaa.aaa_memt = sc->sc_acpi->sc_memt;
> diff --git a/sys/dev/acpi/acpivout.c b/sys/dev/acpi/acpivout.c
> index 5fb6973f595..b1957b0c652 100644
> --- a/sys/dev/acpi/acpivout.c
> +++ b/sys/dev/acpi/acpivout.c
> @@ -60,6 +60,7 @@ struct acpivout_softc {
>
> int *sc_bcl;
> size_t  sc_bcl_len;
> +   int sc_bcl_cur;
>  };
>
>  void   acpivout_brightness_cycle(struct acpivout_softc *);
> @@ -113,10 +114,16 @@ acpivout_attach(struct device *parent, struct device 
> *self, void *aux)
> aml_register_notify(sc->sc_devnode, aaa->aaa_dev,
> acpivout_notify, sc, ACPIDEV_NOPOLL);
>
> +   acpivout_get_bcl(sc);
> +   if (!sc->sc_bcl_len)
> +   return;
> +
> +   sc->sc_bcl_cur = sc->sc_bcl[sc->sc_bcl_len - 1];
> +   sc->sc_bcl_cur = acpivout_get_brightness(sc);
> +   acpivout_set_brightness(sc, sc->sc_bcl_cur);
> +
> ws_get_param = acpivout_get_param;
> ws_set_param = acpivout_set_param;
> -
> -   acpivout_get_bcl(sc);
>  }
>
>  int
> @@ -130,12 +137,15 @@ acpivout_notify(struct aml_node *node, int notify, void 
> *arg)
> break;
> case NOTIFY_BRIGHTNESS_UP:
> acpivout_brightness_step(sc, 1);
> +   wsdisplay_change_brightness(1);
> break;
> case NOTIFY_BRIGHTNESS_DOWN:
> acpivout_brightness_step(sc, -1);
> +   wsdisplay_change_brightness(-1);
> break;
> case NOTIFY_BRIGHTNESS_ZERO:
> acpivout_brightness_zero(sc);
> +   wsdisplay_change_brightness(0);
> break;
> case NOTIFY_DISPLAY_OFF:
> /* TODO: D3 state change */
> @@ -200,7 +210,9 @@ acpivout_get_brightness(struct acpivout_softc *sc)
> struct aml_value res;
> int level;
>
> -   aml_evalname(sc->sc_acpi, sc->sc_devnode, "_BQC", 0, NULL, );
> +   if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_BQC", 0, NULL, ))
> +   return sc->sc_bcl_cur;
> +
> level = aml_val2int();
> aml_freevalue();
> DPRINTF(("%s: BQC = %d\n", DEVNAME(sc), level));
> @@ -242,6 +254,7 @@ acpivout_set_brightness(struct acpivout_softc *sc, int 
> level)
> aml_evalname(sc->sc_acpi, sc->sc_devnode, "_BCM", 1, , );
>
> aml_freevalue();
> +   sc->sc_bcl_cur = level;
>  }
>
>  void
> diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c 
> b/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
> index 02a90069f8d..4bad51b7d5f 100644
> --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
> @@ -1656,7 +1656,7 @@ amdgpu_wsioctl(void *v, u_long cmd, caddr_t data, int 
> flag, struct proc *p)
> case WSDISPLAYIO_PARAM_BRIGHTNESS:
> dp->min = 0;
> dp->max = bd->props.max_brightness;
> -   dp->curval = bd->ops->get_brightness(bd);
> +   dp->curval = bd->props.brightness;
> return (dp->max > dp->min) ? 0 : -1;
> }
> break;
> diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c
> index 61ccd2dae43..eda5c9d8843 100644
> --- a/sys/dev/wscons/wsdisplay.c
> +++ b/sys/dev/wscons/wsdisplay.c
> @@ -3369,3 +3369,43 @@ mouse_remove(struct wsscreen *scr)
>  }
>
>  #endif /* 

Re: OpenBSD -current on T495

2019-11-09 Thread Patrick Wildt
On Sat, Nov 09, 2019 at 12:08:35PM +0100, Thomas de Grivel wrote:
> Everything works except wifi, suspend/resume and screen backlight, and
> mute speakers button.

Hi,

I have an X395 which is basically the same machine.

For Wifi I have temporarily replaced the Intel WiFi with a bwfm(4), the
Dell Wireless DW1820a (note the a), which has two antenna connectors.
There's the DW1830 which has three.  My X395 has two connectors, so I
just put in the DW1820a.  Both can be purchased cheaply on eBay.

The mute speaker button works for me, but the light doesn't show up.

I will try to have a look at suspend/resume at one of the next OpenBSD
hackathons.

For the screen backlight I have come up with a diff, but it's not yet
ready to be committed, as it should be done in a different fashion.
Still, I have attached the diff if you want to give it a go.

Patrick

diff --git a/sys/dev/acpi/acpivideo.c b/sys/dev/acpi/acpivideo.c
index 9498465a418..a46a99a67f7 100644
--- a/sys/dev/acpi/acpivideo.c
+++ b/sys/dev/acpi/acpivideo.c
@@ -149,7 +149,7 @@ acpi_foundvout(struct aml_node *node, void *arg)
if (node->parent != sc->sc_devnode)
return (0);
 
-   if (aml_searchname(node, "_BCM") && aml_searchname(node, "_BQC")) {
+   if (aml_searchname(node, "_BCM")) {
memset(, 0, sizeof(aaa));
aaa.aaa_iot = sc->sc_acpi->sc_iot;
aaa.aaa_memt = sc->sc_acpi->sc_memt;
diff --git a/sys/dev/acpi/acpivout.c b/sys/dev/acpi/acpivout.c
index 5fb6973f595..b1957b0c652 100644
--- a/sys/dev/acpi/acpivout.c
+++ b/sys/dev/acpi/acpivout.c
@@ -60,6 +60,7 @@ struct acpivout_softc {
 
int *sc_bcl;
size_t  sc_bcl_len;
+   int sc_bcl_cur;
 };
 
 void   acpivout_brightness_cycle(struct acpivout_softc *);
@@ -113,10 +114,16 @@ acpivout_attach(struct device *parent, struct device 
*self, void *aux)
aml_register_notify(sc->sc_devnode, aaa->aaa_dev,
acpivout_notify, sc, ACPIDEV_NOPOLL);
 
+   acpivout_get_bcl(sc);
+   if (!sc->sc_bcl_len)
+   return;
+
+   sc->sc_bcl_cur = sc->sc_bcl[sc->sc_bcl_len - 1];
+   sc->sc_bcl_cur = acpivout_get_brightness(sc);
+   acpivout_set_brightness(sc, sc->sc_bcl_cur);
+
ws_get_param = acpivout_get_param;
ws_set_param = acpivout_set_param;
-
-   acpivout_get_bcl(sc);
 }
 
 int
@@ -130,12 +137,15 @@ acpivout_notify(struct aml_node *node, int notify, void 
*arg)
break;
case NOTIFY_BRIGHTNESS_UP:
acpivout_brightness_step(sc, 1);
+   wsdisplay_change_brightness(1);
break;
case NOTIFY_BRIGHTNESS_DOWN:
acpivout_brightness_step(sc, -1);
+   wsdisplay_change_brightness(-1);
break;
case NOTIFY_BRIGHTNESS_ZERO:
acpivout_brightness_zero(sc);
+   wsdisplay_change_brightness(0);
break;
case NOTIFY_DISPLAY_OFF:
/* TODO: D3 state change */
@@ -200,7 +210,9 @@ acpivout_get_brightness(struct acpivout_softc *sc)
struct aml_value res;
int level;
 
-   aml_evalname(sc->sc_acpi, sc->sc_devnode, "_BQC", 0, NULL, );
+   if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_BQC", 0, NULL, ))
+   return sc->sc_bcl_cur;
+
level = aml_val2int();
aml_freevalue();
DPRINTF(("%s: BQC = %d\n", DEVNAME(sc), level));
@@ -242,6 +254,7 @@ acpivout_set_brightness(struct acpivout_softc *sc, int 
level)
aml_evalname(sc->sc_acpi, sc->sc_devnode, "_BCM", 1, , );
 
aml_freevalue();
+   sc->sc_bcl_cur = level;
 }
 
 void
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c 
b/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
index 02a90069f8d..4bad51b7d5f 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c
@@ -1656,7 +1656,7 @@ amdgpu_wsioctl(void *v, u_long cmd, caddr_t data, int 
flag, struct proc *p)
case WSDISPLAYIO_PARAM_BRIGHTNESS:
dp->min = 0;
dp->max = bd->props.max_brightness;
-   dp->curval = bd->ops->get_brightness(bd);
+   dp->curval = bd->props.brightness;
return (dp->max > dp->min) ? 0 : -1;
}
break;
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c
index 61ccd2dae43..eda5c9d8843 100644
--- a/sys/dev/wscons/wsdisplay.c
+++ b/sys/dev/wscons/wsdisplay.c
@@ -3369,3 +3369,43 @@ mouse_remove(struct wsscreen *scr)
 }
 
 #endif /* HAVE_WSMOUSED_SUPPORT */
+
+int
+wsdisplay_change_brightness(int dir)
+{
+   struct wsdisplay_softc *sc;
+   struct wsdisplay_param dp;
+   int step, ret;
+
+   sc = (struct wsdisplay_softc *)device_lookup(_cd, 0);
+   if (sc == NULL)
+   return ENODEV;
+
+   memset(, 0, sizeof(dp));
+   dp.param = WSDISPLAYIO_PARAM_BRIGHTNESS;
+   ret = 

Re: OpenBSD -current on T495

2019-11-09 Thread Thomas de Grivel
Sure, here it is :

OpenBSD 6.6-current (GENERIC.MP) #442: Sat Nov  9 01:36:23 MST 2019
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 23478448128 (22390MB)
avail mem = 22754553856 (21700MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 3.1 @ 0xb9ecc000 (63 entries)
bios0: vendor LENOVO version "R12ET44W(1.14 )" date 09/14/2019
bios0: LENOVO 20NJCTO1WW
acpi0 at bios0: ACPI 5.0
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SSDT SSDT SSDT TPM2 SSDT MSDM SLIC BATB HPET
APIC MCFG SBST WSMT IVRS SSDT CRAT CDIT FPDT SSDT SSDT SSDT UEFI
acpi0: wakeup devices GPP0(S3) GPP1(S3) GPP2(S3) GPP3(S3) GPP4(S3)
L850(S3) GPP5(S3) GPP6(S3) GP17(S3) XHC0(S3) XHC1(S3) GP18(S3)
LID_(S3) SLPB(S3)
acpitimer0 at acpi0: 3579545 Hz, 32 bits
acpihpet0 at acpi0: 14318180 Hz
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: AMD Ryzen 7 PRO 3700U w/ Radeon Vega Mobile Gfx, 2295.97 MHz, 17-18-01
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,FMA3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,RDRAND,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,SKINIT,TCE,TOPEXT,CPCTR,DBKP,PCTRL3,MWAITX,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,RDSEED,ADX,SMAP,CLFLUSHOPT,SHA,IBPB,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu0: 64KB 64b/line 4-way I-cache, 32KB 64b/line 8-way D-cache, 512KB
64b/line 8-way L2 cache, 4MB 64b/line 16-way L3 cache
cpu0: ITLB 64 4KB entries fully associative, 64 4MB entries fully associative
cpu0: DTLB 64 4KB entries fully associative, 64 4MB entries fully associative
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 24MHz
cpu0: mwait min=64, max=64, C-substates=1.1, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: AMD Ryzen 7 PRO 3700U w/ Radeon Vega Mobile Gfx, 2295.66 MHz, 17-18-01
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,FMA3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,RDRAND,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,SKINIT,TCE,TOPEXT,CPCTR,DBKP,PCTRL3,MWAITX,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,RDSEED,ADX,SMAP,CLFLUSHOPT,SHA,IBPB,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu1: 64KB 64b/line 4-way I-cache, 32KB 64b/line 8-way D-cache, 512KB
64b/line 8-way L2 cache, 4MB 64b/line 16-way L3 cache
cpu1: ITLB 64 4KB entries fully associative, 64 4MB entries fully associative
cpu1: DTLB 64 4KB entries fully associative, 64 4MB entries fully associative
cpu1: smt 1, core 0, package 0
cpu2 at mainbus0: apid 2 (application processor)
cpu2: AMD Ryzen 7 PRO 3700U w/ Radeon Vega Mobile Gfx, 2295.66 MHz, 17-18-01
cpu2: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,FMA3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,RDRAND,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,SKINIT,TCE,TOPEXT,CPCTR,DBKP,PCTRL3,MWAITX,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,RDSEED,ADX,SMAP,CLFLUSHOPT,SHA,IBPB,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu2: 64KB 64b/line 4-way I-cache, 32KB 64b/line 8-way D-cache, 512KB
64b/line 8-way L2 cache, 4MB 64b/line 16-way L3 cache
cpu2: ITLB 64 4KB entries fully associative, 64 4MB entries fully associative
cpu2: DTLB 64 4KB entries fully associative, 64 4MB entries fully associative
cpu2: smt 0, core 1, package 0
cpu3 at mainbus0: apid 3 (application processor)
cpu3: AMD Ryzen 7 PRO 3700U w/ Radeon Vega Mobile Gfx, 2295.67 MHz, 17-18-01
cpu3: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,FMA3,CX16,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,RDRAND,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,SKINIT,TCE,TOPEXT,CPCTR,DBKP,PCTRL3,MWAITX,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,RDSEED,ADX,SMAP,CLFLUSHOPT,SHA,IBPB,XSAVEOPT,XSAVEC,XGETBV1,XSAVES
cpu3: 64KB 64b/line 4-way I-cache, 32KB 64b/line 8-way D-cache, 512KB
64b/line 8-way L2 cache, 4MB 64b/line 16-way L3 cache
cpu3: ITLB 64 4KB entries fully associative, 64 4MB entries fully associative
cpu3: DTLB 64 4KB entries fully associative, 64 4MB entries fully associative
cpu3: smt 1, core 1, package 0
cpu4 at mainbus0: apid 4 (application processor)
cpu4: AMD Ryzen 7 PRO 3700U w/ Radeon Vega Mobile Gfx, 2295.66 MHz, 17-18-01
cpu4: 

Re: OpenBSD -current on T495

2019-11-09 Thread Tony Boston
Could you please provide a dmesg output? The info you gave is not very helpful 
without it.

--
Tony

GPG-FP: 49CC8250 CDCF2183 6209C1AE 625677C1 F7783D5F
Threema: DN8PJX4Z






> On 9. Nov 2019, at 12:08, Thomas de Grivel  wrote:
> 
> Everything works except wifi, suspend/resume and screen backlight, and
> mute speakers button.
> 
> --
> Thomas de Grivel
> kmx.io
> 



OpenBSD -current on T495

2019-11-09 Thread Thomas de Grivel
Everything works except wifi, suspend/resume and screen backlight, and
mute speakers button.

--
 Thomas de Grivel
 kmx.io