Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jun 2002 14:59:21 +0200
From:      Willem van Engen <wvengen@stack.nl>
To:        freebsd-hackers@freebsd.org
Subject:   smbalert# hook for smbus childs
Message-ID:  <20020624145921.463108fc.wvengen@stack.nl>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

--Multipart_Mon__24_Jun_2002_14:59:21_+0200_0843ac00
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hello,

there already is some code for smbalert# handling on intpm
(ENABLE_ALART), but there is no support for handling it in a driver. O2
AudioDJ (OZ162) chips use this signal to indicate that a button was
pressed. So I need a way for a driver to be notified when smbalert#
occurs.

Of course I thought immediately about bus_(setup|teardown)_intr. I wrote
something like that for smbus: bus_(setup|teardown)_alart (see patch),
that works now. But is this The Right Way to do it? I do have some
thoughts on it, but maybe someone more knowledgeable than me could comment
on it.
It might be better to use bus_*_intr instead of bus_*_alart, but one
would need to bus_alloc_resource a slave address and pass that to
bus_setup_intr. But then it makes sense to use those slave address
resources to send smbus commands, right? But how would that fit into the
bus_space_* functions?

- Willem
p.s. I hope I'm clear, english isn't my native language.
--Multipart_Mon__24_Jun_2002_14:59:21_+0200_0843ac00
Content-Type: text/plain;
 name="smbus_alart.diff"
Content-Disposition: attachment;
 filename="smbus_alart.diff"
Content-Transfer-Encoding: base64

LS0tIHN5cy9kZXYvc21idXMvc21iY29uZi5jLm9yaWcJTW9uIEp1biAyNCAwMjozNjoyNSAyMDAy
CisrKyBzeXMvZGV2L3NtYnVzL3NtYmNvbmYuYwlNb24gSnVuIDI0IDExOjAwOjExIDIwMDIKQEAg
LTI4LDYgKzI4LDkgQEAKICAqLwogI2luY2x1ZGUgPHN5cy9wYXJhbS5oPgogI2luY2x1ZGUgPHN5
cy9zeXN0bS5oPgorI2luY2x1ZGUgPHN5cy9tYWxsb2MuaD4KKyNpbmNsdWRlIDxzeXMva2VybmVs
Lmg+CisjaW5jbHVkZSA8c3lzL2t0aHJl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OQUJMRV9BTEFSVF9WRVJCT1NFCiAJCQlwcmlu
dGYoIkFMQVJUX1JFU1BPTlNFOiAweCV4XG4iLCBhZGRyKTsKKyNlbmRpZgorCQkJc21idXNfYWxh
cnRfaW50cihkZXYsIGFkZHIpOwogCQl9CiAJfWVsc2V7CisjaWZkZWYgRU5BQkxFX0FMQVJUX1ZF
UkJPU0UKIAkgICAgICAgIHByaW50ZigiRVJST1JcbiIpOworI2VuZGlmCiAJfQogCiAJLypSZS1l
bmFibGUgSU5UUiBmcm9tIEFMQVJUKi8K

--Multipart_Mon__24_Jun_2002_14:59:21_+0200_0843ac00--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020624145921.463108fc.wvengen>