Added patches
This commit is contained in:
		@@ -1,5 +1,2 @@
 | 
			
		||||
DIST all-5.15.6.patch 15465054 BLAKE2B e60ee46d00f0d2a82c491431366e96650b08050e64bc5a751961a7f7d465735250bdc2b26832fc1f0a6a21da1d7c5e87d119359a02c9e175201af5750f8e50f4 SHA512 6499b9f8b5575ca3ab21a28ec5a9c9bd0bcecfec54b90cf7dac1f2c9e818f0a5804a7389f37e6220661210f7ecc80da3cfd3b2c218d29c0d10bb9066c68aa802
 | 
			
		||||
DIST all-5.16.0.patch 15386424 BLAKE2B 4ddf492fedab9dde02e9e3fbfdaaa8c31f3c4ed0267447cd38eb2ede38a4ed44255d6b0972cdca9c440c30031196e35e0b2c00cbadd8ee09a67d7375d24db633 SHA512 fc337e97242c206337f4aa88075a1a850e404ac09c566c06fa42de268d83c58ab9ee3052a0510246023b1e073aced8c88d605bd49a11983cc3716058814926a5
 | 
			
		||||
DIST linux-5.15.tar.xz 121913744 BLAKE2B 3921274b23f7938abdf3ed9334534b4581e13d7484303d3a5280eddb038999aaa8b836666a487472d9c4a219af0f06b9fecccaf348fb5510ab8762f4ef4b7e83 SHA512 d25ad40b5bcd6a4c6042fd0fd84e196e7a58024734c3e9a484fd0d5d54a0c1d87db8a3c784eff55e43b6f021709dc685eb0efa18d2aec327e4f88a79f405705a
 | 
			
		||||
DIST linux-5.16.tar.xz 123114100 BLAKE2B 07a90cc640ff89e1359c06cee8c38abd33e51f9b9a89833e31a1d2750526fda4a59e8884db3c1ea63df0a37f0d3de6b5a922b014b7313d8abce20d90ac08adcb SHA512 7a257dd576bc8493595ec7d6f3c9cb6e22c772a8b2dbe735d2485c4f5c56e26a08695546e7e0f1f1cd04a533f25e829361958d4da0b98bf0ba8094dd57a85aaf
 | 
			
		||||
DIST patch-5.15.6.xz 430232 BLAKE2B ed3eb640ae8617ae726b9d98f3b17ab1602f733e228970826e4a34cb7e466b61ead5371f51e6bc1fc75bb9e468cfeca66c6bca21731f25b53decc52eb59ecb3e SHA512 926403406c82f4589bb872cb74ff21dc4729184a3dd5293ba0cc201c13a5c3917b231721be551a6f19fb1d93e443b8ebac557df2a9cc265967a693b4031cedb3
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
 | 
			
		||||
index 03b83aa91277..dfc6c7d1b0e7 100644
 | 
			
		||||
--- a/drivers/bluetooth/btusb.c
 | 
			
		||||
+++ b/drivers/bluetooth/btusb.c
 | 
			
		||||
