0013-cameras.patch 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780
  1. From 2c667679a6694ea9720c30be32ba73977638ac3a Mon Sep 17 00:00:00 2001
  2. From: Hans de Goede <hdegoede@redhat.com>
  3. Date: Sun, 10 Oct 2021 20:56:57 +0200
  4. Subject: [PATCH] ACPI: delay enumeration of devices with a _DEP pointing to an
  5. INT3472 device
  6. The clk and regulator frameworks expect clk/regulator consumer-devices
  7. to have info about the consumed clks/regulators described in the device's
  8. fw_node.
  9. To work around cases where this info is not present in the firmware tables,
  10. which is often the case on x86/ACPI devices, both frameworks allow the
  11. provider-driver to attach info about consumers to the clks/regulators
  12. when registering these.
  13. This causes problems with the probe ordering wrt drivers for consumers
  14. of these clks/regulators. Since the lookups are only registered when the
  15. provider-driver binds, trying to get these clks/regulators before then
  16. results in a -ENOENT error for clks and a dummy regulator for regulators.
  17. One case where we hit this issue is camera sensors such as e.g. the OV8865
  18. sensor found on the Microsoft Surface Go. The sensor uses clks, regulators
  19. and GPIOs provided by a TPS68470 PMIC which is described in an INT3472
  20. ACPI device. There is special platform code handling this and setting
  21. platform_data with the necessary consumer info on the MFD cells
  22. instantiated for the PMIC under: drivers/platform/x86/intel/int3472.
  23. For this to work properly the ov8865 driver must not bind to the I2C-client
  24. for the OV8865 sensor until after the TPS68470 PMIC gpio, regulator and
  25. clk MFD cells have all been fully setup.
  26. The OV8865 on the Microsoft Surface Go is just one example, all X86
  27. devices using the Intel IPU3 camera block found on recent Intel SoCs
  28. have similar issues where there is an INT3472 HID ACPI-device, which
  29. describes the clks and regulators, and the driver for this INT3472 device
  30. must be fully initialized before the sensor driver (any sensor driver)
  31. binds for things to work properly.
  32. On these devices the ACPI nodes describing the sensors all have a _DEP
  33. dependency on the matching INT3472 ACPI device (there is one per sensor).
  34. This allows solving the probe-ordering problem by delaying the enumeration
  35. (instantiation of the I2C-client in the ov8865 example) of ACPI-devices
  36. which have a _DEP dependency on an INT3472 device.
  37. The new acpi_dev_ready_for_enumeration() helper used for this is also
  38. exported because for devices, which have the enumeration_by_parent flag
  39. set, the parent-driver will do its own scan of child ACPI devices and
  40. it will try to enumerate those during its probe(). Code doing this such
  41. as e.g. the i2c-core-acpi.c code must call this new helper to ensure
  42. that it too delays the enumeration until all the _DEP dependencies are
  43. met on devices which have the new honor_deps flag set.
  44. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  45. Patchset: cameras
  46. ---
  47. drivers/acpi/scan.c | 3 +++
  48. 1 file changed, 3 insertions(+)
  49. diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
  50. index d1464324de95..5d865a34dd9d 100644
  51. --- a/drivers/acpi/scan.c
  52. +++ b/drivers/acpi/scan.c
  53. @@ -2181,6 +2181,9 @@ static acpi_status acpi_bus_check_add_2(acpi_handle handle, u32 lvl_not_used,
  54. static void acpi_default_enumeration(struct acpi_device *device)
  55. {
  56. + if (!acpi_dev_ready_for_enumeration(device))
  57. + return;
  58. +
  59. /*
  60. * Do not enumerate devices with enumeration_by_parent flag set as
  61. * they will be enumerated by their respective parents.
  62. --
  63. 2.45.2
  64. From 0ac07f51d4c870ab988a572a9bdf9e3dde99ae46 Mon Sep 17 00:00:00 2001
  65. From: zouxiaoh <xiaohong.zou@intel.com>
  66. Date: Fri, 25 Jun 2021 08:52:59 +0800
  67. Subject: [PATCH] iommu: intel-ipu: use IOMMU passthrough mode for Intel IPUs
  68. Intel IPU(Image Processing Unit) has its own (IO)MMU hardware,
  69. The IPU driver allocates its own page table that is not mapped
  70. via the DMA, and thus the Intel IOMMU driver blocks access giving
  71. this error: DMAR: DRHD: handling fault status reg 3 DMAR:
  72. [DMA Read] Request device [00:05.0] PASID ffffffff
  73. fault addr 76406000 [fault reason 06] PTE Read access is not set
  74. As IPU is not an external facing device which is not risky, so use
  75. IOMMU passthrough mode for Intel IPUs.
  76. Change-Id: I6dcccdadac308cf42e20a18e1b593381391e3e6b
  77. Depends-On: Iacd67578e8c6a9b9ac73285f52b4081b72fb68a6
  78. Tracked-On: #JIITL8-411
  79. Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
  80. Signed-off-by: zouxiaoh <xiaohong.zou@intel.com>
  81. Signed-off-by: Xu Chongyang <chongyang.xu@intel.com>
  82. Patchset: cameras
  83. ---
  84. drivers/iommu/intel/iommu.c | 30 ++++++++++++++++++++++++++++++
  85. 1 file changed, 30 insertions(+)
  86. diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
  87. index 61bc54299a59..a61af0f4e9fc 100644
  88. --- a/drivers/iommu/intel/iommu.c
  89. +++ b/drivers/iommu/intel/iommu.c
  90. @@ -44,6 +44,13 @@
  91. ((pdev)->vendor == PCI_VENDOR_ID_INTEL && (pdev)->device == 0x34E4) \
  92. )
  93. +#define IS_INTEL_IPU(pdev) ((pdev)->vendor == PCI_VENDOR_ID_INTEL && \
  94. + ((pdev)->device == 0x9a19 || \
  95. + (pdev)->device == 0x9a39 || \
  96. + (pdev)->device == 0x4e19 || \
  97. + (pdev)->device == 0x465d || \
  98. + (pdev)->device == 0x1919))
  99. +
  100. #define IOAPIC_RANGE_START (0xfee00000)
  101. #define IOAPIC_RANGE_END (0xfeefffff)
  102. #define IOVA_START_ADDR (0x1000)
  103. @@ -227,12 +234,14 @@ int intel_iommu_enabled = 0;
  104. EXPORT_SYMBOL_GPL(intel_iommu_enabled);
  105. static int dmar_map_ipts = 1;
  106. +static int dmar_map_ipu = 1;
  107. static int intel_iommu_superpage = 1;
  108. static int iommu_identity_mapping;
  109. static int iommu_skip_te_disable;
  110. static int disable_igfx_iommu;
  111. #define IDENTMAP_AZALIA 4
  112. +#define IDENTMAP_IPU 8
  113. #define IDENTMAP_IPTS 16
  114. const struct iommu_ops intel_iommu_ops;
  115. @@ -2409,6 +2418,9 @@ static int device_def_domain_type(struct device *dev)
  116. if ((iommu_identity_mapping & IDENTMAP_AZALIA) && IS_AZALIA(pdev))
  117. return IOMMU_DOMAIN_IDENTITY;
  118. + if ((iommu_identity_mapping & IDENTMAP_IPU) && IS_INTEL_IPU(pdev))
  119. + return IOMMU_DOMAIN_IDENTITY;
  120. +
  121. if ((iommu_identity_mapping & IDENTMAP_IPTS) && IS_IPTS(pdev))
  122. return IOMMU_DOMAIN_IDENTITY;
  123. }
  124. @@ -2711,6 +2723,9 @@ static int __init init_dmars(void)
  125. iommu_set_root_entry(iommu);
  126. }
  127. + if (!dmar_map_ipu)
  128. + iommu_identity_mapping |= IDENTMAP_IPU;
  129. +
  130. if (!dmar_map_ipts)
  131. iommu_identity_mapping |= IDENTMAP_IPTS;
  132. @@ -4884,6 +4899,18 @@ static void quirk_iommu_igfx(struct pci_dev *dev)
  133. disable_igfx_iommu = 1;
  134. }
  135. +static void quirk_iommu_ipu(struct pci_dev *dev)
  136. +{
  137. + if (!IS_INTEL_IPU(dev))
  138. + return;
  139. +
  140. + if (risky_device(dev))
  141. + return;
  142. +
  143. + pci_info(dev, "Passthrough IOMMU for integrated Intel IPU\n");
  144. + dmar_map_ipu = 0;
  145. +}
  146. +
  147. static void quirk_iommu_ipts(struct pci_dev *dev)
  148. {
  149. if (!IS_IPTS(dev))
  150. @@ -4931,6 +4958,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1632, quirk_iommu_igfx);
  151. DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x163A, quirk_iommu_igfx);
  152. DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x163D, quirk_iommu_igfx);
  153. +/* disable IPU dmar support */
  154. +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_iommu_ipu);
  155. +
  156. /* disable IPTS dmar support */
  157. DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9D3E, quirk_iommu_ipts);
  158. DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x34E4, quirk_iommu_ipts);
  159. --
  160. 2.45.2
  161. From 1c90833561276f2ca96a844a980a4660255fd241 Mon Sep 17 00:00:00 2001
  162. From: Daniel Scally <djrscally@gmail.com>
  163. Date: Sun, 10 Oct 2021 20:57:02 +0200
  164. Subject: [PATCH] platform/x86: int3472: Enable I2c daisy chain
  165. The TPS68470 PMIC has an I2C passthrough mode through which I2C traffic
  166. can be forwarded to a device connected to the PMIC as though it were
  167. connected directly to the system bus. Enable this mode when the chip
  168. is initialised.
  169. Signed-off-by: Daniel Scally <djrscally@gmail.com>
  170. Patchset: cameras
  171. ---
  172. drivers/platform/x86/intel/int3472/tps68470.c | 7 +++++++
  173. 1 file changed, 7 insertions(+)
  174. diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c
  175. index 1e107fd49f82..e3e1696e7f0e 100644
  176. --- a/drivers/platform/x86/intel/int3472/tps68470.c
  177. +++ b/drivers/platform/x86/intel/int3472/tps68470.c
  178. @@ -46,6 +46,13 @@ static int tps68470_chip_init(struct device *dev, struct regmap *regmap)
  179. return ret;
  180. }
  181. + /* Enable I2C daisy chain */
  182. + ret = regmap_write(regmap, TPS68470_REG_S_I2C_CTL, 0x03);
  183. + if (ret) {
  184. + dev_err(dev, "Failed to enable i2c daisy chain\n");
  185. + return ret;
  186. + }
  187. +
  188. dev_info(dev, "TPS68470 REVID: 0x%02x\n", version);
  189. return 0;
  190. --
  191. 2.45.2
  192. From 9a9c937d189290f66f1744119731887a3acc6d10 Mon Sep 17 00:00:00 2001
  193. From: Daniel Scally <dan.scally@ideasonboard.com>
  194. Date: Thu, 2 Mar 2023 12:59:39 +0000
  195. Subject: [PATCH] platform/x86: int3472: Remap reset GPIO for INT347E
  196. ACPI _HID INT347E represents the OmniVision 7251 camera sensor. The
  197. driver for this sensor expects a single pin named "enable", but on
  198. some Microsoft Surface platforms the sensor is assigned a single
  199. GPIO who's type flag is INT3472_GPIO_TYPE_RESET.
  200. Remap the GPIO pin's function from "reset" to "enable". This is done
  201. outside of the existing remap table since it is a more widespread
  202. discrepancy than that method is designed for. Additionally swap the
  203. polarity of the pin to match the driver's expectation.
  204. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
  205. Patchset: cameras
  206. ---
  207. drivers/platform/x86/intel/int3472/discrete.c | 14 ++++++++++++++
  208. 1 file changed, 14 insertions(+)
  209. diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c
  210. index 07b302e09340..1d3097bc7e48 100644
  211. --- a/drivers/platform/x86/intel/int3472/discrete.c
  212. +++ b/drivers/platform/x86/intel/int3472/discrete.c
  213. @@ -83,12 +83,26 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347
  214. const char *func, u32 polarity)
  215. {
  216. int ret;
  217. + const struct acpi_device_id ov7251_ids[] = {
  218. + { "INT347E" },
  219. + };
  220. if (int3472->n_sensor_gpios >= INT3472_MAX_SENSOR_GPIOS) {
  221. dev_warn(int3472->dev, "Too many GPIOs mapped\n");
  222. return -EINVAL;
  223. }
  224. + /*
  225. + * In addition to the function remap table we need to bulk remap the
  226. + * "reset" GPIO for the OmniVision 7251 sensor, as the driver for that
  227. + * expects its only GPIO pin to be called "enable" (and to have the
  228. + * opposite polarity).
  229. + */
  230. + if (!strcmp(func, "reset") && !acpi_match_device_ids(int3472->sensor, ov7251_ids)) {
  231. + func = "enable";
  232. + polarity = GPIO_ACTIVE_HIGH;
  233. + }
  234. +
  235. ret = skl_int3472_fill_gpiod_lookup(&int3472->gpios.table[int3472->n_sensor_gpios],
  236. agpio, func, polarity);
  237. if (ret)
  238. --
  239. 2.45.2
  240. From b329ea16ddeae06460a32495f79cd82d1c58ee65 Mon Sep 17 00:00:00 2001
  241. From: Daniel Scally <dan.scally@ideasonboard.com>
  242. Date: Tue, 21 Mar 2023 13:45:26 +0000
  243. Subject: [PATCH] media: i2c: Clarify that gain is Analogue gain in OV7251
  244. Update the control ID for the gain control in the ov7251 driver to
  245. V4L2_CID_ANALOGUE_GAIN.
  246. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
  247. Patchset: cameras
  248. ---
  249. drivers/media/i2c/ov7251.c | 4 ++--
  250. 1 file changed, 2 insertions(+), 2 deletions(-)
  251. diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c
  252. index 30f61e04ecaf..9c1292ca8552 100644
  253. --- a/drivers/media/i2c/ov7251.c
  254. +++ b/drivers/media/i2c/ov7251.c
  255. @@ -1051,7 +1051,7 @@ static int ov7251_s_ctrl(struct v4l2_ctrl *ctrl)
  256. case V4L2_CID_EXPOSURE:
  257. ret = ov7251_set_exposure(ov7251, ctrl->val);
  258. break;
  259. - case V4L2_CID_GAIN:
  260. + case V4L2_CID_ANALOGUE_GAIN:
  261. ret = ov7251_set_gain(ov7251, ctrl->val);
  262. break;
  263. case V4L2_CID_TEST_PATTERN:
  264. @@ -1572,7 +1572,7 @@ static int ov7251_init_ctrls(struct ov7251 *ov7251)
  265. ov7251->exposure = v4l2_ctrl_new_std(&ov7251->ctrls, &ov7251_ctrl_ops,
  266. V4L2_CID_EXPOSURE, 1, 32, 1, 32);
  267. ov7251->gain = v4l2_ctrl_new_std(&ov7251->ctrls, &ov7251_ctrl_ops,
  268. - V4L2_CID_GAIN, 16, 1023, 1, 16);
  269. + V4L2_CID_ANALOGUE_GAIN, 16, 1023, 1, 16);
  270. v4l2_ctrl_new_std_menu_items(&ov7251->ctrls, &ov7251_ctrl_ops,
  271. V4L2_CID_TEST_PATTERN,
  272. ARRAY_SIZE(ov7251_test_pattern_menu) - 1,
  273. --
  274. 2.45.2
  275. From 4b407381f7a1272abf62bd19a32240b4abbb5128 Mon Sep 17 00:00:00 2001
  276. From: Daniel Scally <dan.scally@ideasonboard.com>
  277. Date: Wed, 22 Mar 2023 11:01:42 +0000
  278. Subject: [PATCH] media: v4l2-core: Acquire privacy led in
  279. v4l2_async_register_subdev()
  280. The current call to v4l2_subdev_get_privacy_led() is contained in
  281. v4l2_async_register_subdev_sensor(), but that function isn't used by
  282. all the sensor drivers. Move the acquisition of the privacy led to
  283. v4l2_async_register_subdev() instead.
  284. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
  285. Patchset: cameras
  286. ---
  287. drivers/media/v4l2-core/v4l2-async.c | 4 ++++
  288. drivers/media/v4l2-core/v4l2-fwnode.c | 4 ----
  289. 2 files changed, 4 insertions(+), 4 deletions(-)
  290. diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
  291. index 4bb073587817..cbcbf91db640 100644
  292. --- a/drivers/media/v4l2-core/v4l2-async.c
  293. +++ b/drivers/media/v4l2-core/v4l2-async.c
  294. @@ -792,6 +792,10 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd)
  295. INIT_LIST_HEAD(&sd->asc_list);
  296. + ret = v4l2_subdev_get_privacy_led(sd);
  297. + if (ret < 0)
  298. + return ret;
  299. +
  300. /*
  301. * No reference taken. The reference is held by the device (struct
  302. * v4l2_subdev.dev), and async sub-device does not exist independently
  303. diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c
  304. index 89c7192148df..44eca113e772 100644
  305. --- a/drivers/media/v4l2-core/v4l2-fwnode.c
  306. +++ b/drivers/media/v4l2-core/v4l2-fwnode.c
  307. @@ -1219,10 +1219,6 @@ int v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd)
  308. v4l2_async_subdev_nf_init(notifier, sd);
  309. - ret = v4l2_subdev_get_privacy_led(sd);
  310. - if (ret < 0)
  311. - goto out_cleanup;
  312. -
  313. ret = v4l2_async_nf_parse_fwnode_sensor(sd->dev, notifier);
  314. if (ret < 0)
  315. goto out_cleanup;
  316. --
  317. 2.45.2
  318. From 1058d4acabef10a3e2002f4c6017cc9f83300ec9 Mon Sep 17 00:00:00 2001
  319. From: Kate Hsuan <hpa@redhat.com>
  320. Date: Tue, 21 Mar 2023 23:37:16 +0800
  321. Subject: [PATCH] platform: x86: int3472: Add MFD cell for tps68470 LED
  322. Add MFD cell for tps68470-led.
  323. Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
  324. Signed-off-by: Kate Hsuan <hpa@redhat.com>
  325. Reviewed-by: Hans de Goede <hdegoede@redhat.com>
  326. Patchset: cameras
  327. ---
  328. drivers/platform/x86/intel/int3472/tps68470.c | 5 +++--
  329. 1 file changed, 3 insertions(+), 2 deletions(-)
  330. diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c
  331. index e3e1696e7f0e..423dc555093f 100644
  332. --- a/drivers/platform/x86/intel/int3472/tps68470.c
  333. +++ b/drivers/platform/x86/intel/int3472/tps68470.c
  334. @@ -17,7 +17,7 @@
  335. #define DESIGNED_FOR_CHROMEOS 1
  336. #define DESIGNED_FOR_WINDOWS 2
  337. -#define TPS68470_WIN_MFD_CELL_COUNT 3
  338. +#define TPS68470_WIN_MFD_CELL_COUNT 4
  339. static const struct mfd_cell tps68470_cros[] = {
  340. { .name = "tps68470-gpio" },
  341. @@ -200,7 +200,8 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client)
  342. cells[1].name = "tps68470-regulator";
  343. cells[1].platform_data = (void *)board_data->tps68470_regulator_pdata;
  344. cells[1].pdata_size = sizeof(struct tps68470_regulator_platform_data);
  345. - cells[2].name = "tps68470-gpio";
  346. + cells[2].name = "tps68470-led";
  347. + cells[3].name = "tps68470-gpio";
  348. for (i = 0; i < board_data->n_gpiod_lookups; i++)
  349. gpiod_add_lookup_table(board_data->tps68470_gpio_lookup_tables[i]);
  350. --
  351. 2.45.2
  352. From 0c84792426ef55475cf21abe08692e849baea648 Mon Sep 17 00:00:00 2001
  353. From: Kate Hsuan <hpa@redhat.com>
  354. Date: Tue, 21 Mar 2023 23:37:17 +0800
  355. Subject: [PATCH] include: mfd: tps68470: Add masks for LEDA and LEDB
  356. Add flags for both LEDA(TPS68470_ILEDCTL_ENA), LEDB
  357. (TPS68470_ILEDCTL_ENB), and current control mask for LEDB
  358. (TPS68470_ILEDCTL_CTRLB)
  359. Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
  360. Reviewed-by: Hans de Goede <hdegoede@redhat.com>
  361. Signed-off-by: Kate Hsuan <hpa@redhat.com>
  362. Patchset: cameras
  363. ---
  364. include/linux/mfd/tps68470.h | 5 +++++
  365. 1 file changed, 5 insertions(+)
  366. diff --git a/include/linux/mfd/tps68470.h b/include/linux/mfd/tps68470.h
  367. index 7807fa329db0..2d2abb25b944 100644
  368. --- a/include/linux/mfd/tps68470.h
  369. +++ b/include/linux/mfd/tps68470.h
  370. @@ -34,6 +34,7 @@
  371. #define TPS68470_REG_SGPO 0x22
  372. #define TPS68470_REG_GPDI 0x26
  373. #define TPS68470_REG_GPDO 0x27
  374. +#define TPS68470_REG_ILEDCTL 0x28
  375. #define TPS68470_REG_VCMVAL 0x3C
  376. #define TPS68470_REG_VAUX1VAL 0x3D
  377. #define TPS68470_REG_VAUX2VAL 0x3E
  378. @@ -94,4 +95,8 @@
  379. #define TPS68470_GPIO_MODE_OUT_CMOS 2
  380. #define TPS68470_GPIO_MODE_OUT_ODRAIN 3
  381. +#define TPS68470_ILEDCTL_ENA BIT(2)
  382. +#define TPS68470_ILEDCTL_ENB BIT(6)
  383. +#define TPS68470_ILEDCTL_CTRLB GENMASK(5, 4)
  384. +
  385. #endif /* __LINUX_MFD_TPS68470_H */
  386. --
  387. 2.45.2
  388. From bcdf2d2c87ec937d77fad091d249f321d9adc727 Mon Sep 17 00:00:00 2001
  389. From: Kate Hsuan <hpa@redhat.com>
  390. Date: Tue, 21 Mar 2023 23:37:18 +0800
  391. Subject: [PATCH] leds: tps68470: Add LED control for tps68470
  392. There are two LED controllers, LEDA indicator LED and LEDB flash LED for
  393. tps68470. LEDA can be enabled by setting TPS68470_ILEDCTL_ENA. Moreover,
  394. tps68470 provides four levels of power status for LEDB. If the
  395. properties called "ti,ledb-current" can be found, the current will be
  396. set according to the property values. These two LEDs can be controlled
  397. through the LED class of sysfs (tps68470-leda and tps68470-ledb).
  398. Signed-off-by: Kate Hsuan <hpa@redhat.com>
  399. Reviewed-by: Hans de Goede <hdegoede@redhat.com>
  400. Patchset: cameras
  401. ---
  402. drivers/leds/Kconfig | 12 +++
  403. drivers/leds/Makefile | 1 +
  404. drivers/leds/leds-tps68470.c | 185 +++++++++++++++++++++++++++++++++++
  405. 3 files changed, 198 insertions(+)
  406. create mode 100644 drivers/leds/leds-tps68470.c
  407. diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
  408. index 05e6af88b88c..c120eb0b5aa8 100644
  409. --- a/drivers/leds/Kconfig
  410. +++ b/drivers/leds/Kconfig
  411. @@ -909,6 +909,18 @@ config LEDS_TPS6105X
  412. It is a single boost converter primarily for white LEDs and
  413. audio amplifiers.
  414. +config LEDS_TPS68470
  415. + tristate "LED support for TI TPS68470"
  416. + depends on LEDS_CLASS
  417. + depends on INTEL_SKL_INT3472
  418. + help
  419. + This driver supports TPS68470 PMIC with LED chip.
  420. + It provides two LED controllers, with the ability to drive 2
  421. + indicator LEDs and 2 flash LEDs.
  422. +
  423. + To compile this driver as a module, choose M and it will be
  424. + called leds-tps68470
  425. +
  426. config LEDS_IP30
  427. tristate "LED support for SGI Octane machines"
  428. depends on LEDS_CLASS
  429. diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
  430. index effdfc6f1e95..6ce609b2cdac 100644
  431. --- a/drivers/leds/Makefile
  432. +++ b/drivers/leds/Makefile
  433. @@ -86,6 +86,7 @@ obj-$(CONFIG_LEDS_TCA6507) += leds-tca6507.o
  434. obj-$(CONFIG_LEDS_TI_LMU_COMMON) += leds-ti-lmu-common.o
  435. obj-$(CONFIG_LEDS_TLC591XX) += leds-tlc591xx.o
  436. obj-$(CONFIG_LEDS_TPS6105X) += leds-tps6105x.o
  437. +obj-$(CONFIG_LEDS_TPS68470) += leds-tps68470.o
  438. obj-$(CONFIG_LEDS_TURRIS_OMNIA) += leds-turris-omnia.o
  439. obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o
  440. obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o
  441. diff --git a/drivers/leds/leds-tps68470.c b/drivers/leds/leds-tps68470.c
  442. new file mode 100644
  443. index 000000000000..35aeb5db89c8
  444. --- /dev/null
  445. +++ b/drivers/leds/leds-tps68470.c
  446. @@ -0,0 +1,185 @@
  447. +// SPDX-License-Identifier: GPL-2.0
  448. +/*
  449. + * LED driver for TPS68470 PMIC
  450. + *
  451. + * Copyright (C) 2023 Red Hat
  452. + *
  453. + * Authors:
  454. + * Kate Hsuan <hpa@redhat.com>
  455. + */
  456. +
  457. +#include <linux/leds.h>
  458. +#include <linux/mfd/tps68470.h>
  459. +#include <linux/module.h>
  460. +#include <linux/platform_device.h>
  461. +#include <linux/property.h>
  462. +#include <linux/regmap.h>
  463. +
  464. +
  465. +#define lcdev_to_led(led_cdev) \
  466. + container_of(led_cdev, struct tps68470_led, lcdev)
  467. +
  468. +#define led_to_tps68470(led, index) \
  469. + container_of(led, struct tps68470_device, leds[index])
  470. +
  471. +enum tps68470_led_ids {
  472. + TPS68470_ILED_A,
  473. + TPS68470_ILED_B,
  474. + TPS68470_NUM_LEDS
  475. +};
  476. +
  477. +static const char *tps68470_led_names[] = {
  478. + [TPS68470_ILED_A] = "tps68470-iled_a",
  479. + [TPS68470_ILED_B] = "tps68470-iled_b",
  480. +};
  481. +
  482. +struct tps68470_led {
  483. + unsigned int led_id;
  484. + struct led_classdev lcdev;
  485. +};
  486. +
  487. +struct tps68470_device {
  488. + struct device *dev;
  489. + struct regmap *regmap;
  490. + struct tps68470_led leds[TPS68470_NUM_LEDS];
  491. +};
  492. +
  493. +enum ctrlb_current {
  494. + CTRLB_2MA = 0,
  495. + CTRLB_4MA = 1,
  496. + CTRLB_8MA = 2,
  497. + CTRLB_16MA = 3,
  498. +};
  499. +
  500. +static int tps68470_brightness_set(struct led_classdev *led_cdev, enum led_brightness brightness)
  501. +{
  502. + struct tps68470_led *led = lcdev_to_led(led_cdev);
  503. + struct tps68470_device *tps68470 = led_to_tps68470(led, led->led_id);
  504. + struct regmap *regmap = tps68470->regmap;
  505. +
  506. + switch (led->led_id) {
  507. + case TPS68470_ILED_A:
  508. + return regmap_update_bits(regmap, TPS68470_REG_ILEDCTL, TPS68470_ILEDCTL_ENA,
  509. + brightness ? TPS68470_ILEDCTL_ENA : 0);
  510. + case TPS68470_ILED_B:
  511. + return regmap_update_bits(regmap, TPS68470_REG_ILEDCTL, TPS68470_ILEDCTL_ENB,
  512. + brightness ? TPS68470_ILEDCTL_ENB : 0);
  513. + }
  514. + return -EINVAL;
  515. +}
  516. +
  517. +static enum led_brightness tps68470_brightness_get(struct led_classdev *led_cdev)
  518. +{
  519. + struct tps68470_led *led = lcdev_to_led(led_cdev);
  520. + struct tps68470_device *tps68470 = led_to_tps68470(led, led->led_id);
  521. + struct regmap *regmap = tps68470->regmap;
  522. + int ret = 0;
  523. + int value = 0;
  524. +
  525. + ret = regmap_read(regmap, TPS68470_REG_ILEDCTL, &value);
  526. + if (ret)
  527. + return dev_err_probe(led_cdev->dev, -EINVAL, "failed on reading register\n");
  528. +
  529. + switch (led->led_id) {
  530. + case TPS68470_ILED_A:
  531. + value = value & TPS68470_ILEDCTL_ENA;
  532. + break;
  533. + case TPS68470_ILED_B:
  534. + value = value & TPS68470_ILEDCTL_ENB;
  535. + break;
  536. + }
  537. +
  538. + return value ? LED_ON : LED_OFF;
  539. +}
  540. +
  541. +
  542. +static int tps68470_ledb_current_init(struct platform_device *pdev,
  543. + struct tps68470_device *tps68470)
  544. +{
  545. + int ret = 0;
  546. + unsigned int curr;
  547. +
  548. + /* configure LEDB current if the properties can be got */
  549. + if (!device_property_read_u32(&pdev->dev, "ti,ledb-current", &curr)) {
  550. + if (curr > CTRLB_16MA) {
  551. + dev_err(&pdev->dev,
  552. + "Invalid LEDB current value: %d\n",
  553. + curr);
  554. + return -EINVAL;
  555. + }
  556. + ret = regmap_update_bits(tps68470->regmap, TPS68470_REG_ILEDCTL,
  557. + TPS68470_ILEDCTL_CTRLB, curr);
  558. + }
  559. + return ret;
  560. +}
  561. +
  562. +static int tps68470_leds_probe(struct platform_device *pdev)
  563. +{
  564. + int i = 0;
  565. + int ret = 0;
  566. + struct tps68470_device *tps68470;
  567. + struct tps68470_led *led;
  568. + struct led_classdev *lcdev;
  569. +
  570. + tps68470 = devm_kzalloc(&pdev->dev, sizeof(struct tps68470_device),
  571. + GFP_KERNEL);
  572. + if (!tps68470)
  573. + return -ENOMEM;
  574. +
  575. + tps68470->dev = &pdev->dev;
  576. + tps68470->regmap = dev_get_drvdata(pdev->dev.parent);
  577. +
  578. + for (i = 0; i < TPS68470_NUM_LEDS; i++) {
  579. + led = &tps68470->leds[i];
  580. + lcdev = &led->lcdev;
  581. +
  582. + led->led_id = i;
  583. +
  584. + lcdev->name = devm_kasprintf(tps68470->dev, GFP_KERNEL, "%s::%s",
  585. + tps68470_led_names[i], LED_FUNCTION_INDICATOR);
  586. + if (!lcdev->name)
  587. + return -ENOMEM;
  588. +
  589. + lcdev->max_brightness = 1;
  590. + lcdev->brightness = 0;
  591. + lcdev->brightness_set_blocking = tps68470_brightness_set;
  592. + lcdev->brightness_get = tps68470_brightness_get;
  593. + lcdev->dev = &pdev->dev;
  594. +
  595. + ret = devm_led_classdev_register(tps68470->dev, lcdev);
  596. + if (ret) {
  597. + dev_err_probe(tps68470->dev, ret,
  598. + "error registering led\n");
  599. + goto err_exit;
  600. + }
  601. +
  602. + if (i == TPS68470_ILED_B) {
  603. + ret = tps68470_ledb_current_init(pdev, tps68470);
  604. + if (ret)
  605. + goto err_exit;
  606. + }
  607. + }
  608. +
  609. +err_exit:
  610. + if (ret) {
  611. + for (i = 0; i < TPS68470_NUM_LEDS; i++) {
  612. + if (tps68470->leds[i].lcdev.name)
  613. + devm_led_classdev_unregister(&pdev->dev,
  614. + &tps68470->leds[i].lcdev);
  615. + }
  616. + }
  617. +
  618. + return ret;
  619. +}
  620. +static struct platform_driver tps68470_led_driver = {
  621. + .driver = {
  622. + .name = "tps68470-led",
  623. + },
  624. + .probe = tps68470_leds_probe,
  625. +};
  626. +
  627. +module_platform_driver(tps68470_led_driver);
  628. +
  629. +MODULE_ALIAS("platform:tps68470-led");
  630. +MODULE_DESCRIPTION("LED driver for TPS68470 PMIC");
  631. +MODULE_LICENSE("GPL v2");
  632. --
  633. 2.45.2
  634. From 95b7370aee5aed2b2cad5baf8a6835b47fd2d8a5 Mon Sep 17 00:00:00 2001
  635. From: mojyack <mojyack@gmail.com>
  636. Date: Sat, 3 Feb 2024 12:59:53 +0900
  637. Subject: [PATCH] media: staging: ipu3-imgu: Fix multiple calls of s_stream on
  638. stream stop
  639. Adapt to 009905e "media: v4l2-subdev: Document and enforce .s_stream() requirements"
  640. Patchset: cameras
  641. ---
  642. drivers/staging/media/ipu3/ipu3-v4l2.c | 16 ++++++++--------
  643. 1 file changed, 8 insertions(+), 8 deletions(-)
  644. diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c
  645. index 3df58eb3e882..81aff2d5d898 100644
  646. --- a/drivers/staging/media/ipu3/ipu3-v4l2.c
  647. +++ b/drivers/staging/media/ipu3/ipu3-v4l2.c
  648. @@ -538,18 +538,18 @@ static void imgu_vb2_stop_streaming(struct vb2_queue *vq)
  649. WARN_ON(!node->enabled);
  650. - pipe = node->pipe;
  651. - dev_dbg(dev, "Try to stream off node [%u][%u]", pipe, node->id);
  652. - imgu_pipe = &imgu->imgu_pipe[pipe];
  653. - r = v4l2_subdev_call(&imgu_pipe->imgu_sd.subdev, video, s_stream, 0);
  654. - if (r)
  655. - dev_err(&imgu->pci_dev->dev,
  656. - "failed to stop subdev streaming\n");
  657. -
  658. mutex_lock(&imgu->streaming_lock);
  659. /* Was this the first node with streaming disabled? */
  660. if (imgu->streaming && imgu_all_nodes_streaming(imgu, node)) {
  661. /* Yes, really stop streaming now */
  662. + pipe = node->pipe;
  663. + dev_dbg(dev, "Try to stream off node [%u][%u]", pipe, node->id);
  664. + imgu_pipe = &imgu->imgu_pipe[pipe];
  665. + r = v4l2_subdev_call(&imgu_pipe->imgu_sd.subdev, video, s_stream, 0);
  666. + if (r)
  667. + dev_err(&imgu->pci_dev->dev,
  668. + "failed to stop subdev streaming\n");
  669. +
  670. dev_dbg(dev, "IMGU streaming is ready to stop");
  671. r = imgu_s_stream(imgu, false);
  672. if (!r)
  673. --
  674. 2.45.2
  675. From 7078234b232f3ebc7b79b14e385c70a3bfd31b4d Mon Sep 17 00:00:00 2001
  676. From: mojyack <mojyack@gmail.com>
  677. Date: Tue, 26 Mar 2024 05:55:44 +0900
  678. Subject: [PATCH] media: i2c: dw9719: fix probe error on surface go 2
  679. On surface go 2, sometimes probing dw9719 fails with "dw9719: probe of i2c-INT347A:00-VCM failed with error -121".
  680. The -121(-EREMOTEIO) is came from drivers/i2c/busses/i2c-designware-common.c:575, and indicates the initialize occurs too early.
  681. So just add some delay.
  682. There is no exact reason for this 10000us, but 100us failed.
  683. Patchset: cameras
  684. ---
  685. drivers/media/i2c/dw9719.c | 3 +++
  686. 1 file changed, 3 insertions(+)
  687. diff --git a/drivers/media/i2c/dw9719.c b/drivers/media/i2c/dw9719.c
  688. index c626ed845928..0094cfda57ea 100644
  689. --- a/drivers/media/i2c/dw9719.c
  690. +++ b/drivers/media/i2c/dw9719.c
  691. @@ -82,6 +82,9 @@ static int dw9719_power_up(struct dw9719_device *dw9719)
  692. if (ret)
  693. return ret;
  694. + /* Wait for device to be acknowledged */
  695. + fsleep(10000);
  696. +
  697. /* Jiggle SCL pin to wake up device */
  698. cci_write(dw9719->regmap, DW9719_CONTROL, 1, &ret);
  699. --
  700. 2.45.2