drm: bridge: Constify mode arguments to bridge .mode_set() operation
The mode and ajusted_mode passed to the bridge .mode_set() operation should never be modified by the bridge (and are not in any of the existing bridge drivers). Make them const to make this clear. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
e3d093070e
commit
63f8f3badf
|
@ -395,7 +395,7 @@ static inline int adv7511_cec_init(struct device *dev, struct adv7511 *adv7511)
|
|||
#ifdef CONFIG_DRM_I2C_ADV7533
|
||||
void adv7533_dsi_power_on(struct adv7511 *adv);
|
||||
void adv7533_dsi_power_off(struct adv7511 *adv);
|
||||
void adv7533_mode_set(struct adv7511 *adv, struct drm_display_mode *mode);
|
||||
void adv7533_mode_set(struct adv7511 *adv, const struct drm_display_mode *mode);
|
||||
int adv7533_patch_registers(struct adv7511 *adv);
|
||||
int adv7533_patch_cec_registers(struct adv7511 *adv);
|
||||
int adv7533_attach_dsi(struct adv7511 *adv);
|
||||
|
@ -411,7 +411,7 @@ static inline void adv7533_dsi_power_off(struct adv7511 *adv)
|
|||
}
|
||||
|
||||
static inline void adv7533_mode_set(struct adv7511 *adv,
|
||||
struct drm_display_mode *mode)
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -676,8 +676,8 @@ static enum drm_mode_status adv7511_mode_valid(struct adv7511 *adv7511,
|
|||
}
|
||||
|
||||
static void adv7511_mode_set(struct adv7511 *adv7511,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adj_mode)
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adj_mode)
|
||||
{
|
||||
unsigned int low_refresh_rate;
|
||||
unsigned int hsync_polarity = 0;
|
||||
|
@ -839,8 +839,8 @@ static void adv7511_bridge_disable(struct drm_bridge *bridge)
|
|||
}
|
||||
|
||||
static void adv7511_bridge_mode_set(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adj_mode)
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adj_mode)
|
||||
{
|
||||
struct adv7511 *adv = bridge_to_adv7511(bridge);
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ void adv7533_dsi_power_off(struct adv7511 *adv)
|
|||
regmap_write(adv->regmap_cec, 0x27, 0x0b);
|
||||
}
|
||||
|
||||
void adv7533_mode_set(struct adv7511 *adv, struct drm_display_mode *mode)
|
||||
void adv7533_mode_set(struct adv7511 *adv, const struct drm_display_mode *mode)
|
||||
{
|
||||
struct mipi_dsi_device *dsi = adv->dsi;
|
||||
int lanes, ret;
|
||||
|
|
|
@ -1082,8 +1082,8 @@ static void anx78xx_bridge_disable(struct drm_bridge *bridge)
|
|||
}
|
||||
|
||||
static void anx78xx_bridge_mode_set(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
struct anx78xx *anx78xx = bridge_to_anx78xx(bridge);
|
||||
struct hdmi_avi_infoframe frame;
|
||||
|
|
|
@ -1361,8 +1361,8 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge)
|
|||
}
|
||||
|
||||
static void analogix_dp_bridge_mode_set(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *orig_mode,
|
||||
struct drm_display_mode *mode)
|
||||
const struct drm_display_mode *orig_mode,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
struct analogix_dp_device *dp = bridge->driver_private;
|
||||
struct drm_display_info *display_info = &dp->connector.display_info;
|
||||
|
|
|
@ -232,8 +232,8 @@ static void sii902x_bridge_enable(struct drm_bridge *bridge)
|
|||
}
|
||||
|
||||
static void sii902x_bridge_mode_set(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adj)
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adj)
|
||||
{
|
||||
struct sii902x *sii902x = bridge_to_sii902x(bridge);
|
||||
struct regmap *regmap = sii902x->regmap;
|
||||
|
|
|
@ -1998,8 +1998,8 @@ dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge,
|
|||
}
|
||||
|
||||
static void dw_hdmi_bridge_mode_set(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *orig_mode,
|
||||
struct drm_display_mode *mode)
|
||||
const struct drm_display_mode *orig_mode,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
struct dw_hdmi *hdmi = bridge->driver_private;
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ static inline bool dw_mipi_is_dual_mode(struct dw_mipi_dsi *dsi)
|
|||
* The controller should generate 2 frames before
|
||||
* preparing the peripheral.
|
||||
*/
|
||||
static void dw_mipi_dsi_wait_for_two_frames(struct drm_display_mode *mode)
|
||||
static void dw_mipi_dsi_wait_for_two_frames(const struct drm_display_mode *mode)
|
||||
{
|
||||
int refresh, two_frames;
|
||||
|
||||
|
@ -564,7 +564,7 @@ static void dw_mipi_dsi_init(struct dw_mipi_dsi *dsi)
|
|||
}
|
||||
|
||||
static void dw_mipi_dsi_dpi_config(struct dw_mipi_dsi *dsi,
|
||||
struct drm_display_mode *mode)
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
u32 val = 0, color = 0;
|
||||
|
||||
|
@ -607,7 +607,7 @@ static void dw_mipi_dsi_packet_handler_config(struct dw_mipi_dsi *dsi)
|
|||
}
|
||||
|
||||
static void dw_mipi_dsi_video_packet_config(struct dw_mipi_dsi *dsi,
|
||||
struct drm_display_mode *mode)
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
/*
|
||||
* TODO dw drv improvements
|
||||
|
@ -642,7 +642,7 @@ static void dw_mipi_dsi_command_mode_config(struct dw_mipi_dsi *dsi)
|
|||
|
||||
/* Get lane byte clock cycles. */
|
||||
static u32 dw_mipi_dsi_get_hcomponent_lbcc(struct dw_mipi_dsi *dsi,
|
||||
struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *mode,
|
||||
u32 hcomponent)
|
||||
{
|
||||
u32 frac, lbcc;
|
||||
|
@ -658,7 +658,7 @@ static u32 dw_mipi_dsi_get_hcomponent_lbcc(struct dw_mipi_dsi *dsi,
|
|||
}
|
||||
|
||||
static void dw_mipi_dsi_line_timer_config(struct dw_mipi_dsi *dsi,
|
||||
struct drm_display_mode *mode)
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
u32 htotal, hsa, hbp, lbcc;
|
||||
|
||||
|
@ -681,7 +681,7 @@ static void dw_mipi_dsi_line_timer_config(struct dw_mipi_dsi *dsi,
|
|||
}
|
||||
|
||||
static void dw_mipi_dsi_vertical_timing_config(struct dw_mipi_dsi *dsi,
|
||||
struct drm_display_mode *mode)
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
u32 vactive, vsa, vfp, vbp;
|
||||
|
||||
|
@ -818,7 +818,7 @@ static unsigned int dw_mipi_dsi_get_lanes(struct dw_mipi_dsi *dsi)
|
|||
}
|
||||
|
||||
static void dw_mipi_dsi_mode_set(struct dw_mipi_dsi *dsi,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
const struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops;
|
||||
void *priv_data = dsi->plat_data->priv_data;
|
||||
|
@ -861,8 +861,8 @@ static void dw_mipi_dsi_mode_set(struct dw_mipi_dsi *dsi,
|
|||
}
|
||||
|
||||
static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge);
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ struct tc_data {
|
|||
/* display edid */
|
||||
struct edid *edid;
|
||||
/* current mode */
|
||||
struct drm_display_mode *mode;
|
||||
const struct drm_display_mode *mode;
|
||||
|
||||
u32 rev;
|
||||
u8 assr;
|
||||
|
@ -648,7 +648,8 @@ static int tc_get_display_props(struct tc_data *tc)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode)
|
||||
static int tc_set_video_mode(struct tc_data *tc,
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
int ret;
|
||||
int vid_sync_dly;
|
||||
|
@ -1113,8 +1114,8 @@ static enum drm_mode_status tc_connector_mode_valid(struct drm_connector *connec
|
|||
}
|
||||
|
||||
static void tc_bridge_mode_set(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adj)
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adj)
|
||||
{
|
||||
struct tc_data *tc = bridge_to_tc(bridge);
|
||||
|
||||
|
|
|
@ -294,8 +294,8 @@ EXPORT_SYMBOL(drm_bridge_post_disable);
|
|||
* Note: the bridge passed should be the one closest to the encoder
|
||||
*/
|
||||
void drm_bridge_mode_set(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
if (!bridge)
|
||||
return;
|
||||
|
|
|
@ -246,8 +246,8 @@ static void mic_post_disable(struct drm_bridge *bridge)
|
|||
}
|
||||
|
||||
static void mic_mode_set(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
struct exynos_mic *mic = bridge->driver_private;
|
||||
|
||||
|
|
|
@ -845,7 +845,7 @@ static int tda998x_write_aif(struct tda998x_priv *priv,
|
|||
}
|
||||
|
||||
static void
|
||||
tda998x_write_avi(struct tda998x_priv *priv, struct drm_display_mode *mode)
|
||||
tda998x_write_avi(struct tda998x_priv *priv, const struct drm_display_mode *mode)
|
||||
{
|
||||
union hdmi_infoframe frame;
|
||||
|
||||
|
@ -1339,8 +1339,8 @@ static void tda998x_bridge_disable(struct drm_bridge *bridge)
|
|||
}
|
||||
|
||||
static void tda998x_bridge_mode_set(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
struct tda998x_priv *priv = bridge_to_tda998x_priv(bridge);
|
||||
unsigned long tmds_clock;
|
||||
|
|
|
@ -1370,8 +1370,8 @@ static void mtk_hdmi_bridge_post_disable(struct drm_bridge *bridge)
|
|||
}
|
||||
|
||||
static void mtk_hdmi_bridge_mode_set(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
struct mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge);
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ int msm_dsi_host_power_on(struct mipi_dsi_host *host,
|
|||
bool is_dual_dsi);
|
||||
int msm_dsi_host_power_off(struct mipi_dsi_host *host);
|
||||
int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host,
|
||||
struct drm_display_mode *mode);
|
||||
const struct drm_display_mode *mode);
|
||||
struct drm_panel *msm_dsi_host_get_panel(struct mipi_dsi_host *host,
|
||||
unsigned long *panel_flags);
|
||||
struct drm_bridge *msm_dsi_host_get_bridge(struct mipi_dsi_host *host);
|
||||
|
|
|
@ -2424,7 +2424,7 @@ int msm_dsi_host_power_off(struct mipi_dsi_host *host)
|
|||
}
|
||||
|
||||
int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host,
|
||||
struct drm_display_mode *mode)
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
|
||||
|
||||
|
|
|
@ -527,8 +527,8 @@ static void dsi_mgr_bridge_post_disable(struct drm_bridge *bridge)
|
|||
}
|
||||
|
||||
static void dsi_mgr_bridge_mode_set(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
int id = dsi_mgr_bridge_get_id(bridge);
|
||||
struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
|
||||
|
|
|
@ -52,8 +52,8 @@ static void edp_bridge_post_disable(struct drm_bridge *bridge)
|
|||
}
|
||||
|
||||
static void edp_bridge_mode_set(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
struct drm_device *dev = bridge->dev;
|
||||
struct drm_connector *connector;
|
||||
|
|
|
@ -207,8 +207,8 @@ static void msm_hdmi_bridge_post_disable(struct drm_bridge *bridge)
|
|||
}
|
||||
|
||||
static void msm_hdmi_bridge_mode_set(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
|
||||
struct hdmi *hdmi = hdmi_bridge->hdmi;
|
||||
|
|
|
@ -520,8 +520,8 @@ static void rcar_lvds_get_lvds_mode(struct rcar_lvds *lvds)
|
|||
}
|
||||
|
||||
static void rcar_lvds_mode_set(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge);
|
||||
|
||||
|
|
|
@ -467,7 +467,7 @@ static int dw_mipi_dsi_phy_init(void *priv_data)
|
|||
}
|
||||
|
||||
static int
|
||||
dw_mipi_dsi_get_lane_mbps(void *priv_data, struct drm_display_mode *mode,
|
||||
dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode,
|
||||
unsigned long mode_flags, u32 lanes, u32 format,
|
||||
unsigned int *lane_mbps)
|
||||
{
|
||||
|
|
|
@ -277,8 +277,8 @@ static void sti_dvo_pre_enable(struct drm_bridge *bridge)
|
|||
}
|
||||
|
||||
static void sti_dvo_set_mode(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
struct sti_dvo *dvo = bridge->driver_private;
|
||||
struct sti_mixer *mixer = to_sti_mixer(dvo->encoder->crtc);
|
||||
|
|
|
@ -508,8 +508,8 @@ static void sti_hda_pre_enable(struct drm_bridge *bridge)
|
|||
}
|
||||
|
||||
static void sti_hda_set_mode(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
struct sti_hda *hda = bridge->driver_private;
|
||||
u32 mode_idx;
|
||||
|
|
|
@ -917,8 +917,8 @@ static void sti_hdmi_pre_enable(struct drm_bridge *bridge)
|
|||
}
|
||||
|
||||
static void sti_hdmi_set_mode(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
struct sti_hdmi *hdmi = bridge->driver_private;
|
||||
int ret;
|
||||
|
|
|
@ -215,7 +215,7 @@ static int dw_mipi_dsi_phy_init(void *priv_data)
|
|||
}
|
||||
|
||||
static int
|
||||
dw_mipi_dsi_get_lane_mbps(void *priv_data, struct drm_display_mode *mode,
|
||||
dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode,
|
||||
unsigned long mode_flags, u32 lanes, u32 format,
|
||||
unsigned int *lane_mbps)
|
||||
{
|
||||
|
|
|
@ -14,7 +14,8 @@ struct dw_mipi_dsi;
|
|||
|
||||
struct dw_mipi_dsi_phy_ops {
|
||||
int (*init)(void *priv_data);
|
||||
int (*get_lane_mbps)(void *priv_data, struct drm_display_mode *mode,
|
||||
int (*get_lane_mbps)(void *priv_data,
|
||||
const struct drm_display_mode *mode,
|
||||
unsigned long mode_flags, u32 lanes, u32 format,
|
||||
unsigned int *lane_mbps);
|
||||
};
|
||||
|
|
|
@ -196,8 +196,8 @@ struct drm_bridge_funcs {
|
|||
* the DRM framework will have to be extended with DRM bridge states.
|
||||
*/
|
||||
void (*mode_set)(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode);
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adjusted_mode);
|
||||
/**
|
||||
* @pre_enable:
|
||||
*
|
||||
|
@ -310,8 +310,8 @@ enum drm_mode_status drm_bridge_mode_valid(struct drm_bridge *bridge,
|
|||
void drm_bridge_disable(struct drm_bridge *bridge);
|
||||
void drm_bridge_post_disable(struct drm_bridge *bridge);
|
||||
void drm_bridge_mode_set(struct drm_bridge *bridge,
|
||||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode);
|
||||
const struct drm_display_mode *mode,
|
||||
const struct drm_display_mode *adjusted_mode);
|
||||
void drm_bridge_pre_enable(struct drm_bridge *bridge);
|
||||
void drm_bridge_enable(struct drm_bridge *bridge);
|
||||
|
||||
|
|
Loading…
Reference in New Issue