@@ -4070,6 +4070,7 @@ static int btusb_setup_qca(struct hci_dev *hdev)
 | 
			
		||||
 	}
 | 
			
		||||
 	if (!info) {
 | 
			
		||||
 		bt_dev_err(hdev, "don't support firmware rome 0x%x", ver_rom);
 | 
			
		||||
+		if (ver_rom & ~0xffffU) return 0;
 | 
			
		||||
 		return -ENODEV;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,49 @@
 | 
			
		||||
From cb408fb65a08bd45543724c1e9b8f38ae1bebc4a Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Arnaud Ferraris <arnaud.ferraris@gmail.com>
 | 
			
		||||
Date: Tue, 4 Aug 2020 15:12:59 +0200
 | 
			
		||||
Subject: [PATCH 177/183] leds-gpio: make max_brightness configurable
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 drivers/leds/leds-gpio.c | 4 ++++
 | 
			
		||||
 include/linux/leds.h     | 3 ++-
 | 
			
		||||
 2 files changed, 6 insertions(+), 1 deletion(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
 | 
			
		||||
index 93f5b1b60fde..f8483fab1164 100644
 | 
			
		||||
--- a/drivers/leds/leds-gpio.c
 | 
			
		||||
+++ b/drivers/leds/leds-gpio.c
 | 
			
		||||
@@ -108,6 +108,8 @@ static int create_gpio_led(const struct gpio_led *template,
 | 
			
		||||
 	if (ret < 0)
 | 
			
		||||
 		return ret;
 | 
			
		||||
 
 | 
			
		||||
+	led_dat->cdev.max_brightness = template->max_brightness;
 | 
			
		||||
+
 | 
			
		||||
 	if (template->name) {
 | 
			
		||||
 		led_dat->cdev.name = template->name;
 | 
			
		||||
 		ret = devm_led_classdev_register(parent, &led_dat->cdev);
 | 
			
		||||
@@ -177,6 +179,8 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
 | 
			
		||||
 		if (fwnode_property_present(child, "panic-indicator"))
 | 
			
		||||
 			led.panic_indicator = 1;
 | 
			
		||||
 
 | 
			
		||||
+		fwnode_property_read_u32(child, "max-brightness", &led.max_brightness);
 | 
			
		||||
+
 | 
			
		||||
 		ret = create_gpio_led(&led, led_dat, dev, child, NULL);
 | 
			
		||||
 		if (ret < 0) {
 | 
			
		||||
 			fwnode_handle_put(child);
 | 
			
		||||
diff --git a/include/linux/leds.h b/include/linux/leds.h
 | 
			
		||||
index 6a8d6409c993..99a80092114d 100644
 | 
			
		||||
--- a/include/linux/leds.h
 | 
			
		||||
+++ b/include/linux/leds.h
 | 
			
		||||
@@ -513,7 +513,8 @@ typedef int (*gpio_blink_set_t)(struct gpio_desc *desc, int state,
 | 
			
		||||
 struct gpio_led {
 | 
			
		||||
 	const char *name;
 | 
			
		||||
 	const char *default_trigger;
 | 
			
		||||
-	unsigned 	gpio;
 | 
			
		||||
+	unsigned	gpio;
 | 
			
		||||
+	unsigned	max_brightness;
 | 
			
		||||
 	unsigned	active_low : 1;
 | 
			
		||||
 	unsigned	retain_state_suspended : 1;
 | 
			
		||||
 	unsigned	panic_indicator : 1;
 | 
			
		||||
-- 
 | 
			
		||||
2.30.0
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,49 @@
 | 
			
		||||
diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
 | 
			
		||||
index 149cfde817cb..0399d8714fd0 100644
 | 
			
		||||
--- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
 | 
			
		||||
+++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
 | 
			
		||||
@@ -984,6 +984,8 @@ static int sun50i_a64_ccu_probe(struct p
 | 
			
		||||
 	if (IS_ERR(reg))
 | 
			
		||||
 		return PTR_ERR(reg);
 | 
			
		||||
 
 | 
			
		||||
+	platform_set_drvdata(pdev, reg);
 | 
			
		||||
+
 | 
			
		||||
 	/* Force the pll-audio variable divider to 3 */
 | 
			
		||||
 	val = readl(reg + SUN50I_A64_PLL_AUDIO_REG);
 | 
			
		||||
 	val &= ~GENMASK(19, 16);
 | 
			
		||||
@@ -974,11 +976,35 @@ static const struct of_device_id sun50i_a64_ccu_ids[] = {
 | 
			
		||||
 	{ }
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
+#define USBPHY_CFG_REG 0x0cc
 | 
			
		||||
+
 | 
			
		||||
+static int sun50i_a64_ccu_suspend(struct device *dev)
 | 
			
		||||
+{
 | 
			
		||||
+	void __iomem *reg = dev_get_drvdata(dev);
 | 
			
		||||
+
 | 
			
		||||
+	writel(readl(reg + USBPHY_CFG_REG) | 0xa00000, reg + USBPHY_CFG_REG);
 | 
			
		||||
+
 | 
			
		||||
+	return 0;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static int sun50i_a64_ccu_resume(struct device *dev)
 | 
			
		||||
+{
 | 
			
		||||
+	void __iomem *reg = dev_get_drvdata(dev);
 | 
			
		||||
+
 | 
			
		||||
+	writel(readl(reg + USBPHY_CFG_REG) & ~0xa00000, reg + USBPHY_CFG_REG);
 | 
			
		||||
+
 | 
			
		||||
+	return 0;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static SIMPLE_DEV_PM_OPS(sun50i_a64_ccu_pm_ops,
 | 
			
		||||
+			 sun50i_a64_ccu_suspend, sun50i_a64_ccu_resume);
 | 
			
		||||
+
 | 
			
		||||
 static struct platform_driver sun50i_a64_ccu_driver = {
 | 
			
		||||
 	.probe	= sun50i_a64_ccu_probe,
 | 
			
		||||
 	.driver	= {
 | 
			
		||||
 		.name	= "sun50i-a64-ccu",
 | 
			
		||||
 		.of_match_table	= sun50i_a64_ccu_ids,
 | 
			
		||||
+		.pm	= &sun50i_a64_ccu_pm_ops,
 | 
			
		||||
 	},
 | 
			
		||||
 };
 | 
			
		||||
 builtin_platform_driver(sun50i_a64_ccu_driver);
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -0,0 +1,175 @@
 | 
			
		||||
From 5da6a7e3f4d6e11f4887893672f849d2d4fa5b58 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Clayton Craft <clayton@craftyguy.net>
 | 
			
		||||
Date: Wed, 16 Dec 2020 20:16:14 -0800
 | 
			
		||||
Subject: [PATCH] dts: pinephone: drop modem-power node
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 .../allwinner/sun50i-a64-pinephone-1.0.dts    | 26 +++---------------
 | 
			
		||||
 .../allwinner/sun50i-a64-pinephone-1.1.dts    | 27 +++----------------
 | 
			
		||||
 .../allwinner/sun50i-a64-pinephone-1.2.dts    | 27 +++----------------
 | 
			
		||||
 .../dts/allwinner/sun50i-a64-pinephone.dtsi   | 12 +++++++++
 | 
			
		||||
 4 files changed, 24 insertions(+), 68 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts
 | 
			
		||||
index 0f6faa44ce3e..2cc513772172 100644
 | 
			
		||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts
 | 
			
		||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts
 | 
			
		||||
@@ -86,28 +86,6 @@ ®_drivevbus {
 | 
			
		||||
 	status = "okay";
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
-&uart3 {
 | 
			
		||||
-	modem {
 | 
			
		||||
-		compatible = "quectel,eg25";
 | 
			
		||||
-		char-device-name = "modem-power";
 | 
			
		||||
-
 | 
			
		||||
-		power-supply = <®_vbat_bb>; /* PL7 */
 | 
			
		||||
-
 | 
			
		||||
-		enable-gpios = <&pio 7 8 GPIO_ACTIVE_LOW>; /* PH8 */
 | 
			
		||||
-		reset-gpios = <&pio 2 4 GPIO_ACTIVE_HIGH>; /* PC4 */
 | 
			
		||||
-		pwrkey-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */
 | 
			
		||||
-
 | 
			
		||||
-		sleep-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
 | 
			
		||||
-		wakeup-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2-RI */
 | 
			
		||||
-
 | 
			
		||||
-		cts-gpios = <&pio 3 5 GPIO_ACTIVE_HIGH>; /* PD5-CTS */
 | 
			
		||||
-		dtr-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6-DTR */
 | 
			
		||||
-		rts-gpios = <&pio 3 4 GPIO_ACTIVE_HIGH>; /* PD4-RTS */
 | 
			
		||||
-
 | 
			
		||||
-		quectel,qdai = "1,1,0,1,0,0,1,1";
 | 
			
		||||
-	};
 | 
			
		||||
-};
 | 
			
		||||
-
 | 
			
		||||
 &usbphy {
 | 
			
		||||
 	usb-role-switch;
 | 
			
		||||
 
 | 
			
		||||
@@ -118,6 +96,10 @@ usb0_drd_sw: endpoint {
 | 
			
		||||
 	};
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
+&ring_indicator {
 | 
			
		||||
+	gpios = <&pio 1 2 GPIO_ACTIVE_LOW>; /* PB2 */
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
 &sgm3140 {
 | 
			
		||||
 	flash-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
 | 
			
		||||
 	enable-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>; /* PC3 */
 | 
			
		||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts
 | 
			
		||||
index 95a880fdc9ce..5f3b6a1a142f 100644
 | 
			
		||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts
 | 
			
		||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts
 | 
			
		||||
@@ -109,34 +109,15 @@
 | 
			
		||||
 	status = "okay";
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
+&ring_indicator {
 | 
			
		||||
+	gpios = <&pio 1 2 GPIO_ACTIVE_LOW>; /* PB2 */
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
 &sgm3140 {
 | 
			
		||||
 	enable-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
 | 
			
		||||
 	flash-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>; /* PC3 */
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
-&uart3 {
 | 
			
		||||
-	modem {
 | 
			
		||||
-		compatible = "quectel,eg25";
 | 
			
		||||
-		char-device-name = "modem-power";
 | 
			
		||||
-
 | 
			
		||||
-		power-supply = <®_vbat_bb>; /* PL7 */
 | 
			
		||||
-
 | 
			
		||||
-		enable-gpios = <&pio 7 8 GPIO_ACTIVE_LOW>; /* PH8 */
 | 
			
		||||
-		reset-gpios = <&pio 2 4 GPIO_ACTIVE_HIGH>; /* PC4 */
 | 
			
		||||
-		pwrkey-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */
 | 
			
		||||
-		//status-pwrkey-multiplexed; /* status acts as pwrkey */
 | 
			
		||||
-
 | 
			
		||||
-		sleep-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
 | 
			
		||||
-		wakeup-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2-RI */
 | 
			
		||||
-
 | 
			
		||||
-		dtr-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6-DTR */
 | 
			
		||||
-		cts-gpios = <&pio 3 5 GPIO_ACTIVE_HIGH>; /* PD5-CTS */
 | 
			
		||||
-		rts-gpios = <&pio 3 4 GPIO_ACTIVE_HIGH>; /* PD4-RTS */
 | 
			
		||||
-
 | 
			
		||||
-		quectel,qdai = "1,1,0,1,0,0,1,1";
 | 
			
		||||
-	};
 | 
			
		||||
-};
 | 
			
		||||
-
 | 
			
		||||
 &usbphy {
 | 
			
		||||
 	usb-role-switch;
 | 
			
		||||
 
 | 
			
		||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dts
 | 
			
		||||
index 23ba72508cfc..889841ca5b8a 100644
 | 
			
		||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dts
 | 
			
		||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.2.dts
 | 
			
		||||
@@ -101,34 +101,15 @@
 | 
			
		||||
 	enable-active-high;
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
+&ring_indicator {
 | 
			
		||||
+	gpios = <&r_pio 0 6 GPIO_ACTIVE_LOW>; /* PL6 */
 | 
			
		||||
+};
 | 
			
		||||
+
 | 
			
		||||
 &sgm3140 {
 | 
			
		||||
 	enable-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
 | 
			
		||||
 	flash-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>; /* PC3 */
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
-&uart3 {
 | 
			
		||||
-	modem {
 | 
			
		||||
-		compatible = "quectel,eg25";
 | 
			
		||||
-		char-device-name = "modem-power";
 | 
			
		||||
-
 | 
			
		||||
-		power-supply = <®_vbat_bb>; /* PL7 */
 | 
			
		||||
-
 | 
			
		||||
-		enable-gpios = <&pio 7 8 GPIO_ACTIVE_LOW>; /* PH8 */
 | 
			
		||||
-		reset-gpios = <&pio 2 4 GPIO_ACTIVE_HIGH>; /* PC4 */
 | 
			
		||||
-		status-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
 | 
			
		||||
-		pwrkey-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */
 | 
			
		||||
-
 | 
			
		||||
-		host-ready-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
 | 
			
		||||
-		wakeup-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6-RI */
 | 
			
		||||
-
 | 
			
		||||
-		dtr-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2-DTR */
 | 
			
		||||
-		cts-gpios = <&pio 3 5 GPIO_ACTIVE_HIGH>; /* PD5-CTS */
 | 
			
		||||
-		rts-gpios = <&pio 3 4 GPIO_ACTIVE_HIGH>; /* PD4-RTS */
 | 
			
		||||
-
 | 
			
		||||
-		quectel,qdai = "1,1,0,1,0,0,1,1";
 | 
			
		||||
-	};
 | 
			
		||||
-};
 | 
			
		||||
-
 | 
			
		||||
 &usbphy {
 | 
			
		||||
 	usb-role-switch;
 | 
			
		||||
 
 | 
			
		||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
 | 
			
		||||
index 02d82980cf39..979d01de8d84 100644
 | 
			
		||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
 | 
			
		||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
 | 
			
		||||
@@ -192,6 +192,17 @@ ec25_codec: ec25-codec {
 | 
			
		||||
 		compatible = "quectel,ec25";
 | 
			
		||||
 	};
 | 
			
		||||
 
 | 
			
		||||
+	gpio-keys {
 | 
			
		||||
+		compatible = "gpio-keys";
 | 
			
		||||
+
 | 
			
		||||
+		ring_indicator: ring-indicator {
 | 
			
		||||
+			label = "Ring Indicator";
 | 
			
		||||
+			linux,can-disable;
 | 
			
		||||
+			linux,code = <KEY_WAKEUP>;
 | 
			
		||||
+			wakeup-source;
 | 
			
		||||
+		};
 | 
			
		||||
+	};
 | 
			
		||||
+
 | 
			
		||||
 	i2c_csi: i2c-csi {
 | 
			
		||||
 		compatible = "i2c-gpio";
 | 
			
		||||
 		sda-gpios = <&pio 4 13 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; /* PE13 */
 | 
			
		||||
@@ -256,6 +267,7 @@ reg_usb_5v: usb-5v {
 | 
			
		||||
 	reg_vbat_bb: vbat-bb {
 | 
			
		||||
 		compatible = "regulator-fixed";
 | 
			
		||||
 		regulator-name = "vbat-bb";
 | 
			
		||||
+		regulator-always-on;
 | 
			
		||||
 		regulator-min-microvolt = <3500000>;
 | 
			
		||||
 		regulator-max-microvolt = <3500000>;
 | 
			
		||||
 		gpio = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
 | 
			
		||||
-- 
 | 
			
		||||
2.29.2
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,409 @@
 | 
			
		||||
From f062022f2a2781d6b8ca63c460b0e72ebac30870 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: Martijn Braam <martijn@brixit.nl>
 | 
			
		||||
Date: Mon, 28 Sep 2020 14:26:11 +0200
 | 
			
		||||
Subject: [PATCH] media: ov5640: Implement autofocus
 | 
			
		||||
 | 
			
		||||
The autofocus functionality needs a firmware blob loaded into the
 | 
			
		||||
internal microcontroller.
 | 
			
		||||
 | 
			
		||||
V4L2 doesn't have an api to control all autofocus functionality, but
 | 
			
		||||
this at least makes it possible to focus on the center of the sensor.
 | 
			
		||||
 | 
			
		||||
Signed-off-by: Martijn Braam <martijn@brixit.nl>
 | 
			
		||||
---
 | 
			
		||||
 drivers/media/i2c/ov5640.c | 254 +++++++++++++++++++++++++++++++++++++
 | 
			
		||||
 1 file changed, 254 insertions(+)
 | 
			
		||||
 | 
			
		||||
diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
 | 
			
		||||
index df0a507c211f..08a5304c0e95 100644
 | 
			
		||||
--- a/drivers/media/i2c/ov5640.c
 | 
			
		||||
+++ b/drivers/media/i2c/ov5640.c
 | 
			
		||||
@@ -9,6 +9,7 @@
 | 
			
		||||
 #include <linux/clkdev.h>
 | 
			
		||||
 #include <linux/ctype.h>
 | 
			
		||||
 #include <linux/delay.h>
 | 
			
		||||
+#include <linux/firmware.h>
 | 
			
		||||
 #include <linux/device.h>
 | 
			
		||||
 #include <linux/gpio/consumer.h>
 | 
			
		||||
 #include <linux/i2c.h>
 | 
			
		||||
@@ -31,7 +32,11 @@
 | 
			
		||||
 
 | 
			
		||||
 #define OV5640_DEFAULT_SLAVE_ID 0x3c
 | 
			
		||||
 
 | 
			
		||||
+#define OV5640_REG_SYS_RESET00		0x3000
 | 
			
		||||
+#define OV5640_REG_SYS_RESET01		0x3001
 | 
			
		||||
 #define OV5640_REG_SYS_RESET02		0x3002
 | 
			
		||||
+#define OV5640_REG_SYS_CLOCK_ENABLE00	0x3004
 | 
			
		||||
+#define OV5640_REG_SYS_CLOCK_ENABLE01	0x3005
 | 
			
		||||
 #define OV5640_REG_SYS_CLOCK_ENABLE02	0x3006
 | 
			
		||||
 #define OV5640_REG_SYS_CTRL0		0x3008
 | 
			
		||||
 #define OV5640_REG_SYS_CTRL0_SW_PWDN	0x42
 | 
			
		||||
@@ -41,6 +46,14 @@
 | 
			
		||||
 #define OV5640_REG_PAD_OUTPUT_ENABLE01	0x3017
 | 
			
		||||
 #define OV5640_REG_PAD_OUTPUT_ENABLE02	0x3018
 | 
			
		||||
 #define OV5640_REG_PAD_OUTPUT00		0x3019
 | 
			
		||||
+#define OV5640_REG_FW_CMD_MAIN		0x3022
 | 
			
		||||
+#define OV5640_REG_FW_CMD_ACK		0x3023
 | 
			
		||||
+#define OV5640_REG_FW_CMD_PARA0		0x3024
 | 
			
		||||
+#define OV5640_REG_FW_CMD_PARA1		0x3025
 | 
			
		||||
+#define OV5640_REG_FW_CMD_PARA2		0x3026
 | 
			
		||||
+#define OV5640_REG_FW_CMD_PARA3		0x3027
 | 
			
		||||
+#define OV5640_REG_FW_CMD_PARA4		0x3028
 | 
			
		||||
+#define OV5640_REG_FW_STATUS		0x3029
 | 
			
		||||
 #define OV5640_REG_SYSTEM_CONTROL1	0x302e
 | 
			
		||||
 #define OV5640_REG_SC_PLL_CTRL0		0x3034
 | 
			
		||||
 #define OV5640_REG_SC_PLL_CTRL1		0x3035
 | 
			
		||||
@@ -59,6 +72,7 @@
 | 
			
		||||
 #define OV5640_REG_AEC_PK_MANUAL	0x3503
 | 
			
		||||
 #define OV5640_REG_AEC_PK_REAL_GAIN	0x350a
 | 
			
		||||
 #define OV5640_REG_AEC_PK_VTS		0x350c
 | 
			
		||||
+#define OV5640_REG_VCM_CONTROL4		0x3606
 | 
			
		||||
 #define OV5640_REG_TIMING_DVPHO		0x3808
 | 
			
		||||
 #define OV5640_REG_TIMING_DVPVO		0x380a
 | 
			
		||||
 #define OV5640_REG_TIMING_HTS		0x380c
 | 
			
		||||
@@ -95,6 +109,20 @@
 | 
			
		||||
 #define OV5640_REG_SDE_CTRL4		0x5584
 | 
			
		||||
 #define OV5640_REG_SDE_CTRL5		0x5585
 | 
			
		||||
 #define OV5640_REG_AVG_READOUT		0x56a1
 | 
			
		||||
+#define OV5640_REG_FIRMWARE_BASE	0x8000
 | 
			
		||||
+
 | 
			
		||||
+#define OV5640_FW_STATUS_S_FIRMWARE	0x7f
 | 
			
		||||
+#define OV5640_FW_STATUS_S_STARTUP	0x7e
 | 
			
		||||
+#define OV5640_FW_STATUS_S_IDLE		0x70
 | 
			
		||||
+#define OV5640_FW_STATUS_S_FOCUSING	0x00
 | 
			
		||||
+#define OV5640_FW_STATUS_S_FOCUSED	0x10
 | 
			
		||||
+
 | 
			
		||||
+#define OV5640_FW_CMD_TRIGGER_FOCUS	0x03
 | 
			
		||||
+#define OV5640_FW_CMD_CONTINUOUS_FOCUS	0x04
 | 
			
		||||
+#define OV5640_FW_CMD_GET_FOCUS_RESULT	0x07
 | 
			
		||||
+#define OV5640_FW_CMD_RELEASE_FOCUS	0x08
 | 
			
		||||
+#define OV5640_FW_CMD_ZONE_CONFIG	0x12
 | 
			
		||||
+#define OV5640_FW_CMD_DEFAULT_ZONES	0x80
 | 
			
		||||
 
 | 
			
		||||
 enum ov5640_mode_id {
 | 
			
		||||
 	OV5640_MODE_QCIF_176_144 = 0,
 | 
			
		||||
@@ -218,6 +246,12 @@ struct ov5640_ctrls {
 | 
			
		||||
 		struct v4l2_ctrl *auto_gain;
 | 
			
		||||
 		struct v4l2_ctrl *gain;
 | 
			
		||||
 	};
 | 
			
		||||
+	struct {
 | 
			
		||||
+		struct v4l2_ctrl *focus_auto;
 | 
			
		||||
+		struct v4l2_ctrl *af_start;
 | 
			
		||||
+		struct v4l2_ctrl *af_stop;
 | 
			
		||||
+		struct v4l2_ctrl *af_status;
 | 
			
		||||
+	};
 | 
			
		||||
 	struct v4l2_ctrl *brightness;
 | 
			
		||||
 	struct v4l2_ctrl *light_freq;
 | 
			
		||||
 	struct v4l2_ctrl *saturation;
 | 
			
		||||
@@ -261,6 +295,8 @@ struct ov5640_dev {
 | 
			
		||||
 
 | 
			
		||||
 	bool pending_mode_change;
 | 
			
		||||
 	bool streaming;
 | 
			
		||||
+
 | 
			
		||||
+	bool af_initialized;
 | 
			
		||||
 };
 | 
			
		||||
 
 | 
			
		||||
 static inline struct ov5640_dev *to_ov5640_dev(struct v4l2_subdev *sd)
 | 
			
		||||
@@ -1967,6 +2003,118 @@ static void ov5640_reset(struct ov5640_dev *sensor)
 | 
			
		||||
 	usleep_range(20000, 25000);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+static int ov5640_copy_fw_to_device(struct ov5640_dev *sensor,
 | 
			
		||||
+					const struct firmware *fw)
 | 
			
		||||
+{
 | 
			
		||||
+	struct i2c_client *client = sensor->i2c_client;
 | 
			
		||||
+	const u8 *data = (const u8 *)fw->data;
 | 
			
		||||
+	u8 fw_status;
 | 
			
		||||
+	int i;
 | 
			
		||||
+	int ret;
 | 
			
		||||
+
 | 
			
		||||
+	// Putting MCU in reset state
 | 
			
		||||
+	ret = ov5640_write_reg(sensor, OV5640_REG_SYS_RESET00, 0x20);
 | 
			
		||||
+	if (ret)
 | 
			
		||||
+		return ret;
 | 
			
		||||
+
 | 
			
		||||
+	// Write firmware
 | 
			
		||||
+	for (i = 0; i < fw->size / sizeof(u8); i++)
 | 
			
		||||
+		ov5640_write_reg(sensor,
 | 
			
		||||
+				OV5640_REG_FIRMWARE_BASE + i, 
 | 
			
		||||
+				data[i]);
 | 
			
		||||
+
 | 
			
		||||
+	// Reset MCU state
 | 
			
		||||
+	ov5640_write_reg(sensor, OV5640_REG_FW_CMD_MAIN, 0x00);
 | 
			
		||||
+	ov5640_write_reg(sensor, OV5640_REG_FW_CMD_ACK, 0x00);
 | 
			
		||||
+	ov5640_write_reg(sensor, OV5640_REG_FW_CMD_PARA0, 0x00);
 | 
			
		||||
+	ov5640_write_reg(sensor, OV5640_REG_FW_CMD_PARA1, 0x00);
 | 
			
		||||
+	ov5640_write_reg(sensor, OV5640_REG_FW_CMD_PARA2, 0x00);
 | 
			
		||||
+	ov5640_write_reg(sensor, OV5640_REG_FW_CMD_PARA3, 0x00);
 | 
			
		||||
+	ov5640_write_reg(sensor, OV5640_REG_FW_CMD_PARA4, 0x00);
 | 
			
		||||
+	ov5640_write_reg(sensor, OV5640_REG_FW_STATUS, 0x7f);
 | 
			
		||||
+
 | 
			
		||||
+	// Start AF MCU
 | 
			
		||||
+	ret = ov5640_write_reg(sensor, OV5640_REG_SYS_RESET00, 0x00);
 | 
			
		||||
+	if (ret)
 | 
			
		||||
+		return ret;
 | 
			
		||||
+
 | 
			
		||||
+	dev_info(&client->dev, "firmware upload success\n");
 | 
			
		||||
+
 | 
			
		||||
+	// Wait for firmware to be ready
 | 
			
		||||
+	for (i = 0; i < 5; i++) {
 | 
			
		||||
+		ret = ov5640_read_reg(sensor, OV5640_REG_FW_STATUS, &fw_status);
 | 
			
		||||
+		if (fw_status == OV5640_FW_STATUS_S_IDLE) {
 | 
			
		||||
+			dev_info(&client->dev, "fw started after %d ms\n", i * 50);
 | 
			
		||||
+			return ret;
 | 
			
		||||
+		}
 | 
			
		||||
+		msleep(50);
 | 
			
		||||
+	}
 | 
			
		||||
+	dev_err(&client->dev, "uploaded firmware didn't start, got to 0x%x, retrying...\n", fw_status);
 | 
			
		||||
+
 | 
			
		||||
+	// Putting MCU in reset state
 | 
			
		||||
+	ret = ov5640_write_reg(sensor, OV5640_REG_SYS_RESET00, 0x20);
 | 
			
		||||
+	if (ret)
 | 
			
		||||
+		return ret;
 | 
			
		||||
+	// Start AF MCU
 | 
			
		||||
+	ret = ov5640_write_reg(sensor, OV5640_REG_SYS_RESET00, 0x00);
 | 
			
		||||
+	if (ret)
 | 
			
		||||
+		return ret;
 | 
			
		||||
+	// Wait for firmware to be ready
 | 
			
		||||
+	for (i = 0; i < 5; i++) {
 | 
			
		||||
+		ret = ov5640_read_reg(sensor, OV5640_REG_FW_STATUS, &fw_status);
 | 
			
		||||
+		if (fw_status == OV5640_FW_STATUS_S_IDLE) {
 | 
			
		||||
+			dev_info(&client->dev, "fw started after %d ms\n", i * 50);
 | 
			
		||||
+			return ret;
 | 
			
		||||
+		}
 | 
			
		||||
+		msleep(50);
 | 
			
		||||
+	}
 | 
			
		||||
+	dev_err(&client->dev, "uploaded firmware didn't start, got to 0x%x\n", fw_status);
 | 
			
		||||
+	return -ETIMEDOUT;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+static int ov5640_af_init(struct ov5640_dev *sensor)
 | 
			
		||||
+{
 | 
			
		||||
+	struct i2c_client *client = sensor->i2c_client;
 | 
			
		||||
+	const char* fwname = "ov5640_af.bin";
 | 
			
		||||
+	const struct firmware *fw;
 | 
			
		||||
+	int ret;
 | 
			
		||||
+
 | 
			
		||||
+	if (sensor->af_initialized) {
 | 
			
		||||
+		return 0;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	if (firmware_request_nowarn(&fw, fwname, &client->dev) == 0) {
 | 
			
		||||
+		ret = ov5640_copy_fw_to_device(sensor, fw);
 | 
			
		||||
+		if (ret == 0)
 | 
			
		||||
+			sensor->af_initialized = 1;
 | 
			
		||||
+	} else {
 | 
			
		||||
+		dev_warn(&client->dev, "%s: no autofocus firmware available (%s)\n",
 | 
			
		||||
+			__func__, fwname);
 | 
			
		||||
+		ret = -1;
 | 
			
		||||
+	}
 | 
			
		||||
+	release_firmware(fw);
 | 
			
		||||
+
 | 
			
		||||
+	if (ret)
 | 
			
		||||
+		return ret;
 | 
			
		||||
+
 | 
			
		||||
+	// Enable AF systems
 | 
			
		||||
+	ret = ov5640_mod_reg(sensor, OV5640_REG_SYS_CLOCK_ENABLE00,
 | 
			
		||||
+			     (BIT(6) | BIT(5)), (BIT(6) | BIT(5)));
 | 
			
		||||
+	if (ret)
 | 
			
		||||
+		return ret;
 | 
			
		||||
+	ret = ov5640_mod_reg(sensor, OV5640_REG_SYS_CLOCK_ENABLE01,
 | 
			
		||||
+			     BIT(6), BIT(6));
 | 
			
		||||
+	if (ret)
 | 
			
		||||
+		return ret;
 | 
			
		||||
+
 | 
			
		||||
+	// Set lens focus driver on
 | 
			
		||||
+	ov5640_write_reg(sensor, OV5640_REG_VCM_CONTROL4, 0x3f);
 | 
			
		||||
+	if (ret)
 | 
			
		||||
+		return ret;
 | 
			
		||||
+
 | 
			
		||||
+	return ret;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 static int ov5640_set_power_on(struct ov5640_dev *sensor)
 | 
			
		||||
 {
 | 
			
		||||
 	struct i2c_client *client = sensor->i2c_client;
 | 
			
		||||
@@ -1988,6 +2117,8 @@ static int ov5640_set_power_on(struct ov5640_dev *sensor)
 | 
			
		||||
 		goto xclk_off;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
+	sensor->af_initialized = 0;
 | 
			
		||||
+
 | 
			
		||||
 	ov5640_reset(sensor);
 | 
			
		||||
 	ov5640_power(sensor, true);
 | 
			
		||||
 
 | 
			
		||||
@@ -2416,6 +2547,35 @@ static int ov5640_set_framefmt(struct ov5640_dev *sensor,
 | 
			
		||||
 			      is_jpeg ? (BIT(5) | BIT(3)) : 0);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+static int ov5640_fw_command(struct ov5640_dev *sensor, int command)
 | 
			
		||||
+{
 | 
			
		||||
+	u8 fw_ack;
 | 
			
		||||
+	int i;
 | 
			
		||||
+	int ret;
 | 
			
		||||
+
 | 
			
		||||
+	ret = ov5640_write_reg(sensor, OV5640_REG_FW_CMD_ACK, 0x01);
 | 
			
		||||
+	if(ret)
 | 
			
		||||
+		return ret;
 | 
			
		||||
+	
 | 
			
		||||
+	ret = ov5640_write_reg(sensor, OV5640_REG_FW_CMD_MAIN, command);
 | 
			
		||||
+	if(ret)
 | 
			
		||||
+		return ret;
 | 
			
		||||
+
 | 
			
		||||
+	for (i = 0; i < 100; i++) {
 | 
			
		||||
+		ret = ov5640_read_reg(sensor, OV5640_REG_FW_CMD_ACK, &fw_ack);
 | 
			
		||||
+		if (ret)
 | 
			
		||||
+			return ret;
 | 
			
		||||
+
 | 
			
		||||
+		if (fw_ack == 0){
 | 
			
		||||
+			return ret;
 | 
			
		||||
+		}
 | 
			
		||||
+
 | 
			
		||||
+		msleep(50);
 | 
			
		||||
+	}
 | 
			
		||||
+	return -ETIMEDOUT;
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
+
 | 
			
		||||
 /*
 | 
			
		||||
  * Sensor Controls.
 | 
			
		||||
  */
 | 
			
		||||
@@ -2532,6 +2692,41 @@ static int ov5640_set_ctrl_exposure(struct ov5640_dev *sensor,
 | 
			
		||||
 	return ret;
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+static int ov5640_set_ctrl_focus(struct ov5640_dev *sensor, int command)
 | 
			
		||||
+{
 | 
			
		||||
+	struct i2c_client *client = sensor->i2c_client;
 | 
			
		||||
+	int ret;
 | 
			
		||||
+
 | 
			
		||||
+	ret = ov5640_af_init(sensor);
 | 
			
		||||
+	if (ret) {
 | 
			
		||||
+		dev_err(&client->dev, "%s: no autofocus firmware loaded\n",
 | 
			
		||||
+			__func__);
 | 
			
		||||
+		return 0;
 | 
			
		||||
+	}
 | 
			
		||||
+
 | 
			
		||||
+	if (command == OV5640_FW_CMD_RELEASE_FOCUS) {
 | 
			
		||||
+		dev_dbg(&client->dev, "%s: Releasing autofocus\n",
 | 
			
		||||
+			__func__);
 | 
			
		||||
+		return ov5640_fw_command(sensor, OV5640_FW_CMD_RELEASE_FOCUS);
 | 
			
		||||
+	}
 | 
			
		||||
+	
 | 
			
		||||
+	// Restart zone config
 | 
			
		||||
+	ret = ov5640_fw_command(sensor, OV5640_FW_CMD_ZONE_CONFIG);
 | 
			
		||||
+	if (ret)
 | 
			
		||||
+		return ret;
 | 
			
		||||
+
 | 
			
		||||
+	// Set default focus zones
 | 
			
		||||
+	ret = ov5640_fw_command(sensor, OV5640_FW_CMD_DEFAULT_ZONES);
 | 
			
		||||
+	if (ret)
 | 
			
		||||
+		return ret;
 | 
			
		||||
+
 | 
			
		||||
+	dev_dbg(&client->dev, "%s: Triggering autofocus\n",
 | 
			
		||||
+		__func__);
 | 
			
		||||
+
 | 
			
		||||
+	// Start focussing
 | 
			
		||||
+	return ov5640_fw_command(sensor, command);
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 static int ov5640_set_ctrl_gain(struct ov5640_dev *sensor, bool auto_gain)
 | 
			
		||||
 {
 | 
			
		||||
 	struct ov5640_ctrls *ctrls = &sensor->ctrls;
 | 
			
		||||
@@ -2638,6 +2833,32 @@ static int ov5640_set_ctrl_vflip(struct ov5640_dev *sensor, int value)
 | 
			
		||||
 			      (BIT(2) | BIT(1)) : 0);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
+static int ov5640_get_af_status(struct ov5640_dev *sensor)
 | 
			
		||||
+{
 | 
			
		||||
+	u8 fw_status;
 | 
			
		||||
+	int ret;
 | 
			
		||||
+
 | 
			
		||||
+	ret = ov5640_read_reg(sensor, OV5640_REG_FW_STATUS, &fw_status);
 | 
			
		||||
+	if (ret)
 | 
			
		||||
+		return ret;
 | 
			
		||||
+
 | 
			
		||||
+	switch (fw_status) {
 | 
			
		||||
+		case OV5640_FW_STATUS_S_FIRMWARE:
 | 
			
		||||
+		case OV5640_FW_STATUS_S_STARTUP:
 | 
			
		||||
+			return V4L2_AUTO_FOCUS_STATUS_FAILED;
 | 
			
		||||
+			break;
 | 
			
		||||
+		case OV5640_FW_STATUS_S_IDLE:
 | 
			
		||||
+			return V4L2_AUTO_FOCUS_STATUS_IDLE;
 | 
			
		||||
+			break;
 | 
			
		||||
+		case OV5640_FW_STATUS_S_FOCUSED:
 | 
			
		||||
+			return V4L2_AUTO_FOCUS_STATUS_REACHED;
 | 
			
		||||
+			break;
 | 
			
		||||
+		default:
 | 
			
		||||
+			return V4L2_AUTO_FOCUS_STATUS_BUSY;
 | 
			
		||||
+			break;
 | 
			
		||||
+	}
 | 
			
		||||
+}
 | 
			
		||||
+
 | 
			
		||||
 static int ov5640_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
 | 
			
		||||
 {
 | 
			
		||||
 	struct v4l2_subdev *sd = ctrl_to_sd(ctrl);
 | 
			
		||||
@@ -2659,6 +2880,12 @@ static int ov5640_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
 | 
			
		||||
 			return val;
 | 
			
		||||
 		sensor->ctrls.exposure->val = val;
 | 
			
		||||
 		break;
 | 
			
		||||
+	case V4L2_CID_FOCUS_AUTO:
 | 
			
		||||
+		val = ov5640_get_af_status(sensor);
 | 
			
		||||
+		if (val < 0)
 | 
			
		||||
+			return val;
 | 
			
		||||
+		sensor->ctrls.af_status->val = val;
 | 
			
		||||
+		break;
 | 
			
		||||
 	}
 | 
			
		||||
 
 | 
			
		||||
 	return 0;
 | 
			
		||||
@@ -2690,6 +2917,18 @@ static int ov5640_s_ctrl(struct v4l2_ctrl *ctrl)
 | 
			
		||||
 	case V4L2_CID_AUTO_WHITE_BALANCE:
 | 
			
		||||
 		ret = ov5640_set_ctrl_white_balance(sensor, ctrl->val);
 | 
			
		||||
 		break;
 | 
			
		||||
+	case V4L2_CID_FOCUS_AUTO:
 | 
			
		||||
+		if (ctrl->val)
 | 
			
		||||
+			ret = ov5640_set_ctrl_focus(sensor, OV5640_FW_CMD_CONTINUOUS_FOCUS);
 | 
			
		||||
+		else
 | 
			
		||||
+			ret = ov5640_set_ctrl_focus(sensor, OV5640_FW_CMD_RELEASE_FOCUS);
 | 
			
		||||
+		break;
 | 
			
		||||
+	case V4L2_CID_AUTO_FOCUS_START:
 | 
			
		||||
+		ret = ov5640_set_ctrl_focus(sensor, OV5640_FW_CMD_TRIGGER_FOCUS);
 | 
			
		||||
+		break;
 | 
			
		||||
+	case V4L2_CID_AUTO_FOCUS_STOP:
 | 
			
		||||
+		ret = ov5640_set_ctrl_focus(sensor, OV5640_FW_CMD_RELEASE_FOCUS);
 | 
			
		||||
+		break;
 | 
			
		||||
 	case V4L2_CID_HUE:
 | 
			
		||||
 		ret = ov5640_set_ctrl_hue(sensor, ctrl->val);
 | 
			
		||||
 		break;
 | 
			
		||||
@@ -2762,6 +3001,20 @@ static int ov5640_init_controls(struct ov5640_dev *sensor)
 | 
			
		||||
 	ctrls->gain = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_GAIN,
 | 
			
		||||
 					0, 1023, 1, 0);
 | 
			
		||||
 
 | 
			
		||||
+	/* Autofocus */
 | 
			
		||||
+	ctrls->focus_auto = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_FOCUS_AUTO,
 | 
			
		||||
+					    0, 1, 1, 0);
 | 
			
		||||
+	ctrls->af_start = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_AUTO_FOCUS_START,
 | 
			
		||||
+					    0, 1, 1, 0);
 | 
			
		||||
+	ctrls->af_stop = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_AUTO_FOCUS_STOP,
 | 
			
		||||
+					   0, 1, 1, 0);
 | 
			
		||||
+	ctrls->af_status = v4l2_ctrl_new_std(hdl, ops,
 | 
			
		||||
+					     V4L2_CID_AUTO_FOCUS_STATUS, 0,
 | 
			
		||||
+					     (V4L2_AUTO_FOCUS_STATUS_BUSY |
 | 
			
		||||
+					      V4L2_AUTO_FOCUS_STATUS_REACHED |
 | 
			
		||||
+					      V4L2_AUTO_FOCUS_STATUS_FAILED),
 | 
			
		||||
+					     0, V4L2_AUTO_FOCUS_STATUS_IDLE);
 | 
			
		||||
+
 | 
			
		||||
 	ctrls->saturation = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_SATURATION,
 | 
			
		||||
 					      0, 255, 1, 64);
 | 
			
		||||
 	ctrls->hue = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_HUE,
 | 
			
		||||
@@ -2795,6 +3048,7 @@ static int ov5640_init_controls(struct ov5640_dev *sensor)
 | 
			
		||||
 	v4l2_ctrl_auto_cluster(3, &ctrls->auto_wb, 0, false);
 | 
			
		||||
 	v4l2_ctrl_auto_cluster(2, &ctrls->auto_gain, 0, true);
 | 
			
		||||
 	v4l2_ctrl_auto_cluster(2, &ctrls->auto_exp, 1, true);
 | 
			
		||||
+	v4l2_ctrl_cluster(4, &ctrls->focus_auto);
 | 
			
		||||
 
 | 
			
		||||
 	sensor->sd.ctrl_handler = hdl;
 | 
			
		||||
 	return 0;
 | 
			
		||||
-- 
 | 
			
		||||
2.25.4
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										12
									
								
								sys-kernel/pinephone-sources/files/panic-led.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								sys-kernel/pinephone-sources/files/panic-led.patch
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
 | 
			
		||||
index 1c555456b..05fab5d79 100644
 | 
			
		||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
 | 
			
		||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
 | 
			
		||||
@@ -78,6 +78,7 @@ green {
 | 
			
		||||
 		};
 | 
			
		||||
 
 | 
			
		||||
 		led-2 {
 | 
			
		||||
+			linux,default-trigger = "panic";
 | 
			
		||||
 			function = LED_FUNCTION_INDICATOR;
 | 
			
		||||
 			color = <LED_COLOR_ID_RED>;
 | 
			
		||||
 			gpios = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */
 | 
			
		||||
@@ -1,49 +0,0 @@
 | 
			
		||||
# Copyright 1999-2021 Gentoo Authors
 | 
			
		||||
# Distributed under the terms of the GNU General Public License v2
 | 
			
		||||
 | 
			
		||||
EAPI="8"
 | 
			
		||||
K_NOUSENAME="yes"
 | 
			
		||||
K_NOSETEXTRAVERSION="yes"
 | 
			
		||||
K_SECURITY_UNSUPPORTED="1"
 | 
			
		||||
ETYPE="sources"
 | 
			
		||||
inherit kernel-2
 | 
			
		||||
detect_version
 | 
			
		||||
 | 
			
		||||
KEYWORDS="~arm64"
 | 
			
		||||
 | 
			
		||||
DEPEND="${RDEPEND}
 | 
			
		||||
	>=sys-devel/patch-2.7.5"
 | 
			
		||||
 | 
			
		||||
DESCRIPTION="Full sources for the Linux kernel, with megi's patch for pinephone"
 | 
			
		||||
 | 
			
		||||
MEGI_PATCH_URI="https://xff.cz/kernels/${PV:0:4}/patches/all.patch"
 | 
			
		||||
SRC_URI="${KERNEL_URI} ${MEGI_PATCH_URI} -> all-${PV}.patch"
 | 
			
		||||
 | 
			
		||||
PATCHES=(
 | 
			
		||||
	${DISTDIR}/all-${PV}.patch
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
src_prepare() {
 | 
			
		||||
	default
 | 
			
		||||
	eapply_user
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pkg_postinst() {
 | 
			
		||||
	kernel-2_pkg_postinst
 | 
			
		||||
	einfo "For more info on this patchset, and how to report problems, see:"
 | 
			
		||||
	einfo "${HOMEPAGE}"
 | 
			
		||||
	einfo "To build the kernel use the following command:"
 | 
			
		||||
	einfo "make Image Image.gz modules"
 | 
			
		||||
	einfo "make DTC_FLAGS="-@" dtbs"
 | 
			
		||||
	einfo "make install; make modules_intall; make dtbs_install"
 | 
			
		||||
	einfo "If you use kernel config coming with this ebuild, don't forget to also copy dracut-pp.conf to /etc/dracut.conf.d/"
 | 
			
		||||
	einfo "to make sure proper kernel modules are loaded into initramfs"
 | 
			
		||||
	einfo "if you want to cross compile pinephone kernel on amd64 host, follow the https://wiki.gentoo.org/wiki/Cross_build_environment"
 | 
			
		||||
	einfo "to setup cross toolchain environment, then create a xmake wrapper like the following, and replace make with xmake in above commands"
 | 
			
		||||
	einfo "#!/bin/sh"
 | 
			
		||||
	einfo "exec make ARCH='arm64' CROSS_COMPILE='aarch64-unknown-linux-gnu-' INSTALL_MOD_PATH='${SYSROOT}' '$@'"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pkg_postrm() {
 | 
			
		||||
	kernel-2_pkg_postrm
 | 
			
		||||
}
 | 
			
		||||
@@ -22,11 +22,16 @@ SRC_URI="${KERNEL_URI} ${MEGI_PATCH_URI} -> all-${PV}.patch"
 | 
			
		||||
PATCHES=(
 | 
			
		||||
	${DISTDIR}/all-${PV}.patch
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	${FILESDIR}/ccu-sun50i-a64-reparent-clocks-to-lower-speed-oscillator.patch
 | 
			
		||||
	${FILESDIR}/dts-pinephone-drop-modem-power-node.patch
 | 
			
		||||
	${FILESDIR}/media-ov5640-Implement-autofocus.patch
 | 
			
		||||
	${FILESDIR}/0107-quirk-kernel-org-bug-210681-firmware_rome_error.patch
 | 
			
		||||
	${FILESDIR}/0177-leds-gpio-make-max_brightness-configurable.patch
 | 
			
		||||
    	${FILESDIR}/panic-led.patch
 | 
			
		||||
 | 
			
		||||
        # Pinephone Keyboard
 | 
			
		||||
        ${FILESDIR}/d1d849cae12db71aa81ceedaedc1b17a34790367.patch
 | 
			
		||||
        ${FILESDIR}/2423aac2d6f5db55da99e11fd799ee66fe6f54c6.patch
 | 
			
		||||
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
src_prepare() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user