summaryrefslogtreecommitdiffstats
path: root/sys/dev/iicbus
Commit message (Collapse)AuthorAgeFilesLines
* Fix the the mode of operation sysctl.Luiz Souza2017-09-191-2/+3
| | | | (cherry picked from commit 68ac788f00aea4daf0e51b72be45eb528f01f825)
* Set breathing on for kernel loading.Luiz Souza2017-09-191-0/+10
| | | | (cherry picked from commit 1289d51ce9ec2baff2d29b8e2e2be58890bbc7b4)
* Fix the off-by-one bugs in my math, allow the setting of the exact entered ↵Luiz Souza2017-09-191-6/+6
| | | | | | value. (cherry picked from commit 441ccf4b193c06e1a98e71d3709550f180bd4abb)
* Update the timers registers when switch to/from PWM mode, this turn on the ↵Luiz Souza2017-09-191-1/+3
| | | | | | one shot programming mode. (cherry picked from commit becbb91ba37bcef86d7d313c0e2befffc88953f2)
* Add a pair of convenience routines for doing simple "register" read/writesian2017-09-192-0/+62
| | | | | | | | | | | | | | | | | on i2c devices, where the "register" can be any length. Many (perhaps most) common i2c devices are organized as a collection of (usually 1-byte-wide) registers, and are accessed by first writing a 1-byte register index/offset number, then by reading or writing the data. Generally there is an auto-increment feature so the when multiple bytes are read or written, multiple contiguous registers are accessed. Most existing slave device drivers allocate an array of iic_msg structures, fill in all the transfer info, and invoke iicbus_transfer(). These new functions commonize all that and reduce register access to a simple call with a few arguments. (cherry picked from commit 7b74ced64a8e58ab40767d2715f2a598b040f40a)
* Export the LED breath timers to userland to make easier to control the LEDs ↵Luiz Souza2017-09-192-64/+323
| | | | | | effects from PHP. (cherry picked from commit 9fbcb1b9dac21d044f29fd2d90a8bf2292b9bc57)
* Fix a hardcoded value.Luiz Souza2017-09-061-1/+1
| | | | (cherry picked from commit 1c3557fa39adee20222b5acd4c3eba78606b7382)
* Enable color changes.Luiz Souza2017-09-061-0/+6
| | | | (cherry picked from commit 923a6ff4c0a60466abedecfbb945a3c290b9b1c3)
* Setup a basic breath sequence on startup.Luiz Souza2017-09-062-18/+42
| | | | (cherry picked from commit f213dad2443a52a8e53f0ec95ac5b927b496a4b0)
* Make the probe routine fail when no compatible is found.Luiz Souza2017-07-201-0/+2
| | | | (cherry picked from commit c3d78dab701406f5bc46cfc1267df5f24ed4ad7a)
* Add initial support to is31fl319x RGB LED driver.Luiz Souza2017-07-202-0/+435
| | | | (cherry picked from commit 981956f70fd72dfecf42adf4377e2acace4cfdd2)
* Add support for the PCA9552 16-bit LED driver with programmable blink rates.Luiz Souza2017-07-202-0/+456
| | | | (cherry picked from commit cb5fdc6a7263db6b05ee95456e847e413fed13e2)
* Always ignore the START and STOP bits whenever the control register isloos2017-07-201-4/+8
| | | | | | | | | | | | | | being overwritten, they are set only bits (cleared by hardware). Disable the Acknowledge of the controller slave address. The slave mode is not supported. Make sure the interrupt flag bit is being cleared as recommended, add a delay() _after_ clear the interrupt bit. Sponsored by: Rubicon Communications, LLC (Netgate) (cherry picked from commit a514510c057d6d853efa9c9558112f91760688ad)
* Make ofw_iicbus attach to twsi I2C controllers.loos2017-07-202-1/+15
| | | | | | | | | Add the ofw_bus_get_node() callback in mv_twsi, it is mandatory for the ofw_iicbus usage. Sponsored by: Rubicon Communications, LLC (Netgate) (cherry picked from commit 63d5603d622c5bb69f74644f066faa68709e87fb)
* MFC r313982, r314068:pfg2017-03-141-1/+1
| | | | | | sys: Replace zero with NULL for pointers. Found with: devel/coccinelle
* MFC r308530: iicsmb: SMB_MAXBLOCKSIZE can be used againavg2016-12-241-14/+4
|
* MFC r308104: add iic interface to ig4 driver, move isl and cyapa to iicbusavg2016-12-141-1/+3
|
* MFC r306589: Implement iicbus_write_ivar and impelemnt the NOSTOP ivaravg2016-12-141-0/+21
| | | | in both read and write.
* MFC r307195: convert iicsmb to use iicbus_transfer for all operationsavg2016-11-171-168/+142
|
* MFC r304459,r305527:mmel2016-11-051-2/+0
| | | | | | | | | | | | | | | | | | r304459: INTRNG: Rework handling with resources. Partially revert r301453. - Read interrupt properties at bus enumeration time and store it into global mapping table. - At bus_activate_resource() time, given mapping entry is resolved and connected to real interrupt source. A copy of mapping entry is attached to given resource. - At bus_setup_intr() time, mapping entry stored in resource is used for delivery of requested interrupt configuration. - For MSI/MSIX interrupts, mapping entry is created within pci_alloc_msi()/pci_alloc_msix() call. - For legacy PCI interrupts, mapping entry must be created within pcib_route_interrupt() by pcib driver itself. r305527: Fix MIPS INTRNG (both FDT and non-FDT) behaviour broken by r304459
* MFC r302523,r302528:mmel2016-11-051-2/+2
| | | | | | | | | | | r302523: Add clk_get_by_ofw_node_index, which is like clk_get_by_ofw_index but operates on a specific OF node instead of the pass in device's OF node. r302528: EXTRES: Add OF node as argument to all <foo>_get_by_ofw_<bar>() functions. In some cases, the driver must handle given properties located in specific OF subnode. Instead of creating duplicate set of function, add 'node' as argument to existing functions, defaulting it to device OF node.
* INTRNG - change the way how an interrupt mapping data are providedskra2016-06-051-0/+2
| | | | | | | | to the framework in OFW (FDT) case. This is a follow-up to r301451. Differential Revision: https://reviews.freebsd.org/D6634
* Add support for interrupts, sensors and GPIO for AXP209 PMIC.manu2016-05-261-2/+4
| | | | | | | | | | | | | | | | | Pressing the PEK (power enable key) will shutdown the board. Some events are reported to devd via system "PMU" and subsystem "Battery", "AC" and "USB" such as connected/disconnected. Some sensors values (power source voltage/current) are reported via sysctl (dev.axp209_pmu.X.) It also expose a gpioc node usable in kernel and userland. Only 3 of the 4 GPIO are exposed (The GPIO3 is different and mostly unused on boards). Most popular boards uses GPIO1 as a sense pin for OTG power. Add a dtsi file that adds gpio-controller capability to the device as upstream doesn't defined it and include it in our custom DTS. Reviewed by: jmcneill Approved by: cognet (mentor) Differential Revision: https://reviews.freebsd.org/D6135
* Move the OFW iicbus code to dev/iicbus to stop polluting dev/ofw withloos2016-05-241-0/+238
| | | | | | unrelated code. Discussed with: nwhitehorn (a long time ago)
* Fix the deciKelvin to Celsius conversion in kernel.loos2016-05-222-2/+2
| | | | | | | | | | | After r285994, sysctl(8) was fixed to use 273.15 instead of 273.20 as 0C reference and as result, the temperature read in sysctl(8) now exibits a +0.1C difference. This commit fix the kernel references to match the reference value used in sysctl(8) after r285994. Sponsored by: Rubicon Communications (Netgate)
* Remove a couple of extra blank lines.loos2016-05-222-2/+0
|
* iic_rdwr_data->nmsgs is uint32_t, so limit the allowable number of messages ↵jah2016-05-202-0/+11
| | | | | | | | | | | to prevent memory exhaustion and short allocations on 32-bit systems. Since iicrdwr is intended to be a workalike of a Linux i2c-dev call, use the same limit of 42 that Linux uses. Also check the return value of copyin(9) to prevent unnecessary allocation in the failure case. Submitted by: ngie Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D5155
* Use OF_prop_free instead of direct call to free(9)gonzo2016-05-141-4/+4
| | | | Reviewed by: jhibbits
* Add allwinner,sun8i-a83t-i2c to the list of compatible devices.jmcneill2016-05-141-0/+1
|
* sys/dev: minor spelling fixes.pfg2016-05-034-4/+4
| | | | Most affect comments, very few have user-visible effects.
* Convert Allwinner port to extres clk/hwreset/regulator APIs.jmcneill2016-04-061-27/+24
| | | | | | Reviewed by: andrew, gonzo, Emmanuel Vadot <manu@bidouilliste.com> Approved by: gonzo (mentor) Differential Revision: https://reviews.freebsd.org/D5752
* Add support for the Microchip mcp7941x.jhibbits2016-04-052-8/+34
| | | | | | | | This is compatible with the ds1307, but comparing the mcp7941x datasheet vs the ds1307 code, appears there is one bit placement difference, so that is now accounted for. Relnotes: yes
* Fix the resource_list_print_type() calls to use uintmax_t.jhibbits2016-03-221-1/+1
| | | | Missed a bunch from r297000.
* Migrate many bus_alloc_resource() calls to bus_alloc_resource_anywhere().jhibbits2016-02-271-2/+2
| | | | | | | | Most calls to bus_alloc_resource() use "anywhere" as the range, with a given count. Migrate these to use the new bus_alloc_resource_anywhere() API. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D5370
* Add the start of support for the Allwinner A31 clocks. It only addsandrew2016-02-261-2/+31
| | | | | | | | | support for the i2c, mmc, and gmac clocks. Further clocks can be added as needed. Submitted by: Emmanuel Vadot <manu@bidouilliste.com> Reviewed by: jmcneill Differential Revision: https://reviews.freebsd.org/D5339
* Fix the spelling of OF_getencprop. It will fix the data correctly for theandrew2016-02-152-6/+4
| | | | | | endian of the CPU so there is no need to call fdt32_to_cpu. Sponsored by: ABT Systems Ltd
* Add support for the Allwinner i2c device. This is similar to the existingandrew2016-02-154-314/+602
| | | | | | | | | | Marvell twsi part, however uses different register locations, as such split the existing driver into Marvell and Allwinner attachments. While here clean a few style issues. Submitted by: Emmanuel Vadot <manu@bidouilliste.com> Differential Revision: https://reviews.freebsd.org/D4846
* Move the twsi driver source to be under iicbus. It is in a separateandrew2016-02-141-0/+644
| | | | | | | directory as it is expected multiple attachments will be added for the SoC families that use this hardware. Sponsored by: ABT Systems Ltd
* Use the correct type for i when iterating over `buf` to avoid unlikelyngie2016-01-301-1/+2
| | | | | | | | | | | negative array indexing in iicrdwr(..) Differential Revision: https://reviews.freebsd.org/D5132 Obtained from: HardenedBSD PR: 206754 Reported by: CTurt <cturt@hardenedbsd.org> Submitted by: Madhi Moktari <mokhi64@gmail.com> Sponsored by: EMC / Isilon Storage Division
* Add FDT compatibility to the icee driver.ian2015-10-221-37/+120
| | | | | | | | | | | | | | | | | | | | The FDT bindings for eeprom parts don't include any metadata about the device other than the part name encoded in the compatible property. Instead, a driver is required to have a compiled-in table of information about the various parts (page size, device capacity, addressing scheme). So much for FDT being an abstract description of hardware characteristics, huh? In addition to the FDT-specific changes, this also switches to using the newer iicbus_transfer_excl() mechanism which holds bus ownership for the duration of the transfer. Previously this code held the bus across all the transfers needed to complete the user's IO request, which could be up to 128KB of data which might occupy the bus for 10-20 seconds. Now the bus will be released and re-aquired between every page-sized (8-256 byte) transfer, making this driver a much nicer citizen on the i2c bus. The hint-based configuration mechanism is still in place for non-FDT systems. Michal Meloun contributed some of the code for these changes.
* Add iicbus_transfer_excl(), a helper routine to do an i2c bus transactionian2015-10-222-0/+17
| | | | | | while holding exclusive ownership of the bus. This is the routine most slave drivers should use unless they have a need to acquire and hold the bus across a series of related operations that involves multiple transfers.
* iicbus: Use device_delete_children() instead of explicit child removaldumbbell2015-10-204-19/+6
| | | | | | | | | | | | | | | | | | If the bus is detached and deleted by a call to device_delete_child() or device_delete_children() on a device higher in the tree, I²C children were already detached and deleted. So the device_t pointer stored in sc points to freed memory: we must not try to delete it again. By using device_delete_children(), we let subr_bus.c figure out if there are children to take care of. While here, make sure iicbus_detach() and iicoc_detach() call device_delete_children() too, to be safe. Reviewed by: jhb, imp Approved by: jhb, imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D3926
* iicbus: Remove trailing whitespacesdumbbell2015-10-201-4/+4
| | | | MFC after: 1 week
* Replace a local sx lock that allowed only one client at a time to accessian2015-10-101-12/+11
| | | | | an eeprom device with iicbus_request/release_bus(), which achieves the same effect and also keeps other i2c slave drivers from clashing on the bus.
* Translate iic hardware layer status values to errno return values.ian2015-10-101-3/+9
|
* Add a short name, IIC_INTRWAIT, for the common case (IIC_INTR | IIC_WAIT).ian2015-10-101-0/+1
|
* Fix more cases of iicbus-layer functions that must return IIC_Exxxx values.ian2015-10-101-2/+2
|
* Return only IIC_Exxxx status values from iicbus-layer functions. Most ofian2015-10-092-7/+22
| | | | | | | | | | these functions are thin wrappers around calling the hardware-layer driver, but some of them do sanity checks and return an error. Since the hardware layer can only return IIC_Exxxxx status values, the iicbus helper functions must also adhere to that, so that drivers at higher layers can assume that any non-zero status value is an IIC_Exxxx value that provides details about what happened at the hardware layer (sometimes those details are important for certain slave drivers).
* Add iic2errno(), a helper function to translate IIC_Exxxxx status values toian2015-10-092-0/+24
| | | | | | | | | | | | | | | errno values that are at least vaguely equivelent. Also add a new status value, IIC_ERESOURCE, to indicate a failure to acquire memory or other required resources to complete a transaction. The IIC_Exxxxxx values are supposed to communicate low-level details of the i2c transaction status between the lowest-layer hardware driver and higher-layer bus protocol and device drivers for slave devices on the bus. Most of those slave drivers just return all status values from the lower layers directly to their callers, resulting in crazy error reporting from a user's point of view (things like timeouts being reported as "no such process"). Now there's a helper function to make it easier to start cleaning up all those drivers.
* Use IIC_EBUSBSY and IIC_BUSERR status values consistantly across all drivers.ian2015-10-092-3/+3
| | | | | | | | | | | | Make it clearer what each one means in the comments that define them. IIC_BUSBSY was used in many places to mean two different things, either "someone else has reserved the bus so you have to wait until they're done" or "the signal level on the bus was not in the state I expected before/after issuing some command". Now IIC_BUSERR is used consistantly to refer to protocol/signaling errors, and IIC_BUSBSY refers to ownership/reservation of the bus.
OpenPOWER on IntegriCloud