1.\" $NetBSD: tsllux.4,v 1.3 2021/12/05 04:38:54 msaitoh Exp $ 2.\" 3.\" Copyright (c) 2018 Jason R Thorpe 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25.\" POSSIBILITY OF SUCH DAMAGE. 26.\" 27.Dd May 21, 2018 28.Dt TSLLUX 4 29.Os 30.Sh NAME 31.Nm tsllux 32.Nd Taos TSL256x Light-to-Digital Converter 33.Sh SYNOPSIS 34.Cd "tsllux* at iic? addr 0x29 flags 0x0" 35.Cd "tsllux* at iic? addr 0x39 flags 0x0" 36.Cd "tsllux* at iic? addr 0x49 flags 0x0" 37.Sh DESCRIPTION 38The 39.Nm 40driver provides support for the 41.Tn Taos 42TSL2560 and TSL2561 light-to-digital converter 43.Pq ambient light sensor 44with the 45.Xr envsys 4 46API. 47.Pp 48The TSL2560 is designed to work with SMBus at 100 kHz. 49The TSL2561 is designed to work with I2C Fast-Mode at 400 kHz. 50The sensors come in a variety of packages, including 6-lead Chipscale 51.Pq CS , 526-lead TMB 53.Pq T , 54dual flat no-lead 55.Pq FN , 56and 6-lead ChipLED 57.Pq CL . 58The 59.Sq CS 60package requires a different set of coefficients for calculating 61the Lux value from the raw sensor data. 62This behavior is enabled by specifying the flag 63.Dv 0x1 64in the kernel configuration file or by using a 65.Xr sysctl 8 66variable; see below. 67.Pp 68The 69.Nm 70driver exports some 71.Xr sysctl 8 72variables to control the behavior of the sensor and driver: 73.Bl -tag -width "XX" 74.It hw.tsllux0.cs_package Pq boolean, read-write 75This variable indicates if the driver instance has been configured 76to use the coeffecients appropriate for the 77.Sq CS 78package variant. 79.It hw.tsllux0.auto_gain Pq boolean, read-write 80This variable indicates if the driver has been configured to use 81an auto-gain algorithm to improve sensitivity of the sensor while 82taking care to avoid sensor saturation. 83Auto-gain is disabled by default. 84.It hw.tsllux0.gain Pq integer, read-write 85This variable indicates the selected sensor gain. 86If auto-gain is enabled, this will reflect the current gain setting 87selected by the auto-gain algorithm. 88Otherwise, it reflects the previously-configured gain. 89Valid values are 90.Dv 1 91and 92.Dv 16 . 93The default gain is 94.Dv 1 . 95Writing to this variable implicitly disables auto-gain. 96.It hw.tsllux0.integration_time Pq integer, read-write 97This variable indicates the selected analog-to-digital converter 98integration time. 99Longer integration times correspond to more accurate readings, at the 100cost of more costly read operation. 101Valid values are 102.Dv 13 Pq 13.7ms , 103.Dv 101 Pq 101ms , 104and 105.Dv 402 Pq 402ms . 106The default value is 107.Dv 101 . 108Note that that due to the granularity of sleep timing in the kernel, 109the 110.Nm 111driver will busy-wait for wait times less than 1 Hz, and add an additional 112sleep clock tick for wait times greater than 1 Hz. 113See 114.Xr hz 9 . 115.El 116.Sh SEE ALSO 117.Xr envsys 4 , 118.Xr iic 4 119.Sh HISTORY 120The 121.Nm 122driver first appeared in 123.Nx 9.0 . 124.Sh AUTHORS 125.An -nosplit 126The 127.Nm 128driver was written by 129.An Jason R Thorpe Aq Mt thorpej@NetBSD.org . 130.Sh BUGS 131The driver does not currently support the sensor's interrupt features 132or the sensor's manual integration timing feature. 133