| Russell King | a4e137a | 2005-08-18 10:06:59 +0100 | [diff] [blame] | 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 |  | 
| Thomas Kunze | c8602ed | 2009-02-10 14:54:57 +0100 | [diff] [blame] | 13 | #include <mach/dma.h> | 
 | 14 |  | 
| Russell King | a4e137a | 2005-08-18 10:06:59 +0100 | [diff] [blame] | 15 | struct mcp_ops; | 
 | 16 |  | 
 | 17 | struct mcp { | 
 | 18 | 	struct module	*owner; | 
 | 19 | 	struct mcp_ops	*ops; | 
 | 20 | 	spinlock_t	lock; | 
 | 21 | 	int		use_count; | 
 | 22 | 	unsigned int	sclk_rate; | 
 | 23 | 	unsigned int	rw_timeout; | 
 | 24 | 	dma_device_t	dma_audio_rd; | 
 | 25 | 	dma_device_t	dma_audio_wr; | 
 | 26 | 	dma_device_t	dma_telco_rd; | 
 | 27 | 	dma_device_t	dma_telco_wr; | 
 | 28 | 	struct device	attached_device; | 
| Thomas Kunze | 9ca3dc8 | 2009-02-10 14:50:56 +0100 | [diff] [blame] | 29 | 	int		gpio_base; | 
| Russell King | a4e137a | 2005-08-18 10:06:59 +0100 | [diff] [blame] | 30 | }; | 
 | 31 |  | 
 | 32 | struct mcp_ops { | 
 | 33 | 	void		(*set_telecom_divisor)(struct mcp *, unsigned int); | 
 | 34 | 	void		(*set_audio_divisor)(struct mcp *, unsigned int); | 
 | 35 | 	void		(*reg_write)(struct mcp *, unsigned int, unsigned int); | 
 | 36 | 	unsigned int	(*reg_read)(struct mcp *, unsigned int); | 
 | 37 | 	void		(*enable)(struct mcp *); | 
 | 38 | 	void		(*disable)(struct mcp *); | 
 | 39 | }; | 
 | 40 |  | 
 | 41 | void mcp_set_telecom_divisor(struct mcp *, unsigned int); | 
 | 42 | void mcp_set_audio_divisor(struct mcp *, unsigned int); | 
 | 43 | void mcp_reg_write(struct mcp *, unsigned int, unsigned int); | 
 | 44 | unsigned int mcp_reg_read(struct mcp *, unsigned int); | 
 | 45 | void mcp_enable(struct mcp *); | 
 | 46 | void mcp_disable(struct mcp *); | 
 | 47 | #define mcp_get_sclk_rate(mcp)	((mcp)->sclk_rate) | 
 | 48 |  | 
 | 49 | struct mcp *mcp_host_alloc(struct device *, size_t); | 
 | 50 | int mcp_host_register(struct mcp *); | 
 | 51 | void mcp_host_unregister(struct mcp *); | 
 | 52 |  | 
 | 53 | struct mcp_driver { | 
 | 54 | 	struct device_driver drv; | 
 | 55 | 	int (*probe)(struct mcp *); | 
 | 56 | 	void (*remove)(struct mcp *); | 
 | 57 | 	int (*suspend)(struct mcp *, pm_message_t); | 
 | 58 | 	int (*resume)(struct mcp *); | 
 | 59 | }; | 
 | 60 |  | 
 | 61 | int mcp_driver_register(struct mcp_driver *); | 
 | 62 | void mcp_driver_unregister(struct mcp_driver *); | 
 | 63 |  | 
 | 64 | #define mcp_get_drvdata(mcp)	dev_get_drvdata(&(mcp)->attached_device) | 
 | 65 | #define mcp_set_drvdata(mcp,d)	dev_set_drvdata(&(mcp)->attached_device, d) | 
 | 66 |  | 
 | 67 | #define mcp_priv(mcp)		((void *)((mcp)+1)) | 
 | 68 |  | 
 | 69 | #endif |