Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1698092

Re: [PATCH v2 1/2] platform: Add Amlogic Meson AO CEC Controller driver

From Neil Armstrong <narmstrong@baylibre.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/2] platform: Add Amlogic Meson AO CEC Controller driver
Date 2017-07-27 17:20 +0200
Message-ID <u7SJZ-7Iw-33@gated-at.bofh.it> (permalink)
References (1 earlier) <u1BVw-2uD-27@gated-at.bofh.it> <u49gm-2si-19@gated-at.bofh.it> <u77i1-2MX-7@gated-at.bofh.it> <u78nM-3qY-23@gated-at.bofh.it> <u7SgX-7jy-31@gated-at.bofh.it>
Organization Baylibre

Show all headers | View raw


On 07/27/2017 04:43 PM, Neil Armstrong wrote:
> On 07/25/2017 03:45 PM, Hans Verkuil wrote:
>> On 07/25/17 14:34, Neil Armstrong wrote:
>>> Hi Hans,
>>
>>>>> +static int meson_ao_cec_probe(struct platform_device *pdev)
>>>>> +{
>>>>> +	struct meson_ao_cec_device *ao_cec;
>>>>> +	struct platform_device *hdmi_dev;
>>>>> +	struct device_node *np;
>>>>> +	struct resource *res;
>>>>> +	int ret, irq;
>>>>> +
>>>>> +	np = of_parse_phandle(pdev->dev.of_node, "hdmi-phandle", 0);
>>>>> +	if (!np) {
>>>>> +		dev_err(&pdev->dev, "Failed to find hdmi node\n");
>>>>> +		return -ENODEV;
>>>>> +	}
>>>>> +
>>>>> +	hdmi_dev = of_find_device_by_node(np);
>>>>> +	if (hdmi_dev == NULL)
>>>>> +		return -EPROBE_DEFER;
>>>>> +
>>>>> +	ao_cec = devm_kzalloc(&pdev->dev, sizeof(*ao_cec), GFP_KERNEL);
>>>>> +	if (!ao_cec)
>>>>> +		return -ENOMEM;
>>>>> +
>>>>> +	spin_lock_init(&ao_cec->cec_reg_lock);
>>>>> +
>>>>> +	ao_cec->notify = cec_notifier_get(&hdmi_dev->dev);
>>>>> +	if (!ao_cec->notify)
>>>>> +		return -ENOMEM;
>>>>> +
>>>>> +	ao_cec->adap = cec_allocate_adapter(&meson_ao_cec_ops, ao_cec,
>>>>> +					    "meson_ao_cec",
>>>>> +					    CEC_CAP_LOG_ADDRS |
>>>>> +					    CEC_CAP_TRANSMIT |
>>>>> +					    CEC_CAP_RC |
>>>>> +					    CEC_CAP_PASSTHROUGH,
>>>>> +					    1); /* Use 1 for now */
>>>>
>>>> I recommend that you add support for 2 logical addresses. More isn't allowed
>>>> by the CEC 2.0 spec anyway (no such restriction for CEC 1.4, but more than
>>>> two really isn't needed).
>>>
>>> I know, but in the "communication" register with the suspend/poweroff firmware
>>> that  handles the wake up, only a single logical address is supported...
>>>
>>> What should I do in this case ? Which logical adress should I pass to the firmware when implementing ir ?
>>
>> Ah, OK. Interesting.
>>
>> From cec-adap.c:
>>
>>                 if (log_addrs->num_log_addrs == 2) {
>>                         if (!(type_mask & ((1 << CEC_LOG_ADDR_TYPE_AUDIOSYSTEM) |
>>                                            (1 << CEC_LOG_ADDR_TYPE_TV)))) {
>>                                 dprintk(1, "two LAs is only allowed for audiosystem and TV\n");
>>                                 return -EINVAL;
>>                         }
>>                         if (!(type_mask & ((1 << CEC_LOG_ADDR_TYPE_PLAYBACK) |
>>                                            (1 << CEC_LOG_ADDR_TYPE_RECORD)))) {
>>                                 dprintk(1, "an audiosystem/TV can only be combined with record or playback\n");
>>                                 return -EINVAL;
>>                         }
>>                 }
>>
>> So you would store the TV or AUDIOSYSTEM logical address in the firmware, since those
>> describe the system best.
>>
>> I.e. it is a TV/Audiosystem with recording/playback capabilities.
>>
>> The problem is that for CEC 1.4 no such restriction is imposed (the test above is
>> specific to CEC 2.0). But I think it makes sense to just check if TV/Audiosystem
>> is selected and pick that as the LA to store in the firmware, and otherwise just
>> pick the first LA (log_addr[0]).
> 
> 
> Ok I'll add support for dual LA, and I'll do this LA selection when I'll add firmware support.

Sorry, but having more than 1 LA makes the CEC controller very unstable, I'll need more info from amlogic to activate multiple LAs.

Neil

> 
> Thanks,
> Neil
> 
> 
>> Regards,
>>
>> 	Hans
>>
> 

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2 1/2] platform: Add Amlogic Meson AO CEC Controller  driver Neil Armstrong <narmstrong@baylibre.com> - 2017-07-25 14:40 +0200
  Re: [PATCH v2 1/2] platform: Add Amlogic Meson AO CEC Controller  driver Hans Verkuil <hverkuil@xs4all.nl> - 2017-07-25 15:50 +0200
    Re: [PATCH v2 1/2] platform: Add Amlogic Meson AO CEC Controller  driver Neil Armstrong <narmstrong@baylibre.com> - 2017-07-27 16:50 +0200
      Re: [PATCH v2 1/2] platform: Add Amlogic Meson AO CEC Controller  driver Neil Armstrong <narmstrong@baylibre.com> - 2017-07-27 17:20 +0200

csiph-web