xref: /qemu/include/hw/gpio/pca9552.h (revision 736132e455eea08e37fe21b4140b8088f2c0956b)
15141d415SCédric Le Goater /*
25141d415SCédric Le Goater  * PCA9552 I2C LED blinker
35141d415SCédric Le Goater  *
45141d415SCédric Le Goater  * Copyright (c) 2017-2018, IBM Corporation.
55141d415SCédric Le Goater  *
65141d415SCédric Le Goater  * This work is licensed under the terms of the GNU GPL, version 2 or
75141d415SCédric Le Goater  * later. See the COPYING file in the top-level directory.
85141d415SCédric Le Goater  */
95141d415SCédric Le Goater #ifndef PCA9552_H
105141d415SCédric Le Goater #define PCA9552_H
115141d415SCédric Le Goater 
125141d415SCédric Le Goater #include "hw/i2c/i2c.h"
135141d415SCédric Le Goater 
145141d415SCédric Le Goater #define TYPE_PCA9552 "pca9552"
15*736132e4SPhilippe Mathieu-Daudé #define TYPE_PCA955X "pca955x"
16*736132e4SPhilippe Mathieu-Daudé #define PCA955X(obj) OBJECT_CHECK(PCA955xState, (obj), TYPE_PCA955X)
175141d415SCédric Le Goater 
18ec17228aSPhilippe Mathieu-Daudé #define PCA955X_NR_REGS 10
19*736132e4SPhilippe Mathieu-Daudé #define PCA955X_PIN_COUNT_MAX 16
205141d415SCédric Le Goater 
21ec17228aSPhilippe Mathieu-Daudé typedef struct PCA955xState {
225141d415SCédric Le Goater     /*< private >*/
235141d415SCédric Le Goater     I2CSlave i2c;
245141d415SCédric Le Goater     /*< public >*/
255141d415SCédric Le Goater 
265141d415SCédric Le Goater     uint8_t len;
275141d415SCédric Le Goater     uint8_t pointer;
285141d415SCédric Le Goater 
29ec17228aSPhilippe Mathieu-Daudé     uint8_t regs[PCA955X_NR_REGS];
30ec17228aSPhilippe Mathieu-Daudé } PCA955xState;
315141d415SCédric Le Goater 
325141d415SCédric Le Goater #endif
33