Lines Matching defs:sp

23 #include "sp-dev.h"
42 static void sp_add_device(struct sp_device *sp)
48 list_add_tail(&sp->entry, &sp_units);
53 static void sp_del_device(struct sp_device *sp)
59 list_del(&sp->entry);
66 struct sp_device *sp = data;
68 if (sp->ccp_irq_handler)
69 sp->ccp_irq_handler(irq, sp->ccp_irq_data);
71 if (sp->psp_irq_handler)
72 sp->psp_irq_handler(irq, sp->psp_irq_data);
77 int sp_request_ccp_irq(struct sp_device *sp, irq_handler_t handler,
82 if ((sp->psp_irq == sp->ccp_irq) && sp->dev_vdata->psp_vdata) {
84 sp->ccp_irq_data = data;
85 sp->ccp_irq_handler = handler;
87 if (!sp->irq_registered) {
88 ret = request_irq(sp->ccp_irq, sp_irq_handler, 0,
89 sp->name, sp);
93 sp->irq_registered = true;
97 ret = request_irq(sp->ccp_irq, handler, 0, name, data);
105 int sp_request_psp_irq(struct sp_device *sp, irq_handler_t handler,
110 if ((sp->psp_irq == sp->ccp_irq) && sp->dev_vdata->ccp_vdata) {
112 sp->psp_irq_data = data;
113 sp->psp_irq_handler = handler;
115 if (!sp->irq_registered) {
116 ret = request_irq(sp->psp_irq, sp_irq_handler, 0,
117 sp->name, sp);
121 sp->irq_registered = true;
125 ret = request_irq(sp->psp_irq, handler, 0, name, data);
133 void sp_free_ccp_irq(struct sp_device *sp, void *data)
135 if ((sp->psp_irq == sp->ccp_irq) && sp->dev_vdata->psp_vdata) {
137 if (!sp->psp_irq_handler) {
139 free_irq(sp->ccp_irq, sp);
141 sp->irq_registered = false;
144 sp->ccp_irq_handler = NULL;
145 sp->ccp_irq_data = NULL;
148 free_irq(sp->ccp_irq, data);
152 void sp_free_psp_irq(struct sp_device *sp, void *data)
154 if ((sp->psp_irq == sp->ccp_irq) && sp->dev_vdata->ccp_vdata) {
156 if (!sp->ccp_irq_handler) {
158 free_irq(sp->psp_irq, sp);
160 sp->irq_registered = false;
163 sp->psp_irq_handler = NULL;
164 sp->psp_irq_data = NULL;
167 free_irq(sp->psp_irq, data);
178 struct sp_device *sp;
180 sp = devm_kzalloc(dev, sizeof(*sp), GFP_KERNEL);
181 if (!sp)
184 sp->dev = dev;
185 sp->ord = atomic_inc_return(&sp_ordinal);
186 snprintf(sp->name, SP_MAX_NAME_LEN, "sp-%u", sp->ord);
188 return sp;
191 int sp_init(struct sp_device *sp)
193 sp_add_device(sp);
195 if (sp->dev_vdata->ccp_vdata)
196 ccp_dev_init(sp);
198 if (sp->dev_vdata->psp_vdata)
199 psp_dev_init(sp);
203 void sp_destroy(struct sp_device *sp)
205 if (sp->dev_vdata->ccp_vdata)
206 ccp_dev_destroy(sp);
208 if (sp->dev_vdata->psp_vdata)
209 psp_dev_destroy(sp);
211 sp_del_device(sp);
214 int sp_suspend(struct sp_device *sp)
216 if (sp->dev_vdata->ccp_vdata) {
217 ccp_dev_suspend(sp);
223 int sp_resume(struct sp_device *sp)
225 if (sp->dev_vdata->ccp_vdata) {
226 ccp_dev_resume(sp);