mcp.h 1.9 KB

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