1db1eb528SBen Skeggs /*
2db1eb528SBen Skeggs * Copyright 2012 Red Hat Inc.
3db1eb528SBen Skeggs *
4db1eb528SBen Skeggs * Permission is hereby granted, free of charge, to any person obtaining a
5db1eb528SBen Skeggs * copy of this software and associated documentation files (the "Software"),
6db1eb528SBen Skeggs * to deal in the Software without restriction, including without limitation
7db1eb528SBen Skeggs * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8db1eb528SBen Skeggs * and/or sell copies of the Software, and to permit persons to whom the
9db1eb528SBen Skeggs * Software is furnished to do so, subject to the following conditions:
10db1eb528SBen Skeggs *
11db1eb528SBen Skeggs * The above copyright notice and this permission notice shall be included in
12db1eb528SBen Skeggs * all copies or substantial portions of the Software.
13db1eb528SBen Skeggs *
14db1eb528SBen Skeggs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15db1eb528SBen Skeggs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16db1eb528SBen Skeggs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17db1eb528SBen Skeggs * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18db1eb528SBen Skeggs * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19db1eb528SBen Skeggs * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20db1eb528SBen Skeggs * OTHER DEALINGS IN THE SOFTWARE.
21db1eb528SBen Skeggs *
22db1eb528SBen Skeggs * Authors: Ben Skeggs
23db1eb528SBen Skeggs */
24db1eb528SBen Skeggs #include "priv.h"
25db1eb528SBen Skeggs #include "pad.h"
26db1eb528SBen Skeggs
27*a25a5d56SBen Skeggs #include <subdev/gsp.h>
28*a25a5d56SBen Skeggs
298ad95edcSBen Skeggs static void
gm200_aux_autodpcd(struct nvkm_i2c * i2c,int aux,bool enable)308ad95edcSBen Skeggs gm200_aux_autodpcd(struct nvkm_i2c *i2c, int aux, bool enable)
318ad95edcSBen Skeggs {
328ad95edcSBen Skeggs nvkm_mask(i2c->subdev.device, 0x00d968 + (aux * 0x50), 0x00010000, enable << 16);
338ad95edcSBen Skeggs }
348ad95edcSBen Skeggs
35db1eb528SBen Skeggs static const struct nvkm_i2c_func
36db1eb528SBen Skeggs gm200_i2c = {
37db1eb528SBen Skeggs .pad_x_new = gf119_i2c_pad_x_new,
38db1eb528SBen Skeggs .pad_s_new = gm200_i2c_pad_s_new,
39db1eb528SBen Skeggs .aux = 8,
40db1eb528SBen Skeggs .aux_stat = gk104_aux_stat,
41db1eb528SBen Skeggs .aux_mask = gk104_aux_mask,
428ad95edcSBen Skeggs .aux_autodpcd = gm200_aux_autodpcd,
43db1eb528SBen Skeggs };
44db1eb528SBen Skeggs
45db1eb528SBen Skeggs int
gm200_i2c_new(struct nvkm_device * device,enum nvkm_subdev_type type,int inst,struct nvkm_i2c ** pi2c)46c6ce0861SBen Skeggs gm200_i2c_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
47c6ce0861SBen Skeggs struct nvkm_i2c **pi2c)
48db1eb528SBen Skeggs {
49*a25a5d56SBen Skeggs if (nvkm_gsp_rm(device->gsp))
50*a25a5d56SBen Skeggs return -ENODEV;
51*a25a5d56SBen Skeggs
52c6ce0861SBen Skeggs return nvkm_i2c_new_(&gm200_i2c, device, type, inst, pi2c);
53db1eb528SBen Skeggs }
54