Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: pulse8-cec: add support for FW v10 and up

Starting with firmware version 10 the GET/SET_HDMI_VERSION message
was removed and GET/SET_AUTO_POWER_ON was added.

The removal of GET/SET_HDMI_VERSION caused the probe of the
Pulse-Eight to fail. Add a version check to handle this gracefully.

Also show (but do not set) the Auto Power On value.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: Maxime Ripard <mripard@kernel.org>
Tested-by: Maxime Ripard <mripard@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
45ba1c0b 024e01de

+30 -13
+30 -13
drivers/media/cec/usb/pulse8/pulse8-cec.c
··· 88 88 MSGCODE_SET_PHYSICAL_ADDRESS, /* 0x20 */ 89 89 MSGCODE_GET_DEVICE_TYPE, 90 90 MSGCODE_SET_DEVICE_TYPE, 91 - MSGCODE_GET_HDMI_VERSION, 91 + MSGCODE_GET_HDMI_VERSION, /* Removed in FW >= 10 */ 92 92 MSGCODE_SET_HDMI_VERSION, 93 93 MSGCODE_GET_OSD_NAME, 94 94 MSGCODE_SET_OSD_NAME, 95 95 MSGCODE_WRITE_EEPROM, 96 96 MSGCODE_GET_ADAPTER_TYPE, /* 0x28 */ 97 97 MSGCODE_SET_ACTIVE_SOURCE, 98 + MSGCODE_GET_AUTO_POWER_ON, /* New for FW >= 10 */ 99 + MSGCODE_SET_AUTO_POWER_ON, 98 100 99 101 MSGCODE_FRAME_EOM = 0x80, 100 102 MSGCODE_FRAME_ACK = 0x40, ··· 145 143 "WRITE_EEPROM", 146 144 "GET_ADAPTER_TYPE", 147 145 "SET_ACTIVE_SOURCE", 146 + "GET_AUTO_POWER_ON", 147 + "SET_AUTO_POWER_ON", 148 148 }; 149 149 150 150 static const char *pulse8_msgname(u8 cmd) ··· 583 579 if (err) 584 580 goto unlock; 585 581 586 - cmd[0] = MSGCODE_SET_HDMI_VERSION; 587 - cmd[1] = adap->log_addrs.cec_version; 588 - err = pulse8_send_and_wait(pulse8, cmd, 2, 589 - MSGCODE_COMMAND_ACCEPTED, 0); 590 - if (err) 591 - goto unlock; 582 + if (pulse8->vers < 10) { 583 + cmd[0] = MSGCODE_SET_HDMI_VERSION; 584 + cmd[1] = adap->log_addrs.cec_version; 585 + err = pulse8_send_and_wait(pulse8, cmd, 2, 586 + MSGCODE_COMMAND_ACCEPTED, 0); 587 + if (err) 588 + goto unlock; 589 + } 592 590 593 591 if (adap->log_addrs.osd_name[0]) { 594 592 size_t osd_len = strlen(adap->log_addrs.osd_name); ··· 697 691 dev_dbg(pulse8->dev, "Autonomous mode: %s", 698 692 data[0] ? "on" : "off"); 699 693 694 + if (pulse8->vers >= 10) { 695 + cmd[0] = MSGCODE_GET_AUTO_POWER_ON; 696 + err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1); 697 + if (!err) 698 + dev_dbg(pulse8->dev, "Auto Power On: %s", 699 + data[0] ? "on" : "off"); 700 + } 701 + 700 702 cmd[0] = MSGCODE_GET_DEVICE_TYPE; 701 703 err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1); 702 704 if (err) ··· 766 752 dev_dbg(pulse8->dev, "Physical address: %x.%x.%x.%x\n", 767 753 cec_phys_addr_exp(*pa)); 768 754 769 - cmd[0] = MSGCODE_GET_HDMI_VERSION; 770 - err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1); 771 - if (err) 772 - return err; 773 - log_addrs->cec_version = data[0]; 774 - dev_dbg(pulse8->dev, "CEC version: %d\n", log_addrs->cec_version); 755 + log_addrs->cec_version = CEC_OP_CEC_VERSION_1_4; 756 + if (pulse8->vers < 10) { 757 + cmd[0] = MSGCODE_GET_HDMI_VERSION; 758 + err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1); 759 + if (err) 760 + return err; 761 + log_addrs->cec_version = data[0]; 762 + dev_dbg(pulse8->dev, "CEC version: %d\n", log_addrs->cec_version); 763 + } 775 764 776 765 cmd[0] = MSGCODE_GET_OSD_NAME; 777 766 err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 0);