summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/hdaudio.h5
-rw-r--r--include/sound/hdaudio_ext.h17
-rw-r--r--sound/hda/ext/hdac_ext_bus.c30
-rw-r--r--sound/soc/codecs/hdac_hdmi.c12
4 files changed, 26 insertions, 38 deletions
diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h
index 9735b51aef08..59ffe63cf194 100644
--- a/include/sound/hdaudio.h
+++ b/include/sound/hdaudio.h
@@ -188,6 +188,11 @@ struct hdac_driver {
188 const struct hda_device_id *id_table; 188 const struct hda_device_id *id_table;
189 int (*match)(struct hdac_device *dev, struct hdac_driver *drv); 189 int (*match)(struct hdac_device *dev, struct hdac_driver *drv);
190 void (*unsol_event)(struct hdac_device *dev, unsigned int event); 190 void (*unsol_event)(struct hdac_device *dev, unsigned int event);
191
192 /* fields used by ext bus APIs */
193 int (*probe)(struct hdac_device *dev);
194 int (*remove)(struct hdac_device *dev);
195 void (*shutdown)(struct hdac_device *dev);
191}; 196};
192 197
193#define drv_to_hdac_driver(_drv) container_of(_drv, struct hdac_driver, driver) 198#define drv_to_hdac_driver(_drv) container_of(_drv, struct hdac_driver, driver)
diff --git a/include/sound/hdaudio_ext.h b/include/sound/hdaudio_ext.h
index e5b0cd1ade19..3c302477750b 100644
--- a/include/sound/hdaudio_ext.h
+++ b/include/sound/hdaudio_ext.h
@@ -160,20 +160,7 @@ struct hdac_ext_dma_params {
160 u8 stream_tag; 160 u8 stream_tag;
161}; 161};
162 162
163/* 163int snd_hda_ext_driver_register(struct hdac_driver *drv);
164 * HD-audio codec base driver 164void snd_hda_ext_driver_unregister(struct hdac_driver *drv);
165 */
166struct hdac_ext_driver {
167 struct hdac_driver hdac;
168
169 int (*probe)(struct hdac_device *dev);
170 int (*remove)(struct hdac_device *dev);
171 void (*shutdown)(struct hdac_device *dev);
172};
173
174int snd_hda_ext_driver_register(struct hdac_ext_driver *drv);
175void snd_hda_ext_driver_unregister(struct hdac_ext_driver *drv);
176
177#define to_ehdac_driver(_drv) container_of(_drv, struct hdac_ext_driver, hdac)
178 165
179#endif /* __SOUND_HDAUDIO_EXT_H */ 166#endif /* __SOUND_HDAUDIO_EXT_H */
diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c
index 77547ede9ae8..52f07766fff3 100644
--- a/sound/hda/ext/hdac_ext_bus.c
+++ b/sound/hda/ext/hdac_ext_bus.c
@@ -200,12 +200,10 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_remove);
200#define dev_to_hdac(dev) (container_of((dev), \ 200#define dev_to_hdac(dev) (container_of((dev), \
201 struct hdac_device, dev)) 201 struct hdac_device, dev))
202 202
203static inline struct hdac_ext_driver *get_edrv(struct device *dev) 203static inline struct hdac_driver *get_hdrv(struct device *dev)
204{ 204{
205 struct hdac_driver *hdrv = drv_to_hdac_driver(dev->driver); 205 struct hdac_driver *hdrv = drv_to_hdac_driver(dev->driver);
206 struct hdac_ext_driver *edrv = to_ehdac_driver(hdrv); 206 return hdrv;
207
208 return edrv;
209} 207}
210 208
211static inline struct hdac_device *get_hdev(struct device *dev) 209static inline struct hdac_device *get_hdev(struct device *dev)
@@ -216,17 +214,17 @@ static inline struct hdac_device *get_hdev(struct device *dev)
216 214
217static int hda_ext_drv_probe(struct device *dev) 215static int hda_ext_drv_probe(struct device *dev)
218{ 216{
219 return (get_edrv(dev))->probe(get_hdev(dev)); 217 return (get_hdrv(dev))->probe(get_hdev(dev));
220} 218}
221 219
222static int hdac_ext_drv_remove(struct device *dev) 220static int hdac_ext_drv_remove(struct device *dev)
223{ 221{
224 return (get_edrv(dev))->remove(get_hdev(dev)); 222 return (get_hdrv(dev))->remove(get_hdev(dev));
225} 223}
226 224
227static void hdac_ext_drv_shutdown(struct device *dev) 225static void hdac_ext_drv_shutdown(struct device *dev)
228{ 226{
229 return (get_edrv(dev))->shutdown(get_hdev(dev)); 227 return (get_hdrv(dev))->shutdown(get_hdev(dev));
230} 228}
231 229
232/** 230/**
@@ -234,20 +232,20 @@ static void hdac_ext_drv_shutdown(struct device *dev)
234 * 232 *
235 * @drv: ext hda driver structure 233 * @drv: ext hda driver structure
236 */ 234 */
237int snd_hda_ext_driver_register(struct hdac_ext_driver *drv) 235int snd_hda_ext_driver_register(struct hdac_driver *drv)
238{ 236{
239 drv->hdac.type = HDA_DEV_ASOC; 237 drv->type = HDA_DEV_ASOC;
240 drv->hdac.driver.bus = &snd_hda_bus_type; 238 drv->driver.bus = &snd_hda_bus_type;
241 /* we use default match */ 239 /* we use default match */
242 240
243 if (drv->probe) 241 if (drv->probe)
244 drv->hdac.driver.probe = hda_ext_drv_probe; 242 drv->driver.probe = hda_ext_drv_probe;
245 if (drv->remove) 243 if (drv->remove)
246 drv->hdac.driver.remove = hdac_ext_drv_remove; 244 drv->driver.remove = hdac_ext_drv_remove;
247 if (drv->shutdown) 245 if (drv->shutdown)
248 drv->hdac.driver.shutdown = hdac_ext_drv_shutdown; 246 drv->driver.shutdown = hdac_ext_drv_shutdown;
249 247
250 return driver_register(&drv->hdac.driver); 248 return driver_register(&drv->driver);
251} 249}
252EXPORT_SYMBOL_GPL(snd_hda_ext_driver_register); 250EXPORT_SYMBOL_GPL(snd_hda_ext_driver_register);
253 251
@@ -256,8 +254,8 @@ EXPORT_SYMBOL_GPL(snd_hda_ext_driver_register);
256 * 254 *
257 * @drv: ext hda driver structure 255 * @drv: ext hda driver structure
258 */ 256 */
259void snd_hda_ext_driver_unregister(struct hdac_ext_driver *drv) 257void snd_hda_ext_driver_unregister(struct hdac_driver *drv)
260{ 258{
261 driver_unregister(&drv->hdac.driver); 259 driver_unregister(&drv->driver);
262} 260}
263EXPORT_SYMBOL_GPL(snd_hda_ext_driver_unregister); 261EXPORT_SYMBOL_GPL(snd_hda_ext_driver_unregister);
diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index c3ccc8d9c91d..3e3a2a9ef310 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -2186,14 +2186,12 @@ static const struct hda_device_id hdmi_list[] = {
2186 2186
2187MODULE_DEVICE_TABLE(hdaudio, hdmi_list); 2187MODULE_DEVICE_TABLE(hdaudio, hdmi_list);
2188 2188
2189static struct hdac_ext_driver hdmi_driver = { 2189static struct hdac_driver hdmi_driver = {
2190 . hdac = { 2190 .driver = {
2191 .driver = { 2191 .name = "HDMI HDA Codec",
2192 .name = "HDMI HDA Codec", 2192 .pm = &hdac_hdmi_pm,
2193 .pm = &hdac_hdmi_pm,
2194 },
2195 .id_table = hdmi_list,
2196 }, 2193 },
2194 .id_table = hdmi_list,
2197 .probe = hdac_hdmi_dev_probe, 2195 .probe = hdac_hdmi_dev_probe,
2198 .remove = hdac_hdmi_dev_remove, 2196 .remove = hdac_hdmi_dev_remove,
2199}; 2197};