Skip to content

Commit d15be54

Browse files
committed
Merge tag 'media/v5.8-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media into master
Pull media fixes from Mauro Carvalho Chehab: "A series of fixes for the upcoming atomisp driver. They solve issues when probing atomisp on devices with multiple cameras and get rid of warnings when built with W=1. The diffstat is a bit long, as this driver has several abstractions. The patches that solved the issues with W=1 had to get rid of some duplicated code (there used to have 2 versions of the same code, one for ISP2401 and another one for ISP2400). As this driver is not in 5.7, such changes won't cause regressions" * tag 'media/v5.8-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (38 commits) Revert "media: atomisp: keep the ISP powered on when setting it" media: atomisp: fix mask and shift operation on ISPSSPM0 media: atomisp: move system_local consts into a C file media: atomisp: get rid of version-specific system_local.h media: atomisp: move global stuff into a common header media: atomisp: remove non-used 32-bits consts at system_local media: atomisp: get rid of some unused static vars media: atomisp: Fix error code in ov5693_probe() media: atomisp: Replace trace_printk by pr_info media: atomisp: Fix __func__ style warnings media: atomisp: fix help message for ISP2401 selection media: atomisp: i2c: atomisp-ov2680.c: fixed a brace coding style issue. media: atomisp: make const arrays static, makes object smaller media: atomisp: Clean up non-existing folders from Makefile media: atomisp: Get rid of ACPI specifics in gmin_subdev_add() media: atomisp: Provide Gmin subdev as parameter to gmin_subdev_add() media: atomisp: Use temporary variable for device in gmin_subdev_add() media: atomisp: Refactor PMIC detection to a separate function media: atomisp: Deduplicate return ret in gmin_i2c_write() media: atomisp: Make pointer to PMIC client global ...
2 parents 071fb1b + 0d6db85 commit d15be54

30 files changed

+1280
-1929
lines changed

arch/x86/include/asm/iosf_mbi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#define BT_MBI_UNIT_PMC 0x04
4040
#define BT_MBI_UNIT_GFX 0x06
4141
#define BT_MBI_UNIT_SMI 0x0C
42+
#define BT_MBI_UNIT_CCK 0x14
4243
#define BT_MBI_UNIT_USB 0x43
4344
#define BT_MBI_UNIT_SATA 0xA3
4445
#define BT_MBI_UNIT_PCIE 0xA6

drivers/staging/media/atomisp/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ config VIDEO_ATOMISP
2222
module will be called atomisp
2323

2424
config VIDEO_ATOMISP_ISP2401
25-
bool "VIDEO_ATOMISP_ISP2401"
25+
bool "Use Intel Atom ISP on Cherrytail/Anniedale (ISP2401)"
2626
depends on VIDEO_ATOMISP
2727
help
2828
Enable support for Atom ISP2401-based boards.

drivers/staging/media/atomisp/Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ atomisp-objs += \
156156
pci/hive_isp_css_common/host/timed_ctrl.o \
157157
pci/hive_isp_css_common/host/vmem.o \
158158
pci/hive_isp_css_shared/host/tag.o \
159+
pci/system_local.o \
159160

160161
obj-byt = \
161162
pci/css_2400_system/hive/ia_css_isp_configs.o \
@@ -182,7 +183,6 @@ INCLUDES += \
182183
-I$(atomisp)/include/hmm/ \
183184
-I$(atomisp)/include/mmu/ \
184185
-I$(atomisp)/pci/ \
185-
-I$(atomisp)/pci/hrt/ \
186186
-I$(atomisp)/pci/base/circbuf/interface/ \
187187
-I$(atomisp)/pci/base/refcount/interface/ \
188188
-I$(atomisp)/pci/camera/pipe/interface/ \
@@ -192,7 +192,6 @@ INCLUDES += \
192192
-I$(atomisp)/pci/hive_isp_css_include/ \
193193
-I$(atomisp)/pci/hive_isp_css_include/device_access/ \
194194
-I$(atomisp)/pci/hive_isp_css_include/host/ \
195-
-I$(atomisp)/pci/hive_isp_css_include/memory_access/ \
196195
-I$(atomisp)/pci/hive_isp_css_shared/ \
197196
-I$(atomisp)/pci/hive_isp_css_shared/host/ \
198197
-I$(atomisp)/pci/isp/kernels/ \
@@ -311,17 +310,14 @@ INCLUDES += \
311310
-I$(atomisp)/pci/runtime/tagger/interface/
312311

