> Date: Fri, 11 Sep 2020 17:42:23 +0200 > From: Marcus Glocker <mar...@nazgul.ch> > > On Thu, 10 Sep 2020 23:44:38 +0200 > Joerg Jung <m...@umaxx.net> wrote: > > > Don’t give up so quickly ;) > > let’s try to make the driver work on your iMac, send me dmesg and > > sysctl hw output please. > > > > Your idea of converting it to ACPI is the right thing to do anyways, > > would be nice to get this working. > > Here we go: > > $ dmesg | grep smc > asmc0 at acpi0: SMC_ (smc-piketon) addr 0x300/0x20: rev 1.64f564, 276 > keys > > $ sysctl -a | grep smc > hw.sensors.asmc0.temp0=27.00 degC (TA0P ambient) > hw.sensors.asmc0.temp1=42.00 degC (TC0H cpu0 heatsink) > hw.sensors.asmc0.temp2=55.00 degC (TG0D gpu0 diode) > hw.sensors.asmc0.temp3=53.00 degC (TG0H gpu0 heatsink) > hw.sensors.asmc0.temp4=38.00 degC (TL0P lcd proximity) > hw.sensors.asmc0.temp5=41.00 degC (TO0P optical drive) > hw.sensors.asmc0.temp6=50.00 degC (Tm0P memory controller) > hw.sensors.asmc0.fan0=998 RPM (ODD, right mid rear) > hw.sensors.asmc0.fan1=1158 RPM (HDD, center mid rear) > hw.sensors.asmc0.fan2=1200 RPM (CPU, left lower rear) > > Does that work for you guys?
$ dmesg | grep smc asmc0 at acpi0: SMC_ (smc-napa) addr 0x300/0x20: rev 1.3f503, 137 keys $ sysctl -a | grep smc hw.sensors.asmc0.temp0=63.00 degC (TC0D cpu0 die core) hw.sensors.asmc0.temp1=55.00 degC (TC0H cpu0 heatsink) hw.sensors.asmc0.temp2=58.00 degC (TC0P cpu0 proximity) hw.sensors.asmc0.temp3=52.00 degC (TN0P northbridge proximity) hw.sensors.asmc0.temp4=52.00 degC (TN1P northbridge 2) hw.sensors.asmc0.fan0=2077 RPM (Master, left upper front) So yes, this works for me. You'll need to make changes to the i386 GENERIC kernel as well. And I'd like to ask you to make one small change... > Index: sys/dev/acpi/asmc.c > =================================================================== > RCS file: sys/dev/acpi/asmc.c > diff -N sys/dev/acpi/asmc.c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ sys/dev/acpi/asmc.c 11 Sep 2020 15:32:38 -0000 > @@ -0,0 +1,744 @@ > +/* $OpenBSD: asmc.c,v 1.33 2020/08/26 03:29:06 visa Exp $ */ > +/* > + * Copyright (c) 2015 Joerg Jung <j...@openbsd.org> > + * > + * Permission to use, copy, modify, and distribute this software for any > + * purpose with or without fee is hereby granted, provided that the above > + * copyright notice and this permission notice appear in all copies. > + * > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR > + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > + */ > + > +/* > + * Driver for Apple's System Management Controller (SMC) an H8S/2117 chip > + */ > + > +#include <sys/param.h> > +#include <sys/systm.h> > +#include <sys/device.h> > +#include <sys/kernel.h> > +#include <sys/rwlock.h> > +#include <sys/task.h> > +#include <sys/sensors.h> > + > +#include <machine/bus.h> > + > +#include <dev/acpi/acpivar.h> > +#include <dev/acpi/acpidev.h> > +#include <dev/acpi/amltypes.h> > +#include <dev/acpi/dsdt.h> > + > +#include <dev/wscons/wsconsio.h> > + > +#define ASMC_BASE 0x300 /* SMC base address */ > +#define ASMC_IOSIZE 32 /* I/O region size 0x300-0x31f */ > + > +#define ASMC_DATA 0x00 /* SMC data port offset */ > +#define ASMC_COMMAND 0x04 /* SMC command port offset */ > +#define ASMC_STATUS 0x1e /* SMC status port offset */ > +#define ASMC_INTERRUPT 0x1f /* SMC interrupt port offset */ > + > +#define ASMC_READ 0x10 /* SMC read command */ > +#define ASMC_WRITE 0x11 /* SMC write command */ > +#define ASMC_INFO 0x13 /* SMC info/type command */ > + > +#define ASMC_OBF 0x01 /* Output buffer full */ > +#define ASMC_IBF 0x02 /* Input buffer full */ > +#define ASMC_ACCEPT 0x04 > + > +#define ASMC_RETRY 3 > +#define ASMC_MAXLEN 32 /* SMC maximum data size len */ > +#define ASMC_NOTFOUND 0x84 /* SMC status key not found */ > + > +#define ASMC_MAXTEMP 101 /* known asmc_prods temperature sensor keys */ > +#define ASMC_MAXFAN 10 /* fan keys with digits 0-9 */ > +#define ASMC_MAXLIGHT 2 /* left and right light sensor */ > +#define ASMC_MAXMOTION 3 /* x y z axis motion sensors */ > + > +struct asmc_prod { > + const char *pr_name; > + uint8_t pr_light; > + const char *pr_temp[ASMC_MAXTEMP]; > +}; > + > +struct asmc_softc { > + struct device sc_dev; > + > + struct acpi_softc *sc_acpi; > + struct aml_node *sc_devnode; > + > + bus_space_tag_t sc_iot; > + bus_space_handle_t sc_ioh; > + > + struct asmc_prod *sc_prod; > + uint8_t sc_nfans; /* number of fans */ > + uint8_t sc_lightlen; /* light data len */ > + uint8_t sc_backlight; /* keyboard backlight value */ > + > + struct rwlock sc_lock; > + struct task sc_task_backlight; > + > + struct ksensor sc_sensor_temp[ASMC_MAXTEMP]; > + struct ksensor sc_sensor_fan[ASMC_MAXFAN]; > + struct ksensor sc_sensor_light[ASMC_MAXLIGHT]; > + struct ksensor sc_sensor_motion[ASMC_MAXMOTION]; > + struct ksensordev sc_sensor_dev; > + struct sensor_task *sc_sensor_task; > +}; > + > +int asmc_try(struct asmc_softc *, int, const char *, uint8_t *, uint8_t); > +void asmc_init(struct asmc_softc *); > +void asmc_update(void *); > + > +int asmc_match(struct device *, void *, void *); > +void asmc_attach(struct device *, struct device *, void *); > +int asmc_detach(struct device *, int); > +int asmc_activate(struct device *, int); > + > +/* wskbd hook functions */ > +void asmc_backlight(void *); > +int asmc_get_backlight(struct wskbd_backlight *); > +int asmc_set_backlight(struct wskbd_backlight *); > +extern int (*wskbd_get_backlight)(struct wskbd_backlight *); > +extern int (*wskbd_set_backlight)(struct wskbd_backlight *); > + > +const struct cfattach asmc_ca = { > + sizeof(struct asmc_softc), asmc_match, asmc_attach, NULL, asmc_activate > +}; > + > +struct cfdriver asmc_cd = { > + NULL, "asmc", DV_DULL > +}; > + > +const char *acpiapplesmc_hids[] = { ...can you rename this variable to asmc_hids[]? > + "APP0001", NULL > +}; > +