If an external EC accesses the chip through SMBus registers
and if the chip's environmental registers are paged, it is likely
that the EC modifies the page register. If so, it likely will not
update the page on each access but assume that it "owns" the chip.
If the driver then modifies the page register, subsequent accesses
from the EC will likely have unpredictable results.
To avoid that problem, let's save the page register value after
disabling SMBus accesses and restore the original value when done.
This is only necessary if accesses are not handled through MMIO
since we don't touch the page register in that case.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Using DKMS, the driver will be automatically rebuilt when
the kernel is updated.
* `make dkms` to install via DKMS
* `make dkms_clean` to remove from DKMS
Signed-off-by: Burt P <pburt0@gmail.com>
This reverts commit 6c1e48b4f1.
See comments:
"This is indeed not working, at least on Fedora. I tried specifying
MAKE and CLEAN but the outcome is the same (which makes sense, since
the defaults should already cover this)."
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Using DKMS, the driver will be automatically rebuilt when
the kernel is updated.
* `make dkms` to install via DKMS
* `make dkms_clean` to remove from DKMS
Signed-off-by: Burt P <pburt0@gmail.com>
We can not use register 0x98 since it is typically not programmed
on systems selecting PECI. Try register 0x0a (Interface Selection)
which should be a better fit anyway.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Only disable SMBus if we are going to read/write data.
Disabling it on each attribute read can result in system
instabilities.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
For some recent chips (at least IT8792E/IT8795E), the value of the chip ID
register does not match the chip name. Display the textual, not the value
of the ID register, in the kernel log.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Make sure the build passes if the source is not in a git repository.
Again, that means that version information won't be available, but there
is only so much we can do about that.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Symbolic file permissions ran out of favor and result in a checkpatch
warning. Use octal permissions instead.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Some distributions use their own Makefile and thus won't create version.h,
resulting in a build failure. Pass the version as define instead.
That won't help for generating the driver version with those distributions,
but at least the driver will build.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Some chips support Environmental Controller access through SMBus.
On those chips, it is possible that an Embedded Controller accesses
Environmental Controller chip registers at any time. There is no real
means for synchronization. On banked chips, this can and will result in
access errors with unpredictable result.
Disable SMBus access while reading or writing environmental controller
registers to work around the problem.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Temperature sensor types won't change, so we only need to read it once.
Also fix temperature register calculation.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
There is some indication that other entities (BIOS ? EC ?) may access
the chip asynchronously. Restore the bank selection after read/write
operations to limit any potenial impact.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Introduce two new type values, 7 for 'virtual' and 8 for 'other'.
This will need to be added to the ABI once approved.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
With the reworked temperature mapping it was no longer possible to set
manual mode since the 'automatic' configuration bit was never cleared.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
It appears that some BIOSes reserve ACPI resources without using them,
and acpi_enable_resources=lax seems to result in failures to load
certain drivers.
Introduce a 'ignore_resource_conflict' module parameter as alternate
means to ignore ACPI resource conflicts.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Various chips have different numbers of valid values for pwm temperature
mapping. Rework the code to take this into account.
No longer keep map as bitmap, but maintain it as number 1..X. Do not try to
define a separate mapping entry for pwm4..6 on chips where the temperature
map for those pwm controls is taken from a different temperature input.
Introduce helpers to convert the control register contents to a map and
vice versa.
Reflect that IT8607 uses the new temperature map in bit 3..5 of the pwm
control register.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
If pwmX_enable is written prior to displaying any attributes,
t87_update_pwm_ctrl() is never called, and the cached pwm registers
are never read before written. This results in bad values written
into various registers, and can result in operational failures.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>