313312
INCLUDES_byt += \
314-
-I$(atomisp)/pci/css_2400_system/ \
315313
-I$(atomisp)/pci/css_2400_system/hive/ \
316-
-I$(atomisp)/pci/css_2400_system/hrt/ \
317314

318315
INCLUDES_cht += \
319316
-I$(atomisp)/pci/css_2401_system/ \
320317
-I$(atomisp)/pci/css_2401_system/host/ \
321318
-I$(atomisp)/pci/css_2401_system/hive/ \
322319
-I$(atomisp)/pci/css_2401_system/hrt/ \
323320

324-
# -I$(atomisp)/pci/css_2401_system/hrt/ \
325321
# -I$(atomisp)/pci/css_2401_system/hive_isp_css_2401_system_generated/ \
326322
327323
DEFINES := -DHRT_HW -DHRT_ISP_CSS_CUSTOM_HOST -DHRT_USE_VIR_ADDRS -D__HOST__

drivers/staging/media/atomisp/i2c/atomisp-ov2680.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,11 +495,11 @@ static int ov2680_h_flip(struct v4l2_subdev *sd, s32 value)
495495
ret = ov2680_read_reg(client, 1, OV2680_MIRROR_REG, &val);
496496
if (ret)
497497
return ret;
498-
if (value) {
498+
if (value)
499499
val |= OV2680_FLIP_MIRROR_BIT_ENABLE;
500-
} else {
500+
else
501501
val &= ~OV2680_FLIP_MIRROR_BIT_ENABLE;
502-
}
502+
503503
ret = ov2680_write_reg(client, 1,
504504
OV2680_MIRROR_REG, val);
505505
if (ret)

drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,7 @@ static int ov5693_probe(struct i2c_client *client)
18991899
{
19001900
struct ov5693_device *dev;
19011901
int i2c;
1902-
int ret = 0;
1902+
int ret;
19031903
void *pdata;
19041904
unsigned int i;
19051905

@@ -1929,8 +1929,10 @@ static int ov5693_probe(struct i2c_client *client)
19291929
pdata = gmin_camera_platform_data(&dev->sd,
19301930
ATOMISP_INPUT_FORMAT_RAW_10,
19311931
atomisp_bayer_order_bggr);
1932-
if (!pdata)
1932+
if (!pdata) {
1933+
ret = -EINVAL;
19331934
goto out_free;
1935+
}
19341936

19351937
ret = ov5693_s_config(&dev->sd, client->irq, pdata);
19361938
if (ret)

drivers/staging/media/atomisp/include/linux/atomisp_platform.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ const struct atomisp_camera_caps *atomisp_get_default_camera_caps(void);
250250
#define IS_MFLD __IS_SOC(INTEL_FAM6_ATOM_SALTWELL_MID)
251251
#define IS_BYT __IS_SOC(INTEL_FAM6_ATOM_SILVERMONT)
252252
#define IS_CHT __IS_SOC(INTEL_FAM6_ATOM_AIRMONT)
253+
#define IS_MRFD __IS_SOC(INTEL_FAM6_ATOM_SILVERMONT_MID)
253254
#define IS_MOFD __IS_SOC(INTEL_FAM6_ATOM_AIRMONT_MID)
254255

255256
/* Both CHT and MOFD come with ISP2401 */

drivers/staging/media/atomisp/pci/atomisp-regs.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
#define ATOMISP_REGS_H
2121

2222
/* common register definitions */
23-
#define PUNIT_PORT 0x04
24-
#define CCK_PORT 0x14
25-
2623
#define PCICMDSTS 0x01
2724
#define INTR 0x0f
2825
#define MSI_CAPID 0x24

drivers/staging/media/atomisp/pci/atomisp_acc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,11 @@ int atomisp_acc_map(struct atomisp_sub_device *asd, struct atomisp_acc_map *map)
355355

356356
pgnr = DIV_ROUND_UP(map->length, PAGE_SIZE);
357357
if (pgnr < ((PAGE_ALIGN(map->length)) >> PAGE_SHIFT)) {
358-
dev_err(atomisp_dev,
358+
dev_err(asd->isp->dev,
359359
"user space memory size is less than the expected size..\n");
360360
return -ENOMEM;
361361
} else if (pgnr > ((PAGE_ALIGN(map->length)) >> PAGE_SHIFT)) {
362-
dev_err(atomisp_dev,
362+
dev_err(asd->isp->dev,
363363
"user space memory size is large than the expected size..\n");
364364
return -ENOMEM;
365365
}

drivers/staging/media/atomisp/pci/atomisp_cmd.c

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/firmware.h>
2222
#include <linux/pci.h>
2323
#include <linux/interrupt.h>
24+
#include <linux/io.h>
2425
#include <linux/kernel.h>
2526
#include <linux/kfifo.h>
2627
#include <linux/pm_runtime.h>
@@ -109,7 +110,7 @@ struct atomisp_acc_pipe *atomisp_to_acc_pipe(struct video_device *dev)
109110

110111
static unsigned short atomisp_get_sensor_fps(struct atomisp_sub_device *asd)
111112
{
112-
struct v4l2_subdev_frame_interval fi;
113+
struct v4l2_subdev_frame_interval fi = { 0 };
113114
struct atomisp_device *isp = asd->isp;
114115

115116
unsigned short fps = 0;
@@ -206,6 +207,7 @@ int atomisp_freq_scaling(struct atomisp_device *isp,
206207
enum atomisp_dfs_mode mode,
207208
bool force)
208209
{
210+
struct pci_dev *pdev = to_pci_dev(isp->dev);
209211
/* FIXME! Only use subdev[0] status yet */
210212
struct atomisp_sub_device *asd = &isp->asd[0];
211213
const struct atomisp_dfs_config *dfs;
@@ -219,7 +221,7 @@ int atomisp_freq_scaling(struct atomisp_device *isp,
219221
return -EINVAL;
220222
}
221223

222-
if ((isp->pdev->device & ATOMISP_PCI_DEVICE_SOC_MASK) ==
224+
if ((pdev->device & ATOMISP_PCI_DEVICE_SOC_MASK) ==
223225
ATOMISP_PCI_DEVICE_SOC_CHT && ATOMISP_USE_YUVPP(asd))
224226
isp->dfs = &dfs_config_cht_soc;
225227

@@ -357,39 +359,41 @@ static void clear_isp_irq(enum hrt_isp_css_irq irq)
357359
irq_clear_all(IRQ0_ID);
358360
}
359361

360-
void atomisp_msi_irq_init(struct atomisp_device *isp, struct pci_dev *dev)
362+
void atomisp_msi_irq_init(struct atomisp_device *isp)
361363
{
364+
struct pci_dev *pdev = to_pci_dev(isp->dev);
362365
u32 msg32;
363366
u16 msg16;
364367

365-
pci_read_config_dword(dev, PCI_MSI_CAPID, &msg32);
368+
pci_read_config_dword(pdev, PCI_MSI_CAPID, &msg32);
366369
msg32 |= 1 << MSI_ENABLE_BIT;
367-
pci_write_config_dword(dev, PCI_MSI_CAPID, msg32);
370+
pci_write_config_dword(pdev, PCI_MSI_CAPID, msg32);
368371

369372
msg32 = (1 << INTR_IER) | (1 << INTR_IIR);
370-
pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, msg32);
373+
pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, msg32);
371374

372-
pci_read_config_word(dev, PCI_COMMAND, &msg16);
375+
pci_read_config_word(pdev, PCI_COMMAND, &msg16);
373376
msg16 |= (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
374377
PCI_COMMAND_INTX_DISABLE);
375-
pci_write_config_word(dev, PCI_COMMAND, msg16);
378+
pci_write_config_word(pdev, PCI_COMMAND, msg16);
376379
}
377380

378-
void atomisp_msi_irq_uninit(struct atomisp_device *isp, struct pci_dev *dev)
381+
void atomisp_msi_irq_uninit(struct atomisp_device *isp)
379382
{
383+
struct pci_dev *pdev = to_pci_dev(isp->dev);
380384
u32 msg32;
381385
u16 msg16;
382386

383-
pci_read_config_dword(dev, PCI_MSI_CAPID, &msg32);
387+
pci_read_config_dword(pdev, PCI_MSI_CAPID, &msg32);
384388
msg32 &= ~(1 << MSI_ENABLE_BIT);
385-
pci_write_config_dword(dev, PCI_MSI_CAPID, msg32);
389+
pci_write_config_dword(pdev, PCI_MSI_CAPID, msg32);
386390

387391
msg32 = 0x0;
388-
pci_write_config_dword(dev, PCI_INTERRUPT_CTRL, msg32);
392+
pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, msg32);
389393

390-
pci_read_config_word(dev, PCI_COMMAND, &msg16);
394+
pci_read_config_word(pdev, PCI_COMMAND, &msg16);
391395
msg16 &= ~(PCI_COMMAND_MASTER);
392-
pci_write_config_word(dev, PCI_COMMAND, msg16);
396+
pci_write_config_word(pdev, PCI_COMMAND, msg16);
393397
}
394398

395399
static void atomisp_sof_event(struct atomisp_sub_device *asd)
@@ -480,11 +484,12 @@ static void print_csi_rx_errors(enum mipi_port_id port,
480484
/* Clear irq reg */
481485
static void clear_irq_reg(struct atomisp_device *isp)
482486
{
487+
struct pci_dev *pdev = to_pci_dev(isp->dev);
483488
u32 msg_ret;
484489

485-
pci_read_config_dword(isp->pdev, PCI_INTERRUPT_CTRL, &msg_ret);
490+
pci_read_config_dword(pdev, PCI_INTERRUPT_CTRL, &msg_ret);
486491
msg_ret |= 1 << INTR_IIR;
487-
pci_write_config_dword(isp->pdev, PCI_INTERRUPT_CTRL, msg_ret);
492+
pci_write_config_dword(pdev, PCI_INTERRUPT_CTRL, msg_ret);
488493
}
489494

490495
static struct atomisp_sub_device *
@@ -665,11 +670,10 @@ bool atomisp_buffers_queued_pipe(struct atomisp_video_pipe *pipe)
665670
void dump_sp_dmem(struct atomisp_device *isp, unsigned int addr,
666671
unsigned int size)
667672
{
668-
u32 __iomem *io_virt_addr;
669673
unsigned int data = 0;
670674
unsigned int size32 = DIV_ROUND_UP(size, sizeof(u32));
671675

672-
dev_dbg(isp->dev, "atomisp_io_base:%p\n", atomisp_io_base);
676+
dev_dbg(isp->dev, "atomisp mmio base: %p\n", isp->base);
673677
dev_dbg(isp->dev, "%s, addr:0x%x, size: %d, size32: %d\n", __func__,
674678
addr, size, size32);
675679
if (size32 * 4 + addr > 0x4000) {
@@ -678,13 +682,12 @@ void dump_sp_dmem(struct atomisp_device *isp, unsigned int addr,
678682
return;
679683
}
680684
addr += SP_DMEM_BASE;
681-
io_virt_addr = atomisp_io_base + (addr & 0x003FFFFF);
685+
addr &= 0x003FFFFF;
682686
do {
683-
data = *io_virt_addr;
687+
data = readl(isp->base + addr);
684688
dev_dbg(isp->dev, "%s, \t [0x%x]:0x%x\n", __func__, addr, data);
685-
io_virt_addr += sizeof(u32);
686-
size32 -= 1;
687-
} while (size32 > 0);
689+
addr += sizeof(u32);
690+
} while (--size32);
688691
}
689692

690693
static struct videobuf_buffer *atomisp_css_frame_to_vbuf(
@@ -1289,6 +1292,7 @@ void atomisp_delayed_init_work(struct work_struct *work)
12891292

12901293
static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout)
12911294
{
1295+
struct pci_dev *pdev = to_pci_dev(isp->dev);
12921296
enum ia_css_pipe_id css_pipe_id;
12931297
bool stream_restart[MAX_STREAM_NUM] = {0};
12941298
bool depth_mode = false;
@@ -1372,8 +1376,8 @@ static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout)
13721376
clear_isp_irq(hrt_isp_css_irq_sp);
13731377

13741378
/* Set the SRSE to 3 before resetting */
1375-
pci_write_config_dword(isp->pdev, PCI_I_CONTROL, isp->saved_regs.i_control |
1376-
MRFLD_PCI_I_CONTROL_SRSE_RESET_MASK);
1379+
pci_write_config_dword(pdev, PCI_I_CONTROL,
1380+
isp->saved_regs.i_control | MRFLD_PCI_I_CONTROL_SRSE_RESET_MASK);
13771381

13781382
/* reset ISP and restore its state */
13791383
isp->isp_timeout = true;
@@ -6158,6 +6162,7 @@ int atomisp_set_shading_table(struct atomisp_sub_device *asd,
61586162
/*Turn off ISP dphy */
61596163
int atomisp_ospm_dphy_down(struct atomisp_device *isp)
61606164
{
6165+
struct pci_dev *pdev = to_pci_dev(isp->dev);
61616166
unsigned long flags;
61626167
u32 reg;
61636168

@@ -6179,9 +6184,9 @@ int atomisp_ospm_dphy_down(struct atomisp_device *isp)
61796184
* MRFLD HW design need all CSI ports are disabled before
61806185
* powering down the IUNIT.
61816186
*/
6182-
pci_read_config_dword(isp->pdev, MRFLD_PCI_CSI_CONTROL, &reg);
6187+
pci_read_config_dword(pdev, MRFLD_PCI_CSI_CONTROL, &reg);
61836188
reg |= MRFLD_ALL_CSI_PORTS_OFF_MASK;
6184-
pci_write_config_dword(isp->pdev, MRFLD_PCI_CSI_CONTROL, reg);
6189+
pci_write_config_dword(pdev, MRFLD_PCI_CSI_CONTROL, reg);
61856190
return 0;
61866191
}
61876192

drivers/staging/media/atomisp/pci/atomisp_cmd.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ bool atomisp_buffers_queued_pipe(struct atomisp_video_pipe *pipe);
6868
/*
6969
* Interrupt functions
7070
*/
71-
void atomisp_msi_irq_init(struct atomisp_device *isp, struct pci_dev *dev);
72-
void atomisp_msi_irq_uninit(struct atomisp_device *isp, struct pci_dev *dev);
71+
void atomisp_msi_irq_init(struct atomisp_device *isp);
72+
void atomisp_msi_irq_uninit(struct atomisp_device *isp);
7373
void atomisp_wdt_work(struct work_struct *work);
7474
void atomisp_wdt(struct timer_list *t);
7575
void atomisp_setup_flash(struct atomisp_sub_device *asd);

0 commit comments

Comments
 (0)