ssdfb: revert rev 1.14
Can't run the worker thread MPSAFE with spi(4) yet because most controller drivers still lack MP safety. Cause issues when using multiple displays.
This commit is contained in:
parent
2fb83002a9
commit
2e6662efc3
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: ssdfb_i2c.c,v 1.10 2021/07/30 13:44:09 tnn Exp $ */
|
/* $NetBSD: ssdfb_i2c.c,v 1.11 2021/08/05 22:31:20 tnn Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 The NetBSD Foundation, Inc.
|
* Copyright (c) 2019 The NetBSD Foundation, Inc.
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.10 2021/07/30 13:44:09 tnn Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.11 2021/08/05 22:31:20 tnn Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/device.h>
|
#include <sys/device.h>
|
||||||
|
@ -112,6 +112,7 @@ ssdfb_i2c_attach(device_t parent, device_t self, void *aux)
|
||||||
if ((flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) == SSDFB_PRODUCT_UNKNOWN)
|
if ((flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) == SSDFB_PRODUCT_UNKNOWN)
|
||||||
flags |= SSDFB_PRODUCT_SSD1306_GENERIC;
|
flags |= SSDFB_PRODUCT_SSD1306_GENERIC;
|
||||||
|
|
||||||
|
flags |= SSDFB_ATTACH_FLAG_MPSAFE;
|
||||||
sc->sc.sc_dev = self;
|
sc->sc.sc_dev = self;
|
||||||
sc->sc_i2c_tag = ia->ia_tag;
|
sc->sc_i2c_tag = ia->ia_tag;
|
||||||
sc->sc_i2c_addr = ia->ia_addr;
|
sc->sc_i2c_addr = ia->ia_addr;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: ssdfb.c,v 1.18 2021/08/05 19:07:09 tnn Exp $ */
|
/* $NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 The NetBSD Foundation, Inc.
|
* Copyright (c) 2019 The NetBSD Foundation, Inc.
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.18 2021/08/05 19:07:09 tnn Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $");
|
||||||
|
|
||||||
#include "opt_ddb.h"
|
#include "opt_ddb.h"
|
||||||
|
|
||||||
|
@ -268,6 +268,7 @@ ssdfb_attach(struct ssdfb_softc *sc, int flags)
|
||||||
int error = 0;
|
int error = 0;
|
||||||
long defattr;
|
long defattr;
|
||||||
const struct ssdfb_product *p;
|
const struct ssdfb_product *p;
|
||||||
|
int kt_flags;
|
||||||
|
|
||||||
p = ssdfb_lookup_product(flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK);
|
p = ssdfb_lookup_product(flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
|
@ -393,11 +394,15 @@ ssdfb_attach(struct ssdfb_softc *sc, int flags)
|
||||||
if (sc->sc_is_console)
|
if (sc->sc_is_console)
|
||||||
ssdfb_set_usepoll(sc, true);
|
ssdfb_set_usepoll(sc, true);
|
||||||
|
|
||||||
mutex_init(&sc->sc_cond_mtx, MUTEX_DEFAULT, IPL_SCHED);
|
mutex_init(&sc->sc_cond_mtx, MUTEX_DEFAULT,
|
||||||
|
ISSET(flags, SSDFB_ATTACH_FLAG_MPSAFE) ? IPL_SCHED : IPL_BIO);
|
||||||
cv_init(&sc->sc_cond, "ssdfb");
|
cv_init(&sc->sc_cond, "ssdfb");
|
||||||
error = kthread_create(PRI_SOFTCLOCK, KTHREAD_MUSTJOIN | KTHREAD_MPSAFE,
|
kt_flags = KTHREAD_MUSTJOIN;
|
||||||
NULL, ssdfb_thread, sc, &sc->sc_thread, "%s",
|
/* XXX spi(4) is not MPSAFE yet. */
|
||||||
device_xname(sc->sc_dev));
|
if (ISSET(flags, SSDFB_ATTACH_FLAG_MPSAFE))
|
||||||
|
kt_flags |= KTHREAD_MPSAFE;
|
||||||
|
error = kthread_create(PRI_SOFTCLOCK, kt_flags, NULL, ssdfb_thread, sc,
|
||||||
|
&sc->sc_thread, "%s", device_xname(sc->sc_dev));
|
||||||
if (error) {
|
if (error) {
|
||||||
cv_destroy(&sc->sc_cond);
|
cv_destroy(&sc->sc_cond);
|
||||||
mutex_destroy(&sc->sc_cond_mtx);
|
mutex_destroy(&sc->sc_cond_mtx);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: ssdfbvar.h,v 1.9 2021/08/05 19:07:09 tnn Exp $ */
|
/* $NetBSD: ssdfbvar.h,v 1.10 2021/08/05 22:31:20 tnn Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2019 The NetBSD Foundation, Inc.
|
* Copyright (c) 2019 The NetBSD Foundation, Inc.
|
||||||
|
@ -36,6 +36,7 @@
|
||||||
#define SSDFB_ATTACH_FLAG_UPSIDEDOWN 0x00000100
|
#define SSDFB_ATTACH_FLAG_UPSIDEDOWN 0x00000100
|
||||||
#define SSDFB_ATTACH_FLAG_INVERSE 0x00000200
|
#define SSDFB_ATTACH_FLAG_INVERSE 0x00000200
|
||||||
#define SSDFB_ATTACH_FLAG_CONSOLE 0x00000400
|
#define SSDFB_ATTACH_FLAG_CONSOLE 0x00000400
|
||||||
|
#define SSDFB_ATTACH_FLAG_MPSAFE 0x00000800
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fundamental commands
|
* Fundamental commands
|
||||||
|
|
Loading…
Reference in New Issue