Commit faa21f4c authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-misc-fixes-2024-01-03' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes

drm-misc-fixes for v6.7 final:
- 2 small qaic fixes.
- Fixes for overflow in aux xfer.
- Fix uninitialised gamma lut in gmag200.
- Small compiler warning fix for backports of a ps8640 fix.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/9ba866b4-3144-47a9-a2c0-7313c67249d7@linux.intel.com
parents bc2fdea0 11f9eb89
...@@ -404,8 +404,21 @@ static struct mhi_controller_config aic100_config = { ...@@ -404,8 +404,21 @@ static struct mhi_controller_config aic100_config = {
static int mhi_read_reg(struct mhi_controller *mhi_cntrl, void __iomem *addr, u32 *out) static int mhi_read_reg(struct mhi_controller *mhi_cntrl, void __iomem *addr, u32 *out)
{ {
u32 tmp = readl_relaxed(addr); u32 tmp;
/*
* SOC_HW_VERSION quirk
* The SOC_HW_VERSION register (offset 0x224) is not reliable and
* may contain uninitialized values, including 0xFFFFFFFF. This could
* cause a false positive link down error. Instead, intercept any
* reads and provide the correct value of the register.
*/
if (addr - mhi_cntrl->regs == 0x224) {
*out = 0x60110200;
return 0;
}
tmp = readl_relaxed(addr);
if (tmp == U32_MAX) if (tmp == U32_MAX)
return -EIO; return -EIO;
......
...@@ -777,7 +777,6 @@ struct drm_gem_object *qaic_gem_prime_import(struct drm_device *dev, struct dma_ ...@@ -777,7 +777,6 @@ struct drm_gem_object *qaic_gem_prime_import(struct drm_device *dev, struct dma_
struct dma_buf_attachment *attach; struct dma_buf_attachment *attach;
struct drm_gem_object *obj; struct drm_gem_object *obj;
struct qaic_bo *bo; struct qaic_bo *bo;
size_t size;
int ret; int ret;
bo = qaic_alloc_init_bo(); bo = qaic_alloc_init_bo();
...@@ -795,13 +794,12 @@ struct drm_gem_object *qaic_gem_prime_import(struct drm_device *dev, struct dma_ ...@@ -795,13 +794,12 @@ struct drm_gem_object *qaic_gem_prime_import(struct drm_device *dev, struct dma_
goto attach_fail; goto attach_fail;
} }
size = PAGE_ALIGN(attach->dmabuf->size); if (!attach->dmabuf->size) {
if (size == 0) {
ret = -EINVAL; ret = -EINVAL;
goto size_align_fail; goto size_align_fail;
} }
drm_gem_private_object_init(dev, obj, size); drm_gem_private_object_init(dev, obj, attach->dmabuf->size);
/* /*
* skipping dma_buf_map_attachment() as we do not know the direction * skipping dma_buf_map_attachment() as we do not know the direction
* just yet. Once the direction is known in the subsequent IOCTL to * just yet. Once the direction is known in the subsequent IOCTL to
......
...@@ -210,7 +210,7 @@ static ssize_t ps8640_aux_transfer_msg(struct drm_dp_aux *aux, ...@@ -210,7 +210,7 @@ static ssize_t ps8640_aux_transfer_msg(struct drm_dp_aux *aux,
struct ps8640 *ps_bridge = aux_to_ps8640(aux); struct ps8640 *ps_bridge = aux_to_ps8640(aux);
struct regmap *map = ps_bridge->regmap[PAGE0_DP_CNTL]; struct regmap *map = ps_bridge->regmap[PAGE0_DP_CNTL];
struct device *dev = &ps_bridge->page[PAGE0_DP_CNTL]->dev; struct device *dev = &ps_bridge->page[PAGE0_DP_CNTL]->dev;
unsigned int len = msg->size; size_t len = msg->size;
unsigned int data; unsigned int data;
unsigned int base; unsigned int base;
int ret; int ret;
...@@ -330,11 +330,12 @@ static ssize_t ps8640_aux_transfer_msg(struct drm_dp_aux *aux, ...@@ -330,11 +330,12 @@ static ssize_t ps8640_aux_transfer_msg(struct drm_dp_aux *aux,
return ret; return ret;
} }
buf[i] = data; if (i < msg->size)
buf[i] = data;
} }
} }
return len; return min(len, msg->size);
} }
static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux, static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux,
......
...@@ -527,6 +527,7 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux, ...@@ -527,6 +527,7 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux,
u32 request_val = AUX_CMD_REQ(msg->request); u32 request_val = AUX_CMD_REQ(msg->request);
u8 *buf = msg->buffer; u8 *buf = msg->buffer;
unsigned int len = msg->size; unsigned int len = msg->size;
unsigned int short_len;
unsigned int val; unsigned int val;
int ret; int ret;
u8 addr_len[SN_AUX_LENGTH_REG + 1 - SN_AUX_ADDR_19_16_REG]; u8 addr_len[SN_AUX_LENGTH_REG + 1 - SN_AUX_ADDR_19_16_REG];
...@@ -600,7 +601,8 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux, ...@@ -600,7 +601,8 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux,
} }
if (val & AUX_IRQ_STATUS_AUX_SHORT) { if (val & AUX_IRQ_STATUS_AUX_SHORT) {
ret = regmap_read(pdata->regmap, SN_AUX_LENGTH_REG, &len); ret = regmap_read(pdata->regmap, SN_AUX_LENGTH_REG, &short_len);
len = min(len, short_len);
if (ret) if (ret)
goto exit; goto exit;
} else if (val & AUX_IRQ_STATUS_NAT_I2C_FAIL) { } else if (val & AUX_IRQ_STATUS_NAT_I2C_FAIL) {
......
...@@ -392,6 +392,11 @@ void mgag200_primary_plane_helper_atomic_disable(struct drm_plane *plane, ...@@ -392,6 +392,11 @@ void mgag200_primary_plane_helper_atomic_disable(struct drm_plane *plane,
.destroy = drm_plane_cleanup, \ .destroy = drm_plane_cleanup, \
DRM_GEM_SHADOW_PLANE_FUNCS DRM_GEM_SHADOW_PLANE_FUNCS
void mgag200_crtc_set_gamma_linear(struct mga_device *mdev, const struct drm_format_info *format);
void mgag200_crtc_set_gamma(struct mga_device *mdev,
const struct drm_format_info *format,
struct drm_color_lut *lut);
enum drm_mode_status mgag200_crtc_helper_mode_valid(struct drm_crtc *crtc, enum drm_mode_status mgag200_crtc_helper_mode_valid(struct drm_crtc *crtc,
const struct drm_display_mode *mode); const struct drm_display_mode *mode);
int mgag200_crtc_helper_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *new_state); int mgag200_crtc_helper_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *new_state);
......
...@@ -202,6 +202,11 @@ static void mgag200_g200er_crtc_helper_atomic_enable(struct drm_crtc *crtc, ...@@ -202,6 +202,11 @@ static void mgag200_g200er_crtc_helper_atomic_enable(struct drm_crtc *crtc,
mgag200_g200er_reset_tagfifo(mdev); mgag200_g200er_reset_tagfifo(mdev);
if (crtc_state->gamma_lut)
mgag200_crtc_set_gamma(mdev, format, crtc_state->gamma_lut->data);
else
mgag200_crtc_set_gamma_linear(mdev, format);
mgag200_enable_display(mdev); mgag200_enable_display(mdev);
if (funcs->enable_vidrst) if (funcs->enable_vidrst)
......
...@@ -203,6 +203,11 @@ static void mgag200_g200ev_crtc_helper_atomic_enable(struct drm_crtc *crtc, ...@@ -203,6 +203,11 @@ static void mgag200_g200ev_crtc_helper_atomic_enable(struct drm_crtc *crtc,
mgag200_g200ev_set_hiprilvl(mdev); mgag200_g200ev_set_hiprilvl(mdev);
if (crtc_state->gamma_lut)
mgag200_crtc_set_gamma(mdev, format, crtc_state->gamma_lut->data);
else
mgag200_crtc_set_gamma_linear(mdev, format);
mgag200_enable_display(mdev); mgag200_enable_display(mdev);
if (funcs->enable_vidrst) if (funcs->enable_vidrst)
......
...@@ -334,6 +334,11 @@ static void mgag200_g200se_crtc_helper_atomic_enable(struct drm_crtc *crtc, ...@@ -334,6 +334,11 @@ static void mgag200_g200se_crtc_helper_atomic_enable(struct drm_crtc *crtc,
mgag200_g200se_set_hiprilvl(mdev, adjusted_mode, format); mgag200_g200se_set_hiprilvl(mdev, adjusted_mode, format);
if (crtc_state->gamma_lut)
mgag200_crtc_set_gamma(mdev, format, crtc_state->gamma_lut->data);
else
mgag200_crtc_set_gamma_linear(mdev, format);
mgag200_enable_display(mdev); mgag200_enable_display(mdev);
if (funcs->enable_vidrst) if (funcs->enable_vidrst)
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
* This file contains setup code for the CRTC. * This file contains setup code for the CRTC.
*/ */
static void mgag200_crtc_set_gamma_linear(struct mga_device *mdev, void mgag200_crtc_set_gamma_linear(struct mga_device *mdev,
const struct drm_format_info *format) const struct drm_format_info *format)
{ {
int i; int i;
...@@ -65,9 +65,9 @@ static void mgag200_crtc_set_gamma_linear(struct mga_device *mdev, ...@@ -65,9 +65,9 @@ static void mgag200_crtc_set_gamma_linear(struct mga_device *mdev,
} }
} }
static void mgag200_crtc_set_gamma(struct mga_device *mdev, void mgag200_crtc_set_gamma(struct mga_device *mdev,
const struct drm_format_info *format, const struct drm_format_info *format,
struct drm_color_lut *lut) struct drm_color_lut *lut)
{ {
int i; int i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment