linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail
@ 2020-06-26 12:19 Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 01/15] media: atomisp: Replace last use of Intel MID APIs Andy Shevchenko
                   ` (15 more replies)
  0 siblings, 16 replies; 19+ messages in thread
From: Andy Shevchenko @ 2020-06-26 12:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Sakari Ailus; +Cc: Andy Shevchenko

I'm experimenting with it on Baytrail machine and found some issues.
Along with fixing them I cleaned up a bit this.

So, after applying I have the following log

# modprobe atomisp
[  116.215056] atomisp: module is from the staging directory, the quality is unknown, you have been warned.
[  116.310077] atomisp-isp2 0000:00:03.0: Detected Baytrail version 15 (ISP2400) on VALLEYVIEW C0 (CR) PLATFORM
[  116.354189] atomisp-isp2 0000:00:03.0: start: 0x50000000
[  116.376888] atomisp-isp2 0000:00:03.0: atomisp mmio base: 0000000027f9eb1f
[  116.401267] ACPI: \: failed to evaluate _DSM (0x1001)
[  116.423479] atomisp-isp2 0000:00:03.0: Failed to find EFI variable 0000:00:03.0_HpllFreq
[  116.449254] atomisp-isp2 0000:00:03.0: HpllFreq: using default (2000)
[  116.473045] atomisp-isp2 0000:00:03.0: ISP HPLL frequency base = 2000 MHz
[  116.770613] atomisp-isp2 0000:00:03.0: Probing Subdev INT33F8:00
[  116.793750] atomisp-isp2 0000:00:03.0: Subdev INT33F8:00 successfully register
[  116.818155] atomisp-isp2 0000:00:03.0: raw_index: -1
[  116.839924] atomisp-isp2 0000:00:03.0: SOC_INDEX: 0
[  116.861622] atomisp-isp2 0000:00:03.0: Probing Subdev INTCF1C:00
[  116.896885] lm3554 i2c-INTCF1C:00: Failed to power on lm3554 LED flash
[  116.920236] atomisp-isp2 0000:00:03.0: Subdev INTCF1C:00 detection fail
[  116.943649] atomisp-isp2 0000:00:03.0: detected 1 camera sensors
[  116.966177] atomisp-isp2 0000:00:03.0: atomisp_csi_lane_config: the portconfig is 2-1-0, CSI_CONTROL is 0x0002009C
[  117.009054] atomisp-isp2 0000:00:03.0: Entity type for entity ATOM ISP CSI2-port0 was not initialized!
[  117.050772] atomisp-isp2 0000:00:03.0: Entity type for entity ATOM ISP CSI2-port1 was not initialized!
[  117.050795] atomisp-isp2 0000:00:03.0: Entity type for entity ATOM ISP CSI2-port2 was not initialized!
[  117.134464] atomisp-isp2 0000:00:03.0: Entity type for entity file_input_subdev was not initialized!
[  117.176572] atomisp-isp2 0000:00:03.0: Entity type for entity tpg_subdev was not initialized!
[  117.202301] atomisp-isp2 0000:00:03.0: Entity type for entity ATOMISP_SUBDEV_0 was not initialized!
[  117.246734] atomisp-isp2 0000:00:03.0: Entity type for entity ATOMISP_SUBDEV_1 was not initialized!
[  117.290990] atomisp-isp2 0000:00:03.0: FILE_INPUT enable, camera_cnt: 1
[  117.314607] atomisp-isp2 0000:00:03.0: TPG detected, camera_cnt: 2
[  117.341386] atomisp-isp2 0000:00:03.0: atomisp_save_iunit_reg
[  117.363735] atomisp-isp2 0000:00:03.0: DFS target frequency=200.
[  117.386272] atomisp-isp2 0000:00:03.0: Programming DFS frequency to 200
[  117.409426] atomisp-isp2 0000:00:03.0: waiting for ISPSSPM1 valid bit to be 0.
[  117.433323] atomisp-isp2 0000:00:03.0: waiting for ISPSSPM1 valid bit to be 0.
[  117.457139] atomisp-isp2 0000:00:03.0: atomisp_ospm_dphy_down
[  117.479800] atomisp-isp2 0000:00:03.0: binary #0  type SP: sp
[  117.502001] atomisp-isp2 0000:00:03.0: binary #1  type ISP (Normal), binary id is  0: isp_copy_var
[  117.542907] atomisp-isp2 0000:00:03.0: binary #2  type ISP (Normal), binary id is  2: isp_vf_pp_full
[  117.584666] atomisp-isp2 0000:00:03.0: binary #3  type ISP (Normal), binary id is  3: isp_vf_pp_opt
[  117.626806] atomisp-isp2 0000:00:03.0: binary #4  type ISP (Normal), binary id is 60: isp_capture_pp_var_bli
[  117.670360] atomisp-isp2 0000:00:03.0: binary #5  type ISP (Normal), binary id is 61: isp_capture_pp_ldc
[  117.713655] atomisp-isp2 0000:00:03.0: binary #6  type ISP (Normal), binary id is  5: isp_capture_pp_var
[  117.757345] atomisp-isp2 0000:00:03.0: binary #7  type ISP (Normal), binary id is  4: isp_yuv_scale_var
[  117.801371] atomisp-isp2 0000:00:03.0: binary #8  type ISP (Normal), binary id is  6: isp_preisp_var
[  117.845621] atomisp-isp2 0000:00:03.0: binary #9  type ISP (Normal), binary id is  7: isp_preisp_var_isp2
[  117.890913] atomisp-isp2 0000:00:03.0: binary #10 type ISP (Normal), binary id is 58: isp_pre_de_var_isp2
[  117.936321] atomisp-isp2 0000:00:03.0: binary #11 type ISP (Normal), binary id is  8: isp_gdc_var
[  117.963840] atomisp-isp2 0000:00:03.0: binary #12 type ISP (Normal), binary id is 11: isp_anr_var
[  117.991190] atomisp-isp2 0000:00:03.0: binary #13 type ISP (Normal), binary id is 12: isp_anr_var_isp2
[  118.035988] atomisp-isp2 0000:00:03.0: binary #14 type ISP (Normal), binary id is  9: isp_postisp_var
[  118.081148] atomisp-isp2 0000:00:03.0: binary #15 type ISP (Normal), binary id is 10: isp_postisp_var_isp2
[  118.127374] atomisp-isp2 0000:00:03.0: binary #16 type ISP (Normal), binary id is 15: isp_preview_dec
[  118.173707] atomisp-isp2 0000:00:03.0: binary #17 type ISP (Normal), binary id is 16: isp_preview_cont_bds125_isp2
[  118.221920] atomisp-isp2 0000:00:03.0: binary #18 type ISP (Normal), binary id is 18: isp_preview_cont_bds150_isp2
[  118.270412] atomisp-isp2 0000:00:03.0: binary #19 type ISP (Normal), binary id is 20: isp_preview_cont_bds200_isp2
[  118.318942] atomisp-isp2 0000:00:03.0: binary #20 type ISP (Normal), binary id is 21: isp_preview_var
[  118.366572] atomisp-isp2 0000:00:03.0: binary #21 type ISP (Normal), binary id is 22: isp_preview_var_isp2
[  118.415086] atomisp-isp2 0000:00:03.0: binary #22 type ISP (Normal), binary id is 27: isp_primary_striped
[  118.464002] atomisp-isp2 0000:00:03.0: binary #23 type ISP (Normal), binary id is 28: isp_primary_striped_isp2
[  118.514097] atomisp-isp2 0000:00:03.0: binary #24 type ISP (Normal), binary id is 24: isp_primary_var
[  118.564053] atomisp-isp2 0000:00:03.0: binary #25 type ISP (Normal), binary id is 25: isp_primary_var_isp2
[  118.615276] atomisp-isp2 0000:00:03.0: binary #26 type ISP (Normal), binary id is 26: isp_primary_small
[  118.666737] atomisp-isp2 0000:00:03.0: binary #27 type ISP (Normal), binary id is 29: isp_primary_8mp
[  118.718346] atomisp-isp2 0000:00:03.0: binary #28 type ISP (Normal), binary id is 30: isp_primary_14mp
[  118.770053] atomisp-isp2 0000:00:03.0: binary #29 type ISP (Normal), binary id is 31: isp_primary_16mp
[  118.821763] atomisp-isp2 0000:00:03.0: binary #30 type ISP (Normal), binary id is 33: isp_primary_isp261_stage0
[  118.874370] atomisp-isp2 0000:00:03.0: binary #31 type ISP (Normal), binary id is 34: isp_primary_isp261_stage1
[  118.926992] atomisp-isp2 0000:00:03.0: binary #32 type ISP (Normal), binary id is 35: isp_primary_isp261_stage2
[  118.979792] atomisp-isp2 0000:00:03.0: binary #33 type ISP (Normal), binary id is 36: isp_primary_isp261_stage3
[  119.032714] atomisp-isp2 0000:00:03.0: binary #34 type ISP (Normal), binary id is 37: isp_primary_isp261_stage4
[  119.085749] atomisp-isp2 0000:00:03.0: binary #35 type ISP (Normal), binary id is 38: isp_primary_isp261_stage5
[  119.139422] atomisp-isp2 0000:00:03.0: binary #36 type ISP (Normal), binary id is 42: isp_video_dz
[  119.192607] atomisp-isp2 0000:00:03.0: binary #37 type ISP (Normal), binary id is 44: isp_video_high
[  119.246768] atomisp-isp2 0000:00:03.0: binary #38 type ISP (Normal), binary id is 45: isp_video_nodz
[  119.301793] atomisp-isp2 0000:00:03.0: binary #39 type ISP (Normal), binary id is 46: isp_video_cont_multibds_isp2_min
[  119.359159] atomisp-isp2 0000:00:03.0: binary #40 type ISP (Normal), binary id is 47: isp_video_cont_bds_300_600_isp2_min
[  119.416880] atomisp-isp2 0000:00:03.0: binary #41 type ISP (Normal), binary id is 49: isp_video_cont_bds150_isp2_min
[  119.474102] atomisp-isp2 0000:00:03.0: binary #42 type ISP (Normal), binary id is 51: isp_video_cont_bds200_isp2_min
[  119.531365] atomisp-isp2 0000:00:03.0: binary #43 type ISP (Normal), binary id is 52: isp_video_cont_nobds_isp2_min
[  119.588595] atomisp-isp2 0000:00:03.0: binary #44 type ISP (Normal), binary id is 53: isp_video_dz_isp2_min
[  119.644981] atomisp-isp2 0000:00:03.0: binary #45 type ISP (Normal), binary id is 54: isp_video_dz_isp2
[  119.701015] atomisp-isp2 0000:00:03.0: binary #46 type ISP (Normal), binary id is 55: isp_video_lp_isp2


Andy Shevchenko (15):
  media: atomisp: Replace last use of Intel MID APIs
  media: atomisp: move CCK endpoint address to generic header
  media: atomisp: Use proper APIs to find I²C client device by ACPI HID
  media: atomisp: don't pass struct device_driver as parameter
  media: atomisp: Get rid of struct pci_dev in struct atomisp_device
  media: atomisp: Unify pdev to be pointer to struct pci_device
  media: atomisp: Replace direct access to MMIO with proper helpers
  media: atomisp: Drop global atomisp_dev variable (easy cases)
  media: atomisp: make platform data more readable
  media: atomisp: Don't try to parse unexpected ACPI object type
  media: atomisp: Make pointer to PMIC client global
  media: atomisp: Refactor PMIC detection to a separate function.
  media: atomisp: Provide Gmin subdev as parameter to gmin_subdev_add()
  media: atomisp: Get rid of ugly and leaky ACPI handling in
    gmin_subdev_add()
  media: atomisp: Deduplicate return ret in gmin_i2c_write()

 arch/x86/include/asm/iosf_mbi.h               |   1 +
 .../atomisp/include/linux/atomisp_platform.h  |   1 +
 .../staging/media/atomisp/pci/atomisp-regs.h  |   3 -
 .../staging/media/atomisp/pci/atomisp_acc.c   |   4 +-
 .../staging/media/atomisp/pci/atomisp_cmd.c   |  57 ++--
 .../staging/media/atomisp/pci/atomisp_cmd.h   |   4 +-
 .../media/atomisp/pci/atomisp_compat.h        |   2 -
 .../media/atomisp/pci/atomisp_compat_css20.c  |  64 ++--
 .../media/atomisp/pci/atomisp_compat_css20.h  |   2 +-
 .../staging/media/atomisp/pci/atomisp_drvfs.c |  14 +-
 .../staging/media/atomisp/pci/atomisp_drvfs.h |   2 +-
 .../media/atomisp/pci/atomisp_gmin_platform.c | 220 +++++++-------
 .../media/atomisp/pci/atomisp_internal.h      |   2 +-
 .../staging/media/atomisp/pci/atomisp_ioctl.c |  19 +-
 .../staging/media/atomisp/pci/atomisp_v4l2.c  | 277 ++++++++----------
 15 files changed, 311 insertions(+), 361 deletions(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v2 01/15] media: atomisp: Replace last use of Intel MID APIs
  2020-06-26 12:19 [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Andy Shevchenko
@ 2020-06-26 12:19 ` Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 02/15] media: atomisp: move CCK endpoint address to generic header Andy Shevchenko
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2020-06-26 12:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Sakari Ailus; +Cc: Andy Shevchenko

Intel MID special header is not in use in this driver.
Replace it with a better macro for now on.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 .../staging/media/atomisp/include/linux/atomisp_platform.h   | 1 +
 drivers/staging/media/atomisp/pci/atomisp_compat_css20.c     | 5 +----
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h
index 873344a02ccf..5a5121d958ed 100644
--- a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h
+++ b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h
@@ -250,6 +250,7 @@ const struct atomisp_camera_caps *atomisp_get_default_camera_caps(void);
 #define IS_MFLD	__IS_SOC(INTEL_FAM6_ATOM_SALTWELL_MID)
 #define IS_BYT	__IS_SOC(INTEL_FAM6_ATOM_SILVERMONT)
 #define IS_CHT	__IS_SOC(INTEL_FAM6_ATOM_AIRMONT)
+#define IS_MRFD	__IS_SOC(INTEL_FAM6_ATOM_SILVERMONT_MID)
 #define IS_MOFD	__IS_SOC(INTEL_FAM6_ATOM_AIRMONT_MID)
 
 /* Both CHT and MOFD come with ISP2401 */
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
index c1e282a974d0..df352be06474 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
@@ -33,8 +33,6 @@
 #include "atomisp_ioctl.h"
 #include "atomisp_acc.h"
 
-#include <asm/intel-mid.h>
-
 #include "ia_css_debug.h"
 #include "ia_css_isp_param.h"
 #include "sh_css_hrt.h"
@@ -1966,8 +1964,7 @@ void atomisp_css_input_set_mode(struct atomisp_sub_device *asd,
 			true,
 			0x13000,
 			&size_mem_words) != 0) {
-			if (intel_mid_identify_cpu() ==
-			    INTEL_MID_CPU_CHIP_TANGIER)
+			if (IS_MRFD)
 				size_mem_words = CSS_MIPI_FRAME_BUFFER_SIZE_2;
 			else
 				size_mem_words = CSS_MIPI_FRAME_BUFFER_SIZE_1;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 02/15] media: atomisp: move CCK endpoint address to generic header
  2020-06-26 12:19 [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 01/15] media: atomisp: Replace last use of Intel MID APIs Andy Shevchenko
@ 2020-06-26 12:19 ` Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 03/15] media: atomisp: Use proper APIs to find I²C client device by ACPI HID Andy Shevchenko
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2020-06-26 12:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Sakari Ailus; +Cc: Andy Shevchenko

IOSF MBI header contains a lot of definitions, such as
end point addresses of IPs. Move CCK address from AtomISP driver
to generic header.

While here, drop unused one.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/x86/include/asm/iosf_mbi.h                  | 1 +
 drivers/staging/media/atomisp/pci/atomisp-regs.h | 3 ---
 drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/iosf_mbi.h b/arch/x86/include/asm/iosf_mbi.h
index 5270ff39b9af..a1911fea8739 100644
--- a/arch/x86/include/asm/iosf_mbi.h
+++ b/arch/x86/include/asm/iosf_mbi.h
@@ -39,6 +39,7 @@
 #define BT_MBI_UNIT_PMC		0x04
 #define BT_MBI_UNIT_GFX		0x06
 #define BT_MBI_UNIT_SMI		0x0C
+#define BT_MBI_UNIT_CCK		0x14
 #define BT_MBI_UNIT_USB		0x43
 #define BT_MBI_UNIT_SATA	0xA3
 #define BT_MBI_UNIT_PCIE	0xA6
diff --git a/drivers/staging/media/atomisp/pci/atomisp-regs.h b/drivers/staging/media/atomisp/pci/atomisp-regs.h
index de34ee28e390..022997f47121 100644
--- a/drivers/staging/media/atomisp/pci/atomisp-regs.h
+++ b/drivers/staging/media/atomisp/pci/atomisp-regs.h
@@ -20,9 +20,6 @@
 #define ATOMISP_REGS_H
 
 /* common register definitions */
-#define PUNIT_PORT		0x04
-#define CCK_PORT		0x14
-
 #define PCICMDSTS		0x01
 #define INTR			0x0f
 #define MSI_CAPID		0x24
diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
index d36809a0182c..fa07cbaf0422 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
@@ -1685,7 +1685,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 		isp->dfs = &dfs_config_cht;
 		isp->pdev->d3cold_delay = 0;
 
-		iosf_mbi_read(CCK_PORT, MBI_REG_READ, CCK_FUSE_REG_0, &val);
+		iosf_mbi_read(BT_MBI_UNIT_CCK, MBI_REG_READ, CCK_FUSE_REG_0, &val);
 		switch (val & CCK_FUSE_HPLL_FREQ_MASK) {
 		case 0x00:
 			isp->hpll_freq = HPLL_FREQ_800MHZ;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 03/15] media: atomisp: Use proper APIs to find I²C client device by ACPI HID
  2020-06-26 12:19 [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 01/15] media: atomisp: Replace last use of Intel MID APIs Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 02/15] media: atomisp: move CCK endpoint address to generic header Andy Shevchenko
@ 2020-06-26 12:19 ` Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 04/15] media: atomisp: don't pass struct device_driver as parameter Andy Shevchenko
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2020-06-26 12:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Sakari Ailus; +Cc: Andy Shevchenko

