summaryrefslogtreecommitdiffstats
path: root/sys/dev/iicbus
Commit message (Collapse)AuthorAgeFilesLines
* Add a driver for the Maxim DS3231 a low-cost, extremely accurate (+-2PPM)loos2015-02-282-0/+662
| | | | | | | | | | | | | | | | I2C real-time clock (RTC). The DS3231 has an integrated temperature-compensated crystal oscillator (TXCO) and crystal. DS3231 has a temperature sensor, an independent 32kHz output (which can be turned on and off by the driver) and another output that can be used as interrupt for alarms or as a second square-wave output, which frequency and operation mode can be set by driver sysctl(8) knobs. Differential Revision: https://reviews.freebsd.org/D1016 Reviewed by: ian, rpaulo Tested on: Raspberry pi model B
* Replace hardcoded sizes by sizeof() and nitems().loos2015-02-171-14/+13
| | | | Set all the sysctls as CTLFLAG_MPSAFE.
* Fix the display of negative temperatures.loos2015-02-171-7/+14
| | | | | Fix the setting of TOS (overtemperature shutdown) and THYST (hysteresis temperature).
* Use proper signed types. The ADT746x uses signed 8-bit numbers for thejhibbits2015-01-181-2/+3
| | | | | | temperature. MFC after: 2 weeks
* Allow i2c bus speed to be configured via hints, FDT data, and sysctl.ian2014-11-183-1/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current support for controlling i2c bus speed is an inconsistant mess. There are 4 symbolic speed values defined, UNKNOWN, SLOW, FAST, FASTEST. It seems to be universally assumed that SLOW means the standard 100KHz rate from the original spec. Nothing ever calls iicbus_reset() with a speed of FAST, although some drivers would treat it as the 400KHz standard speed. Mostly iicbus_reset() is called with the speed set to UNKNOWN or FASTEST, and there's really no telling what any individual driver will do with those. The speed of an i2c bus is limited by the speed of the slowest device on the bus. This means that generally the bus speed needs to be configured based on the board/system and the components within it. Historically for i2c we've configured with device hints. Newer systems use FDT data and it documents a clock-frequency property for i2c busses. Hobbyists and developers are likely to want on the fly changes. These changes provide all 3 methods, but do not require any existing drivers to change to use the new facilities. This adds an iicbus method, iicbus_get_frequency(dev, speed) that gets the frequency for the requested symbolic speed. If the symbolic speed is SLOW or if there is no speed configured for the bus, the returned value is 100KHz, always. Otherwise, if bus speed is configured by hints, fdt, tunable, or sysctl, that speed is returned. It also adds a helper function, iicbus_init_frequency() that any bus driver subclassed from iicbus can initialize the frequency from some other source of info. Initial driver implementations are provided for Freescale and TI. Differential Revision: https://reviews.freebsd.org/D1174 PR: 195009
* Add a method to iicbus to request IIC_M_NOSTOP behaviour for multibytekib2014-10-272-4/+10
| | | | | | | | | transfers to be default. It simplifies porting code which assumes such settings. Discussed with: avg, llos, nwhitehorn Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Move the adm1030 driver to the proper location, and rename it.jhibbits2014-10-161-0/+240
| | | | | For compatibility, 'device windtunnel' is still supported, but one should use 'device adm1030' instead, and this has been updated in GENERIC and NOTES.
* Check error return from reading integer part of temperature.jhibbits2014-10-121-0/+4
| | | | | | | | | There's a very remote, but possible, chance that the integer part read will fail, but the fraction read succeeds, at which point the reported temperature is invalid. Reported by: Matthew Rezny MFC after: 3 weeks
* Mechanically convert to if_inc_counter().glebius2014-09-191-8/+8
|
* Revert r268543.rpaulo2014-07-124-3/+70
| | | | We should probably fix sys/gpio.h instead.
* Move iic.h to sys/ so that it's automatically installed in /usr/include/sys.rpaulo2014-07-124-70/+3
| | | | | | | This lets us call iic(4) ioctls without needing the kernel source code and follows the same model of GPIO. MFC after: 3 weeks
* Ignore IIC_ENOADDR from iicbus_reset() as it only means we have aloos2014-05-311-0/+6
| | | | | | | | master-only controller. This fixes the iic bus scan with i2c(8) (on supported controllers). Tested with gpioiic(4).
* Add the lm75 i2c digital temperature sensor driver.loos2014-05-101-0/+574
| | | | | | | | | | | | | | This driver supports the low and high precision models (9 and 11 bits) and it will auto-detect the both variants. The driver expose the temperature registers (actual temperature, shutdown and hysteresys temperature) and also the configuration register. It was tested on FDT systems: RPi, BBB and on non-FDT systems: AR71xx, with both, hardware i2c controllers (when available) and gpioiic(4). This provides a simple and cheap way for verifying the i2c bus on embedded systems.
* Allow the use of OFW I2C bus together with iicbb(4) on OFW-based systems.loos2014-02-131-0/+25
| | | | | | | | | | | This change makes ofw_iicbus attach to iicbb(4) controllers in addition to the already supported i2c host bridges (iichb). On iicbb(4) allow the direct access of the OFW parent node by its children, so they can be directly attached to iicbb(4) node on the DTS without the need of describing the i2c bus. Approved by: adrian (mentor, implicit)
* Add driver for the ADT7460/ADT7467 fan controller found in later PowerBooksjhibbits2014-02-031-0/+664
| | | | | | and iBooks. Original work by andreast. MFC after: 1 month
* Make more unsigned ints signed.jhibbits2013-12-072-2/+2
| | | | | Found by: clang (powerpc64) MFC after: 1 week
* Fix some integer signs. These unsigned integers should all be signed.jhibbits2013-12-071-1/+1
| | | | Found by: clang (powerpc64)
* The r48589 promised to remove implicit inclusion of if_var.h soon. Prepareglebius2013-10-261-0/+1
| | | | | | | | to this event, adding if_var.h to files that do need it. Also, include all includes that now are included due to implicit pollution via if_var.h Sponsored by: Netflix Sponsored by: Nginx, Inc.
* Clean up SIOCSIFDSTADDR usage from ifnet drivers. The ioctl itself isglebius2013-09-111-1/+0
| | | | | | | | extremely outdated, and I doubt that it was ever used for ifnet drivers. It was used for AF_INET sockets in pre-FreeBSD time. Approved by: re (hrs) Sponsored by: Nginx, Inc.
* Add const qualifier to the dst parameter of the ifnet if_output method.glebius2013-04-261-2/+2
|
* Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on ↵sbz2013-01-304-4/+4
| | | | | | | device_method_t arrays Reviewed by: cognet Approved by: cognet
* Check the return value of uiomove(9).kevlo2012-11-131-1/+5
|
* It turns out that as documented, PCF8563_R_SECOND_VL (i.e. battery low)marius2012-10-181-3/+11
| | | | | | | | | | doesn't automatically clear when VDD rises above Vlow again and needs to be cleared manually. However, apparently this needs all of the time registers to be set, i.e. pcf8563_settime(), and not just PCF8563_R_SECOND in order for PCF8563_R_SECOND_VL to stick. Thus, we just issue a warning during pcf8563_attach() rather than failing with ENXIO in case it is set. MFC after: 3 days
* Remove unused variables.kevlo2012-09-291-4/+0
|
* Add s35390a_rtc(4) driver for Seiko Instruments S-35390A RTC.hrs2012-08-211-0/+333
| | | | Submitted by: Yusuke Tanaka
* Add a new temperature driver for certain PowerMacs. Found here on my Quad G5.andreast2012-08-191-0/+413
|
* Unify the sysctl description with the other PowerMac temperature drivers.andreast2012-08-191-7/+9
|
* Avoid using the degree symbol. Looks ugly on the console.andreast2012-08-191-3/+4
|
* Do the ADC init only at startup and not during every sensor read call.andreast2012-08-191-5/+12
| | | | This reduces the number of interrupts.
* Don't include MIPS machine headers. There's no need for it.marcel2012-05-191-6/+0
|
* Add a driver for the NXP (Philips) PCF8563 RTC.marius2012-04-132-0/+260
| | | | Obtained from: NetBSD (pcf8563reg.h)
* Driver for OpenCores I2C controller.jchandra2012-03-272-0/+468
| | | | | | | Add a Simple polled driver iicoc for the OpenCores I2C controller. This is used in Netlogic XLP processors. Submitted by: Sreekanth M. S. (kanthms at netlogicmicro com)
* Move driver for DS1374 RTC to sys/dev/iicbusjchandra2012-03-271-0/+143
| | | | | | The earlier version of the driver is sys/mips/rmi/dev/iic/ds1374u.c Convert all references to ds1374u to ds1374, and use DEVMETHOD_END. Also update the license header as Netlogic is now Broadcom.
* Fix typo.andreast2012-03-021-1/+1
|
* Provide pre/post transfer method callbacks for icbbbkan2012-03-012-2/+55
| | | | | | | | | | clients. These are helful when making certain drivers work on both Linux and FreeBSD without changing the code flow too much. Reviewed by: kib, wlosh MFC after: 1 month
* IIC bitbang changes - prepare to make the bit delay configurable; debug ↵adrian2011-12-201-31/+42
| | | | | | | | | | | print changes. * Right now the delay is hard coded at 10uS. This is a bit long when doing lots of periodic i2c transactions. So create a 'udelay' parameter and initialise it to 10. This can be tuned later. * Add a newline after a transaction finishes, so the debugging output isn't so horrible.
* Allow the i2c node requirements to be slightly relaxed.adrian2011-12-043-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | These realtek switch PHYs speak a variant of i2c with some slightly modified handling. From the submitter, slightly modified now that some further digging has been done: The I2C framework makes a assumption that the read/not-write bit of the first byte (the address) indicates whether reads or writes are to follow. The RTL8366 family uses the bus: after sending the address+read/not-write byte, two register address bytes are sent, then the 16-bit register value is sent or received. While the register write access can be performed as a 4-byte write, the read access requires the read bit to be set, but the first two bytes for the register address then need to be transmitted. This patch maintains the i2c protocol behaviour but allows it to be relaxed (for these kinds of switch PHYs, and whatever else Realtek may do with this almost-but-not-quite i2c bus) - by setting the "strict" hint to 0. The "strict" hint defaults to 1. Submitted by: Stefan Bethke <stb@lassitu.de>
* - There's no need to overwrite the default device method with the defaultmarius2011-11-222-11/+6
| | | | | | | | | | one. Interestingly, these are actually the default for quite some time (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9) since r52045) but even recently added device drivers do this unnecessarily. Discussed with: jhb, marcel - While at it, use DEVMETHOD_END. Discussed with: jhb - Also while at it, use __FBSDID.
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.ed2011-11-072-2/+2
| | | | This means that their use is restricted to a single C file.
* Revert r226398 and instead move the allocation of usrbufs after the error check.brueffer2011-10-161-4/+2
| | | | | Suggested by: pjd MFC after: 1 week
* Properly free resources in an error case.brueffer2011-10-151-1/+3
| | | | | | CID: 4203 Found with: Coverity Prevent(tm) MFC after: 1 week
* Tag mbufs of all incoming frames or packets with the interface's FIBbz2011-07-031-0/+1
| | | | | | | | | setting (either default or if supported as set by SIOCSIFFIB, e.g. from ifconfig). Submitted by: Alexander V. Chernikov (melifaro ipfw.ru) Reviewed by: julian MFC after: 2 weeks
* Remove duplicate header includeskevlo2011-06-281-3/+0
|
* - Improve error handling.andreast2011-06-081-43/+127
| | | | | | | | - Add retry loops in the i2c read/write functions. - Combied the ADC channel selection and readout of the value into one iicbus_transfer to avoid possible races. Reviewed by: nwhitehorn
* - Improve error handling.andreast2011-06-041-23/+45
| | | | | | | | | - Add a retry loop for the i2c sensor reading. - Check on busy status of the chip and on invalid values. - Fix a typo in a comment. - Replace the constant 2732 with the ZERO_C_TO_K macro. Approved by: nwhitehorn (mentor)
* Replace the FCU_ZERO_C_TO_K with the ZERO_C_TO_K from powermac_thermal.h.andreast2011-06-041-7/+5
| | | | Approved by: nwhitehorn (mentor)
* - Improve error handling.andreast2011-06-031-11/+33
| | | | | | | | | - Add a retry loop for the i2c sensor reading. - Update the sensor handling for sensors which do not have a location entry. [1] Submitted by: [1] Justin Hibbits. Approved by: nwhitehorn (mentor)
* Move the celsius-to-kelvin conversion to a place that powermac_thermal cannwhitehorn2011-05-291-6/+3
| | | | see it as well.
* Update the I2C-based temperature/fan drivers to connect to the Powermacnwhitehorn2011-05-293-91/+186
| | | | | thermal control module. This provides automatic fan management on all G5 PowerMacs and Xserves.
* Add a new driver, the ad7417, to read temperatures and voltages on someandreast2011-05-291-0/+457
| | | | | | PowerMac's. Approved by: nwhitehorn (mentor)
OpenPOWER on IntegriCloud