mcp48x1.c (93f31c05) mcp48x1.c (da38dc41)
1/* $NetBSD: mcp48x1.c,v 1.2 2022/01/19 05:05:45 thorpej Exp $ */
1/* $NetBSD: mcp48x1.c,v 1.3 2022/01/19 05:21:44 thorpej Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Radoslaw Kujawa.
9 *

--- 15 unchanged lines hidden (view full) ---

25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#include <sys/cdefs.h>
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Radoslaw Kujawa.
9 *

--- 15 unchanged lines hidden (view full) ---

25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: mcp48x1.c,v 1.2 2022/01/19 05:05:45 thorpej Exp $");
33__KERNEL_RCSID(0, "$NetBSD: mcp48x1.c,v 1.3 2022/01/19 05:21:44 thorpej Exp $");
34
35/*
36 * Driver for Microchip MCP4801/MCP4811/MCP4821 DAC.
37 *
38 * XXX: needs more testing.
39 */
40
41#include <sys/param.h>

--- 92 unchanged lines hidden (view full) ---

134 sa = aux;
135 sc = device_private(self);
136 sc->sc_dev = self;
137 sc->sc_sh = sa->sa_handle;
138 cf_flags = device_cfdata(sc->sc_dev)->cf_flags;
139
140 sc->sc_dm = &mcp48x1_models[cf_flags]; /* flag value defines model */
141
34
35/*
36 * Driver for Microchip MCP4801/MCP4811/MCP4821 DAC.
37 *
38 * XXX: needs more testing.
39 */
40
41#include <sys/param.h>

--- 92 unchanged lines hidden (view full) ---

134 sa = aux;
135 sc = device_private(self);
136 sc->sc_dev = self;
137 sc->sc_sh = sa->sa_handle;
138 cf_flags = device_cfdata(sc->sc_dev)->cf_flags;
139
140 sc->sc_dm = &mcp48x1_models[cf_flags]; /* flag value defines model */
141
142 error = spi_configure(sa->sa_handle, SPI_MODE_0, 20000000);
142 error = spi_configure(self, sa->sa_handle, SPI_MODE_0, 20000000);
143 if (error) {
143 if (error) {
144 aprint_error_dev(self,
145 "failed to set Mode 0 @ 20MHz, error=%d\n", error);
146 return;
147 }
148
149 if(!mcp48x1dac_envsys_attach(sc)) {
150 aprint_error_dev(sc->sc_dev, "failed to attach envsys\n");
151 return;
152 };
153

--- 170 unchanged lines hidden ---
144 return;
145 }
146
147 if(!mcp48x1dac_envsys_attach(sc)) {
148 aprint_error_dev(sc->sc_dev, "failed to attach envsys\n");
149 return;
150 };
151

--- 170 unchanged lines hidden ---