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