[media] cx88: don't use atomic_t for core->users
[firefly-linux-kernel-4.4.55.git] / drivers / media / video / cx88 / cx88.h
index c9981e77416a6f8292721b53333bd9cbba1da35c..a399a8b086babf4e9facf27a690cdb577a5b6427 100644 (file)
@@ -33,6 +33,7 @@
 #include <media/cx2341x.h>
 #include <media/videobuf-dvb.h>
 #include <media/ir-kbd-i2c.h>
+#include <media/wm8775.h>
 
 #include "btcx-risc.h"
 #include "cx88-reg.h"
@@ -240,6 +241,7 @@ extern const struct sram_channel const cx88_sram_channels[];
 #define CX88_BOARD_PROF_7301               83
 #define CX88_BOARD_SAMSUNG_SMT_7020        84
 #define CX88_BOARD_TWINHAN_VP1027_DVBS     85
+#define CX88_BOARD_TEVII_S464              86
 
 enum cx88_itype {
        CX88_VMUX_COMPOSITE1 = 1,
@@ -273,6 +275,9 @@ struct cx88_board {
        enum cx88_board_type    mpeg;
        unsigned int            audio_chip;
        int                     num_frontends;
+
+       /* Used for I2S devices */
+       int                     i2sinputcntl;
 };
 
 struct cx88_subid {
@@ -379,12 +384,13 @@ struct cx88_core {
 
        /* I2C remote data */
        struct IR_i2c_init_data    init_data;
+       struct wm8775_platform_data wm8775_data;
 
        struct mutex               lock;
        /* various v4l controls */
        u32                        freq;
-       atomic_t                   users;
-       atomic_t                   mpeg_users;
+       int                        users;
+       int                        mpeg_users;
 
        /* cx88-video needs to access cx8802 for hybrid tuner pll access. */
        struct cx8802_dev          *dvbdev;
@@ -398,17 +404,21 @@ static inline struct cx88_core *to_core(struct v4l2_device *v4l2_dev)
        return container_of(v4l2_dev, struct cx88_core, v4l2_dev);
 }
 
-#define call_all(core, o, f, args...)                          \
+#define WM8775_GID     (1 << 0)
+
+#define call_hw(core, grpid, o, f, args...) \
        do {                                                    \
                if (!core->i2c_rc) {                            \
                        if (core->gate_ctrl)                    \
                                core->gate_ctrl(core, 1);       \
-                       v4l2_device_call_all(&core->v4l2_dev, 0, o, f, ##args); \
+                       v4l2_device_call_all(&core->v4l2_dev, grpid, o, f, ##args); \
                        if (core->gate_ctrl)                    \
                                core->gate_ctrl(core, 0);       \
                }                                               \
        } while (0)
 
+#define call_all(core, o, f, args...) call_hw(core, 0, o, f, ##args)
+
 struct cx8800_dev;
 struct cx8802_dev;
 
@@ -495,6 +505,8 @@ struct cx8802_driver {
        int (*suspend)(struct pci_dev *pci_dev, pm_message_t state);
        int (*resume)(struct pci_dev *pci_dev);
 
+       /* Callers to the following functions must hold core->lock */
+
        /* MPEG 8802 -> mini driver - Driver probe and configuration */
        int (*probe)(struct cx8802_driver *drv);
        int (*remove)(struct cx8802_driver *drv);
@@ -551,8 +563,9 @@ struct cx8802_dev {
        /* for switching modulation types */
        unsigned char              ts_gen_cntrl;
 
-       /* List of attached drivers */
+       /* List of attached drivers; must hold core->lock to access */
        struct list_head           drvlist;
+
        struct work_struct         request_module_wk;
 };
 
@@ -675,6 +688,8 @@ int cx88_audio_thread(void *data);
 
 int cx8802_register_driver(struct cx8802_driver *drv);
 int cx8802_unregister_driver(struct cx8802_driver *drv);
+
+/* Caller must hold core->lock */
 struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype);
 
 /* ----------------------------------------------------------- */