linux-surface/patches/cameras.patch

152 lines
5.5 KiB
Diff

From d4460b8c7124d6dd878acbd3207e2c41ceec5266 Mon Sep 17 00:00:00 2001
From: Jake Day <jake@ninebysix.com>
Date: Thu, 1 Feb 2018 19:25:08 -0500
Subject: initial support for surface cameras
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 6d22b22..b72b782 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -2277,6 +2277,46 @@ MODULE_PARM_DESC(timeout, "Streaming control requests timeout");
* though they are compliant.
*/
static const struct usb_device_id uvc_ids[] = {
+ /* Microsoft Surface Pro 3 Front */
+ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
+ | USB_DEVICE_ID_MATCH_INT_INFO,
+ .idVendor = 0x045e,
+ .idProduct = 0x07be,
+ .bInterfaceClass = USB_CLASS_VIDEO,
+ .bInterfaceSubClass = 1,
+ .bInterfaceProtocol = 1 },
+ /* Microsoft Surface Pro 3 Rear */
+ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
+ | USB_DEVICE_ID_MATCH_INT_INFO,
+ .idVendor = 0x045e,
+ .idProduct = 0x07bf,
+ .bInterfaceClass = USB_CLASS_VIDEO,
+ .bInterfaceSubClass = 1,
+ .bInterfaceProtocol = 1 },
+ /* Microsoft Surface Pro 4 Cam */
+ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
+ | USB_DEVICE_ID_MATCH_INT_INFO,
+ .idVendor = 0x045e,
+ .idProduct = 0x090c,
+ .bInterfaceClass = USB_CLASS_VIDEO,
+ .bInterfaceSubClass = 1,
+ .bInterfaceProtocol = 1 },
+ /* Microsoft Surface Book Cam 1 */
+ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
+ | USB_DEVICE_ID_MATCH_INT_INFO,
+ .idVendor = 0x045e,
+ .idProduct = 0x090b,
+ .bInterfaceClass = USB_CLASS_VIDEO,
+ .bInterfaceSubClass = 1,
+ .bInterfaceProtocol = 1 },
+ /* Microsoft Surface Book Cam 2 */
+ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
+ | USB_DEVICE_ID_MATCH_INT_INFO,
+ .idVendor = 0x045e,
+ .idProduct = 0x091a,
+ .bInterfaceClass = USB_CLASS_VIDEO,
+ .bInterfaceSubClass = 1,
+ .bInterfaceProtocol = 1 },
/* LogiLink Wireless Webcam */
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO,
diff --git a/drivers/staging/media/atomisp/i2c/ov5693/Kconfig b/drivers/staging/media/atomisp/i2c/ov5693/Kconfig
index 9fb1bff..3954b8c 100644
--- a/drivers/staging/media/atomisp/i2c/ov5693/Kconfig
+++ b/drivers/staging/media/atomisp/i2c/ov5693/Kconfig
@@ -1,6 +1,6 @@
config VIDEO_OV5693
tristate "Omnivision ov5693 sensor support"
- depends on I2C && VIDEO_V4L2
+ depends on I2C && VIDEO_V4L2 && MEDIA_CONTROLLER
---help---
This is a Video4Linux2 sensor-level driver for the Micron
ov5693 5 Mpixel camera.
diff --git a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c
index 1236425..37986f5 100644
--- a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c
+++ b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c
@@ -1332,7 +1332,7 @@ static int power_ctrl(struct v4l2_subdev *sd, bool flag)
static int gpio_ctrl(struct v4l2_subdev *sd, bool flag)
{
- int ret;
+ int ret = 0;
struct ov5693_device *dev = to_ov5693_sensor(sd);
if (!dev || !dev->platform_data)
@@ -1342,7 +1342,8 @@ static int gpio_ctrl(struct v4l2_subdev *sd, bool flag)
if (dev->platform_data->gpio_ctrl)
return dev->platform_data->gpio_ctrl(sd, flag);
- ret = dev->platform_data->gpio0_ctrl(sd, flag);
+ if (dev->platform_data->gpio0_ctrl)
+ ret = dev->platform_data->gpio0_ctrl(sd, flag);
return ret;
}
@@ -1709,7 +1710,7 @@ static int ov5693_detect(struct i2c_client *client)
OV5693_SC_CMMN_CHIP_ID_L, &low);
id = ((((u16) high) << 8) | (u16) low);
- if (id != OV5693_ID) {
+ if (id != OV5690_ID && id != OV5693_ID) {
dev_err(&client->dev, "sensor ID error 0x%x\n", id);
return -ENODEV;
}
diff --git a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h
index 8c2e679..a657f94 100644
--- a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h
+++ b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.h
@@ -33,7 +33,7 @@
#include <linux/v4l2-mediabus.h>
#include <media/media-entity.h>
-#include "../../include/linux/atomisp_platform.h"
+#include "../../include/linux/atomisp_gmin_platform.h"
#define OV5693_NAME "ov5693"
@@ -78,7 +78,8 @@
* bits 7-0: min f-number denominator
*/
#define OV5693_F_NUMBER_RANGE 0x180a180a
-#define OV5693_ID 0x5690
+#define OV5690_ID 0x5690
+#define OV5693_ID 0x5693
#define OV5693_FINE_INTG_TIME_MIN 0
#define OV5693_FINE_INTG_TIME_MAX_MARGIN 0
diff --git a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
index edaae93..ca59c4f 100644
--- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
@@ -296,11 +296,13 @@ static const struct gmin_cfg_var ecs7_vars[] = {
{"INT33BE:00_CsiFmt", "13"},
{"INT33BE:00_CsiBayer", "2"},
{"INT33BE:00_CamClk", "0"},
+ {"INT33BE:00_ClkSrc", "1"},
{"INT33F0:00_CsiPort", "0"},
{"INT33F0:00_CsiLanes", "1"},
{"INT33F0:00_CsiFmt", "13"},
{"INT33F0:00_CsiBayer", "0"},
{"INT33F0:00_CamClk", "1"},
+ {"INT33BE:00_I2CAddr", "-1"},
{"gmin_V2P8GPIO", "402"},
{},
};
@@ -325,6 +327,8 @@ static const struct {
{ "MRD7", mrd7_vars },
{ "ST70408", ecs7_vars },
{ "VTA0803", i8880_vars },
+ { "Surface Book" , ecs7_vars } ,
+ { "Surface Pro 4" , ecs7_vars } ,
};