linux/drivers/gpu/drm/nouveau/core/subdev/i2c/pad.h
<<
>>
Prefs
   1#ifndef __NVKM_I2C_PAD_H__
   2#define __NVKM_I2C_PAD_H__
   3
   4#include "priv.h"
   5
   6struct nvkm_i2c_pad {
   7        struct nouveau_object base;
   8        int index;
   9        struct nouveau_i2c_port *port;
  10        struct nouveau_i2c_port *next;
  11};
  12
  13static inline struct nvkm_i2c_pad *
  14nvkm_i2c_pad(struct nouveau_i2c_port *port)
  15{
  16        struct nouveau_object *pad = nv_object(port);
  17        while (pad->parent)
  18                pad = pad->parent;
  19        return (void *)pad;
  20}
  21
  22#define nvkm_i2c_pad_create(p,e,o,i,d)                                         \
  23        nvkm_i2c_pad_create_((p), (e), (o), (i), sizeof(**d), (void **)d)
  24#define nvkm_i2c_pad_destroy(p) ({                                             \
  25        struct nvkm_i2c_pad *_p = (p);                                         \
  26        _nvkm_i2c_pad_dtor(nv_object(_p));                                     \
  27})
  28#define nvkm_i2c_pad_init(p) ({                                                \
  29        struct nvkm_i2c_pad *_p = (p);                                         \
  30        _nvkm_i2c_pad_init(nv_object(_p));                                     \
  31})
  32#define nvkm_i2c_pad_fini(p,s) ({                                              \
  33        struct nvkm_i2c_pad *_p = (p);                                         \
  34        _nvkm_i2c_pad_fini(nv_object(_p), (s));                                \
  35})
  36
  37int nvkm_i2c_pad_create_(struct nouveau_object *, struct nouveau_object *,
  38                         struct nouveau_oclass *, int index, int, void **);
  39
  40int _nvkm_i2c_pad_ctor(struct nouveau_object *, struct nouveau_object *,
  41                       struct nouveau_oclass *, void *, u32,
  42                       struct nouveau_object **);
  43#define _nvkm_i2c_pad_dtor nouveau_object_destroy
  44int _nvkm_i2c_pad_init(struct nouveau_object *);
  45int _nvkm_i2c_pad_fini(struct nouveau_object *, bool);
  46
  47#ifndef MSG
  48#define MSG(l,f,a...) do {                                                     \
  49        struct nvkm_i2c_pad *_pad = (void *)pad;                               \
  50        nv_##l(nv_object(_pad)->engine, "PAD:%c:%02x: "f,                      \
  51               _pad->index >= 0x100 ? 'X' : 'S',                               \
  52               _pad->index >= 0x100 ? _pad->index - 0x100 : _pad->index, ##a); \
  53} while(0)
  54#define DBG(f,a...) MSG(debug, f, ##a)
  55#define ERR(f,a...) MSG(error, f, ##a)
  56#endif
  57
  58#endif
  59