Changeset a64970e1 in mainline


Ignore:
Timestamp:
2025-03-05T19:25:06Z (18 hours ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
07039850
Parents:
89b5a75
Message:

Implement quiesce in HD Audio and SB16 drivers.

Location:
uspace/drv/audio
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/audio/hdaudio/hdactl.c

    r89b5a75 ra64970e1  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    628628}
    629629
     630void hda_ctl_quiesce(hda_ctl_t *ctl)
     631{
     632        uint32_t gctl;
     633
     634        ddf_msg(LVL_DEBUG, "hda_ctl_quiesce(): Resetting controller.");
     635        gctl = hda_reg32_read(&ctl->hda->regs->gctl);
     636        hda_reg32_write(&ctl->hda->regs->gctl,
     637            gctl & ~BIT_V(uint32_t, gctl_crst));
     638}
     639
    630640errno_t hda_cmd(hda_t *hda, uint32_t verb, uint32_t *resp)
    631641{
  • uspace/drv/audio/hdaudio/hdactl.h

    r89b5a75 ra64970e1  
    11/*
    2  * Copyright (c) 2014 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    7777extern hda_ctl_t *hda_ctl_init(hda_t *);
    7878extern void hda_ctl_fini(hda_ctl_t *);
     79extern void hda_ctl_quiesce(hda_ctl_t *);
    7980extern void hda_ctl_interrupt(hda_ctl_t *);
    8081extern errno_t hda_cmd(hda_t *, uint32_t, uint32_t *);
  • uspace/drv/audio/hdaudio/hdaudio.c

    r89b5a75 ra64970e1  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    5555static errno_t hda_dev_remove(ddf_dev_t *dev);
    5656static errno_t hda_dev_gone(ddf_dev_t *dev);
     57static errno_t hda_dev_quiesce(ddf_dev_t *dev);
    5758static errno_t hda_fun_online(ddf_fun_t *fun);
    5859static errno_t hda_fun_offline(ddf_fun_t *fun);
     
    6162
    6263static driver_ops_t driver_ops = {
    63         .dev_add = &hda_dev_add,
    64         .dev_remove = &hda_dev_remove,
    65         .dev_gone = &hda_dev_gone,
    66         .fun_online = &hda_fun_online,
    67         .fun_offline = &hda_fun_offline
     64        .dev_add = hda_dev_add,
     65        .dev_remove = hda_dev_remove,
     66        .dev_gone = hda_dev_gone,
     67        .dev_quiesce = hda_dev_quiesce,
     68        .fun_online = hda_fun_online,
     69        .fun_offline = hda_fun_offline
    6870};
    6971
     
    362364        }
    363365
     366        return EOK;
     367}
     368
     369static errno_t hda_dev_quiesce(ddf_dev_t *dev)
     370{
     371        hda_t *hda = (hda_t *)ddf_dev_data_get(dev);
     372
     373        ddf_msg(LVL_DEBUG, "hda_dev_quiesce(%p)", dev);
     374
     375        hda_ctl_quiesce(hda->ctl);
    364376        return EOK;
    365377}
  • uspace/drv/audio/sb16/dsp.c

    r89b5a75 ra64970e1  
    11/*
     2 * Copyright (c) 2025 Jiri Svoboda
    23 * Copyright (c) 2011 Jan Vesely
    34 * All rights reserved.
     
    7475                [DSP_READY] = "READY",
    7576                [DSP_NO_BUFFER] = "NO BUFFER",
     77                [DSP_QUIESCED] = "QUIESCED"
    7678        };
    7779        if ((size_t)state < ARRAY_SIZE(state_names))
     
    8385{
    8486        assert(dsp);
     87        if (dsp->state == DSP_QUIESCED)
     88                return;
     89
    8590        ddf_log_verbose("Changing state from %s to %s",
    8691            dsp_state_to_str(dsp->state), dsp_state_to_str(state));
     
    230235
    231236        return ret;
     237}
     238
     239void sb_dsp_quiesce(sb_dsp_t *dsp)
     240{
     241        dsp->state = DSP_QUIESCED;
     242        dsp_reset(dsp);
    232243}
    233244
  • uspace/drv/audio/sb16/dsp.h

    r89b5a75 ra64970e1  
    11/*
     2 * Copyright (c) 2025 Jiri Svoboda
    23 * Copyright (c) 2011 Jan Vesely
    34 * All rights reserved.
     
    5152        DSP_READY,
    5253        DSP_NO_BUFFER,
     54        DSP_QUIESCED
    5355} dsp_state_t;
    5456
     
    7880errno_t sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs, ddf_dev_t *dev,
    7981    int dma8, int dma16);
     82void sb_dsp_quiesce(sb_dsp_t *dsp);
    8083void sb_dsp_interrupt(sb_dsp_t *dsp);
    8184unsigned sb_dsp_query_cap(sb_dsp_t *dsp, audio_cap_t cap);
  • uspace/drv/audio/sb16/main.c

    r89b5a75 ra64970e1  
    11/*
     2 * Copyright (c) 2025 Jiri Svoboda
    23 * Copyright (c) 2011 Jan Vesely
    34 * Copyright (c) 2011 Vojtech Horky
     
    4849
    4950static errno_t sb_add_device(ddf_dev_t *device);
     51static errno_t sb_dev_quiesce(ddf_dev_t *device);
    5052static errno_t sb_get_res(ddf_dev_t *device, addr_range_t **pp_sb_regs,
    5153    addr_range_t **pp_mpu_regs, int *irq, int *dma8, int *dma16);
     
    5456static driver_ops_t sb_driver_ops = {
    5557        .dev_add = sb_add_device,
     58        .dev_quiesce = sb_dev_quiesce
    5659};
    5760
     
    178181}
    179182
     183/** Initialize new SB16 driver instance.
     184 *
     185 * @param[in] device DDF instance of the device to initialize.
     186 * @return Error code.
     187 */
     188static errno_t sb_dev_quiesce(ddf_dev_t *device)
     189{
     190        sb16_t *soft_state = (sb16_t *)ddf_dev_data_get(device);
     191
     192        return sb16_quiesce(soft_state);
     193}
     194
    180195static errno_t sb_get_res(ddf_dev_t *device, addr_range_t **pp_sb_regs,
    181196    addr_range_t **pp_mpu_regs, int *irq, int *dma8, int *dma16)
  • uspace/drv/audio/sb16/sb16.c

    r89b5a75 ra64970e1  
    11/*
     2 * Copyright (c) 2025 Jiri Svoboda
    23 * Copyright (c) 2011 Jan Vesely
    34 * All rights reserved.
     
    191192}
    192193
     194errno_t sb16_quiesce(sb16_t *sb)
     195{
     196        sb_dsp_quiesce(&sb->dsp);
     197        return EOK;
     198}
     199
    193200void sb16_interrupt(sb16_t *sb)
    194201{
  • uspace/drv/audio/sb16/sb16.h

    r89b5a75 ra64970e1  
    11/*
     2 * Copyright (c) 2025 Jiri Svoboda
    23 * Copyright (c) 2011 Jan Vesely
    34 * All rights reserved.
     
    5556errno_t sb16_init_sb16(sb16_t *sb, addr_range_t *regs, ddf_dev_t *dev, int dma8, int dma16);
    5657errno_t sb16_init_mpu(sb16_t *sb, addr_range_t *regs);
     58errno_t sb16_quiesce(sb16_t *sb);
    5759void sb16_interrupt(sb16_t *sb);
    5860
Note: See TracChangeset for help on using the changeset viewer.