1/* 2 * linux/drivers/mfd/mcp.h 3 * 4 * Copyright (C) 2001 Russell King, All Rights Reserved. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License. 9 */ 10#ifndef MCP_H 11#define MCP_H 12 13struct mcp_ops; 14 15struct mcp { 16 struct module *owner; 17 struct mcp_ops *ops; 18 spinlock_t lock; 19 int use_count; 20 unsigned int sclk_rate; 21 unsigned int rw_timeout; 22 dma_device_t dma_audio_rd; 23 dma_device_t dma_audio_wr; 24 dma_device_t dma_telco_rd; 25 dma_device_t dma_telco_wr; 26 struct device attached_device; 27}; 28 29struct mcp_ops { 30 void (*set_telecom_divisor)(struct mcp *, unsigned int); 31 void (*set_audio_divisor)(struct mcp *, unsigned int); 32 void (*reg_write)(struct mcp *, unsigned int, unsigned int); 33 unsigned int (*reg_read)(struct mcp *, unsigned int); 34 void (*enable)(struct mcp *); 35 void (*disable)(struct mcp *); 36}; 37 38void mcp_set_telecom_divisor(struct mcp *, unsigned int); 39void mcp_set_audio_divisor(struct mcp *, unsigned int); 40void mcp_reg_write(struct mcp *, unsigned int, unsigned int); 41unsigned int mcp_reg_read(struct mcp *, unsigned int); 42void mcp_enable(struct mcp *); 43void mcp_disable(struct mcp *); 44#define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate) 45 46struct mcp *mcp_host_alloc(struct device *, size_t); 47int mcp_host_register(struct mcp *); 48void mcp_host_unregister(struct mcp *); 49 50struct mcp_driver { 51 struct device_driver drv; 52 int (*probe)(struct mcp *); 53 void (*remove)(struct mcp *); 54 int (*suspend)(struct mcp *, pm_message_t); 55 int (*resume)(struct mcp *); 56}; 57 58int mcp_driver_register(struct mcp_driver *); 59void mcp_driver_unregister(struct mcp_driver *); 60 61#define mcp_get_drvdata(mcp) dev_get_drvdata(&(mcp)->attached_device) 62#define mcp_set_drvdata(mcp,d) dev_set_drvdata(&(mcp)->attached_device, d) 63 64#define mcp_priv(mcp) ((void *)((mcp)+1)) 65 66#endif 67