vic.c (82ffd0454bd9bd57780966d47bfd56d579dd4fb3) vic.c (77a0b09dd993c83ee7c770cc704e9bec18fd19c7)
1/*
2 * Copyright (c) 2015, NVIDIA Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8

--- 167 unchanged lines hidden (view full) ---

176 dev_err(vic->dev, "failed to attach to domain: %d\n",
177 err);
178 return err;
179 }
180
181 vic->domain = tegra->domain;
182 }
183
1/*
2 * Copyright (c) 2015, NVIDIA Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8

--- 167 unchanged lines hidden (view full) ---

176 dev_err(vic->dev, "failed to attach to domain: %d\n",
177 err);
178 return err;
179 }
180
181 vic->domain = tegra->domain;
182 }
183
184 if (!vic->falcon.data) {
185 vic->falcon.data = tegra;
186 err = falcon_load_firmware(&vic->falcon);
187 if (err < 0)
188 goto detach;
189 }
190
191 vic->channel = host1x_channel_request(client->dev);
192 if (!vic->channel) {
193 err = -ENOMEM;
194 goto detach;
195 }
196
197 client->syncpts[0] = host1x_syncpt_request(client, 0);
198 if (!client->syncpts[0]) {

--- 42 unchanged lines hidden (view full) ---

241 return 0;
242}
243
244static const struct host1x_client_ops vic_client_ops = {
245 .init = vic_init,
246 .exit = vic_exit,
247};
248
184 vic->channel = host1x_channel_request(client->dev);
185 if (!vic->channel) {
186 err = -ENOMEM;
187 goto detach;
188 }
189
190 client->syncpts[0] = host1x_syncpt_request(client, 0);
191 if (!client->syncpts[0]) {

--- 42 unchanged lines hidden (view full) ---

234 return 0;
235}
236
237static const struct host1x_client_ops vic_client_ops = {
238 .init = vic_init,
239 .exit = vic_exit,
240};
241
242static int vic_load_firmware(struct vic *vic)
243{
244 int err;
245
246 if (vic->falcon.data)
247 return 0;
248
249 vic->falcon.data = vic->client.drm;
250
251 err = falcon_read_firmware(&vic->falcon, vic->config->firmware);
252 if (err < 0)
253 goto cleanup;
254
255 err = falcon_load_firmware(&vic->falcon);
256 if (err < 0)
257 goto cleanup;
258
259 return 0;
260
261cleanup:
262 vic->falcon.data = NULL;
263 return err;
264}
265
249static int vic_open_channel(struct tegra_drm_client *client,
250 struct tegra_drm_context *context)
251{
252 struct vic *vic = to_vic(client);
253 int err;
254
255 err = pm_runtime_get_sync(vic->dev);
256 if (err < 0)
257 return err;
258
266static int vic_open_channel(struct tegra_drm_client *client,
267 struct tegra_drm_context *context)
268{
269 struct vic *vic = to_vic(client);
270 int err;
271
272 err = pm_runtime_get_sync(vic->dev);
273 if (err < 0)
274 return err;
275
276 err = vic_load_firmware(vic);
277 if (err < 0)
278 goto rpm_put;
279
259 err = vic_boot(vic);
280 err = vic_boot(vic);
260 if (err < 0) {
261 pm_runtime_put(vic->dev);
262 return err;
263 }
281 if (err < 0)
282 goto rpm_put;
264
265 context->channel = host1x_channel_get(vic->channel);
266 if (!context->channel) {
283
284 context->channel = host1x_channel_get(vic->channel);
285 if (!context->channel) {
267 pm_runtime_put(vic->dev);
268 return -ENOMEM;
286 err = -ENOMEM;
287 goto rpm_put;
269 }
270
271 return 0;
288 }
289
290 return 0;
291
292rpm_put:
293 pm_runtime_put(vic->dev);
294 return err;
272}
273
274static void vic_close_channel(struct tegra_drm_context *context)
275{
276 struct vic *vic = to_vic(context->client);
277
278 host1x_channel_put(context->channel);
279

--- 87 unchanged lines hidden (view full) ---

367 vic->falcon.dev = dev;
368 vic->falcon.regs = vic->regs;
369 vic->falcon.ops = &vic_falcon_ops;
370
371 err = falcon_init(&vic->falcon);
372 if (err < 0)
373 return err;
374
295}
296
297static void vic_close_channel(struct tegra_drm_context *context)
298{
299 struct vic *vic = to_vic(context->client);
300
301 host1x_channel_put(context->channel);
302

--- 87 unchanged lines hidden (view full) ---

390 vic->falcon.dev = dev;
391 vic->falcon.regs = vic->regs;
392 vic->falcon.ops = &vic_falcon_ops;
393
394 err = falcon_init(&vic->falcon);
395 if (err < 0)
396 return err;
397
375 err = falcon_read_firmware(&vic->falcon, vic->config->firmware);
376 if (err < 0)
377 goto exit_falcon;
378
379 platform_set_drvdata(pdev, vic);
380
381 INIT_LIST_HEAD(&vic->client.base.list);
382 vic->client.base.ops = &vic_client_ops;
383 vic->client.base.dev = dev;
384 vic->client.base.class = HOST1X_CLASS_VIC;
385 vic->client.base.syncpts = syncpts;
386 vic->client.base.num_syncpts = 1;

--- 78 unchanged lines hidden ---
398 platform_set_drvdata(pdev, vic);
399
400 INIT_LIST_HEAD(&vic->client.base.list);
401 vic->client.base.ops = &vic_client_ops;
402 vic->client.base.dev = dev;
403 vic->client.base.class = HOST1X_CLASS_VIC;
404 vic->client.base.syncpts = syncpts;
405 vic->client.base.num_syncpts = 1;

--- 78 unchanged lines hidden ---