mcp.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. #include <mach/dma.h>
  13. struct mcp_ops;
  14. struct mcp {
  15. struct module *owner;
  16. struct mcp_ops *ops;
  17. spinlock_t lock;
  18. int use_count;
  19. unsigned int sclk_rate;
  20. unsigned int rw_timeout;
  21. dma_device_t dma_audio_rd;
  22. dma_device_t dma_audio_wr;
  23. dma_device_t dma_telco_rd;
  24. dma_device_t dma_telco_wr;
  25. struct device attached_device;
  26. };
  27. struct mcp_ops {
  28. void (*set_telecom_divisor)(struct mcp *, unsigned int);
  29. void (*set_audio_divisor)(struct mcp *, unsigned int);
  30. void (*reg_write)(struct mcp *, unsigned int, unsigned int);
  31. unsigned int (*reg_read)(struct mcp *, unsigned int);
  32. void (*enable)(struct mcp *);
  33. void (*disable)(struct mcp *);
  34. };
  35. void mcp_set_telecom_divisor(struct mcp *, unsigned int);
  36. void mcp_set_audio_divisor(struct mcp *, unsigned int);
  37. void mcp_reg_write(struct mcp *, unsigned int, unsigned int);
  38. unsigned int mcp_reg_read(struct mcp *, unsigned int);
  39. void mcp_enable(struct mcp *);
  40. void mcp_disable(struct mcp *);
  41. #define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate)
  42. struct mcp *mcp_host_alloc(struct device *, size_t);
  43. int mcp_host_register(struct mcp *);
  44. void mcp_host_unregister(struct mcp *);
  45. struct mcp_driver {
  46. struct device_driver drv;
  47. int (*probe)(struct mcp *);
  48. void (*remove)(struct mcp *);
  49. int (*suspend)(struct mcp *, pm_message_t);
  50. int (*resume)(struct mcp *);
  51. };
  52. int mcp_driver_register(struct mcp_driver *);
  53. void mcp_driver_unregister(struct mcp_driver *);
  54. #define mcp_get_drvdata(mcp) dev_get_drvdata(&(mcp)->attached_device)
  55. #define mcp_set_drvdata(mcp,d) dev_set_drvdata(&(mcp)->attached_device, d)
  56. #define mcp_priv(mcp) ((void *)((mcp)+1))
  57. #endif