| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2014, The Linux Foundation. All rights reserved. |
|---|
| 3 | 4 | * Copyright (C) 2013 Red Hat |
|---|
| 4 | 5 | * Author: Rob Clark <robdclark@gmail.com> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 7 | | - * under the terms of the GNU General Public License version 2 as published by |
|---|
| 8 | | - * the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 11 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 12 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 13 | | - * more details. |
|---|
| 14 | | - * |
|---|
| 15 | | - * You should have received a copy of the GNU General Public License along with |
|---|
| 16 | | - * this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | 6 | */ |
|---|
| 18 | 7 | |
|---|
| 19 | 8 | #include <drm/drm_crtc.h> |
|---|
| 20 | | -#include <drm/drm_crtc_helper.h> |
|---|
| 9 | +#include <drm/drm_probe_helper.h> |
|---|
| 21 | 10 | |
|---|
| 22 | 11 | #include "mdp5_kms.h" |
|---|
| 23 | 12 | |
|---|
| .. | .. |
|---|
| 27 | 16 | return to_mdp5_kms(to_mdp_kms(priv->kms)); |
|---|
| 28 | 17 | } |
|---|
| 29 | 18 | |
|---|
| 30 | | -#ifdef DOWNSTREAM_CONFIG_MSM_BUS_SCALING |
|---|
| 31 | | -#include <mach/board.h> |
|---|
| 32 | | -#include <mach/msm_bus.h> |
|---|
| 33 | | -#include <mach/msm_bus_board.h> |
|---|
| 34 | | -#define MDP_BUS_VECTOR_ENTRY(ab_val, ib_val) \ |
|---|
| 35 | | - { \ |
|---|
| 36 | | - .src = MSM_BUS_MASTER_MDP_PORT0, \ |
|---|
| 37 | | - .dst = MSM_BUS_SLAVE_EBI_CH0, \ |
|---|
| 38 | | - .ab = (ab_val), \ |
|---|
| 39 | | - .ib = (ib_val), \ |
|---|
| 40 | | - } |
|---|
| 41 | | - |
|---|
| 42 | | -static struct msm_bus_vectors mdp_bus_vectors[] = { |
|---|
| 43 | | - MDP_BUS_VECTOR_ENTRY(0, 0), |
|---|
| 44 | | - MDP_BUS_VECTOR_ENTRY(2000000000, 2000000000), |
|---|
| 45 | | -}; |
|---|
| 46 | | -static struct msm_bus_paths mdp_bus_usecases[] = { { |
|---|
| 47 | | - .num_paths = 1, |
|---|
| 48 | | - .vectors = &mdp_bus_vectors[0], |
|---|
| 49 | | -}, { |
|---|
| 50 | | - .num_paths = 1, |
|---|
| 51 | | - .vectors = &mdp_bus_vectors[1], |
|---|
| 52 | | -} }; |
|---|
| 53 | | -static struct msm_bus_scale_pdata mdp_bus_scale_table = { |
|---|
| 54 | | - .usecase = mdp_bus_usecases, |
|---|
| 55 | | - .num_usecases = ARRAY_SIZE(mdp_bus_usecases), |
|---|
| 56 | | - .name = "mdss_mdp", |
|---|
| 57 | | -}; |
|---|
| 58 | | - |
|---|
| 59 | | -static void bs_init(struct mdp5_encoder *mdp5_encoder) |
|---|
| 60 | | -{ |
|---|
| 61 | | - mdp5_encoder->bsc = msm_bus_scale_register_client( |
|---|
| 62 | | - &mdp_bus_scale_table); |
|---|
| 63 | | - DBG("bus scale client: %08x", mdp5_encoder->bsc); |
|---|
| 64 | | -} |
|---|
| 65 | | - |
|---|
| 66 | | -static void bs_fini(struct mdp5_encoder *mdp5_encoder) |
|---|
| 67 | | -{ |
|---|
| 68 | | - if (mdp5_encoder->bsc) { |
|---|
| 69 | | - msm_bus_scale_unregister_client(mdp5_encoder->bsc); |
|---|
| 70 | | - mdp5_encoder->bsc = 0; |
|---|
| 71 | | - } |
|---|
| 72 | | -} |
|---|
| 73 | | - |
|---|
| 74 | | -static void bs_set(struct mdp5_encoder *mdp5_encoder, int idx) |
|---|
| 75 | | -{ |
|---|
| 76 | | - if (mdp5_encoder->bsc) { |
|---|
| 77 | | - DBG("set bus scaling: %d", idx); |
|---|
| 78 | | - /* HACK: scaling down, and then immediately back up |
|---|
| 79 | | - * seems to leave things broken (underflow).. so |
|---|
| 80 | | - * never disable: |
|---|
| 81 | | - */ |
|---|
| 82 | | - idx = 1; |
|---|
| 83 | | - msm_bus_scale_client_update_request(mdp5_encoder->bsc, idx); |
|---|
| 84 | | - } |
|---|
| 85 | | -} |
|---|
| 86 | | -#else |
|---|
| 87 | | -static void bs_init(struct mdp5_encoder *mdp5_encoder) {} |
|---|
| 88 | | -static void bs_fini(struct mdp5_encoder *mdp5_encoder) {} |
|---|
| 89 | | -static void bs_set(struct mdp5_encoder *mdp5_encoder, int idx) {} |
|---|
| 90 | | -#endif |
|---|
| 91 | | - |
|---|
| 92 | 19 | static void mdp5_encoder_destroy(struct drm_encoder *encoder) |
|---|
| 93 | 20 | { |
|---|
| 94 | 21 | struct mdp5_encoder *mdp5_encoder = to_mdp5_encoder(encoder); |
|---|
| 95 | | - bs_fini(mdp5_encoder); |
|---|
| 96 | 22 | drm_encoder_cleanup(encoder); |
|---|
| 97 | 23 | kfree(mdp5_encoder); |
|---|
| 98 | 24 | } |
|---|
| .. | .. |
|---|
| 118 | 44 | |
|---|
| 119 | 45 | mode = adjusted_mode; |
|---|
| 120 | 46 | |
|---|
| 121 | | - DBG("set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x", |
|---|
| 122 | | - mode->base.id, mode->name, |
|---|
| 123 | | - mode->vrefresh, mode->clock, |
|---|
| 124 | | - mode->hdisplay, mode->hsync_start, |
|---|
| 125 | | - mode->hsync_end, mode->htotal, |
|---|
| 126 | | - mode->vdisplay, mode->vsync_start, |
|---|
| 127 | | - mode->vsync_end, mode->vtotal, |
|---|
| 128 | | - mode->type, mode->flags); |
|---|
| 47 | + DBG("set mode: " DRM_MODE_FMT, DRM_MODE_ARG(mode)); |
|---|
| 129 | 48 | |
|---|
| 130 | 49 | ctrl_pol = 0; |
|---|
| 131 | 50 | |
|---|
| .. | .. |
|---|
| 240 | 159 | */ |
|---|
| 241 | 160 | mdp_irq_wait(&mdp5_kms->base, intf2vblank(mixer, intf)); |
|---|
| 242 | 161 | |
|---|
| 243 | | - bs_set(mdp5_encoder, 0); |
|---|
| 244 | | - |
|---|
| 245 | 162 | mdp5_encoder->enabled = false; |
|---|
| 246 | 163 | } |
|---|
| 247 | 164 | |
|---|
| .. | .. |
|---|
| 258 | 175 | if (WARN_ON(mdp5_encoder->enabled)) |
|---|
| 259 | 176 | return; |
|---|
| 260 | 177 | |
|---|
| 261 | | - bs_set(mdp5_encoder, 1); |
|---|
| 262 | 178 | spin_lock_irqsave(&mdp5_encoder->intf_lock, flags); |
|---|
| 263 | 179 | mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(intfn), 1); |
|---|
| 264 | 180 | spin_unlock_irqrestore(&mdp5_encoder->intf_lock, flags); |
|---|
| .. | .. |
|---|
| 443 | 359 | drm_encoder_init(dev, encoder, &mdp5_encoder_funcs, enc_type, NULL); |
|---|
| 444 | 360 | |
|---|
| 445 | 361 | drm_encoder_helper_add(encoder, &mdp5_encoder_helper_funcs); |
|---|
| 446 | | - |
|---|
| 447 | | - bs_init(mdp5_encoder); |
|---|
| 448 | 362 | |
|---|
| 449 | 363 | return encoder; |
|---|
| 450 | 364 | |
|---|