18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/* -------------------------------------------------------------------- */
38c2ecf20Sopenharmony_ci/* i2c-pcf8584.h: PCF 8584 global defines				*/
48c2ecf20Sopenharmony_ci/* -------------------------------------------------------------------- */
58c2ecf20Sopenharmony_ci/*   Copyright (C) 1996 Simon G. Vogl
68c2ecf20Sopenharmony_ci                   1999 Hans Berglund
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci/* --------------------------------------------------------------------	*/
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/* With some changes from Frodo Looijaard <frodol@dds.nl> */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#ifndef I2C_PCF8584_H
148c2ecf20Sopenharmony_ci#define I2C_PCF8584_H 1
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/* ----- Control register bits ----------------------------------------	*/
178c2ecf20Sopenharmony_ci#define I2C_PCF_PIN	0x80
188c2ecf20Sopenharmony_ci#define I2C_PCF_ESO	0x40
198c2ecf20Sopenharmony_ci#define I2C_PCF_ES1	0x20
208c2ecf20Sopenharmony_ci#define I2C_PCF_ES2	0x10
218c2ecf20Sopenharmony_ci#define I2C_PCF_ENI	0x08
228c2ecf20Sopenharmony_ci#define I2C_PCF_STA	0x04
238c2ecf20Sopenharmony_ci#define I2C_PCF_STO	0x02
248c2ecf20Sopenharmony_ci#define I2C_PCF_ACK	0x01
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#define I2C_PCF_START    (I2C_PCF_PIN | I2C_PCF_ESO | I2C_PCF_STA | I2C_PCF_ACK)
278c2ecf20Sopenharmony_ci#define I2C_PCF_STOP     (I2C_PCF_PIN | I2C_PCF_ESO | I2C_PCF_STO | I2C_PCF_ACK)
288c2ecf20Sopenharmony_ci#define I2C_PCF_REPSTART (              I2C_PCF_ESO | I2C_PCF_STA | I2C_PCF_ACK)
298c2ecf20Sopenharmony_ci#define I2C_PCF_IDLE     (I2C_PCF_PIN | I2C_PCF_ESO               | I2C_PCF_ACK)
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* ----- Status register bits -----------------------------------------	*/
328c2ecf20Sopenharmony_ci/*#define I2C_PCF_PIN  0x80    as above*/
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define I2C_PCF_INI 0x40   /* 1 if not initialized */
358c2ecf20Sopenharmony_ci#define I2C_PCF_STS 0x20
368c2ecf20Sopenharmony_ci#define I2C_PCF_BER 0x10
378c2ecf20Sopenharmony_ci#define I2C_PCF_AD0 0x08
388c2ecf20Sopenharmony_ci#define I2C_PCF_LRB 0x08
398c2ecf20Sopenharmony_ci#define I2C_PCF_AAS 0x04
408c2ecf20Sopenharmony_ci#define I2C_PCF_LAB 0x02
418c2ecf20Sopenharmony_ci#define I2C_PCF_BB  0x01
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci/* ----- Chip clock frequencies ---------------------------------------	*/
448c2ecf20Sopenharmony_ci#define I2C_PCF_CLK3	0x00
458c2ecf20Sopenharmony_ci#define I2C_PCF_CLK443	0x10
468c2ecf20Sopenharmony_ci#define I2C_PCF_CLK6	0x14
478c2ecf20Sopenharmony_ci#define I2C_PCF_CLK	0x18
488c2ecf20Sopenharmony_ci#define I2C_PCF_CLK12	0x1c
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci/* ----- transmission frequencies -------------------------------------	*/
518c2ecf20Sopenharmony_ci#define I2C_PCF_TRNS90 0x00	/*  90 kHz */
528c2ecf20Sopenharmony_ci#define I2C_PCF_TRNS45 0x01	/*  45 kHz */
538c2ecf20Sopenharmony_ci#define I2C_PCF_TRNS11 0x02	/*  11 kHz */
548c2ecf20Sopenharmony_ci#define I2C_PCF_TRNS15 0x03	/* 1.5 kHz */
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci/* ----- Access to internal registers according to ES1,ES2 ------------	*/
588c2ecf20Sopenharmony_ci/* they are mapped to the data port ( a0 = 0 ) 				*/
598c2ecf20Sopenharmony_ci/* available when ESO == 0 :						*/
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#define I2C_PCF_OWNADR	0
628c2ecf20Sopenharmony_ci#define I2C_PCF_INTREG	I2C_PCF_ES2
638c2ecf20Sopenharmony_ci#define I2C_PCF_CLKREG	I2C_PCF_ES1
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#endif /* I2C_PCF8584_H */
66