| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Samsung S5P/EXYNOS SoC series MIPI-CSI receiver driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. |
|---|
| 5 | 6 | * Author: Sylwester Nawrocki <s.nawrocki@samsung.com> |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 9 | | - * published by the Free Software Foundation. |
|---|
| 10 | 7 | */ |
|---|
| 11 | 8 | |
|---|
| 12 | 9 | #include <linux/clk.h> |
|---|
| .. | .. |
|---|
| 44 | 41 | /* CSIS global control */ |
|---|
| 45 | 42 | #define S5PCSIS_CTRL 0x00 |
|---|
| 46 | 43 | #define S5PCSIS_CTRL_DPDN_DEFAULT (0 << 31) |
|---|
| 47 | | -#define S5PCSIS_CTRL_DPDN_SWAP (1 << 31) |
|---|
| 44 | +#define S5PCSIS_CTRL_DPDN_SWAP (1UL << 31) |
|---|
| 48 | 45 | #define S5PCSIS_CTRL_ALIGN_32BIT (1 << 20) |
|---|
| 49 | 46 | #define S5PCSIS_CTRL_UPDATE_SHADOW (1 << 16) |
|---|
| 50 | 47 | #define S5PCSIS_CTRL_WCLK_EXTCLK (1 << 8) |
|---|
| .. | .. |
|---|
| 68 | 65 | |
|---|
| 69 | 66 | /* Interrupt mask */ |
|---|
| 70 | 67 | #define S5PCSIS_INTMSK 0x10 |
|---|
| 71 | | -#define S5PCSIS_INTMSK_EVEN_BEFORE (1 << 31) |
|---|
| 68 | +#define S5PCSIS_INTMSK_EVEN_BEFORE (1UL << 31) |
|---|
| 72 | 69 | #define S5PCSIS_INTMSK_EVEN_AFTER (1 << 30) |
|---|
| 73 | 70 | #define S5PCSIS_INTMSK_ODD_BEFORE (1 << 29) |
|---|
| 74 | 71 | #define S5PCSIS_INTMSK_ODD_AFTER (1 << 28) |
|---|
| .. | .. |
|---|
| 86 | 83 | |
|---|
| 87 | 84 | /* Interrupt source */ |
|---|
| 88 | 85 | #define S5PCSIS_INTSRC 0x14 |
|---|
| 89 | | -#define S5PCSIS_INTSRC_EVEN_BEFORE (1 << 31) |
|---|
| 86 | +#define S5PCSIS_INTSRC_EVEN_BEFORE (1UL << 31) |
|---|
| 90 | 87 | #define S5PCSIS_INTSRC_EVEN_AFTER (1 << 30) |
|---|
| 91 | 88 | #define S5PCSIS_INTSRC_EVEN (0x3 << 30) |
|---|
| 92 | 89 | #define S5PCSIS_INTSRC_ODD_BEFORE (1 << 29) |
|---|
| .. | .. |
|---|
| 183 | 180 | * @index: the hardware instance index |
|---|
| 184 | 181 | * @pdev: CSIS platform device |
|---|
| 185 | 182 | * @phy: pointer to the CSIS generic PHY |
|---|
| 186 | | - * @regs: mmaped I/O registers memory |
|---|
| 183 | + * @regs: mmapped I/O registers memory |
|---|
| 187 | 184 | * @supplies: CSIS regulator supplies |
|---|
| 188 | 185 | * @clock: CSIS clocks |
|---|
| 189 | 186 | * @irq: requested s5p-mipi-csis irq number |
|---|
| .. | .. |
|---|
| 497 | 494 | struct device *dev = &state->pdev->dev; |
|---|
| 498 | 495 | |
|---|
| 499 | 496 | if (on) |
|---|
| 500 | | - return pm_runtime_get_sync(dev); |
|---|
| 497 | + return pm_runtime_resume_and_get(dev); |
|---|
| 501 | 498 | |
|---|
| 502 | 499 | return pm_runtime_put_sync(dev); |
|---|
| 503 | 500 | } |
|---|
| .. | .. |
|---|
| 512 | 509 | |
|---|
| 513 | 510 | if (enable) { |
|---|
| 514 | 511 | s5pcsis_clear_counters(state); |
|---|
| 515 | | - ret = pm_runtime_get_sync(&state->pdev->dev); |
|---|
| 516 | | - if (ret && ret != 1) { |
|---|
| 517 | | - pm_runtime_put_noidle(&state->pdev->dev); |
|---|
| 512 | + ret = pm_runtime_resume_and_get(&state->pdev->dev); |
|---|
| 513 | + if (ret < 0) |
|---|
| 518 | 514 | return ret; |
|---|
| 519 | | - } |
|---|
| 520 | 515 | } |
|---|
| 521 | 516 | |
|---|
| 522 | 517 | mutex_lock(&state->lock); |
|---|
| .. | .. |
|---|
| 538 | 533 | if (!enable) |
|---|
| 539 | 534 | pm_runtime_put(&state->pdev->dev); |
|---|
| 540 | 535 | |
|---|
| 541 | | - return ret == 1 ? 0 : ret; |
|---|
| 536 | + return ret; |
|---|
| 542 | 537 | } |
|---|
| 543 | 538 | |
|---|
| 544 | 539 | static int s5pcsis_enum_mbus_code(struct v4l2_subdev *sd, |
|---|
| .. | .. |
|---|
| 720 | 715 | struct csis_state *state) |
|---|
| 721 | 716 | { |
|---|
| 722 | 717 | struct device_node *node = pdev->dev.of_node; |
|---|
| 723 | | - struct v4l2_fwnode_endpoint endpoint; |
|---|
| 718 | + struct v4l2_fwnode_endpoint endpoint = { .bus_type = 0 }; |
|---|
| 724 | 719 | int ret; |
|---|
| 725 | 720 | |
|---|
| 726 | 721 | if (of_property_read_u32(node, "clock-frequency", |
|---|
| .. | .. |
|---|
| 747 | 742 | goto err; |
|---|
| 748 | 743 | } |
|---|
| 749 | 744 | |
|---|
| 750 | | - /* Get MIPI CSI-2 bus configration from the endpoint node. */ |
|---|
| 745 | + /* Get MIPI CSI-2 bus configuration from the endpoint node. */ |
|---|
| 751 | 746 | of_property_read_u32(node, "samsung,csis-hs-settle", |
|---|
| 752 | 747 | &state->hs_settle); |
|---|
| 753 | 748 | state->wclk_ext = of_property_read_bool(node, |
|---|
| .. | .. |
|---|
| 808 | 803 | return PTR_ERR(state->regs); |
|---|
| 809 | 804 | |
|---|
| 810 | 805 | state->irq = platform_get_irq(pdev, 0); |
|---|
| 811 | | - if (state->irq < 0) { |
|---|
| 812 | | - dev_err(dev, "Failed to get irq\n"); |
|---|
| 806 | + if (state->irq < 0) |
|---|
| 813 | 807 | return state->irq; |
|---|
| 814 | | - } |
|---|
| 815 | 808 | |
|---|
| 816 | 809 | for (i = 0; i < CSIS_NUM_SUPPLIES; i++) |
|---|
| 817 | 810 | state->supplies[i].supply = csis_supply_name[i]; |
|---|