There are specific ACPI and I²C APIs to match device by different parameters,
such as ACPI HID, and retrieve an I²C client. Use them instead of home grown
approach. Note, it fixes a resource leak as well.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 .../media/atomisp/pci/atomisp_gmin_platform.c | 43 ++++++++-----------
 1 file changed, 18 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index 1af9da8acf4c..8acceae189a2 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -90,9 +90,9 @@ struct gmin_subdev {
 static struct gmin_subdev gmin_subdevs[MAX_SUBDEVS];
 
 /* ACPI HIDs for the PMICs that could be used by this driver */
-#define PMIC_ACPI_AXP		"INT33F4:00"	/* XPower AXP288 PMIC */
-#define PMIC_ACPI_TI		"INT33F5:00"	/* Dollar Cove TI PMIC */
-#define PMIC_ACPI_CRYSTALCOVE	"INT33FD:00"	/* Crystal Cove PMIC */
+#define PMIC_ACPI_AXP		"INT33F4"	/* XPower AXP288 PMIC */
+#define PMIC_ACPI_TI		"INT33F5"	/* Dollar Cove TI PMIC */
+#define PMIC_ACPI_CRYSTALCOVE	"INT33FD"	/* Crystal Cove PMIC */
 
 #define PMIC_PLATFORM_TI	"intel_soc_pmic_chtdc_ti"
 
@@ -381,34 +381,27 @@ static const guid_t atomisp_dsm_guid = GUID_INIT(0xdc2f6c4f, 0x045b, 0x4f1d,
 #define GMIN_PMC_CLK_NAME 14 /* "pmc_plt_clk_[0..5]" */
 static char gmin_pmc_clk_name[GMIN_PMC_CLK_NAME];
 
-static int gmin_i2c_match_one(struct device *dev, const void *data)
-{
-	const char *name = data;
-	struct i2c_client *client;
-
-	if (dev->type != &i2c_client_type)
-		return 0;
-
-	client = to_i2c_client(dev);
-
-	return (!strcmp(name, client->name));
-}
-
 static struct i2c_client *gmin_i2c_dev_exists(struct device *dev, char *name,
 					      struct i2c_client **client)
 {
+	struct acpi_device *adev;
 	struct device *d;
 
-	while ((d = bus_find_device(&i2c_bus_type, NULL, name,
-				    gmin_i2c_match_one))) {
-		*client = to_i2c_client(d);
-		dev_dbg(dev, "found '%s' at address 0x%02x, adapter %d\n",
-			(*client)->name, (*client)->addr,
-			(*client)->adapter->nr);
-		return *client;
-	}
+	adev = acpi_dev_get_first_match_dev(name, NULL, -1);
+	if (!adev)
+		return NULL;
 
-	return NULL;
+	d = bus_find_device_by_acpi_dev(&i2c_bus_type, adev);
+	acpi_dev_put(adev);
+	if (!d)
+		return NULL;
+
+	*client = i2c_verify_client(d);
+	put_device(d);
+
+	dev_dbg(dev, "found '%s' at address 0x%02x, adapter %d\n",
+		(*client)->name, (*client)->addr, (*client)->adapter->nr);
+	return *client;
 }
 
 static int gmin_i2c_write(struct device *dev, u16 i2c_addr, u8 reg,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 04/15] media: atomisp: don't pass struct device_driver as parameter
  2020-06-26 12:19 [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Andy Shevchenko
                   ` (2 preceding siblings ...)
  2020-06-26 12:19 ` [PATCH v2 03/15] media: atomisp: Use proper APIs to find I²C client device by ACPI HID Andy Shevchenko
@ 2020-06-26 12:19 ` Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 05/15] media: atomisp: Get rid of struct pci_dev in struct atomisp_device Andy Shevchenko
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2020-06-26 12:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Sakari Ailus; +Cc: Andy Shevchenko

There is no need to pass a pointer to struct device_driver
when we have an access to struct device already.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/staging/media/atomisp/pci/atomisp_drvfs.c | 3 ++-
 drivers/staging/media/atomisp/pci/atomisp_drvfs.h | 2 +-
 drivers/staging/media/atomisp/pci/atomisp_v4l2.c  | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_drvfs.c b/drivers/staging/media/atomisp/pci/atomisp_drvfs.c
index fe0e2bfde27f..3711df111fbf 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_drvfs.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_drvfs.c
@@ -185,8 +185,9 @@ static void iunit_drvfs_remove_files(struct device_driver *drv)
 		driver_remove_file(drv, &iunit_drvfs_attrs[i]);
 }
 
-int atomisp_drvfs_init(struct device_driver *drv, struct atomisp_device *isp)
+int atomisp_drvfs_init(struct atomisp_device *isp)
 {
+	struct device_driver *drv = isp->dev->driver;
 	int ret;
 
 	iunit_debug.isp = isp;
diff --git a/drivers/staging/media/atomisp/pci/atomisp_drvfs.h b/drivers/staging/media/atomisp/pci/atomisp_drvfs.h
index 4911037231fb..8f4cc722b881 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_drvfs.h
+++ b/drivers/staging/media/atomisp/pci/atomisp_drvfs.h
@@ -19,7 +19,7 @@
 #ifndef	__ATOMISP_DRVFS_H__
 #define	__ATOMISP_DRVFS_H__
 
-int atomisp_drvfs_init(struct device_driver *drv, struct atomisp_device *isp);
+int atomisp_drvfs_init(struct atomisp_device *isp);
 void atomisp_drvfs_exit(void);
 
 #endif /* __ATOMISP_DRVFS_H__ */
diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
index fa07cbaf0422..c6996b1f228b 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
@@ -1838,7 +1838,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 	isp->firmware = NULL;
 	isp->css_env.isp_css_fw.data = NULL;
 
-	atomisp_drvfs_init(&dev->driver->driver, isp);
+	atomisp_drvfs_init(isp);
 
 	return 0;
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 05/15] media: atomisp: Get rid of struct pci_dev in struct atomisp_device
  2020-06-26 12:19 [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Andy Shevchenko
                   ` (3 preceding siblings ...)
  2020-06-26 12:19 ` [PATCH v2 04/15] media: atomisp: don't pass struct device_driver as parameter Andy Shevchenko
@ 2020-06-26 12:19 ` Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 06/15] media: atomisp: Unify pdev to be pointer to struct pci_device Andy Shevchenko
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2020-06-26 12:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Sakari Ailus; +Cc: Andy Shevchenko

struct atomisp device has struct device and struct pci_dev pointers
which are basically duplicates of each other. Drop the latter
in favour of the former.

While here, unify pdev to be pointer to struct pci_device and reindent
some (touched) lines for better readability.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 .../staging/media/atomisp/pci/atomisp_cmd.c   | 24 +++++++++-----
 .../staging/media/atomisp/pci/atomisp_cmd.h   |  4 +--
 .../media/atomisp/pci/atomisp_internal.h      |  1 -
 .../staging/media/atomisp/pci/atomisp_ioctl.c | 19 +++++------
 .../staging/media/atomisp/pci/atomisp_v4l2.c  | 33 ++++++++++---------
 5 files changed, 43 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
index 7b936e5a5f03..0735df75841f 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
@@ -206,6 +206,7 @@ int atomisp_freq_scaling(struct atomisp_device *isp,
 			 enum atomisp_dfs_mode mode,
 			 bool force)
 {
+	struct pci_dev *pdev = to_pci_dev(isp->dev);
 	/* FIXME! Only use subdev[0] status yet */
 	struct atomisp_sub_device *asd = &isp->asd[0];
 	const struct atomisp_dfs_config *dfs;
@@ -219,7 +220,7 @@ int atomisp_freq_scaling(struct atomisp_device *isp,
 		return -EINVAL;
 	}
 
-	if ((isp->pdev->device & ATOMISP_PCI_DEVICE_SOC_MASK) ==
+	if ((pdev->device & ATOMISP_PCI_DEVICE_SOC_MASK) ==
 	    ATOMISP_PCI_DEVICE_SOC_CHT && ATOMISP_USE_YUVPP(asd))
 		isp->dfs = &dfs_config_cht_soc;
 
@@ -357,8 +358,9 @@ static void clear_isp_irq(enum hrt_isp_css_irq irq)
 	irq_clear_all(IRQ0_ID);
 }
 
-void atomisp_msi_irq_init(struct atomisp_device *isp, struct pci_dev *dev)
+void atomisp_msi_irq_init(struct atomisp_device *isp)
 {
+	struct pci_dev *dev = to_pci_dev(isp->dev);
 	u32 msg32;
 	u16 msg16;
 
@@ -375,8 +377,9 @@ void atomisp_msi_irq_init(struct atomisp_device *isp, struct pci_dev *dev)
 	pci_write_config_word(dev, PCI_COMMAND, msg16);
 }
 
-void atomisp_msi_irq_uninit(struct atomisp_device *isp, struct pci_dev *dev)
+void atomisp_msi_irq_uninit(struct atomisp_device *isp)
 {
+	struct pci_dev *dev = to_pci_dev(isp->dev);
 	u32 msg32;
 	u16 msg16;
 
@@ -480,11 +483,12 @@ static void print_csi_rx_errors(enum mipi_port_id port,
 /* Clear irq reg */
 static void clear_irq_reg(struct atomisp_device *isp)
 {
+	struct pci_dev *pdev = to_pci_dev(isp->dev);
 	u32 msg_ret;
 
-	pci_read_config_dword(isp->pdev, PCI_INTERRUPT_CTRL, &msg_ret);
+	pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &msg_ret);
 	msg_ret |= 1 << INTR_IIR;
-	pci_write_config_dword(isp->pdev, PCI_INTERRUPT_CTRL, msg_ret);
+	pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, msg_ret);
 }
 
 static struct atomisp_sub_device *
@@ -1289,6 +1293,7 @@ void atomisp_delayed_init_work(struct work_struct *work)
 
 static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout)
 {
+	struct pci_dev *pdev = to_pci_dev(isp->dev);
 	enum ia_css_pipe_id css_pipe_id;
 	bool stream_restart[MAX_STREAM_NUM] = {0};
 	bool depth_mode = false;
@@ -1372,8 +1377,8 @@ static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout)
 	clear_isp_irq(hrt_isp_css_irq_sp);
 
 	/* Set the SRSE to 3 before resetting */
-	pci_write_config_dword(isp->pdev, PCI_I_CONTROL, isp->saved_regs.i_control |
-			       MRFLD_PCI_I_CONTROL_SRSE_RESET_MASK);
+	pci_write_config_dword(pdev, PCI_I_CONTROL,
+			       isp->saved_regs.i_control | MRFLD_PCI_I_CONTROL_SRSE_RESET_MASK);
 
 	/* reset ISP and restore its state */
 	isp->isp_timeout = true;
@@ -6158,6 +6163,7 @@ int atomisp_set_shading_table(struct atomisp_sub_device *asd,
 /*Turn off ISP dphy */
 int atomisp_ospm_dphy_down(struct atomisp_device *isp)
 {
+	struct pci_dev *pdev = to_pci_dev(isp->dev);
 	unsigned long flags;
 	u32 reg;
 
@@ -6179,9 +6185,9 @@ int atomisp_ospm_dphy_down(struct atomisp_device *isp)
 	 * MRFLD HW design need all CSI ports are disabled before
 	 * powering down the IUNIT.
 	 */
-	pci_read_config_dword(isp->pdev, MRFLD_PCI_CSI_CONTROL, &reg);
+	pci_read_config_dword(pdev, MRFLD_PCI_CSI_CONTROL, &reg);
 	reg |= MRFLD_ALL_CSI_PORTS_OFF_MASK;
-	pci_write_config_dword(isp->pdev, MRFLD_PCI_CSI_CONTROL, reg);
+	pci_write_config_dword(pdev, MRFLD_PCI_CSI_CONTROL, reg);
 	return 0;
 }
 
diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.h b/drivers/staging/media/atomisp/pci/atomisp_cmd.h
index 0bde995f1a8d..1c0d464c2ac1 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_cmd.h
+++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.h
@@ -68,8 +68,8 @@ bool atomisp_buffers_queued_pipe(struct atomisp_video_pipe *pipe);
 /*
  * Interrupt functions
  */
-void atomisp_msi_irq_init(struct atomisp_device *isp, struct pci_dev *dev);
-void atomisp_msi_irq_uninit(struct atomisp_device *isp, struct pci_dev *dev);
+void atomisp_msi_irq_init(struct atomisp_device *isp);
+void atomisp_msi_irq_uninit(struct atomisp_device *isp);
 void atomisp_wdt_work(struct work_struct *work);
 void atomisp_wdt(struct timer_list *t);
 void atomisp_setup_flash(struct atomisp_sub_device *asd);
diff --git a/drivers/staging/media/atomisp/pci/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp_internal.h
index ff3becd41110..5af9bbce6284 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_internal.h
+++ b/drivers/staging/media/atomisp/pci/atomisp_internal.h
@@ -216,7 +216,6 @@ struct atomisp_sw_contex {
  * ci device struct
  */
 struct atomisp_device {
-	struct pci_dev *pdev;
 	struct device *dev;
 	struct v4l2_device v4l2_dev;
 	struct media_device media_dev;
diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
index 9404a678fa6f..f8d616f08b51 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
@@ -549,8 +549,7 @@ static int atomisp_querycap(struct file *file, void *fh,
 
 	strscpy(cap->driver, DRIVER, sizeof(cap->driver));
 	strscpy(cap->card, CARD, sizeof(cap->card));
-	snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s",
-		 pci_name(isp->pdev));
+	snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", dev_name(isp->dev));
 
 	return 0;
 }
@@ -1635,6 +1634,7 @@ static int atomisp_streamon(struct file *file, void *fh,
 	struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev);
 	struct atomisp_sub_device *asd = pipe->asd;
 	struct atomisp_device *isp = video_get_drvdata(vdev);
+	struct pci_dev *pdev = to_pci_dev(isp->dev);
 	enum ia_css_pipe_id css_pipe_id;
 	unsigned int sensor_start_stream;
 	unsigned int wdt_duration = ATOMISP_ISP_TIMEOUT_DURATION;
@@ -1844,9 +1844,8 @@ static int atomisp_streamon(struct file *file, void *fh,
 	/* Enable the CSI interface on ANN B0/K0 */
 	if (isp->media_dev.hw_revision >= ((ATOMISP_HW_REVISION_ISP2401 <<
 					    ATOMISP_HW_REVISION_SHIFT) | ATOMISP_HW_STEPPING_B0)) {
-		pci_write_config_word(isp->pdev, MRFLD_PCI_CSI_CONTROL,
-				      isp->saved_regs.csi_control |
-				      MRFLD_PCI_CSI_CONTROL_CSI_READY);
+		pci_write_config_word(pdev, MRFLD_PCI_CSI_CONTROL,
+				      isp->saved_regs.csi_control | MRFLD_PCI_CSI_CONTROL_CSI_READY);
 	}
 
 	/* stream on the sensor */
@@ -1891,6 +1890,7 @@ int __atomisp_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
 {
 	struct video_device *vdev = video_devdata(file);
 	struct atomisp_device *isp = video_get_drvdata(vdev);
+	struct pci_dev *pdev = to_pci_dev(isp->dev);
 	struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev);
 	struct atomisp_sub_device *asd = pipe->asd;
 	struct atomisp_video_pipe *capture_pipe = NULL;
@@ -2076,9 +2076,8 @@ int __atomisp_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
 	/* Disable the CSI interface on ANN B0/K0 */
 	if (isp->media_dev.hw_revision >= ((ATOMISP_HW_REVISION_ISP2401 <<
 					    ATOMISP_HW_REVISION_SHIFT) | ATOMISP_HW_STEPPING_B0)) {
-		pci_write_config_word(isp->pdev, MRFLD_PCI_CSI_CONTROL,
-				      isp->saved_regs.csi_control &
-				      ~MRFLD_PCI_CSI_CONTROL_CSI_READY);
+		pci_write_config_word(pdev, MRFLD_PCI_CSI_CONTROL,
+				      isp->saved_regs.csi_control & ~MRFLD_PCI_CSI_CONTROL_CSI_READY);
 	}
 
 	if (atomisp_freq_scaling(isp, ATOMISP_DFS_MODE_LOW, false))
@@ -2111,8 +2110,8 @@ int __atomisp_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
 		}
 
 		/* disable  PUNIT/ISP acknowlede/handshake - SRSE=3 */
-		pci_write_config_dword(isp->pdev, PCI_I_CONTROL, isp->saved_regs.i_control |
-				       MRFLD_PCI_I_CONTROL_SRSE_RESET_MASK);
+		pci_write_config_dword(pdev, PCI_I_CONTROL,
+				       isp->saved_regs.i_control | MRFLD_PCI_I_CONTROL_SRSE_RESET_MASK);
 		dev_err(isp->dev, "atomisp_reset");
 		atomisp_reset(isp);
 		for (i = 0; i < isp->num_of_streams; i++) {
diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
index c6996b1f228b..3ae9058b32ec 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
@@ -512,7 +512,7 @@ void atomisp_acc_unregister(struct atomisp_acc_pipe *video)
 
 static int atomisp_save_iunit_reg(struct atomisp_device *isp)
 {
-	struct pci_dev *dev = isp->pdev;
+	struct pci_dev *dev = to_pci_dev(isp->dev);
 
 	dev_dbg(isp->dev, "%s\n", __func__);
 
@@ -573,7 +573,7 @@ static int atomisp_save_iunit_reg(struct atomisp_device *isp)
 
 static int __maybe_unused atomisp_restore_iunit_reg(struct atomisp_device *isp)
 {
-	struct pci_dev *dev = isp->pdev;
+	struct pci_dev *dev = to_pci_dev(isp->dev);
 
 	dev_dbg(isp->dev, "%s\n", __func__);
 
@@ -619,7 +619,7 @@ static int __maybe_unused atomisp_restore_iunit_reg(struct atomisp_device *isp)
 
 static int atomisp_mrfld_pre_power_down(struct atomisp_device *isp)
 {
-	struct pci_dev *dev = isp->pdev;
+	struct pci_dev *dev = to_pci_dev(isp->dev);
 	u32 irq;
 	unsigned long flags;
 
@@ -679,7 +679,7 @@ static int atomisp_mrfld_pre_power_down(struct atomisp_device *isp)
 	irq &= ~(1 << INTR_IER);
 	pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, irq);
 
-	atomisp_msi_irq_uninit(isp, dev);
+	atomisp_msi_irq_uninit(isp);
 	atomisp_freq_scaling(isp, ATOMISP_DFS_MODE_LOW, true);
 	spin_unlock_irqrestore(&isp->lock, flags);
 
@@ -902,6 +902,7 @@ static int __maybe_unused atomisp_resume(struct device *dev)
 
 int atomisp_csi_lane_config(struct atomisp_device *isp)
 {
+	struct pci_dev *pdev = to_pci_dev(isp->dev);
 	static const struct {
 		u8 code;
 		u8 lanes[MRFLD_PORT_NUM];
@@ -1003,7 +1004,7 @@ int atomisp_csi_lane_config(struct atomisp_device *isp)
 		return -EINVAL;
 	}
 
-	pci_read_config_dword(isp->pdev, MRFLD_PCI_CSI_CONTROL, &csi_control);
+	pci_read_config_dword(pdev, MRFLD_PCI_CSI_CONTROL, &csi_control);
 	csi_control &= ~port_config_mask;
 	csi_control |= (portconfigs[i].code << MRFLD_PORT_CONFIGCODE_SHIFT)
 		       | (portconfigs[i].lanes[0] ? 0 : (1 << MRFLD_PORT1_ENABLE_SHIFT))
@@ -1013,7 +1014,7 @@ int atomisp_csi_lane_config(struct atomisp_device *isp)
 		       | (((1 << portconfigs[i].lanes[1]) - 1) << MRFLD_PORT2_LANES_SHIFT)
 		       | (((1 << portconfigs[i].lanes[2]) - 1) << port3_lanes_shift);
 
-	pci_write_config_dword(isp->pdev, MRFLD_PCI_CSI_CONTROL, csi_control);
+	pci_write_config_dword(pdev, MRFLD_PCI_CSI_CONTROL, csi_control);
 
 	dev_dbg(isp->dev,
 		"%s: the portconfig is %d-%d-%d, CSI_CONTROL is 0x%08X\n",
@@ -1587,7 +1588,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 		err = -ENOMEM;
 		goto atomisp_dev_alloc_fail;
 	}
-	isp->pdev = dev;
+
 	isp->dev = &dev->dev;
 	isp->sw_contex.power_state = ATOM_ISP_POWER_UP;
 	isp->saved_regs.ispmmadr = start;
@@ -1597,7 +1598,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 	spin_lock_init(&isp->lock);
 
 	/* This is not a true PCI device on SoC, so the delay is not needed. */
-	isp->pdev->d3_delay = 0;
+	dev->d3_delay = 0;
 
 	switch (id->device & ATOMISP_PCI_DEVICE_SOC_MASK) {
 	case ATOMISP_PCI_DEVICE_SOC_MRFLD:
@@ -1656,7 +1657,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 		 * in power off. Set d3cold_delay to 0 since default 100ms is not
 		 * necessary.
 		 */
-		isp->pdev->d3cold_delay = 0;
+		dev->d3cold_delay = 0;
 		break;
 	case ATOMISP_PCI_DEVICE_SOC_ANN:
 		isp->media_dev.hw_revision = (
@@ -1666,7 +1667,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 						 ATOMISP_HW_REVISION_ISP2401_LEGACY
 #endif
 						 << ATOMISP_HW_REVISION_SHIFT);
-		isp->media_dev.hw_revision |= isp->pdev->revision < 2 ?
+		isp->media_dev.hw_revision |= dev->revision < 2 ?
 					      ATOMISP_HW_STEPPING_A0 : ATOMISP_HW_STEPPING_B0;
 		isp->dfs = &dfs_config_merr;
 		isp->hpll_freq = HPLL_FREQ_1600MHZ;
@@ -1679,11 +1680,11 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 						 ATOMISP_HW_REVISION_ISP2401_LEGACY
 #endif
 						 << ATOMISP_HW_REVISION_SHIFT);
-		isp->media_dev.hw_revision |= isp->pdev->revision < 2 ?
+		isp->media_dev.hw_revision |= dev->revision < 2 ?
 					      ATOMISP_HW_STEPPING_A0 : ATOMISP_HW_STEPPING_B0;
 
 		isp->dfs = &dfs_config_cht;
-		isp->pdev->d3cold_delay = 0;
+		dev->d3cold_delay = 0;
 
 		iosf_mbi_read(BT_MBI_UNIT_CCK, MBI_REG_READ, CCK_FUSE_REG_0, &val);
 		switch (val & CCK_FUSE_HPLL_FREQ_MASK) {
@@ -1741,7 +1742,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 		goto enable_msi_fail;
 	}
 
-	atomisp_msi_irq_init(isp, dev);
+	atomisp_msi_irq_init(isp);
 
 	cpu_latency_qos_add_request(&isp->pm_qos, PM_QOS_DEFAULT_VALUE);
 
@@ -1856,7 +1857,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 	atomisp_uninitialize_modules(isp);
 initialize_modules_fail:
 	cpu_latency_qos_remove_request(&isp->pm_qos);
-	atomisp_msi_irq_uninit(isp, dev);
+	atomisp_msi_irq_uninit(isp);
 	pci_disable_msi(dev);
 enable_msi_fail:
 fw_validation_fail:
@@ -1877,7 +1878,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 	irq &= ~(1 << INTR_IER);
 	pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, irq);
 
-	atomisp_msi_irq_uninit(isp, dev);
+	atomisp_msi_irq_uninit(isp);
 
 	atomisp_ospm_dphy_down(isp);
 
@@ -1910,7 +1911,7 @@ static void atomisp_pci_remove(struct pci_dev *dev)
 	pm_runtime_get_noresume(&dev->dev);
 	cpu_latency_qos_remove_request(&isp->pm_qos);
 
-	atomisp_msi_irq_uninit(isp, dev);
+	atomisp_msi_irq_uninit(isp);
 	atomisp_unregister_entities(isp);
 
 	destroy_workqueue(isp->wdt_work_queue);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 06/15] media: atomisp: Unify pdev to be pointer to struct pci_device
  2020-06-26 12:19 [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Andy Shevchenko
                   ` (4 preceding siblings ...)
  2020-06-26 12:19 ` [PATCH v2 05/15] media: atomisp: Get rid of struct pci_dev in struct atomisp_device Andy Shevchenko
@ 2020-06-26 12:19 ` Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 07/15] media: atomisp: Replace direct access to MMIO with proper helpers Andy Shevchenko
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2020-06-26 12:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Sakari Ailus; +Cc: Andy Shevchenko

Unify pdev to be pointer to struct pci_device.

While here, reindent some (touched) lines for better readability.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 .../staging/media/atomisp/pci/atomisp_cmd.c   |  24 +-
 .../media/atomisp/pci/atomisp_gmin_platform.c |   6 +-
 .../staging/media/atomisp/pci/atomisp_v4l2.c  | 248 ++++++++----------
 3 files changed, 127 insertions(+), 151 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
index 0735df75841f..db3c3542457c 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
@@ -360,39 +360,39 @@ static void clear_isp_irq(enum hrt_isp_css_irq irq)
 
 void atomisp_msi_irq_init(struct atomisp_device *isp)
 {
-	struct pci_dev *dev = to_pci_dev(isp->dev);
+	struct pci_dev *pdev = to_pci_dev(isp->dev);
 	u32 msg32;
 	u16 msg16;
 
-	pci_read_config_dword(dev, PCI_MSI_CAPID, &msg32);
+	pci_read_config_dword(pdev, PCI_MSI_CAPID, &msg32);
 	msg32 |= 1 << MSI_ENABLE_BIT;
-	pci_write_config_dword(dev, PCI_MSI_CAPID, msg32);
+	pci_write_config_dword(pdev, PCI_MSI_CAPID, msg32);
 
 	msg32 = (1 << INTR_IER) | (1 << INTR_IIR);
-	pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, msg32);
+	pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, msg32);
 
-	pci_read_config_word(dev, PCI_COMMAND, &msg16);
+	pci_read_config_word(pdev, PCI_COMMAND, &msg16);
 	msg16 |= (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
 		  PCI_COMMAND_INTX_DISABLE);
-	pci_write_config_word(dev, PCI_COMMAND, msg16);
+	pci_write_config_word(pdev, PCI_COMMAND, msg16);
 }
 
 void atomisp_msi_irq_uninit(struct atomisp_device *isp)
 {
-	struct pci_dev *dev = to_pci_dev(isp->dev);
+	struct pci_dev *pdev = to_pci_dev(isp->dev);
 	u32 msg32;
 	u16 msg16;
 
-	pci_read_config_dword(dev, PCI_MSI_CAPID, &msg32);
+	pci_read_config_dword(pdev, PCI_MSI_CAPID, &msg32);
 	msg32 &=  ~(1 << MSI_ENABLE_BIT);
-	pci_write_config_dword(dev, PCI_MSI_CAPID, msg32);
+	pci_write_config_dword(pdev, PCI_MSI_CAPID, msg32);
 
 	msg32 = 0x0;
-	pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, msg32);
+	pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, msg32);
 
-	pci_read_config_word(dev, PCI_COMMAND, &msg16);
+	pci_read_config_word(pdev, PCI_COMMAND, &msg16);
 	msg16 &= ~(PCI_COMMAND_MASTER);
-	pci_write_config_word(dev, PCI_COMMAND, msg16);
+	pci_write_config_word(pdev, PCI_COMMAND, msg16);
 }
 
 static void atomisp_sof_event(struct atomisp_sub_device *asd)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index 8acceae189a2..79cbde65d3c1 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -1148,10 +1148,10 @@ EXPORT_SYMBOL_GPL(camera_sensor_csi);
  * trying.  The driver itself does direct calls to the PUNIT to manage
  * ISP power.
  */
-static void isp_pm_cap_fixup(struct pci_dev *dev)
+static void isp_pm_cap_fixup(struct pci_dev *pdev)
 {
-	dev_info(&dev->dev, "Disabling PCI power management on camera ISP\n");
-	dev->pm_cap = 0;
+	dev_info(&pdev->dev, "Disabling PCI power management on camera ISP\n");
+	pdev->pm_cap = 0;
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0f38, isp_pm_cap_fixup);
 
diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
index 3ae9058b32ec..731a683e82f1 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
@@ -512,30 +512,27 @@ void atomisp_acc_unregister(struct atomisp_acc_pipe *video)
 
 static int atomisp_save_iunit_reg(struct atomisp_device *isp)
 {
-	struct pci_dev *dev = to_pci_dev(isp->dev);
+	struct pci_dev *pdev = to_pci_dev(isp->dev);
 
 	dev_dbg(isp->dev, "%s\n", __func__);
 
-	pci_read_config_word(dev, PCI_COMMAND, &isp->saved_regs.pcicmdsts);
+	pci_read_config_word(pdev, PCI_COMMAND, &isp->saved_regs.pcicmdsts);
 	/* isp->saved_regs.ispmmadr is set from the atomisp_pci_probe() */
-	pci_read_config_dword(dev, PCI_MSI_CAPID, &isp->saved_regs.msicap);
-	pci_read_config_dword(dev, PCI_MSI_ADDR, &isp->saved_regs.msi_addr);
-	pci_read_config_word(dev, PCI_MSI_DATA,  &isp->saved_regs.msi_data);
-	pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &isp->saved_regs.intr);
-	pci_read_config_dword(dev, PCI_INTERRUPT_CTRL,
-			      &isp->saved_regs.interrupt_control);
-
-	pci_read_config_dword(dev, MRFLD_PCI_PMCS,
-			      &isp->saved_regs.pmcs);
+	pci_read_config_dword(pdev, PCI_MSI_CAPID, &isp->saved_regs.msicap);
+	pci_read_config_dword(pdev, PCI_MSI_ADDR, &isp->saved_regs.msi_addr);
+	pci_read_config_word(pdev, PCI_MSI_DATA,  &isp->saved_regs.msi_data);
+	pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &isp->saved_regs.intr);
+	pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &isp->saved_regs.interrupt_control);
+
+	pci_read_config_dword(pdev, MRFLD_PCI_PMCS, &isp->saved_regs.pmcs);
 	/* Ensure read/write combining is enabled. */
-	pci_read_config_dword(dev, PCI_I_CONTROL,
-			      &isp->saved_regs.i_control);
+	pci_read_config_dword(pdev, PCI_I_CONTROL, &isp->saved_regs.i_control);
 	isp->saved_regs.i_control |=
 	    MRFLD_PCI_I_CONTROL_ENABLE_READ_COMBINING |
 	    MRFLD_PCI_I_CONTROL_ENABLE_WRITE_COMBINING;
-	pci_read_config_dword(dev, MRFLD_PCI_CSI_ACCESS_CTRL_VIOL,
+	pci_read_config_dword(pdev, MRFLD_PCI_CSI_ACCESS_CTRL_VIOL,
 			      &isp->saved_regs.csi_access_viol);
-	pci_read_config_dword(dev, MRFLD_PCI_CSI_RCOMP_CONTROL,
+	pci_read_config_dword(pdev, MRFLD_PCI_CSI_RCOMP_CONTROL,
 			      &isp->saved_regs.csi_rcomp_config);
 	/*
 	 * Hardware bugs require setting CSI_HS_OVR_CLK_GATE_ON_UPDATE.
@@ -545,65 +542,58 @@ static int atomisp_save_iunit_reg(struct atomisp_device *isp)
 	 * is missed, and IUNIT can hang.
 	 * For both issues, setting this bit is a workaround.
 	 */
-	isp->saved_regs.csi_rcomp_config |=
-	    MRFLD_PCI_CSI_HS_OVR_CLK_GATE_ON_UPDATE;
-	pci_read_config_dword(dev, MRFLD_PCI_CSI_AFE_TRIM_CONTROL,
+	isp->saved_regs.csi_rcomp_config |= MRFLD_PCI_CSI_HS_OVR_CLK_GATE_ON_UPDATE;
+	pci_read_config_dword(pdev, MRFLD_PCI_CSI_AFE_TRIM_CONTROL,
 			      &isp->saved_regs.csi_afe_dly);
-	pci_read_config_dword(dev, MRFLD_PCI_CSI_CONTROL,
+	pci_read_config_dword(pdev, MRFLD_PCI_CSI_CONTROL,
 			      &isp->saved_regs.csi_control);
 	if (isp->media_dev.hw_revision >=
 	    (ATOMISP_HW_REVISION_ISP2401 << ATOMISP_HW_REVISION_SHIFT))
-		isp->saved_regs.csi_control |=
-		    MRFLD_PCI_CSI_CONTROL_PARPATHEN;
+		isp->saved_regs.csi_control |= MRFLD_PCI_CSI_CONTROL_PARPATHEN;
 	/*
 	 * On CHT CSI_READY bit should be enabled before stream on
 	 */
 	if (IS_CHT && (isp->media_dev.hw_revision >= ((ATOMISP_HW_REVISION_ISP2401 <<
 		       ATOMISP_HW_REVISION_SHIFT) | ATOMISP_HW_STEPPING_B0)))
-		isp->saved_regs.csi_control |=
-		    MRFLD_PCI_CSI_CONTROL_CSI_READY;
-	pci_read_config_dword(dev, MRFLD_PCI_CSI_AFE_RCOMP_CONTROL,
+		isp->saved_regs.csi_control |= MRFLD_PCI_CSI_CONTROL_CSI_READY;
+	pci_read_config_dword(pdev, MRFLD_PCI_CSI_AFE_RCOMP_CONTROL,
 			      &isp->saved_regs.csi_afe_rcomp_config);
-	pci_read_config_dword(dev, MRFLD_PCI_CSI_AFE_HS_CONTROL,
+	pci_read_config_dword(pdev, MRFLD_PCI_CSI_AFE_HS_CONTROL,
 			      &isp->saved_regs.csi_afe_hs_control);
-	pci_read_config_dword(dev, MRFLD_PCI_CSI_DEADLINE_CONTROL,
+	pci_read_config_dword(pdev, MRFLD_PCI_CSI_DEADLINE_CONTROL,
 			      &isp->saved_regs.csi_deadline_control);
 	return 0;
 }
 
 static int __maybe_unused atomisp_restore_iunit_reg(struct atomisp_device *isp)
 {
-	struct pci_dev *dev = to_pci_dev(isp->dev);
+	struct pci_dev *pdev = to_pci_dev(isp->dev);
 
 	dev_dbg(isp->dev, "%s\n", __func__);
 
-	pci_write_config_word(dev, PCI_COMMAND, isp->saved_regs.pcicmdsts);
-	pci_write_config_dword(dev, PCI_BASE_ADDRESS_0,
-			       isp->saved_regs.ispmmadr);
-	pci_write_config_dword(dev, PCI_MSI_CAPID, isp->saved_regs.msicap);
-	pci_write_config_dword(dev, PCI_MSI_ADDR, isp->saved_regs.msi_addr);
-	pci_write_config_word(dev, PCI_MSI_DATA, isp->saved_regs.msi_data);
-	pci_write_config_byte(dev, PCI_INTERRUPT_LINE, isp->saved_regs.intr);
-	pci_write_config_dword(dev, PCI_INTERRUPT_CTRL,
-			       isp->saved_regs.interrupt_control);
-	pci_write_config_dword(dev, PCI_I_CONTROL,
-			       isp->saved_regs.i_control);
-
-	pci_write_config_dword(dev, MRFLD_PCI_PMCS,
-			       isp->saved_regs.pmcs);
-	pci_write_config_dword(dev, MRFLD_PCI_CSI_ACCESS_CTRL_VIOL,
+	pci_write_config_word(pdev, PCI_COMMAND, isp->saved_regs.pcicmdsts);
+	pci_write_config_dword(pdev, PCI_BASE_ADDRESS_0, isp->saved_regs.ispmmadr);
+	pci_write_config_dword(pdev, PCI_MSI_CAPID, isp->saved_regs.msicap);
+	pci_write_config_dword(pdev, PCI_MSI_ADDR, isp->saved_regs.msi_addr);
+	pci_write_config_word(pdev, PCI_MSI_DATA, isp->saved_regs.msi_data);
+	pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, isp->saved_regs.intr);
+	pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, isp->saved_regs.interrupt_control);
+	pci_write_config_dword(pdev, PCI_I_CONTROL, isp->saved_regs.i_control);
+
+	pci_write_config_dword(pdev, MRFLD_PCI_PMCS, isp->saved_regs.pmcs);
+	pci_write_config_dword(pdev, MRFLD_PCI_CSI_ACCESS_CTRL_VIOL,
 			       isp->saved_regs.csi_access_viol);
-	pci_write_config_dword(dev, MRFLD_PCI_CSI_RCOMP_CONTROL,
+	pci_write_config_dword(pdev, MRFLD_PCI_CSI_RCOMP_CONTROL,
 			       isp->saved_regs.csi_rcomp_config);
-	pci_write_config_dword(dev, MRFLD_PCI_CSI_AFE_TRIM_CONTROL,
+	pci_write_config_dword(pdev, MRFLD_PCI_CSI_AFE_TRIM_CONTROL,
 			       isp->saved_regs.csi_afe_dly);
-	pci_write_config_dword(dev, MRFLD_PCI_CSI_CONTROL,
+	pci_write_config_dword(pdev, MRFLD_PCI_CSI_CONTROL,
 			       isp->saved_regs.csi_control);
-	pci_write_config_dword(dev, MRFLD_PCI_CSI_AFE_RCOMP_CONTROL,
+	pci_write_config_dword(pdev, MRFLD_PCI_CSI_AFE_RCOMP_CONTROL,
 			       isp->saved_regs.csi_afe_rcomp_config);
-	pci_write_config_dword(dev, MRFLD_PCI_CSI_AFE_HS_CONTROL,
+	pci_write_config_dword(pdev, MRFLD_PCI_CSI_AFE_HS_CONTROL,
 			       isp->saved_regs.csi_afe_hs_control);
-	pci_write_config_dword(dev, MRFLD_PCI_CSI_DEADLINE_CONTROL,
+	pci_write_config_dword(pdev, MRFLD_PCI_CSI_DEADLINE_CONTROL,
 			       isp->saved_regs.csi_deadline_control);
 
 	/*
@@ -619,7 +609,7 @@ static int __maybe_unused atomisp_restore_iunit_reg(struct atomisp_device *isp)
 
 static int atomisp_mrfld_pre_power_down(struct atomisp_device *isp)
 {
-	struct pci_dev *dev = to_pci_dev(isp->dev);
+	struct pci_dev *pdev = to_pci_dev(isp->dev);
 	u32 irq;
 	unsigned long flags;
 
@@ -635,11 +625,11 @@ static int atomisp_mrfld_pre_power_down(struct atomisp_device *isp)
 	 * So, here we need to check if there is any pending
 	 * IRQ, if so, waiting for it to be served
 	 */
-	pci_read_config_dword(dev, PCI_INTERRUPT_CTRL, &irq);
+	pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &irq);
 	irq = irq & 1 << INTR_IIR;
-	pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, irq);
+	pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, irq);
 
-	pci_read_config_dword(dev, PCI_INTERRUPT_CTRL, &irq);
+	pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &irq);
 	if (!(irq & (1 << INTR_IIR)))
 		goto done;
 
@@ -652,11 +642,11 @@ static int atomisp_mrfld_pre_power_down(struct atomisp_device *isp)
 		spin_unlock_irqrestore(&isp->lock, flags);
 		return -EAGAIN;
 	} else {
-		pci_read_config_dword(dev, PCI_INTERRUPT_CTRL, &irq);
+		pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &irq);
 		irq = irq & 1 << INTR_IIR;
-		pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, irq);
+		pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, irq);
 
-		pci_read_config_dword(dev, PCI_INTERRUPT_CTRL, &irq);
+		pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &irq);
 		if (!(irq & (1 << INTR_IIR))) {
 			atomisp_css2_hw_store_32(MRFLD_INTR_ENABLE_REG, 0x0);
 			goto done;
@@ -675,9 +665,9 @@ static int atomisp_mrfld_pre_power_down(struct atomisp_device *isp)
 	* to IIR. It could block subsequent interrupt messages.
 	* HW sighting:4568410.
 	*/
-	pci_read_config_dword(dev, PCI_INTERRUPT_CTRL, &irq);
+	pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &irq);
 	irq &= ~(1 << INTR_IER);
-	pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, irq);
+	pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, irq);
 
 	atomisp_msi_irq_uninit(isp);
 	atomisp_freq_scaling(isp, ATOMISP_DFS_MODE_LOW, true);
@@ -1441,8 +1431,7 @@ atomisp_load_firmware(struct atomisp_device *isp)
  * Check for flags the driver was compiled with against the PCI
  * device. Always returns true on other than ISP 2400.
  */
-static bool is_valid_device(struct pci_dev *dev,
-			    const struct pci_device_id *id)
+static bool is_valid_device(struct pci_dev *pdev, const struct pci_device_id *id)
 {
 	unsigned int a0_max_id = 0;
 	const char *name;
@@ -1466,14 +1455,14 @@ static bool is_valid_device(struct pci_dev *dev,
 		name = "Cherrytrail";
 		break;
 	default:
-		dev_err(&dev->dev, "%s: unknown device ID %x04:%x04\n",
+		dev_err(&pdev->dev, "%s: unknown device ID %x04:%x04\n",
 			product, id->vendor, id->device);
 		return false;
 	}
 
-	if (dev->revision <= ATOMISP_PCI_REV_BYT_A0_MAX) {
-		dev_err(&dev->dev, "%s revision %d is not unsupported\n",
-			name, dev->revision);
+	if (pdev->revision <= ATOMISP_PCI_REV_BYT_A0_MAX) {
+		dev_err(&pdev->dev, "%s revision %d is not unsupported\n",
+			name, pdev->revision);
 		return false;
 	}
 
@@ -1484,22 +1473,20 @@ static bool is_valid_device(struct pci_dev *dev,
 
 #if defined(ISP2400)
 	if (IS_ISP2401) {
-		dev_err(&dev->dev, "Support for %s (ISP2401) was disabled at compile time\n",
+		dev_err(&pdev->dev, "Support for %s (ISP2401) was disabled at compile time\n",
 			name);
 		return false;
 	}
 #else
 	if (!IS_ISP2401) {
-		dev_err(&dev->dev, "Support for %s (ISP2400) was disabled at compile time\n",
+		dev_err(&pdev->dev, "Support for %s (ISP2400) was disabled at compile time\n",
 			name);
 		return false;
 	}
 #endif
 
-	dev_info(&dev->dev, "Detected %s version %d (ISP240%c) on %s\n",
-		name, dev->revision,
-		IS_ISP2401 ? '1' : '0',
-		product);
+	dev_info(&pdev->dev, "Detected %s version %d (ISP240%c) on %s\n",
+		 name, pdev->revision, IS_ISP2401 ? '1' : '0', product);
 
 	return true;
 }
@@ -1539,8 +1526,7 @@ static int init_atomisp_wdts(struct atomisp_device *isp)
 
 #define ATOM_ISP_PCI_BAR	0
 
-static int atomisp_pci_probe(struct pci_dev *dev,
-			     const struct pci_device_id *id)
+static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 {
 	const struct atomisp_platform_data *pdata;
 	struct atomisp_device *isp;
@@ -1549,47 +1535,45 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 	int err, val;
 	u32 irq;
 
-	if (!is_valid_device(dev, id))
+	if (!is_valid_device(pdev, id))
 		return -ENODEV;
 
 	/* Pointer to struct device. */
-	atomisp_dev = &dev->dev;
+	atomisp_dev = &pdev->dev;
 
 	pdata = atomisp_get_platform_data();
 	if (!pdata)
-		dev_warn(&dev->dev, "no platform data available\n");
+		dev_warn(&pdev->dev, "no platform data available\n");
 
-	err = pcim_enable_device(dev);
+	err = pcim_enable_device(pdev);
 	if (err) {
-		dev_err(&dev->dev, "Failed to enable CI ISP device (%d)\n",
-			err);
+		dev_err(&pdev->dev, "Failed to enable CI ISP device (%d)\n", err);
 		return err;
 	}
 
-	start = pci_resource_start(dev, ATOM_ISP_PCI_BAR);
-	dev_dbg(&dev->dev, "start: 0x%x\n", start);
+	start = pci_resource_start(pdev, ATOM_ISP_PCI_BAR);
+	dev_dbg(&pdev->dev, "start: 0x%x\n", start);
 
-	err = pcim_iomap_regions(dev, 1 << ATOM_ISP_PCI_BAR, pci_name(dev));
+	err = pcim_iomap_regions(pdev, 1 << ATOM_ISP_PCI_BAR, pci_name(pdev));
 	if (err) {
-		dev_err(&dev->dev, "Failed to I/O memory remapping (%d)\n",
-			err);
+		dev_err(&pdev->dev, "Failed to I/O memory remapping (%d)\n", err);
 		goto ioremap_fail;
 	}
 
-	base = pcim_iomap_table(dev)[ATOM_ISP_PCI_BAR];
-	dev_dbg(&dev->dev, "base: %p\n", base);
+	base = pcim_iomap_table(pdev)[ATOM_ISP_PCI_BAR];
+	dev_dbg(&pdev->dev, "base: %p\n", base);
 
 	atomisp_io_base = base;
 
-	dev_dbg(&dev->dev, "atomisp_io_base: %p\n", atomisp_io_base);
+	dev_dbg(&pdev->dev, "atomisp_io_base: %p\n", atomisp_io_base);
 
-	isp = devm_kzalloc(&dev->dev, sizeof(struct atomisp_device), GFP_KERNEL);
+	isp = devm_kzalloc(&pdev->dev, sizeof(*isp), GFP_KERNEL);
 	if (!isp) {
 		err = -ENOMEM;
 		goto atomisp_dev_alloc_fail;
 	}
 
-	isp->dev = &dev->dev;
+	isp->dev = &pdev->dev;
 	isp->sw_contex.power_state = ATOM_ISP_POWER_UP;
 	isp->saved_regs.ispmmadr = start;
 
@@ -1598,7 +1582,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 	spin_lock_init(&isp->lock);
 
 	/* This is not a true PCI device on SoC, so the delay is not needed. */
-	dev->d3_delay = 0;
+	pdev->d3_delay = 0;
 
 	switch (id->device & ATOMISP_PCI_DEVICE_SOC_MASK) {
 	case ATOMISP_PCI_DEVICE_SOC_MRFLD:
@@ -1649,15 +1633,14 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 		 * have specs yet for exactly how it varies.  Default to
 		 * BYT-CR but let provisioning set it via EFI variable
 		 */
-		isp->hpll_freq = gmin_get_var_int(&dev->dev, false, "HpllFreq",
-						  HPLL_FREQ_2000MHZ);
+		isp->hpll_freq = gmin_get_var_int(&pdev->dev, false, "HpllFreq", HPLL_FREQ_2000MHZ);
 
 		/*
 		 * for BYT/CHT we are put isp into D3cold to avoid pci registers access
 		 * in power off. Set d3cold_delay to 0 since default 100ms is not
 		 * necessary.
 		 */
-		dev->d3cold_delay = 0;
+		pdev->d3cold_delay = 0;
 		break;
 	case ATOMISP_PCI_DEVICE_SOC_ANN:
 		isp->media_dev.hw_revision = (
@@ -1667,7 +1650,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 						 ATOMISP_HW_REVISION_ISP2401_LEGACY
 #endif
 						 << ATOMISP_HW_REVISION_SHIFT);
-		isp->media_dev.hw_revision |= dev->revision < 2 ?
+		isp->media_dev.hw_revision |= pdev->revision < 2 ?
 					      ATOMISP_HW_STEPPING_A0 : ATOMISP_HW_STEPPING_B0;
 		isp->dfs = &dfs_config_merr;
 		isp->hpll_freq = HPLL_FREQ_1600MHZ;
@@ -1680,11 +1663,11 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 						 ATOMISP_HW_REVISION_ISP2401_LEGACY
 #endif
 						 << ATOMISP_HW_REVISION_SHIFT);
-		isp->media_dev.hw_revision |= dev->revision < 2 ?
+		isp->media_dev.hw_revision |= pdev->revision < 2 ?
 					      ATOMISP_HW_STEPPING_A0 : ATOMISP_HW_STEPPING_B0;
 
 		isp->dfs = &dfs_config_cht;
-		dev->d3cold_delay = 0;
+		pdev->d3cold_delay = 0;
 
 		iosf_mbi_read(BT_MBI_UNIT_CCK, MBI_REG_READ, CCK_FUSE_REG_0, &val);
 		switch (val & CCK_FUSE_HPLL_FREQ_MASK) {
@@ -1699,18 +1682,16 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 			break;
 		default:
 			isp->hpll_freq = HPLL_FREQ_1600MHZ;
-			dev_warn(isp->dev,
-				 "read HPLL from cck failed. Default to 1600 MHz.\n");
+			dev_warn(&pdev->dev, "read HPLL from cck failed. Default to 1600 MHz.\n");
 		}
 		break;
 	default:
-		dev_err(&dev->dev, "un-supported IUNIT device\n");
+		dev_err(&pdev->dev, "un-supported IUNIT device\n");
 		err = -ENODEV;
 		goto atomisp_dev_alloc_fail;
 	}
 
-	dev_info(&dev->dev, "ISP HPLL frequency base = %d MHz\n",
-		 isp->hpll_freq);
+	dev_info(&pdev->dev, "ISP HPLL frequency base = %d MHz\n", isp->hpll_freq);
 
 	isp->max_isr_latency = ATOMISP_MAX_ISR_LATENCY;
 
@@ -1719,26 +1700,25 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 		isp->firmware = atomisp_load_firmware(isp);
 		if (!isp->firmware) {
 			err = -ENOENT;
-			dev_dbg(&dev->dev, "Firmware load failed\n");
+			dev_dbg(&pdev->dev, "Firmware load failed\n");
 			goto load_fw_fail;
 		}
 
-		err = sh_css_check_firmware_version(isp->dev,
-						    isp->firmware->data);
+		err = sh_css_check_firmware_version(isp->dev, isp->firmware->data);
 		if (err) {
-			dev_dbg(&dev->dev, "Firmware version check failed\n");
+			dev_dbg(&pdev->dev, "Firmware version check failed\n");
 			goto fw_validation_fail;
 		}
 	} else {
-		dev_info(&dev->dev, "Firmware load will be deferred\n");
+		dev_info(&pdev->dev, "Firmware load will be deferred\n");
 	}
 
-	pci_set_master(dev);
-	pci_set_drvdata(dev, isp);
+	pci_set_master(pdev);
+	pci_set_drvdata(pdev, isp);
 
-	err = pci_enable_msi(dev);
+	err = pci_enable_msi(pdev);
 	if (err) {
-		dev_err(&dev->dev, "Failed to enable msi (%d)\n", err);
+		dev_err(&pdev->dev, "Failed to enable msi (%d)\n", err);
 		goto enable_msi_fail;
 	}
 
@@ -1763,8 +1743,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 		 * Workaround for imbalance data eye issue which is observed
 		 * on TNG B0.
 		 */
-		pci_read_config_dword(dev, MRFLD_PCI_CSI_AFE_TRIM_CONTROL,
-				      &csi_afe_trim);
+		pci_read_config_dword(pdev, MRFLD_PCI_CSI_AFE_TRIM_CONTROL, &csi_afe_trim);
 		csi_afe_trim &= ~((MRFLD_PCI_CSI_HSRXCLKTRIM_MASK <<
 				   MRFLD_PCI_CSI1_HSRXCLKTRIM_SHIFT) |
 				  (MRFLD_PCI_CSI_HSRXCLKTRIM_MASK <<
@@ -1777,20 +1756,18 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 				 MRFLD_PCI_CSI2_HSRXCLKTRIM_SHIFT) |
 				(MRFLD_PCI_CSI3_HSRXCLKTRIM <<
 				 MRFLD_PCI_CSI3_HSRXCLKTRIM_SHIFT);
-		pci_write_config_dword(dev, MRFLD_PCI_CSI_AFE_TRIM_CONTROL,
-				       csi_afe_trim);
+		pci_write_config_dword(pdev, MRFLD_PCI_CSI_AFE_TRIM_CONTROL, csi_afe_trim);
 	}
 
 	err = atomisp_initialize_modules(isp);
 	if (err < 0) {
-		dev_err(&dev->dev, "atomisp_initialize_modules (%d)\n", err);
+		dev_err(&pdev->dev, "atomisp_initialize_modules (%d)\n", err);
 		goto initialize_modules_fail;
 	}
 
 	err = atomisp_register_entities(isp);
 	if (err < 0) {
-		dev_err(&dev->dev, "atomisp_register_entities failed (%d)\n",
-			err);
+		dev_err(&pdev->dev, "atomisp_register_entities failed (%d)\n", err);
 		goto register_entities_fail;
 	}
 	err = atomisp_create_pads_links(isp);
@@ -1803,24 +1780,24 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 	/* save the iunit context only once after all the values are init'ed. */
 	atomisp_save_iunit_reg(isp);
 
-	pm_runtime_put_noidle(&dev->dev);
-	pm_runtime_allow(&dev->dev);
+	pm_runtime_put_noidle(&pdev->dev);
+	pm_runtime_allow(&pdev->dev);
 
 	hmm_init_mem_stat(repool_pgnr, dypool_enable, dypool_pgnr);
 	err = hmm_pool_register(repool_pgnr, HMM_POOL_TYPE_RESERVED);
 	if (err) {
-		dev_err(&dev->dev, "Failed to register reserved memory pool.\n");
+		dev_err(&pdev->dev, "Failed to register reserved memory pool.\n");
 		goto hmm_pool_fail;
 	}
 
 	/* Init ISP memory management */
 	hmm_init();
 
-	err = devm_request_threaded_irq(&dev->dev, dev->irq,
+	err = devm_request_threaded_irq(&pdev->dev, pdev->irq,
 					atomisp_isr, atomisp_isr_thread,
 					IRQF_SHARED, "isp_irq", isp);
 	if (err) {
-		dev_err(&dev->dev, "Failed to request irq (%d)\n", err);
+		dev_err(&pdev->dev, "Failed to request irq (%d)\n", err);
 		goto request_irq_fail;
 	}
 
@@ -1828,11 +1805,11 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 	if (!defer_fw_load) {
 		err = atomisp_css_load_firmware(isp);
 		if (err) {
-			dev_err(&dev->dev, "Failed to init css.\n");
+			dev_err(&pdev->dev, "Failed to init css.\n");
 			goto css_init_fail;
 		}
 	} else {
-		dev_dbg(&dev->dev, "Skip css init.\n");
+		dev_dbg(&pdev->dev, "Skip css init.\n");
 	}
 	/* Clear FW image from memory */
 	release_firmware(isp->firmware);
@@ -1844,7 +1821,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 	return 0;
 
 css_init_fail:
-	devm_free_irq(&dev->dev, dev->irq, isp);
+	devm_free_irq(&pdev->dev, pdev->irq, isp);
 request_irq_fail:
 	hmm_cleanup();
 	hmm_pool_unregister(HMM_POOL_TYPE_RESERVED);
@@ -1858,7 +1835,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 initialize_modules_fail:
 	cpu_latency_qos_remove_request(&isp->pm_qos);
 	atomisp_msi_irq_uninit(isp);
-	pci_disable_msi(dev);
+	pci_disable_msi(pdev);
 enable_msi_fail:
 fw_validation_fail:
 	release_firmware(isp->firmware);
@@ -1870,13 +1847,13 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 	 * The following lines have been copied from atomisp suspend path
 	 */
 
-	pci_read_config_dword(dev, PCI_INTERRUPT_CTRL, &irq);
+	pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &irq);
 	irq = irq & 1 << INTR_IIR;
-	pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, irq);
+	pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, irq);
 
-	pci_read_config_dword(dev, PCI_INTERRUPT_CTRL, &irq);
+	pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &irq);
 	irq &= ~(1 << INTR_IER);
-	pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, irq);
+	pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, irq);
 
 	atomisp_msi_irq_uninit(isp);
 
@@ -1884,21 +1861,20 @@ static int atomisp_pci_probe(struct pci_dev *dev,
 
 	/* Address later when we worry about the ...field chips */
 	if (IS_ENABLED(CONFIG_PM) && atomisp_mrfld_power_down(isp))
-		dev_err(&dev->dev, "Failed to switch off ISP\n");
+		dev_err(&pdev->dev, "Failed to switch off ISP\n");
 
 atomisp_dev_alloc_fail:
-	pcim_iounmap_regions(dev, 1 << ATOM_ISP_PCI_BAR);
+	pcim_iounmap_regions(pdev, 1 << ATOM_ISP_PCI_BAR);
 
 ioremap_fail:
 	return err;
 }
 
-static void atomisp_pci_remove(struct pci_dev *dev)
+static void atomisp_pci_remove(struct pci_dev *pdev)
 {
-	struct atomisp_device *isp = (struct atomisp_device *)
-				     pci_get_drvdata(dev);
+	struct atomisp_device *isp = pci_get_drvdata(pdev);
 
-	dev_info(&dev->dev, "Removing atomisp driver\n");
+	dev_info(&pdev->dev, "Removing atomisp driver\n");
 
 	atomisp_drvfs_exit();
 
@@ -1907,8 +1883,8 @@ static void atomisp_pci_remove(struct pci_dev *dev)
 	ia_css_unload_firmware();
 	hmm_cleanup();
 
-	pm_runtime_forbid(&dev->dev);
-	pm_runtime_get_noresume(&dev->dev);
+	pm_runtime_forbid(&pdev->dev);
+	pm_runtime_get_noresume(&pdev->dev);
 	cpu_latency_qos_remove_request(&isp->pm_qos);
 
 	atomisp_msi_irq_uninit(isp);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 07/15] media: atomisp: Replace direct access to MMIO with proper helpers
  2020-06-26 12:19 [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Andy Shevchenko
                   ` (5 preceding siblings ...)
  2020-06-26 12:19 ` [PATCH v2 06/15] media: atomisp: Unify pdev to be pointer to struct pci_device Andy Shevchenko
@ 2020-06-26 12:19 ` Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 08/15] media: atomisp: Drop global atomisp_dev variable (easy cases) Andy Shevchenko
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2020-06-26 12:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Sakari Ailus; +Cc: Andy Shevchenko

We have special helpers to access MMIO. Use them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 .../staging/media/atomisp/pci/atomisp_cmd.c   | 13 +++---
 .../media/atomisp/pci/atomisp_compat.h        |  2 -
 .../media/atomisp/pci/atomisp_compat_css20.c  | 43 ++++++++++---------
 .../media/atomisp/pci/atomisp_internal.h      |  1 +
 .../staging/media/atomisp/pci/atomisp_v4l2.c  | 16 +++----
 5 files changed, 35 insertions(+), 40 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
index db3c3542457c..ed01a0987da7 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
@@ -21,6 +21,7 @@
 #include <linux/firmware.h>
 #include <linux/pci.h>
 #include <linux/interrupt.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/kfifo.h>
 #include <linux/pm_runtime.h>
@@ -669,11 +670,10 @@ bool atomisp_buffers_queued_pipe(struct atomisp_video_pipe *pipe)
 void dump_sp_dmem(struct atomisp_device *isp, unsigned int addr,
 		  unsigned int size)
 {
-	u32 __iomem *io_virt_addr;
 	unsigned int data = 0;
 	unsigned int size32 = DIV_ROUND_UP(size, sizeof(u32));
 
-	dev_dbg(isp->dev, "atomisp_io_base:%p\n", atomisp_io_base);
+	dev_dbg(isp->dev, "atomisp mmio base: %p\n", isp->base);
 	dev_dbg(isp->dev, "%s, addr:0x%x, size: %d, size32: %d\n", __func__,
 		addr, size, size32);
 	if (size32 * 4 + addr > 0x4000) {
@@ -682,13 +682,12 @@ void dump_sp_dmem(struct atomisp_device *isp, unsigned int addr,
 		return;
 	}
 	addr += SP_DMEM_BASE;
-	io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
+	addr &= 0x003FFFFF;
 	do {
-		data = *io_virt_addr;
+		data = readl(isp->base + addr);
 		dev_dbg(isp->dev, "%s, \t [0x%x]:0x%x\n", __func__, addr, data);
-		io_virt_addr += sizeof(u32);
-		size32 -= 1;
-	} while (size32 > 0);
+		addr += sizeof(u32);
+	} while (--size32);
 }
 
 static struct videobuf_buffer *atomisp_css_frame_to_vbuf(
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat.h b/drivers/staging/media/atomisp/pci/atomisp_compat.h
index b2ed83c2f337..6a2a81a3eb23 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat.h
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat.h
@@ -29,8 +29,6 @@ struct atomisp_sub_device;
 struct video_device;
 enum atomisp_input_stream_id;
 
-extern void __iomem *atomisp_io_base;
-
 struct atomisp_metadata_buf {
 	struct ia_css_metadata *metadata;
 	void *md_vptr;
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
index df352be06474..010b2b19d811 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
@@ -38,6 +38,7 @@
 #include "sh_css_hrt.h"
 #include "ia_css_isys.h"
 
+#include <linux/io.h>
 #include <linux/pm_runtime.h>
 
 /* Assume max number of ACC stages */
@@ -67,92 +68,94 @@ struct bayer_ds_factor {
 
 static void atomisp_css2_hw_store_8(hrt_address addr, uint8_t data)
 {
-	s8 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
+	struct atomisp_device *isp = dev_get_drvdata(atomisp_dev);
 	unsigned long flags;
 
 	spin_lock_irqsave(&mmio_lock, flags);
-	*io_virt_addr = data;
+	writeb(data, isp->base + (addr & 0x003FFFFF));
 	spin_unlock_irqrestore(&mmio_lock, flags);
 }
 
 static void atomisp_css2_hw_store_16(hrt_address addr, uint16_t data)
 {
-	s16 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
+	struct atomisp_device *isp = dev_get_drvdata(atomisp_dev);
 	unsigned long flags;
 
 	spin_lock_irqsave(&mmio_lock, flags);
-	*io_virt_addr = data;
+	writew(data, isp->base + (addr & 0x003FFFFF));
 	spin_unlock_irqrestore(&mmio_lock, flags);
 }
 
 void atomisp_css2_hw_store_32(hrt_address addr, uint32_t data)
 {
-	s32 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
+	struct atomisp_device *isp = dev_get_drvdata(atomisp_dev);
 	unsigned long flags;
 
 	spin_lock_irqsave(&mmio_lock, flags);
-	*io_virt_addr = data;
+	writel(data, isp->base + (addr & 0x003FFFFF));
 	spin_unlock_irqrestore(&mmio_lock, flags);
 }
 
 static uint8_t atomisp_css2_hw_load_8(hrt_address addr)
 {
-	s8 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
+	struct atomisp_device *isp = dev_get_drvdata(atomisp_dev);
 	unsigned long flags;
 	u8 ret;
 
 	spin_lock_irqsave(&mmio_lock, flags);
-	ret = *io_virt_addr;
+	ret = readb(isp->base + (addr & 0x003FFFFF));
 	spin_unlock_irqrestore(&mmio_lock, flags);
 	return ret;
 }
 
 static uint16_t atomisp_css2_hw_load_16(hrt_address addr)
 {
-	s16 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
+	struct atomisp_device *isp = dev_get_drvdata(atomisp_dev);
 	unsigned long flags;
 	u16 ret;
 
 	spin_lock_irqsave(&mmio_lock, flags);
-	ret = *io_virt_addr;
+	ret = readw(isp->base + (addr & 0x003FFFFF));
 	spin_unlock_irqrestore(&mmio_lock, flags);
 	return ret;
 }
 
 static uint32_t atomisp_css2_hw_load_32(hrt_address addr)
 {
-	s32 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
+	struct atomisp_device *isp = dev_get_drvdata(atomisp_dev);
 	unsigned long flags;
 	u32 ret;
 
 	spin_lock_irqsave(&mmio_lock, flags);
-	ret = *io_virt_addr;
+	ret = readl(isp->base + (addr & 0x003FFFFF));
 	spin_unlock_irqrestore(&mmio_lock, flags);
 	return ret;
 }
 
-static void atomisp_css2_hw_store(hrt_address addr,
-				  const void *from, uint32_t n)
+static void atomisp_css2_hw_store(hrt_address addr, const void *from, uint32_t n)
 {
-	s8 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
+	struct atomisp_device *isp = dev_get_drvdata(atomisp_dev);
 	unsigned long flags;
 	unsigned int i;
 
+	addr &= 0x003FFFFF;
 	spin_lock_irqsave(&mmio_lock, flags);
-	for (i = 0; i < n; i++, io_virt_addr++, from++)
-		*io_virt_addr = *(s8 *)from;
+	for (i = 0; i < n; i++, from++)
+		writeb(*(s8 *)from, isp->base + addr + i);
+
 	spin_unlock_irqrestore(&mmio_lock, flags);
 }
 
 static void atomisp_css2_hw_load(hrt_address addr, void *to, uint32_t n)
 {
-	s8 __iomem *io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
+	struct atomisp_device *isp = dev_get_drvdata(atomisp_dev);
 	unsigned long flags;
 	unsigned int i;
 
+	addr &= 0x003FFFFF;
 	spin_lock_irqsave(&mmio_lock, flags);
-	for (i = 0; i < n; i++, to++, io_virt_addr++)
-		*(s8 *)to = *io_virt_addr;
+	for (i = 0; i < n; i++, to++)
+		*(s8 *)to = readb(isp->base + addr + i);
 	spin_unlock_irqrestore(&mmio_lock, flags);
 }
 
diff --git a/drivers/staging/media/atomisp/pci/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp_internal.h
index 5af9bbce6284..c01db10bb735 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_internal.h
+++ b/drivers/staging/media/atomisp/pci/atomisp_internal.h
@@ -221,6 +221,7 @@ struct atomisp_device {
 	struct media_device media_dev;
 	struct atomisp_platform_data *pdata;
 	void *mmu_l1_base;
+	void __iomem *base;
 	const struct firmware *firmware;
 
 	struct pm_qos_request pm_qos;
diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
index 731a683e82f1..17ca730aa358 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
@@ -127,8 +127,6 @@ MODULE_PARM_DESC(pad_h, "extra data for ISP processing");
 
 struct device *atomisp_dev;
 
-void __iomem *atomisp_io_base;
-
 static const struct atomisp_freq_scaling_rule dfs_rules_merr[] = {
 	{
 		.width = ISP_FREQ_RULE_ANY,
@@ -1531,7 +1529,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
 	const struct atomisp_platform_data *pdata;
 	struct atomisp_device *isp;
 	unsigned int start;
-	void __iomem *base;
 	int err, val;
 	u32 irq;
 
@@ -1560,13 +1557,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
 		goto ioremap_fail;
 	}
 
-	base = pcim_iomap_table(pdev)[ATOM_ISP_PCI_BAR];
-	dev_dbg(&pdev->dev, "base: %p\n", base);
-
-	atomisp_io_base = base;
-
-	dev_dbg(&pdev->dev, "atomisp_io_base: %p\n", atomisp_io_base);
-
 	isp = devm_kzalloc(&pdev->dev, sizeof(*isp), GFP_KERNEL);
 	if (!isp) {
 		err = -ENOMEM;
@@ -1574,9 +1564,12 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
 	}
 
 	isp->dev = &pdev->dev;
+	isp->base = pcim_iomap_table(pdev)[ATOM_ISP_PCI_BAR];
 	isp->sw_contex.power_state = ATOM_ISP_POWER_UP;
 	isp->saved_regs.ispmmadr = start;
 
+	dev_dbg(&pdev->dev, "atomisp mmio base: %p\n", isp->base);
+
 	rt_mutex_init(&isp->mutex);
 	mutex_init(&isp->streamoff_mutex);
 	spin_lock_init(&isp->lock);
@@ -1584,6 +1577,8 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
 	/* This is not a true PCI device on SoC, so the delay is not needed. */
 	pdev->d3_delay = 0;
 
+	pci_set_drvdata(pdev, isp);
+
 	switch (id->device & ATOMISP_PCI_DEVICE_SOC_MASK) {
 	case ATOMISP_PCI_DEVICE_SOC_MRFLD:
 		isp->media_dev.hw_revision =
@@ -1714,7 +1709,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
 	}
 
 	pci_set_master(pdev);
-	pci_set_drvdata(pdev, isp);
 
 	err = pci_enable_msi(pdev);
 	if (err) {
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 08/15] media: atomisp: Drop global atomisp_dev variable (easy cases)
  2020-06-26 12:19 [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Andy Shevchenko
                   ` (6 preceding siblings ...)
  2020-06-26 12:19 ` [PATCH v2 07/15] media: atomisp: Replace direct access to MMIO with proper helpers Andy Shevchenko
@ 2020-06-26 12:19 ` Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 09/15] media: atomisp: make platform data more readable Andy Shevchenko
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2020-06-26 12:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Sakari Ailus; +Cc: Andy Shevchenko

Refactor code to avoid use of atomisp_dev global variable
where it's easy to achieve.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/staging/media/atomisp/pci/atomisp_acc.c  |  4 ++--
 .../media/atomisp/pci/atomisp_compat_css20.c     | 16 +++++++---------
 .../media/atomisp/pci/atomisp_compat_css20.h     |  2 +-
 .../staging/media/atomisp/pci/atomisp_drvfs.c    | 11 +++++------
 4 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_acc.c b/drivers/staging/media/atomisp/pci/atomisp_acc.c
index 76861396ba86..f638d0bd09fe 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_acc.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_acc.c
@@ -355,11 +355,11 @@ int atomisp_acc_map(struct atomisp_sub_device *asd, struct atomisp_acc_map *map)
 
 		pgnr = DIV_ROUND_UP(map->length, PAGE_SIZE);
 		if (pgnr < ((PAGE_ALIGN(map->length)) >> PAGE_SHIFT)) {
-			dev_err(atomisp_dev,
+			dev_err(asd->isp->dev,
 				"user space memory size is less than the expected size..\n");
 			return -ENOMEM;
 		} else if (pgnr > ((PAGE_ALIGN(map->length)) >> PAGE_SHIFT)) {
-			dev_err(atomisp_dev,
+			dev_err(asd->isp->dev,
 				"user space memory size is large than the expected size..\n");
 			return -ENOMEM;
 		}
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
index 010b2b19d811..499916bc6aab 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
@@ -182,10 +182,10 @@ void atomisp_load_uint32(hrt_address addr, uint32_t *data)
 	*data = atomisp_css2_hw_load_32(addr);
 }
 
-static int hmm_get_mmu_base_addr(unsigned int *mmu_base_addr)
+static int hmm_get_mmu_base_addr(struct device *dev, unsigned int *mmu_base_addr)
 {
 	if (!sh_mmu_mrfld.get_pd_base) {
-		dev_err(atomisp_dev, "get mmu base address failed.\n");
+		dev_err(dev, "get mmu base address failed.\n");
 		return -EINVAL;
 	}
 
@@ -840,7 +840,7 @@ int atomisp_css_init(struct atomisp_device *isp)
 	int ret;
 	int err;
 
-	ret = hmm_get_mmu_base_addr(&mmu_base_addr);
+	ret = hmm_get_mmu_base_addr(isp->dev, &mmu_base_addr);
 	if (ret)
 		return ret;
 
@@ -942,7 +942,7 @@ int atomisp_css_resume(struct atomisp_device *isp)
 	unsigned int mmu_base_addr;
 	int ret;
 
-	ret = hmm_get_mmu_base_addr(&mmu_base_addr);
+	ret = hmm_get_mmu_base_addr(isp->dev, &mmu_base_addr);
 	if (ret) {
 		dev_err(isp->dev, "get base address error.\n");
 		return -EINVAL;
@@ -4337,7 +4337,7 @@ static const char * const fw_acc_type_name[] = {
 	[IA_CSS_ACC_STANDALONE] =	"Stand-alone acceleration",
 };
 
-int atomisp_css_dump_blob_infor(void)
+int atomisp_css_dump_blob_infor(struct atomisp_device *isp)
 {
 	struct ia_css_blob_descr *bd = sh_css_blob_info;
 	unsigned int i, nm = sh_css_num_binaries;
@@ -4354,8 +4354,7 @@ int atomisp_css_dump_blob_infor(void)
 	for (i = 0; i < sh_css_num_binaries - NUM_OF_SPS; i++) {
 		switch (bd[i].header.type) {
 		case ia_css_isp_firmware:
-			dev_dbg(atomisp_dev,
-				"Num%2d type %s (%s), binary id is %2d, name is %s\n",
+			dev_dbg(isp->dev, "Num%2d type %s (%s), binary id is %2d, name is %s\n",
 				i + NUM_OF_SPS,
 				fw_type_name[bd[i].header.type],
 				fw_acc_type_name[bd[i].header.info.isp.type],
@@ -4363,8 +4362,7 @@ int atomisp_css_dump_blob_infor(void)
 				bd[i].name);
 			break;
 		default:
-			dev_dbg(atomisp_dev,
-				"Num%2d type %s, name is %s\n",
+			dev_dbg(isp->dev, "Num%2d type %s, name is %s\n",
 				i + NUM_OF_SPS, fw_type_name[bd[i].header.type],
 				bd[i].name);
 		}
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.h b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.h
index 8376aec18e3e..e0601534380f 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.h
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.h
@@ -153,7 +153,7 @@ int atomisp_css_debug_dump_isp_binary(void);
 
 int atomisp_css_dump_sp_raw_copy_linecount(bool reduced);
 
-int atomisp_css_dump_blob_infor(void);
+int atomisp_css_dump_blob_infor(struct atomisp_device *isp);
 
 void atomisp_css_set_isp_config_id(struct atomisp_sub_device *asd,
 				   uint32_t isp_config_id);
diff --git a/drivers/staging/media/atomisp/pci/atomisp_drvfs.c b/drivers/staging/media/atomisp/pci/atomisp_drvfs.c
index 3711df111fbf..f670faf978e6 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_drvfs.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_drvfs.c
@@ -62,9 +62,9 @@ static inline int iunit_dump_dbgopt(struct atomisp_device *isp,
 
 	if (opt & OPTION_VALID) {
 		if (opt & OPTION_BIN_LIST) {
-			ret = atomisp_css_dump_blob_infor();
+			ret = atomisp_css_dump_blob_infor(isp);
 			if (ret) {
-				dev_err(atomisp_dev, "%s dump blob infor err[ret:%d]\n",
+				dev_err(isp->dev, "%s dump blob infor err[ret:%d]\n",
 					__func__, ret);
 				goto opt_err;
 			}
@@ -76,7 +76,7 @@ static inline int iunit_dump_dbgopt(struct atomisp_device *isp,
 				atomisp_css_debug_dump_isp_binary();
 			} else {
 				ret = -EPERM;
-				dev_err(atomisp_dev, "%s dump running bin err[ret:%d]\n",
+				dev_err(isp->dev, "%s dump running bin err[ret:%d]\n",
 					__func__, ret);
 				goto opt_err;
 			}
@@ -86,8 +86,7 @@ static inline int iunit_dump_dbgopt(struct atomisp_device *isp,
 			hmm_show_mem_stat(__func__, __LINE__);
 	} else {
 		ret = -EINVAL;
-		dev_err(atomisp_dev, "%s dump nothing[ret=%d]\n", __func__,
-			ret);
+		dev_err(isp->dev, "%s dump nothing[ret=%d]\n", __func__, ret);
 	}
 
 opt_err:
@@ -195,7 +194,7 @@ int atomisp_drvfs_init(struct atomisp_device *isp)
 
 	ret = iunit_drvfs_create_files(iunit_debug.drv);
 	if (ret) {
-		dev_err(atomisp_dev, "drvfs_create_files error: %d\n", ret);
+		dev_err(isp->dev, "drvfs_create_files error: %d\n", ret);
 		iunit_drvfs_remove_files(iunit_debug.drv);
 	}
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 09/15] media: atomisp: make platform data more readable
  2020-06-26 12:19 [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Andy Shevchenko
                   ` (7 preceding siblings ...)
  2020-06-26 12:19 ` [PATCH v2 08/15] media: atomisp: Drop global atomisp_dev variable (easy cases) Andy Shevchenko
@ 2020-06-26 12:19 ` Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 10/15] media: atomisp: Don't try to parse unexpected ACPI object type Andy Shevchenko
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2020-06-26 12:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Sakari Ailus; +Cc: Andy Shevchenko

Add few blank lines to make platform data more readable.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index 79cbde65d3c1..fb61274af7e5 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -294,6 +294,7 @@ static struct gmin_cfg_var mrd7_vars[] = {
 	{"INT33F8:00_CsiFmt", "13"},
 	{"INT33F8:00_CsiBayer", "0"},
 	{"INT33F8:00_CamClk", "0"},
+
 	{"INT33F9:00_CamType", "1"},
 	{"INT33F9:00_CsiPort", "0"},
 	{"INT33F9:00_CsiLanes", "1"},
@@ -309,6 +310,7 @@ static struct gmin_cfg_var ecs7_vars[] = {
 	{"INT33BE:00_CsiFmt", "13"},
 	{"INT33BE:00_CsiBayer", "2"},
 	{"INT33BE:00_CamClk", "0"},
+
 	{"INT33F0:00_CsiPort", "0"},
 	{"INT33F0:00_CsiLanes", "1"},
 	{"INT33F0:00_CsiFmt", "13"},
@@ -322,6 +324,7 @@ static struct gmin_cfg_var i8880_vars[] = {
 	{"XXOV2680:00_CsiPort", "1"},
 	{"XXOV2680:00_CsiLanes", "1"},
 	{"XXOV2680:00_CamClk", "0"},
+
 	{"XXGC0310:00_CsiPort", "0"},
 	{"XXGC0310:00_CsiLanes", "1"},
 	{"XXGC0310:00_CamClk", "1"},
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 10/15] media: atomisp: Don't try to parse unexpected ACPI object type
  2020-06-26 12:19 [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Andy Shevchenko
                   ` (8 preceding siblings ...)
  2020-06-26 12:19 ` [PATCH v2 09/15] media: atomisp: make platform data more readable Andy Shevchenko
@ 2020-06-26 12:19 ` Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 11/15] media: atomisp: Make pointer to PMIC client global Andy Shevchenko
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2020-06-26 12:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Sakari Ailus; +Cc: Andy Shevchenko

There are devices with completely different _DSM() format,
and accessing object as a package leads to crashes.

Bail out in the case of unexpected object type.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index fb61274af7e5..f06c0eb6d288 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -959,6 +959,10 @@ static int gmin_get_config_dsm_var(struct device *dev,
 		return -EINVAL;
 	}
 
+	/* Return on unexpected object type */
+	if (obj->type != ACPI_TYPE_PACKAGE)
+		return -EINVAL;
+
 #if 0 /* Just for debugging purposes */
 	for (i = 0; i < obj->package.count; i++) {
 		union acpi_object *cur = &obj->package.elements[i];
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 11/15] media: atomisp: Make pointer to PMIC client global
  2020-06-26 12:19 [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Andy Shevchenko
                   ` (9 preceding siblings ...)
  2020-06-26 12:19 ` [PATCH v2 10/15] media: atomisp: Don't try to parse unexpected ACPI object type Andy Shevchenko
@ 2020-06-26 12:19 ` Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 12/15] media: atomisp: Refactor PMIC detection to a separate function Andy Shevchenko
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2020-06-26 12:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Sakari Ailus; +Cc: Andy Shevchenko

When we enumerate second device when PMIC has been successfully detected
to AXP, we got into troubles dereferencing NULL pointer. It seems
we have to detect PMIC only once because pmic_id is a global variable
and code doesn't expect the change of it: Two PMICs on one platform?
It's impossible.

Crash excerpt:
[   34.335237] BUG: kernel NULL pointer dereference, address: 0000000000000002
...
[   35.652036] RIP: 0010:gmin_subdev_add.cold+0x32f/0x33e [atomisp_gmin_platform]

So, as a quick fix make power a global variable. In next patches we move
PMIC detection to be more independent from subdevices.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index f06c0eb6d288..84e9bf1825fa 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -437,9 +437,11 @@ static int gmin_i2c_write(struct device *dev, u16 i2c_addr, u8 reg,
 	return ret;
 }
 
+static struct i2c_client *power;
+
 static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev)
 {
-	struct i2c_client *power = NULL, *client = v4l2_get_subdevdata(subdev);
+	struct i2c_client *client = v4l2_get_subdevdata(subdev);
 	struct acpi_device *adev;
 	acpi_handle handle;
 	struct device *dev;
@@ -570,7 +572,6 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev)
 		gmin_subdevs[i].eldo2_ctrl_shift = gmin_get_var_int(dev, false,
 								    "eldo2_ctrl_shift",
 								    ELDO2_CTRL_SHIFT);
-		gmin_subdevs[i].pwm_i2c_addr = power->addr;
 		break;
 
 	default:
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 12/15] media: atomisp: Refactor PMIC detection to a separate function.
  2020-06-26 12:19 [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Andy Shevchenko
                   ` (10 preceding siblings ...)
  2020-06-26 12:19 ` [PATCH v2 11/15] media: atomisp: Make pointer to PMIC client global Andy Shevchenko
@ 2020-06-26 12:19 ` Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 13/15] media: atomisp: Provide Gmin subdev as parameter to gmin_subdev_add() Andy Shevchenko
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2020-06-26 12:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Sakari Ailus; +Cc: Andy Shevchenko

Refactor PMIC detection to a separate function. In the future
we may move this code somewhere else where it's more suitable.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 .../media/atomisp/pci/atomisp_gmin_platform.c | 40 +++++++++++--------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index 84e9bf1825fa..26f200b1ed6d 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -439,19 +439,34 @@ static int gmin_i2c_write(struct device *dev, u16 i2c_addr, u8 reg,
 
 static struct i2c_client *power;
 
+static int gmin_pmic_detect(struct v4l2_subdev *subdev)
+{
+	struct i2c_client *client = v4l2_get_subdevdata(subdev);
+	struct device *dev = &client->dev;
+
+	if (pmic_id)
+		return pmic_id;
+
+	if (gmin_i2c_dev_exists(dev, PMIC_ACPI_TI, &power))
+		pmic_id = PMIC_TI;
+	else if (gmin_i2c_dev_exists(dev, PMIC_ACPI_AXP, &power))
+		pmic_id = PMIC_AXP;
+	else if (gmin_i2c_dev_exists(dev, PMIC_ACPI_CRYSTALCOVE, &power))
+		pmic_id = PMIC_CRYSTALCOVE;
+	else
+		pmic_id = PMIC_REGULATOR;
+
+	return pmic_id;
+}
+
 static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev)
 {
 	struct i2c_client *client = v4l2_get_subdevdata(subdev);
+	struct device *dev = &client->dev;
 	struct acpi_device *adev;
 	acpi_handle handle;
-	struct device *dev;
 	int i, ret;
 
-	if (!client)
-		return NULL;
-
-	dev = &client->dev;
-
 	handle = ACPI_HANDLE(dev);
 
 	// FIXME: may need to release resources allocated by acpi_bus_get_device()
@@ -463,17 +478,6 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev)
 	dev_info(&client->dev, "%s: ACPI detected it on bus ID=%s, HID=%s\n",
 		__func__, acpi_device_bid(adev), acpi_device_hid(adev));
 
-	if (!pmic_id) {
-		if (gmin_i2c_dev_exists(dev, PMIC_ACPI_TI, &power))
-			pmic_id = PMIC_TI;
-		else if (gmin_i2c_dev_exists(dev, PMIC_ACPI_AXP, &power))
-			pmic_id = PMIC_AXP;
-		else if (gmin_i2c_dev_exists(dev, PMIC_ACPI_CRYSTALCOVE, &power))
-			pmic_id = PMIC_CRYSTALCOVE;
-		else
-			pmic_id = PMIC_REGULATOR;
-	}
-
 	for (i = 0; i < MAX_SUBDEVS && gmin_subdevs[i].subdev; i++)
 		;
 	if (i >= MAX_SUBDEVS)
@@ -588,6 +592,8 @@ static struct gmin_subdev *find_gmin_subdev(struct v4l2_subdev *subdev)
 	for (i = 0; i < MAX_SUBDEVS; i++)
 		if (gmin_subdevs[i].subdev == subdev)
 			return &gmin_subdevs[i];
+
+	gmin_pmic_detect(subdev);
 	return gmin_subdev_add(subdev);
 }
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 13/15] media: atomisp: Provide Gmin subdev as parameter to gmin_subdev_add()
  2020-06-26 12:19 [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Andy Shevchenko
                   ` (11 preceding siblings ...)
  2020-06-26 12:19 ` [PATCH v2 12/15] media: atomisp: Refactor PMIC detection to a separate function Andy Shevchenko
@ 2020-06-26 12:19 ` Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 14/15] media: atomisp: Get rid of ugly and leaky ACPI handling in gmin_subdev_add() Andy Shevchenko
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2020-06-26 12:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Sakari Ailus; +Cc: Andy Shevchenko

Provide Gmin subdev as parameter to gmin_subdev_add()
to avoid direct global variable usage.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 .../media/atomisp/pci/atomisp_gmin_platform.c | 104 ++++++++----------
 1 file changed, 46 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index 26f200b1ed6d..d0b9d906a563 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -459,13 +459,13 @@ static int gmin_pmic_detect(struct v4l2_subdev *subdev)
 	return pmic_id;
 }
 
-static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev)
+static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev, struct gmin_subdev *gdev)
 {
 	struct i2c_client *client = v4l2_get_subdevdata(subdev);
 	struct device *dev = &client->dev;
 	struct acpi_device *adev;
 	acpi_handle handle;
-	int i, ret;
+	int ret;
 
 	handle = ACPI_HANDLE(dev);
 
@@ -478,13 +478,8 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev)
 	dev_info(&client->dev, "%s: ACPI detected it on bus ID=%s, HID=%s\n",
 		__func__, acpi_device_bid(adev), acpi_device_hid(adev));
 
-	for (i = 0; i < MAX_SUBDEVS && gmin_subdevs[i].subdev; i++)
-		;
-	if (i >= MAX_SUBDEVS)
-		return NULL;
-
 	if (power) {
-		gmin_subdevs[i].pwm_i2c_addr = power->addr;
+		gdev->pwm_i2c_addr = power->addr;
 		dev_info(dev,
 			 "gmin: power management provided via %s (i2c addr 0x%02x)\n",
 			 pmic_name[pmic_id], power->addr);
@@ -493,28 +488,21 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev)
 			 pmic_name[pmic_id]);
 	}
 
-	gmin_subdevs[i].subdev = subdev;
-	gmin_subdevs[i].clock_num = gmin_get_var_int(dev, false, "CamClk", 0);
+	gdev->subdev = subdev;
+	gdev->clock_num = gmin_get_var_int(dev, false, "CamClk", 0);
 	/*WA:CHT requires XTAL clock as PLL is not stable.*/
-	gmin_subdevs[i].clock_src = gmin_get_var_int(dev, false, "ClkSrc",
-				    VLV2_CLK_PLL_19P2MHZ);
-	gmin_subdevs[i].csi_port = gmin_get_var_int(dev, false, "CsiPort", 0);
-	gmin_subdevs[i].csi_lanes = gmin_get_var_int(dev, false, "CsiLanes", 1);
+	gdev->clock_src = gmin_get_var_int(dev, false, "ClkSrc", VLV2_CLK_PLL_19P2MHZ);
+	gdev->csi_port = gmin_get_var_int(dev, false, "CsiPort", 0);
+	gdev->csi_lanes = gmin_get_var_int(dev, false, "CsiLanes", 1);
 
 	/* get PMC clock with clock framework */
-	snprintf(gmin_pmc_clk_name,
-		 sizeof(gmin_pmc_clk_name),
-		 "%s_%d", "pmc_plt_clk", gmin_subdevs[i].clock_num);
-
-	gmin_subdevs[i].pmc_clk = devm_clk_get(dev, gmin_pmc_clk_name);
-	if (IS_ERR(gmin_subdevs[i].pmc_clk)) {
-		ret = PTR_ERR(gmin_subdevs[i].pmc_clk);
-
-		dev_err(dev,
-			"Failed to get clk from %s : %d\n",
-			gmin_pmc_clk_name,
-			ret);
+	snprintf(gmin_pmc_clk_name, sizeof(gmin_pmc_clk_name),
+		 "pmc_plt_clk_%d", gdev->clock_num);
 
+	gdev->pmc_clk = devm_clk_get(dev, gmin_pmc_clk_name);
+	if (IS_ERR(gdev->pmc_clk)) {
+		ret = PTR_ERR(gdev->pmc_clk);
+		dev_err(dev, "Failed to get clk from %s: %d\n", gmin_pmc_clk_name, ret);
 		return NULL;
 	}
 
@@ -528,25 +516,25 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev)
 	 * to disable a clock that has not been enabled,
 	 * we need to enable the clock first.
 	 */
-	ret = clk_prepare_enable(gmin_subdevs[i].pmc_clk);
+	ret = clk_prepare_enable(gdev->pmc_clk);
 	if (!ret)
-		clk_disable_unprepare(gmin_subdevs[i].pmc_clk);
+		clk_disable_unprepare(gdev->pmc_clk);
 
-	gmin_subdevs[i].gpio0 = gpiod_get_index(dev, NULL, 0, GPIOD_OUT_LOW);
-	if (IS_ERR(gmin_subdevs[i].gpio0))
-		gmin_subdevs[i].gpio0 = NULL;
+	gdev->gpio0 = gpiod_get_index(dev, NULL, 0, GPIOD_OUT_LOW);
+	if (IS_ERR(gdev->gpio0))
+		gdev->gpio0 = NULL;
 
-	gmin_subdevs[i].gpio1 = gpiod_get_index(dev, NULL, 1, GPIOD_OUT_LOW);
-	if (IS_ERR(gmin_subdevs[i].gpio1))
-		gmin_subdevs[i].gpio1 = NULL;
+	gdev->gpio1 = gpiod_get_index(dev, NULL, 1, GPIOD_OUT_LOW);
+	if (IS_ERR(gdev->gpio1))
+		gdev->gpio1 = NULL;
 
 	switch (pmic_id) {
 	case PMIC_REGULATOR:
-		gmin_subdevs[i].v1p8_reg = regulator_get(dev, "V1P8SX");
-		gmin_subdevs[i].v2p8_reg = regulator_get(dev, "V2P8SX");
+		gdev->v1p8_reg = regulator_get(dev, "V1P8SX");
+		gdev->v2p8_reg = regulator_get(dev, "V2P8SX");
 
-		gmin_subdevs[i].v1p2_reg = regulator_get(dev, "V1P2A");
-		gmin_subdevs[i].v2p8_vcm_reg = regulator_get(dev, "VPROG4B");
+		gdev->v1p2_reg = regulator_get(dev, "V1P2A");
+		gdev->v2p8_vcm_reg = regulator_get(dev, "VPROG4B");
 
 		/* Note: ideally we would initialize v[12]p8_on to the
 		 * output of regulator_is_enabled(), but sadly that
@@ -558,31 +546,25 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev)
 		break;
 
 	case PMIC_AXP:
-		gmin_subdevs[i].eldo1_1p8v = gmin_get_var_int(dev, false,
-							      "eldo1_1p8v",
-							      ELDO1_1P8V);
-		gmin_subdevs[i].eldo1_sel_reg = gmin_get_var_int(dev, false,
-								 "eldo1_sel_reg",
-								 ELDO1_SEL_REG);
-		gmin_subdevs[i].eldo1_ctrl_shift = gmin_get_var_int(dev, false,
-								    "eldo1_ctrl_shift",
-								    ELDO1_CTRL_SHIFT);
-		gmin_subdevs[i].eldo2_1p8v = gmin_get_var_int(dev, false,
-							      "eldo2_1p8v",
-							      ELDO2_1P8V);
-		gmin_subdevs[i].eldo2_sel_reg = gmin_get_var_int(dev, false,
-								 "eldo2_sel_reg",
-								 ELDO2_SEL_REG);
-		gmin_subdevs[i].eldo2_ctrl_shift = gmin_get_var_int(dev, false,
-								    "eldo2_ctrl_shift",
-								    ELDO2_CTRL_SHIFT);
+		gdev->eldo1_1p8v = gmin_get_var_int(dev, false, "eldo1_1p8v",
+						    ELDO1_1P8V);
+		gdev->eldo1_sel_reg = gmin_get_var_int(dev, false, "eldo1_sel_reg",
+						       ELDO1_SEL_REG);
+		gdev->eldo1_ctrl_shift = gmin_get_var_int(dev, false, "eldo1_ctrl_shift",
+							  ELDO1_CTRL_SHIFT);
+		gdev->eldo2_1p8v = gmin_get_var_int(dev, false, "eldo2_1p8v",
+						    ELDO2_1P8V);
+		gdev->eldo2_sel_reg = gmin_get_var_int(dev, false, "eldo2_sel_reg",
+						       ELDO2_SEL_REG);
+		gdev->eldo2_ctrl_shift = gmin_get_var_int(dev, false, "eldo2_ctrl_shift",
+							  ELDO2_CTRL_SHIFT);
 		break;
 
 	default:
 		break;
 	}
 
-	return &gmin_subdevs[i];
+	return gdev;
 }
 
 static struct gmin_subdev *find_gmin_subdev(struct v4l2_subdev *subdev)
@@ -593,8 +575,14 @@ static struct gmin_subdev *find_gmin_subdev(struct v4l2_subdev *subdev)
 		if (gmin_subdevs[i].subdev == subdev)
 			return &gmin_subdevs[i];
 
+	for (i = 0; i < MAX_SUBDEVS; i++)
+		if (gmin_subdevs[i].subdev == NULL)
+			break;
+	if (i == MAX_SUBDEVS)
+		return NULL;
+
 	gmin_pmic_detect(subdev);
-	return gmin_subdev_add(subdev);
+	return gmin_subdev_add(subdev, &gmin_subdevs[i]);
 }
 
 static int axp_regulator_set(struct device *dev, struct gmin_subdev *gs,
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 14/15] media: atomisp: Get rid of ugly and leaky ACPI handling in gmin_subdev_add()
  2020-06-26 12:19 [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Andy Shevchenko
                   ` (12 preceding siblings ...)
  2020-06-26 12:19 ` [PATCH v2 13/15] media: atomisp: Provide Gmin subdev as parameter to gmin_subdev_add() Andy Shevchenko
@ 2020-06-26 12:19 ` Andy Shevchenko
  2020-06-26 12:19 ` [PATCH v2 15/15] media: atomisp: Deduplicate return ret in gmin_i2c_write() Andy Shevchenko
  2020-06-26 13:29 ` [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Mauro Carvalho Chehab
  15 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2020-06-26 12:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Sakari Ailus; +Cc: Andy Shevchenko

First of all ACPI HID is a part of the device name which is printed
as a part of the dev_info(dev, ...); line. Second, since the only BID
is left, it's a part of ACPI path, which can be printed via %pfw.

Get rid of ugly and leaky ACPI handling in gmin_subdev_add() by replacing it
with %pfw.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 .../media/atomisp/pci/atomisp_gmin_platform.c       | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index d0b9d906a563..7f9e93a9a4b1 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -463,20 +463,9 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev, struct gm
 {
 	struct i2c_client *client = v4l2_get_subdevdata(subdev);
 	struct device *dev = &client->dev;
-	struct acpi_device *adev;
-	acpi_handle handle;
 	int ret;
 
-	handle = ACPI_HANDLE(dev);
-
-	// FIXME: may need to release resources allocated by acpi_bus_get_device()
-	if (!handle || acpi_bus_get_device(handle, &adev)) {
-		dev_err(dev, "Error could not get ACPI device\n");
-		return NULL;
-	}
-
-	dev_info(&client->dev, "%s: ACPI detected it on bus ID=%s, HID=%s\n",
-		__func__, acpi_device_bid(adev), acpi_device_hid(adev));
+	dev_info(&client->dev, "%s: ACPI path is %pfw\n", __func__, dev_fwnode(dev));
 
 	if (power) {
 		gdev->pwm_i2c_addr = power->addr;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 15/15] media: atomisp: Deduplicate return ret in gmin_i2c_write()
  2020-06-26 12:19 [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Andy Shevchenko
                   ` (13 preceding siblings ...)
  2020-06-26 12:19 ` [PATCH v2 14/15] media: atomisp: Get rid of ugly and leaky ACPI handling in gmin_subdev_add() Andy Shevchenko
@ 2020-06-26 12:19 ` Andy Shevchenko
  2020-06-26 13:29 ` [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Mauro Carvalho Chehab
  15 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2020-06-26 12:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Sakari Ailus; +Cc: Andy Shevchenko

Deduplicate return ret in gmin_i2c_write().

While here, replace 'Kernel' by 'kernel' in the message and
reduce amount of LOCs.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 .../staging/media/atomisp/pci/atomisp_gmin_platform.c  | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index 7f9e93a9a4b1..11437161ef20 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -423,16 +423,12 @@ static int gmin_i2c_write(struct device *dev, u16 i2c_addr, u8 reg,
 		"I2C write, addr: 0x%02x, reg: 0x%02x, value: 0x%02x, mask: 0x%02x\n",
 		i2c_addr, reg, value, mask);
 
-	ret = intel_soc_pmic_exec_mipi_pmic_seq_element(i2c_addr, reg,
-							value, mask);
-
-	if (ret == -EOPNOTSUPP) {
+	ret = intel_soc_pmic_exec_mipi_pmic_seq_element(i2c_addr, reg, value, mask);
+	if (ret == -EOPNOTSUPP)
 		dev_err(dev,
 			"ACPI didn't mapped the OpRegion needed to access I2C address 0x%02x.\n"
-			"Need to compile the Kernel using CONFIG_*_PMIC_OPREGION settings\n",
+			"Need to compile the kernel using CONFIG_*_PMIC_OPREGION settings\n",
 			i2c_addr);
-		return ret;
-	}
 
 	return ret;
 }
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail
  2020-06-26 12:19 [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Andy Shevchenko
                   ` (14 preceding siblings ...)
  2020-06-26 12:19 ` [PATCH v2 15/15] media: atomisp: Deduplicate return ret in gmin_i2c_write() Andy Shevchenko
@ 2020-06-26 13:29 ` Mauro Carvalho Chehab
  2020-06-26 14:01   ` Mauro Carvalho Chehab
  15 siblings, 1 reply; 19+ messages in thread
From: Mauro Carvalho Chehab @ 2020-06-26 13:29 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-media, Sakari Ailus

Hi Andy,

Em Fri, 26 Jun 2020 15:19:10 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> escreveu:

> I'm experimenting with it on Baytrail machine and found some issues.
> Along with fixing them I cleaned up a bit this.

Thanks for that! Yeah, I found some issues there myself, although
testing on a device with more than one camera is very nice.

I'll apply your patches on the top of my atomisp tree:

	https://git.linuxtv.org/mchehab/experimental.git/log/?h=atomisp_v5

On a very quick look, I suspect that some may rise some conflicts,
as I did some improvements at the detection logic, in order to get
rid of the ugly DMI match stuff when ACPI has what's needed.

Regards,
Mauro

> 
> So, after applying I have the following log
> 
> # modprobe atomisp
> [  116.215056] atomisp: module is from the staging directory, the quality is unknown, you have been warned.
> [  116.310077] atomisp-isp2 0000:00:03.0: Detected Baytrail version 15 (ISP2400) on VALLEYVIEW C0 (CR) PLATFORM
> [  116.354189] atomisp-isp2 0000:00:03.0: start: 0x50000000
> [  116.376888] atomisp-isp2 0000:00:03.0: atomisp mmio base: 0000000027f9eb1f
> [  116.401267] ACPI: \: failed to evaluate _DSM (0x1001)
> [  116.423479] atomisp-isp2 0000:00:03.0: Failed to find EFI variable 0000:00:03.0_HpllFreq
> [  116.449254] atomisp-isp2 0000:00:03.0: HpllFreq: using default (2000)
> [  116.473045] atomisp-isp2 0000:00:03.0: ISP HPLL frequency base = 2000 MHz
> [  116.770613] atomisp-isp2 0000:00:03.0: Probing Subdev INT33F8:00
> [  116.793750] atomisp-isp2 0000:00:03.0: Subdev INT33F8:00 successfully register
> [  116.818155] atomisp-isp2 0000:00:03.0: raw_index: -1
> [  116.839924] atomisp-isp2 0000:00:03.0: SOC_INDEX: 0
> [  116.861622] atomisp-isp2 0000:00:03.0: Probing Subdev INTCF1C:00
> [  116.896885] lm3554 i2c-INTCF1C:00: Failed to power on lm3554 LED flash
> [  116.920236] atomisp-isp2 0000:00:03.0: Subdev INTCF1C:00 detection fail
> [  116.943649] atomisp-isp2 0000:00:03.0: detected 1 camera sensors
> [  116.966177] atomisp-isp2 0000:00:03.0: atomisp_csi_lane_config: the portconfig is 2-1-0, CSI_CONTROL is 0x0002009C
> [  117.009054] atomisp-isp2 0000:00:03.0: Entity type for entity ATOM ISP CSI2-port0 was not initialized!
> [  117.050772] atomisp-isp2 0000:00:03.0: Entity type for entity ATOM ISP CSI2-port1 was not initialized!
> [  117.050795] atomisp-isp2 0000:00:03.0: Entity type for entity ATOM ISP CSI2-port2 was not initialized!
> [  117.134464] atomisp-isp2 0000:00:03.0: Entity type for entity file_input_subdev was not initialized!
> [  117.176572] atomisp-isp2 0000:00:03.0: Entity type for entity tpg_subdev was not initialized!
> [  117.202301] atomisp-isp2 0000:00:03.0: Entity type for entity ATOMISP_SUBDEV_0 was not initialized!
> [  117.246734] atomisp-isp2 0000:00:03.0: Entity type for entity ATOMISP_SUBDEV_1 was not initialized!
> [  117.290990] atomisp-isp2 0000:00:03.0: FILE_INPUT enable, camera_cnt: 1
> [  117.314607] atomisp-isp2 0000:00:03.0: TPG detected, camera_cnt: 2
> [  117.341386] atomisp-isp2 0000:00:03.0: atomisp_save_iunit_reg
> [  117.363735] atomisp-isp2 0000:00:03.0: DFS target frequency=200.
> [  117.386272] atomisp-isp2 0000:00:03.0: Programming DFS frequency to 200
> [  117.409426] atomisp-isp2 0000:00:03.0: waiting for ISPSSPM1 valid bit to be 0.
> [  117.433323] atomisp-isp2 0000:00:03.0: waiting for ISPSSPM1 valid bit to be 0.
> [  117.457139] atomisp-isp2 0000:00:03.0: atomisp_ospm_dphy_down
> [  117.479800] atomisp-isp2 0000:00:03.0: binary #0  type SP: sp
> [  117.502001] atomisp-isp2 0000:00:03.0: binary #1  type ISP (Normal), binary id is  0: isp_copy_var
> [  117.542907] atomisp-isp2 0000:00:03.0: binary #2  type ISP (Normal), binary id is  2: isp_vf_pp_full
> [  117.584666] atomisp-isp2 0000:00:03.0: binary #3  type ISP (Normal), binary id is  3: isp_vf_pp_opt
> [  117.626806] atomisp-isp2 0000:00:03.0: binary #4  type ISP (Normal), binary id is 60: isp_capture_pp_var_bli
> [  117.670360] atomisp-isp2 0000:00:03.0: binary #5  type ISP (Normal), binary id is 61: isp_capture_pp_ldc
> [  117.713655] atomisp-isp2 0000:00:03.0: binary #6  type ISP (Normal), binary id is  5: isp_capture_pp_var
> [  117.757345] atomisp-isp2 0000:00:03.0: binary #7  type ISP (Normal), binary id is  4: isp_yuv_scale_var
> [  117.801371] atomisp-isp2 0000:00:03.0: binary #8  type ISP (Normal), binary id is  6: isp_preisp_var
> [  117.845621] atomisp-isp2 0000:00:03.0: binary #9  type ISP (Normal), binary id is  7: isp_preisp_var_isp2
> [  117.890913] atomisp-isp2 0000:00:03.0: binary #10 type ISP (Normal), binary id is 58: isp_pre_de_var_isp2
> [  117.936321] atomisp-isp2 0000:00:03.0: binary #11 type ISP (Normal), binary id is  8: isp_gdc_var
> [  117.963840] atomisp-isp2 0000:00:03.0: binary #12 type ISP (Normal), binary id is 11: isp_anr_var
> [  117.991190] atomisp-isp2 0000:00:03.0: binary #13 type ISP (Normal), binary id is 12: isp_anr_var_isp2
> [  118.035988] atomisp-isp2 0000:00:03.0: binary #14 type ISP (Normal), binary id is  9: isp_postisp_var
> [  118.081148] atomisp-isp2 0000:00:03.0: binary #15 type ISP (Normal), binary id is 10: isp_postisp_var_isp2
> [  118.127374] atomisp-isp2 0000:00:03.0: binary #16 type ISP (Normal), binary id is 15: isp_preview_dec
> [  118.173707] atomisp-isp2 0000:00:03.0: binary #17 type ISP (Normal), binary id is 16: isp_preview_cont_bds125_isp2
> [  118.221920] atomisp-isp2 0000:00:03.0: binary #18 type ISP (Normal), binary id is 18: isp_preview_cont_bds150_isp2
> [  118.270412] atomisp-isp2 0000:00:03.0: binary #19 type ISP (Normal), binary id is 20: isp_preview_cont_bds200_isp2
> [  118.318942] atomisp-isp2 0000:00:03.0: binary #20 type ISP (Normal), binary id is 21: isp_preview_var
> [  118.366572] atomisp-isp2 0000:00:03.0: binary #21 type ISP (Normal), binary id is 22: isp_preview_var_isp2
> [  118.415086] atomisp-isp2 0000:00:03.0: binary #22 type ISP (Normal), binary id is 27: isp_primary_striped
> [  118.464002] atomisp-isp2 0000:00:03.0: binary #23 type ISP (Normal), binary id is 28: isp_primary_striped_isp2
> [  118.514097] atomisp-isp2 0000:00:03.0: binary #24 type ISP (Normal), binary id is 24: isp_primary_var
> [  118.564053] atomisp-isp2 0000:00:03.0: binary #25 type ISP (Normal), binary id is 25: isp_primary_var_isp2
> [  118.615276] atomisp-isp2 0000:00:03.0: binary #26 type ISP (Normal), binary id is 26: isp_primary_small
> [  118.666737] atomisp-isp2 0000:00:03.0: binary #27 type ISP (Normal), binary id is 29: isp_primary_8mp
> [  118.718346] atomisp-isp2 0000:00:03.0: binary #28 type ISP (Normal), binary id is 30: isp_primary_14mp
> [  118.770053] atomisp-isp2 0000:00:03.0: binary #29 type ISP (Normal), binary id is 31: isp_primary_16mp
> [  118.821763] atomisp-isp2 0000:00:03.0: binary #30 type ISP (Normal), binary id is 33: isp_primary_isp261_stage0
> [  118.874370] atomisp-isp2 0000:00:03.0: binary #31 type ISP (Normal), binary id is 34: isp_primary_isp261_stage1
> [  118.926992] atomisp-isp2 0000:00:03.0: binary #32 type ISP (Normal), binary id is 35: isp_primary_isp261_stage2
> [  118.979792] atomisp-isp2 0000:00:03.0: binary #33 type ISP (Normal), binary id is 36: isp_primary_isp261_stage3
> [  119.032714] atomisp-isp2 0000:00:03.0: binary #34 type ISP (Normal), binary id is 37: isp_primary_isp261_stage4
> [  119.085749] atomisp-isp2 0000:00:03.0: binary #35 type ISP (Normal), binary id is 38: isp_primary_isp261_stage5
> [  119.139422] atomisp-isp2 0000:00:03.0: binary #36 type ISP (Normal), binary id is 42: isp_video_dz
> [  119.192607] atomisp-isp2 0000:00:03.0: binary #37 type ISP (Normal), binary id is 44: isp_video_high
> [  119.246768] atomisp-isp2 0000:00:03.0: binary #38 type ISP (Normal), binary id is 45: isp_video_nodz
> [  119.301793] atomisp-isp2 0000:00:03.0: binary #39 type ISP (Normal), binary id is 46: isp_video_cont_multibds_isp2_min
> [  119.359159] atomisp-isp2 0000:00:03.0: binary #40 type ISP (Normal), binary id is 47: isp_video_cont_bds_300_600_isp2_min
> [  119.416880] atomisp-isp2 0000:00:03.0: binary #41 type ISP (Normal), binary id is 49: isp_video_cont_bds150_isp2_min
> [  119.474102] atomisp-isp2 0000:00:03.0: binary #42 type ISP (Normal), binary id is 51: isp_video_cont_bds200_isp2_min
> [  119.531365] atomisp-isp2 0000:00:03.0: binary #43 type ISP (Normal), binary id is 52: isp_video_cont_nobds_isp2_min
> [  119.588595] atomisp-isp2 0000:00:03.0: binary #44 type ISP (Normal), binary id is 53: isp_video_dz_isp2_min
> [  119.644981] atomisp-isp2 0000:00:03.0: binary #45 type ISP (Normal), binary id is 54: isp_video_dz_isp2
> [  119.701015] atomisp-isp2 0000:00:03.0: binary #46 type ISP (Normal), binary id is 55: isp_video_lp_isp2
> 
> 
> Andy Shevchenko (15):
>   media: atomisp: Replace last use of Intel MID APIs
>   media: atomisp: move CCK endpoint address to generic header
>   media: atomisp: Use proper APIs to find I²C client device by ACPI HID
>   media: atomisp: don't pass struct device_driver as parameter
>   media: atomisp: Get rid of struct pci_dev in struct atomisp_device
>   media: atomisp: Unify pdev to be pointer to struct pci_device
>   media: atomisp: Replace direct access to MMIO with proper helpers
>   media: atomisp: Drop global atomisp_dev variable (easy cases)
>   media: atomisp: make platform data more readable
>   media: atomisp: Don't try to parse unexpected ACPI object type
>   media: atomisp: Make pointer to PMIC client global
>   media: atomisp: Refactor PMIC detection to a separate function.
>   media: atomisp: Provide Gmin subdev as parameter to gmin_subdev_add()
>   media: atomisp: Get rid of ugly and leaky ACPI handling in
>     gmin_subdev_add()
>   media: atomisp: Deduplicate return ret in gmin_i2c_write()
> 
>  arch/x86/include/asm/iosf_mbi.h               |   1 +
>  .../atomisp/include/linux/atomisp_platform.h  |   1 +
>  .../staging/media/atomisp/pci/atomisp-regs.h  |   3 -
>  .../staging/media/atomisp/pci/atomisp_acc.c   |   4 +-
>  .../staging/media/atomisp/pci/atomisp_cmd.c   |  57 ++--
>  .../staging/media/atomisp/pci/atomisp_cmd.h   |   4 +-
>  .../media/atomisp/pci/atomisp_compat.h        |   2 -
>  .../media/atomisp/pci/atomisp_compat_css20.c  |  64 ++--
>  .../media/atomisp/pci/atomisp_compat_css20.h  |   2 +-
>  .../staging/media/atomisp/pci/atomisp_drvfs.c |  14 +-
>  .../staging/media/atomisp/pci/atomisp_drvfs.h |   2 +-
>  .../media/atomisp/pci/atomisp_gmin_platform.c | 220 +++++++-------
>  .../media/atomisp/pci/atomisp_internal.h      |   2 +-
>  .../staging/media/atomisp/pci/atomisp_ioctl.c |  19 +-
>  .../staging/media/atomisp/pci/atomisp_v4l2.c  | 277 ++++++++----------
>  15 files changed, 311 insertions(+), 361 deletions(-)
> 



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail
  2020-06-26 13:29 ` [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Mauro Carvalho Chehab
@ 2020-06-26 14:01   ` Mauro Carvalho Chehab
  2020-06-29 10:53     ` Andy Shevchenko
  0 siblings, 1 reply; 19+ messages in thread
From: Mauro Carvalho Chehab @ 2020-06-26 14:01 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-media, Sakari Ailus

Em Fri, 26 Jun 2020 15:29:53 +0200
Mauro Carvalho Chehab <mchehab@kernel.org> escreveu:

> Hi Andy,
> 
> Em Fri, 26 Jun 2020 15:19:10 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> escreveu:
> 
> > I'm experimenting with it on Baytrail machine and found some issues.
> > Along with fixing them I cleaned up a bit this.
> 
> Thanks for that! Yeah, I found some issues there myself, although
> testing on a device with more than one camera is very nice.
> 
> I'll apply your patches on the top of my atomisp tree:
> 
> 	https://git.linuxtv.org/mchehab/experimental.git/log/?h=atomisp_v5
> 
> On a very quick look, I suspect that some may rise some conflicts,
> as I did some improvements at the detection logic, in order to get
> rid of the ugly DMI match stuff when ACPI has what's needed.
> 
> Regards,
> Mauro
> 
> > 
> > So, after applying I have the following log
> > 
> > # modprobe atomisp
> > [  116.215056] atomisp: module is from the staging directory, the quality is unknown, you have been warned.
> > [  116.310077] atomisp-isp2 0000:00:03.0: Detected Baytrail version 15 (ISP2400) on VALLEYVIEW C0 (CR) PLATFORM
> > [  116.354189] atomisp-isp2 0000:00:03.0: start: 0x50000000
> > [  116.376888] atomisp-isp2 0000:00:03.0: atomisp mmio base: 0000000027f9eb1f
> > [  116.401267] ACPI: \: failed to evaluate _DSM (0x1001)
> > [  116.423479] atomisp-isp2 0000:00:03.0: Failed to find EFI variable 0000:00:03.0_HpllFreq
> > [  116.449254] atomisp-isp2 0000:00:03.0: HpllFreq: using default (2000)
> > [  116.473045] atomisp-isp2 0000:00:03.0: ISP HPLL frequency base = 2000 MHz
> > [  116.770613] atomisp-isp2 0000:00:03.0: Probing Subdev INT33F8:00
> > [  116.793750] atomisp-isp2 0000:00:03.0: Subdev INT33F8:00 successfully register
> > [  116.818155] atomisp-isp2 0000:00:03.0: raw_index: -1
> > [  116.839924] atomisp-isp2 0000:00:03.0: SOC_INDEX: 0
> > [  116.861622] atomisp-isp2 0000:00:03.0: Probing Subdev INTCF1C:00
> > [  116.896885] lm3554 i2c-INTCF1C:00: Failed to power on lm3554 LED flash
> > [  116.920236] atomisp-isp2 0000:00:03.0: Subdev INTCF1C:00 detection fail
> > [  116.943649] atomisp-isp2 0000:00:03.0: detected 1 camera sensors
> > [  116.966177] atomisp-isp2 0000:00:03.0: atomisp_csi_lane_config: the portconfig is 2-1-0, CSI_CONTROL is 0x0002009C
> > [  117.009054] atomisp-isp2 0000:00:03.0: Entity type for entity ATOM ISP CSI2-port0 was not initialized!
> > [  117.050772] atomisp-isp2 0000:00:03.0: Entity type for entity ATOM ISP CSI2-port1 was not initialized!
> > [  117.050795] atomisp-isp2 0000:00:03.0: Entity type for entity ATOM ISP CSI2-port2 was not initialized!
> > [  117.134464] atomisp-isp2 0000:00:03.0: Entity type for entity file_input_subdev was not initialized!
> > [  117.176572] atomisp-isp2 0000:00:03.0: Entity type for entity tpg_subdev was not initialized!
> > [  117.202301] atomisp-isp2 0000:00:03.0: Entity type for entity ATOMISP_SUBDEV_0 was not initialized!
> > [  117.246734] atomisp-isp2 0000:00:03.0: Entity type for entity ATOMISP_SUBDEV_1 was not initialized!
> > [  117.290990] atomisp-isp2 0000:00:03.0: FILE_INPUT enable, camera_cnt: 1
> > [  117.314607] atomisp-isp2 0000:00:03.0: TPG detected, camera_cnt: 2
> > [  117.341386] atomisp-isp2 0000:00:03.0: atomisp_save_iunit_reg
> > [  117.363735] atomisp-isp2 0000:00:03.0: DFS target frequency=200.
> > [  117.386272] atomisp-isp2 0000:00:03.0: Programming DFS frequency to 200
> > [  117.409426] atomisp-isp2 0000:00:03.0: waiting for ISPSSPM1 valid bit to be 0.
> > [  117.433323] atomisp-isp2 0000:00:03.0: waiting for ISPSSPM1 valid bit to be 0.
> > [  117.457139] atomisp-isp2 0000:00:03.0: atomisp_ospm_dphy_down
> > [  117.479800] atomisp-isp2 0000:00:03.0: binary #0  type SP: sp
> > [  117.502001] atomisp-isp2 0000:00:03.0: binary #1  type ISP (Normal), binary id is  0: isp_copy_var
> > [  117.542907] atomisp-isp2 0000:00:03.0: binary #2  type ISP (Normal), binary id is  2: isp_vf_pp_full
> > [  117.584666] atomisp-isp2 0000:00:03.0: binary #3  type ISP (Normal), binary id is  3: isp_vf_pp_opt
> > [  117.626806] atomisp-isp2 0000:00:03.0: binary #4  type ISP (Normal), binary id is 60: isp_capture_pp_var_bli
> > [  117.670360] atomisp-isp2 0000:00:03.0: binary #5  type ISP (Normal), binary id is 61: isp_capture_pp_ldc
> > [  117.713655] atomisp-isp2 0000:00:03.0: binary #6  type ISP (Normal), binary id is  5: isp_capture_pp_var
> > [  117.757345] atomisp-isp2 0000:00:03.0: binary #7  type ISP (Normal), binary id is  4: isp_yuv_scale_var
> > [  117.801371] atomisp-isp2 0000:00:03.0: binary #8  type ISP (Normal), binary id is  6: isp_preisp_var
> > [  117.845621] atomisp-isp2 0000:00:03.0: binary #9  type ISP (Normal), binary id is  7: isp_preisp_var_isp2
> > [  117.890913] atomisp-isp2 0000:00:03.0: binary #10 type ISP (Normal), binary id is 58: isp_pre_de_var_isp2
> > [  117.936321] atomisp-isp2 0000:00:03.0: binary #11 type ISP (Normal), binary id is  8: isp_gdc_var
> > [  117.963840] atomisp-isp2 0000:00:03.0: binary #12 type ISP (Normal), binary id is 11: isp_anr_var
> > [  117.991190] atomisp-isp2 0000:00:03.0: binary #13 type ISP (Normal), binary id is 12: isp_anr_var_isp2
> > [  118.035988] atomisp-isp2 0000:00:03.0: binary #14 type ISP (Normal), binary id is  9: isp_postisp_var
> > [  118.081148] atomisp-isp2 0000:00:03.0: binary #15 type ISP (Normal), binary id is 10: isp_postisp_var_isp2
> > [  118.127374] atomisp-isp2 0000:00:03.0: binary #16 type ISP (Normal), binary id is 15: isp_preview_dec
> > [  118.173707] atomisp-isp2 0000:00:03.0: binary #17 type ISP (Normal), binary id is 16: isp_preview_cont_bds125_isp2
> > [  118.221920] atomisp-isp2 0000:00:03.0: binary #18 type ISP (Normal), binary id is 18: isp_preview_cont_bds150_isp2
> > [  118.270412] atomisp-isp2 0000:00:03.0: binary #19 type ISP (Normal), binary id is 20: isp_preview_cont_bds200_isp2
> > [  118.318942] atomisp-isp2 0000:00:03.0: binary #20 type ISP (Normal), binary id is 21: isp_preview_var
> > [  118.366572] atomisp-isp2 0000:00:03.0: binary #21 type ISP (Normal), binary id is 22: isp_preview_var_isp2
> > [  118.415086] atomisp-isp2 0000:00:03.0: binary #22 type ISP (Normal), binary id is 27: isp_primary_striped
> > [  118.464002] atomisp-isp2 0000:00:03.0: binary #23 type ISP (Normal), binary id is 28: isp_primary_striped_isp2
> > [  118.514097] atomisp-isp2 0000:00:03.0: binary #24 type ISP (Normal), binary id is 24: isp_primary_var
> > [  118.564053] atomisp-isp2 0000:00:03.0: binary #25 type ISP (Normal), binary id is 25: isp_primary_var_isp2
> > [  118.615276] atomisp-isp2 0000:00:03.0: binary #26 type ISP (Normal), binary id is 26: isp_primary_small
> > [  118.666737] atomisp-isp2 0000:00:03.0: binary #27 type ISP (Normal), binary id is 29: isp_primary_8mp
> > [  118.718346] atomisp-isp2 0000:00:03.0: binary #28 type ISP (Normal), binary id is 30: isp_primary_14mp
> > [  118.770053] atomisp-isp2 0000:00:03.0: binary #29 type ISP (Normal), binary id is 31: isp_primary_16mp
> > [  118.821763] atomisp-isp2 0000:00:03.0: binary #30 type ISP (Normal), binary id is 33: isp_primary_isp261_stage0
> > [  118.874370] atomisp-isp2 0000:00:03.0: binary #31 type ISP (Normal), binary id is 34: isp_primary_isp261_stage1
> > [  118.926992] atomisp-isp2 0000:00:03.0: binary #32 type ISP (Normal), binary id is 35: isp_primary_isp261_stage2
> > [  118.979792] atomisp-isp2 0000:00:03.0: binary #33 type ISP (Normal), binary id is 36: isp_primary_isp261_stage3
> > [  119.032714] atomisp-isp2 0000:00:03.0: binary #34 type ISP (Normal), binary id is 37: isp_primary_isp261_stage4
> > [  119.085749] atomisp-isp2 0000:00:03.0: binary #35 type ISP (Normal), binary id is 38: isp_primary_isp261_stage5
> > [  119.139422] atomisp-isp2 0000:00:03.0: binary #36 type ISP (Normal), binary id is 42: isp_video_dz
> > [  119.192607] atomisp-isp2 0000:00:03.0: binary #37 type ISP (Normal), binary id is 44: isp_video_high
> > [  119.246768] atomisp-isp2 0000:00:03.0: binary #38 type ISP (Normal), binary id is 45: isp_video_nodz
> > [  119.301793] atomisp-isp2 0000:00:03.0: binary #39 type ISP (Normal), binary id is 46: isp_video_cont_multibds_isp2_min
> > [  119.359159] atomisp-isp2 0000:00:03.0: binary #40 type ISP (Normal), binary id is 47: isp_video_cont_bds_300_600_isp2_min
> > [  119.416880] atomisp-isp2 0000:00:03.0: binary #41 type ISP (Normal), binary id is 49: isp_video_cont_bds150_isp2_min
> > [  119.474102] atomisp-isp2 0000:00:03.0: binary #42 type ISP (Normal), binary id is 51: isp_video_cont_bds200_isp2_min
> > [  119.531365] atomisp-isp2 0000:00:03.0: binary #43 type ISP (Normal), binary id is 52: isp_video_cont_nobds_isp2_min
> > [  119.588595] atomisp-isp2 0000:00:03.0: binary #44 type ISP (Normal), binary id is 53: isp_video_dz_isp2_min
> > [  119.644981] atomisp-isp2 0000:00:03.0: binary #45 type ISP (Normal), binary id is 54: isp_video_dz_isp2
> > [  119.701015] atomisp-isp2 0000:00:03.0: binary #46 type ISP (Normal), binary id is 55: isp_video_lp_isp2
> > 

Ok, I merged the patches on my atomisp tree:

	https://git.linuxtv.org/mchehab/experimental.git/log/?h=atomisp_v5

I'll wait for Sakari's review on them (and on my patches) before applying
on media master tree.

As some of the stuff here are fixes (and this driver is new for 5.8),
I'll probably submit them to v5.8-rc.

> > 
> > Andy Shevchenko (15):
> >   media: atomisp: Replace last use of Intel MID APIs
> >   media: atomisp: move CCK endpoint address to generic header
> >   media: atomisp: Use proper APIs to find I²C client device by ACPI HID
> >   media: atomisp: don't pass struct device_driver as parameter
> >   media: atomisp: Get rid of struct pci_dev in struct atomisp_device
> >   media: atomisp: Unify pdev to be pointer to struct pci_device
> >   media: atomisp: Replace direct access to MMIO with proper helpers
> >   media: atomisp: Drop global atomisp_dev variable (easy cases)
> >   media: atomisp: make platform data more readable
> >   media: atomisp: Don't try to parse unexpected ACPI object type

The above patches applied fine.

> >   media: atomisp: Make pointer to PMIC client global

I had to rebase this one, but also applied fine.

> >   media: atomisp: Refactor PMIC detection to a separate function.
> >   media: atomisp: Provide Gmin subdev as parameter to gmin_subdev_add()

Could you please rebase those on the top of my atomisp branch? 

> >   media: atomisp: Get rid of ugly and leaky ACPI handling in
> >     gmin_subdev_add()

The part of the code that used to call acpi_bus_get_device() was
already removed by a previous patch on my tree. So, I guess this one
may not be needed anymore.

> >   media: atomisp: Deduplicate return ret in gmin_i2c_write()

This one also applied as-is.

Thanks,
Mauro

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail
  2020-06-26 14:01   ` Mauro Carvalho Chehab
@ 2020-06-29 10:53     ` Andy Shevchenko
  0 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2020-06-29 10:53 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media, Sakari Ailus

On Fri, Jun 26, 2020 at 04:01:41PM +0200, Mauro Carvalho Chehab wrote:
> Em Fri, 26 Jun 2020 15:29:53 +0200
> Mauro Carvalho Chehab <mchehab@kernel.org> escreveu:
> > Em Fri, 26 Jun 2020 15:19:10 +0300
> > Andy Shevchenko <andriy.shevchenko@linux.intel.com> escreveu:

> > >   media: atomisp: Refactor PMIC detection to a separate function.
> > >   media: atomisp: Provide Gmin subdev as parameter to gmin_subdev_add()
> 
> Could you please rebase those on the top of my atomisp branch? 
> 
> > >   media: atomisp: Get rid of ugly and leaky ACPI handling in
> > >     gmin_subdev_add()
> 
> The part of the code that used to call acpi_bus_get_device() was
> already removed by a previous patch on my tree. So, I guess this one
> may not be needed anymore.

Mentioned above have been rebased and I'm about to send a v2.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2020-06-29 19:28 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-26 12:19 [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Andy Shevchenko
2020-06-26 12:19 ` [PATCH v2 01/15] media: atomisp: Replace last use of Intel MID APIs Andy Shevchenko
2020-06-26 12:19 ` [PATCH v2 02/15] media: atomisp: move CCK endpoint address to generic header Andy Shevchenko
2020-06-26 12:19 ` [PATCH v2 03/15] media: atomisp: Use proper APIs to find I²C client device by ACPI HID Andy Shevchenko
2020-06-26 12:19 ` [PATCH v2 04/15] media: atomisp: don't pass struct device_driver as parameter Andy Shevchenko
2020-06-26 12:19 ` [PATCH v2 05/15] media: atomisp: Get rid of struct pci_dev in struct atomisp_device Andy Shevchenko
2020-06-26 12:19 ` [PATCH v2 06/15] media: atomisp: Unify pdev to be pointer to struct pci_device Andy Shevchenko
2020-06-26 12:19 ` [PATCH v2 07/15] media: atomisp: Replace direct access to MMIO with proper helpers Andy Shevchenko
2020-06-26 12:19 ` [PATCH v2 08/15] media: atomisp: Drop global atomisp_dev variable (easy cases) Andy Shevchenko
2020-06-26 12:19 ` [PATCH v2 09/15] media: atomisp: make platform data more readable Andy Shevchenko
2020-06-26 12:19 ` [PATCH v2 10/15] media: atomisp: Don't try to parse unexpected ACPI object type Andy Shevchenko
2020-06-26 12:19 ` [PATCH v2 11/15] media: atomisp: Make pointer to PMIC client global Andy Shevchenko
2020-06-26 12:19 ` [PATCH v2 12/15] media: atomisp: Refactor PMIC detection to a separate function Andy Shevchenko
2020-06-26 12:19 ` [PATCH v2 13/15] media: atomisp: Provide Gmin subdev as parameter to gmin_subdev_add() Andy Shevchenko
2020-06-26 12:19 ` [PATCH v2 14/15] media: atomisp: Get rid of ugly and leaky ACPI handling in gmin_subdev_add() Andy Shevchenko
2020-06-26 12:19 ` [PATCH v2 15/15] media: atomisp: Deduplicate return ret in gmin_i2c_write() Andy Shevchenko
2020-06-26 13:29 ` [PATCH v2 00/15] media: atomisp: Clean ups and fixes to make it load on Baytrail Mauro Carvalho Chehab
2020-06-26 14:01   ` Mauro Carvalho Chehab
2020-06-29 10:53     ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).