From nobody Wed May 8 14:18:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1505825959500690.0758867137264; Tue, 19 Sep 2017 05:59:19 -0700 (PDT) Received: from localhost ([::1]:42691 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duI7S-00034h-Fl for importer@patchew.org; Tue, 19 Sep 2017 08:59:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duHgC-0004yA-At for qemu-devel@nongnu.org; Tue, 19 Sep 2017 08:31:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duHg6-0005yw-4L for qemu-devel@nongnu.org; Tue, 19 Sep 2017 08:31:08 -0400 Received: from mail-qk0-x244.google.com ([2607:f8b0:400d:c09::244]:33146) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1duHg5-0005ya-VX; Tue, 19 Sep 2017 08:31:02 -0400 Received: by mail-qk0-x244.google.com with SMTP id g128so2160048qke.0; Tue, 19 Sep 2017 05:31:01 -0700 (PDT) Received: from yoga.offpageads.com ([181.93.89.178]) by smtp.gmail.com with ESMTPSA id s43sm7066033qta.31.2017.09.19.05.30.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Sep 2017 05:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/bKIVRLW3IlxxSQsnJe16diIs0PTxcNz2vOPa7E4WcA=; b=Ev8EJuP7udb8BoEn8EDo2I94nau2RS81JToe/xiBnreAcwUr+oc/aRhTWFfjaQROZ9 wXWe2wYQHKOPnBvs92xhenZpmxjAf9c4/M0zMbBoaam/IU93Ho/KXB+0gVAPknpp1ncf OMt1G9iegWTd+itlQZpLK2sEDjx8h4AF0CUuACmEzyvwgc1XW1lrKobGeIBIraCr5fnO 9xlRkVGTqkyDEFyQyhQxIrzYhEQ4yg0uWJFK10PWA2gYunXALroT+5pExKswWrROvOOp rYnm4YGNZPbR9oH+8ZPuLBuyoPxLfRBE8fyai4cVl0tmJadFJDAXy2ohBlRPiLfCBZsR gvQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=/bKIVRLW3IlxxSQsnJe16diIs0PTxcNz2vOPa7E4WcA=; b=A3tTntLrorkVdUw1pHE0xKCLoVsH55PL2HlT+Hml36E8aBoFFNTESQKhkRv4wEpwX1 GbnLkqi66cdLEDcCVKQYu0V+E1J+Pl2xuH/5XdoX1Bwrtp7fS7Q/PurwkiC2T5+L5xRz +iaBRiyqq8tU4i8KbB69HXYfamfFYXxsgf7bc51uE330bPjQIPC7fG8QqOiMJ4Xlx/Qy Z8kTCzlDtGJphV3FOtb7zB3+MmYSGCmCzZXZ4rf1Z0yuAfniyMMbjKE0S+DwOsrD9X4H 6LnWWMUQiue3F9gYyeVXltj8MQ21o8ZattvmroB1pBH72+JxBbYPRL1ANKbKfvFBabPz AwpA== X-Gm-Message-State: AHPjjUhbVyg86s+HdbEDp05bepAqwF+4unqj4SzEJ9640lcL38KMjIsC tTceqCvowOimPxd5prDTe3A= X-Google-Smtp-Source: AOwi7QAYlW+e52sx9ZuyOELtnuvoVkMR3+QMpZkp+NJZL19IFY23u5jv/tuUVALz6veuGSrr3lTNkA== X-Received: by 10.55.125.7 with SMTP id y7mr1674519qkc.206.1505824261314; Tue, 19 Sep 2017 05:31:01 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Jan Kiszka , Peter Maydell , Andrzej Zaborowski , Gerd Hoffmann Date: Tue, 19 Sep 2017 09:30:53 -0300 Message-Id: <20170919123053.32675-1-f4bug@amsat.org> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::244 Subject: [Qemu-devel] [PATCH] hw/audio/wm8750: move WM8750 declarations from i2c/i2c.h to audio/wm8750.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 while here use TYPE_WM8750 and declare a data_req_cb() typedef. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/audio/wm8750.h | 30 ++++++++++++++++++++++++++++++ include/hw/i2c/i2c.h | 9 --------- hw/arm/musicpal.c | 3 ++- hw/arm/spitz.c | 3 ++- hw/arm/z2.c | 3 ++- hw/audio/marvell_88w8618.c | 1 + hw/audio/wm8750.c | 6 ++---- 7 files changed, 39 insertions(+), 16 deletions(-) create mode 100644 include/hw/audio/wm8750.h diff --git a/include/hw/audio/wm8750.h b/include/hw/audio/wm8750.h new file mode 100644 index 0000000000..9ff976d4b8 --- /dev/null +++ b/include/hw/audio/wm8750.h @@ -0,0 +1,30 @@ +/* + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2 or later, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License f= or + * more details. + * + * You should have received a copy of the GNU General Public License along= with + * this program. If not, see . + */ +#ifndef HW_DAC_WM8750_H +#define HW_DAC_WM8750_H + +#include "hw/hw.h" + +#define TYPE_WM8750 "wm8750" + +typedef void data_req_cb(void *opaque, int free_out, int free_in); + +void wm8750_data_req_set(DeviceState *dev, data_req_cb *data_req, void *op= aque); +void wm8750_dac_dat(void *opaque, uint32_t sample); +uint32_t wm8750_adc_dat(void *opaque); +void *wm8750_dac_buffer(void *opaque, int samples); +void wm8750_dac_commit(void *opaque); +void wm8750_set_bclk_in(void *opaque, int new_hz); + +#endif diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h index 2ce611d4c8..24e95d0155 100644 --- a/include/hw/i2c/i2c.h +++ b/include/hw/i2c/i2c.h @@ -70,15 +70,6 @@ int i2c_recv(I2CBus *bus); =20 DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr); =20 -/* wm8750.c */ -void wm8750_data_req_set(DeviceState *dev, - void (*data_req)(void *, int, int), void *opaque); -void wm8750_dac_dat(void *opaque, uint32_t sample); -uint32_t wm8750_adc_dat(void *opaque); -void *wm8750_dac_buffer(void *opaque, int samples); -void wm8750_dac_commit(void *opaque); -void wm8750_set_bclk_in(void *opaque, int new_hz); - /* lm832x.c */ void lm832x_key_event(DeviceState *dev, int key, int state); =20 diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index ab4ba31a24..b5e25d417c 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -25,6 +25,7 @@ #include "hw/block/flash.h" #include "ui/console.h" #include "hw/i2c/i2c.h" +#include "hw/audio/wm8750.h" #include "sysemu/block-backend.h" #include "exec/address-spaces.h" #include "ui/pixel_ops.h" @@ -1699,7 +1700,7 @@ static void musicpal_init(MachineState *machine) qdev_connect_gpio_out(key_dev, i, qdev_get_gpio_in(dev, i + 15)); } =20 - wm8750_dev =3D i2c_create_slave(i2c, "wm8750", MP_WM_ADDR); + wm8750_dev =3D i2c_create_slave(i2c, TYPE_WM8750, MP_WM_ADDR); dev =3D qdev_create(NULL, "mv88w8618_audio"); s =3D SYS_BUS_DEVICE(dev); qdev_prop_set_ptr(dev, "wm8750", wm8750_dev); diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index 6406421d0c..2ae611d785 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -24,6 +24,7 @@ #include "hw/devices.h" #include "hw/arm/sharpsl.h" #include "ui/console.h" +#include "hw/audio/wm8750.h" #include "audio/audio.h" #include "hw/boards.h" #include "sysemu/block-backend.h" @@ -745,7 +746,7 @@ static void spitz_i2c_setup(PXA2xxState *cpu) DeviceState *wm; =20 /* Attach a WM8750 to the bus */ - wm =3D i2c_create_slave(bus, "wm8750", 0); + wm =3D i2c_create_slave(bus, TYPE_WM8750, 0); =20 spitz_wm8750_addr(wm, 0, 0); qdev_connect_gpio_out(cpu->gpio, SPITZ_GPIO_WM, diff --git a/hw/arm/z2.c b/hw/arm/z2.c index 417bc1ac33..4541dc3054 100644 --- a/hw/arm/z2.c +++ b/hw/arm/z2.c @@ -23,6 +23,7 @@ #include "hw/block/flash.h" #include "sysemu/block-backend.h" #include "ui/console.h" +#include "hw/audio/wm8750.h" #include "audio/audio.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h" @@ -350,7 +351,7 @@ static void z2_init(MachineState *machine) z2_lcd =3D ssi_create_slave(mpu->ssp[1], "zipit-lcd"); bus =3D pxa2xx_i2c_bus(mpu->i2c[0]); i2c_create_slave(bus, TYPE_AER915, 0x55); - wm =3D i2c_create_slave(bus, "wm8750", 0x1b); + wm =3D i2c_create_slave(bus, TYPE_WM8750, 0x1b); mpu->i2s->opaque =3D wm; mpu->i2s->codec_out =3D wm8750_dac_dat; mpu->i2s->codec_in =3D wm8750_adc_dat; diff --git a/hw/audio/marvell_88w8618.c b/hw/audio/marvell_88w8618.c index 4f65f8c199..e546892d3c 100644 --- a/hw/audio/marvell_88w8618.c +++ b/hw/audio/marvell_88w8618.c @@ -13,6 +13,7 @@ #include "hw/sysbus.h" #include "hw/hw.h" #include "hw/i2c/i2c.h" +#include "hw/audio/wm8750.h" #include "audio/audio.h" =20 #define MP_AUDIO_SIZE 0x00001000 diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c index d2bf2e1da1..7624bc1bf0 100644 --- a/hw/audio/wm8750.c +++ b/hw/audio/wm8750.c @@ -8,8 +8,8 @@ */ =20 #include "qemu/osdep.h" -#include "hw/hw.h" #include "hw/i2c/i2c.h" +#include "hw/audio/wm8750.h" #include "audio/audio.h" =20 #define IN_PORT_N 3 @@ -24,7 +24,6 @@ typedef struct { int dac_hz; } WMRate; =20 -#define TYPE_WM8750 "wm8750" #define WM8750(obj) OBJECT_CHECK(WM8750State, (obj), TYPE_WM8750) =20 typedef struct WM8750State { @@ -637,8 +636,7 @@ static void wm8750_fini(I2CSlave *i2c) } #endif =20 -void wm8750_data_req_set(DeviceState *dev, - void (*data_req)(void *, int, int), void *opaque) +void wm8750_data_req_set(DeviceState *dev, data_req_cb *data_req, void *op= aque) { WM8750State *s =3D WM8750(dev); =20 --=20 2.14.1