linuxPackages.ipu6-drivers: 2023-02-20 -> 2023-05-19

+6 -377
+6 -12
pkgs/os-specific/linux/ipu6-drivers/default.nix
··· 5 , kernel 6 }: 7 8 - stdenv.mkDerivation rec { 9 pname = "ipu6-drivers"; 10 - version = "unstable-2023-02-20"; 11 12 src = fetchFromGitHub { 13 owner = "intel"; 14 - repo = pname; 15 - rev = "dfedab03f3856010d37968cb384696038c73c984"; 16 - hash = "sha256-TKo04+fqY64SdDuWApuzRXBnaAW2DReubwFRsdfJMWM="; 17 }; 18 - 19 - patches = [ 20 - # https://github.com/intel/ipu6-drivers/pull/84 21 - ./pr-84-unpatched-upstream-compatiblity.patch 22 - ]; 23 24 postPatch = '' 25 cp --no-preserve=mode --recursive --verbose \ ··· 53 maintainers = with lib.maintainers; [ hexa ]; 54 platforms = [ "x86_64-linux" ]; 55 # requires 6.1.7 https://github.com/intel/ipu6-drivers/pull/84 56 - # fails to build on 6.3 https://github.com/intel/ipu6-drivers/issues/140 57 - broken = kernel.kernelOlder "6.1.7" || kernel.kernelAtLeast "6.3"; 58 }; 59 }
··· 5 , kernel 6 }: 7 8 + stdenv.mkDerivation { 9 pname = "ipu6-drivers"; 10 + version = "unstable-2023-05-19"; 11 12 src = fetchFromGitHub { 13 owner = "intel"; 14 + repo = "ipu6-drivers"; 15 + rev = "8c02a846d1afe0e108964a2d3db4acb175712da9"; 16 + hash = "sha256-f2EuxVkCvEPyH0XbLCv5t/Mi0jdk7BOh1QluG/TxZr0="; 17 }; 18 19 postPatch = '' 20 cp --no-preserve=mode --recursive --verbose \ ··· 48 maintainers = with lib.maintainers; [ hexa ]; 49 platforms = [ "x86_64-linux" ]; 50 # requires 6.1.7 https://github.com/intel/ipu6-drivers/pull/84 51 + broken = kernel.kernelOlder "6.1.7"; 52 }; 53 }
-365
pkgs/os-specific/linux/ipu6-drivers/pr-84-unpatched-upstream-compatiblity.patch
··· 1 - From 8f4346915bb7e3a3ad3eea2c24b6da09dac257b2 Mon Sep 17 00:00:00 2001 2 - From: Hans de Goede <hdegoede@redhat.com> 3 - Date: Tue, 29 Nov 2022 15:06:23 +0100 4 - Subject: [PATCH 1/4] sensors: Use clk-framework instead of a "clken" GPIO 5 - 6 - Use the clk-framework to get a clk-provider reference and use 7 - clk_prepare_enable() / clk_disable_unprepare() to control the clk. 8 - 9 - This replace modelling the clock as a "clken" GPIO, which is not a valid 10 - way to model it when the clk is e.g. generated by the clk-generator of 11 - a TPS68470 PMIC. 12 - 13 - This relies on the following upstream bugfix for the INT3472 clk provider: 14 - 15 - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cf5ac2d45f6e4d11ad78e7b10ae9a4121ba5e995 16 - 17 - "platform/x86: int3472/discrete: Ensure the clk/power enable pins are in output mode" 18 - 19 - This patch is available since upstream kernel 6.1.7, so the new 20 - code is only enabled for LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 7) 21 - 22 - This allow susing the IPU6 sensor drivers with the upstream int3472 23 - driver with unmodified upstream kernels >= 6.1.7 . 24 - 25 - Signed-off-by: Hans de Goede <hdegoede@redhat.com> 26 - --- 27 - drivers/media/i2c/hm11b1.c | 18 ++++++++++++++++++ 28 - drivers/media/i2c/ov01a1s.c | 18 ++++++++++++++++++ 29 - 2 files changed, 36 insertions(+) 30 - 31 - diff --git a/drivers/media/i2c/hm11b1.c b/drivers/media/i2c/hm11b1.c 32 - index 1cc5cd761fbf..e14810bdd612 100644 33 - --- a/drivers/media/i2c/hm11b1.c 34 - +++ b/drivers/media/i2c/hm11b1.c 35 - @@ -468,8 +468,13 @@ struct hm11b1 { 36 - struct gpio_desc *reset_gpio; 37 - /* GPIO for powerdown */ 38 - struct gpio_desc *powerdown_gpio; 39 - +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 7) 40 - /* GPIO for clock enable */ 41 - struct gpio_desc *clken_gpio; 42 - +#else 43 - + /* Clock provider */ 44 - + struct clk *clk; 45 - +#endif 46 - /* GPIO for privacy LED */ 47 - struct gpio_desc *pled_gpio; 48 - #endif 49 - @@ -508,7 +513,14 @@ static void hm11b1_set_power(struct hm11b1 *hm11b1, int on) 50 - return; 51 - gpiod_set_value_cansleep(hm11b1->reset_gpio, on); 52 - gpiod_set_value_cansleep(hm11b1->powerdown_gpio, on); 53 - +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 7) 54 - gpiod_set_value_cansleep(hm11b1->clken_gpio, on); 55 - +#else 56 - + if (on) 57 - + clk_prepare_enable(hm11b1->clk); 58 - + else 59 - + clk_disable_unprepare(hm11b1->clk); 60 - +#endif 61 - gpiod_set_value_cansleep(hm11b1->pled_gpio, on); 62 - msleep(20); 63 - #elif IS_ENABLED(CONFIG_POWER_CTRL_LOGIC) 64 - @@ -1093,12 +1105,18 @@ static int hm11b1_parse_dt(struct hm11b1 *hm11b1) 65 - return ret; 66 - } 67 - 68 - +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 7) 69 - hm11b1->clken_gpio = devm_gpiod_get(dev, "clken", GPIOD_OUT_HIGH); 70 - ret = PTR_ERR_OR_ZERO(hm11b1->clken_gpio); 71 - if (ret < 0) { 72 - dev_err(dev, "error while getting clken_gpio gpio: %d\n", ret); 73 - return ret; 74 - } 75 - +#else 76 - + hm11b1->clk = devm_clk_get_optional(dev, "clk"); 77 - + if (IS_ERR(hm11b1->clk)) 78 - + return dev_err_probe(dev, PTR_ERR(hm11b1->clk), "getting clk\n"); 79 - +#endif 80 - 81 - hm11b1->pled_gpio = devm_gpiod_get(dev, "pled", GPIOD_OUT_HIGH); 82 - ret = PTR_ERR_OR_ZERO(hm11b1->pled_gpio); 83 - diff --git a/drivers/media/i2c/ov01a1s.c b/drivers/media/i2c/ov01a1s.c 84 - index e4477625ce3b..628a1dd83ddf 100644 85 - --- a/drivers/media/i2c/ov01a1s.c 86 - +++ b/drivers/media/i2c/ov01a1s.c 87 - @@ -317,8 +317,13 @@ struct ov01a1s { 88 - struct gpio_desc *reset_gpio; 89 - /* GPIO for powerdown */ 90 - struct gpio_desc *powerdown_gpio; 91 - +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 7) 92 - /* GPIO for clock enable */ 93 - struct gpio_desc *clken_gpio; 94 - +#else 95 - + /* Clock provider */ 96 - + struct clk *clk; 97 - +#endif 98 - /* GPIO for privacy LED */ 99 - struct gpio_desc *pled_gpio; 100 - #endif 101 - @@ -339,7 +344,14 @@ static void ov01a1s_set_power(struct ov01a1s *ov01a1s, int on) 102 - return; 103 - gpiod_set_value_cansleep(ov01a1s->reset_gpio, on); 104 - gpiod_set_value_cansleep(ov01a1s->powerdown_gpio, on); 105 - +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 7) 106 - gpiod_set_value_cansleep(ov01a1s->clken_gpio, on); 107 - +#else 108 - + if (on) 109 - + clk_prepare_enable(ov01a1s->clk); 110 - + else 111 - + clk_disable_unprepare(ov01a1s->clk); 112 - +#endif 113 - gpiod_set_value_cansleep(ov01a1s->pled_gpio, on); 114 - msleep(20); 115 - #elif IS_ENABLED(CONFIG_POWER_CTRL_LOGIC) 116 - @@ -945,12 +957,18 @@ static int ov01a1s_parse_dt(struct ov01a1s *ov01a1s) 117 - return -EPROBE_DEFER; 118 - } 119 - 120 - +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 7) 121 - ov01a1s->clken_gpio = devm_gpiod_get(dev, "clken", GPIOD_OUT_HIGH); 122 - ret = PTR_ERR_OR_ZERO(ov01a1s->clken_gpio); 123 - if (ret < 0) { 124 - dev_err(dev, "error while getting clken_gpio gpio: %d\n", ret); 125 - return -EPROBE_DEFER; 126 - } 127 - +#else 128 - + ov01a1s->clk = devm_clk_get_optional(dev, "clk"); 129 - + if (IS_ERR(ov01a1s->clk)) 130 - + return dev_err_probe(dev, PTR_ERR(ov01a1s->clk), "getting clk\n"); 131 - +#endif 132 - 133 - ov01a1s->pled_gpio = devm_gpiod_get(dev, "pled", GPIOD_OUT_HIGH); 134 - ret = PTR_ERR_OR_ZERO(ov01a1s->pled_gpio); 135 - 136 - From b04fdf6433f6b64840d46f92ddf3d6d18e86ede3 Mon Sep 17 00:00:00 2001 137 - From: Hans de Goede <hdegoede@redhat.com> 138 - Date: Tue, 29 Nov 2022 23:37:50 +0100 139 - Subject: [PATCH 2/4] sensors: Make powerdown and reset signals active-low by 140 - default 141 - 142 - The powerdown and reset functions should be set to 0, as in 143 - not-powered-down, not-in-reset when the sensor is turned on. 144 - 145 - Adjust the gpiod_set() value parameters for the powerdown_gpio 146 - and reset_gpio to !on to properly reflect this. 147 - 148 - Typical sensors however have a NRESET aka /RESET pin which needs 149 - to be driven low to put the device in reset and the have 150 - a powerup/enable pin rather then a powerdown pin. So at 151 - the physicical level the pins associated with the reset and 152 - powerdown functions need to be driven low to put the chip 153 - in reset / to power the chip down. Mark the pins as active-low 154 - in the added gpio-lookup table entries for these pin to 155 - reflect this. 156 - 157 - This double negation has 0 net effect, but it uses the GPIO 158 - subsystem functionality as intended (setting reset to 0 159 - on poweron makes lot more sense then setting it to 1 on poweron) 160 - and it aligns the use of these GPIOs with that of the mainline 161 - kernel allowing future use of the IPU6 driver with the 162 - mainline INT3472 driver without needing to patch the mainline 163 - kernel. 164 - 165 - Signed-off-by: Hans de Goede <hdegoede@redhat.com> 166 - --- 167 - drivers/media/i2c/hm11b1.c | 4 ++-- 168 - drivers/media/i2c/ov01a1s.c | 4 ++-- 169 - drivers/media/i2c/ov2740.c | 2 +- 170 - ...nt3472-support-independent-clock-and-LED-gpios-5.17+.patch | 4 ++-- 171 - patch/int3472-support-independent-clock-and-LED-gpios.patch | 4 ++-- 172 - 5 files changed, 9 insertions(+), 9 deletions(-) 173 - 174 - diff --git a/drivers/media/i2c/hm11b1.c b/drivers/media/i2c/hm11b1.c 175 - index e14810bdd612..652e8f177044 100644 176 - --- a/drivers/media/i2c/hm11b1.c 177 - +++ b/drivers/media/i2c/hm11b1.c 178 - @@ -511,8 +511,8 @@ static void hm11b1_set_power(struct hm11b1 *hm11b1, int on) 179 - #if IS_ENABLED(CONFIG_INTEL_SKL_INT3472) 180 - if (!(hm11b1->reset_gpio && hm11b1->powerdown_gpio)) 181 - return; 182 - - gpiod_set_value_cansleep(hm11b1->reset_gpio, on); 183 - - gpiod_set_value_cansleep(hm11b1->powerdown_gpio, on); 184 - + gpiod_set_value_cansleep(hm11b1->reset_gpio, !on); 185 - + gpiod_set_value_cansleep(hm11b1->powerdown_gpio, !on); 186 - #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 7) 187 - gpiod_set_value_cansleep(hm11b1->clken_gpio, on); 188 - #else 189 - diff --git a/drivers/media/i2c/ov01a1s.c b/drivers/media/i2c/ov01a1s.c 190 - index 628a1dd83ddf..2ce81d04abf6 100644 191 - --- a/drivers/media/i2c/ov01a1s.c 192 - +++ b/drivers/media/i2c/ov01a1s.c 193 - @@ -342,8 +342,8 @@ static void ov01a1s_set_power(struct ov01a1s *ov01a1s, int on) 194 - #if IS_ENABLED(CONFIG_INTEL_SKL_INT3472) 195 - if (!(ov01a1s->reset_gpio && ov01a1s->powerdown_gpio)) 196 - return; 197 - - gpiod_set_value_cansleep(ov01a1s->reset_gpio, on); 198 - - gpiod_set_value_cansleep(ov01a1s->powerdown_gpio, on); 199 - + gpiod_set_value_cansleep(ov01a1s->reset_gpio, !on); 200 - + gpiod_set_value_cansleep(ov01a1s->powerdown_gpio, !on); 201 - #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 7) 202 - gpiod_set_value_cansleep(ov01a1s->clken_gpio, on); 203 - #else 204 - diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c 205 - index 67fb17e08e36..a8bb101776bd 100644 206 - --- a/drivers/media/i2c/ov2740.c 207 - +++ b/drivers/media/i2c/ov2740.c 208 - @@ -596,7 +596,7 @@ static void ov2740_set_power(struct ov2740 *ov2740, int on) 209 - { 210 - if (!(ov2740->reset_gpio && ov2740->pled_gpio)) 211 - return; 212 - - gpiod_set_value_cansleep(ov2740->reset_gpio, on); 213 - + gpiod_set_value_cansleep(ov2740->reset_gpio, !on); 214 - gpiod_set_value_cansleep(ov2740->pled_gpio, on); 215 - msleep(20); 216 - } 217 - diff --git a/patch/int3472-support-independent-clock-and-LED-gpios-5.17+.patch b/patch/int3472-support-independent-clock-and-LED-gpios-5.17+.patch 218 - index 57373ac85f39..66ed770b68a0 100644 219 - --- a/patch/int3472-support-independent-clock-and-LED-gpios-5.17+.patch 220 - +++ b/patch/int3472-support-independent-clock-and-LED-gpios-5.17+.patch 221 - @@ -65,7 +65,7 @@ index ed4c9d760757..f5857ec334fa 100644 222 - case INT3472_GPIO_TYPE_RESET: 223 - ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, "reset", 224 - - GPIO_ACTIVE_LOW); 225 - -+ polarity); 226 - ++ polarity ^ GPIO_ACTIVE_LOW); 227 - if (ret) 228 - err_msg = "Failed to map reset pin to sensor\n"; 229 - 230 - @@ -73,7 +73,7 @@ index ed4c9d760757..f5857ec334fa 100644 231 - case INT3472_GPIO_TYPE_POWERDOWN: 232 - ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, "powerdown", 233 - - GPIO_ACTIVE_LOW); 234 - -+ polarity); 235 - ++ polarity ^ GPIO_ACTIVE_LOW); 236 - if (ret) 237 - err_msg = "Failed to map powerdown pin to sensor\n"; 238 - 239 - diff --git a/patch/int3472-support-independent-clock-and-LED-gpios.patch b/patch/int3472-support-independent-clock-and-LED-gpios.patch 240 - index a2def0d76852..df70ce4a7117 100644 241 - --- a/patch/int3472-support-independent-clock-and-LED-gpios.patch 242 - +++ b/patch/int3472-support-independent-clock-and-LED-gpios.patch 243 - @@ -65,7 +65,7 @@ index e59d79c7e82f..5cf6dd63d43f 100644 244 - case INT3472_GPIO_TYPE_RESET: 245 - ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, "reset", 246 - - GPIO_ACTIVE_LOW); 247 - -+ polarity); 248 - ++ polarity ^ GPIO_ACTIVE_LOW); 249 - if (ret) 250 - err_msg = "Failed to map reset pin to sensor\n"; 251 - 252 - @@ -73,7 +73,7 @@ index e59d79c7e82f..5cf6dd63d43f 100644 253 - case INT3472_GPIO_TYPE_POWERDOWN: 254 - ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, "powerdown", 255 - - GPIO_ACTIVE_LOW); 256 - -+ polarity); 257 - ++ polarity ^ GPIO_ACTIVE_LOW); 258 - if (ret) 259 - err_msg = "Failed to map powerdown pin to sensor\n"; 260 - 261 - 262 - From 90d4b2d9cb07292c6a2580572252938a836f4a86 Mon Sep 17 00:00:00 2001 263 - From: Hans de Goede <hdegoede@redhat.com> 264 - Date: Thu, 15 Dec 2022 16:00:31 +0100 265 - Subject: [PATCH 3/4] sensors: Make "pled" GPIO optional 266 - 267 - Starting with kernel 6.3 the mainline int3472 driver models the privacy 268 - LED device as a LED class device rather then as a GPIO. 269 - 270 - As part of these changed the v4l2-core subdev code in 6.3 turns 271 - the LED on/off on s_stream() on/off calls on the sensor v4l2-subdev, 272 - so sensor drivers don't have to take care of this themselves. 273 - 274 - Change the devm_gpiod_get() calls for the "pled" GPIO into 275 - devm_gpiod_get_optional() calls so that the sensor drivers 276 - can work with both older kernel (controlling the GPIO) and 277 - with newer kernels which don't have a "pled" GPIO. 278 - 279 - Signed-off-by: Hans de Goede <hdegoede@redhat.com> 280 - --- 281 - drivers/media/i2c/hm11b1.c | 2 +- 282 - drivers/media/i2c/ov01a1s.c | 2 +- 283 - drivers/media/i2c/ov2740.c | 4 +--- 284 - 3 files changed, 3 insertions(+), 5 deletions(-) 285 - 286 - diff --git a/drivers/media/i2c/hm11b1.c b/drivers/media/i2c/hm11b1.c 287 - index 652e8f177044..6257f7987268 100644 288 - --- a/drivers/media/i2c/hm11b1.c 289 - +++ b/drivers/media/i2c/hm11b1.c 290 - @@ -1118,7 +1118,7 @@ static int hm11b1_parse_dt(struct hm11b1 *hm11b1) 291 - return dev_err_probe(dev, PTR_ERR(hm11b1->clk), "getting clk\n"); 292 - #endif 293 - 294 - - hm11b1->pled_gpio = devm_gpiod_get(dev, "pled", GPIOD_OUT_HIGH); 295 - + hm11b1->pled_gpio = devm_gpiod_get_optional(dev, "pled", GPIOD_OUT_HIGH); 296 - ret = PTR_ERR_OR_ZERO(hm11b1->pled_gpio); 297 - if (ret < 0) { 298 - dev_err(dev, "error while getting pled gpio: %d\n", ret); 299 - diff --git a/drivers/media/i2c/ov01a1s.c b/drivers/media/i2c/ov01a1s.c 300 - index 2ce81d04abf6..1bc6199713f3 100644 301 - --- a/drivers/media/i2c/ov01a1s.c 302 - +++ b/drivers/media/i2c/ov01a1s.c 303 - @@ -970,7 +970,7 @@ static int ov01a1s_parse_dt(struct ov01a1s *ov01a1s) 304 - return dev_err_probe(dev, PTR_ERR(ov01a1s->clk), "getting clk\n"); 305 - #endif 306 - 307 - - ov01a1s->pled_gpio = devm_gpiod_get(dev, "pled", GPIOD_OUT_HIGH); 308 - + ov01a1s->pled_gpio = devm_gpiod_get_optional(dev, "pled", GPIOD_OUT_HIGH); 309 - ret = PTR_ERR_OR_ZERO(ov01a1s->pled_gpio); 310 - if (ret < 0) { 311 - dev_err(dev, "error while getting pled gpio: %d\n", ret); 312 - diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c 313 - index a8bb101776bd..08f284d4aca1 100644 314 - --- a/drivers/media/i2c/ov2740.c 315 - +++ b/drivers/media/i2c/ov2740.c 316 - @@ -594,8 +594,6 @@ static u64 to_pixels_per_line(u32 hts, u32 f_index) 317 - 318 - static void ov2740_set_power(struct ov2740 *ov2740, int on) 319 - { 320 - - if (!(ov2740->reset_gpio && ov2740->pled_gpio)) 321 - - return; 322 - gpiod_set_value_cansleep(ov2740->reset_gpio, !on); 323 - gpiod_set_value_cansleep(ov2740->pled_gpio, on); 324 - msleep(20); 325 - @@ -633,7 +631,7 @@ static int ov2740_parse_dt(struct ov2740 *ov2740) 326 - return ret; 327 - } 328 - 329 - - ov2740->pled_gpio = devm_gpiod_get(dev, "pled", GPIOD_OUT_HIGH); 330 - + ov2740->pled_gpio = devm_gpiod_get_optional(dev, "pled", GPIOD_OUT_HIGH); 331 - ret = PTR_ERR_OR_ZERO(ov2740->pled_gpio); 332 - if (ret < 0) { 333 - dev_err(dev, "error while getting pled gpio: %d\n", ret); 334 - 335 - From 5ed1980822f0cb4787d1346493d126aad1bf9210 Mon Sep 17 00:00:00 2001 336 - From: Hans de Goede <hdegoede@redhat.com> 337 - Date: Tue, 29 Nov 2022 15:15:15 +0100 338 - Subject: [PATCH 4/4] ov01a1s: Drop unused link_freq variable 339 - MIME-Version: 1.0 340 - Content-Type: text/plain; charset=UTF-8 341 - Content-Transfer-Encoding: 8bit 342 - 343 - Drop the unused link_freq variable, fixing this compiler warning: 344 - 345 - drivers/media/i2c/ov01a1s.c:994:13: warning: unused variable ‘link_freq’ [-Wunused-variable] 346 - 994 | s64 link_freq; 347 - | ^~~~~~~~~ 348 - 349 - Signed-off-by: Hans de Goede <hdegoede@redhat.com> 350 - --- 351 - drivers/media/i2c/ov01a1s.c | 1 - 352 - 1 file changed, 1 deletion(-) 353 - 354 - diff --git a/drivers/media/i2c/ov01a1s.c b/drivers/media/i2c/ov01a1s.c 355 - index 1bc6199713f3..ab4ff255d4c1 100644 356 - --- a/drivers/media/i2c/ov01a1s.c 357 - +++ b/drivers/media/i2c/ov01a1s.c 358 - @@ -988,7 +988,6 @@ static int ov01a1s_probe(struct i2c_client *client) 359 - #if IS_ENABLED(CONFIG_INTEL_VSC) 360 - struct vsc_mipi_config conf; 361 - struct vsc_camera_status status; 362 - - s64 link_freq; 363 - #endif 364 - 365 - ov01a1s = devm_kzalloc(&client->dev, sizeof(*ov01a1s), GFP_KERNEL);
···