Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drm:vc4 Added calls for firmware display blank/unblank #3289

Merged
merged 1 commit into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions drivers/gpu/drm/vc4/vc4_firmware_kms.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ struct mailbox_blank_display {
u32 blank;
};

struct mailbox_display_pwr {
struct rpi_firmware_property_tag_header tag1;
u32 display;
u32 state;
};

struct mailbox_get_edid {
struct rpi_firmware_property_tag_header tag1;
u32 block;
Expand Down Expand Up @@ -272,6 +278,7 @@ struct vc4_fkms_encoder {
struct drm_encoder base;
bool hdmi_monitor;
bool rgb_range_selectable;
int display_num;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel that this should be accessible from either the crtc or connector (the bits either side of the encoder).
In reality I get lost with the potential dereferencing between the structures, and this driver is fairly monolithic anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did spend about 45 minutes trying to find a way of getting this information from the existing structures, and it ended up being so convoluted that adding this parameter was a hugely simpler option - both from an implementation and understanding point of view.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. I know that finding the right linkings can be less than obvious.

};

static inline struct vc4_fkms_encoder *
Expand Down Expand Up @@ -1613,13 +1620,29 @@ static const struct drm_encoder_funcs vc4_fkms_encoder_funcs = {
.destroy = vc4_fkms_encoder_destroy,
};

static void vc4_fkms_display_power(struct drm_encoder *encoder, bool power)
{
struct vc4_fkms_encoder *vc4_encoder = to_vc4_fkms_encoder(encoder);
struct vc4_dev *vc4 = to_vc4_dev(encoder->dev);

struct mailbox_display_pwr pwr = {
.tag1 = {RPI_FIRMWARE_SET_DISPLAY_POWER, 8, 0, },
.display = vc4_encoder->display_num,
.state = power ? 1 : 0,
};

rpi_firmware_property_list(vc4->firmware, &pwr, sizeof(pwr));
}

static void vc4_fkms_encoder_enable(struct drm_encoder *encoder)
{
vc4_fkms_display_power(encoder, true);
DRM_DEBUG_KMS("Encoder_enable\n");
}

static void vc4_fkms_encoder_disable(struct drm_encoder *encoder)
{
vc4_fkms_display_power(encoder, false);
DRM_DEBUG_KMS("Encoder_disable\n");
}

Expand Down Expand Up @@ -1695,6 +1718,8 @@ static int vc4_fkms_create_screen(struct device *dev, struct drm_device *drm,
if (!vc4_encoder)
return -ENOMEM;
vc4_crtc->encoder = &vc4_encoder->base;

vc4_encoder->display_num = display_ref;
vc4_encoder->base.possible_crtcs |= drm_crtc_mask(crtc) ;

drm_encoder_init(drm, &vc4_encoder->base, &vc4_fkms_encoder_funcs,
Expand Down
2 changes: 1 addition & 1 deletion include/soc/bcm2835/raspberrypi-firmware.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ enum rpi_firmware_property_tag {
RPI_FIRMWARE_GET_DISPLAY_TIMING = 0x00040017,
RPI_FIRMWARE_SET_TIMING = 0x00048017,
RPI_FIRMWARE_GET_DISPLAY_CFG = 0x00040018,

RPI_FIRMWARE_SET_DISPLAY_POWER = 0x00048019,
RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001,
RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001,
};
Expand Down