diff mbox series

[PATCH-for-10.0,01/12] hw/audio/wm8750: Categorize and add description

Message ID 20250325224310.8785-2-philmd@linaro.org
State New
Headers show
Series hw: Categorize few devices and add their descriptions | expand

Commit Message

Philippe Mathieu-Daudé March 25, 2025, 10:42 p.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/audio/wm8750.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Thomas Huth March 26, 2025, 6:47 a.m. UTC | #1
On 25/03/2025 23.42, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/audio/wm8750.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c
> index 8d381dbc658..6c1bb20fb75 100644
> --- a/hw/audio/wm8750.c
> +++ b/hw/audio/wm8750.c
> @@ -721,6 +721,8 @@ static void wm8750_class_init(ObjectClass *klass, void *data)
>       sc->send = wm8750_tx;
>       dc->vmsd = &vmstate_wm8750;
>       device_class_set_props(dc, wm8750_properties);
> +    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
> +    dc->desc = "WM8750 Stereo CODEC";
>   }
>   
>   static const TypeInfo wm8750_info = {

Reviewed-by: Thomas Huth <thuth@redhat.com>
Thomas Huth March 26, 2025, 6:57 a.m. UTC | #2
On 26/03/2025 07.47, Thomas Huth wrote:
> On 25/03/2025 23.42, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   hw/audio/wm8750.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c
>> index 8d381dbc658..6c1bb20fb75 100644
>> --- a/hw/audio/wm8750.c
>> +++ b/hw/audio/wm8750.c
>> @@ -721,6 +721,8 @@ static void wm8750_class_init(ObjectClass *klass, void 
>> *data)
>>       sc->send = wm8750_tx;
>>       dc->vmsd = &vmstate_wm8750;
>>       device_class_set_props(dc, wm8750_properties);
>> +    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
>> +    dc->desc = "WM8750 Stereo CODEC";
>>   }
>>   static const TypeInfo wm8750_info = {
> 
> Reviewed-by: Thomas Huth <thuth@redhat.com>

Looking at this twice, I think the patch is not OK in its current shape: The 
wm8750 device now shows up twice in the output of "-device help", once in 
the "Sound" category and once in the "Misc" category (inherited from I2C 
device). That's somewhat ugly. I guess you'd need to remove the MISC bit 
here to clean that up?

  Thomas
BALATON Zoltan March 26, 2025, 12:39 p.m. UTC | #3
On Wed, 26 Mar 2025, Thomas Huth wrote:
> On 26/03/2025 07.47, Thomas Huth wrote:
>> On 25/03/2025 23.42, Philippe Mathieu-Daudé wrote:
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>> ---
>>>   hw/audio/wm8750.c | 2 ++
>>>   1 file changed, 2 insertions(+)
>>> 
>>> diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c
>>> index 8d381dbc658..6c1bb20fb75 100644
>>> --- a/hw/audio/wm8750.c
>>> +++ b/hw/audio/wm8750.c
>>> @@ -721,6 +721,8 @@ static void wm8750_class_init(ObjectClass *klass, void 
>>> *data)
>>>       sc->send = wm8750_tx;
>>>       dc->vmsd = &vmstate_wm8750;
>>>       device_class_set_props(dc, wm8750_properties);
>>> +    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
>>> +    dc->desc = "WM8750 Stereo CODEC";
>>>   }
>>>   static const TypeInfo wm8750_info = {
>> 
>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>
> Looking at this twice, I think the patch is not OK in its current shape: The 
> wm8750 device now shows up twice in the output of "-device help", once in the 
> "Sound" category and once in the "Misc" category (inherited from I2C device). 
> That's somewhat ugly. I guess you'd need to remove the MISC bit here to clean 
> that up?

Maybe we could add an i2c category for those devices? But in this case it 
fits in multiple categories.

Regards,
BALATON Zoltan
Thomas Huth March 26, 2025, 12:46 p.m. UTC | #4
On 26/03/2025 13.39, BALATON Zoltan wrote:
> On Wed, 26 Mar 2025, Thomas Huth wrote:
>> On 26/03/2025 07.47, Thomas Huth wrote:
>>> On 25/03/2025 23.42, Philippe Mathieu-Daudé wrote:
>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>>> ---
>>>>   hw/audio/wm8750.c | 2 ++
>>>>   1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c
>>>> index 8d381dbc658..6c1bb20fb75 100644
>>>> --- a/hw/audio/wm8750.c
>>>> +++ b/hw/audio/wm8750.c
>>>> @@ -721,6 +721,8 @@ static void wm8750_class_init(ObjectClass *klass, 
>>>> void *data)
>>>>       sc->send = wm8750_tx;
>>>>       dc->vmsd = &vmstate_wm8750;
>>>>       device_class_set_props(dc, wm8750_properties);
>>>> +    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
>>>> +    dc->desc = "WM8750 Stereo CODEC";
>>>>   }
>>>>   static const TypeInfo wm8750_info = {
>>>
>>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>>
>> Looking at this twice, I think the patch is not OK in its current shape: 
>> The wm8750 device now shows up twice in the output of "-device help", once 
>> in the "Sound" category and once in the "Misc" category (inherited from 
>> I2C device). That's somewhat ugly. I guess you'd need to remove the MISC 
>> bit here to clean that up?
> 
> Maybe we could add an i2c category for those devices? But in this case it 
> fits in multiple categories.

I think we should aim for the most specific category only. For example, we 
also have things like "usb-mouse" or "usb-tablet", but these only show up in 
the "input" category, and not in the "USB device" category.

By the way, it's somewhat weird that we have a USB category, but not a PCI 
or I2C category ... maybe we should rather get rid of that USB category and 
classify the HCDs as "controller/bridges" like we do it for the PCI host 
controllers?

  Thomas
diff mbox series

Patch

diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c
index 8d381dbc658..6c1bb20fb75 100644
--- a/hw/audio/wm8750.c
+++ b/hw/audio/wm8750.c
@@ -721,6 +721,8 @@  static void wm8750_class_init(ObjectClass *klass, void *data)
     sc->send = wm8750_tx;
     dc->vmsd = &vmstate_wm8750;
     device_class_set_props(dc, wm8750_properties);
+    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
+    dc->desc = "WM8750 Stereo CODEC";
 }
 
 static const TypeInfo wm8750_info = {