mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
c942fddf87
Based on 3 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version [author] [graeme] [gregory] [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema] [hk] [hemahk]@[ti] [com] this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1105 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
99 lines
2.2 KiB
C
99 lines
2.2 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Driver for the Conexant CX23885/7/8 PCIe bridge
|
|
*
|
|
* Various common ioctl() support functions
|
|
*
|
|
* Copyright (c) 2009 Andy Walls <awalls@md.metrocast.net>
|
|
*/
|
|
|
|
#include "cx23885.h"
|
|
#include "cx23885-ioctl.h"
|
|
|
|
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
|
int cx23885_g_chip_info(struct file *file, void *fh,
|
|
struct v4l2_dbg_chip_info *chip)
|
|
{
|
|
struct cx23885_dev *dev = video_drvdata(file);
|
|
|
|
if (chip->match.addr > 1)
|
|
return -EINVAL;
|
|
if (chip->match.addr == 1) {
|
|
if (dev->v4l_device == NULL)
|
|
return -EINVAL;
|
|
strscpy(chip->name, "cx23417", sizeof(chip->name));
|
|
} else {
|
|
strscpy(chip->name, dev->v4l2_dev.name, sizeof(chip->name));
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
static int cx23417_g_register(struct cx23885_dev *dev,
|
|
struct v4l2_dbg_register *reg)
|
|
{
|
|
u32 value;
|
|
|
|
if (dev->v4l_device == NULL)
|
|
return -EINVAL;
|
|
|
|
if ((reg->reg & 0x3) != 0 || reg->reg >= 0x10000)
|
|
return -EINVAL;
|
|
|
|
if (mc417_register_read(dev, (u16) reg->reg, &value))
|
|
return -EINVAL; /* V4L2 spec, but -EREMOTEIO really */
|
|
|
|
reg->size = 4;
|
|
reg->val = value;
|
|
return 0;
|
|
}
|
|
|
|
int cx23885_g_register(struct file *file, void *fh,
|
|
struct v4l2_dbg_register *reg)
|
|
{
|
|
struct cx23885_dev *dev = video_drvdata(file);
|
|
|
|
if (reg->match.addr > 1)
|
|
return -EINVAL;
|
|
if (reg->match.addr)
|
|
return cx23417_g_register(dev, reg);
|
|
|
|
if ((reg->reg & 0x3) != 0 || reg->reg >= pci_resource_len(dev->pci, 0))
|
|
return -EINVAL;
|
|
|
|
reg->size = 4;
|
|
reg->val = cx_read(reg->reg);
|
|
return 0;
|
|
}
|
|
|
|
static int cx23417_s_register(struct cx23885_dev *dev,
|
|
const struct v4l2_dbg_register *reg)
|
|
{
|
|
if (dev->v4l_device == NULL)
|
|
return -EINVAL;
|
|
|
|
if ((reg->reg & 0x3) != 0 || reg->reg >= 0x10000)
|
|
return -EINVAL;
|
|
|
|
if (mc417_register_write(dev, (u16) reg->reg, (u32) reg->val))
|
|
return -EINVAL; /* V4L2 spec, but -EREMOTEIO really */
|
|
return 0;
|
|
}
|
|
|
|
int cx23885_s_register(struct file *file, void *fh,
|
|
const struct v4l2_dbg_register *reg)
|
|
{
|
|
struct cx23885_dev *dev = video_drvdata(file);
|
|
|
|
if (reg->match.addr > 1)
|
|
return -EINVAL;
|
|
if (reg->match.addr)
|
|
return cx23417_s_register(dev, reg);
|
|
|
|
if ((reg->reg & 0x3) != 0 || reg->reg >= pci_resource_len(dev->pci, 0))
|
|
return -EINVAL;
|
|
|
|
cx_write(reg->reg, reg->val);
|
|
return 0;
|
|
}
|
|
#endif
|