1 /* $NetBSD: nxp75areg.h,v 1.1 2026/06/03 11:08:41 jdc Exp $ */ 2 3 /*- 4 * Copyright (c) 2026 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Julian Coleman. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32 #ifndef _DEV_I2C_NXP75AREG_H_ 33 #define _DEV_I2C_NXP75AREG_H_ 34 35 /* 36 * *NXP* LM75A temperature sensor register definitions. 37 * Pin compatible but not the same as the *TI* LM75A. 38 */ 39 40 #define NXP75A_ADDRMASK 0x3f8 41 #define NXP75A_ADDR 0x48 42 43 /* 44 * Temperature on the NXP LM75A is represented by a 11-bit two's complement 45 * word with the LSB equal to 0.125C. From the data sheet: 46 * 47 * +127C 011 1111 1000 0x3f8 48 * +126.875C 011 1111 0111 0x3f7 49 * +126.125C 011 1111 0001 0x3f1 50 * +125C 011 1110 1000 0x3e8 51 * +25C 000 1100 1000 0x9c8 52 * +0.125C 000 0000 0001 0x001 53 * 0C 000 0000 0000 0x000 54 * -0.125C 111 1111 1111 0x7ff 55 * -25C 111 0011 1000 0x738 56 * -54.875C 110 0100 1001 0x649 57 * -55C 110 0100 1000 0x648 58 * 59 * The bits are left-shifted to take the high 11 bits of the 2 registers. 60 */ 61 62 /* Command bits 0-2 select the register */ 63 #define NXP75A_TEMP 0x00 64 #define NXP75A_CONFIG 0x01 65 #define NXP75A_THYST 0x02 66 #define NXP75A_OVERTEMP 0x03 67 68 /* Configuration register */ 69 #define NXP75A_CONF_SHUTDOWN (1 << 0) /* Shutdown mode */ 70 #define NXP75A_CONF_OS_MODE_INT (1 << 1) /* OS interrupt mode*/ 71 #define NXP75A_CONF_OS_MODE_CMP (1 << 0) /* OS comparator mode*/ 72 #define NXP75A_CONF_OS_POL_HIGH (2 << 1) /* OS polarity high */ 73 #define NXP75A_CONF_OS_POL_LOW (2 << 0) /* OS polarity low */ 74 #define NXP75A_CONF_OS_FLTQ_1 (0 << 3) /* OS fault queue len 1 */ 75 #define NXP75A_CONF_OS_FLTQ_2 (1 << 3) /* OS fault queue len 2 */ 76 #define NXP75A_CONF_OS_FLTQ_4 (2 << 3) /* OS fault queue len 4 */ 77 #define NXP75A_CONF_OS_FLTQ_6 (3 << 3) /* OS fault queue len 6 */ 78 79 #define NXP75A_TEMP_LEN 2 /* 2 bytes for temperatures */ 80 #define NXP75A_CONF_LEN 1 /* 1 byte for configuration */ 81 82 #endif /* _DEV_I2C_NXP75AREG_H_ */ 83