| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * R-Car Gen3 HDMI PHY |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2016 Renesas Electronics Corporation |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 10 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 11 | | - * (at your option) any later version. |
|---|
| 12 | 8 | */ |
|---|
| 13 | 9 | |
|---|
| 10 | +#include <linux/mod_devicetable.h> |
|---|
| 14 | 11 | #include <linux/module.h> |
|---|
| 15 | 12 | #include <linux/platform_device.h> |
|---|
| 16 | 13 | |
|---|
| 17 | 14 | #include <drm/bridge/dw_hdmi.h> |
|---|
| 15 | +#include <drm/drm_modes.h> |
|---|
| 18 | 16 | |
|---|
| 19 | 17 | #define RCAR_HDMI_PHY_OPMODE_PLLCFG 0x06 /* Mode of operation and PLL dividers */ |
|---|
| 20 | 18 | #define RCAR_HDMI_PHY_PLLCURRGMPCTRL 0x10 /* PLL current and Gmp (conductance) */ |
|---|
| .. | .. |
|---|
| 39 | 37 | { ~0UL, 0x0000, 0x0000, 0x0000 }, |
|---|
| 40 | 38 | }; |
|---|
| 41 | 39 | |
|---|
| 42 | | -static int rcar_hdmi_phy_configure(struct dw_hdmi *hdmi, |
|---|
| 43 | | - const struct dw_hdmi_plat_data *pdata, |
|---|
| 40 | +static enum drm_mode_status |
|---|
| 41 | +rcar_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, |
|---|
| 42 | + const struct drm_display_info *info, |
|---|
| 43 | + const struct drm_display_mode *mode) |
|---|
| 44 | +{ |
|---|
| 45 | + /* |
|---|
| 46 | + * The maximum supported clock frequency is 297 MHz, as shown in the PHY |
|---|
| 47 | + * parameters table. |
|---|
| 48 | + */ |
|---|
| 49 | + if (mode->clock > 297000) |
|---|
| 50 | + return MODE_CLOCK_HIGH; |
|---|
| 51 | + |
|---|
| 52 | + return MODE_OK; |
|---|
| 53 | +} |
|---|
| 54 | + |
|---|
| 55 | +static int rcar_hdmi_phy_configure(struct dw_hdmi *hdmi, void *data, |
|---|
| 44 | 56 | unsigned long mpixelclock) |
|---|
| 45 | 57 | { |
|---|
| 46 | 58 | const struct rcar_hdmi_phy_params *params = rcar_hdmi_phy_params; |
|---|
| .. | .. |
|---|
| 63 | 75 | } |
|---|
| 64 | 76 | |
|---|
| 65 | 77 | static const struct dw_hdmi_plat_data rcar_dw_hdmi_plat_data = { |
|---|
| 78 | + .mode_valid = rcar_hdmi_mode_valid, |
|---|
| 66 | 79 | .configure_phy = rcar_hdmi_phy_configure, |
|---|
| 67 | 80 | }; |
|---|
| 68 | 81 | |
|---|