Ben Skeggs | 7974dd1 | 2015-08-20 14:54:17 +1000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Red Hat Inc. |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice shall be included in |
| 12 | * all copies or substantial portions of the Software. |
| 13 | * |
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 | * OTHER DEALINGS IN THE SOFTWARE. |
| 21 | * |
| 22 | * Authors: Ben Skeggs <bskeggs@redhat.com> |
| 23 | */ |
| 24 | #include <core/tegra.h> |
| 25 | #ifdef CONFIG_NOUVEAU_PLATFORM_DRIVER |
| 26 | #include "priv.h" |
| 27 | |
| 28 | static struct nvkm_device_tegra * |
| 29 | nvkm_device_tegra(struct nvkm_device *obj) |
| 30 | { |
| 31 | return container_of(obj, struct nvkm_device_tegra, device); |
| 32 | } |
| 33 | |
| 34 | static const struct nvkm_device_func |
| 35 | nvkm_device_tegra_func = { |
| 36 | .tegra = nvkm_device_tegra, |
| 37 | }; |
| 38 | |
| 39 | int |
| 40 | nvkm_device_tegra_new(struct platform_device *pdev, |
| 41 | const char *cfg, const char *dbg, |
| 42 | bool detect, bool mmio, u64 subdev_mask, |
| 43 | struct nvkm_device **pdevice) |
| 44 | { |
| 45 | struct nvkm_device_tegra *tdev; |
| 46 | |
| 47 | if (!(tdev = kzalloc(sizeof(*tdev), GFP_KERNEL))) |
| 48 | return -ENOMEM; |
| 49 | *pdevice = &tdev->device; |
| 50 | tdev->pdev = pdev; |
| 51 | |
| 52 | return nvkm_device_ctor(&nvkm_device_tegra_func, NULL, pdev, |
| 53 | NVKM_BUS_PLATFORM, pdev->id, NULL, |
| 54 | cfg, dbg, detect, mmio, subdev_mask, |
| 55 | &tdev->device); |
| 56 | } |
| 57 | #else |
| 58 | int |
| 59 | nvkm_device_tegra_new(struct platform_device *pdev, |
| 60 | const char *cfg, const char *dbg, |
| 61 | bool detect, bool mmio, u64 subdev_mask, |
| 62 | struct nvkm_device **pdevice) |
| 63 | { |
| 64 | return -ENOSYS; |
| 65 | } |
| 66 | #endif |