Android音頻驅動-ASOC之常用對象

struct snd_soc_dai {
    const char *name;
    int id;
    struct device *dev;
    void *ac97_pdata;   /* platform_data for the ac97 codec */

    /* driver ops */
    struct snd_soc_dai_driver *driver;

    /* DAI runtime info */
    unsigned int capture_active:1;      /* stream is in use */
    unsigned int playback_active:1;     /* stream is in use */
    unsigned int symmetric_rates:1;
    unsigned int symmetric_channels:1;
    unsigned int symmetric_samplebits:1;
    unsigned int active;
    unsigned char probed:1;

    struct snd_soc_dapm_widget *playback_widget;
    struct snd_soc_dapm_widget *capture_widget;

    /* DAI DMA data */
    void *playback_dma_data;
    void *capture_dma_data;

    /* Symmetry data - only valid if symmetry is being enforced */
    unsigned int rate;
    unsigned int channels;
    unsigned int sample_bits;

    /* parent platform/codec */
    struct snd_soc_platform *platform;
    struct snd_soc_codec *codec;
    struct snd_soc_component *component;

    /* CODEC TDM slot masks and params (for fixup) */
    unsigned int tx_mask;
    unsigned int rx_mask;

    struct snd_soc_card *card;

    struct list_head list;
};
struct snd_soc_component {
    const char *name;
    int id;
    const char *name_prefix;
    struct device *dev;
    struct snd_soc_card *card;

    unsigned int active;

    unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
    unsigned int registered_as_component:1;
    unsigned int probed:1;

    struct list_head list;

    struct snd_soc_dai_driver *dai_drv;
    int num_dai;

    const struct snd_soc_component_driver *driver;

    struct list_head dai_list;//保存codec dai鏈表對象

    int (*read)(struct snd_soc_component *, unsigned int, unsigned int *);
    int (*write)(struct snd_soc_component *, unsigned int, unsigned int);

    struct regmap *regmap;
    int val_bytes;

    struct mutex io_mutex;


    /*
    * DO NOT use any of the fields below in drivers, they are temporary and
    * are going to be removed again soon. If you use them in driver code the
    * driver will be marked as BROKEN when these fields are removed.
    */

    /* Don't use these, use snd_soc_component_get_dapm() */
    struct snd_soc_dapm_context dapm;
    struct snd_soc_dapm_context *dapm_ptr;

    const struct snd_kcontrol_new *controls;
    unsigned int num_controls;
    const struct snd_soc_dapm_widget *dapm_widgets;
    unsigned int num_dapm_widgets;
    const struct snd_soc_dapm_route *dapm_routes;
    unsigned int num_dapm_routes;
    struct snd_soc_codec *codec;//屬於哪個codec

    int (*probe)(struct snd_soc_component *);
    void (*remove)(struct snd_soc_component *);

};
struct snd_soc_codec {
    struct device *dev;
    const struct snd_soc_codec_driver *driver;

    struct mutex mutex;
    struct list_head list;
    struct list_head card_list;

    /* runtime */
    struct snd_ac97 *ac97;  /* for ad-hoc ac97 devices */
    unsigned int cache_bypass:1; /* Suppress access to the cache */
    unsigned int suspended:1; /* Codec is in suspend PM state */
    unsigned int ac97_registered:1; /* Codec has been AC97 registered */
    unsigned int ac97_created:1; /* Codec has been created by SoC */
    unsigned int cache_init:1; /* codec cache has been initialized */
    u32 cache_sync; /* Cache needs to be synced to hardware */

    /* codec IO */
    void *control_data; /* codec control (i2c/3wire) data */
    hw_write_t hw_write;
    void *reg_cache;
    struct mutex cache_rw_mutex;

    /* component */
    struct snd_soc_component component;//保存component對象

    /* dapm */
    struct snd_soc_dapm_context dapm;
};
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章