diff options
| author | David Bang <dbang@nvidia.com> | 2017-10-11 17:33:20 -0400 |
|---|---|---|
| committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-10-25 20:29:26 -0400 |
| commit | 4173a8a377c190514f51224159bbdf1e5efd8dee (patch) | |
| tree | 5981edf56bdfccb9b3988c724fb42a321c80b315 | |
| parent | f505012f51c6e2ccd7da71b0d77ecbd0d4089431 (diff) | |
drivers: camera: add ioctl for mipi bias pad
Add support for the user to read mipi bias pad config
registers.
Jira CRTC-1436
Change-Id: I6e5cc5865d226e31f10c7b0c3bc4d0ce78e91d26
Signed-off-by: David Bang <dbang@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1577309
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bhanu Murthy V <bmurthyv@nvidia.com>
Reviewed-by: Josh Kergan <jkergan@nvidia.com>
Reviewed-by: Jihoon Bang <jbang@nvidia.com>
| -rw-r--r-- | drivers/media/platform/tegra/mipical/mipi_cal.c | 24 | ||||
| -rw-r--r-- | include/uapi/misc/tegra_mipi_ioctl.h | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/media/platform/tegra/mipical/mipi_cal.c b/drivers/media/platform/tegra/mipical/mipi_cal.c index fb82f27c7..d848622c0 100644 --- a/drivers/media/platform/tegra/mipical/mipi_cal.c +++ b/drivers/media/platform/tegra/mipical/mipi_cal.c | |||
| @@ -776,6 +776,30 @@ static long mipi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 776 | } | 776 | } |
| 777 | return 0; | 777 | return 0; |
| 778 | } | 778 | } |
| 779 | case _IOC_NR(TEGRA_MIPI_IOCTL_BIAS_PAD_CFG0): { | ||
| 780 | u32 bias_pad_config0 = 0; | ||
| 781 | |||
| 782 | regmap_read(mipi->regmap, ADDR(MIPI_BIAS_PAD_CFG0), | ||
| 783 | &bias_pad_config0); | ||
| 784 | if (copy_to_user((void __user *)arg, &bias_pad_config0, | ||
| 785 | sizeof(u32))) { | ||
| 786 | dev_err(mipi->dev, "Fail to copy kernel data to user\n"); | ||
| 787 | return -EFAULT; | ||
| 788 | } | ||
| 789 | return 0; | ||
| 790 | } | ||
| 791 | case _IOC_NR(TEGRA_MIPI_IOCTL_BIAS_PAD_CFG2): { | ||
| 792 | u32 bias_pad_config2 = 0; | ||
| 793 | |||
| 794 | regmap_read(mipi->regmap, ADDR(MIPI_BIAS_PAD_CFG2), | ||
| 795 | &bias_pad_config2); | ||
| 796 | if (copy_to_user((void __user *)arg, &bias_pad_config2, | ||
| 797 | sizeof(u32))) { | ||
| 798 | dev_err(mipi->dev, "Fail to copy kernel data to user\n"); | ||
| 799 | return -EFAULT; | ||
| 800 | } | ||
| 801 | return 0; | ||
| 802 | } | ||
| 779 | default: | 803 | default: |
| 780 | dev_err(mipi->dev, "Unknown ioctl\n"); | 804 | dev_err(mipi->dev, "Unknown ioctl\n"); |
| 781 | return -EINVAL; | 805 | return -EINVAL; |
diff --git a/include/uapi/misc/tegra_mipi_ioctl.h b/include/uapi/misc/tegra_mipi_ioctl.h index 3c188b54a..145ebf7fa 100644 --- a/include/uapi/misc/tegra_mipi_ioctl.h +++ b/include/uapi/misc/tegra_mipi_ioctl.h | |||
| @@ -22,5 +22,7 @@ | |||
| 22 | #define TEGRA_MIPI_IOCTL_BIAS_PAD_CTRL _IOW(TEGRA_MIPI_IOCTL_MAGIC, 1, u32) | 22 | #define TEGRA_MIPI_IOCTL_BIAS_PAD_CTRL _IOW(TEGRA_MIPI_IOCTL_MAGIC, 1, u32) |
| 23 | #define TEGRA_MIPI_IOCTL_CAL _IOW(TEGRA_MIPI_IOCTL_MAGIC, 2, u32) | 23 | #define TEGRA_MIPI_IOCTL_CAL _IOW(TEGRA_MIPI_IOCTL_MAGIC, 2, u32) |
| 24 | #define TEGRA_MIPI_IOCTL_CAL_STATUS _IOR(TEGRA_MIPI_IOCTL_MAGIC, 3, __u32) | 24 | #define TEGRA_MIPI_IOCTL_CAL_STATUS _IOR(TEGRA_MIPI_IOCTL_MAGIC, 3, __u32) |
| 25 | #define TEGRA_MIPI_IOCTL_BIAS_PAD_CFG0 _IOR(TEGRA_MIPI_IOCTL_MAGIC, 4, __u32) | ||
| 26 | #define TEGRA_MIPI_IOCTL_BIAS_PAD_CFG2 _IOR(TEGRA_MIPI_IOCTL_MAGIC, 5, __u32) | ||
| 25 | 27 | ||
| 26 | #endif | 28 | #endif |
